diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2013-05-05 23:40:40 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2013-05-05 23:40:40 -0400 |
commit | 3fd47f063b17692e843128e2abda3e697df42198 (patch) | |
tree | d90a5bdd247b0cc5af7cf78cd18cf6e27a884f00 /arch/powerpc/platforms/powernv/pci-ioda.c | |
parent | 342d6666f7276723e418b91c885b0c03f02eeaaf (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/powernv/pci-ioda.c')
-rw-r--r-- | arch/powerpc/platforms/powernv/pci-ioda.c | 10 |
1 files changed, 6 insertions, 4 deletions
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 ? */ |