aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/powernv/pci-ioda.c
diff options
context:
space:
mode:
authorGavin Shan <gwshan@linux.vnet.ibm.com>2016-05-03 01:41:28 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2016-05-11 07:54:19 -0400
commit69d733e72ddae1680ffd3b5c648ff31cb46d9cc9 (patch)
tree981d4dbb1446aad40de991a25e293420ba987a6d /arch/powerpc/platforms/powernv/pci-ioda.c
parent23e79425fe7caaa93ddcee18ac4c57069f0fb4b6 (diff)
powerpc/powernv: IO and M32 mapping based on PCI device resources
Currently, the IO and M32 segments are mapped to the corresponding PE based on the windows of the parent bridge of PE's primary bus. It's not going to work when the windows of root port or upstream port of the PCIe switch behind root port are extended to PHB's apertures in order to support hotplug in subsequent patch. This fixes the issue by mapping IO and M32 segments based on the resources of the PCI devices included in the PE, instead of the windows of the parent bridge of the PE's primary bus. Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/platforms/powernv/pci-ioda.c')
-rw-r--r--arch/powerpc/platforms/powernv/pci-ioda.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index b954fbcfe14d..904790bf9566 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -2993,7 +2993,7 @@ static void pnv_ioda_setup_pe_res(struct pnv_ioda_pe *pe,
2993 */ 2993 */
2994static void pnv_ioda_setup_pe_seg(struct pnv_ioda_pe *pe) 2994static void pnv_ioda_setup_pe_seg(struct pnv_ioda_pe *pe)
2995{ 2995{
2996 struct resource *res; 2996 struct pci_dev *pdev;
2997 int i; 2997 int i;
2998 2998
2999 /* 2999 /*
@@ -3003,8 +3003,21 @@ static void pnv_ioda_setup_pe_seg(struct pnv_ioda_pe *pe)
3003 */ 3003 */
3004 BUG_ON(!(pe->flags & (PNV_IODA_PE_BUS | PNV_IODA_PE_BUS_ALL))); 3004 BUG_ON(!(pe->flags & (PNV_IODA_PE_BUS | PNV_IODA_PE_BUS_ALL)));
3005 3005
3006 pci_bus_for_each_resource(pe->pbus, res, i) 3006 list_for_each_entry(pdev, &pe->pbus->devices, bus_list) {
3007 pnv_ioda_setup_pe_res(pe, res); 3007 for (i = 0; i <= PCI_ROM_RESOURCE; i++)
3008 pnv_ioda_setup_pe_res(pe, &pdev->resource[i]);
3009
3010 /*
3011 * If the PE contains all subordinate PCI buses, the
3012 * windows of the child bridges should be mapped to
3013 * the PE as well.
3014 */
3015 if (!(pe->flags & PNV_IODA_PE_BUS_ALL) || !pci_is_bridge(pdev))
3016 continue;
3017 for (i = 0; i < PCI_BRIDGE_RESOURCE_NUM; i++)
3018 pnv_ioda_setup_pe_res(pe,
3019 &pdev->resource[PCI_BRIDGE_RESOURCES + i]);
3020 }
3008} 3021}
3009 3022
3010static void pnv_pci_ioda_setup_seg(void) 3023static void pnv_pci_ioda_setup_seg(void)