diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2012-02-23 22:19:01 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2012-02-23 22:19:01 -0500 |
commit | 9f786d033d025ab7d2c4d1b959aa81d935eb9e19 (patch) | |
tree | 5a92b3c43935efd5044972fb45eaa2c7ca1c2fcf | |
parent | c04d9e35790013606f18cf56db07f80c3a339608 (diff) |
arm/PCI: get rid of device resource fixups
Tell the PCI core about host bridge address translation so it can take
care of bus-to-resource conversion for us.
CC: Russell King <linux@arm.linux.org.uk>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r-- | arch/arm/common/it8152.c | 4 | ||||
-rw-r--r-- | arch/arm/include/asm/pci.h | 8 | ||||
-rw-r--r-- | arch/arm/kernel/bios32.c | 69 | ||||
-rw-r--r-- | arch/arm/mach-cns3xxx/pcie.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-dove/pcie.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-footbridge/dc21285.c | 8 | ||||
-rw-r--r-- | arch/arm/mach-integrator/pci_v3.c | 7 | ||||
-rw-r--r-- | arch/arm/mach-iop13xx/pci.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-ixp2000/pci.c | 6 | ||||
-rw-r--r-- | arch/arm/mach-ixp23xx/pci.c | 6 | ||||
-rw-r--r-- | arch/arm/mach-ixp4xx/common-pci.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/pcie.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-ks8695/pci.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-mv78xx0/pcie.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/pci.c | 14 | ||||
-rw-r--r-- | arch/arm/mach-sa1100/pci-nanoengine.c | 8 | ||||
-rw-r--r-- | arch/arm/mach-tegra/pcie.c | 6 | ||||
-rw-r--r-- | arch/arm/mach-versatile/pci.c | 6 | ||||
-rw-r--r-- | arch/arm/plat-iop/pci.c | 4 |
19 files changed, 57 insertions, 117 deletions
diff --git a/arch/arm/common/it8152.c b/arch/arm/common/it8152.c index d1bcd7b13ebc..9384c2d02baa 100644 --- a/arch/arm/common/it8152.c +++ b/arch/arm/common/it8152.c | |||
@@ -299,8 +299,8 @@ int __init it8152_pci_setup(int nr, struct pci_sys_data *sys) | |||
299 | goto err1; | 299 | goto err1; |
300 | } | 300 | } |
301 | 301 | ||
302 | pci_add_resource(&sys->resources, &it8152_io); | 302 | pci_add_resource_offset(&sys->resources, &it8152_io, sys->io_offset); |
303 | pci_add_resource(&sys->resources, &it8152_mem); | 303 | pci_add_resource_offset(&sys->resources, &it8152_mem, sys->mem_offset); |
304 | 304 | ||
305 | if (platform_notify || platform_notify_remove) { | 305 | if (platform_notify || platform_notify_remove) { |
306 | printk(KERN_ERR "PCI: Can't use platform_notify\n"); | 306 | printk(KERN_ERR "PCI: Can't use platform_notify\n"); |
diff --git a/arch/arm/include/asm/pci.h b/arch/arm/include/asm/pci.h index da337ba57ffd..4748a75ed112 100644 --- a/arch/arm/include/asm/pci.h +++ b/arch/arm/include/asm/pci.h | |||
@@ -57,13 +57,7 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev, | |||
57 | extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, | 57 | extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, |
58 | enum pci_mmap_state mmap_state, int write_combine); | 58 | enum pci_mmap_state mmap_state, int write_combine); |
59 | 59 | ||
60 | extern void | 60 | #define ARCH_HAS_GENERIC_PCI_OFFSETS |
61 | pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, | ||
62 | struct resource *res); | ||
63 | |||
64 | extern void | ||
65 | pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, | ||
66 | struct pci_bus_region *region); | ||
67 | 61 | ||
68 | /* | 62 | /* |
69 | * Dummy implementation; always return 0. | 63 | * Dummy implementation; always return 0. |
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c index 8d7c22d7dff8..be5d3b23284d 100644 --- a/arch/arm/kernel/bios32.c +++ b/arch/arm/kernel/bios32.c | |||
@@ -294,28 +294,6 @@ static inline int pdev_bad_for_parity(struct pci_dev *dev) | |||
294 | } | 294 | } |
295 | 295 | ||
296 | /* | 296 | /* |
297 | * Adjust the device resources from bus-centric to Linux-centric. | ||
298 | */ | ||
299 | static void __devinit | ||
300 | pdev_fixup_device_resources(struct pci_sys_data *root, struct pci_dev *dev) | ||
301 | { | ||
302 | resource_size_t offset; | ||
303 | int i; | ||
304 | |||
305 | for (i = 0; i < PCI_NUM_RESOURCES; i++) { | ||
306 | if (dev->resource[i].start == 0) | ||
307 | continue; | ||
308 | if (dev->resource[i].flags & IORESOURCE_MEM) | ||
309 | offset = root->mem_offset; | ||
310 | else | ||
311 | offset = root->io_offset; | ||
312 | |||
313 | dev->resource[i].start += offset; | ||
314 | dev->resource[i].end += offset; | ||
315 | } | ||
316 | } | ||
317 | |||
318 | /* | ||
319 | * pcibios_fixup_bus - Called after each bus is probed, | 297 | * pcibios_fixup_bus - Called after each bus is probed, |
320 | * but before its children are examined. | 298 | * but before its children are examined. |
321 | */ | 299 | */ |
@@ -332,8 +310,6 @@ void pcibios_fixup_bus(struct pci_bus *bus) | |||
332 | list_for_each_entry(dev, &bus->devices, bus_list) { | 310 | list_for_each_entry(dev, &bus->devices, bus_list) { |
333 | u16 status; | 311 | u16 status; |
334 | 312 | ||
335 | pdev_fixup_device_resources(root, dev); | ||
336 | |||
337 | pci_read_config_word(dev, PCI_STATUS, &status); | 313 | pci_read_config_word(dev, PCI_STATUS, &status); |
338 | 314 | ||
339 | /* | 315 | /* |
@@ -399,43 +375,6 @@ EXPORT_SYMBOL(pcibios_fixup_bus); | |||
399 | #endif | 375 | #endif |
400 | 376 | ||
401 | /* | 377 | /* |
402 | * Convert from Linux-centric to bus-centric addresses for bridge devices. | ||
403 | */ | ||
404 | void | ||
405 | pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, | ||
406 | struct resource *res) | ||
407 | { | ||
408 | struct pci_sys_data *root = dev->sysdata; | ||
409 | unsigned long offset = 0; | ||
410 | |||
411 | if (res->flags & IORESOURCE_IO) | ||
412 | offset = root->io_offset; | ||
413 | if (res->flags & IORESOURCE_MEM) | ||
414 | offset = root->mem_offset; | ||
415 | |||
416 | region->start = res->start - offset; | ||
417 | region->end = res->end - offset; | ||
418 | } | ||
419 | EXPORT_SYMBOL(pcibios_resource_to_bus); | ||
420 | |||
421 | void __devinit | ||
422 | pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, | ||
423 | struct pci_bus_region *region) | ||
424 | { | ||
425 | struct pci_sys_data *root = dev->sysdata; | ||
426 | unsigned long offset = 0; | ||
427 | |||
428 | if (res->flags & IORESOURCE_IO) | ||
429 | offset = root->io_offset; | ||
430 | if (res->flags & IORESOURCE_MEM) | ||
431 | offset = root->mem_offset; | ||
432 | |||
433 | res->start = region->start + offset; | ||
434 | res->end = region->end + offset; | ||
435 | } | ||
436 | EXPORT_SYMBOL(pcibios_bus_to_resource); | ||
437 | |||
438 | /* | ||
439 | * Swizzle the device pin each time we cross a bridge. | 378 | * Swizzle the device pin each time we cross a bridge. |
440 | * This might update pin and returns the slot number. | 379 | * This might update pin and returns the slot number. |
441 | */ | 380 | */ |
@@ -496,10 +435,10 @@ static void __init pcibios_init_hw(struct hw_pci *hw) | |||
496 | 435 | ||
497 | if (ret > 0) { | 436 | if (ret > 0) { |
498 | if (list_empty(&sys->resources)) { | 437 | if (list_empty(&sys->resources)) { |
499 | pci_add_resource(&sys->resources, | 438 | pci_add_resource_offset(&sys->resources, |
500 | &ioport_resource); | 439 | &ioport_resource, sys->io_offset); |
501 | pci_add_resource(&sys->resources, | 440 | pci_add_resource_offset(&sys->resources, |
502 | &iomem_resource); | 441 | &iomem_resource, sys->mem_offset); |
503 | } | 442 | } |
504 | 443 | ||
505 | sys->bus = hw->scan(nr, sys); | 444 | sys->bus = hw->scan(nr, sys); |
diff --git a/arch/arm/mach-cns3xxx/pcie.c b/arch/arm/mach-cns3xxx/pcie.c index e159d69967c9..79d001f831e0 100644 --- a/arch/arm/mach-cns3xxx/pcie.c +++ b/arch/arm/mach-cns3xxx/pcie.c | |||
@@ -155,8 +155,8 @@ static int cns3xxx_pci_setup(int nr, struct pci_sys_data *sys) | |||
155 | BUG_ON(request_resource(&iomem_resource, res_io) || | 155 | BUG_ON(request_resource(&iomem_resource, res_io) || |
156 | request_resource(&iomem_resource, res_mem)); | 156 | request_resource(&iomem_resource, res_mem)); |
157 | 157 | ||
158 | pci_add_resource(&sys->resources, res_io); | 158 | pci_add_resource_offset(&sys->resources, res_io, sys->io_offset); |
159 | pci_add_resource(&sys->resources, res_mem); | 159 | pci_add_resource_offset(&sys->resources, res_mem, sys->mem_offset); |
160 | 160 | ||
161 | return 1; | 161 | return 1; |
162 | } | 162 | } |
diff --git a/arch/arm/mach-dove/pcie.c b/arch/arm/mach-dove/pcie.c index 52e96d397ba8..48a032005ea3 100644 --- a/arch/arm/mach-dove/pcie.c +++ b/arch/arm/mach-dove/pcie.c | |||
@@ -69,7 +69,7 @@ static int __init dove_pcie_setup(int nr, struct pci_sys_data *sys) | |||
69 | pp->res[0].flags = IORESOURCE_IO; | 69 | pp->res[0].flags = IORESOURCE_IO; |
70 | if (request_resource(&ioport_resource, &pp->res[0])) | 70 | if (request_resource(&ioport_resource, &pp->res[0])) |
71 | panic("Request PCIe IO resource failed\n"); | 71 | panic("Request PCIe IO resource failed\n"); |
72 | pci_add_resource(&sys->resources, &pp->res[0]); | 72 | pci_add_resource_offset(&sys->resources, &pp->res[0], sys->io_offset); |
73 | 73 | ||
74 | /* | 74 | /* |
75 | * IORESOURCE_MEM | 75 | * IORESOURCE_MEM |
@@ -88,7 +88,7 @@ static int __init dove_pcie_setup(int nr, struct pci_sys_data *sys) | |||
88 | pp->res[1].flags = IORESOURCE_MEM; | 88 | pp->res[1].flags = IORESOURCE_MEM; |
89 | if (request_resource(&iomem_resource, &pp->res[1])) | 89 | if (request_resource(&iomem_resource, &pp->res[1])) |
90 | panic("Request PCIe Memory resource failed\n"); | 90 | panic("Request PCIe Memory resource failed\n"); |
91 | pci_add_resource(&sys->resources, &pp->res[1]); | 91 | pci_add_resource_offset(&sys->resources, &pp->res[1], sys->mem_offset); |
92 | 92 | ||
93 | return 1; | 93 | return 1; |
94 | } | 94 | } |
diff --git a/arch/arm/mach-footbridge/dc21285.c b/arch/arm/mach-footbridge/dc21285.c index f685650c25d7..3194d3f73503 100644 --- a/arch/arm/mach-footbridge/dc21285.c +++ b/arch/arm/mach-footbridge/dc21285.c | |||
@@ -275,11 +275,13 @@ int __init dc21285_setup(int nr, struct pci_sys_data *sys) | |||
275 | allocate_resource(&iomem_resource, &res[0], 0x40000000, | 275 | allocate_resource(&iomem_resource, &res[0], 0x40000000, |
276 | 0x80000000, 0xffffffff, 0x40000000, NULL, NULL); | 276 | 0x80000000, 0xffffffff, 0x40000000, NULL, NULL); |
277 | 277 | ||
278 | pci_add_resource(&sys->resources, &ioport_resource); | ||
279 | pci_add_resource(&sys->resources, &res[0]); | ||
280 | pci_add_resource(&sys->resources, &res[1]); | ||
281 | sys->mem_offset = DC21285_PCI_MEM; | 278 | sys->mem_offset = DC21285_PCI_MEM; |
282 | 279 | ||
280 | pci_add_resource_offset(&sys->resources, | ||
281 | &ioport_resource, sys->io_offset); | ||
282 | pci_add_resource_offset(&sys->resources, &res[0], sys->mem_offset); | ||
283 | pci_add_resource_offset(&sys->resources, &res[1], sys->mem_offset); | ||
284 | |||
283 | return 1; | 285 | return 1; |
284 | } | 286 | } |
285 | 287 | ||
diff --git a/arch/arm/mach-integrator/pci_v3.c b/arch/arm/mach-integrator/pci_v3.c index 3c82566acece..015be770c1d8 100644 --- a/arch/arm/mach-integrator/pci_v3.c +++ b/arch/arm/mach-integrator/pci_v3.c | |||
@@ -378,9 +378,10 @@ static int __init pci_v3_setup_resources(struct pci_sys_data *sys) | |||
378 | * the mem resource for this bus | 378 | * the mem resource for this bus |
379 | * the prefetch mem resource for this bus | 379 | * the prefetch mem resource for this bus |
380 | */ | 380 | */ |
381 | pci_add_resource(&sys->resources, &ioport_resource); | 381 | pci_add_resource_offset(&sys->resources, |
382 | pci_add_resource(&sys->resources, &non_mem); | 382 | &ioport_resource, sys->io_offset); |
383 | pci_add_resource(&sys->resources, &pre_mem); | 383 | pci_add_resource_offset(&sys->resources, &non_mem, sys->mem_offset); |
384 | pci_add_resource_offset(&sys->resources, &pre_mem, sys->mem_offset); | ||
384 | 385 | ||
385 | return 1; | 386 | return 1; |
386 | } | 387 | } |
diff --git a/arch/arm/mach-iop13xx/pci.c b/arch/arm/mach-iop13xx/pci.c index b8f5a8736511..861cb12ef436 100644 --- a/arch/arm/mach-iop13xx/pci.c +++ b/arch/arm/mach-iop13xx/pci.c | |||
@@ -1084,8 +1084,8 @@ int iop13xx_pci_setup(int nr, struct pci_sys_data *sys) | |||
1084 | request_resource(&ioport_resource, &res[0]); | 1084 | request_resource(&ioport_resource, &res[0]); |
1085 | request_resource(&iomem_resource, &res[1]); | 1085 | request_resource(&iomem_resource, &res[1]); |
1086 | 1086 | ||
1087 | pci_add_resource(&sys->resources, &res[0]); | 1087 | pci_add_resource_offset(&sys->resources, &res[0], sys->io_offset); |
1088 | pci_add_resource(&sys->resources, &res[1]); | 1088 | pci_add_resource_offset(&sys->resources, &res[1], sys->mem_offset); |
1089 | 1089 | ||
1090 | return 1; | 1090 | return 1; |
1091 | } | 1091 | } |
diff --git a/arch/arm/mach-ixp2000/pci.c b/arch/arm/mach-ixp2000/pci.c index 626fda435aa9..49c36f3cd602 100644 --- a/arch/arm/mach-ixp2000/pci.c +++ b/arch/arm/mach-ixp2000/pci.c | |||
@@ -243,8 +243,10 @@ int ixp2000_pci_setup(int nr, struct pci_sys_data *sys) | |||
243 | if (nr >= 1) | 243 | if (nr >= 1) |
244 | return 0; | 244 | return 0; |
245 | 245 | ||
246 | pci_add_resource(&sys->resources, &ixp2000_pci_io_space); | 246 | pci_add_resource_offset(&sys->resources, |
247 | pci_add_resource(&sys->resources, &ixp2000_pci_mem_space); | 247 | &ixp2000_pci_io_space, sys->io_offset); |
248 | pci_add_resource_offset(&sys->resources, | ||
249 | &ixp2000_pci_mem_space, sys->mem_offset); | ||
248 | 250 | ||
249 | return 1; | 251 | return 1; |
250 | } | 252 | } |
diff --git a/arch/arm/mach-ixp23xx/pci.c b/arch/arm/mach-ixp23xx/pci.c index 25b5c462cea2..3cbbd3208fa8 100644 --- a/arch/arm/mach-ixp23xx/pci.c +++ b/arch/arm/mach-ixp23xx/pci.c | |||
@@ -281,8 +281,10 @@ int ixp23xx_pci_setup(int nr, struct pci_sys_data *sys) | |||
281 | if (nr >= 1) | 281 | if (nr >= 1) |
282 | return 0; | 282 | return 0; |
283 | 283 | ||
284 | pci_add_resource(&sys->resources, &ixp23xx_pci_io_space); | 284 | pci_add_resource_offset(&sys->resources, |
285 | pci_add_resource(&sys->resources, &ixp23xx_pci_mem_space); | 285 | &ixp23xx_pci_io_space, sys->io_offset); |
286 | pci_add_resource_offset(&sys->resources, | ||
287 | &ixp23xx_pci_mem_space, sys->mem_offset); | ||
286 | 288 | ||
287 | return 1; | 289 | return 1; |
288 | } | 290 | } |
diff --git a/arch/arm/mach-ixp4xx/common-pci.c b/arch/arm/mach-ixp4xx/common-pci.c index 5eff15f24bc2..8508882b13f0 100644 --- a/arch/arm/mach-ixp4xx/common-pci.c +++ b/arch/arm/mach-ixp4xx/common-pci.c | |||
@@ -472,8 +472,8 @@ int ixp4xx_setup(int nr, struct pci_sys_data *sys) | |||
472 | request_resource(&ioport_resource, &res[0]); | 472 | request_resource(&ioport_resource, &res[0]); |
473 | request_resource(&iomem_resource, &res[1]); | 473 | request_resource(&iomem_resource, &res[1]); |
474 | 474 | ||
475 | pci_add_resource(&sys->resources, &res[0]); | 475 | pci_add_resource_offset(&sys->resources, &res[0], sys->io_offset); |
476 | pci_add_resource(&sys->resources, &res[1]); | 476 | pci_add_resource_offset(&sys->resources, &res[1], sys->mem_offset); |
477 | 477 | ||
478 | platform_notify = ixp4xx_pci_platform_notify; | 478 | platform_notify = ixp4xx_pci_platform_notify; |
479 | platform_notify_remove = ixp4xx_pci_platform_notify_remove; | 479 | platform_notify_remove = ixp4xx_pci_platform_notify_remove; |
diff --git a/arch/arm/mach-kirkwood/pcie.c b/arch/arm/mach-kirkwood/pcie.c index a066a6d8d9d2..f56a0118c1bb 100644 --- a/arch/arm/mach-kirkwood/pcie.c +++ b/arch/arm/mach-kirkwood/pcie.c | |||
@@ -198,9 +198,9 @@ static int __init kirkwood_pcie_setup(int nr, struct pci_sys_data *sys) | |||
198 | if (request_resource(&iomem_resource, &pp->res[1])) | 198 | if (request_resource(&iomem_resource, &pp->res[1])) |
199 | panic("Request PCIe%d Memory resource failed\n", index); | 199 | panic("Request PCIe%d Memory resource failed\n", index); |
200 | 200 | ||
201 | pci_add_resource(&sys->resources, &pp->res[0]); | ||
202 | pci_add_resource(&sys->resources, &pp->res[1]); | ||
203 | sys->io_offset = 0; | 201 | sys->io_offset = 0; |
202 | pci_add_resource_offset(&sys->resources, &pp->res[0], sys->io_offset); | ||
203 | pci_add_resource_offset(&sys->resources, &pp->res[1], sys->mem_offset); | ||
204 | 204 | ||
205 | /* | 205 | /* |
206 | * Generic PCIe unit setup. | 206 | * Generic PCIe unit setup. |
diff --git a/arch/arm/mach-ks8695/pci.c b/arch/arm/mach-ks8695/pci.c index b26f992071df..acc701435817 100644 --- a/arch/arm/mach-ks8695/pci.c +++ b/arch/arm/mach-ks8695/pci.c | |||
@@ -169,8 +169,8 @@ static int __init ks8695_pci_setup(int nr, struct pci_sys_data *sys) | |||
169 | request_resource(&iomem_resource, &pci_mem); | 169 | request_resource(&iomem_resource, &pci_mem); |
170 | request_resource(&ioport_resource, &pci_io); | 170 | request_resource(&ioport_resource, &pci_io); |
171 | 171 | ||
172 | pci_add_resource(&sys->resources, &pci_io); | 172 | pci_add_resource_offset(&sys->resources, &pci_io, sys->io_offset); |
173 | pci_add_resource(&sys->resources, &pci_mem); | 173 | pci_add_resource_offset(&sys->resources, &pci_mem, sys->mem_offset); |
174 | 174 | ||
175 | /* Assign and enable processor bridge */ | 175 | /* Assign and enable processor bridge */ |
176 | ks8695_local_writeconfig(PCI_BASE_ADDRESS_0, KS8695_PCIMEM_PA); | 176 | ks8695_local_writeconfig(PCI_BASE_ADDRESS_0, KS8695_PCIMEM_PA); |
diff --git a/arch/arm/mach-mv78xx0/pcie.c b/arch/arm/mach-mv78xx0/pcie.c index 8459f6d7d8ca..df3e38055a24 100644 --- a/arch/arm/mach-mv78xx0/pcie.c +++ b/arch/arm/mach-mv78xx0/pcie.c | |||
@@ -155,8 +155,8 @@ static int __init mv78xx0_pcie_setup(int nr, struct pci_sys_data *sys) | |||
155 | orion_pcie_set_local_bus_nr(pp->base, sys->busnr); | 155 | orion_pcie_set_local_bus_nr(pp->base, sys->busnr); |
156 | orion_pcie_setup(pp->base); | 156 | orion_pcie_setup(pp->base); |
157 | 157 | ||
158 | pci_add_resource(&sys->resources, &pp->res[0]); | 158 | pci_add_resource_offset(&sys->resources, &pp->res[0], sys->io_offset); |
159 | pci_add_resource(&sys->resources, &pp->res[1]); | 159 | pci_add_resource_offset(&sys->resources, &pp->res[1], sys->mem_offset); |
160 | 160 | ||
161 | return 1; | 161 | return 1; |
162 | } | 162 | } |
diff --git a/arch/arm/mach-orion5x/pci.c b/arch/arm/mach-orion5x/pci.c index 09a045f0c406..d6a91948e4dc 100644 --- a/arch/arm/mach-orion5x/pci.c +++ b/arch/arm/mach-orion5x/pci.c | |||
@@ -171,13 +171,14 @@ static int __init pcie_setup(struct pci_sys_data *sys) | |||
171 | /* | 171 | /* |
172 | * IORESOURCE_IO | 172 | * IORESOURCE_IO |
173 | */ | 173 | */ |
174 | sys->io_offset = 0; | ||
174 | res[0].name = "PCIe I/O Space"; | 175 | res[0].name = "PCIe I/O Space"; |
175 | res[0].flags = IORESOURCE_IO; | 176 | res[0].flags = IORESOURCE_IO; |
176 | res[0].start = ORION5X_PCIE_IO_BUS_BASE; | 177 | res[0].start = ORION5X_PCIE_IO_BUS_BASE; |
177 | res[0].end = res[0].start + ORION5X_PCIE_IO_SIZE - 1; | 178 | res[0].end = res[0].start + ORION5X_PCIE_IO_SIZE - 1; |
178 | if (request_resource(&ioport_resource, &res[0])) | 179 | if (request_resource(&ioport_resource, &res[0])) |
179 | panic("Request PCIe IO resource failed\n"); | 180 | panic("Request PCIe IO resource failed\n"); |
180 | pci_add_resource(&sys->resources, &res[0]); | 181 | pci_add_resource_offset(&sys->resources, &res[0], sys->io_offset); |
181 | 182 | ||
182 | /* | 183 | /* |
183 | * IORESOURCE_MEM | 184 | * IORESOURCE_MEM |
@@ -188,9 +189,7 @@ static int __init pcie_setup(struct pci_sys_data *sys) | |||
188 | res[1].end = res[1].start + ORION5X_PCIE_MEM_SIZE - 1; | 189 | res[1].end = res[1].start + ORION5X_PCIE_MEM_SIZE - 1; |
189 | if (request_resource(&iomem_resource, &res[1])) | 190 | if (request_resource(&iomem_resource, &res[1])) |
190 | panic("Request PCIe Memory resource failed\n"); | 191 | panic("Request PCIe Memory resource failed\n"); |
191 | pci_add_resource(&sys->resources, &res[1]); | 192 | pci_add_resource_offset(&sys->resources, &res[1], sys->mem_offset); |
192 | |||
193 | sys->io_offset = 0; | ||
194 | 193 | ||
195 | return 1; | 194 | return 1; |
196 | } | 195 | } |
@@ -499,13 +498,14 @@ static int __init pci_setup(struct pci_sys_data *sys) | |||
499 | /* | 498 | /* |
500 | * IORESOURCE_IO | 499 | * IORESOURCE_IO |
501 | */ | 500 | */ |
501 | sys->io_offset = 0; | ||
502 | res[0].name = "PCI I/O Space"; | 502 | res[0].name = "PCI I/O Space"; |
503 | res[0].flags = IORESOURCE_IO; | 503 | res[0].flags = IORESOURCE_IO; |
504 | res[0].start = ORION5X_PCI_IO_BUS_BASE; | 504 | res[0].start = ORION5X_PCI_IO_BUS_BASE; |
505 | res[0].end = res[0].start + ORION5X_PCI_IO_SIZE - 1; | 505 | res[0].end = res[0].start + ORION5X_PCI_IO_SIZE - 1; |
506 | if (request_resource(&ioport_resource, &res[0])) | 506 | if (request_resource(&ioport_resource, &res[0])) |
507 | panic("Request PCI IO resource failed\n"); | 507 | panic("Request PCI IO resource failed\n"); |
508 | pci_add_resource(&sys->resources, &res[0]); | 508 | pci_add_resource_offset(&sys->resources, &res[0], sys->io_offset); |
509 | 509 | ||
510 | /* | 510 | /* |
511 | * IORESOURCE_MEM | 511 | * IORESOURCE_MEM |
@@ -516,9 +516,7 @@ static int __init pci_setup(struct pci_sys_data *sys) | |||
516 | res[1].end = res[1].start + ORION5X_PCI_MEM_SIZE - 1; | 516 | res[1].end = res[1].start + ORION5X_PCI_MEM_SIZE - 1; |
517 | if (request_resource(&iomem_resource, &res[1])) | 517 | if (request_resource(&iomem_resource, &res[1])) |
518 | panic("Request PCI Memory resource failed\n"); | 518 | panic("Request PCI Memory resource failed\n"); |
519 | pci_add_resource(&sys->resources, &res[1]); | 519 | pci_add_resource_offset(&sys->resources, &res[1], sys->mem_offset); |
520 | |||
521 | sys->io_offset = 0; | ||
522 | 520 | ||
523 | return 1; | 521 | return 1; |
524 | } | 522 | } |
diff --git a/arch/arm/mach-sa1100/pci-nanoengine.c b/arch/arm/mach-sa1100/pci-nanoengine.c index 0d01ca788922..b466bca9c651 100644 --- a/arch/arm/mach-sa1100/pci-nanoengine.c +++ b/arch/arm/mach-sa1100/pci-nanoengine.c | |||
@@ -244,9 +244,11 @@ static int __init pci_nanoengine_setup_resources(struct pci_sys_data *sys) | |||
244 | printk(KERN_ERR "PCI: unable to allocate prefetchable\n"); | 244 | printk(KERN_ERR "PCI: unable to allocate prefetchable\n"); |
245 | return -EBUSY; | 245 | return -EBUSY; |
246 | } | 246 | } |
247 | pci_add_resource(&sys->resources, &pci_io_ports); | 247 | pci_add_resource_offset(&sys->resources, &pci_io_ports, sys->io_offset); |
248 | pci_add_resource(&sys->resources, &pci_non_prefetchable_memory); | 248 | pci_add_resource_offset(&sys->resources, |
249 | pci_add_resource(&sys->resources, &pci_prefetchable_memory); | 249 | &pci_non_prefetchable_memory, sys->mem_offset); |
250 | pci_add_resource_offset(&sys->resources, | ||
251 | &pci_prefetchable_memory, sys->mem_offset); | ||
250 | 252 | ||
251 | return 1; | 253 | return 1; |
252 | } | 254 | } |
diff --git a/arch/arm/mach-tegra/pcie.c b/arch/arm/mach-tegra/pcie.c index af8b63435727..14b29ab5d8f0 100644 --- a/arch/arm/mach-tegra/pcie.c +++ b/arch/arm/mach-tegra/pcie.c | |||
@@ -408,7 +408,7 @@ static int tegra_pcie_setup(int nr, struct pci_sys_data *sys) | |||
408 | pp->res[0].flags = IORESOURCE_IO; | 408 | pp->res[0].flags = IORESOURCE_IO; |
409 | if (request_resource(&ioport_resource, &pp->res[0])) | 409 | if (request_resource(&ioport_resource, &pp->res[0])) |
410 | panic("Request PCIe IO resource failed\n"); | 410 | panic("Request PCIe IO resource failed\n"); |
411 | pci_add_resource(&sys->resources, &pp->res[0]); | 411 | pci_add_resource_offset(&sys->resources, &pp->res[0], sys->io_offset); |
412 | 412 | ||
413 | /* | 413 | /* |
414 | * IORESOURCE_MEM | 414 | * IORESOURCE_MEM |
@@ -427,7 +427,7 @@ static int tegra_pcie_setup(int nr, struct pci_sys_data *sys) | |||
427 | pp->res[1].flags = IORESOURCE_MEM; | 427 | pp->res[1].flags = IORESOURCE_MEM; |
428 | if (request_resource(&iomem_resource, &pp->res[1])) | 428 | if (request_resource(&iomem_resource, &pp->res[1])) |
429 | panic("Request PCIe Memory resource failed\n"); | 429 | panic("Request PCIe Memory resource failed\n"); |
430 | pci_add_resource(&sys->resources, &pp->res[1]); | 430 | pci_add_resource_offset(&sys->resources, &pp->res[1], sys->mem_offset); |
431 | 431 | ||
432 | /* | 432 | /* |
433 | * IORESOURCE_MEM | IORESOURCE_PREFETCH | 433 | * IORESOURCE_MEM | IORESOURCE_PREFETCH |
@@ -446,7 +446,7 @@ static int tegra_pcie_setup(int nr, struct pci_sys_data *sys) | |||
446 | pp->res[2].flags = IORESOURCE_MEM | IORESOURCE_PREFETCH; | 446 | pp->res[2].flags = IORESOURCE_MEM | IORESOURCE_PREFETCH; |
447 | if (request_resource(&iomem_resource, &pp->res[2])) | 447 | if (request_resource(&iomem_resource, &pp->res[2])) |
448 | panic("Request PCIe Prefetch Memory resource failed\n"); | 448 | panic("Request PCIe Prefetch Memory resource failed\n"); |
449 | pci_add_resource(&sys->resources, &pp->res[2]); | 449 | pci_add_resource_offset(&sys->resources, &pp->res[2], sys->mem_offset); |
450 | 450 | ||
451 | return 1; | 451 | return 1; |
452 | } | 452 | } |
diff --git a/arch/arm/mach-versatile/pci.c b/arch/arm/mach-versatile/pci.c index 90069bce23bc..51733b022d04 100644 --- a/arch/arm/mach-versatile/pci.c +++ b/arch/arm/mach-versatile/pci.c | |||
@@ -219,9 +219,9 @@ static int __init pci_versatile_setup_resources(struct list_head *resources) | |||
219 | * the mem resource for this bus | 219 | * the mem resource for this bus |
220 | * the prefetch mem resource for this bus | 220 | * the prefetch mem resource for this bus |
221 | */ | 221 | */ |
222 | pci_add_resource(resources, &io_mem); | 222 | pci_add_resource_offset(resources, &io_mem, sys->io_offset); |
223 | pci_add_resource(resources, &non_mem); | 223 | pci_add_resource_offset(resources, &non_mem, sys->mem_offset); |
224 | pci_add_resource(resources, &pre_mem); | 224 | pci_add_resource_offset(resources, &pre_mem, sys->mem_offset); |
225 | 225 | ||
226 | goto out; | 226 | goto out; |
227 | 227 | ||
diff --git a/arch/arm/plat-iop/pci.c b/arch/arm/plat-iop/pci.c index f4d40a27111e..72768356447a 100644 --- a/arch/arm/plat-iop/pci.c +++ b/arch/arm/plat-iop/pci.c | |||
@@ -215,8 +215,8 @@ int iop3xx_pci_setup(int nr, struct pci_sys_data *sys) | |||
215 | sys->mem_offset = IOP3XX_PCI_LOWER_MEM_PA - *IOP3XX_OMWTVR0; | 215 | sys->mem_offset = IOP3XX_PCI_LOWER_MEM_PA - *IOP3XX_OMWTVR0; |
216 | sys->io_offset = IOP3XX_PCI_LOWER_IO_PA - *IOP3XX_OIOWTVR; | 216 | sys->io_offset = IOP3XX_PCI_LOWER_IO_PA - *IOP3XX_OIOWTVR; |
217 | 217 | ||
218 | pci_add_resource(&sys->resources, &res[0]); | 218 | pci_add_resource_offset(&sys->resources, &res[0], sys->io_offset); |
219 | pci_add_resource(&sys->resources, &res[1]); | 219 | pci_add_resource_offset(&sys->resources, &res[1], sys->mem_offset); |
220 | 220 | ||
221 | return 1; | 221 | return 1; |
222 | } | 222 | } |