Lines Matching refs:bridge

92 	put_device(pci_bus->bridge);  in release_pcibus_dev()
459 static void pci_read_bridge_windows(struct pci_dev *bridge) in pci_read_bridge_windows() argument
466 pci_read_config_dword(bridge, PCI_PRIMARY_BUS, &buses); in pci_read_bridge_windows()
470 pci_info(bridge, "PCI bridge to %pR%s\n", &res, in pci_read_bridge_windows()
471 bridge->transparent ? " (subtractive decode)" : ""); in pci_read_bridge_windows()
473 pci_read_config_word(bridge, PCI_IO_BASE, &io); in pci_read_bridge_windows()
475 pci_write_config_word(bridge, PCI_IO_BASE, 0xe0f0); in pci_read_bridge_windows()
476 pci_read_config_word(bridge, PCI_IO_BASE, &io); in pci_read_bridge_windows()
477 pci_write_config_word(bridge, PCI_IO_BASE, 0x0); in pci_read_bridge_windows()
480 bridge->io_window = 1; in pci_read_bridge_windows()
481 pci_read_bridge_io(bridge, &res, true); in pci_read_bridge_windows()
484 pci_read_bridge_mmio(bridge, &res, true); in pci_read_bridge_windows()
491 if (bridge->vendor == PCI_VENDOR_ID_DEC && bridge->device == 0x0001) in pci_read_bridge_windows()
494 pci_read_config_dword(bridge, PCI_PREF_MEMORY_BASE, &pmem); in pci_read_bridge_windows()
496 pci_write_config_dword(bridge, PCI_PREF_MEMORY_BASE, in pci_read_bridge_windows()
498 pci_read_config_dword(bridge, PCI_PREF_MEMORY_BASE, &pmem); in pci_read_bridge_windows()
499 pci_write_config_dword(bridge, PCI_PREF_MEMORY_BASE, 0x0); in pci_read_bridge_windows()
504 bridge->pref_window = 1; in pci_read_bridge_windows()
513 pci_read_config_dword(bridge, PCI_PREF_BASE_UPPER32, &pmem); in pci_read_bridge_windows()
514 pci_write_config_dword(bridge, PCI_PREF_BASE_UPPER32, in pci_read_bridge_windows()
516 pci_read_config_dword(bridge, PCI_PREF_BASE_UPPER32, &tmp); in pci_read_bridge_windows()
517 pci_write_config_dword(bridge, PCI_PREF_BASE_UPPER32, pmem); in pci_read_bridge_windows()
519 bridge->pref_64_window = 1; in pci_read_bridge_windows()
522 pci_read_bridge_mmio_pref(bridge, &res, true); in pci_read_bridge_windows()
582 struct pci_host_bridge *bridge = to_pci_host_bridge(dev); in pci_release_host_bridge_dev() local
584 if (bridge->release_fn) in pci_release_host_bridge_dev()
585 bridge->release_fn(bridge); in pci_release_host_bridge_dev()
587 pci_free_resource_list(&bridge->windows); in pci_release_host_bridge_dev()
588 pci_free_resource_list(&bridge->dma_ranges); in pci_release_host_bridge_dev()
589 kfree(bridge); in pci_release_host_bridge_dev()
592 static void pci_init_host_bridge(struct pci_host_bridge *bridge) in pci_init_host_bridge() argument
594 INIT_LIST_HEAD(&bridge->windows); in pci_init_host_bridge()
595 INIT_LIST_HEAD(&bridge->dma_ranges); in pci_init_host_bridge()
603 bridge->native_aer = 1; in pci_init_host_bridge()
604 bridge->native_pcie_hotplug = 1; in pci_init_host_bridge()
605 bridge->native_shpc_hotplug = 1; in pci_init_host_bridge()
606 bridge->native_pme = 1; in pci_init_host_bridge()
607 bridge->native_ltr = 1; in pci_init_host_bridge()
608 bridge->native_dpc = 1; in pci_init_host_bridge()
609 bridge->domain_nr = PCI_DOMAIN_NR_NOT_SET; in pci_init_host_bridge()
610 bridge->native_cxl_error = 1; in pci_init_host_bridge()
612 device_initialize(&bridge->dev); in pci_init_host_bridge()
617 struct pci_host_bridge *bridge; in pci_alloc_host_bridge() local
619 bridge = kzalloc(sizeof(*bridge) + priv, GFP_KERNEL); in pci_alloc_host_bridge()
620 if (!bridge) in pci_alloc_host_bridge()
623 pci_init_host_bridge(bridge); in pci_alloc_host_bridge()
624 bridge->dev.release = pci_release_host_bridge_dev; in pci_alloc_host_bridge()
626 return bridge; in pci_alloc_host_bridge()
639 struct pci_host_bridge *bridge; in devm_pci_alloc_host_bridge() local
641 bridge = pci_alloc_host_bridge(priv); in devm_pci_alloc_host_bridge()
642 if (!bridge) in devm_pci_alloc_host_bridge()
645 bridge->dev.parent = dev; in devm_pci_alloc_host_bridge()
648 bridge); in devm_pci_alloc_host_bridge()
652 ret = devm_of_pci_bridge_init(dev, bridge); in devm_pci_alloc_host_bridge()
656 return bridge; in devm_pci_alloc_host_bridge()
660 void pci_free_host_bridge(struct pci_host_bridge *bridge) in pci_free_host_bridge() argument
662 put_device(&bridge->dev); in pci_free_host_bridge()
784 struct pci_dev *bridge = bus->self; in pci_set_bus_speed() local
787 pos = pci_find_capability(bridge, PCI_CAP_ID_AGP); in pci_set_bus_speed()
789 pos = pci_find_capability(bridge, PCI_CAP_ID_AGP3); in pci_set_bus_speed()
793 pci_read_config_dword(bridge, pos + PCI_AGP_STATUS, &agpstat); in pci_set_bus_speed()
796 pci_read_config_dword(bridge, pos + PCI_AGP_COMMAND, &agpcmd); in pci_set_bus_speed()
800 pos = pci_find_capability(bridge, PCI_CAP_ID_PCIX); in pci_set_bus_speed()
805 pci_read_config_word(bridge, pos + PCI_X_BRIDGE_SSTATUS, in pci_set_bus_speed()
828 if (pci_is_pcie(bridge)) { in pci_set_bus_speed()
832 pcie_capability_read_dword(bridge, PCI_EXP_LNKCAP, &linkcap); in pci_set_bus_speed()
835 pcie_capability_read_word(bridge, PCI_EXP_LNKSTA, &linksta); in pci_set_bus_speed()
845 d = dev_get_msi_domain(bus->bridge); in pci_host_bridge_msi_domain()
903 static int pci_register_host_bridge(struct pci_host_bridge *bridge) in pci_register_host_bridge() argument
905 struct device *parent = bridge->dev.parent; in pci_register_host_bridge()
919 bridge->bus = bus; in pci_register_host_bridge()
921 bus->sysdata = bridge->sysdata; in pci_register_host_bridge()
922 bus->ops = bridge->ops; in pci_register_host_bridge()
923 bus->number = bus->busn_res.start = bridge->busnr; in pci_register_host_bridge()
925 if (bridge->domain_nr == PCI_DOMAIN_NR_NOT_SET) in pci_register_host_bridge()
928 bus->domain_nr = bridge->domain_nr; in pci_register_host_bridge()
935 b = pci_find_bus(pci_domain_nr(bus), bridge->busnr); in pci_register_host_bridge()
943 dev_set_name(&bridge->dev, "pci%04x:%02x", pci_domain_nr(bus), in pci_register_host_bridge()
944 bridge->busnr); in pci_register_host_bridge()
946 err = pcibios_root_bridge_prepare(bridge); in pci_register_host_bridge()
951 list_splice_init(&bridge->windows, &resources); in pci_register_host_bridge()
952 err = device_add(&bridge->dev); in pci_register_host_bridge()
954 put_device(&bridge->dev); in pci_register_host_bridge()
957 bus->bridge = get_device(&bridge->dev); in pci_register_host_bridge()
958 device_enable_async_suspend(bus->bridge); in pci_register_host_bridge()
961 if (bridge->msi_domain && !dev_get_msi_domain(&bus->dev) && in pci_register_host_bridge()
966 set_dev_node(bus->bridge, pcibus_to_node(bus)); in pci_register_host_bridge()
969 bus->dev.parent = bus->bridge; in pci_register_host_bridge()
998 bridge->preserve_config = pci_preserve_config(bridge); in pci_register_host_bridge()
1030 list_move_tail(&window->node, &bridge->windows); in pci_register_host_bridge()
1059 put_device(&bridge->dev); in pci_register_host_bridge()
1060 device_del(&bridge->dev); in pci_register_host_bridge()
1070 static bool pci_bridge_child_ext_cfg_accessible(struct pci_dev *bridge) in pci_bridge_child_ext_cfg_accessible() argument
1079 if (bridge->bus->bus_flags & PCI_BUS_FLAGS_NO_EXTCFG) in pci_bridge_child_ext_cfg_accessible()
1087 if (pci_is_pcie(bridge) && in pci_bridge_child_ext_cfg_accessible()
1088 (pci_pcie_type(bridge) == PCI_EXP_TYPE_ROOT_PORT || in pci_bridge_child_ext_cfg_accessible()
1089 pci_pcie_type(bridge) == PCI_EXP_TYPE_UPSTREAM || in pci_bridge_child_ext_cfg_accessible()
1090 pci_pcie_type(bridge) == PCI_EXP_TYPE_DOWNSTREAM)) in pci_bridge_child_ext_cfg_accessible()
1101 pos = pci_find_capability(bridge, PCI_CAP_ID_PCIX); in pci_bridge_child_ext_cfg_accessible()
1105 pci_read_config_dword(bridge, pos + PCI_X_STATUS, &status); in pci_bridge_child_ext_cfg_accessible()
1110 struct pci_dev *bridge, int busnr) in pci_alloc_child_bus() argument
1144 if (!bridge) { in pci_alloc_child_bus()
1145 child->dev.parent = parent->bridge; in pci_alloc_child_bus()
1149 child->self = bridge; in pci_alloc_child_bus()
1150 child->bridge = get_device(&bridge->dev); in pci_alloc_child_bus()
1151 child->dev.parent = child->bridge; in pci_alloc_child_bus()
1160 if (!pci_bridge_child_ext_cfg_accessible(bridge)) { in pci_alloc_child_bus()
1167 child->resource[i] = &bridge->resource[PCI_BRIDGE_RESOURCES+i]; in pci_alloc_child_bus()
1170 bridge->subordinate = child; in pci_alloc_child_bus()
1910 dev->dev.parent = dev->bus->bridge; in pci_setup_device()
2075 struct pci_dev *bridge = pci_upstream_bridge(dev); in pci_configure_mps() local
2102 if (!bridge || !pci_is_pcie(bridge)) in pci_configure_mps()
2106 p_mps = pcie_get_mps(bridge); in pci_configure_mps()
2113 mps, pci_name(bridge), p_mps); in pci_configure_mps()
2125 if (mpss < p_mps && pci_pcie_type(bridge) == PCI_EXP_TYPE_ROOT_PORT) { in pci_configure_mps()
2126 pcie_set_mps(bridge, mpss); in pci_configure_mps()
2128 mpss, p_mps, 128 << bridge->pcie_mpss); in pci_configure_mps()
2129 p_mps = pcie_get_mps(bridge); in pci_configure_mps()
2234 struct pci_dev *bridge; in pci_configure_eetlp_prefix() local
2250 bridge = pci_upstream_bridge(dev); in pci_configure_eetlp_prefix()
2251 if (bridge && bridge->eetlp_prefix_path) in pci_configure_eetlp_prefix()
2413 struct pci_dev *bridge = bus->self; in pci_bus_read_dev_vendor_id() local
2419 if (bridge && bridge->vendor == PCI_VENDOR_ID_IDT && in pci_bus_read_dev_vendor_id()
2420 bridge->device == 0x80b5) in pci_bus_read_dev_vendor_id()
2654 struct pci_dev *bridge = bus->self; in only_one_child() local
2668 if (bridge && pci_is_pcie(bridge) && pcie_downstream_port(bridge)) in only_one_child()
3038 int __weak pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) in pcibios_root_bridge_prepare() argument
3055 struct pci_host_bridge *bridge; in pci_create_root_bus() local
3057 bridge = pci_alloc_host_bridge(0); in pci_create_root_bus()
3058 if (!bridge) in pci_create_root_bus()
3061 bridge->dev.parent = parent; in pci_create_root_bus()
3063 list_splice_init(resources, &bridge->windows); in pci_create_root_bus()
3064 bridge->sysdata = sysdata; in pci_create_root_bus()
3065 bridge->busnr = bus; in pci_create_root_bus()
3066 bridge->ops = ops; in pci_create_root_bus()
3068 error = pci_register_host_bridge(bridge); in pci_create_root_bus()
3072 return bridge->bus; in pci_create_root_bus()
3075 put_device(&bridge->dev); in pci_create_root_bus()
3080 int pci_host_probe(struct pci_host_bridge *bridge) in pci_host_probe() argument
3086 ret = pci_scan_root_bus_bridge(bridge); in pci_host_probe()
3089 dev_err(bridge->dev.parent, "Scanning root bridge failed"); in pci_host_probe()
3093 bus = bridge->bus; in pci_host_probe()
3096 if (bridge->preserve_config) in pci_host_probe()
3176 int pci_scan_root_bus_bridge(struct pci_host_bridge *bridge) in pci_scan_root_bus_bridge() argument
3183 if (!bridge) in pci_scan_root_bus_bridge()
3186 resource_list_for_each_entry(window, &bridge->windows) in pci_scan_root_bus_bridge()
3188 bridge->busnr = window->res->start; in pci_scan_root_bus_bridge()
3193 ret = pci_register_host_bridge(bridge); in pci_scan_root_bus_bridge()
3197 b = bridge->bus; in pci_scan_root_bus_bridge()
3198 bus = bridge->busnr; in pci_scan_root_bus_bridge()
3280 unsigned int pci_rescan_bus_bridge_resize(struct pci_dev *bridge) in pci_rescan_bus_bridge_resize() argument
3283 struct pci_bus *bus = bridge->subordinate; in pci_rescan_bus_bridge_resize()
3287 pci_assign_unassigned_bridge_resources(bridge); in pci_rescan_bus_bridge_resize()