Message ID | 20170913052425.23122-2-hegdevasant@linux.vnet.ibm.com |
---|---|
State | Accepted |
Headers | show |
Series | [1/3] hdata: Add ecid property | expand |
Vasant Hegde <hegdevasant@linux.vnet.ibm.com> writes: > + > + /* > + * 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); This produces the following sparse warning: hdata/spira.c:433:33: warning: restricted beint64_t degrades to integer looks like we're missing some endian conversions?
On 09/28/2017 12:07 PM, Stewart Smith wrote: > Vasant Hegde <hegdevasant@linux.vnet.ibm.com> writes: >> + >> + /* >> + * 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); > > This produces the following sparse warning: > > hdata/spira.c:433:33: warning: restricted beint64_t degrades to integer > > looks like we're missing some endian conversions? My bad. . I missed be64_to_cpu() ... Will send separate patch for that. -Vasant
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)
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> --- hdata/spira.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)