[Skiboot] [PATCH 1/3] hdata: Add ecid property

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Wed Sep 13 15:24:23 AEST 2017


Add ecid property under xscom node.

Sample output:
-------------
[root at wsp xscom at 623fc00000000]# lsprop ecid
ecid             019a00d4 03100718 852c0000 00fd7911

Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
 hdata/spira.c | 17 +++++++++++++++++
 hdata/spira.h | 10 ++++++++++
 2 files changed, 27 insertions(+)

diff --git a/hdata/spira.c b/hdata/spira.c
index b58be7c..147e650 100644
--- a/hdata/spira.c
+++ b/hdata/spira.c
@@ -372,6 +372,22 @@ static void add_vas_node(struct dt_node *np, int idx)
 	dt_add_property_cells(vas, "ibm,vas-id", idx);
 }
 
+static void add_ecid_data(const struct HDIF_common_hdr *hdr,
+			  struct dt_node *xscom)
+{
+	uint32_t size = 0;
+	struct sppcrd_ecid *ecid;
+	const struct HDIF_array_hdr *ec_hdr;
+
+	ec_hdr = HDIF_get_idata(hdr, SPPCRD_IDATA_EC_LEVEL, &size);
+	if (!ec_hdr || !size)
+		return;
+
+	ecid = (void *)ec_hdr + be32_to_cpu(ec_hdr->offset);
+	dt_add_property_u64s(xscom, "ecid", be64_to_cpu(ecid->low),
+			     be64_to_cpu(ecid->high));
+}
+
 static void add_xscom_add_pcia_assoc(struct dt_node *np, uint32_t pcid)
 {
 	const struct HDIF_common_hdr *hdr;
@@ -487,6 +503,7 @@ static bool add_xscom_sppcrd(uint64_t xscom_base)
 			add_xive_node(np);
 			parse_i2c_devs(hdif, SPPCRD_IDATA_HOST_I2C, np);
 			add_vas_node(np, i);
+			add_ecid_data(hdif, np);
 		}
 
 		/*
diff --git a/hdata/spira.h b/hdata/spira.h
index 0276d4a..26648a9 100644
--- a/hdata/spira.h
+++ b/hdata/spira.h
@@ -1063,6 +1063,16 @@ struct sppcrd_chip_tod {
 /* Idata index 5 : Chip attached I2C devices */
 #define SPPCRD_IDATA_HOST_I2C	5
 
+/* Idata index 8 : chip EC Level array */
+#define SPPCRD_IDATA_EC_LEVEL	8
+
+struct sppcrd_ecid {
+	__be32	chip_id;
+	__be32	ec_level;
+	__be64	low;	/* Processor ECID bit 0-63 */
+	__be64	high;	/* Processor ECID bit 64-127 */
+} __packed;
+
 /*
  * Host Services Data.
  */
-- 
2.9.3



More information about the Skiboot mailing list