Lines Matching refs:sw

47 static struct nvm_auth_status *__nvm_get_auth_status(const struct tb_switch *sw)  in __nvm_get_auth_status()  argument
52 if (uuid_equal(&st->uuid, sw->uuid)) in __nvm_get_auth_status()
59 static void nvm_get_auth_status(const struct tb_switch *sw, u32 *status) in nvm_get_auth_status() argument
64 st = __nvm_get_auth_status(sw); in nvm_get_auth_status()
70 static void nvm_set_auth_status(const struct tb_switch *sw, u32 status) in nvm_set_auth_status() argument
74 if (WARN_ON(!sw->uuid)) in nvm_set_auth_status()
78 st = __nvm_get_auth_status(sw); in nvm_set_auth_status()
85 memcpy(&st->uuid, sw->uuid, sizeof(st->uuid)); in nvm_set_auth_status()
95 static void nvm_clear_auth_status(const struct tb_switch *sw) in nvm_clear_auth_status() argument
100 st = __nvm_get_auth_status(sw); in nvm_clear_auth_status()
108 static int nvm_validate_and_write(struct tb_switch *sw) in nvm_validate_and_write() argument
111 const u8 *buf = sw->nvm->buf; in nvm_validate_and_write()
118 image_size = sw->nvm->buf_data_size; in nvm_validate_and_write()
142 if (!sw->safe_mode) { in nvm_validate_and_write()
150 if (device_id != sw->config.device_id) in nvm_validate_and_write()
153 if (sw->generation < 3) { in nvm_validate_and_write()
155 ret = dma_port_flash_write(sw->dma_port, in nvm_validate_and_write()
167 return dma_port_flash_write(sw->dma_port, 0, buf, image_size); in nvm_validate_and_write()
170 static int nvm_authenticate_host(struct tb_switch *sw) in nvm_authenticate_host() argument
179 if (!sw->safe_mode) { in nvm_authenticate_host()
180 ret = tb_domain_disconnect_all_paths(sw->tb); in nvm_authenticate_host()
187 ret = dma_port_flash_update_auth(sw->dma_port); in nvm_authenticate_host()
195 dma_port_power_cycle(sw->dma_port); in nvm_authenticate_host()
199 static int nvm_authenticate_device(struct tb_switch *sw) in nvm_authenticate_device() argument
203 ret = dma_port_flash_update_auth(sw->dma_port); in nvm_authenticate_device()
216 ret = dma_port_flash_update_auth_status(sw->dma_port, &status); in nvm_authenticate_device()
221 tb_sw_warn(sw, "failed to authenticate NVM\n"); in nvm_authenticate_device()
222 nvm_set_auth_status(sw, status); in nvm_authenticate_device()
225 tb_sw_info(sw, "power cycling the switch now\n"); in nvm_authenticate_device()
226 dma_port_power_cycle(sw->dma_port); in nvm_authenticate_device()
239 struct tb_switch *sw = priv; in tb_switch_nvm_read() local
242 pm_runtime_get_sync(&sw->dev); in tb_switch_nvm_read()
243 ret = dma_port_flash_read(sw->dma_port, offset, val, bytes); in tb_switch_nvm_read()
244 pm_runtime_mark_last_busy(&sw->dev); in tb_switch_nvm_read()
245 pm_runtime_put_autosuspend(&sw->dev); in tb_switch_nvm_read()
253 struct tb_switch *sw = priv; in tb_switch_nvm_write() local
265 if (!sw->nvm->buf) { in tb_switch_nvm_write()
266 sw->nvm->buf = vmalloc(NVM_MAX_SIZE); in tb_switch_nvm_write()
267 if (!sw->nvm->buf) { in tb_switch_nvm_write()
273 sw->nvm->buf_data_size = offset + bytes; in tb_switch_nvm_write()
274 memcpy(sw->nvm->buf + offset, val, bytes); in tb_switch_nvm_write()
282 static struct nvmem_device *register_nvmem(struct tb_switch *sw, int id, in register_nvmem() argument
303 config.dev = &sw->dev; in register_nvmem()
305 config.priv = sw; in register_nvmem()
310 static int tb_switch_nvm_add(struct tb_switch *sw) in tb_switch_nvm_add() argument
317 if (!sw->dma_port) in tb_switch_nvm_add()
331 if (!sw->safe_mode) { in tb_switch_nvm_add()
334 ret = dma_port_flash_read(sw->dma_port, NVM_FLASH_SIZE, &val, in tb_switch_nvm_add()
339 hdr_size = sw->generation < 3 ? SZ_8K : SZ_16K; in tb_switch_nvm_add()
343 ret = dma_port_flash_read(sw->dma_port, NVM_VERSION, &val, in tb_switch_nvm_add()
351 nvm_dev = register_nvmem(sw, nvm->id, nvm_size, true); in tb_switch_nvm_add()
359 nvm_dev = register_nvmem(sw, nvm->id, NVM_MAX_SIZE, false); in tb_switch_nvm_add()
367 sw->nvm = nvm; in tb_switch_nvm_add()
382 static void tb_switch_nvm_remove(struct tb_switch *sw) in tb_switch_nvm_remove() argument
387 nvm = sw->nvm; in tb_switch_nvm_remove()
388 sw->nvm = NULL; in tb_switch_nvm_remove()
396 nvm_clear_auth_status(sw); in tb_switch_nvm_remove()
597 tb_dump_port(port->sw->tb, &port->config); in tb_init_port()
606 static void tb_dump_switch(struct tb *tb, struct tb_regs_switch_header *sw) in tb_dump_switch() argument
610 sw->vendor_id, sw->device_id, sw->revision, in tb_dump_switch()
611 sw->thunderbolt_version); in tb_dump_switch()
612 tb_info(tb, " Max Port Number: %d\n", sw->max_port_number); in tb_dump_switch()
616 sw->upstream_port_number, sw->depth, in tb_dump_switch()
617 (((u64) sw->route_hi) << 32) | sw->route_lo, in tb_dump_switch()
618 sw->enabled, sw->plug_events_delay); in tb_dump_switch()
621 sw->__unknown1, sw->__unknown4); in tb_dump_switch()
648 struct tb_switch *get_switch_at_route(struct tb_switch *sw, u64 route) in get_switch_at_route() argument
655 return sw; in get_switch_at_route()
656 if (next_port > sw->config.max_port_number) in get_switch_at_route()
658 if (tb_is_upstream_port(&sw->ports[next_port])) in get_switch_at_route()
660 if (!sw->ports[next_port].remote) in get_switch_at_route()
662 return get_switch_at_route(sw->ports[next_port].remote->sw, in get_switch_at_route()
673 static int tb_plug_events_active(struct tb_switch *sw, bool active) in tb_plug_events_active() argument
678 if (!sw->config.enabled) in tb_plug_events_active()
681 sw->config.plug_events_delay = 0xff; in tb_plug_events_active()
682 res = tb_sw_write(sw, ((u32 *) &sw->config) + 4, TB_CFG_SWITCH, 4, 1); in tb_plug_events_active()
686 res = tb_sw_read(sw, &data, TB_CFG_SWITCH, sw->cap_plug_events + 1, 1); in tb_plug_events_active()
692 switch (sw->config.device_id) { in tb_plug_events_active()
703 return tb_sw_write(sw, &data, TB_CFG_SWITCH, in tb_plug_events_active()
704 sw->cap_plug_events + 1, 1); in tb_plug_events_active()
711 struct tb_switch *sw = tb_to_switch(dev); in authorized_show() local
713 return sprintf(buf, "%u\n", sw->authorized); in authorized_show()
716 static int tb_switch_set_authorized(struct tb_switch *sw, unsigned int val) in tb_switch_set_authorized() argument
723 if (sw->authorized) in tb_switch_set_authorized()
732 pm_runtime_get_sync(&sw->dev); in tb_switch_set_authorized()
737 if (sw->key) in tb_switch_set_authorized()
738 ret = tb_domain_approve_switch_key(sw->tb, sw); in tb_switch_set_authorized()
740 ret = tb_domain_approve_switch(sw->tb, sw); in tb_switch_set_authorized()
745 if (sw->key) in tb_switch_set_authorized()
746 ret = tb_domain_challenge_switch_key(sw->tb, sw); in tb_switch_set_authorized()
753 pm_runtime_mark_last_busy(&sw->dev); in tb_switch_set_authorized()
754 pm_runtime_put_autosuspend(&sw->dev); in tb_switch_set_authorized()
758 sw->authorized = val; in tb_switch_set_authorized()
760 kobject_uevent(&sw->dev.kobj, KOBJ_CHANGE); in tb_switch_set_authorized()
772 struct tb_switch *sw = tb_to_switch(dev); in authorized_store() local
782 ret = tb_switch_set_authorized(sw, val); in authorized_store()
791 struct tb_switch *sw = tb_to_switch(dev); in boot_show() local
793 return sprintf(buf, "%u\n", sw->boot); in boot_show()
800 struct tb_switch *sw = tb_to_switch(dev); in device_show() local
802 return sprintf(buf, "%#x\n", sw->device); in device_show()
809 struct tb_switch *sw = tb_to_switch(dev); in device_name_show() local
811 return sprintf(buf, "%s\n", sw->device_name ? sw->device_name : ""); in device_name_show()
818 struct tb_switch *sw = tb_to_switch(dev); in key_show() local
824 if (sw->key) in key_show()
825 ret = sprintf(buf, "%*phN\n", TB_SWITCH_KEY_SIZE, sw->key); in key_show()
836 struct tb_switch *sw = tb_to_switch(dev); in key_store() local
849 if (sw->authorized) { in key_store()
852 kfree(sw->key); in key_store()
854 sw->key = NULL; in key_store()
856 sw->key = kmemdup(key, sizeof(key), GFP_KERNEL); in key_store()
857 if (!sw->key) in key_store()
870 struct tb_switch *sw = tb_to_switch(dev); in nvm_authenticate_show() local
873 nvm_get_auth_status(sw, &status); in nvm_authenticate_show()
880 struct tb_switch *sw = tb_to_switch(dev); in nvm_authenticate_store() local
888 if (!sw->nvm) { in nvm_authenticate_store()
898 nvm_clear_auth_status(sw); in nvm_authenticate_store()
901 if (!sw->nvm->buf) { in nvm_authenticate_store()
906 pm_runtime_get_sync(&sw->dev); in nvm_authenticate_store()
907 ret = nvm_validate_and_write(sw); in nvm_authenticate_store()
909 pm_runtime_mark_last_busy(&sw->dev); in nvm_authenticate_store()
910 pm_runtime_put_autosuspend(&sw->dev); in nvm_authenticate_store()
914 sw->nvm->authenticating = true; in nvm_authenticate_store()
916 if (!tb_route(sw)) in nvm_authenticate_store()
917 ret = nvm_authenticate_host(sw); in nvm_authenticate_store()
919 ret = nvm_authenticate_device(sw); in nvm_authenticate_store()
920 pm_runtime_mark_last_busy(&sw->dev); in nvm_authenticate_store()
921 pm_runtime_put_autosuspend(&sw->dev); in nvm_authenticate_store()
936 struct tb_switch *sw = tb_to_switch(dev); in nvm_version_show() local
942 if (sw->safe_mode) in nvm_version_show()
944 else if (!sw->nvm) in nvm_version_show()
947 ret = sprintf(buf, "%x.%x\n", sw->nvm->major, sw->nvm->minor); in nvm_version_show()
958 struct tb_switch *sw = tb_to_switch(dev); in vendor_show() local
960 return sprintf(buf, "%#x\n", sw->vendor); in vendor_show()
967 struct tb_switch *sw = tb_to_switch(dev); in vendor_name_show() local
969 return sprintf(buf, "%s\n", sw->vendor_name ? sw->vendor_name : ""); in vendor_name_show()
976 struct tb_switch *sw = tb_to_switch(dev); in unique_id_show() local
978 return sprintf(buf, "%pUb\n", sw->uuid); in unique_id_show()
1000 struct tb_switch *sw = tb_to_switch(dev); in switch_attr_is_visible() local
1003 if (tb_route(sw) && in switch_attr_is_visible()
1004 sw->tb->security_level == TB_SECURITY_SECURE && in switch_attr_is_visible()
1005 sw->security_level == TB_SECURITY_SECURE) in switch_attr_is_visible()
1010 if (sw->dma_port) in switch_attr_is_visible()
1014 if (tb_route(sw)) in switch_attr_is_visible()
1019 return sw->safe_mode ? 0 : attr->mode; in switch_attr_is_visible()
1034 struct tb_switch *sw = tb_to_switch(dev); in tb_switch_release() local
1036 dma_port_free(sw->dma_port); in tb_switch_release()
1038 kfree(sw->uuid); in tb_switch_release()
1039 kfree(sw->device_name); in tb_switch_release()
1040 kfree(sw->vendor_name); in tb_switch_release()
1041 kfree(sw->ports); in tb_switch_release()
1042 kfree(sw->drom); in tb_switch_release()
1043 kfree(sw->key); in tb_switch_release()
1044 kfree(sw); in tb_switch_release()
1072 static int tb_switch_get_generation(struct tb_switch *sw) in tb_switch_get_generation() argument
1074 switch (sw->config.device_id) { in tb_switch_get_generation()
1105 tb_sw_warn(sw, "unsupported switch device id %#x\n", in tb_switch_get_generation()
1106 sw->config.device_id); in tb_switch_get_generation()
1129 struct tb_switch *sw; in tb_switch_alloc() local
1134 sw = kzalloc(sizeof(*sw), GFP_KERNEL); in tb_switch_alloc()
1135 if (!sw) in tb_switch_alloc()
1138 sw->tb = tb; in tb_switch_alloc()
1139 if (tb_cfg_read(tb->ctl, &sw->config, route, 0, TB_CFG_SWITCH, 0, 5)) in tb_switch_alloc()
1143 tb_dump_switch(tb, &sw->config); in tb_switch_alloc()
1146 sw->config.upstream_port_number = upstream_port; in tb_switch_alloc()
1147 sw->config.depth = tb_route_length(route); in tb_switch_alloc()
1148 sw->config.route_lo = route; in tb_switch_alloc()
1149 sw->config.route_hi = route >> 32; in tb_switch_alloc()
1150 sw->config.enabled = 0; in tb_switch_alloc()
1153 sw->ports = kcalloc(sw->config.max_port_number + 1, sizeof(*sw->ports), in tb_switch_alloc()
1155 if (!sw->ports) in tb_switch_alloc()
1158 for (i = 0; i <= sw->config.max_port_number; i++) { in tb_switch_alloc()
1160 sw->ports[i].sw = sw; in tb_switch_alloc()
1161 sw->ports[i].port = i; in tb_switch_alloc()
1164 sw->generation = tb_switch_get_generation(sw); in tb_switch_alloc()
1166 cap = tb_switch_find_vse_cap(sw, TB_VSE_CAP_PLUG_EVENTS); in tb_switch_alloc()
1168 tb_sw_warn(sw, "cannot find TB_VSE_CAP_PLUG_EVENTS aborting\n"); in tb_switch_alloc()
1171 sw->cap_plug_events = cap; in tb_switch_alloc()
1175 sw->authorized = true; in tb_switch_alloc()
1177 device_initialize(&sw->dev); in tb_switch_alloc()
1178 sw->dev.parent = parent; in tb_switch_alloc()
1179 sw->dev.bus = &tb_bus_type; in tb_switch_alloc()
1180 sw->dev.type = &tb_switch_type; in tb_switch_alloc()
1181 sw->dev.groups = switch_groups; in tb_switch_alloc()
1182 dev_set_name(&sw->dev, "%u-%llx", tb->index, tb_route(sw)); in tb_switch_alloc()
1184 return sw; in tb_switch_alloc()
1187 kfree(sw->ports); in tb_switch_alloc()
1188 kfree(sw); in tb_switch_alloc()
1210 struct tb_switch *sw; in tb_switch_alloc_safe_mode() local
1212 sw = kzalloc(sizeof(*sw), GFP_KERNEL); in tb_switch_alloc_safe_mode()
1213 if (!sw) in tb_switch_alloc_safe_mode()
1216 sw->tb = tb; in tb_switch_alloc_safe_mode()
1217 sw->config.depth = tb_route_length(route); in tb_switch_alloc_safe_mode()
1218 sw->config.route_hi = upper_32_bits(route); in tb_switch_alloc_safe_mode()
1219 sw->config.route_lo = lower_32_bits(route); in tb_switch_alloc_safe_mode()
1220 sw->safe_mode = true; in tb_switch_alloc_safe_mode()
1222 device_initialize(&sw->dev); in tb_switch_alloc_safe_mode()
1223 sw->dev.parent = parent; in tb_switch_alloc_safe_mode()
1224 sw->dev.bus = &tb_bus_type; in tb_switch_alloc_safe_mode()
1225 sw->dev.type = &tb_switch_type; in tb_switch_alloc_safe_mode()
1226 sw->dev.groups = switch_groups; in tb_switch_alloc_safe_mode()
1227 dev_set_name(&sw->dev, "%u-%llx", tb->index, tb_route(sw)); in tb_switch_alloc_safe_mode()
1229 return sw; in tb_switch_alloc_safe_mode()
1242 int tb_switch_configure(struct tb_switch *sw) in tb_switch_configure() argument
1244 struct tb *tb = sw->tb; in tb_switch_configure()
1248 route = tb_route(sw); in tb_switch_configure()
1251 route, tb_route_length(route), sw->config.upstream_port_number); in tb_switch_configure()
1253 if (sw->config.vendor_id != PCI_VENDOR_ID_INTEL) in tb_switch_configure()
1254 tb_sw_warn(sw, "unknown switch vendor id %#x\n", in tb_switch_configure()
1255 sw->config.vendor_id); in tb_switch_configure()
1257 sw->config.enabled = 1; in tb_switch_configure()
1260 ret = tb_sw_write(sw, 1 + (u32 *)&sw->config, TB_CFG_SWITCH, 1, 3); in tb_switch_configure()
1264 return tb_plug_events_active(sw, true); in tb_switch_configure()
1267 static void tb_switch_set_uuid(struct tb_switch *sw) in tb_switch_set_uuid() argument
1272 if (sw->uuid) in tb_switch_set_uuid()
1279 cap = tb_switch_find_vse_cap(sw, TB_VSE_CAP_LINK_CONTROLLER); in tb_switch_set_uuid()
1281 tb_sw_read(sw, uuid, TB_CFG_SWITCH, cap + 3, 4); in tb_switch_set_uuid()
1289 uuid[0] = sw->uid & 0xffffffff; in tb_switch_set_uuid()
1290 uuid[1] = (sw->uid >> 32) & 0xffffffff; in tb_switch_set_uuid()
1295 sw->uuid = kmemdup(uuid, sizeof(uuid), GFP_KERNEL); in tb_switch_set_uuid()
1298 static int tb_switch_add_dma_port(struct tb_switch *sw) in tb_switch_add_dma_port() argument
1303 switch (sw->generation) { in tb_switch_add_dma_port()
1309 if (tb_route(sw)) in tb_switch_add_dma_port()
1318 if (!sw->safe_mode) in tb_switch_add_dma_port()
1323 if (sw->no_nvm_upgrade) in tb_switch_add_dma_port()
1326 sw->dma_port = dma_port_alloc(sw); in tb_switch_add_dma_port()
1327 if (!sw->dma_port) in tb_switch_add_dma_port()
1335 ret = dma_port_flash_update_auth_status(sw->dma_port, &status); in tb_switch_add_dma_port()
1340 tb_sw_info(sw, "switch flash authentication failed\n"); in tb_switch_add_dma_port()
1341 tb_switch_set_uuid(sw); in tb_switch_add_dma_port()
1342 nvm_set_auth_status(sw, status); in tb_switch_add_dma_port()
1345 tb_sw_info(sw, "power cycling the switch now\n"); in tb_switch_add_dma_port()
1346 dma_port_power_cycle(sw->dma_port); in tb_switch_add_dma_port()
1367 int tb_switch_add(struct tb_switch *sw) in tb_switch_add() argument
1378 ret = tb_switch_add_dma_port(sw); in tb_switch_add()
1382 if (!sw->safe_mode) { in tb_switch_add()
1384 ret = tb_drom_read(sw); in tb_switch_add()
1386 tb_sw_warn(sw, "tb_eeprom_read_rom failed\n"); in tb_switch_add()
1389 tb_sw_info(sw, "uid: %#llx\n", sw->uid); in tb_switch_add()
1391 tb_switch_set_uuid(sw); in tb_switch_add()
1393 for (i = 0; i <= sw->config.max_port_number; i++) { in tb_switch_add()
1394 if (sw->ports[i].disabled) { in tb_switch_add()
1395 tb_port_info(&sw->ports[i], "disabled by eeprom\n"); in tb_switch_add()
1398 ret = tb_init_port(&sw->ports[i]); in tb_switch_add()
1404 ret = device_add(&sw->dev); in tb_switch_add()
1408 ret = tb_switch_nvm_add(sw); in tb_switch_add()
1410 device_del(&sw->dev); in tb_switch_add()
1414 pm_runtime_set_active(&sw->dev); in tb_switch_add()
1415 if (sw->rpm) { in tb_switch_add()
1416 pm_runtime_set_autosuspend_delay(&sw->dev, TB_AUTOSUSPEND_DELAY); in tb_switch_add()
1417 pm_runtime_use_autosuspend(&sw->dev); in tb_switch_add()
1418 pm_runtime_mark_last_busy(&sw->dev); in tb_switch_add()
1419 pm_runtime_enable(&sw->dev); in tb_switch_add()
1420 pm_request_autosuspend(&sw->dev); in tb_switch_add()
1434 void tb_switch_remove(struct tb_switch *sw) in tb_switch_remove() argument
1438 if (sw->rpm) { in tb_switch_remove()
1439 pm_runtime_get_sync(&sw->dev); in tb_switch_remove()
1440 pm_runtime_disable(&sw->dev); in tb_switch_remove()
1444 for (i = 1; i <= sw->config.max_port_number; i++) { in tb_switch_remove()
1445 if (tb_is_upstream_port(&sw->ports[i])) in tb_switch_remove()
1447 if (sw->ports[i].remote) in tb_switch_remove()
1448 tb_switch_remove(sw->ports[i].remote->sw); in tb_switch_remove()
1449 sw->ports[i].remote = NULL; in tb_switch_remove()
1450 if (sw->ports[i].xdomain) in tb_switch_remove()
1451 tb_xdomain_remove(sw->ports[i].xdomain); in tb_switch_remove()
1452 sw->ports[i].xdomain = NULL; in tb_switch_remove()
1455 if (!sw->is_unplugged) in tb_switch_remove()
1456 tb_plug_events_active(sw, false); in tb_switch_remove()
1458 tb_switch_nvm_remove(sw); in tb_switch_remove()
1459 device_unregister(&sw->dev); in tb_switch_remove()
1465 void tb_sw_set_unplugged(struct tb_switch *sw) in tb_sw_set_unplugged() argument
1468 if (sw == sw->tb->root_switch) { in tb_sw_set_unplugged()
1469 tb_sw_WARN(sw, "cannot unplug root switch\n"); in tb_sw_set_unplugged()
1472 if (sw->is_unplugged) { in tb_sw_set_unplugged()
1473 tb_sw_WARN(sw, "is_unplugged already set\n"); in tb_sw_set_unplugged()
1476 sw->is_unplugged = true; in tb_sw_set_unplugged()
1477 for (i = 0; i <= sw->config.max_port_number; i++) { in tb_sw_set_unplugged()
1478 if (!tb_is_upstream_port(&sw->ports[i]) && sw->ports[i].remote) in tb_sw_set_unplugged()
1479 tb_sw_set_unplugged(sw->ports[i].remote->sw); in tb_sw_set_unplugged()
1483 int tb_switch_resume(struct tb_switch *sw) in tb_switch_resume() argument
1486 tb_sw_info(sw, "resuming switch\n"); in tb_switch_resume()
1492 if (tb_route(sw)) { in tb_switch_resume()
1495 err = tb_drom_read_uid_only(sw, &uid); in tb_switch_resume()
1497 tb_sw_warn(sw, "uid read failed\n"); in tb_switch_resume()
1500 if (sw->uid != uid) { in tb_switch_resume()
1501 tb_sw_info(sw, in tb_switch_resume()
1503 sw->uid, uid); in tb_switch_resume()
1509 err = tb_sw_write(sw, 1 + (u32 *) &sw->config, TB_CFG_SWITCH, 1, 3); in tb_switch_resume()
1513 err = tb_plug_events_active(sw, true); in tb_switch_resume()
1518 for (i = 1; i <= sw->config.max_port_number; i++) { in tb_switch_resume()
1519 struct tb_port *port = &sw->ports[i]; in tb_switch_resume()
1525 || tb_switch_resume(port->remote->sw)) { in tb_switch_resume()
1528 tb_sw_set_unplugged(port->remote->sw); in tb_switch_resume()
1534 void tb_switch_suspend(struct tb_switch *sw) in tb_switch_suspend() argument
1537 err = tb_plug_events_active(sw, false); in tb_switch_suspend()
1541 for (i = 1; i <= sw->config.max_port_number; i++) { in tb_switch_suspend()
1542 if (!tb_is_upstream_port(&sw->ports[i]) && sw->ports[i].remote) in tb_switch_suspend()
1543 tb_switch_suspend(sw->ports[i].remote->sw); in tb_switch_suspend()
1561 struct tb_switch *sw = tb_to_switch(dev); in tb_switch_match() local
1564 if (!sw) in tb_switch_match()
1566 if (sw->tb != lookup->tb) in tb_switch_match()
1570 return !memcmp(sw->uuid, lookup->uuid, sizeof(*lookup->uuid)); in tb_switch_match()
1573 return sw->config.route_lo == lower_32_bits(lookup->route) && in tb_switch_match()
1574 sw->config.route_hi == upper_32_bits(lookup->route); in tb_switch_match()
1579 return !sw->depth; in tb_switch_match()
1581 return sw->link == lookup->link && sw->depth == lookup->depth; in tb_switch_match()