• Home
  • Raw
  • Download

Lines Matching full:sw

118  * @sw: Switch the port belongs to
130 struct tb_switch *sw; member
229 int (*approve_switch)(struct tb *tb, struct tb_switch *sw);
230 int (*add_switch_key)(struct tb *tb, struct tb_switch *sw);
231 int (*challenge_switch_key)(struct tb *tb, struct tb_switch *sw,
257 static inline struct tb_port *tb_upstream_port(struct tb_switch *sw) in tb_upstream_port() argument
259 return &sw->ports[sw->config.upstream_port_number]; in tb_upstream_port()
262 static inline u64 tb_route(struct tb_switch *sw) in tb_route() argument
264 return ((u64) sw->config.route_hi) << 32 | sw->config.route_lo; in tb_route()
267 static inline struct tb_port *tb_port_at(u64 route, struct tb_switch *sw) in tb_port_at() argument
271 port = route >> (sw->config.depth * 8); in tb_port_at()
272 if (WARN_ON(port > sw->config.max_port_number)) in tb_port_at()
274 return &sw->ports[port]; in tb_port_at()
277 static inline int tb_sw_read(struct tb_switch *sw, void *buffer, in tb_sw_read() argument
280 return tb_cfg_read(sw->tb->ctl, in tb_sw_read()
282 tb_route(sw), in tb_sw_read()
289 static inline int tb_sw_write(struct tb_switch *sw, void *buffer, in tb_sw_write() argument
292 return tb_cfg_write(sw->tb->ctl, in tb_sw_write()
294 tb_route(sw), in tb_sw_write()
304 return tb_cfg_read(port->sw->tb->ctl, in tb_port_read()
306 tb_route(port->sw), in tb_port_read()
316 return tb_cfg_write(port->sw->tb->ctl, in tb_port_write()
318 tb_route(port->sw), in tb_port_write()
331 #define __TB_SW_PRINT(level, sw, fmt, arg...) \ argument
333 struct tb_switch *__sw = (sw); \
337 #define tb_sw_WARN(sw, fmt, arg...) __TB_SW_PRINT(tb_WARN, sw, fmt, ##arg) argument
338 #define tb_sw_warn(sw, fmt, arg...) __TB_SW_PRINT(tb_warn, sw, fmt, ##arg) argument
339 #define tb_sw_info(sw, fmt, arg...) __TB_SW_PRINT(tb_info, sw, fmt, ##arg) argument
345 level(__port->sw->tb, "%llx:%x: " fmt, \
346 tb_route(__port->sw), __port->port, ## arg); \
376 int tb_domain_approve_switch(struct tb *tb, struct tb_switch *sw);
377 int tb_domain_approve_switch_key(struct tb *tb, struct tb_switch *sw);
378 int tb_domain_challenge_switch_key(struct tb *tb, struct tb_switch *sw);
393 int tb_switch_configure(struct tb_switch *sw);
394 int tb_switch_add(struct tb_switch *sw);
395 void tb_switch_remove(struct tb_switch *sw);
396 void tb_switch_suspend(struct tb_switch *sw);
397 int tb_switch_resume(struct tb_switch *sw);
399 void tb_sw_set_unplugged(struct tb_switch *sw);
405 static inline struct tb_switch *tb_switch_get(struct tb_switch *sw) in tb_switch_get() argument
407 if (sw) in tb_switch_get()
408 get_device(&sw->dev); in tb_switch_get()
409 return sw; in tb_switch_get()
412 static inline void tb_switch_put(struct tb_switch *sw) in tb_switch_put() argument
414 put_device(&sw->dev); in tb_switch_put()
433 int tb_switch_find_vse_cap(struct tb_switch *sw, enum tb_switch_vse_cap vsec);
442 int tb_drom_read(struct tb_switch *sw);
443 int tb_drom_read_uid_only(struct tb_switch *sw, u64 *uid);
453 return port == tb_upstream_port(port->sw); in tb_is_upstream_port()
465 return tb_route(port->sw) in tb_downstream_route()
466 | ((u64) port->port << (port->sw->config.depth * 8)); in tb_downstream_route()