diff options
author | Vipin K Parashar <vipin@linux.vnet.ibm.com> | 2015-07-29 23:28:43 +0530 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-07-31 15:32:43 +1000 |
commit | 36c213d95f971804388c336213d636277b0f40f5 (patch) | |
tree | d325c6ebec923a8941315a0c2122fa4e0715de16 /hw | |
parent | c37f122d3ca2e7964f971a98c5acbec9435c5616 (diff) | |
download | skiboot-36c213d95f971804388c336213d636277b0f40f5.zip skiboot-36c213d95f971804388c336213d636277b0f40f5.tar.gz skiboot-36c213d95f971804388c336213d636277b0f40f5.tar.bz2 |
opal-api: Add OPAL call to handle abnormal reboots.
This patch adds a new OPAL call OPAL_CEC_REBOOT2 which will
be used to handle abnormal reboot/termination by kernel host.
This call will allow host kernel to pass reboot type and additional
debug data which needs to be captured/saved somewhere (for later
analysis) before going down.
Currently it will support two reboot types (0). normal reboot, that
will behave similar to that of opal_cec_reboot() call, and
(1). platform error reboot, that will trigger a system checkstop
using xscom address and FIR bit information obtained via device-tree
property 'ibm,sw-checkstop-fir'.
For unsupported reboot type, this call will do nothing and return
with OPAL_UNSUPPORTED.
In future, we can overload this call to support additional reboot types.
Signed-off-by: Vipin K Parashar <vipin@linux.vnet.ibm.com>
Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Reviewed-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/xscom.c | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -53,6 +53,12 @@ DEFINE_LOG_ENTRY(OPAL_RC_XSCOM_RESET, OPAL_PLATFORM_ERR_EVT, OPAL_XSCOM, OPAL_CEC_HARDWARE, OPAL_PREDICTIVE_ERR_GENERAL, OPAL_NA); +/* xscom details to trigger xstop */ +static struct { + uint64_t addr; + uint64_t fir_bit; +} xstop_xscom; + /* * Locking notes: * @@ -483,9 +489,25 @@ static void xscom_init_chip_info(struct proc_chip *chip) chip->ec_level |= (val >> 8) & 0xf; } +/* +* This function triggers xstop by writing to XSCOM. +* Machine would enter xstop state post completion of this. +*/ +int64_t xscom_trigger_xstop(void) +{ + int rc = OPAL_UNSUPPORTED; + + if (xstop_xscom.addr) + rc = xscom_writeme(xstop_xscom.addr, + PPC_BIT(xstop_xscom.fir_bit)); + + return rc; +} + void xscom_init(void) { struct dt_node *xn; + const struct dt_property *p; dt_for_each_compatible(dt_root, xn, "ibm,xscom") { uint32_t gcid = dt_get_chip_id(xn); @@ -521,6 +543,16 @@ void xscom_init(void) chip->ec_level >> 4, chip->ec_level & 0xf); } + + /* Collect details to trigger xstop via XSCOM write */ + p = dt_find_property(dt_root, "ibm,sw-checkstop-fir"); + if (p) { + xstop_xscom.addr = dt_property_get_cell(p, 0); + xstop_xscom.fir_bit = dt_property_get_cell(p, 1); + prlog(PR_INFO, "XSTOP: XSCOM addr = 0x%llx, FIR bit = %lld\n", + xstop_xscom.addr, xstop_xscom.fir_bit); + } else + prlog(PR_INFO, "XSTOP: ibm,sw-checkstop-fir prop not found\n"); } void xscom_used_by_console(void) |