From patchwork Wed Sep 13 05:24:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 813162 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xsVV73wGGz9sMN for ; Wed, 13 Sep 2017 15:25:03 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3xsVV72MTrzDrKj for ; Wed, 13 Sep 2017 15:25:03 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3xsVTm3HSzzDrHr for ; Wed, 13 Sep 2017 15:24:44 +1000 (AEST) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v8D5Nrcj012252 for ; Wed, 13 Sep 2017 01:24:42 -0400 Received: from e23smtp06.au.ibm.com (e23smtp06.au.ibm.com [202.81.31.148]) by mx0a-001b2d01.pphosted.com with ESMTP id 2cxx1311kg-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 13 Sep 2017 01:24:41 -0400 Received: from localhost by e23smtp06.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 13 Sep 2017 15:24:38 +1000 Received: from d23relay08.au.ibm.com (202.81.31.227) by e23smtp06.au.ibm.com (202.81.31.212) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 13 Sep 2017 15:24:36 +1000 Received: from d23av05.au.ibm.com (d23av05.au.ibm.com [9.190.234.119]) by d23relay08.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v8D5OZw940763568 for ; Wed, 13 Sep 2017 15:24:35 +1000 Received: from d23av05.au.ibm.com (localhost [127.0.0.1]) by d23av05.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v8D5OZkC003728 for ; Wed, 13 Sep 2017 15:24:35 +1000 Received: from hegdevasant.in.ibm.com ([9.109.222.138]) by d23av05.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v8D5OUGJ003602; Wed, 13 Sep 2017 15:24:33 +1000 From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Wed, 13 Sep 2017 10:54:24 +0530 X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170913052425.23122-1-hegdevasant@linux.vnet.ibm.com> References: <20170913052425.23122-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-MML: disable x-cbid: 17091305-0040-0000-0000-00000355E8C8 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17091305-0041-0000-0000-00000CD62DE5 Message-Id: <20170913052425.23122-2-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-09-13_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1709130083 Subject: [Skiboot] [PATCH 2/3] hdata: Add wafer-id property X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" 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 --- 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)