Lines Matching refs:bus
291 pcibios_bus_to_resource(dev->bus, res, ®ion); in __pci_read_base()
292 pcibios_resource_to_bus(dev->bus, &inverted_region, res); in __pci_read_base()
437 pcibios_bus_to_resource(dev->bus, res, ®ion); in pci_read_bridge_io()
459 pcibios_bus_to_resource(dev->bus, res, ®ion); in pci_read_bridge_mmio()
512 pcibios_bus_to_resource(dev->bus, res, ®ion); in pci_read_bridge_mmio_pref()
683 void pcie_update_link_speed(struct pci_bus *bus, u16 linksta) in pcie_update_link_speed() argument
685 bus->cur_bus_speed = pcie_link_speed[linksta & PCI_EXP_LNKSTA_CLS]; in pcie_update_link_speed()
720 static void pci_set_bus_speed(struct pci_bus *bus) in pci_set_bus_speed() argument
722 struct pci_dev *bridge = bus->self; in pci_set_bus_speed()
732 bus->max_bus_speed = agp_speed(agpstat & 8, agpstat & 7); in pci_set_bus_speed()
735 bus->cur_bus_speed = agp_speed(agpstat & 8, agpcmd & 7); in pci_set_bus_speed()
759 bus->max_bus_speed = max; in pci_set_bus_speed()
760 bus->cur_bus_speed = pcix_bus_speed[ in pci_set_bus_speed()
771 bus->max_bus_speed = pcie_link_speed[linkcap & PCI_EXP_LNKCAP_SLS]; in pci_set_bus_speed()
774 pcie_update_link_speed(bus, linksta); in pci_set_bus_speed()
778 static struct irq_domain *pci_host_bridge_msi_domain(struct pci_bus *bus) in pci_host_bridge_msi_domain() argument
786 d = pci_host_bridge_of_msi_domain(bus); in pci_host_bridge_msi_domain()
788 d = pci_host_bridge_acpi_msi_domain(bus); in pci_host_bridge_msi_domain()
796 struct fwnode_handle *fwnode = pci_root_bus_fwnode(bus); in pci_host_bridge_msi_domain()
807 static void pci_set_bus_msi_domain(struct pci_bus *bus) in pci_set_bus_msi_domain() argument
817 for (b = bus, d = NULL; !d && !pci_is_root_bus(b); b = b->parent) { in pci_set_bus_msi_domain()
825 dev_set_msi_domain(&bus->dev, d); in pci_set_bus_msi_domain()
832 struct pci_bus *bus, *b; in pci_register_host_bridge() local
840 bus = pci_alloc_bus(NULL); in pci_register_host_bridge()
841 if (!bus) in pci_register_host_bridge()
844 bridge->bus = bus; in pci_register_host_bridge()
848 bus->sysdata = bridge->sysdata; in pci_register_host_bridge()
849 bus->msi = bridge->msi; in pci_register_host_bridge()
850 bus->ops = bridge->ops; in pci_register_host_bridge()
851 bus->number = bus->busn_res.start = bridge->busnr; in pci_register_host_bridge()
853 bus->domain_nr = pci_bus_find_domain_nr(bus, parent); in pci_register_host_bridge()
856 b = pci_find_bus(pci_domain_nr(bus), bridge->busnr); in pci_register_host_bridge()
864 dev_set_name(&bridge->dev, "pci%04x:%02x", pci_domain_nr(bus), in pci_register_host_bridge()
876 bus->bridge = get_device(&bridge->dev); in pci_register_host_bridge()
877 device_enable_async_suspend(bus->bridge); in pci_register_host_bridge()
878 pci_set_bus_of_node(bus); in pci_register_host_bridge()
879 pci_set_bus_msi_domain(bus); in pci_register_host_bridge()
882 set_dev_node(bus->bridge, pcibus_to_node(bus)); in pci_register_host_bridge()
884 bus->dev.class = &pcibus_class; in pci_register_host_bridge()
885 bus->dev.parent = bus->bridge; in pci_register_host_bridge()
887 dev_set_name(&bus->dev, "%04x:%02x", pci_domain_nr(bus), bus->number); in pci_register_host_bridge()
888 name = dev_name(&bus->dev); in pci_register_host_bridge()
890 err = device_register(&bus->dev); in pci_register_host_bridge()
894 pcibios_add_bus(bus); in pci_register_host_bridge()
897 pci_create_legacy_files(bus); in pci_register_host_bridge()
911 pci_bus_insert_busn_res(bus, bus->number, res->end); in pci_register_host_bridge()
913 pci_bus_add_resource(bus, res, 0); in pci_register_host_bridge()
927 dev_info(&bus->dev, "root bus resource %pR%s\n", res, addr); in pci_register_host_bridge()
931 list_add_tail(&bus->node, &pci_root_buses); in pci_register_host_bridge()
941 kfree(bus); in pci_register_host_bridge()
954 if (bridge->bus->bus_flags & PCI_BUS_FLAGS_NO_EXTCFG) in pci_bridge_child_ext_cfg_accessible()
1087 static unsigned int pci_scan_child_bus_extend(struct pci_bus *bus,
1113 static int pci_scan_bridge_extend(struct pci_bus *bus, struct pci_dev *dev, in pci_scan_bridge_extend() argument
1138 if (!primary && (primary != bus->number) && secondary && subordinate) { in pci_scan_bridge_extend()
1140 primary = bus->number; in pci_scan_bridge_extend()
1145 (primary != bus->number || secondary <= bus->number || in pci_scan_bridge_extend()
1179 child = pci_find_bus(pci_domain_nr(bus), secondary); in pci_scan_bridge_extend()
1181 child = pci_add_new_bus(bus, dev, secondary); in pci_scan_bridge_extend()
1227 child = pci_find_bus(pci_domain_nr(bus), max+1); in pci_scan_bridge_extend()
1229 child = pci_add_new_bus(bus, dev, max+1); in pci_scan_bridge_extend()
1233 bus->busn_res.end); in pci_scan_bridge_extend()
1267 struct pci_bus *parent = bus; in pci_scan_bridge_extend()
1268 if (pci_find_bus(pci_domain_nr(bus), in pci_scan_bridge_extend()
1300 pci_domain_nr(bus), child->number); in pci_scan_bridge_extend()
1303 while (bus->parent) { in pci_scan_bridge_extend()
1304 if ((child->busn_res.end > bus->busn_res.end) || in pci_scan_bridge_extend()
1305 (child->number > bus->busn_res.end) || in pci_scan_bridge_extend()
1306 (child->number < bus->number) || in pci_scan_bridge_extend()
1307 (child->busn_res.end < bus->number)) { in pci_scan_bridge_extend()
1312 bus = bus->parent; in pci_scan_bridge_extend()
1342 int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass) in pci_scan_bridge() argument
1344 return pci_scan_bridge_extend(bus, dev, max, 0, pass); in pci_scan_bridge()
1504 if (dev->bus->bus_flags & PCI_BUS_FLAGS_NO_EXTCFG) in pci_cfg_space_size()
1643 dev->sysdata = dev->bus->sysdata; in pci_setup_device()
1644 dev->dev.parent = dev->bus->bridge; in pci_setup_device()
1645 dev->dev.bus = &pci_bus_type; in pci_setup_device()
1659 dev_set_name(&dev->dev, "%04x:%02x:%02x.%d", pci_domain_nr(dev->bus), in pci_setup_device()
1660 dev->bus->number, PCI_SLOT(dev->devfn), in pci_setup_device()
1724 pcibios_bus_to_resource(dev->bus, res, ®ion); in pci_setup_device()
1731 pcibios_bus_to_resource(dev->bus, res, ®ion); in pci_setup_device()
1740 pcibios_bus_to_resource(dev->bus, res, ®ion); in pci_setup_device()
1747 pcibios_bus_to_resource(dev->bus, res, ®ion); in pci_setup_device()
2048 host = pci_find_host_bridge(dev->bus); in pci_configure_extended_tags()
2118 struct pci_host_bridge *host = pci_find_host_bridge(dev->bus); in pci_configure_ltr()
2232 pci_bus_put(pci_dev->bus); in pci_release_dev()
2238 struct pci_dev *pci_alloc_dev(struct pci_bus *bus) in pci_alloc_dev() argument
2248 dev->bus = pci_bus_get(bus); in pci_alloc_dev()
2259 static bool pci_bus_wait_crs(struct pci_bus *bus, int devfn, u32 *l, in pci_bus_wait_crs() argument
2278 pci_domain_nr(bus), bus->number, in pci_bus_wait_crs()
2285 pci_domain_nr(bus), bus->number, in pci_bus_wait_crs()
2291 if (pci_bus_read_config_dword(bus, devfn, PCI_VENDOR_ID, l)) in pci_bus_wait_crs()
2297 pci_domain_nr(bus), bus->number, in pci_bus_wait_crs()
2303 bool pci_bus_generic_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l, in pci_bus_generic_read_dev_vendor_id() argument
2306 if (pci_bus_read_config_dword(bus, devfn, PCI_VENDOR_ID, l)) in pci_bus_generic_read_dev_vendor_id()
2315 return pci_bus_wait_crs(bus, devfn, l, timeout); in pci_bus_generic_read_dev_vendor_id()
2320 bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l, in pci_bus_read_dev_vendor_id() argument
2324 struct pci_dev *bridge = bus->self; in pci_bus_read_dev_vendor_id()
2332 return pci_idt_bus_quirk(bus, devfn, l, timeout); in pci_bus_read_dev_vendor_id()
2335 return pci_bus_generic_read_dev_vendor_id(bus, devfn, l, timeout); in pci_bus_read_dev_vendor_id()
2343 static struct pci_dev *pci_scan_device(struct pci_bus *bus, int devfn) in pci_scan_device() argument
2348 if (!pci_bus_read_dev_vendor_id(bus, devfn, &l, 60*1000)) in pci_scan_device()
2351 dev = pci_alloc_dev(bus); in pci_scan_device()
2363 pci_bus_put(dev->bus); in pci_scan_device()
2470 d = dev_get_msi_domain(&dev->bus->dev); in pci_set_msi_domain()
2475 void pci_device_add(struct pci_dev *dev, struct pci_bus *bus) in pci_device_add() argument
2484 set_dev_node(&dev->dev, pcibus_to_node(bus)); in pci_device_add()
2509 list_add_tail(&dev->bus_list, &bus->devices); in pci_device_add()
2524 struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn) in pci_scan_single_device() argument
2528 dev = pci_get_slot(bus, devfn); in pci_scan_single_device()
2534 dev = pci_scan_device(bus, devfn); in pci_scan_single_device()
2538 pci_device_add(dev, bus); in pci_scan_single_device()
2544 static unsigned next_fn(struct pci_bus *bus, struct pci_dev *dev, unsigned fn) in next_fn() argument
2550 if (pci_ari_enabled(bus)) { in next_fn()
2572 static int only_one_child(struct pci_bus *bus) in only_one_child() argument
2574 struct pci_dev *bridge = bus->self; in only_one_child()
2609 int pci_scan_slot(struct pci_bus *bus, int devfn) in pci_scan_slot() argument
2614 if (only_one_child(bus) && (devfn > 0)) in pci_scan_slot()
2617 dev = pci_scan_single_device(bus, devfn); in pci_scan_slot()
2623 for (fn = next_fn(bus, dev, 0); fn > 0; fn = next_fn(bus, dev, fn)) { in pci_scan_slot()
2624 dev = pci_scan_single_device(bus, devfn + fn); in pci_scan_slot()
2633 if (bus->self && nr) in pci_scan_slot()
2634 pcie_aspm_init_link_state(bus->self); in pci_scan_slot()
2680 dev->bus->self) in pcie_write_mps()
2695 mps = min(mps, pcie_get_mps(dev->bus->self)); in pcie_write_mps()
2770 void pcie_bus_configure_settings(struct pci_bus *bus) in pcie_bus_configure_settings() argument
2774 if (!bus->self) in pcie_bus_configure_settings()
2777 if (!pci_is_pcie(bus->self)) in pcie_bus_configure_settings()
2789 smpss = bus->self->pcie_mpss; in pcie_bus_configure_settings()
2791 pcie_find_smpss(bus->self, &smpss); in pcie_bus_configure_settings()
2792 pci_walk_bus(bus, pcie_find_smpss, &smpss); in pcie_bus_configure_settings()
2795 pcie_bus_configure_set(bus->self, &smpss); in pcie_bus_configure_settings()
2796 pci_walk_bus(bus, pcie_bus_configure_set, &smpss); in pcie_bus_configure_settings()
2804 void __weak pcibios_fixup_bus(struct pci_bus *bus) in pcibios_fixup_bus() argument
2821 static unsigned int pci_scan_child_bus_extend(struct pci_bus *bus, in pci_scan_child_bus_extend() argument
2825 unsigned int start = bus->busn_res.start; in pci_scan_child_bus_extend()
2830 dev_dbg(&bus->dev, "scanning bus\n"); in pci_scan_child_bus_extend()
2834 nr_devs = pci_scan_slot(bus, devfn); in pci_scan_child_bus_extend()
2843 dev = pci_scan_single_device(bus, devfn + fn); in pci_scan_child_bus_extend()
2851 used_buses = pci_iov_bus_range(bus); in pci_scan_child_bus_extend()
2858 if (!bus->is_added) { in pci_scan_child_bus_extend()
2859 dev_dbg(&bus->dev, "fixups for bus\n"); in pci_scan_child_bus_extend()
2860 pcibios_fixup_bus(bus); in pci_scan_child_bus_extend()
2861 bus->is_added = 1; in pci_scan_child_bus_extend()
2869 for_each_pci_bridge(dev, bus) { in pci_scan_child_bus_extend()
2881 for_each_pci_bridge(dev, bus) { in pci_scan_child_bus_extend()
2883 max = pci_scan_bridge_extend(bus, dev, max, 0, 0); in pci_scan_child_bus_extend()
2895 for_each_pci_bridge(dev, bus) { in pci_scan_child_bus_extend()
2918 max = pci_scan_bridge_extend(bus, dev, cmax, buses, 1); in pci_scan_child_bus_extend()
2929 if (bus->self && bus->self->is_hotplug_bridge) { in pci_scan_child_bus_extend()
2936 if (max > bus->busn_res.end) in pci_scan_child_bus_extend()
2937 max = bus->busn_res.end; in pci_scan_child_bus_extend()
2939 dev_dbg(&bus->dev, "%pR extended by %#02x\n", in pci_scan_child_bus_extend()
2940 &bus->busn_res, max - start); in pci_scan_child_bus_extend()
2951 dev_dbg(&bus->dev, "bus scan returning with max=%02x\n", max); in pci_scan_child_bus_extend()
2962 unsigned int pci_scan_child_bus(struct pci_bus *bus) in pci_scan_child_bus() argument
2964 return pci_scan_child_bus_extend(bus, 0); in pci_scan_child_bus()
2980 void __weak pcibios_add_bus(struct pci_bus *bus) in pcibios_add_bus() argument
2984 void __weak pcibios_remove_bus(struct pci_bus *bus) in pcibios_remove_bus() argument
2988 struct pci_bus *pci_create_root_bus(struct device *parent, int bus, in pci_create_root_bus() argument
3002 bridge->busnr = bus; in pci_create_root_bus()
3009 return bridge->bus; in pci_create_root_bus()
3019 struct pci_bus *bus, *child; in pci_host_probe() local
3028 bus = bridge->bus; in pci_host_probe()
3036 pci_bus_claim_resources(bus); in pci_host_probe()
3038 pci_bus_size_bridges(bus); in pci_host_probe()
3039 pci_bus_assign_resources(bus); in pci_host_probe()
3041 list_for_each_entry(child, &bus->children, node) in pci_host_probe()
3045 pci_bus_add_devices(bus); in pci_host_probe()
3050 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int bus_max) in pci_bus_insert_busn_res() argument
3055 res->start = bus; in pci_bus_insert_busn_res()
3118 int max, bus, ret; in pci_scan_root_bus_bridge() local
3133 b = bridge->bus; in pci_scan_root_bus_bridge()
3134 bus = bridge->busnr; in pci_scan_root_bus_bridge()
3139 bus); in pci_scan_root_bus_bridge()
3140 pci_bus_insert_busn_res(b, bus, 255); in pci_scan_root_bus_bridge()
3152 struct pci_bus *pci_scan_root_bus(struct device *parent, int bus, in pci_scan_root_bus() argument
3166 b = pci_create_root_bus(parent, bus, ops, sysdata, resources); in pci_scan_root_bus()
3173 bus); in pci_scan_root_bus()
3174 pci_bus_insert_busn_res(b, bus, 255); in pci_scan_root_bus()
3186 struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, in pci_scan_bus() argument
3195 b = pci_create_root_bus(NULL, bus, ops, sysdata, &resources); in pci_scan_bus()
3219 struct pci_bus *bus = bridge->subordinate; in pci_rescan_bus_bridge_resize() local
3221 max = pci_scan_child_bus(bus); in pci_rescan_bus_bridge_resize()
3225 pci_bus_add_devices(bus); in pci_rescan_bus_bridge_resize()
3239 unsigned int pci_rescan_bus(struct pci_bus *bus) in pci_rescan_bus() argument
3243 max = pci_scan_child_bus(bus); in pci_rescan_bus()
3244 pci_assign_unassigned_bus_resources(bus); in pci_rescan_bus()
3245 pci_bus_add_devices(bus); in pci_rescan_bus()
3275 if (pci_domain_nr(a->bus) < pci_domain_nr(b->bus)) return -1; in pci_sort_bf_cmp()
3276 else if (pci_domain_nr(a->bus) > pci_domain_nr(b->bus)) return 1; in pci_sort_bf_cmp()
3278 if (a->bus->number < b->bus->number) return -1; in pci_sort_bf_cmp()
3279 else if (a->bus->number > b->bus->number) return 1; in pci_sort_bf_cmp()
3294 struct pci_bus *parent = dev->bus; in pci_hp_add_bridge()