aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorVipin K Parashar <vipin@linux.vnet.ibm.com>2015-07-29 23:28:43 +0530
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-07-31 15:32:43 +1000
commit36c213d95f971804388c336213d636277b0f40f5 (patch)
treed325c6ebec923a8941315a0c2122fa4e0715de16 /hw
parentc37f122d3ca2e7964f971a98c5acbec9435c5616 (diff)
downloadskiboot-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.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/hw/xscom.c b/hw/xscom.c
index ef3ff0f..ba9130a 100644
--- a/hw/xscom.c
+++ b/hw/xscom.c
@@ -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)