aboutsummaryrefslogtreecommitdiff
path: root/core/pci-opal.c
diff options
context:
space:
mode:
authorMike Qiu <qiudayu@linux.vnet.ibm.com>2014-07-02 04:02:06 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2014-07-21 14:48:45 +1000
commit5377c73b25c6b19c3b3d238a5bcc7d5f1348ea45 (patch)
treecef3e6c3834eea04d13eebeb77ae4142f57803f7 /core/pci-opal.c
parent3ec0a137016cc515278071c2f7c413e43d345bf8 (diff)
downloadskiboot-5377c73b25c6b19c3b3d238a5bcc7d5f1348ea45.zip
skiboot-5377c73b25c6b19c3b3d238a5bcc7d5f1348ea45.tar.gz
skiboot-5377c73b25c6b19c3b3d238a5bcc7d5f1348ea45.tar.bz2
core: PCI error injection API
The patch introduces new OPAL API opal_pci_err_injct() for injecting PCI errors. Signed-off-by: Mike Qiu <qiudayu@linux.vnet.ibm.com> Reviewed-by: Gavin Shan <gwshan@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'core/pci-opal.c')
-rw-r--r--core/pci-opal.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/core/pci-opal.c b/core/pci-opal.c
index ee534cc..fdeba33 100644
--- a/core/pci-opal.c
+++ b/core/pci-opal.c
@@ -93,6 +93,32 @@ static int64_t opal_pci_eeh_freeze_clear(uint64_t phb_id, uint64_t pe_number,
}
opal_call(OPAL_PCI_EEH_FREEZE_CLEAR, opal_pci_eeh_freeze_clear, 3);
+static int64_t opal_pci_err_injct(uint64_t phb_id, uint32_t pe_no,
+ uint32_t type, uint32_t function,
+ uint64_t addr, uint64_t mask)
+{
+ struct phb *phb = pci_get_phb(phb_id);
+ int64_t rc;
+
+ if (!phb)
+ return OPAL_PARAMETER;
+ if (!phb->ops || !phb->ops->err_injct)
+ return OPAL_UNSUPPORTED;
+
+ if (type != OpalErrinjctTypeIoaBusError &&
+ type != OpalErrinjctTypeIoaBusError64)
+ return OPAL_PARAMETER;
+
+ phb->ops->lock(phb);
+ rc = phb->ops->err_injct(phb, pe_no, type,
+ function, addr, mask);
+ phb->ops->unlock(phb);
+ pci_put_phb(phb);
+
+ return rc;
+}
+opal_call(OPAL_PCI_ERR_INJCT, opal_pci_err_injct, 6);
+
static int64_t opal_pci_phb_mmio_enable(uint64_t phb_id, uint16_t window_type,
uint16_t window_num, uint16_t enable)
{