From patchwork Wed Oct 7 12:09:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mahesh J Salgaonkar X-Patchwork-Id: 1377980 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4C5tW01HZXz9sSG for ; Wed, 7 Oct 2020 23:12:12 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=N0wt/SCF; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4C5tVz252hzDqPg for ; Wed, 7 Oct 2020 23:12:11 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=mahesh@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=N0wt/SCF; dkim-atps=neutral Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 4C5tRt3zq9zDqPK for ; Wed, 7 Oct 2020 23:09:30 +1100 (AEDT) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 097C7wLV079876 for ; Wed, 7 Oct 2020 08:09:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : from : to : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=pp1; bh=67NmLES7wWMtlXtVKaRHHyhJE0E6Ieh+8wvOHdYEPqY=; b=N0wt/SCFLrPz4auGhc17AV7xhFdEpFV/btbxFv8SUhBHc8VNpVjELDe8wBaKDxLdsbK1 FU5NkKe9vFK5ar5iUxu6C1hKOeUdGV1hW7sG8499P5r+C2lCZG1IgjxPX6FJByojijCP kV29siXnekchxSiCFbA3WARGumHkLiei4Lxf7L/OyfncRIDljmEhbNZkLE9Y42ZLHtzk xeTrxEGE+fEZ0XfJfjjKjP9CbLlD6W39jZr5zCMUaVvixPIUAcO/lS4kECACuMsctR0z /dsVvVjtczJDV9cSVOf8EnegqYwfAVBFxPJ2CK8eu4AB2L7y3ta0st0ME1BfsJFZzdwZ jA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 341bwdk5st-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 07 Oct 2020 08:09:28 -0400 Received: from m0098394.ppops.net (m0098394.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 097C8Wtq082393 for ; Wed, 7 Oct 2020 08:09:28 -0400 Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com with ESMTP id 341bwdk5s8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 07 Oct 2020 08:09:28 -0400 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 097C8txx031636; Wed, 7 Oct 2020 12:09:25 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma06ams.nl.ibm.com with ESMTP id 33xgjh48v6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 07 Oct 2020 12:09:25 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 097C9MpI28180934 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 7 Oct 2020 12:09:23 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D8C364C04E; Wed, 7 Oct 2020 12:09:22 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 470964C059; Wed, 7 Oct 2020 12:09:22 +0000 (GMT) Received: from [192.168.0.63] (unknown [9.199.48.78]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 7 Oct 2020 12:09:22 +0000 (GMT) From: Mahesh Salgaonkar To: skiboot list Date: Wed, 07 Oct 2020 17:39:21 +0530 Message-ID: <160207256072.2097386.8459143697191737194.stgit@jupiter> In-Reply-To: <160207247879.2097386.9393389763183654717.stgit@jupiter> References: <160207247879.2097386.9393389763183654717.stgit@jupiter> User-Agent: StGit/0.21 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-10-07_08:2020-10-06, 2020-10-07 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 suspectscore=0 clxscore=1015 mlxscore=0 impostorscore=0 phishscore=0 adultscore=0 bulkscore=0 mlxlogscore=999 spamscore=0 priorityscore=1501 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010070079 Subject: [Skiboot] [PATCH v2 05/10] opal: Get backplane (io base) part-number and serial-number. X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vasant Hegde Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Get backplane (io base) part-number and serial-number and store it under phb structure for quick reference while sending error log that needs backplane FRU details. Signed-off-by: Mahesh Salgaonkar --- hdata/iohub.c | 43 ++++++++++++++++++++++++++++++++++++++++++ hdata/test/p8-840-spira.dts | 2 ++ hdata/test/p81-811.spira.dts | 2 ++ hw/phb4.c | 6 ++++++ include/pci.h | 2 ++ 5 files changed, 55 insertions(+) diff --git a/hdata/iohub.c b/hdata/iohub.c index fa3afbf7a..c751823a7 100644 --- a/hdata/iohub.c +++ b/hdata/iohub.c @@ -54,6 +54,46 @@ static bool io_get_lx_info(const void *kwvpd, unsigned int kwvpd_sz, return true; } +/* Discard trailing spaces and populate device tree */ +static void io_dt_add_string_prop(struct dt_node *node, const char *name, + const char *val, int vlen) +{ + char *prop = zalloc(vlen + 1); + int i; + + if (!prop) + return; + + memcpy(prop, val, vlen); + for (i = vlen - 1; i >= 0; i--) { + if (prop[i] != 0x20) { + prop[i + 1] = '\0'; + break; + } + } + + if (i >= 0 && !dt_find_property(node, name)) + dt_add_property_string(node, name, prop); +} + +static void io_get_fru_info(const void *kwvpd, unsigned int kwvpd_sz, + struct dt_node *hn) +{ + const void *kw; + uint8_t sz; + char buf[12]; + + memset(buf, 0, 12); + /* Serial Number */ + kw = vpd_find(kwvpd, kwvpd_sz, "VINI", "SN", &sz); + if (kw) + io_dt_add_string_prop(hn, "ibm,io-base-serial-number", kw, sz); + + /* Part Number */ + kw = vpd_find(kwvpd, kwvpd_sz, "VINI", "PN", &sz); + if (kw) + io_dt_add_string_prop(hn, "ibm,io-base-part-number", kw, sz); +} static void io_get_loc_code(const void *sp_iohubs, struct dt_node *hn, const char *prop_name) { @@ -336,6 +376,9 @@ static void io_add_p8_cec_vpd(const struct HDIF_common_hdr *sp_iohubs) /* Grab LX load info */ io_get_lx_info(kwvpd, kwvpd_sz, 0, dt_root); + + /* Grab part-number and serial-number of io base (backplane) */ + io_get_fru_info(kwvpd, kwvpd_sz, dt_root); } /* diff --git a/hdata/test/p8-840-spira.dts b/hdata/test/p8-840-spira.dts index 625935d30..f461df2f5 100644 --- a/hdata/test/p8-840-spira.dts +++ b/hdata/test/p8-840-spira.dts @@ -12,6 +12,8 @@ nest-frequency = <0x0 0x77359400>; vendor = "IBM"; ibm,io-base-loc-code = "U78C9.001.WZS0CWX-P1"; + ibm,io-base-part-number = "00E4241"; + ibm,io-base-serial-number = "YL30UF55N006"; ibm,vpd-lx-info = <0x0 0x31000401 0x300043>; model = "8286-41A"; system-id = "TU00163"; diff --git a/hdata/test/p81-811.spira.dts b/hdata/test/p81-811.spira.dts index ed7bd5deb..800ad800c 100644 --- a/hdata/test/p81-811.spira.dts +++ b/hdata/test/p81-811.spira.dts @@ -13,6 +13,8 @@ nest-frequency = <0x0 0x77359400>; vendor = "IBM"; ibm,io-base-loc-code = "U78CB.001.WZS00AL-P1"; + ibm,io-base-part-number = "00E3997"; + ibm,io-base-serial-number = "YL10UF42L013"; ibm,vpd-lx-info = <0x0 0x31000401 0x300042>; model = "8247-22L"; system-id = "1010C8A"; diff --git a/hw/phb4.c b/hw/phb4.c index 17a233f39..79bfdbf9a 100644 --- a/hw/phb4.c +++ b/hw/phb4.c @@ -5780,6 +5780,12 @@ static void phb4_create(struct dt_node *np) if (!p->phb.base_loc_code) PHBDBG(p, "Base location code not found !\n"); + /* Find base io backplane part/serial number from root node */ + p->phb.base_part_no = dt_prop_get_def(dt_root, + "ibm,io-base-part-number", NULL); + p->phb.base_serial_no = dt_prop_get_def(dt_root, + "ibm,io-base-serial-number", NULL); + /* * Grab CEC IO VPD load info from the root of the device-tree, * on P8 there's a single such VPD for the whole machine diff --git a/include/pci.h b/include/pci.h index eb23a6d9b..0b7a1f8a6 100644 --- a/include/pci.h +++ b/include/pci.h @@ -379,6 +379,8 @@ struct phb { /* Base location code used to generate the children one */ const char *base_loc_code; + const char *base_part_no; + const char *base_serial_no; /* Additional data the platform might need to attach */ void *platform_data;