diff mbox series

[3/3] hdata: Add wafer-location property

Message ID 20170913052425.23122-3-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
Extract wafer-location from ECID and add property under xscom node.
  bits  64:71 are the chip x location (7:0)
  bits  72:79 are the chip y location (7:0)

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

Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
---
 hdata/spira.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/hdata/spira.c b/hdata/spira.c
index 2e44209..bed7a21 100644
--- a/hdata/spira.c
+++ b/hdata/spira.c
@@ -411,6 +411,10 @@  static void add_ecid_data(const struct HDIF_common_hdr *hdr,
 	}
 	wafer_id[10] = '\0';
 	dt_add_property_nstr(xscom, "wafer-id", wafer_id, 10);
+
+	dt_add_property_cells(xscom, "wafer-location",
+			      (u32)((be64_to_cpu(ecid->high) >> 56) & 0xff),
+			      (u32)((be64_to_cpu(ecid->high) >> 48) & 0xff));
 }
 
 static void add_xscom_add_pcia_assoc(struct dt_node *np, uint32_t pcid)