aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-05-05 23:40:40 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-05-05 23:40:40 -0400
commit3fd47f063b17692e843128e2abda3e697df42198 (patch)
treed90a5bdd247b0cc5af7cf78cd18cf6e27a884f00 /arch/powerpc/platforms
parent342d6666f7276723e418b91c885b0c03f02eeaaf (diff)
powerpc/pci: Support per-aperture memory offset
The PCI core supports an offset per aperture nowadays but our arch code still has a single offset per host bridge representing the difference betwen CPU memory addresses and PCI MMIO addresses. This is a problem as new machines and hypervisor versions are coming out where the 64-bit windows will have a different offset (basically mapped 1:1) from the 32-bit windows. This fixes it by using separate offsets. In the long run, we probably want to get rid of that intermediary struct pci_controller and have those directly stored into the pci_host_bridge as they are parsed but this will be a more invasive change. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r--arch/powerpc/platforms/embedded6xx/mpc10x.h11
-rw-r--r--arch/powerpc/platforms/powermac/pci.c2
-rw-r--r--arch/powerpc/platforms/powernv/pci-ioda.c10
-rw-r--r--arch/powerpc/platforms/wsp/wsp_pci.c2
4 files changed, 8 insertions, 17 deletions
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 *