diff options
-rw-r--r-- | arch/powerpc/include/asm/pci-bridge.h | 6 | ||||
-rw-r--r-- | arch/powerpc/kernel/pci-common.c | 97 | ||||
-rw-r--r-- | arch/powerpc/kernel/pci_32.c | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/pci_64.c | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/embedded6xx/mpc10x.h | 11 | ||||
-rw-r--r-- | arch/powerpc/platforms/powermac/pci.c | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/powernv/pci-ioda.c | 10 | ||||
-rw-r--r-- | arch/powerpc/platforms/wsp/wsp_pci.c | 2 | ||||
-rw-r--r-- | arch/powerpc/sysdev/fsl_pci.c | 11 | ||||
-rw-r--r-- | arch/powerpc/sysdev/ppc4xx_pci.c | 15 |
10 files changed, 54 insertions, 104 deletions
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h index 0694f73db22d..8b11b5bd9938 100644 --- a/arch/powerpc/include/asm/pci-bridge.h +++ b/arch/powerpc/include/asm/pci-bridge.h | |||
@@ -39,11 +39,6 @@ struct pci_controller { | |||
39 | resource_size_t io_base_phys; | 39 | resource_size_t io_base_phys; |
40 | resource_size_t pci_io_size; | 40 | resource_size_t pci_io_size; |
41 | 41 | ||
42 | /* Some machines (PReP) have a non 1:1 mapping of | ||
43 | * the PCI memory space in the CPU bus space | ||
44 | */ | ||
45 | resource_size_t pci_mem_offset; | ||
46 | |||
47 | /* Some machines have a special region to forward the ISA | 42 | /* Some machines have a special region to forward the ISA |
48 | * "memory" cycles such as VGA memory regions. Left to 0 | 43 | * "memory" cycles such as VGA memory regions. Left to 0 |
49 | * if unsupported | 44 | * if unsupported |
@@ -86,6 +81,7 @@ struct pci_controller { | |||
86 | */ | 81 | */ |
87 | struct resource io_resource; | 82 | struct resource io_resource; |
88 | struct resource mem_resources[3]; | 83 | struct resource mem_resources[3]; |
84 | resource_size_t mem_offset[3]; | ||
89 | int global_number; /* PCI domain number */ | 85 | int global_number; /* PCI domain number */ |
90 | 86 | ||
91 | resource_size_t dma_window_base_cur; | 87 | resource_size_t dma_window_base_cur; |
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index cf00588b0023..f5c5c90799a7 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c | |||
@@ -786,22 +786,8 @@ void pci_process_bridge_OF_ranges(struct pci_controller *hose, | |||
786 | hose->isa_mem_size = size; | 786 | hose->isa_mem_size = size; |
787 | } | 787 | } |
788 | 788 | ||
789 | /* We get the PCI/Mem offset from the first range or | ||
790 | * the, current one if the offset came from an ISA | ||
791 | * hole. If they don't match, bugger. | ||
792 | */ | ||
793 | if (memno == 0 || | ||
794 | (isa_hole >= 0 && pci_addr != 0 && | ||
795 | hose->pci_mem_offset == isa_mb)) | ||
796 | hose->pci_mem_offset = cpu_addr - pci_addr; | ||
797 | else if (pci_addr != 0 && | ||
798 | hose->pci_mem_offset != cpu_addr - pci_addr) { | ||
799 | printk(KERN_INFO | ||
800 | " \\--> Skipped (offset mismatch) !\n"); | ||
801 | continue; | ||
802 | } | ||
803 | |||
804 | /* Build resource */ | 789 | /* Build resource */ |
790 | hose->mem_offset[memno] = cpu_addr - pci_addr; | ||
805 | res = &hose->mem_resources[memno++]; | 791 | res = &hose->mem_resources[memno++]; |
806 | res->flags = IORESOURCE_MEM; | 792 | res->flags = IORESOURCE_MEM; |
807 | if (pci_space & 0x40000000) | 793 | if (pci_space & 0x40000000) |
@@ -817,20 +803,6 @@ void pci_process_bridge_OF_ranges(struct pci_controller *hose, | |||
817 | res->child = NULL; | 803 | res->child = NULL; |
818 | } | 804 | } |
819 | } | 805 | } |
820 | |||
821 | /* If there's an ISA hole and the pci_mem_offset is -not- matching | ||
822 | * the ISA hole offset, then we need to remove the ISA hole from | ||
823 | * the resource list for that brige | ||
824 | */ | ||
825 | if (isa_hole >= 0 && hose->pci_mem_offset != isa_mb) { | ||
826 | unsigned int next = isa_hole + 1; | ||
827 | printk(KERN_INFO " Removing ISA hole at 0x%016llx\n", isa_mb); | ||
828 | if (next < memno) | ||
829 | memmove(&hose->mem_resources[isa_hole], | ||
830 | &hose->mem_resources[next], | ||
831 | sizeof(struct resource) * (memno - next)); | ||
832 | hose->mem_resources[--memno].flags = 0; | ||
833 | } | ||
834 | } | 806 | } |
835 | 807 | ||
836 | /* Decide whether to display the domain number in /proc */ | 808 | /* Decide whether to display the domain number in /proc */ |
@@ -916,6 +888,7 @@ static int pcibios_uninitialized_bridge_resource(struct pci_bus *bus, | |||
916 | struct pci_controller *hose = pci_bus_to_host(bus); | 888 | struct pci_controller *hose = pci_bus_to_host(bus); |
917 | struct pci_dev *dev = bus->self; | 889 | struct pci_dev *dev = bus->self; |
918 | resource_size_t offset; | 890 | resource_size_t offset; |
891 | struct pci_bus_region region; | ||
919 | u16 command; | 892 | u16 command; |
920 | int i; | 893 | int i; |
921 | 894 | ||
@@ -925,10 +898,10 @@ static int pcibios_uninitialized_bridge_resource(struct pci_bus *bus, | |||
925 | 898 | ||
926 | /* Job is a bit different between memory and IO */ | 899 | /* Job is a bit different between memory and IO */ |
927 | if (res->flags & IORESOURCE_MEM) { | 900 | if (res->flags & IORESOURCE_MEM) { |
928 | /* If the BAR is non-0 (res != pci_mem_offset) then it's probably been | 901 | pcibios_resource_to_bus(dev, ®ion, res); |
929 | * initialized by somebody | 902 | |
930 | */ | 903 | /* If the BAR is non-0 then it's probably been initialized */ |
931 | if (res->start != hose->pci_mem_offset) | 904 | if (region.start != 0) |
932 | return 0; | 905 | return 0; |
933 | 906 | ||
934 | /* The BAR is 0, let's check if memory decoding is enabled on | 907 | /* The BAR is 0, let's check if memory decoding is enabled on |
@@ -940,11 +913,11 @@ static int pcibios_uninitialized_bridge_resource(struct pci_bus *bus, | |||
940 | 913 | ||
941 | /* Memory decoding is enabled and the BAR is 0. If any of the bridge | 914 | /* Memory decoding is enabled and the BAR is 0. If any of the bridge |
942 | * resources covers that starting address (0 then it's good enough for | 915 | * resources covers that starting address (0 then it's good enough for |
943 | * us for memory | 916 | * us for memory space) |
944 | */ | 917 | */ |
945 | for (i = 0; i < 3; i++) { | 918 | for (i = 0; i < 3; i++) { |
946 | if ((hose->mem_resources[i].flags & IORESOURCE_MEM) && | 919 | if ((hose->mem_resources[i].flags & IORESOURCE_MEM) && |
947 | hose->mem_resources[i].start == hose->pci_mem_offset) | 920 | hose->mem_resources[i].start == hose->mem_offset[i]) |
948 | return 0; | 921 | return 0; |
949 | } | 922 | } |
950 | 923 | ||
@@ -1381,10 +1354,9 @@ static void __init pcibios_reserve_legacy_regions(struct pci_bus *bus) | |||
1381 | 1354 | ||
1382 | no_io: | 1355 | no_io: |
1383 | /* Check for memory */ | 1356 | /* Check for memory */ |
1384 | offset = hose->pci_mem_offset; | ||
1385 | pr_debug("hose mem offset: %016llx\n", (unsigned long long)offset); | ||
1386 | for (i = 0; i < 3; i++) { | 1357 | for (i = 0; i < 3; i++) { |
1387 | pres = &hose->mem_resources[i]; | 1358 | pres = &hose->mem_resources[i]; |
1359 | offset = hose->mem_offset[i]; | ||
1388 | if (!(pres->flags & IORESOURCE_MEM)) | 1360 | if (!(pres->flags & IORESOURCE_MEM)) |
1389 | continue; | 1361 | continue; |
1390 | pr_debug("hose mem res: %pR\n", pres); | 1362 | pr_debug("hose mem res: %pR\n", pres); |
@@ -1524,6 +1496,7 @@ static void pcibios_setup_phb_resources(struct pci_controller *hose, | |||
1524 | struct list_head *resources) | 1496 | struct list_head *resources) |
1525 | { | 1497 | { |
1526 | struct resource *res; | 1498 | struct resource *res; |
1499 | resource_size_t offset; | ||
1527 | int i; | 1500 | int i; |
1528 | 1501 | ||
1529 | /* Hookup PHB IO resource */ | 1502 | /* Hookup PHB IO resource */ |
@@ -1533,51 +1506,37 @@ static void pcibios_setup_phb_resources(struct pci_controller *hose, | |||
1533 | printk(KERN_WARNING "PCI: I/O resource not set for host" | 1506 | printk(KERN_WARNING "PCI: I/O resource not set for host" |
1534 | " bridge %s (domain %d)\n", | 1507 | " bridge %s (domain %d)\n", |
1535 | hose->dn->full_name, hose->global_number); | 1508 | hose->dn->full_name, hose->global_number); |
1536 | #ifdef CONFIG_PPC32 | 1509 | } else { |
1537 | /* Workaround for lack of IO resource only on 32-bit */ | 1510 | offset = pcibios_io_space_offset(hose); |
1538 | res->start = (unsigned long)hose->io_base_virt - isa_io_base; | 1511 | |
1539 | res->end = res->start + IO_SPACE_LIMIT; | 1512 | pr_debug("PCI: PHB IO resource = %08llx-%08llx [%lx] off 0x%08llx\n", |
1540 | res->flags = IORESOURCE_IO; | ||
1541 | #endif /* CONFIG_PPC32 */ | ||
1542 | } | ||
1543 | if (res->flags) { | ||
1544 | pr_debug("PCI: PHB IO resource = %016llx-%016llx [%lx]\n", | ||
1545 | (unsigned long long)res->start, | 1513 | (unsigned long long)res->start, |
1546 | (unsigned long long)res->end, | 1514 | (unsigned long long)res->end, |
1547 | (unsigned long)res->flags); | 1515 | (unsigned long)res->flags, |
1548 | pci_add_resource_offset(resources, res, pcibios_io_space_offset(hose)); | 1516 | (unsigned long long)offset); |
1549 | 1517 | pci_add_resource_offset(resources, res, offset); | |
1550 | pr_debug("PCI: PHB IO offset = %08lx\n", | ||
1551 | (unsigned long)hose->io_base_virt - _IO_BASE); | ||
1552 | } | 1518 | } |
1553 | 1519 | ||
1554 | /* Hookup PHB Memory resources */ | 1520 | /* Hookup PHB Memory resources */ |
1555 | for (i = 0; i < 3; ++i) { | 1521 | for (i = 0; i < 3; ++i) { |
1556 | res = &hose->mem_resources[i]; | 1522 | res = &hose->mem_resources[i]; |
1557 | if (!res->flags) { | 1523 | if (!res->flags) { |
1558 | if (i > 0) | ||
1559 | continue; | ||
1560 | printk(KERN_ERR "PCI: Memory resource 0 not set for " | 1524 | printk(KERN_ERR "PCI: Memory resource 0 not set for " |
1561 | "host bridge %s (domain %d)\n", | 1525 | "host bridge %s (domain %d)\n", |
1562 | hose->dn->full_name, hose->global_number); | 1526 | hose->dn->full_name, hose->global_number); |
1563 | #ifdef CONFIG_PPC32 | 1527 | continue; |
1564 | /* Workaround for lack of MEM resource only on 32-bit */ | ||
1565 | res->start = hose->pci_mem_offset; | ||
1566 | res->end = (resource_size_t)-1LL; | ||
1567 | res->flags = IORESOURCE_MEM; | ||
1568 | #endif /* CONFIG_PPC32 */ | ||
1569 | } | ||
1570 | if (res->flags) { | ||
1571 | pr_debug("PCI: PHB MEM resource %d = %016llx-%016llx [%lx]\n", i, | ||
1572 | (unsigned long long)res->start, | ||
1573 | (unsigned long long)res->end, | ||
1574 | (unsigned long)res->flags); | ||
1575 | pci_add_resource_offset(resources, res, hose->pci_mem_offset); | ||
1576 | } | 1528 | } |
1577 | } | 1529 | offset = hose->mem_offset[i]; |
1578 | 1530 | ||
1579 | pr_debug("PCI: PHB MEM offset = %016llx\n", | 1531 | |
1580 | (unsigned long long)hose->pci_mem_offset); | 1532 | pr_debug("PCI: PHB MEM resource %d = %08llx-%08llx [%lx] off 0x%08llx\n", i, |
1533 | (unsigned long long)res->start, | ||
1534 | (unsigned long long)res->end, | ||
1535 | (unsigned long)res->flags, | ||
1536 | (unsigned long long)offset); | ||
1537 | |||
1538 | pci_add_resource_offset(resources, res, offset); | ||
1539 | } | ||
1581 | } | 1540 | } |
1582 | 1541 | ||
1583 | /* | 1542 | /* |
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c index e37c2152acf4..432459c817fa 100644 --- a/arch/powerpc/kernel/pci_32.c +++ b/arch/powerpc/kernel/pci_32.c | |||
@@ -295,7 +295,7 @@ long sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn) | |||
295 | case IOBASE_BRIDGE_NUMBER: | 295 | case IOBASE_BRIDGE_NUMBER: |
296 | return (long)hose->first_busno; | 296 | return (long)hose->first_busno; |
297 | case IOBASE_MEMORY: | 297 | case IOBASE_MEMORY: |
298 | return (long)hose->pci_mem_offset; | 298 | return (long)hose->mem_offset[0]; |
299 | case IOBASE_IO: | 299 | case IOBASE_IO: |
300 | return (long)hose->io_base_phys; | 300 | return (long)hose->io_base_phys; |
301 | case IOBASE_ISA_IO: | 301 | case IOBASE_ISA_IO: |
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c index 51a133a78a09..873050d26840 100644 --- a/arch/powerpc/kernel/pci_64.c +++ b/arch/powerpc/kernel/pci_64.c | |||
@@ -246,7 +246,7 @@ long sys_pciconfig_iobase(long which, unsigned long in_bus, | |||
246 | case IOBASE_BRIDGE_NUMBER: | 246 | case IOBASE_BRIDGE_NUMBER: |
247 | return (long)hose->first_busno; | 247 | return (long)hose->first_busno; |
248 | case IOBASE_MEMORY: | 248 | case IOBASE_MEMORY: |
249 | return (long)hose->pci_mem_offset; | 249 | return (long)hose->mem_offset[0]; |
250 | case IOBASE_IO: | 250 | case IOBASE_IO: |
251 | return (long)hose->io_base_phys; | 251 | return (long)hose->io_base_phys; |
252 | case IOBASE_ISA_IO: | 252 | case IOBASE_ISA_IO: |
diff --git a/arch/powerpc/platforms/embedded6xx/mpc10x.h b/arch/powerpc/platforms/embedded6xx/mpc10x.h index b30a6a3b5bd2..b290b63661f1 100644 --- a/arch/powerpc/platforms/embedded6xx/mpc10x.h +++ b/arch/powerpc/platforms/embedded6xx/mpc10x.h | |||
@@ -81,17 +81,6 @@ | |||
81 | #define MPC10X_MAPB_PCI_MEM_OFFSET (MPC10X_MAPB_ISA_MEM_BASE - \ | 81 | #define MPC10X_MAPB_PCI_MEM_OFFSET (MPC10X_MAPB_ISA_MEM_BASE - \ |
82 | MPC10X_MAPB_PCI_MEM_START) | 82 | MPC10X_MAPB_PCI_MEM_START) |
83 | 83 | ||
84 | /* Set hose members to values appropriate for the mem map used */ | ||
85 | #define MPC10X_SETUP_HOSE(hose, map) { \ | ||
86 | (hose)->pci_mem_offset = MPC10X_MAP##map##_PCI_MEM_OFFSET; \ | ||
87 | (hose)->io_space.start = MPC10X_MAP##map##_PCI_IO_START; \ | ||
88 | (hose)->io_space.end = MPC10X_MAP##map##_PCI_IO_END; \ | ||
89 | (hose)->mem_space.start = MPC10X_MAP##map##_PCI_MEM_START; \ | ||
90 | (hose)->mem_space.end = MPC10X_MAP##map##_PCI_MEM_END; \ | ||
91 | (hose)->io_base_virt = (void *)MPC10X_MAP##map##_ISA_IO_BASE; \ | ||
92 | } | ||
93 | |||
94 | |||
95 | /* Miscellaneous Configuration register offsets */ | 84 | /* Miscellaneous Configuration register offsets */ |
96 | #define MPC10X_CFG_PIR_REG 0x09 | 85 | #define MPC10X_CFG_PIR_REG 0x09 |
97 | #define MPC10X_CFG_PIR_HOST_BRIDGE 0x00 | 86 | #define MPC10X_CFG_PIR_HOST_BRIDGE 0x00 |
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c index 2b8af75abc23..cf7009b8c7b6 100644 --- a/arch/powerpc/platforms/powermac/pci.c +++ b/arch/powerpc/platforms/powermac/pci.c | |||
@@ -824,6 +824,7 @@ static void __init parse_region_decode(struct pci_controller *hose, | |||
824 | hose->mem_resources[cur].name = hose->dn->full_name; | 824 | hose->mem_resources[cur].name = hose->dn->full_name; |
825 | hose->mem_resources[cur].start = base; | 825 | hose->mem_resources[cur].start = base; |
826 | hose->mem_resources[cur].end = end; | 826 | hose->mem_resources[cur].end = end; |
827 | hose->mem_offset[cur] = 0; | ||
827 | DBG(" %d: 0x%08lx-0x%08lx\n", cur, base, end); | 828 | DBG(" %d: 0x%08lx-0x%08lx\n", cur, base, end); |
828 | } else { | 829 | } else { |
829 | DBG(" : -0x%08lx\n", end); | 830 | DBG(" : -0x%08lx\n", end); |
@@ -866,7 +867,6 @@ static void __init setup_u3_ht(struct pci_controller* hose) | |||
866 | hose->io_resource.start = 0; | 867 | hose->io_resource.start = 0; |
867 | hose->io_resource.end = 0x003fffff; | 868 | hose->io_resource.end = 0x003fffff; |
868 | hose->io_resource.flags = IORESOURCE_IO; | 869 | hose->io_resource.flags = IORESOURCE_IO; |
869 | hose->pci_mem_offset = 0; | ||
870 | hose->first_busno = 0; | 870 | hose->first_busno = 0; |
871 | hose->last_busno = 0xef; | 871 | hose->last_busno = 0xef; |
872 | 872 | ||
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 97b08fcc8727..1da578b7c1bf 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c | |||
@@ -915,11 +915,14 @@ static void pnv_ioda_setup_pe_seg(struct pci_controller *hose, | |||
915 | index++; | 915 | index++; |
916 | } | 916 | } |
917 | } else if (res->flags & IORESOURCE_MEM) { | 917 | } else if (res->flags & IORESOURCE_MEM) { |
918 | /* WARNING: Assumes M32 is mem region 0 in PHB. We need to | ||
919 | * harden that algorithm when we start supporting M64 | ||
920 | */ | ||
918 | region.start = res->start - | 921 | region.start = res->start - |
919 | hose->pci_mem_offset - | 922 | hose->mem_offset[0] - |
920 | phb->ioda.m32_pci_base; | 923 | phb->ioda.m32_pci_base; |
921 | region.end = res->end - | 924 | region.end = res->end - |
922 | hose->pci_mem_offset - | 925 | hose->mem_offset[0] - |
923 | phb->ioda.m32_pci_base; | 926 | phb->ioda.m32_pci_base; |
924 | index = region.start / phb->ioda.m32_segsize; | 927 | index = region.start / phb->ioda.m32_segsize; |
925 | 928 | ||
@@ -1115,8 +1118,7 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np, int ioda_type) | |||
1115 | phb->ioda.m32_size += 0x10000; | 1118 | phb->ioda.m32_size += 0x10000; |
1116 | 1119 | ||
1117 | phb->ioda.m32_segsize = phb->ioda.m32_size / phb->ioda.total_pe; | 1120 | phb->ioda.m32_segsize = phb->ioda.m32_size / phb->ioda.total_pe; |
1118 | phb->ioda.m32_pci_base = hose->mem_resources[0].start - | 1121 | phb->ioda.m32_pci_base = hose->mem_resources[0].start - hose->mem_offset[0]; |
1119 | hose->pci_mem_offset; | ||
1120 | phb->ioda.io_size = hose->pci_io_size; | 1122 | phb->ioda.io_size = hose->pci_io_size; |
1121 | phb->ioda.io_segsize = phb->ioda.io_size / phb->ioda.total_pe; | 1123 | phb->ioda.io_segsize = phb->ioda.io_size / phb->ioda.total_pe; |
1122 | phb->ioda.io_pci_base = 0; /* XXX calculate this ? */ | 1124 | phb->ioda.io_pci_base = 0; /* XXX calculate this ? */ |
diff --git a/arch/powerpc/platforms/wsp/wsp_pci.c b/arch/powerpc/platforms/wsp/wsp_pci.c index 8e22f561d171..62cb527493e7 100644 --- a/arch/powerpc/platforms/wsp/wsp_pci.c +++ b/arch/powerpc/platforms/wsp/wsp_pci.c | |||
@@ -502,7 +502,7 @@ static void __init wsp_pcie_configure_hw(struct pci_controller *hose) | |||
502 | (~(hose->mem_resources[0].end - | 502 | (~(hose->mem_resources[0].end - |
503 | hose->mem_resources[0].start)) & 0x3ffffff0000ul); | 503 | hose->mem_resources[0].start)) & 0x3ffffff0000ul); |
504 | out_be64(hose->cfg_data + PCIE_REG_M32A_START_ADDR, | 504 | out_be64(hose->cfg_data + PCIE_REG_M32A_START_ADDR, |
505 | (hose->mem_resources[0].start - hose->pci_mem_offset) | 1); | 505 | (hose->mem_resources[0].start - hose->mem_offset[0]) | 1); |
506 | 506 | ||
507 | /* Clear all TVT entries | 507 | /* Clear all TVT entries |
508 | * | 508 | * |
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c index cffe7edac858..028ac1f71b51 100644 --- a/arch/powerpc/sysdev/fsl_pci.c +++ b/arch/powerpc/sysdev/fsl_pci.c | |||
@@ -178,7 +178,7 @@ static void setup_pci_atmu(struct pci_controller *hose) | |||
178 | struct ccsr_pci __iomem *pci = hose->private_data; | 178 | struct ccsr_pci __iomem *pci = hose->private_data; |
179 | int i, j, n, mem_log, win_idx = 3, start_idx = 1, end_idx = 4; | 179 | int i, j, n, mem_log, win_idx = 3, start_idx = 1, end_idx = 4; |
180 | u64 mem, sz, paddr_hi = 0; | 180 | u64 mem, sz, paddr_hi = 0; |
181 | u64 paddr_lo = ULLONG_MAX; | 181 | u64 offset = 0, paddr_lo = ULLONG_MAX; |
182 | u32 pcicsrbar = 0, pcicsrbar_sz; | 182 | u32 pcicsrbar = 0, pcicsrbar_sz; |
183 | u32 piwar = PIWAR_EN | PIWAR_PF | PIWAR_TGI_LOCAL | | 183 | u32 piwar = PIWAR_EN | PIWAR_PF | PIWAR_TGI_LOCAL | |
184 | PIWAR_READ_SNOOP | PIWAR_WRITE_SNOOP; | 184 | PIWAR_READ_SNOOP | PIWAR_WRITE_SNOOP; |
@@ -208,8 +208,9 @@ static void setup_pci_atmu(struct pci_controller *hose) | |||
208 | paddr_lo = min(paddr_lo, (u64)hose->mem_resources[i].start); | 208 | paddr_lo = min(paddr_lo, (u64)hose->mem_resources[i].start); |
209 | paddr_hi = max(paddr_hi, (u64)hose->mem_resources[i].end); | 209 | paddr_hi = max(paddr_hi, (u64)hose->mem_resources[i].end); |
210 | 210 | ||
211 | n = setup_one_atmu(pci, j, &hose->mem_resources[i], | 211 | /* We assume all memory resources have the same offset */ |
212 | hose->pci_mem_offset); | 212 | offset = hose->mem_offset[i]; |
213 | n = setup_one_atmu(pci, j, &hose->mem_resources[i], offset); | ||
213 | 214 | ||
214 | if (n < 0 || j >= 5) { | 215 | if (n < 0 || j >= 5) { |
215 | pr_err("Ran out of outbound PCI ATMUs for resource %d!\n", i); | 216 | pr_err("Ran out of outbound PCI ATMUs for resource %d!\n", i); |
@@ -239,8 +240,8 @@ static void setup_pci_atmu(struct pci_controller *hose) | |||
239 | } | 240 | } |
240 | 241 | ||
241 | /* convert to pci address space */ | 242 | /* convert to pci address space */ |
242 | paddr_hi -= hose->pci_mem_offset; | 243 | paddr_hi -= offset; |
243 | paddr_lo -= hose->pci_mem_offset; | 244 | paddr_lo -= offset; |
244 | 245 | ||
245 | if (paddr_hi == paddr_lo) { | 246 | if (paddr_hi == paddr_lo) { |
246 | pr_err("%s: No outbound window space\n", name); | 247 | pr_err("%s: No outbound window space\n", name); |
diff --git a/arch/powerpc/sysdev/ppc4xx_pci.c b/arch/powerpc/sysdev/ppc4xx_pci.c index 56e8b3c3c890..64603a10b863 100644 --- a/arch/powerpc/sysdev/ppc4xx_pci.c +++ b/arch/powerpc/sysdev/ppc4xx_pci.c | |||
@@ -257,6 +257,7 @@ static void __init ppc4xx_configure_pci_PMMs(struct pci_controller *hose, | |||
257 | /* Setup outbound memory windows */ | 257 | /* Setup outbound memory windows */ |
258 | for (i = j = 0; i < 3; i++) { | 258 | for (i = j = 0; i < 3; i++) { |
259 | struct resource *res = &hose->mem_resources[i]; | 259 | struct resource *res = &hose->mem_resources[i]; |
260 | resource_size_t offset = hose->mem_offset[i]; | ||
260 | 261 | ||
261 | /* we only care about memory windows */ | 262 | /* we only care about memory windows */ |
262 | if (!(res->flags & IORESOURCE_MEM)) | 263 | if (!(res->flags & IORESOURCE_MEM)) |
@@ -270,7 +271,7 @@ static void __init ppc4xx_configure_pci_PMMs(struct pci_controller *hose, | |||
270 | /* Configure the resource */ | 271 | /* Configure the resource */ |
271 | if (ppc4xx_setup_one_pci_PMM(hose, reg, | 272 | if (ppc4xx_setup_one_pci_PMM(hose, reg, |
272 | res->start, | 273 | res->start, |
273 | res->start - hose->pci_mem_offset, | 274 | res->start - offset, |
274 | resource_size(res), | 275 | resource_size(res), |
275 | res->flags, | 276 | res->flags, |
276 | j) == 0) { | 277 | j) == 0) { |
@@ -279,7 +280,7 @@ static void __init ppc4xx_configure_pci_PMMs(struct pci_controller *hose, | |||
279 | /* If the resource PCI address is 0 then we have our | 280 | /* If the resource PCI address is 0 then we have our |
280 | * ISA memory hole | 281 | * ISA memory hole |
281 | */ | 282 | */ |
282 | if (res->start == hose->pci_mem_offset) | 283 | if (res->start == offset) |
283 | found_isa_hole = 1; | 284 | found_isa_hole = 1; |
284 | } | 285 | } |
285 | } | 286 | } |
@@ -457,6 +458,7 @@ static void __init ppc4xx_configure_pcix_POMs(struct pci_controller *hose, | |||
457 | /* Setup outbound memory windows */ | 458 | /* Setup outbound memory windows */ |
458 | for (i = j = 0; i < 3; i++) { | 459 | for (i = j = 0; i < 3; i++) { |
459 | struct resource *res = &hose->mem_resources[i]; | 460 | struct resource *res = &hose->mem_resources[i]; |
461 | resource_size_t offset = hose->mem_offset[i]; | ||
460 | 462 | ||
461 | /* we only care about memory windows */ | 463 | /* we only care about memory windows */ |
462 | if (!(res->flags & IORESOURCE_MEM)) | 464 | if (!(res->flags & IORESOURCE_MEM)) |
@@ -470,7 +472,7 @@ static void __init ppc4xx_configure_pcix_POMs(struct pci_controller *hose, | |||
470 | /* Configure the resource */ | 472 | /* Configure the resource */ |
471 | if (ppc4xx_setup_one_pcix_POM(hose, reg, | 473 | if (ppc4xx_setup_one_pcix_POM(hose, reg, |
472 | res->start, | 474 | res->start, |
473 | res->start - hose->pci_mem_offset, | 475 | res->start - offset, |
474 | resource_size(res), | 476 | resource_size(res), |
475 | res->flags, | 477 | res->flags, |
476 | j) == 0) { | 478 | j) == 0) { |
@@ -479,7 +481,7 @@ static void __init ppc4xx_configure_pcix_POMs(struct pci_controller *hose, | |||
479 | /* If the resource PCI address is 0 then we have our | 481 | /* If the resource PCI address is 0 then we have our |
480 | * ISA memory hole | 482 | * ISA memory hole |
481 | */ | 483 | */ |
482 | if (res->start == hose->pci_mem_offset) | 484 | if (res->start == offset) |
483 | found_isa_hole = 1; | 485 | found_isa_hole = 1; |
484 | } | 486 | } |
485 | } | 487 | } |
@@ -1792,6 +1794,7 @@ static void __init ppc4xx_configure_pciex_POMs(struct ppc4xx_pciex_port *port, | |||
1792 | /* Setup outbound memory windows */ | 1794 | /* Setup outbound memory windows */ |
1793 | for (i = j = 0; i < 3; i++) { | 1795 | for (i = j = 0; i < 3; i++) { |
1794 | struct resource *res = &hose->mem_resources[i]; | 1796 | struct resource *res = &hose->mem_resources[i]; |
1797 | resource_size_t offset = hose->mem_offset[i]; | ||
1795 | 1798 | ||
1796 | /* we only care about memory windows */ | 1799 | /* we only care about memory windows */ |
1797 | if (!(res->flags & IORESOURCE_MEM)) | 1800 | if (!(res->flags & IORESOURCE_MEM)) |
@@ -1805,7 +1808,7 @@ static void __init ppc4xx_configure_pciex_POMs(struct ppc4xx_pciex_port *port, | |||
1805 | /* Configure the resource */ | 1808 | /* Configure the resource */ |
1806 | if (ppc4xx_setup_one_pciex_POM(port, hose, mbase, | 1809 | if (ppc4xx_setup_one_pciex_POM(port, hose, mbase, |
1807 | res->start, | 1810 | res->start, |
1808 | res->start - hose->pci_mem_offset, | 1811 | res->start - offset, |
1809 | resource_size(res), | 1812 | resource_size(res), |
1810 | res->flags, | 1813 | res->flags, |
1811 | j) == 0) { | 1814 | j) == 0) { |
@@ -1814,7 +1817,7 @@ static void __init ppc4xx_configure_pciex_POMs(struct ppc4xx_pciex_port *port, | |||
1814 | /* If the resource PCI address is 0 then we have our | 1817 | /* If the resource PCI address is 0 then we have our |
1815 | * ISA memory hole | 1818 | * ISA memory hole |
1816 | */ | 1819 | */ |
1817 | if (res->start == hose->pci_mem_offset) | 1820 | if (res->start == offset) |
1818 | found_isa_hole = 1; | 1821 | found_isa_hole = 1; |
1819 | } | 1822 | } |
1820 | } | 1823 | } |