[Skiboot] [RFC PATCH] opal: Extract sw checkstop fir address from HDAT.

Mahesh J Salgaonkar mahesh at linux.vnet.ibm.com
Wed Aug 16 23:51:52 AEST 2017


From: Mahesh Salgaonkar <mahesh at linux.vnet.ibm.com>

Extract sw checkstop fir address info from HDAT and populate device tree
node ibm,sw-checkstop-fir.

This patch is required for OPAL_CEC_REBOOT2 OPAL call to work as expected
on p9.

This is an RFC patch need to be tested.

Signed-off-by: Mahesh Salgaonkar <mahesh at linux.vnet.ibm.com>
---
 hdata/spira.c |   25 ++++++++++++++++++++++++-
 hdata/spira.h |    4 ++++
 2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/hdata/spira.c b/hdata/spira.c
index d5e6984..676daf9 100644
--- a/hdata/spira.c
+++ b/hdata/spira.c
@@ -425,9 +425,10 @@ static bool add_xscom_sppcrd(uint64_t xscom_base)
 	for_each_ntuple_idx(&spira.ntuples.proc_chip, hdif, i,
 			    SPPCRD_HDIF_SIG) {
 		const struct sppcrd_chip_info *cinfo;
+		unsigned int csize;
 		u32 ve, version;
 
-		cinfo = HDIF_get_idata(hdif, SPPCRD_IDATA_CHIP_INFO, NULL);
+		cinfo = HDIF_get_idata(hdif, SPPCRD_IDATA_CHIP_INFO, &csize);
 		if (!CHECK_SPPTR(cinfo)) {
 			prerror("XSCOM: Bad ChipID data %d\n", i);
 			continue;
@@ -487,6 +488,28 @@ static bool add_xscom_sppcrd(uint64_t xscom_base)
 			parse_i2c_devs(hdif, SPPCRD_IDATA_HOST_I2C, np);
 			add_vas_node(np, i);
 		}
+
+		/*
+		 * Add sw checkstop scom address (ibm,sw-checkstop-fir)
+		 *
+		 * The latest HDAT versions have sw checkstop scom address
+		 * info.  But not sure from which version onwards (at least
+		 * HDAT spec do not mention that explicitly). Hence use the
+		 * sppcrd struct size returned by HDIF_get_idata to figure out
+		 * whether it contains sw checkstop scom address info. Also
+		 * check if sw_xstop_fir_scom address is non-zero.
+		 */
+		if ((csize >= (offsetof(struct sppcrd_chip_info,
+					sw_xstop_fir_bitpos) + 1)) &&
+						cinfo->sw_xstop_fir_scom) {
+			__be32 fir_bit = cinfo->sw_xstop_fir_bitpos;
+
+			if (!dt_find_property(dt_root, "ibm,sw-checkstop-fir"))
+				dt_add_property_cells(dt_root,
+					"ibm,sw-checkstop-fir",
+					be32_to_cpu(cinfo->sw_xstop_fir_scom),
+					be32_to_cpu(fir_bit));
+		}
 	}
 
 	return i > 0;
diff --git a/hdata/spira.h b/hdata/spira.h
index 4867b6d..0276d4a 100644
--- a/hdata/spira.h
+++ b/hdata/spira.h
@@ -1035,6 +1035,10 @@ struct sppcrd_chip_info {
 	__be32 capp1_func_state;
 	/* *possibly* from Version 0x20 - check spec */
 	__be32 stop_levels;
+	/* From latest version (possibly 0x21 and later) */
+	__be32 sw_xstop_fir_scom;
+	uint8_t sw_xstop_fir_bitpos;
+	uint8_t	reserved_1[3];
 } __packed;
 
 /* Idata index 1 : Chip TOD */



More information about the Skiboot mailing list