Lines Matching refs:sw
131 struct tb_switch *sw; member
230 int (*approve_switch)(struct tb *tb, struct tb_switch *sw);
231 int (*add_switch_key)(struct tb *tb, struct tb_switch *sw);
232 int (*challenge_switch_key)(struct tb *tb, struct tb_switch *sw,
258 static inline struct tb_port *tb_upstream_port(struct tb_switch *sw) in tb_upstream_port() argument
260 return &sw->ports[sw->config.upstream_port_number]; in tb_upstream_port()
263 static inline u64 tb_route(struct tb_switch *sw) in tb_route() argument
265 return ((u64) sw->config.route_hi) << 32 | sw->config.route_lo; in tb_route()
268 static inline struct tb_port *tb_port_at(u64 route, struct tb_switch *sw) in tb_port_at() argument
272 port = route >> (sw->config.depth * 8); in tb_port_at()
273 if (WARN_ON(port > sw->config.max_port_number)) in tb_port_at()
275 return &sw->ports[port]; in tb_port_at()
278 static inline int tb_sw_read(struct tb_switch *sw, void *buffer, in tb_sw_read() argument
281 return tb_cfg_read(sw->tb->ctl, in tb_sw_read()
283 tb_route(sw), in tb_sw_read()
290 static inline int tb_sw_write(struct tb_switch *sw, void *buffer, in tb_sw_write() argument
293 return tb_cfg_write(sw->tb->ctl, in tb_sw_write()
295 tb_route(sw), in tb_sw_write()
305 return tb_cfg_read(port->sw->tb->ctl, in tb_port_read()
307 tb_route(port->sw), in tb_port_read()
317 return tb_cfg_write(port->sw->tb->ctl, in tb_port_write()
319 tb_route(port->sw), in tb_port_write()
332 #define __TB_SW_PRINT(level, sw, fmt, arg...) \ argument
334 struct tb_switch *__sw = (sw); \
338 #define tb_sw_WARN(sw, fmt, arg...) __TB_SW_PRINT(tb_WARN, sw, fmt, ##arg) argument
339 #define tb_sw_warn(sw, fmt, arg...) __TB_SW_PRINT(tb_warn, sw, fmt, ##arg) argument
340 #define tb_sw_info(sw, fmt, arg...) __TB_SW_PRINT(tb_info, sw, fmt, ##arg) argument
346 level(__port->sw->tb, "%llx:%x: " fmt, \
347 tb_route(__port->sw), __port->port, ## arg); \
377 int tb_domain_approve_switch(struct tb *tb, struct tb_switch *sw);
378 int tb_domain_approve_switch_key(struct tb *tb, struct tb_switch *sw);
379 int tb_domain_challenge_switch_key(struct tb *tb, struct tb_switch *sw);
394 int tb_switch_configure(struct tb_switch *sw);
395 int tb_switch_add(struct tb_switch *sw);
396 void tb_switch_remove(struct tb_switch *sw);
397 void tb_switch_suspend(struct tb_switch *sw);
398 int tb_switch_resume(struct tb_switch *sw);
400 void tb_sw_set_unplugged(struct tb_switch *sw);
401 struct tb_switch *get_switch_at_route(struct tb_switch *sw, u64 route);
407 static inline struct tb_switch *tb_switch_get(struct tb_switch *sw) in tb_switch_get() argument
409 if (sw) in tb_switch_get()
410 get_device(&sw->dev); in tb_switch_get()
411 return sw; in tb_switch_get()
414 static inline void tb_switch_put(struct tb_switch *sw) in tb_switch_put() argument
416 put_device(&sw->dev); in tb_switch_put()
435 int tb_switch_find_vse_cap(struct tb_switch *sw, enum tb_switch_vse_cap vsec);
444 int tb_drom_read(struct tb_switch *sw);
445 int tb_drom_read_uid_only(struct tb_switch *sw, u64 *uid);
455 return port == tb_upstream_port(port->sw); in tb_is_upstream_port()
467 return tb_route(port->sw) in tb_downstream_route()
468 | ((u64) port->port << (port->sw->config.depth * 8)); in tb_downstream_route()