diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/alpha/kernel/pci.c | 7 | ||||
-rw-r--r-- | arch/alpha/kernel/sys_nautilus.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-dove/pcie.c | 12 | ||||
-rw-r--r-- | arch/arm/mach-mv78xx0/pcie.c | 12 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/pci.c | 32 | ||||
-rw-r--r-- | arch/frv/mb93090-mb00/pci-vdk.c | 6 | ||||
-rw-r--r-- | arch/ia64/sn/kernel/io_init.c | 2 | ||||
-rw-r--r-- | arch/m68k/coldfire/pci.c | 4 | ||||
-rw-r--r-- | arch/microblaze/pci/pci-common.c | 4 | ||||
-rw-r--r-- | arch/mips/pci/pci.c | 32 | ||||
-rw-r--r-- | arch/mn10300/unit-asb2305/pci.c | 6 | ||||
-rw-r--r-- | arch/s390/pci/pci.c | 2 | ||||
-rw-r--r-- | arch/sh/drivers/pci/pci.c | 25 | ||||
-rw-r--r-- | arch/sparc/kernel/leon_pci.c | 16 | ||||
-rw-r--r-- | arch/sparc/kernel/pci.c | 3 | ||||
-rw-r--r-- | arch/sparc/kernel/pcic.c | 4 | ||||
-rw-r--r-- | arch/tile/kernel/pci.c | 2 | ||||
-rw-r--r-- | arch/tile/kernel/pci_gx.c | 2 | ||||
-rw-r--r-- | arch/unicore32/kernel/pci.c | 9 | ||||
-rw-r--r-- | arch/x86/pci/common.c | 2 | ||||
-rw-r--r-- | arch/xtensa/kernel/pci.c | 15 |
21 files changed, 119 insertions, 82 deletions
diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c index 98a1525fa164..82f738e5d54c 100644 --- a/arch/alpha/kernel/pci.c +++ b/arch/alpha/kernel/pci.c | |||
@@ -338,6 +338,8 @@ common_init_pci(void) | |||
338 | 338 | ||
339 | bus = pci_scan_root_bus(NULL, next_busno, alpha_mv.pci_ops, | 339 | bus = pci_scan_root_bus(NULL, next_busno, alpha_mv.pci_ops, |
340 | hose, &resources); | 340 | hose, &resources); |
341 | if (!bus) | ||
342 | continue; | ||
341 | hose->bus = bus; | 343 | hose->bus = bus; |
342 | hose->need_domain_info = need_domain_info; | 344 | hose->need_domain_info = need_domain_info; |
343 | next_busno = bus->busn_res.end + 1; | 345 | next_busno = bus->busn_res.end + 1; |
@@ -353,6 +355,11 @@ common_init_pci(void) | |||
353 | 355 | ||
354 | pci_assign_unassigned_resources(); | 356 | pci_assign_unassigned_resources(); |
355 | pci_fixup_irqs(alpha_mv.pci_swizzle, alpha_mv.pci_map_irq); | 357 | pci_fixup_irqs(alpha_mv.pci_swizzle, alpha_mv.pci_map_irq); |
358 | for (hose = hose_head; hose; hose = hose->next) { | ||
359 | bus = hose->bus; | ||
360 | if (bus) | ||
361 | pci_bus_add_devices(bus); | ||
362 | } | ||
356 | } | 363 | } |
357 | 364 | ||
358 | 365 | ||
diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c index 837c0fa58317..700686d04869 100644 --- a/arch/alpha/kernel/sys_nautilus.c +++ b/arch/alpha/kernel/sys_nautilus.c | |||
@@ -207,6 +207,9 @@ nautilus_init_pci(void) | |||
207 | 207 | ||
208 | /* Scan our single hose. */ | 208 | /* Scan our single hose. */ |
209 | bus = pci_scan_bus(0, alpha_mv.pci_ops, hose); | 209 | bus = pci_scan_bus(0, alpha_mv.pci_ops, hose); |
210 | if (!bus) | ||
211 | return; | ||
212 | |||
210 | hose->bus = bus; | 213 | hose->bus = bus; |
211 | pcibios_claim_one_bus(bus); | 214 | pcibios_claim_one_bus(bus); |
212 | 215 | ||
@@ -253,6 +256,7 @@ nautilus_init_pci(void) | |||
253 | for the root bus, so just clear it. */ | 256 | for the root bus, so just clear it. */ |
254 | bus->self = NULL; | 257 | bus->self = NULL; |
255 | pci_fixup_irqs(alpha_mv.pci_swizzle, alpha_mv.pci_map_irq); | 258 | pci_fixup_irqs(alpha_mv.pci_swizzle, alpha_mv.pci_map_irq); |
259 | pci_bus_add_devices(bus); | ||
256 | } | 260 | } |
257 | 261 | ||
258 | /* | 262 | /* |
diff --git a/arch/arm/mach-dove/pcie.c b/arch/arm/mach-dove/pcie.c index 8a275f297522..91fe97144570 100644 --- a/arch/arm/mach-dove/pcie.c +++ b/arch/arm/mach-dove/pcie.c | |||
@@ -155,17 +155,13 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL, PCI_ANY_ID, rc_pci_fixup); | |||
155 | static struct pci_bus __init * | 155 | static struct pci_bus __init * |
156 | dove_pcie_scan_bus(int nr, struct pci_sys_data *sys) | 156 | dove_pcie_scan_bus(int nr, struct pci_sys_data *sys) |
157 | { | 157 | { |
158 | struct pci_bus *bus; | 158 | if (nr >= num_pcie_ports) { |
159 | |||
160 | if (nr < num_pcie_ports) { | ||
161 | bus = pci_scan_root_bus(NULL, sys->busnr, &pcie_ops, sys, | ||
162 | &sys->resources); | ||
163 | } else { | ||
164 | bus = NULL; | ||
165 | BUG(); | 159 | BUG(); |
160 | return NULL; | ||
166 | } | 161 | } |
167 | 162 | ||
168 | return bus; | 163 | return pci_scan_root_bus(NULL, sys->busnr, &pcie_ops, sys, |
164 | &sys->resources); | ||
169 | } | 165 | } |
170 | 166 | ||
171 | static int __init dove_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 167 | static int __init dove_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
diff --git a/arch/arm/mach-mv78xx0/pcie.c b/arch/arm/mach-mv78xx0/pcie.c index 445e553f4a28..097ea4cb1136 100644 --- a/arch/arm/mach-mv78xx0/pcie.c +++ b/arch/arm/mach-mv78xx0/pcie.c | |||
@@ -197,17 +197,13 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL, PCI_ANY_ID, rc_pci_fixup); | |||
197 | static struct pci_bus __init * | 197 | static struct pci_bus __init * |
198 | mv78xx0_pcie_scan_bus(int nr, struct pci_sys_data *sys) | 198 | mv78xx0_pcie_scan_bus(int nr, struct pci_sys_data *sys) |
199 | { | 199 | { |
200 | struct pci_bus *bus; | 200 | if (nr >= num_pcie_ports) { |
201 | |||
202 | if (nr < num_pcie_ports) { | ||
203 | bus = pci_scan_root_bus(NULL, sys->busnr, &pcie_ops, sys, | ||
204 | &sys->resources); | ||
205 | } else { | ||
206 | bus = NULL; | ||
207 | BUG(); | 201 | BUG(); |
202 | return NULL; | ||
208 | } | 203 | } |
209 | 204 | ||
210 | return bus; | 205 | return pci_scan_root_bus(NULL, sys->busnr, &pcie_ops, sys, |
206 | &sys->resources); | ||
211 | } | 207 | } |
212 | 208 | ||
213 | static int __init mv78xx0_pcie_map_irq(const struct pci_dev *dev, u8 slot, | 209 | static int __init mv78xx0_pcie_map_irq(const struct pci_dev *dev, u8 slot, |
diff --git a/arch/arm/mach-orion5x/pci.c b/arch/arm/mach-orion5x/pci.c index 87a12d6930ff..b02f3947be51 100644 --- a/arch/arm/mach-orion5x/pci.c +++ b/arch/arm/mach-orion5x/pci.c | |||
@@ -540,37 +540,33 @@ void __init orion5x_pci_set_cardbus_mode(void) | |||
540 | 540 | ||
541 | int __init orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys) | 541 | int __init orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys) |
542 | { | 542 | { |
543 | int ret = 0; | ||
544 | |||
545 | vga_base = ORION5X_PCIE_MEM_PHYS_BASE; | 543 | vga_base = ORION5X_PCIE_MEM_PHYS_BASE; |
546 | 544 | ||
547 | if (nr == 0) { | 545 | if (nr == 0) { |
548 | orion_pcie_set_local_bus_nr(PCIE_BASE, sys->busnr); | 546 | orion_pcie_set_local_bus_nr(PCIE_BASE, sys->busnr); |
549 | ret = pcie_setup(sys); | 547 | return pcie_setup(sys); |
550 | } else if (nr == 1 && !orion5x_pci_disabled) { | 548 | } |
549 | |||
550 | if (nr == 1 && !orion5x_pci_disabled) { | ||
551 | orion5x_pci_set_bus_nr(sys->busnr); | 551 | orion5x_pci_set_bus_nr(sys->busnr); |
552 | ret = pci_setup(sys); | 552 | return pci_setup(sys); |
553 | } | 553 | } |
554 | 554 | ||
555 | return ret; | 555 | return 0; |
556 | } | 556 | } |
557 | 557 | ||
558 | struct pci_bus __init *orion5x_pci_sys_scan_bus(int nr, struct pci_sys_data *sys) | 558 | struct pci_bus __init *orion5x_pci_sys_scan_bus(int nr, struct pci_sys_data *sys) |
559 | { | 559 | { |
560 | struct pci_bus *bus; | 560 | if (nr == 0) |
561 | return pci_scan_root_bus(NULL, sys->busnr, &pcie_ops, sys, | ||
562 | &sys->resources); | ||
561 | 563 | ||
562 | if (nr == 0) { | 564 | if (nr == 1 && !orion5x_pci_disabled) |
563 | bus = pci_scan_root_bus(NULL, sys->busnr, &pcie_ops, sys, | 565 | return pci_scan_root_bus(NULL, sys->busnr, &pci_ops, sys, |
564 | &sys->resources); | 566 | &sys->resources); |
565 | } else if (nr == 1 && !orion5x_pci_disabled) { | ||
566 | bus = pci_scan_root_bus(NULL, sys->busnr, &pci_ops, sys, | ||
567 | &sys->resources); | ||
568 | } else { | ||
569 | bus = NULL; | ||
570 | BUG(); | ||
571 | } | ||
572 | 567 | ||
573 | return bus; | 568 | BUG(); |
569 | return NULL; | ||
574 | } | 570 | } |
575 | 571 | ||
576 | int __init orion5x_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 572 | int __init orion5x_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
diff --git a/arch/frv/mb93090-mb00/pci-vdk.c b/arch/frv/mb93090-mb00/pci-vdk.c index b073f4d771a5..f211839e2cae 100644 --- a/arch/frv/mb93090-mb00/pci-vdk.c +++ b/arch/frv/mb93090-mb00/pci-vdk.c | |||
@@ -316,6 +316,7 @@ void pcibios_fixup_bus(struct pci_bus *bus) | |||
316 | 316 | ||
317 | int __init pcibios_init(void) | 317 | int __init pcibios_init(void) |
318 | { | 318 | { |
319 | struct pci_bus *bus; | ||
319 | struct pci_ops *dir = NULL; | 320 | struct pci_ops *dir = NULL; |
320 | LIST_HEAD(resources); | 321 | LIST_HEAD(resources); |
321 | 322 | ||
@@ -383,12 +384,15 @@ int __init pcibios_init(void) | |||
383 | printk("PCI: Probing PCI hardware\n"); | 384 | printk("PCI: Probing PCI hardware\n"); |
384 | pci_add_resource(&resources, &pci_ioport_resource); | 385 | pci_add_resource(&resources, &pci_ioport_resource); |
385 | pci_add_resource(&resources, &pci_iomem_resource); | 386 | pci_add_resource(&resources, &pci_iomem_resource); |
386 | pci_scan_root_bus(NULL, 0, pci_root_ops, NULL, &resources); | 387 | bus = pci_scan_root_bus(NULL, 0, pci_root_ops, NULL, &resources); |
387 | 388 | ||
388 | pcibios_irq_init(); | 389 | pcibios_irq_init(); |
389 | pcibios_fixup_irqs(); | 390 | pcibios_fixup_irqs(); |
390 | pcibios_resource_survey(); | 391 | pcibios_resource_survey(); |
392 | if (!bus) | ||
393 | return 0; | ||
391 | 394 | ||
395 | pci_bus_add_devices(bus); | ||
392 | return 0; | 396 | return 0; |
393 | } | 397 | } |
394 | 398 | ||
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c index 0b5ce82d203d..1be65eb074ec 100644 --- a/arch/ia64/sn/kernel/io_init.c +++ b/arch/ia64/sn/kernel/io_init.c | |||
@@ -271,7 +271,9 @@ sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus) | |||
271 | if (bus == NULL) { | 271 | if (bus == NULL) { |
272 | kfree(res); | 272 | kfree(res); |
273 | kfree(controller); | 273 | kfree(controller); |
274 | return; | ||
274 | } | 275 | } |
276 | pci_bus_add_devices(bus); | ||
275 | } | 277 | } |
276 | 278 | ||
277 | /* | 279 | /* |
diff --git a/arch/m68k/coldfire/pci.c b/arch/m68k/coldfire/pci.c index df9679238b6d..821de928dc3f 100644 --- a/arch/m68k/coldfire/pci.c +++ b/arch/m68k/coldfire/pci.c | |||
@@ -313,12 +313,16 @@ static int __init mcf_pci_init(void) | |||
313 | schedule_timeout(msecs_to_jiffies(200)); | 313 | schedule_timeout(msecs_to_jiffies(200)); |
314 | 314 | ||
315 | rootbus = pci_scan_bus(0, &mcf_pci_ops, NULL); | 315 | rootbus = pci_scan_bus(0, &mcf_pci_ops, NULL); |
316 | if (!rootbus) | ||
317 | return -ENODEV; | ||
318 | |||
316 | rootbus->resource[0] = &mcf_pci_io; | 319 | rootbus->resource[0] = &mcf_pci_io; |
317 | rootbus->resource[1] = &mcf_pci_mem; | 320 | rootbus->resource[1] = &mcf_pci_mem; |
318 | 321 | ||
319 | pci_fixup_irqs(pci_common_swizzle, mcf_pci_map_irq); | 322 | pci_fixup_irqs(pci_common_swizzle, mcf_pci_map_irq); |
320 | pci_bus_size_bridges(rootbus); | 323 | pci_bus_size_bridges(rootbus); |
321 | pci_bus_assign_resources(rootbus); | 324 | pci_bus_assign_resources(rootbus); |
325 | pci_bus_add_devices(rootbus); | ||
322 | return 0; | 326 | return 0; |
323 | } | 327 | } |
324 | 328 | ||
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c index 48528fb81eff..ae838ed5fcf2 100644 --- a/arch/microblaze/pci/pci-common.c +++ b/arch/microblaze/pci/pci-common.c | |||
@@ -1382,6 +1382,10 @@ static int __init pcibios_init(void) | |||
1382 | 1382 | ||
1383 | /* Call common code to handle resource allocation */ | 1383 | /* Call common code to handle resource allocation */ |
1384 | pcibios_resource_survey(); | 1384 | pcibios_resource_survey(); |
1385 | list_for_each_entry_safe(hose, tmp, &hose_list, list_node) { | ||
1386 | if (hose->bus) | ||
1387 | pci_bus_add_devices(hose->bus); | ||
1388 | } | ||
1385 | 1389 | ||
1386 | return 0; | 1390 | return 0; |
1387 | } | 1391 | } |
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c index 1bf60b127377..8bb13a4af68a 100644 --- a/arch/mips/pci/pci.c +++ b/arch/mips/pci/pci.c | |||
@@ -94,27 +94,29 @@ static void pcibios_scanbus(struct pci_controller *hose) | |||
94 | pci_add_resource_offset(&resources, hose->io_resource, hose->io_offset); | 94 | pci_add_resource_offset(&resources, hose->io_resource, hose->io_offset); |
95 | bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose, | 95 | bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose, |
96 | &resources); | 96 | &resources); |
97 | if (!bus) | ||
98 | pci_free_resource_list(&resources); | ||
99 | |||
100 | hose->bus = bus; | 97 | hose->bus = bus; |
101 | 98 | ||
102 | need_domain_info = need_domain_info || hose->index; | 99 | need_domain_info = need_domain_info || hose->index; |
103 | hose->need_domain_info = need_domain_info; | 100 | hose->need_domain_info = need_domain_info; |
104 | if (bus) { | ||
105 | next_busno = bus->busn_res.end + 1; | ||
106 | /* Don't allow 8-bit bus number overflow inside the hose - | ||
107 | reserve some space for bridges. */ | ||
108 | if (next_busno > 224) { | ||
109 | next_busno = 0; | ||
110 | need_domain_info = 1; | ||
111 | } | ||
112 | 101 | ||
113 | if (!pci_has_flag(PCI_PROBE_ONLY)) { | 102 | if (!bus) { |
114 | pci_bus_size_bridges(bus); | 103 | pci_free_resource_list(&resources); |
115 | pci_bus_assign_resources(bus); | 104 | return; |
116 | } | 105 | } |
106 | |||
107 | next_busno = bus->busn_res.end + 1; | ||
108 | /* Don't allow 8-bit bus number overflow inside the hose - | ||
109 | reserve some space for bridges. */ | ||
110 | if (next_busno > 224) { | ||
111 | next_busno = 0; | ||
112 | need_domain_info = 1; | ||
113 | } | ||
114 | |||
115 | if (!pci_has_flag(PCI_PROBE_ONLY)) { | ||
116 | pci_bus_size_bridges(bus); | ||
117 | pci_bus_assign_resources(bus); | ||
117 | } | 118 | } |
119 | pci_bus_add_devices(bus); | ||
118 | } | 120 | } |
119 | 121 | ||
120 | #ifdef CONFIG_OF | 122 | #ifdef CONFIG_OF |
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 | ||
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c index f0b85443e060..b2c76f64c530 100644 --- a/arch/s390/pci/pci.c +++ b/arch/s390/pci/pci.c | |||
@@ -780,8 +780,8 @@ static int zpci_scan_bus(struct zpci_dev *zdev) | |||
780 | zpci_cleanup_bus_resources(zdev); | 780 | zpci_cleanup_bus_resources(zdev); |
781 | return -EIO; | 781 | return -EIO; |
782 | } | 782 | } |
783 | |||
784 | zdev->bus->max_bus_speed = zdev->max_bus_speed; | 783 | zdev->bus->max_bus_speed = zdev->max_bus_speed; |
784 | pci_bus_add_devices(zdev->bus); | ||
785 | return 0; | 785 | return 0; |
786 | } | 786 | } |
787 | 787 | ||
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c index 1bc09ee7948f..d5462b7bc514 100644 --- a/arch/sh/drivers/pci/pci.c +++ b/arch/sh/drivers/pci/pci.c | |||
@@ -58,20 +58,23 @@ static void pcibios_scanbus(struct pci_channel *hose) | |||
58 | 58 | ||
59 | need_domain_info = need_domain_info || hose->index; | 59 | need_domain_info = need_domain_info || hose->index; |
60 | hose->need_domain_info = need_domain_info; | 60 | hose->need_domain_info = need_domain_info; |
61 | if (bus) { | ||
62 | next_busno = bus->busn_res.end + 1; | ||
63 | /* Don't allow 8-bit bus number overflow inside the hose - | ||
64 | reserve some space for bridges. */ | ||
65 | if (next_busno > 224) { | ||
66 | next_busno = 0; | ||
67 | need_domain_info = 1; | ||
68 | } | ||
69 | 61 | ||
70 | pci_bus_size_bridges(bus); | 62 | if (!bus) { |
71 | pci_bus_assign_resources(bus); | ||
72 | } else { | ||
73 | pci_free_resource_list(&resources); | 63 | pci_free_resource_list(&resources); |
64 | return; | ||
65 | } | ||
66 | |||
67 | next_busno = bus->busn_res.end + 1; | ||
68 | /* Don't allow 8-bit bus number overflow inside the hose - | ||
69 | reserve some space for bridges. */ | ||
70 | if (next_busno > 224) { | ||
71 | next_busno = 0; | ||
72 | need_domain_info = 1; | ||
74 | } | 73 | } |
74 | |||
75 | pci_bus_size_bridges(bus); | ||
76 | pci_bus_assign_resources(bus); | ||
77 | pci_bus_add_devices(bus); | ||
75 | } | 78 | } |
76 | 79 | ||
77 | /* | 80 | /* |
diff --git a/arch/sparc/kernel/leon_pci.c b/arch/sparc/kernel/leon_pci.c index 899b7203a4e4..4371f72ff025 100644 --- a/arch/sparc/kernel/leon_pci.c +++ b/arch/sparc/kernel/leon_pci.c | |||
@@ -34,15 +34,17 @@ void leon_pci_init(struct platform_device *ofdev, struct leon_pci_info *info) | |||
34 | 34 | ||
35 | root_bus = pci_scan_root_bus(&ofdev->dev, 0, info->ops, info, | 35 | root_bus = pci_scan_root_bus(&ofdev->dev, 0, info->ops, info, |
36 | &resources); | 36 | &resources); |
37 | if (root_bus) { | 37 | if (!root_bus) { |
38 | /* Setup IRQs of all devices using custom routines */ | ||
39 | pci_fixup_irqs(pci_common_swizzle, info->map_irq); | ||
40 | |||
41 | /* Assign devices with resources */ | ||
42 | pci_assign_unassigned_resources(); | ||
43 | } else { | ||
44 | pci_free_resource_list(&resources); | 38 | pci_free_resource_list(&resources); |
39 | return; | ||
45 | } | 40 | } |
41 | |||
42 | /* Setup IRQs of all devices using custom routines */ | ||
43 | pci_fixup_irqs(pci_common_swizzle, info->map_irq); | ||
44 | |||
45 | /* Assign devices with resources */ | ||
46 | pci_assign_unassigned_resources(); | ||
47 | pci_bus_add_devices(root_bus); | ||
46 | } | 48 | } |
47 | 49 | ||
48 | void pcibios_fixup_bus(struct pci_bus *pbus) | 50 | void pcibios_fixup_bus(struct pci_bus *pbus) |
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c index 9ce5afe167ff..9e267cae683e 100644 --- a/arch/sparc/kernel/pci.c +++ b/arch/sparc/kernel/pci.c | |||
@@ -677,11 +677,10 @@ struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm, | |||
677 | } | 677 | } |
678 | 678 | ||
679 | pci_of_scan_bus(pbm, node, bus); | 679 | pci_of_scan_bus(pbm, node, bus); |
680 | pci_bus_add_devices(bus); | ||
681 | pci_bus_register_of_sysfs(bus); | 680 | pci_bus_register_of_sysfs(bus); |
682 | 681 | ||
683 | pci_claim_bus_resources(bus); | 682 | pci_claim_bus_resources(bus); |
684 | 683 | pci_bus_add_devices(bus); | |
685 | return bus; | 684 | return bus; |
686 | } | 685 | } |
687 | 686 | ||
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c index 6cc78c213c01..24384e1dc33d 100644 --- a/arch/sparc/kernel/pcic.c +++ b/arch/sparc/kernel/pcic.c | |||
@@ -391,12 +391,16 @@ static void __init pcic_pbm_scan_bus(struct linux_pcic *pcic) | |||
391 | struct linux_pbm_info *pbm = &pcic->pbm; | 391 | struct linux_pbm_info *pbm = &pcic->pbm; |
392 | 392 | ||
393 | pbm->pci_bus = pci_scan_bus(pbm->pci_first_busno, &pcic_ops, pbm); | 393 | pbm->pci_bus = pci_scan_bus(pbm->pci_first_busno, &pcic_ops, pbm); |
394 | if (!pbm->pci_bus) | ||
395 | return; | ||
396 | |||
394 | #if 0 /* deadwood transplanted from sparc64 */ | 397 | #if 0 /* deadwood transplanted from sparc64 */ |
395 | pci_fill_in_pbm_cookies(pbm->pci_bus, pbm, pbm->prom_node); | 398 | pci_fill_in_pbm_cookies(pbm->pci_bus, pbm, pbm->prom_node); |
396 | pci_record_assignments(pbm, pbm->pci_bus); | 399 | pci_record_assignments(pbm, pbm->pci_bus); |
397 | pci_assign_unassigned(pbm, pbm->pci_bus); | 400 | pci_assign_unassigned(pbm, pbm->pci_bus); |
398 | pci_fixup_irq(pbm, pbm->pci_bus); | 401 | pci_fixup_irq(pbm, pbm->pci_bus); |
399 | #endif | 402 | #endif |
403 | pci_bus_add_devices(pbm->pci_bus); | ||
400 | } | 404 | } |
401 | 405 | ||
402 | /* | 406 | /* |
diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c index 325df47f114d..9475a74cd53a 100644 --- a/arch/tile/kernel/pci.c +++ b/arch/tile/kernel/pci.c | |||
@@ -339,6 +339,8 @@ int __init pcibios_init(void) | |||
339 | struct pci_bus *next_bus; | 339 | struct pci_bus *next_bus; |
340 | struct pci_dev *dev; | 340 | struct pci_dev *dev; |
341 | 341 | ||
342 | pci_bus_add_devices(root_bus); | ||
343 | |||
342 | list_for_each_entry(dev, &root_bus->devices, bus_list) { | 344 | list_for_each_entry(dev, &root_bus->devices, bus_list) { |
343 | /* | 345 | /* |
344 | * Find the PCI host controller, ie. the 1st | 346 | * Find the PCI host controller, ie. the 1st |
diff --git a/arch/tile/kernel/pci_gx.c b/arch/tile/kernel/pci_gx.c index 2c95f37ebbed..b1df847d0686 100644 --- a/arch/tile/kernel/pci_gx.c +++ b/arch/tile/kernel/pci_gx.c | |||
@@ -1030,6 +1030,8 @@ int __init pcibios_init(void) | |||
1030 | alloc_mem_map_failed: | 1030 | alloc_mem_map_failed: |
1031 | break; | 1031 | break; |
1032 | } | 1032 | } |
1033 | |||
1034 | pci_bus_add_devices(root_bus); | ||
1033 | } | 1035 | } |
1034 | 1036 | ||
1035 | return 0; | 1037 | return 0; |
diff --git a/arch/unicore32/kernel/pci.c b/arch/unicore32/kernel/pci.c index 374a055a8e6b..d45fa5f3e9c4 100644 --- a/arch/unicore32/kernel/pci.c +++ b/arch/unicore32/kernel/pci.c | |||
@@ -266,17 +266,10 @@ static int __init pci_common_init(void) | |||
266 | pci_fixup_irqs(pci_common_swizzle, pci_puv3_map_irq); | 266 | pci_fixup_irqs(pci_common_swizzle, pci_puv3_map_irq); |
267 | 267 | ||
268 | if (!pci_has_flag(PCI_PROBE_ONLY)) { | 268 | if (!pci_has_flag(PCI_PROBE_ONLY)) { |
269 | /* | ||
270 | * Size the bridge windows. | ||
271 | */ | ||
272 | pci_bus_size_bridges(puv3_bus); | 269 | pci_bus_size_bridges(puv3_bus); |
273 | |||
274 | /* | ||
275 | * Assign resources. | ||
276 | */ | ||
277 | pci_bus_assign_resources(puv3_bus); | 270 | pci_bus_assign_resources(puv3_bus); |
278 | } | 271 | } |
279 | 272 | pci_bus_add_devices(puv3_bus); | |
280 | return 0; | 273 | return 0; |
281 | } | 274 | } |
282 | subsys_initcall(pci_common_init); | 275 | subsys_initcall(pci_common_init); |
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c index 3d2612b68694..95a0ba70376b 100644 --- a/arch/x86/pci/common.c +++ b/arch/x86/pci/common.c | |||
@@ -490,7 +490,9 @@ void pcibios_scan_root(int busnum) | |||
490 | if (!bus) { | 490 | if (!bus) { |
491 | pci_free_resource_list(&resources); | 491 | pci_free_resource_list(&resources); |
492 | kfree(sd); | 492 | kfree(sd); |
493 | return; | ||
493 | } | 494 | } |
495 | pci_bus_add_devices(bus); | ||
494 | } | 496 | } |
495 | 497 | ||
496 | void __init pcibios_set_cache_line_size(void) | 498 | void __init pcibios_set_cache_line_size(void) |
diff --git a/arch/xtensa/kernel/pci.c b/arch/xtensa/kernel/pci.c index 5b3403388d7f..b848cc3dc913 100644 --- a/arch/xtensa/kernel/pci.c +++ b/arch/xtensa/kernel/pci.c | |||
@@ -174,7 +174,7 @@ static int __init pcibios_init(void) | |||
174 | struct pci_controller *pci_ctrl; | 174 | struct pci_controller *pci_ctrl; |
175 | struct list_head resources; | 175 | struct list_head resources; |
176 | struct pci_bus *bus; | 176 | struct pci_bus *bus; |
177 | int next_busno = 0; | 177 | int next_busno = 0, ret; |
178 | 178 | ||
179 | printk("PCI: Probing PCI hardware\n"); | 179 | printk("PCI: Probing PCI hardware\n"); |
180 | 180 | ||
@@ -185,14 +185,25 @@ static int __init pcibios_init(void) | |||
185 | pci_controller_apertures(pci_ctrl, &resources); | 185 | pci_controller_apertures(pci_ctrl, &resources); |
186 | bus = pci_scan_root_bus(NULL, pci_ctrl->first_busno, | 186 | bus = pci_scan_root_bus(NULL, pci_ctrl->first_busno, |
187 | pci_ctrl->ops, pci_ctrl, &resources); | 187 | pci_ctrl->ops, pci_ctrl, &resources); |
188 | if (!bus) | ||
189 | continue; | ||
190 | |||
188 | pci_ctrl->bus = bus; | 191 | pci_ctrl->bus = bus; |
189 | pci_ctrl->last_busno = bus->busn_res.end; | 192 | pci_ctrl->last_busno = bus->busn_res.end; |
190 | if (next_busno <= pci_ctrl->last_busno) | 193 | if (next_busno <= pci_ctrl->last_busno) |
191 | next_busno = pci_ctrl->last_busno+1; | 194 | next_busno = pci_ctrl->last_busno+1; |
192 | } | 195 | } |
193 | pci_bus_count = next_busno; | 196 | pci_bus_count = next_busno; |
197 | ret = platform_pcibios_fixup(); | ||
198 | if (ret) | ||
199 | return ret; | ||
194 | 200 | ||
195 | return platform_pcibios_fixup(); | 201 | for (pci_ctrl = pci_ctrl_head; pci_ctrl; pci_ctrl = pci_ctrl->next) { |
202 | if (pci_ctrl->bus) | ||
203 | pci_bus_add_devices(pci_ctrl->bus); | ||
204 | } | ||
205 | |||
206 | return 0; | ||
196 | } | 207 | } |
197 | 208 | ||
198 | subsys_initcall(pcibios_init); | 209 | subsys_initcall(pcibios_init); |