diff mbox series

[1/3] hdata: Add ecid property

Message ID 20170913052425.23122-1-hegdevasant@linux.vnet.ibm.com
State Accepted
Headers show
Series [1/3] hdata: Add ecid property | expand

Commit Message

Vasant Hegde Sept. 13, 2017, 5:24 a.m. UTC
Add ecid property under xscom node.

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

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

Comments

Stewart Smith Sept. 19, 2017, 10:15 a.m. UTC | #1
Vasant Hegde <hegdevasant@linux.vnet.ibm.com> writes:
> Add ecid property under xscom node.
>
> Sample output:
> -------------
> [root@wsp xscom@623fc00000000]# lsprop ecid
> ecid             019a00d4 03100718 852c0000 00fd7911

Series merged to master as of 4b22457e783762e8532c7219d9f774b3df3f20a2

(and as discussed on internal slack, device tree binding documentation
forthcoming :)
diff mbox series

Patch

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.
  */