diff options
author | Gavin Shan <gwshan@linux.vnet.ibm.com> | 2014-07-21 14:35:27 +1000 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2014-07-21 14:48:45 +1000 |
commit | a4202bc19821a024e460592159507a059f993d3b (patch) | |
tree | 9385e51a6fe4e3ef4b5bf905e2a0188b91935aa6 /hw/p7ioc-phb.c | |
parent | 1b5220b4b7a337463cfe77e36d8988039f6facca (diff) | |
download | skiboot-a4202bc19821a024e460592159507a059f993d3b.zip skiboot-a4202bc19821a024e460592159507a059f993d3b.tar.gz skiboot-a4202bc19821a024e460592159507a059f993d3b.tar.bz2 |
PCI: Allow to set frozen state
The patch introduces a new OPAL API opal_pci_eeh_freeze_set(),
which allows to set frozen state for the specified PE, so that
we can support "compound" PE in kernel.
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'hw/p7ioc-phb.c')
-rw-r--r-- | hw/p7ioc-phb.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/hw/p7ioc-phb.c b/hw/p7ioc-phb.c index 64dbfed..834a794 100644 --- a/hw/p7ioc-phb.c +++ b/hw/p7ioc-phb.c @@ -1301,6 +1301,38 @@ static int64_t p7ioc_eeh_freeze_clear(struct phb *phb, uint64_t pe_number, return OPAL_SUCCESS; } +static int64_t p7ioc_eeh_freeze_set(struct phb *phb, uint64_t pe_number, + uint64_t eeh_action_token) +{ + struct p7ioc_phb *p = phb_to_p7ioc_phb(phb); + uint64_t data; + + if (pe_number > 127) + return OPAL_PARAMETER; + + if (eeh_action_token != OPAL_EEH_ACTION_SET_FREEZE_MMIO && + eeh_action_token != OPAL_EEH_ACTION_SET_FREEZE_DMA && + eeh_action_token != OPAL_EEH_ACTION_SET_FREEZE_ALL) + return OPAL_PARAMETER; + + if (eeh_action_token & OPAL_EEH_ACTION_SET_FREEZE_MMIO) { + p7ioc_phb_ioda_sel(p, IODA_TBL_PESTA, pe_number, false); + data = in_be64(p->regs + PHB_IODA_DATA0); + data |= IODA_PESTA_MMIO_FROZEN; + out_be64(p->regs + PHB_IODA_DATA0, data); + } + + if (eeh_action_token & OPAL_EEH_ACTION_SET_FREEZE_DMA) { + p7ioc_phb_ioda_sel(p, IODA_TBL_PESTB, pe_number, false); + data = in_be64(p->regs + PHB_IODA_DATA0); + data |= IODA_PESTB_DMA_STOPPED; + out_be64(p->regs + PHB_IODA_DATA0, data); + } + + return OPAL_SUCCESS; +} + + static int64_t p7ioc_err_injct(struct phb *phb, uint32_t pe_no, uint32_t type, uint32_t function, uint64_t address, uint64_t mask) @@ -2526,6 +2558,7 @@ static const struct phb_ops p7ioc_phb_ops = { .pci_reinit = p7ioc_pci_reinit, .eeh_freeze_status = p7ioc_eeh_freeze_status, .eeh_freeze_clear = p7ioc_eeh_freeze_clear, + .eeh_freeze_set = p7ioc_eeh_freeze_set, .err_injct = p7ioc_err_injct, .get_diag_data = NULL, .get_diag_data2 = p7ioc_get_diag_data, |