aboutsummaryrefslogtreecommitdiff
path: root/hw/npu2.c
diff options
context:
space:
mode:
authorAlistair Popple <alistair@popple.id.au>2017-06-15 15:51:54 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-06-20 14:31:56 +1000
commit3704e7784d0f65d926901799af14247613006876 (patch)
tree8c5b717167164200faabf525fd45728d2dfb42ed /hw/npu2.c
parentebfcfaa0c3e5b3813d3e35d456f7c16c6a53ff0d (diff)
downloadskiboot-3704e7784d0f65d926901799af14247613006876.zip
skiboot-3704e7784d0f65d926901799af14247613006876.tar.gz
skiboot-3704e7784d0f65d926901799af14247613006876.tar.bz2
NPU2: Add flag to nvlink config space indicating DL reset state
Device drivers need to be able to determine if the DL is out of reset or not so they can safely probe to see if links have already been trained. This patch adds a flag to the vendor specific config space indicating if the DL is out of reset. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw/npu2.c')
-rw-r--r--hw/npu2.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/hw/npu2.c b/hw/npu2.c
index 034f9d3..bdc44e1 100644
--- a/hw/npu2.c
+++ b/hw/npu2.c
@@ -121,6 +121,14 @@ void npu2_write_mask(struct npu2 *p, uint64_t reg, uint64_t val, uint64_t mask)
npu2_scom_write(p->chip_id, p->xscom_base, reg, NPU2_MISC_DA_LEN_8B, new_val);
}
+/* Set a specific flag in the vendor config space */
+void npu2_set_link_flag(struct npu2_dev *ndev, uint8_t flag)
+{
+ ndev->link_flags |= flag;
+ PCI_VIRT_CFG_INIT_RO(ndev->pvd, VENDOR_CAP_START +
+ VENDOR_CAP_PCI_DEV_OFFSET, 1, ndev->link_flags);
+}
+
static inline void npu2_ioda_sel(struct npu2 *p, uint32_t table,
uint32_t index, bool autoinc)
{
@@ -442,8 +450,7 @@ static void npu2_dev_bind_pci_dev(struct npu2_dev *dev)
if (dev->pd) {
dev->phb = phb;
/* Found the device, set the bit in config space */
- PCI_VIRT_CFG_INIT_RO(dev->pvd, VENDOR_CAP_START +
- VENDOR_CAP_PCI_DEV_OFFSET, 1, 0x01);
+ npu2_set_link_flag(dev, NPU2_DEV_PCI_LINKED);
return;
}
}