Commit 74710ded authored by Alex Chiang's avatar Alex Chiang Committed by Jesse Barnes

PCI: always scan child buses

While scanning bridges, we stop our scan if we encounter a bus
that we've seen before, to work around some buggy chipsets. This
is a good idea, but prevents us from fully scanning the PCI bus
at a future time (to find newly hot-added devices, for example).

Change the logic so that we skip _re-adding_ an existing bus
that we've seen before, but also allow the scan to descend to
all child buses.

Now that we're potentially scanning our child buses again, we
also need to be sure not to attempt re-initializing their BARs
so we avoid that.

This patch lays the groundwork to allow the user to issue a
rescan of the PCI bus at any time.
Signed-off-by: default avatarAlex Chiang <achiang@hp.com>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent 1b69dfc6
...@@ -511,20 +511,20 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, ...@@ -511,20 +511,20 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
/* /*
* If we already got to this bus through a different bridge, * If we already got to this bus through a different bridge,
* ignore it. This can happen with the i450NX chipset. * don't re-add it. This can happen with the i450NX chipset.
*
* However, we continue to descend down the hierarchy and
* scan remaining child buses.
*/ */
if (pci_find_bus(pci_domain_nr(bus), busnr)) { child = pci_find_bus(pci_domain_nr(bus), busnr);
dev_info(&dev->dev, "bus %04x:%02x already known\n", if (!child) {
pci_domain_nr(bus), busnr);
goto out;
}
child = pci_add_new_bus(bus, dev, busnr); child = pci_add_new_bus(bus, dev, busnr);
if (!child) if (!child)
goto out; goto out;
child->primary = buses & 0xFF; child->primary = buses & 0xFF;
child->subordinate = (buses >> 16) & 0xFF; child->subordinate = (buses >> 16) & 0xFF;
child->bridge_ctl = bctl; child->bridge_ctl = bctl;
}
cmax = pci_scan_child_bus(child); cmax = pci_scan_child_bus(child);
if (cmax > max) if (cmax > max)
...@@ -1092,8 +1092,14 @@ unsigned int __devinit pci_scan_child_bus(struct pci_bus *bus) ...@@ -1092,8 +1092,14 @@ unsigned int __devinit pci_scan_child_bus(struct pci_bus *bus)
* After performing arch-dependent fixup of the bus, look behind * After performing arch-dependent fixup of the bus, look behind
* all PCI-to-PCI bridges on this bus. * all PCI-to-PCI bridges on this bus.
*/ */
pr_debug("PCI: Fixups for bus %04x:%02x\n", pci_domain_nr(bus), bus->number); if (!bus->is_added) {
pr_debug("PCI: Fixups for bus %04x:%02x\n",
pci_domain_nr(bus), bus->number);
pcibios_fixup_bus(bus); pcibios_fixup_bus(bus);
if (pci_is_root_bus(bus))
bus->is_added = 1;
}
for (pass=0; pass < 2; pass++) for (pass=0; pass < 2; pass++)
list_for_each_entry(dev, &bus->devices, bus_list) { list_for_each_entry(dev, &bus->devices, bus_list) {
if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment