PCI: Call pci_read_bridge_bases() from core instead of arch code
authorLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Thu, 9 Jul 2015 10:59:16 +0000 (11:59 +0100)
committerBjorn Helgaas <bhelgaas@google.com>
Thu, 23 Jul 2015 15:13:29 +0000 (10:13 -0500)
When we scan a PCI bus, we read PCI-PCI bridge window registers with
pci_read_bridge_bases() so we can validate the resource hierarchy.  Most
architectures call pci_read_bridge_bases() from pcibios_fixup_bus(), but
PCI-PCI bridges are not arch-specific, so this doesn't need to be in
arch-specific code.

Call pci_read_bridge_bases() directly from the PCI core instead of from
arch code.

For alpha and mips, we now call pci_read_bridge_bases() always; previously
we only called it if PCI_PROBE_ONLY was set.

[bhelgaas: changelog]
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: Ralf Baechle <ralf@linux-mips.org>
CC: James E.J. Bottomley <jejb@parisc-linux.org>
CC: Michael Ellerman <mpe@ellerman.id.au>
CC: Bjorn Helgaas <bhelgaas@google.com>
CC: Richard Henderson <rth@twiddle.net>
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: David Howells <dhowells@redhat.com>
CC: Russell King <linux@arm.linux.org.uk>
CC: Tony Luck <tony.luck@intel.com>
CC: David S. Miller <davem@davemloft.net>
CC: Ingo Molnar <mingo@redhat.com>
CC: Guenter Roeck <linux@roeck-us.net>
CC: Michal Simek <monstr@monstr.eu>
CC: Chris Zankel <chris@zankel.net>
12 files changed:
arch/alpha/kernel/pci.c
arch/frv/mb93090-mb00/pci-vdk.c
arch/ia64/pci/pci.c
arch/microblaze/pci/pci-common.c
arch/mips/pci/pci.c
arch/mn10300/unit-asb2305/pci.c
arch/powerpc/kernel/pci-common.c
arch/x86/pci/common.c
arch/xtensa/kernel/pci.c
drivers/parisc/dino.c
drivers/parisc/lba_pci.c
drivers/pci/probe.c

index 82f738e5d54cb85f5b77c21304fd590d1e5bbbc5..cded02c890aacb5b32813332b61df3b4523fbd05 100644 (file)
@@ -242,12 +242,7 @@ pci_restore_srm_config(void)
 
 void pcibios_fixup_bus(struct pci_bus *bus)
 {
-       struct pci_dev *dev = bus->self;
-
-       if (pci_has_flag(PCI_PROBE_ONLY) && dev &&
-                  (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) {
-               pci_read_bridge_bases(bus);
-       } 
+       struct pci_dev *dev;
 
        list_for_each_entry(dev, &bus->devices, bus_list) {
                pdev_save_srm_config(dev);
index f211839e2cae18f4d71999ec41ad8ed2a8ff1bca..f9c86c475bbdafdbd37771c6834d7376b25673ec 100644 (file)
@@ -294,8 +294,6 @@ void pcibios_fixup_bus(struct pci_bus *bus)
        printk("### PCIBIOS_FIXUP_BUS(%d)\n",bus->number);
 #endif
 
-       pci_read_bridge_bases(bus);
-
        if (bus->number == 0) {
                struct pci_dev *dev;
                list_for_each_entry(dev, &bus->devices, bus_list) {
index 7cc3be9fa7c65a0dd700dfd30c04cc7be822922d..d89b6013c9412c7f2ef5d72a3a5f9710f7544d3e 100644 (file)
@@ -533,10 +533,9 @@ void pcibios_fixup_bus(struct pci_bus *b)
 {
        struct pci_dev *dev;
 
-       if (b->self) {
-               pci_read_bridge_bases(b);
+       if (b->self)
                pcibios_fixup_bridge_resources(b->self);
-       }
+
        list_for_each_entry(dev, &b->devices, bus_list)
                pcibios_fixup_device_resources(dev);
        platform_pci_fixup_bus(b);
index ae838ed5fcf2535ca5c047a2837adadc434735cd..6b8b75266801aaf25fe509985d2a5edd66ed3e8c 100644 (file)
@@ -863,14 +863,7 @@ void pcibios_setup_bus_devices(struct pci_bus *bus)
 
 void pcibios_fixup_bus(struct pci_bus *bus)
 {
-       /* When called from the generic PCI probe, read PCI<->PCI bridge
-        * bases. This is -not- called when generating the PCI tree from
-        * the OF device-tree.
-        */
-       if (bus->self != NULL)
-               pci_read_bridge_bases(bus);
-
-       /* Now fixup the bus bus */
+       /* Fixup the bus */
        pcibios_setup_bus_self(bus);
 
        /* Now fixup devices on that bus */
index b8a0bf5766f2efb64380ae3dedddca3b4782da03..c6996cf67a5c83e91e465d7d03e25c3ff7d3c89d 100644 (file)
@@ -311,12 +311,6 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
 
 void pcibios_fixup_bus(struct pci_bus *bus)
 {
-       struct pci_dev *dev = bus->self;
-
-       if (pci_has_flag(PCI_PROBE_ONLY) && dev &&
-           (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) {
-               pci_read_bridge_bases(bus);
-       }
 }
 
 EXPORT_SYMBOL(PCIBIOS_MIN_IO);
index 3dfe2d31c67b20971701cac89565af0531dec878..deaa893efba5969a92aed92e6c230f2e00658e6f 100644 (file)
@@ -324,7 +324,6 @@ void pcibios_fixup_bus(struct pci_bus *bus)
        struct pci_dev *dev;
 
        if (bus->self) {
-               pci_read_bridge_bases(bus);
                pcibios_fixup_bridge_resources(bus->self);
        }
 
index b9de34d44fcb877c388bcb54c98cc82bfb2ac3f2..02c1d5dcee4d8c10b0bf00d1f466bb1256725767 100644 (file)
@@ -1044,13 +1044,7 @@ void pcibios_set_master(struct pci_dev *dev)
 
 void pcibios_fixup_bus(struct pci_bus *bus)
 {
-       /* When called from the generic PCI probe, read PCI<->PCI bridge
-        * bases. This is -not- called when generating the PCI tree from
-        * the OF device-tree.
-        */
-       pci_read_bridge_bases(bus);
-
-       /* Now fixup the bus bus */
+       /* Fixup the bus */
        pcibios_setup_bus_self(bus);
 
        /* Now fixup devices on that bus */
index 8fd6f44aee8370958076fb4a8af3e13a2781fe33..3bff24438b00bcf5bba500bf34bbe31746f66f9e 100644 (file)
@@ -166,7 +166,6 @@ void pcibios_fixup_bus(struct pci_bus *b)
 {
        struct pci_dev *dev;
 
-       pci_read_bridge_bases(b);
        list_for_each_entry(dev, &b->devices, bus_list)
                pcibios_fixup_device_resources(dev);
 }
index b848cc3dc913d8de7dc5181fc140a9f83215e6cf..d27b4dcf221f8904e34198474d396c77b1034bb6 100644 (file)
@@ -210,10 +210,6 @@ subsys_initcall(pcibios_init);
 
 void pcibios_fixup_bus(struct pci_bus *bus)
 {
-       if (bus->parent) {
-               /* This is a subordinate bridge */
-               pci_read_bridge_bases(bus);
-       }
 }
 
 void pcibios_set_master(struct pci_dev *dev)
index a0580afe1713a5f58db5e96da635028856200a08..baec33c4e6981ffdb19df8d767f5aff8cb72bb77 100644 (file)
@@ -560,9 +560,6 @@ dino_fixup_bus(struct pci_bus *bus)
        } else if (bus->parent) {
                int i;
 
-               pci_read_bridge_bases(bus);
-
-
                for(i = PCI_BRIDGE_RESOURCES; i < PCI_NUM_RESOURCES; i++) {
                        if((bus->self->resource[i].flags & 
                            (IORESOURCE_IO | IORESOURCE_MEM)) == 0)
index dceb9ddfd99af6d754b0190fe2eb99431f64f4a6..901e1a3fa4e2689e6cfd31a01d01a80520dc3a22 100644 (file)
@@ -693,7 +693,6 @@ lba_fixup_bus(struct pci_bus *bus)
        if (bus->parent) {
                int i;
                /* PCI-PCI Bridge */
-               pci_read_bridge_bases(bus);
                for (i = PCI_BRIDGE_RESOURCES; i < PCI_NUM_RESOURCES; i++)
                        pci_claim_bridge_resource(bus->self, i);
        } else {
index cefd636681b6418ce75376879dc26fe3891bc47d..b996aefc109286475381af284705db5272fe0183 100644 (file)
@@ -826,6 +826,9 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass)
                        child->bridge_ctl = bctl;
                }
 
+               /* Read and initialize bridge resources */
+               pci_read_bridge_bases(child);
+
                cmax = pci_scan_child_bus(child);
                if (cmax > subordinate)
                        dev_warn(&dev->dev, "bridge has subordinate %02x but max busn %02x\n",
@@ -886,6 +889,9 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass)
 
                if (!is_cardbus) {
                        child->bridge_ctl = bctl;
+
+                       /* Read and initialize bridge resources */
+                       pci_read_bridge_bases(child);
                        max = pci_scan_child_bus(child);
                } else {
                        /*