From 5377c73b25c6b19c3b3d238a5bcc7d5f1348ea45 Mon Sep 17 00:00:00 2001 From: Mike Qiu Date: Wed, 2 Jul 2014 04:02:06 -0400 Subject: core: PCI error injection API The patch introduces new OPAL API opal_pci_err_injct() for injecting PCI errors. Signed-off-by: Mike Qiu Reviewed-by: Gavin Shan Signed-off-by: Benjamin Herrenschmidt --- core/pci-opal.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'core/pci-opal.c') 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) { -- cgit v1.1