[Skiboot] [PATCH 2/3] hdata: Add wafer-id property

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


Wafer id is derived from ECID data.
  bits   4:63 are the wafer id ( ten 6 bit fields each containing a code)

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

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

diff --git a/hdata/spira.c b/hdata/spira.c
index 147e650..2e44209 100644
--- a/hdata/spira.c
+++ b/hdata/spira.c
@@ -375,6 +375,9 @@ static void add_vas_node(struct dt_node *np, int idx)
 static void add_ecid_data(const struct HDIF_common_hdr *hdr,
 			  struct dt_node *xscom)
 {
+	char wafer_id[11];
+	uint8_t tmp;
+	int i;
 	uint32_t size = 0;
 	struct sppcrd_ecid *ecid;
 	const struct HDIF_array_hdr *ec_hdr;
@@ -386,6 +389,28 @@ static void add_ecid_data(const struct HDIF_common_hdr *hdr,
 	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));
+
+	/*
+	 * bits 4:63 of ECID data contains wafter ID data (ten 6 bit fields
+	 * each containing a code).
+	 */
+	for (i = 0; i < 10; i++) {
+		tmp = (u8)((ecid->low >> (i * 6)) & 0x3f);
+		if (tmp <= 9)
+			wafer_id[9 - i] = tmp + '0';
+		else if (tmp >= 0xA && tmp <= 0x23)
+			wafer_id[9 - i] = tmp + '0' + 7;
+		else if (tmp == 0x3D)
+			wafer_id[9 - i] = '-';
+		else if (tmp == 0x3E)
+			wafer_id[9 - i] = '.';
+		else if (tmp == 0x3F)
+			wafer_id[9 - i] = ' ';
+		else /* Unknown code */
+			wafer_id[9 - i] = tmp + '0';
+	}
+	wafer_id[10] = '\0';
+	dt_add_property_nstr(xscom, "wafer-id", wafer_id, 10);
 }
 
 static void add_xscom_add_pcia_assoc(struct dt_node *np, uint32_t pcid)
-- 
2.9.3



More information about the Skiboot mailing list