diff options
author | Yinghai Lu | 2012-11-03 23:39:27 -0500 |
---|---|---|
committer | Bjorn Helgaas | 2013-01-07 16:58:34 -0600 |
commit | dc2f56fa8400677ef4852d5128f03b795cf57e7b (patch) | |
tree | e37ae488d36b8f8f149e8f4198600c0c924b3ff5 /arch/x86 | |
parent | 83edc87ce8b284a3d60ab8072e55041c76a68277 (diff) | |
download | am43-linux-kernel-dc2f56fa8400677ef4852d5128f03b795cf57e7b.tar.gz am43-linux-kernel-dc2f56fa8400677ef4852d5128f03b795cf57e7b.tar.xz am43-linux-kernel-dc2f56fa8400677ef4852d5128f03b795cf57e7b.zip |
x86/PCI: Factor out pcibios_allocate_dev_rom_resource()
Factor pcibios_allocate_rom_resources() and
pcibios_allocate_dev_rom_resource() out of pcibios_assign_resources().
This will allow us to allocate ROM resources for hot-added root buses.
[bhelgaas: changelog]
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/pci/i386.c | 52 |
1 files changed, 35 insertions, 17 deletions
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c index 84696ed1f0e..42dd7555235 100644 --- a/arch/x86/pci/i386.c +++ b/arch/x86/pci/i386.c | |||
@@ -298,27 +298,45 @@ static void __init pcibios_allocate_resources(struct pci_bus *bus, int pass) | |||
298 | } | 298 | } |
299 | } | 299 | } |
300 | 300 | ||
301 | static int __init pcibios_assign_resources(void) | 301 | static void __init pcibios_allocate_dev_rom_resource(struct pci_dev *dev) |
302 | { | 302 | { |
303 | struct pci_dev *dev = NULL; | ||
304 | struct resource *r; | 303 | struct resource *r; |
305 | 304 | ||
306 | if (!(pci_probe & PCI_ASSIGN_ROMS)) { | 305 | /* |
307 | /* | 306 | * Try to use BIOS settings for ROMs, otherwise let |
308 | * Try to use BIOS settings for ROMs, otherwise let | 307 | * pci_assign_unassigned_resources() allocate the new |
309 | * pci_assign_unassigned_resources() allocate the new | 308 | * addresses. |
310 | * addresses. | 309 | */ |
311 | */ | 310 | r = &dev->resource[PCI_ROM_RESOURCE]; |
312 | for_each_pci_dev(dev) { | 311 | if (!r->flags || !r->start) |
313 | r = &dev->resource[PCI_ROM_RESOURCE]; | 312 | return; |
314 | if (!r->flags || !r->start) | 313 | |
315 | continue; | 314 | if (pci_claim_resource(dev, PCI_ROM_RESOURCE) < 0) { |
316 | if (pci_claim_resource(dev, PCI_ROM_RESOURCE) < 0) { | 315 | r->end -= r->start; |
317 | r->end -= r->start; | 316 | r->start = 0; |
318 | r->start = 0; | ||
319 | } | ||
320 | } | ||
321 | } | 317 | } |
318 | } | ||
319 | static void __init pcibios_allocate_rom_resources(struct pci_bus *bus) | ||
320 | { | ||
321 | struct pci_dev *dev; | ||
322 | struct pci_bus *child; | ||
323 | |||
324 | list_for_each_entry(dev, &bus->devices, bus_list) { | ||
325 | pcibios_allocate_dev_rom_resource(dev); | ||
326 | |||
327 | child = dev->subordinate; | ||
328 | if (child) | ||
329 | pcibios_allocate_rom_resources(child); | ||
330 | } | ||
331 | } | ||
332 | |||
333 | static int __init pcibios_assign_resources(void) | ||
334 | { | ||
335 | struct pci_bus *bus; | ||
336 | |||
337 | if (!(pci_probe & PCI_ASSIGN_ROMS)) | ||
338 | list_for_each_entry(bus, &pci_root_buses, node) | ||
339 | pcibios_allocate_rom_resources(bus); | ||
322 | 340 | ||
323 | pci_assign_unassigned_resources(); | 341 | pci_assign_unassigned_resources(); |
324 | pcibios_fw_addr_list_del(); | 342 | pcibios_fw_addr_list_del(); |