From patchwork Fri Mar 18 14:36:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lombard X-Patchwork-Id: 1607078 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.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=iHON2V/z; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4KKmnv6H0pz9s3q for ; Sat, 19 Mar 2022 01:37:55 +1100 (AEDT) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4KKmnv3JtLz3bb6 for ; Sat, 19 Mar 2022 01:37:55 +1100 (AEDT) Authentication-Results: lists.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=iHON2V/z; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=clombard@linux.vnet.ibm.com; receiver=) 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=iHON2V/z; 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 4KKmmH3zLkz30Ld for ; Sat, 19 Mar 2022 01:36:31 +1100 (AEDT) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22ICnwuW001093 for ; Fri, 18 Mar 2022 14:36:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=ezoFvczJurBi8GBBq2sLK6Da0AEIVW4f/GMe0dLHor0=; b=iHON2V/zKrMGn9UCwuzY1OzEaL44a7AlGw+BugJ84GvgWSf+oevw0YTPwkZxnhsalxri pmDkqnXn0auQVilKbbhizFzu8cOXbTqzYTYZ05YwGvLDYJZa7lS9EHqvlkAKfQUDYHOR tAL0ZKxmBOAVeqgtSMtPg2/LoLKj9nedsZR30w5qZkYE/GeJUc+lsjxhNgDs1/okWpjG 7lfay4B/Wl1orc984WTRjdFNCag0RBhJ1ipW5mR/c32ApT+Zf7aDGUjIFRyH9TOc++2/ lob24GYKLS6L3RcpLkACsjnMgwXetOJYEaWMFjFgdoME2IhWx+BEomawehZovxeLSZWQ uQ== Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 3ev1w171br-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 18 Mar 2022 14:36:29 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 22IEJA4Y027875 for ; Fri, 18 Mar 2022 14:36:27 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma03ams.nl.ibm.com with ESMTP id 3et95x11uy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 18 Mar 2022 14:36:27 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 22IEaOte49086914 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 18 Mar 2022 14:36:24 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BF36711C04A for ; Fri, 18 Mar 2022 14:36:24 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 911BE11C04C for ; Fri, 18 Mar 2022 14:36:24 +0000 (GMT) Received: from li-ed209401-43e8-11cb-8043-c0c0b85d70f7.ibm.com.com (unknown [9.171.63.232]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Fri, 18 Mar 2022 14:36:24 +0000 (GMT) From: Christophe Lombard To: skiboot@lists.ozlabs.org Date: Fri, 18 Mar 2022 15:36:15 +0100 Message-Id: <20220318143619.83489-18-clombard@linux.vnet.ibm.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220318143619.83489-1-clombard@linux.vnet.ibm.com> References: <20220318143619.83489-1-clombard@linux.vnet.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: _emL1vO0_aTqeMqS10GY8hluHOAn7aCd X-Proofpoint-ORIG-GUID: _emL1vO0_aTqeMqS10GY8hluHOAn7aCd X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.850,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-03-18_10,2022-03-15_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 impostorscore=0 clxscore=1015 mlxscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 malwarescore=0 phishscore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203180080 Subject: [Skiboot] [PATCH V3 17/21] core/pldm: Update "bmc-firmware-version" device-tree field 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: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Use the GetFruRecordByOptionReq command to retrieve the bmc information with: "FRU Field Type": Version "FRU Record Set Identifier": 1, "FRU Record Type": "General(1)" and update the "bmc-firmware-version" device-tree field. Signed-off-by: Christophe Lombard --- core/pldm/pldm-fru-requests.c | 36 +++++++++++++++++++++++++++++++++++ include/pldm.h | 5 +++++ 2 files changed, 41 insertions(+) diff --git a/core/pldm/pldm-fru-requests.c b/core/pldm/pldm-fru-requests.c index a2665c41..b4111c94 100644 --- a/core/pldm/pldm-fru-requests.c +++ b/core/pldm/pldm-fru-requests.c @@ -110,3 +110,39 @@ int pldm_fru_get_record_by_option(uint16_t fru_table_handle, field_type, fru_structure_data); } + +int pldm_fru_dt_add_bmc_version(void) +{ + struct pldm_fru_record_data_format *record_data; + struct variable_field fru_structure_data; + struct pldm_fru_record_tlv *record_tlv; + struct dt_node *dt_fw_version; + int rc; + + dt_fw_version = dt_find_by_name(dt_root, "ibm,firmware-versions"); + if (!dt_fw_version) + return OPAL_SUCCESS; + + /* retrieve the bmc information with + * "FRU Field Type": Version + * "FRU Record Set Identifier": 1, + * "FRU Record Type": "General(1)" + */ + rc = get_fru_record_by_option_req(0, + 1, + PLDM_FRU_RECORD_TYPE_GENERAL, + PLDM_FRU_FIELD_TYPE_VERSION, + &fru_structure_data); + if (rc) + return rc; + + record_data = (struct pldm_fru_record_data_format *)fru_structure_data.ptr; + record_tlv = (struct pldm_fru_record_tlv *)record_data->tlvs; + prlog(PR_DEBUG, "%s - value: %s\n", __func__, record_tlv->value); + + dt_add_property_string(dt_fw_version, + "bmc-firmware-version", + record_tlv->value); + + return OPAL_SUCCESS; +} diff --git a/include/pldm.h b/include/pldm.h index e1b60f67..aa7ea9c4 100644 --- a/include/pldm.h +++ b/include/pldm.h @@ -20,4 +20,9 @@ int pldm_platform_power_off(void); */ int pldm_platform_restart(void); +/** + * Update the firmware version device-tree field + */ +int pldm_fru_dt_add_bmc_version(void); + #endif /* __PLDM_H__ */