diff options
author | Oliver O'Halloran <oohall@gmail.com> | 2018-04-10 17:29:20 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.ibm.com> | 2018-04-11 17:59:57 -0500 |
commit | f10feca2b3324270ca3de47aa98d99911cf85a7c (patch) | |
tree | 73578b006e999b12ed81f9618199275c9522dc12 /hw | |
parent | 778d86bf9e5b9cf61986f6d316707771eed1d409 (diff) | |
download | talos-skiboot-f10feca2b3324270ca3de47aa98d99911cf85a7c.tar.gz talos-skiboot-f10feca2b3324270ca3de47aa98d99911cf85a7c.zip |
phb4: Enable the PCIe slotcap on pluggable slots
Enables reporting of slot status information, etc in the config space of
the root complex. Currently this is only used to set the slot power
limit in our generic PCI code, but we might use it for other things
later on.
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/phb4.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -619,6 +619,8 @@ static int64_t phb4_get_reserved_pe_number(struct phb *phb) static void phb4_root_port_init(struct phb *phb, struct pci_device *dev, int ecap, int aercap) { + struct phb4 *p = phb_to_phb4(phb); + struct pci_slot *slot = dev->slot; uint16_t bdfn = dev->bdfn; uint16_t val16; uint32_t val32; @@ -634,6 +636,24 @@ static void phb4_root_port_init(struct phb *phb, struct pci_device *dev, // FIXME: check recommended init values for phb4 + /* + * Enable the bridge slot capability in the root port's config + * space. This should probably be done *before* we start + * scanning config space, but we need a pci_device struct to + * exist before we do a slot lookup so *faaaaaaaaaaaaaart* + */ + if (slot && slot->pluggable && slot->power_limit) { + uint64_t val; + + val = in_be64(p->regs + PHB_PCIE_SCR); + val |= PHB_PCIE_SCR_SLOT_CAP; + out_be64(p->regs + PHB_PCIE_SCR, val); + + /* update the cached slotcap */ + pci_cfg_read32(phb, bdfn, ecap + PCICAP_EXP_SLOTCAP, + &slot->slot_cap); + } + /* Enable SERR and parity checking */ pci_cfg_read16(phb, bdfn, PCI_CFG_CMD, &val16); val16 |= (PCI_CFG_CMD_SERR_EN | PCI_CFG_CMD_PERR_RESP | |