aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/powernv/pci-ioda.c
diff options
context:
space:
mode:
authorOliver O'Halloran <oohall@gmail.com>2020-04-17 17:35:05 +1000
committerMichael Ellerman <mpe@ellerman.id.au>2020-05-28 23:24:38 +1000
commita8d7d5fc2e1672924a391aa37ef8c02d1ec84a4e (patch)
treea25a4773ee37656e4eef8c66d1b0ceec607c81d7 /arch/powerpc/platforms/powernv/pci-ioda.c
parentpowerpc/powernv/pci: Add an explaination for PNV_IODA_PE_BUS_ALL (diff)
downloadlinux-dev-a8d7d5fc2e1672924a391aa37ef8c02d1ec84a4e.tar.xz
linux-dev-a8d7d5fc2e1672924a391aa37ef8c02d1ec84a4e.zip
powerpc/powernv/pci: Add helper to find ioda_pe from BDFN
For each PHB we maintain a reverse-map that can be used to find the PE that a BDFN is currently mapped to. Add a helper for doing this lookup so we can check if a PE has been configured without looking at pdn->pe_number. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20200417073508.30356-2-oohall@gmail.com
Diffstat (limited to 'arch/powerpc/platforms/powernv/pci-ioda.c')
-rw-r--r--arch/powerpc/platforms/powernv/pci-ioda.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 9902f2bea0ec..88d9bdc46373 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -660,6 +660,16 @@ static int pnv_ioda_get_pe_state(struct pnv_phb *phb, int pe_no)
return state;
}
+struct pnv_ioda_pe *pnv_pci_bdfn_to_pe(struct pnv_phb *phb, u16 bdfn)
+{
+ int pe_number = phb->ioda.pe_rmap[bdfn];
+
+ if (pe_number == IODA_INVALID_PE)
+ return NULL;
+
+ return &phb->ioda.pe_array[pe_number];
+}
+
struct pnv_ioda_pe *pnv_ioda_get_pe(struct pci_dev *dev)
{
struct pci_controller *hose = pci_bus_to_host(dev->bus);