]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
powerpc/eeh: Add bdfn field to eeh_dev
authorOliver O'Halloran <oohall@gmail.com>
Fri, 16 Aug 2019 04:48:11 +0000 (14:48 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 22 Aug 2019 13:12:46 +0000 (23:12 +1000)
Preparation for removing pci_dn from the powernv EEH code. The only
thing we really use pci_dn for is to get the bdfn of the device for
config space accesses, so adding that information to eeh_dev reduces
the need to carry around the pci_dn.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
[SB: Re-wrapped commit message, fixed whitespace damage.]
Signed-off-by: Sam Bobroff <sbobroff@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/e458eb69a1f591d8a120782f23a8506b15d3c654.1565930772.git.sbobroff@linux.ibm.com
arch/powerpc/include/asm/eeh.h
arch/powerpc/include/asm/ppc-pci.h
arch/powerpc/kernel/eeh_dev.c

index 1fc2b5e40822c465bdd1dd06332b203005575e16..294efeaf939e975fed3fe5c32417a4e628d48203 100644 (file)
@@ -121,6 +121,8 @@ static inline bool eeh_pe_passed(struct eeh_pe *pe)
 struct eeh_dev {
        int mode;                       /* EEH mode                     */
        int class_code;                 /* Class code of the device     */
+       int bdfn;                       /* bdfn of device (for cfg ops) */
+       struct pci_controller *controller;
        int pe_config_addr;             /* PE config address            */
        u32 config_space[16];           /* Saved PCI config space       */
        int pcix_cap;                   /* Saved PCIx capability        */
index cec2d640951558f7d41b339e49468fab51b5606f..72860de205a0f2bf9a408c6aa4fdc93ababf786e 100644 (file)
@@ -74,6 +74,8 @@ static inline const char *eeh_driver_name(struct pci_dev *pdev)
 
 #endif /* CONFIG_EEH */
 
+#define PCI_BUSNO(bdfn) ((bdfn >> 8) & 0xff)
+
 #else /* CONFIG_PCI */
 static inline void init_pci_config_tokens(void) { }
 #endif /* !CONFIG_PCI */
index c4317c452d98e706896e7aa6bac87464716849c6..7370185c7a051716f13a01c2c34e706db95e638a 100644 (file)
@@ -47,6 +47,8 @@ struct eeh_dev *eeh_dev_init(struct pci_dn *pdn)
        /* Associate EEH device with OF node */
        pdn->edev = edev;
        edev->pdn = pdn;
+       edev->bdfn = (pdn->busno << 8) | pdn->devfn;
+       edev->controller = pdn->phb;
 
        return edev;
 }