diff options
author | Yijing Wang <wangyijing@huawei.com> | 2015-03-15 23:18:56 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2015-03-19 11:17:13 -0400 |
commit | b97ea289cf6aff8d4cbcefe2b707bb9b00a73c73 (patch) | |
tree | efa328fedf08e394912322783660d27c33257610 /arch/mn10300 | |
parent | c90570d9511d42421c85709b46bffd366185d835 (diff) |
PCI: Assign resources before drivers claim devices (pci_scan_root_bus())
Previously, pci_scan_root_bus() created a root PCI bus, enumerated the
devices on it, and called pci_bus_add_devices(), which made the devices
available for drivers to claim them.
Most callers assigned resources to devices after pci_scan_root_bus()
returns, which may be after drivers have claimed the devices. This is
incorrect; the PCI core should not change device resources while a driver
is managing the device.
Remove pci_bus_add_devices() from pci_scan_root_bus() and do it after any
resource assignment in the callers.
Note that ARM's pci_common_init_dev() already called pci_bus_add_devices()
after pci_scan_root_bus(), so we only need to remove the first call:
pci_common_init_dev
pcibios_init_hw
pci_scan_root_bus
pci_bus_add_devices # first call
pci_bus_assign_resources
pci_bus_add_devices # second call
[bhelgaas: changelog, drop "root_bus" var in alpha common_init_pci(),
return failure earlier in mn10300, add "return" in x86 pcibios_scan_root(),
return early if xtensa platform_pcibios_fixup() fails]
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: Richard Henderson <rth@twiddle.net>
CC: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
CC: Matt Turner <mattst88@gmail.com>
CC: David Howells <dhowells@redhat.com>
CC: Tony Luck <tony.luck@intel.com>
CC: Michal Simek <monstr@monstr.eu>
CC: Ralf Baechle <ralf@linux-mips.org>
CC: Koichi Yasutake <yasutake.koichi@jp.panasonic.com>
CC: Sebastian Ott <sebott@linux.vnet.ibm.com>
CC: "David S. Miller" <davem@davemloft.net>
CC: Chris Metcalf <cmetcalf@ezchip.com>
CC: Chris Zankel <chris@zankel.net>
CC: Max Filippov <jcmvbkbc@gmail.com>
CC: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/mn10300')
-rw-r--r-- | arch/mn10300/unit-asb2305/pci.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/arch/mn10300/unit-asb2305/pci.c b/arch/mn10300/unit-asb2305/pci.c index 613ca1e55b4b..3dfe2d31c67b 100644 --- a/arch/mn10300/unit-asb2305/pci.c +++ b/arch/mn10300/unit-asb2305/pci.c | |||
@@ -342,6 +342,7 @@ static int __init pcibios_init(void) | |||
342 | { | 342 | { |
343 | resource_size_t io_offset, mem_offset; | 343 | resource_size_t io_offset, mem_offset; |
344 | LIST_HEAD(resources); | 344 | LIST_HEAD(resources); |
345 | struct pci_bus *bus; | ||
345 | 346 | ||
346 | ioport_resource.start = 0xA0000000; | 347 | ioport_resource.start = 0xA0000000; |
347 | ioport_resource.end = 0xDFFFFFFF; | 348 | ioport_resource.end = 0xDFFFFFFF; |
@@ -371,11 +372,14 @@ static int __init pcibios_init(void) | |||
371 | 372 | ||
372 | pci_add_resource_offset(&resources, &pci_ioport_resource, io_offset); | 373 | pci_add_resource_offset(&resources, &pci_ioport_resource, io_offset); |
373 | pci_add_resource_offset(&resources, &pci_iomem_resource, mem_offset); | 374 | pci_add_resource_offset(&resources, &pci_iomem_resource, mem_offset); |
374 | pci_scan_root_bus(NULL, 0, &pci_direct_ampci, NULL, &resources); | 375 | bus = pci_scan_root_bus(NULL, 0, &pci_direct_ampci, NULL, &resources); |
376 | if (!bus) | ||
377 | return 0; | ||
375 | 378 | ||
376 | pcibios_irq_init(); | 379 | pcibios_irq_init(); |
377 | pcibios_fixup_irqs(); | 380 | pcibios_fixup_irqs(); |
378 | pcibios_resource_survey(); | 381 | pcibios_resource_survey(); |
382 | pci_bus_add_devices(bus); | ||
379 | return 0; | 383 | return 0; |
380 | } | 384 | } |
381 | 385 | ||