• Home
  • Raw
  • Download

Lines Matching full:sw

38 static void tb_scan_switch(struct tb_switch *sw)  in tb_scan_switch()  argument
41 for (i = 1; i <= sw->config.max_port_number; i++) in tb_scan_switch()
42 tb_scan_port(&sw->ports[i]); in tb_scan_switch()
50 struct tb_switch *sw; in tb_scan_port() local
66 sw = tb_switch_alloc(port->sw->tb, &port->sw->dev, in tb_scan_port()
68 if (!sw) in tb_scan_port()
71 if (tb_switch_configure(sw)) { in tb_scan_port()
72 tb_switch_put(sw); in tb_scan_port()
76 sw->authorized = true; in tb_scan_port()
78 if (tb_switch_add(sw)) { in tb_scan_port()
79 tb_switch_put(sw); in tb_scan_port()
83 port->remote = tb_upstream_port(sw); in tb_scan_port()
84 tb_upstream_port(sw)->remote = port; in tb_scan_port()
85 tb_scan_switch(sw); in tb_scan_port()
109 static void tb_free_unplugged_children(struct tb_switch *sw) in tb_free_unplugged_children() argument
112 for (i = 1; i <= sw->config.max_port_number; i++) { in tb_free_unplugged_children()
113 struct tb_port *port = &sw->ports[i]; in tb_free_unplugged_children()
118 if (port->remote->sw->is_unplugged) { in tb_free_unplugged_children()
119 tb_switch_remove(port->remote->sw); in tb_free_unplugged_children()
122 tb_free_unplugged_children(port->remote->sw); in tb_free_unplugged_children()
129 * find_pci_up_port() - return the first PCIe up port on @sw or NULL
131 static struct tb_port *tb_find_pci_up_port(struct tb_switch *sw) in tb_find_pci_up_port() argument
134 for (i = 1; i <= sw->config.max_port_number; i++) in tb_find_pci_up_port()
135 if (sw->ports[i].config.type == TB_TYPE_PCIE_UP) in tb_find_pci_up_port()
136 return &sw->ports[i]; in tb_find_pci_up_port()
141 * find_unused_down_port() - return the first inactive PCIe down port on @sw
143 static struct tb_port *tb_find_unused_down_port(struct tb_switch *sw) in tb_find_unused_down_port() argument
149 for (i = 1; i <= sw->config.max_port_number; i++) { in tb_find_unused_down_port()
150 if (tb_is_upstream_port(&sw->ports[i])) in tb_find_unused_down_port()
152 if (sw->ports[i].config.type != TB_TYPE_PCIE_DOWN) in tb_find_unused_down_port()
154 cap = tb_port_find_cap(&sw->ports[i], TB_PORT_CAP_ADAP); in tb_find_unused_down_port()
157 res = tb_port_read(&sw->ports[i], &data, TB_CFG_PORT, cap, 1); in tb_find_unused_down_port()
162 return &sw->ports[i]; in tb_find_unused_down_port()
178 struct tb_switch *sw; in tb_activate_pcie_devices() local
192 sw = tb->root_switch->ports[i].remote->sw; in tb_activate_pcie_devices()
193 up_port = tb_find_pci_up_port(sw); in tb_activate_pcie_devices()
195 tb_sw_info(sw, "no PCIe devices found, aborting\n"); in tb_activate_pcie_devices()
255 struct tb_switch *sw; in tb_handle_hotplug() local
261 sw = tb_switch_find_by_route(tb, ev->route); in tb_handle_hotplug()
262 if (!sw) { in tb_handle_hotplug()
268 if (ev->port > sw->config.max_port_number) { in tb_handle_hotplug()
274 port = &sw->ports[ev->port]; in tb_handle_hotplug()
284 tb_sw_set_unplugged(port->remote->sw); in tb_handle_hotplug()
286 tb_switch_remove(port->remote->sw); in tb_handle_hotplug()
300 } else if (port->remote->sw->config.depth > 1) { in tb_handle_hotplug()
301 tb_sw_warn(port->remote->sw, in tb_handle_hotplug()
304 tb_sw_info(port->remote->sw, in tb_handle_hotplug()
311 tb_switch_put(sw); in tb_handle_hotplug()