diff options
author | Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> | 2015-07-09 06:59:16 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2015-07-23 11:13:29 -0400 |
commit | dff22d2054b5dbb1889f20c03959dd0c494fab8c (patch) | |
tree | 6f3956c967a62215275826b5158adfe7c203de1e | |
parent | bc0195aad0daa2ad5b0d76cce22b167bc3435590 (diff) |
PCI: Call pci_read_bridge_bases() from core instead of arch code
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>
-rw-r--r-- | arch/alpha/kernel/pci.c | 7 | ||||
-rw-r--r-- | arch/frv/mb93090-mb00/pci-vdk.c | 2 | ||||
-rw-r--r-- | arch/ia64/pci/pci.c | 5 | ||||
-rw-r--r-- | arch/microblaze/pci/pci-common.c | 9 | ||||
-rw-r--r-- | arch/mips/pci/pci.c | 6 | ||||
-rw-r--r-- | arch/mn10300/unit-asb2305/pci.c | 1 | ||||
-rw-r--r-- | arch/powerpc/kernel/pci-common.c | 8 | ||||
-rw-r--r-- | arch/x86/pci/common.c | 1 | ||||
-rw-r--r-- | arch/xtensa/kernel/pci.c | 4 | ||||
-rw-r--r-- | drivers/parisc/dino.c | 3 | ||||
-rw-r--r-- | drivers/parisc/lba_pci.c | 1 | ||||
-rw-r--r-- | drivers/pci/probe.c | 6 |
12 files changed, 11 insertions, 42 deletions
diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c index 82f738e5d54c..cded02c890aa 100644 --- a/arch/alpha/kernel/pci.c +++ b/arch/alpha/kernel/pci.c | |||
@@ -242,12 +242,7 @@ pci_restore_srm_config(void) | |||
242 | 242 | ||
243 | void pcibios_fixup_bus(struct pci_bus *bus) | 243 | void pcibios_fixup_bus(struct pci_bus *bus) |
244 | { | 244 | { |
245 | struct pci_dev *dev = bus->self; | 245 | struct pci_dev *dev; |
246 | |||
247 | if (pci_has_flag(PCI_PROBE_ONLY) && dev && | ||
248 | (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) { | ||
249 | pci_read_bridge_bases(bus); | ||
250 | } | ||
251 | 246 | ||
252 | list_for_each_entry(dev, &bus->devices, bus_list) { | 247 | list_for_each_entry(dev, &bus->devices, bus_list) { |
253 | pdev_save_srm_config(dev); | 248 | pdev_save_srm_config(dev); |
diff --git a/arch/frv/mb93090-mb00/pci-vdk.c b/arch/frv/mb93090-mb00/pci-vdk.c index f211839e2cae..f9c86c475bbd 100644 --- a/arch/frv/mb93090-mb00/pci-vdk.c +++ b/arch/frv/mb93090-mb00/pci-vdk.c | |||
@@ -294,8 +294,6 @@ void pcibios_fixup_bus(struct pci_bus *bus) | |||
294 | printk("### PCIBIOS_FIXUP_BUS(%d)\n",bus->number); | 294 | printk("### PCIBIOS_FIXUP_BUS(%d)\n",bus->number); |
295 | #endif | 295 | #endif |
296 | 296 | ||
297 | pci_read_bridge_bases(bus); | ||
298 | |||
299 | if (bus->number == 0) { | 297 | if (bus->number == 0) { |
300 | struct pci_dev *dev; | 298 | struct pci_dev *dev; |
301 | list_for_each_entry(dev, &bus->devices, bus_list) { | 299 | list_for_each_entry(dev, &bus->devices, bus_list) { |
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index 7cc3be9fa7c6..d89b6013c941 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c | |||
@@ -533,10 +533,9 @@ void pcibios_fixup_bus(struct pci_bus *b) | |||
533 | { | 533 | { |
534 | struct pci_dev *dev; | 534 | struct pci_dev *dev; |
535 | 535 | ||
536 | if (b->self) { | 536 | if (b->self) |
537 | pci_read_bridge_bases(b); | ||
538 | pcibios_fixup_bridge_resources(b->self); | 537 | pcibios_fixup_bridge_resources(b->self); |
539 | } | 538 | |
540 | list_for_each_entry(dev, &b->devices, bus_list) | 539 | list_for_each_entry(dev, &b->devices, bus_list) |
541 | pcibios_fixup_device_resources(dev); | 540 | pcibios_fixup_device_resources(dev); |
542 | platform_pci_fixup_bus(b); | 541 | platform_pci_fixup_bus(b); |
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c index ae838ed5fcf2..6b8b75266801 100644 --- a/arch/microblaze/pci/pci-common.c +++ b/arch/microblaze/pci/pci-common.c | |||
@@ -863,14 +863,7 @@ void pcibios_setup_bus_devices(struct pci_bus *bus) | |||
863 | 863 | ||
864 | void pcibios_fixup_bus(struct pci_bus *bus) | 864 | void pcibios_fixup_bus(struct pci_bus *bus) |
865 | { | 865 | { |
866 | /* When called from the generic PCI probe, read PCI<->PCI bridge | 866 | /* Fixup the bus */ |
867 | * bases. This is -not- called when generating the PCI tree from | ||
868 | * the OF device-tree. | ||
869 | */ | ||
870 | if (bus->self != NULL) | ||
871 | pci_read_bridge_bases(bus); | ||
872 | |||
873 | /* Now fixup the bus bus */ | ||
874 | pcibios_setup_bus_self(bus); | 867 | pcibios_setup_bus_self(bus); |
875 | 868 | ||
876 | /* Now fixup devices on that bus */ | 869 | /* Now fixup devices on that bus */ |
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c index b8a0bf5766f2..c6996cf67a5c 100644 --- a/arch/mips/pci/pci.c +++ b/arch/mips/pci/pci.c | |||
@@ -311,12 +311,6 @@ int pcibios_enable_device(struct pci_dev *dev, int mask) | |||
311 | 311 | ||
312 | void pcibios_fixup_bus(struct pci_bus *bus) | 312 | void pcibios_fixup_bus(struct pci_bus *bus) |
313 | { | 313 | { |
314 | struct pci_dev *dev = bus->self; | ||
315 | |||
316 | if (pci_has_flag(PCI_PROBE_ONLY) && dev && | ||
317 | (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) { | ||
318 | pci_read_bridge_bases(bus); | ||
319 | } | ||
320 | } | 314 | } |
321 | 315 | ||
322 | EXPORT_SYMBOL(PCIBIOS_MIN_IO); | 316 | EXPORT_SYMBOL(PCIBIOS_MIN_IO); |
diff --git a/arch/mn10300/unit-asb2305/pci.c b/arch/mn10300/unit-asb2305/pci.c index 3dfe2d31c67b..deaa893efba5 100644 --- a/arch/mn10300/unit-asb2305/pci.c +++ b/arch/mn10300/unit-asb2305/pci.c | |||
@@ -324,7 +324,6 @@ void pcibios_fixup_bus(struct pci_bus *bus) | |||
324 | struct pci_dev *dev; | 324 | struct pci_dev *dev; |
325 | 325 | ||
326 | if (bus->self) { | 326 | if (bus->self) { |
327 | pci_read_bridge_bases(bus); | ||
328 | pcibios_fixup_bridge_resources(bus->self); | 327 | pcibios_fixup_bridge_resources(bus->self); |
329 | } | 328 | } |
330 | 329 | ||
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index b9de34d44fcb..02c1d5dcee4d 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c | |||
@@ -1044,13 +1044,7 @@ void pcibios_set_master(struct pci_dev *dev) | |||
1044 | 1044 | ||
1045 | void pcibios_fixup_bus(struct pci_bus *bus) | 1045 | void pcibios_fixup_bus(struct pci_bus *bus) |
1046 | { | 1046 | { |
1047 | /* When called from the generic PCI probe, read PCI<->PCI bridge | 1047 | /* Fixup the bus */ |
1048 | * bases. This is -not- called when generating the PCI tree from | ||
1049 | * the OF device-tree. | ||
1050 | */ | ||
1051 | pci_read_bridge_bases(bus); | ||
1052 | |||
1053 | /* Now fixup the bus bus */ | ||
1054 | pcibios_setup_bus_self(bus); | 1048 | pcibios_setup_bus_self(bus); |
1055 | 1049 | ||
1056 | /* Now fixup devices on that bus */ | 1050 | /* Now fixup devices on that bus */ |
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c index 8fd6f44aee83..3bff24438b00 100644 --- a/arch/x86/pci/common.c +++ b/arch/x86/pci/common.c | |||
@@ -166,7 +166,6 @@ void pcibios_fixup_bus(struct pci_bus *b) | |||
166 | { | 166 | { |
167 | struct pci_dev *dev; | 167 | struct pci_dev *dev; |
168 | 168 | ||
169 | pci_read_bridge_bases(b); | ||
170 | list_for_each_entry(dev, &b->devices, bus_list) | 169 | list_for_each_entry(dev, &b->devices, bus_list) |
171 | pcibios_fixup_device_resources(dev); | 170 | pcibios_fixup_device_resources(dev); |
172 | } | 171 | } |
diff --git a/arch/xtensa/kernel/pci.c b/arch/xtensa/kernel/pci.c index b848cc3dc913..d27b4dcf221f 100644 --- a/arch/xtensa/kernel/pci.c +++ b/arch/xtensa/kernel/pci.c | |||
@@ -210,10 +210,6 @@ subsys_initcall(pcibios_init); | |||
210 | 210 | ||
211 | void pcibios_fixup_bus(struct pci_bus *bus) | 211 | void pcibios_fixup_bus(struct pci_bus *bus) |
212 | { | 212 | { |
213 | if (bus->parent) { | ||
214 | /* This is a subordinate bridge */ | ||
215 | pci_read_bridge_bases(bus); | ||
216 | } | ||
217 | } | 213 | } |
218 | 214 | ||
219 | void pcibios_set_master(struct pci_dev *dev) | 215 | void pcibios_set_master(struct pci_dev *dev) |
diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c index a0580afe1713..baec33c4e698 100644 --- a/drivers/parisc/dino.c +++ b/drivers/parisc/dino.c | |||
@@ -560,9 +560,6 @@ dino_fixup_bus(struct pci_bus *bus) | |||
560 | } else if (bus->parent) { | 560 | } else if (bus->parent) { |
561 | int i; | 561 | int i; |
562 | 562 | ||
563 | pci_read_bridge_bases(bus); | ||
564 | |||
565 | |||
566 | for(i = PCI_BRIDGE_RESOURCES; i < PCI_NUM_RESOURCES; i++) { | 563 | for(i = PCI_BRIDGE_RESOURCES; i < PCI_NUM_RESOURCES; i++) { |
567 | if((bus->self->resource[i].flags & | 564 | if((bus->self->resource[i].flags & |
568 | (IORESOURCE_IO | IORESOURCE_MEM)) == 0) | 565 | (IORESOURCE_IO | IORESOURCE_MEM)) == 0) |
diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c index dceb9ddfd99a..901e1a3fa4e2 100644 --- a/drivers/parisc/lba_pci.c +++ b/drivers/parisc/lba_pci.c | |||
@@ -693,7 +693,6 @@ lba_fixup_bus(struct pci_bus *bus) | |||
693 | if (bus->parent) { | 693 | if (bus->parent) { |
694 | int i; | 694 | int i; |
695 | /* PCI-PCI Bridge */ | 695 | /* PCI-PCI Bridge */ |
696 | pci_read_bridge_bases(bus); | ||
697 | for (i = PCI_BRIDGE_RESOURCES; i < PCI_NUM_RESOURCES; i++) | 696 | for (i = PCI_BRIDGE_RESOURCES; i < PCI_NUM_RESOURCES; i++) |
698 | pci_claim_bridge_resource(bus->self, i); | 697 | pci_claim_bridge_resource(bus->self, i); |
699 | } else { | 698 | } else { |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index cefd636681b6..b996aefc1092 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -826,6 +826,9 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass) | |||
826 | child->bridge_ctl = bctl; | 826 | child->bridge_ctl = bctl; |
827 | } | 827 | } |
828 | 828 | ||
829 | /* Read and initialize bridge resources */ | ||
830 | pci_read_bridge_bases(child); | ||
831 | |||
829 | cmax = pci_scan_child_bus(child); | 832 | cmax = pci_scan_child_bus(child); |
830 | if (cmax > subordinate) | 833 | if (cmax > subordinate) |
831 | dev_warn(&dev->dev, "bridge has subordinate %02x but max busn %02x\n", | 834 | 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) | |||
886 | 889 | ||
887 | if (!is_cardbus) { | 890 | if (!is_cardbus) { |
888 | child->bridge_ctl = bctl; | 891 | child->bridge_ctl = bctl; |
892 | |||
893 | /* Read and initialize bridge resources */ | ||
894 | pci_read_bridge_bases(child); | ||
889 | max = pci_scan_child_bus(child); | 895 | max = pci_scan_child_bus(child); |
890 | } else { | 896 | } else { |
891 | /* | 897 | /* |