diff options
author | Gavin Shan <gwshan@linux.vnet.ibm.com> | 2017-02-10 12:19:59 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-02-16 16:50:53 +1100 |
commit | 6f05217fe0a2b8c35be4fb5cc4294904ec635bb2 (patch) | |
tree | 6f3e1302c0caa479693fe58b195faaa245f52ba3 /hw/phb3.c | |
parent | af23374372850b69cb1351523c2a5cf34db4a968 (diff) | |
download | skiboot-6f05217fe0a2b8c35be4fb5cc4294904ec635bb2.zip skiboot-6f05217fe0a2b8c35be4fb5cc4294904ec635bb2.tar.gz skiboot-6f05217fe0a2b8c35be4fb5cc4294904ec635bb2.tar.bz2 |
core/pci: Initialize AER capability in PCI core
Currently, AER capability is initialized in phb_ops->device_init()
which is called after the device is instantiated by PCI core, or
reinitializing the device after reset in EEH recovery path. It
means we are maintaining similar sets of codes for P7IOC, PHB3
and PHB4.
This moves the logic initializing AER capability from P7IOC, PHB3
and PHB4 to PCI core, thus the duplicated codes can be dropped.
No functional changes introduced by this.
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Reviewed-by: Russell Currey <ruscur@russell.cc>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw/phb3.c')
-rw-r--r-- | hw/phb3.c | 19 |
1 files changed, 3 insertions, 16 deletions
@@ -645,29 +645,16 @@ static int phb3_device_init(struct phb *phb, struct pci_device *dev, void *data __unused) { - int ecap = 0; - int aercap = 0; + int ecap, aercap; /* Some special adapter tweaks for devices directly under the PHB */ phb3_check_device_quirks(phb, dev); - /* Figure out PCIe & AER capability */ - if (pci_has_cap(dev, PCI_CFG_CAP_ID_EXP, false)) { - ecap = pci_cap(dev, PCI_CFG_CAP_ID_EXP, false); - - if (!pci_has_cap(dev, PCIECAP_ID_AER, true)) { - aercap = pci_find_ecap(phb, dev->bdfn, - PCIECAP_ID_AER, NULL); - if (aercap > 0) - pci_set_cap(dev, PCIECAP_ID_AER, aercap, true); - } else { - aercap = pci_cap(dev, PCIECAP_ID_AER, true); - } - } - /* Common initialization for the device */ pci_device_init(phb, dev); + ecap = pci_cap(dev, PCI_CFG_CAP_ID_EXP, false); + aercap = pci_cap(dev, PCIECAP_ID_AER, true); if (dev->dev_type == PCIE_TYPE_ROOT_PORT) phb3_root_port_init(phb, dev, ecap, aercap); else if (dev->dev_type == PCIE_TYPE_SWITCH_UPPORT || |