[Skiboot] [PATCH v2 1/2] opal-api: Add OPAL call OPAL_TRIGGER_XSTOP to invoke xstop

Vipin K Parashar vipin at linux.vnet.ibm.com
Fri Jul 24 05:49:48 AEST 2015


This patch adds a new OPAL call OPAL_TRIGGER_XSTOP which will
be used to invoke xstop. This call invokes xstop by writing to a
XSCOM register. XSCOM address and FIR bit details are obtained
via device-tree property 'ibm,sw-checkstop-fir', which contains
two cells. First cell contains XSCOM address while second cell
contains FIR bit number. No input parameter is required. Machine
enters xstop state upon completion of this call.

Signed-off-by: Vipin K Parashar <vipin at linux.vnet.ibm.com>
---
 hw/xscom.c         | 33 +++++++++++++++++++++++++++++++++
 include/opal-api.h |  3 ++-
 2 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/hw/xscom.c b/hw/xscom.c
index 9d3523c..b875ca9 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, NULL);
 
+/* xscom details to trigger xstop */
+static struct {
+	uint64_t addr;
+	uint64_t fir_bit;
+} xstop_xscom;
+
 /*
  * Locking notes:
  *
@@ -483,9 +489,26 @@ 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.
+*/
+static int64_t opal_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;
+}
+opal_call(OPAL_TRIGGER_XSTOP, opal_trigger_xstop, 0);
+
 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 +544,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)
diff --git a/include/opal-api.h b/include/opal-api.h
index bfad589..1b56270 100644
--- a/include/opal-api.h
+++ b/include/opal-api.h
@@ -161,7 +161,8 @@
 #define OPAL_PRD_MSG				113
 #define OPAL_LEDS_GET_INDICATOR			114
 #define OPAL_LEDS_SET_INDICATOR			115
-#define OPAL_LAST				115
+#define OPAL_TRIGGER_XSTOP			116
+#define OPAL_LAST				116
 
 /* Device tree flags */
 
-- 
1.9.3



More information about the Skiboot mailing list