Skip to content

Commit

Permalink
hdata: Add wafer-id property
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Vasant Hegde authored and stewartsmith committed Sep 19, 2017
1 parent 6fa9cea commit c68fcc8
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions hdata/spira.c
Expand Up @@ -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;
Expand All @@ -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)
Expand Down

0 comments on commit c68fcc8

Please sign in to comment.