From patchwork Wed Oct 7 12:09:14 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: 1377978 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 4C5tVX00MXz9sSG for ; Wed, 7 Oct 2020 23:11:48 +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=fadBeTgm; 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 4C5tVW606DzDqPR for ; Wed, 7 Oct 2020 23:11:47 +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=fadBeTgm; 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 4C5tRm5h11zDqNt for ; Wed, 7 Oct 2020 23:09:24 +1100 (AEDT) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 097C2T93011277 for ; Wed, 7 Oct 2020 08:09:21 -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=CvAZ89OTdNV0dxD9eKpkkCxtANXKRBkYKtPdIoS5CWQ=; b=fadBeTgm2v3r3m/oig3B2X5I3qCwLZmDkSpCSQ8hska27m1isJOgZh0loatBJDhRlHGi EyJARy2FeIXov/OZcmrucW3Z3cQ+KuYcGSNcy9OgsxWL32sGjKvaegPR3oqe3/3m1/hB sVi+PxOQh3xcL8K5tBgRdSRJK1BpKpcErOprXrkzlBZGywscQu+TN0Q1aqJL1gW+ij8J trF4FP8Pa9r8Bwf/intTXelJKbo8eM4h03RoZ6ATFWZIIr1dGLu7HhsGaYLZlIS/QxCw 9qql9j5PCWP3GemwIWpbF9MTTpfpz/QkTcK6GTlkYm/KhvJOfYVliXv7RUiJPb9y+IWg Hw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 341d7e0hkn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 07 Oct 2020 08:09:21 -0400 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 097C2kep013439 for ; Wed, 7 Oct 2020 08:09:20 -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 341d7e0hhk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 07 Oct 2020 08:09:20 -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 097C8iJ5031623; Wed, 7 Oct 2020 12:09:18 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma06ams.nl.ibm.com with ESMTP id 33xgjh48v3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 07 Oct 2020 12:09:18 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 097C9FI917826244 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 7 Oct 2020 12:09:15 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8808052052; Wed, 7 Oct 2020 12:09:15 +0000 (GMT) Received: from [192.168.0.63] (unknown [9.199.48.78]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id EABC552057; Wed, 7 Oct 2020 12:09:14 +0000 (GMT) From: Mahesh Salgaonkar To: skiboot list Date: Wed, 07 Oct 2020 17:39:14 +0530 Message-ID: <160207255420.2097386.2824537182922235039.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 phishscore=0 clxscore=1015 impostorscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 lowpriorityscore=0 priorityscore=1501 bulkscore=0 spamscore=0 malwarescore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010070079 Subject: [Skiboot] [PATCH v2 04/10] opal: Get chip 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" From: Mahesh Salgaonkar Get chip part-number and serial-number and store it under proc_chip for quick reference while sending error log that needs proc chip FRU details. Signed-off-by: Mahesh Salgaonkar --- Change in v2: - Use dt_prop_get_def(). --- core/chip.c | 4 ++++ include/chip.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/core/chip.c b/core/chip.c index f1269d3f9..d1ee59d58 100644 --- a/core/chip.c +++ b/core/chip.c @@ -113,6 +113,10 @@ static void init_chip(struct dt_node *dn) if (lc) chip->loc_code = strdup(lc); + /* Update part number and serial number for this chip */ + chip->part_no = dt_prop_get_def(dn, "part-number", NULL); + chip->serial_no = dt_prop_get_def(dn, "serial-number", NULL); + prlog(PR_INFO, "CHIP: Initialised chip %d from %s\n", id, dn->name); chips[id] = chip; } diff --git a/include/chip.h b/include/chip.h index 4deb96182..53b4a41b7 100644 --- a/include/chip.h +++ b/include/chip.h @@ -220,6 +220,10 @@ struct proc_chip { /* location code of this chip */ const uint8_t *loc_code; + /* part-number and serial number for this chip */ + const uint8_t *part_no; + const uint8_t *serial_no; + /* Used by hw/sbe-p9.c */ struct p9_sbe *sbe; @@ -276,5 +280,29 @@ static inline const char *chip_loc_code(uint32_t chip_id) return chip->loc_code; } +/* helper to get part number of a chip */ +static inline const char *chip_part_number(uint32_t chip_id) +{ + struct proc_chip *chip; + + chip = get_chip(chip_id); + if (!chip) + return NULL; + + return chip->part_no; +} + +/* helper to get serial number of a chip */ +static inline const char *chip_serial_number(uint32_t chip_id) +{ + struct proc_chip *chip; + + chip = get_chip(chip_id); + if (!chip) + return NULL; + + return chip->serial_no; +} + #endif /* __CHIP_H */