Lines Matching refs:sw

138 	struct tb_switch *sw;  member
278 int (*runtime_suspend_switch)(struct tb_switch *sw);
279 int (*runtime_resume_switch)(struct tb_switch *sw);
284 int (*approve_switch)(struct tb *tb, struct tb_switch *sw);
285 int (*add_switch_key)(struct tb *tb, struct tb_switch *sw);
286 int (*challenge_switch_key)(struct tb *tb, struct tb_switch *sw,
312 static inline struct tb_port *tb_upstream_port(struct tb_switch *sw) in tb_upstream_port() argument
314 return &sw->ports[sw->config.upstream_port_number]; in tb_upstream_port()
326 const struct tb_port *upstream_port = tb_upstream_port(port->sw); in tb_is_upstream_port()
330 static inline u64 tb_route(const struct tb_switch *sw) in tb_route() argument
332 return ((u64) sw->config.route_hi) << 32 | sw->config.route_lo; in tb_route()
335 static inline struct tb_port *tb_port_at(u64 route, struct tb_switch *sw) in tb_port_at() argument
339 port = route >> (sw->config.depth * 8); in tb_port_at()
340 if (WARN_ON(port > sw->config.max_port_number)) in tb_port_at()
342 return &sw->ports[port]; in tb_port_at()
388 static inline int tb_sw_read(struct tb_switch *sw, void *buffer, in tb_sw_read() argument
391 if (sw->is_unplugged) in tb_sw_read()
393 return tb_cfg_read(sw->tb->ctl, in tb_sw_read()
395 tb_route(sw), in tb_sw_read()
402 static inline int tb_sw_write(struct tb_switch *sw, void *buffer, in tb_sw_write() argument
405 if (sw->is_unplugged) in tb_sw_write()
407 return tb_cfg_write(sw->tb->ctl, in tb_sw_write()
409 tb_route(sw), in tb_sw_write()
419 if (port->sw->is_unplugged) in tb_port_read()
421 return tb_cfg_read(port->sw->tb->ctl, in tb_port_read()
423 tb_route(port->sw), in tb_port_read()
433 if (port->sw->is_unplugged) in tb_port_write()
435 return tb_cfg_write(port->sw->tb->ctl, in tb_port_write()
437 tb_route(port->sw), in tb_port_write()
450 #define __TB_SW_PRINT(level, sw, fmt, arg...) \ argument
452 const struct tb_switch *__sw = (sw); \
456 #define tb_sw_WARN(sw, fmt, arg...) __TB_SW_PRINT(tb_WARN, sw, fmt, ##arg) argument
457 #define tb_sw_warn(sw, fmt, arg...) __TB_SW_PRINT(tb_warn, sw, fmt, ##arg) argument
458 #define tb_sw_info(sw, fmt, arg...) __TB_SW_PRINT(tb_info, sw, fmt, ##arg) argument
459 #define tb_sw_dbg(sw, fmt, arg...) __TB_SW_PRINT(tb_dbg, sw, fmt, ##arg) argument
464 level(__port->sw->tb, "%llx:%x: " fmt, \
465 tb_route(__port->sw), __port->port, ## arg); \
497 int tb_domain_approve_switch(struct tb *tb, struct tb_switch *sw);
498 int tb_domain_approve_switch_key(struct tb *tb, struct tb_switch *sw);
499 int tb_domain_challenge_switch_key(struct tb *tb, struct tb_switch *sw);
521 int tb_switch_configure(struct tb_switch *sw);
522 int tb_switch_add(struct tb_switch *sw);
523 void tb_switch_remove(struct tb_switch *sw);
524 void tb_switch_suspend(struct tb_switch *sw);
525 int tb_switch_resume(struct tb_switch *sw);
527 void tb_sw_set_unplugged(struct tb_switch *sw);
533 static inline struct tb_switch *tb_switch_get(struct tb_switch *sw) in tb_switch_get() argument
535 if (sw) in tb_switch_get()
536 get_device(&sw->dev); in tb_switch_get()
537 return sw; in tb_switch_get()
540 static inline void tb_switch_put(struct tb_switch *sw) in tb_switch_put() argument
542 put_device(&sw->dev); in tb_switch_put()
557 static inline struct tb_switch *tb_switch_parent(struct tb_switch *sw) in tb_switch_parent() argument
559 return tb_to_switch(sw->dev.parent); in tb_switch_parent()
562 static inline bool tb_switch_is_lr(const struct tb_switch *sw) in tb_switch_is_lr() argument
564 return sw->config.device_id == PCI_DEVICE_ID_INTEL_LIGHT_RIDGE; in tb_switch_is_lr()
567 static inline bool tb_switch_is_er(const struct tb_switch *sw) in tb_switch_is_er() argument
569 return sw->config.device_id == PCI_DEVICE_ID_INTEL_EAGLE_RIDGE; in tb_switch_is_er()
572 static inline bool tb_switch_is_cr(const struct tb_switch *sw) in tb_switch_is_cr() argument
574 switch (sw->config.device_id) { in tb_switch_is_cr()
583 static inline bool tb_switch_is_fr(const struct tb_switch *sw) in tb_switch_is_fr() argument
585 switch (sw->config.device_id) { in tb_switch_is_fr()
605 int tb_switch_find_vse_cap(struct tb_switch *sw, enum tb_switch_vse_cap vsec);
630 int tb_drom_read(struct tb_switch *sw);
631 int tb_drom_read_uid_only(struct tb_switch *sw, u64 *uid);
633 int tb_lc_read_uuid(struct tb_switch *sw, u32 *uuid);
634 int tb_lc_configure_link(struct tb_switch *sw);
635 void tb_lc_unconfigure_link(struct tb_switch *sw);
636 int tb_lc_set_sleep(struct tb_switch *sw);
652 return tb_route(port->sw) in tb_downstream_route()
653 | ((u64) port->port << (port->sw->config.depth * 8)); in tb_downstream_route()