aboutsummaryrefslogtreecommitdiff
path: root/hw/phb3.c
diff options
context:
space:
mode:
authorGavin Shan <gwshan@linux.vnet.ibm.com>2017-02-10 12:19:59 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-02-16 16:50:53 +1100
commit6f05217fe0a2b8c35be4fb5cc4294904ec635bb2 (patch)
tree6f3e1302c0caa479693fe58b195faaa245f52ba3 /hw/phb3.c
parentaf23374372850b69cb1351523c2a5cf34db4a968 (diff)
downloadskiboot-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.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/hw/phb3.c b/hw/phb3.c
index e246e46..cdb52cb 100644
--- a/hw/phb3.c
+++ b/hw/phb3.c
@@ -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 ||