From patchwork Tue Mar 14 10:27:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ananth N Mavinakayanahalli X-Patchwork-Id: 738626 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 3vj9v53jjSz9s1y for ; Tue, 14 Mar 2017 21:28:49 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3vj9v52xYxzDqYs for ; Tue, 14 Mar 2017 21:28:49 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org 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 3vj9v049p6zDqGb for ; Tue, 14 Mar 2017 21:28:43 +1100 (AEDT) Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v2EANfeq103188 for ; Tue, 14 Mar 2017 06:28:32 -0400 Received: from e23smtp01.au.ibm.com (e23smtp01.au.ibm.com [202.81.31.143]) by mx0b-001b2d01.pphosted.com with ESMTP id 29603fnu7f-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 14 Mar 2017 06:28:31 -0400 Received: from localhost by e23smtp01.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 14 Mar 2017 20:28:28 +1000 Received: from d23relay08.au.ibm.com (202.81.31.227) by e23smtp01.au.ibm.com (202.81.31.207) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 14 Mar 2017 20:28:27 +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 v2EASJcw42795088 for ; Tue, 14 Mar 2017 21:28:27 +1100 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 v2EARsf4013431 for ; Tue, 14 Mar 2017 21:27:54 +1100 Received: from thinktux.in.ibm.com (thinktux.in.ibm.com [9.124.35.193]) by d23av05.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v2EARshB012922 for ; Tue, 14 Mar 2017 21:27:54 +1100 From: Ananth N Mavinakayanahalli To: skiboot@lists.ozlabs.org Date: Tue, 14 Mar 2017 15:57:29 +0530 In-Reply-To: <148948723452.25437.16956459316985787450.stgit@thinktux.in.ibm.com> References: <148948723452.25437.16956459316985787450.stgit@thinktux.in.ibm.com> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-TM-AS-MML: disable x-cbid: 17031410-1617-0000-0000-000001B54455 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17031410-1618-0000-0000-000047ED60AD Message-Id: <148948724990.25437.11480171364926302983.stgit@thinktux.in.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-03-14_07:, , 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-1702020001 definitions=main-1703140086 Subject: [Skiboot] [PATCH V4 3/4] hdata/vpd: Parse the OpenPOWER OPFR record X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Parse the OpenPOWER FRU VPD (OPFR) record on OpenPOWER instead of the VINI records. TODO: Add the dts and updates for make check for P9 OPFR systems once the HDAT in those are complete. Signed-off-by: Ananth N Mavinakayanahalli Reviewed-by: Vasant Hegde --- hdata/vpd.c | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/hdata/vpd.c b/hdata/vpd.c index 462a7f0..639fa33 100644 --- a/hdata/vpd.c +++ b/hdata/vpd.c @@ -226,6 +226,45 @@ static const struct card_info *card_info_lookup(char *ccin) return NULL; } +/* + * For OpenPOWER, we only decipher OPFR records. While OP HDAT have VINI + * records too, populating the fields in there is optional. Also, there + * is an overlap in the fields contained therein. + */ +static void vpd_opfr_parse(struct dt_node *node, + const void *fruvpd, unsigned int fruvpd_sz) +{ + const void *kw; + uint8_t sz; + + /* Vendor Name */ + kw = vpd_find(fruvpd, fruvpd_sz, "OPFR", "VN", &sz); + if (kw) + dt_add_property_nstr(node, "vendor", kw, sz); + + /* FRU Description */ + kw = vpd_find(fruvpd, fruvpd_sz, "OPFR", "DR", &sz); + if (kw) + dt_add_property_nstr(node, "description", kw, sz); + + /* Part number */ + kw = vpd_find(fruvpd, fruvpd_sz, "OPFR", "VP", &sz); + if (kw) + dt_add_property_nstr(node, "part-number", kw, sz); + + /* Serial number */ + kw = vpd_find(fruvpd, fruvpd_sz, "OPFR", "VS", &sz); + if (kw) + dt_add_property_nstr(node, "serial-number", kw, sz); + + /* Build date in BCD */ + kw = vpd_find(fruvpd, fruvpd_sz, "OPFR", "MB", &sz); + if (kw) + dt_add_property_nstr(node, "build-date", kw, sz); + + return; +} + static void vpd_vini_parse(struct dt_node *node, const void *fruvpd, unsigned int fruvpd_sz) { @@ -446,7 +485,11 @@ struct dt_node *dt_add_vpd_node(const struct HDIF_common_hdr *hdr, if (vpd_valid(fruvpd, fruvpd_sz) && !dt_find_property(node, "ibm,vpd")) { dt_add_property(node, "ibm,vpd", fruvpd, fruvpd_sz); - vpd_vini_parse(node, fruvpd, fruvpd_sz); + + if (op_platform) + vpd_opfr_parse(node, fruvpd, fruvpd_sz); + else + vpd_vini_parse(node, fruvpd, fruvpd_sz); } return node;