aboutsummaryrefslogtreecommitdiff
path: root/hdata
diff options
context:
space:
mode:
authorVasant Hegde <hegdevasant@linux.vnet.ibm.com>2017-09-13 10:54:24 +0530
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-09-19 04:16:53 -0500
commitc68fcc866a7b4064209c4fca85246b6ac1780451 (patch)
tree1c56e2d46309cbfe430f7e68764a6694024dcc45 /hdata
parent6fa9cea1638dcada59d27e924616fac509cf25f8 (diff)
downloadskiboot-c68fcc866a7b4064209c4fca85246b6ac1780451.zip
skiboot-c68fcc866a7b4064209c4fca85246b6ac1780451.tar.gz
skiboot-c68fcc866a7b4064209c4fca85246b6ac1780451.tar.bz2
hdata: Add wafer-id property
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@wsp xscom@623fc00000000]# lsprop ecid ecid 019a00d4 03100718 852c0000 00fd7911 [root@wsp xscom@623fc00000000]# lsprop wafer-id wafer-id "6Q0DG340SO" Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hdata')
-rw-r--r--hdata/spira.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/hdata/spira.c b/hdata/spira.c
index 2d41e91..a652d63 100644
--- a/hdata/spira.c
+++ b/hdata/spira.c
@@ -411,6 +411,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;
@@ -422,6 +425,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)