From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by mx.groups.io with SMTP id smtpd.web11.7662.1678798098942931444 for ; Tue, 14 Mar 2023 05:48:18 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@quicinc.com header.s=qcppdkim1 header.b=Cs+XWmSD; spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: quicinc.com, ip: 205.220.168.131, mailfrom: quic_llindhol@quicinc.com) Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32EATXvJ000304; Tue, 14 Mar 2023 12:48:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : content-transfer-encoding : in-reply-to; s=qcppdkim1; bh=4LWQ4H5ED9o8PbsIhbc8kfToBezRtEBs7fVzzEMviUk=; b=Cs+XWmSDuipk4pKcqE0kF4O/ryiFXuHVoN+IXhx+KKL0Gd8rXvDiQhKG/ITzM4QRS6Vc wM89sa4BvGMI+/zjS4yPq9CMl/gWut7NKp3HgJzBPv4uaDuXxXoqC6soW5xxCKVpT2SB jgKDvTLWQY7KrzzssAG+7UwCkB9P2SuVc2hqzKV/aYV+FOmWqwzQkNYJB0kO4D3tbOaa tfm1usyOERZkgOE5AQ1890kfLnFZUWu23H7q1Hgtf5TISDvtKYJ50ukX0Ygu0cm0P4MP UT9wvefGchJg1KrAvyS92dMHiygOYYyy6kDYqUP7Qcs6GMgy/9uLxtVhaYeL/r4JlK+S nA== Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3paef89u9q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Mar 2023 12:48:14 +0000 Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 32ECmEh3004714 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 Mar 2023 12:48:14 GMT Received: from qc-i7.hemma.eciton.net (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 14 Mar 2023 05:48:12 -0700 Date: Tue, 14 Mar 2023 12:48:08 +0000 From: "Leif Lindholm" To: , CC: , , Nhi Pham , Rebecca Cran Subject: Re: [edk2-devel] [PATCH 1/1] ArmPkg/SmbiosMiscDxe: Adjust the priority of getting firmware version Message-ID: References: <20230313064321.170866-1-tinhnguyen@os.amperecomputing.com> <0e962fce-d8d2-9622-94af-5f32e5a51ca4@amperemail.onmicrosoft.com> MIME-Version: 1.0 In-Reply-To: <0e962fce-d8d2-9622-94af-5f32e5a51ca4@amperemail.onmicrosoft.com> X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: ZpK-gWDCa_Gm5NPeKcR1HLlap_LM6fF5 X-Proofpoint-GUID: ZpK-gWDCa_Gm5NPeKcR1HLlap_LM6fF5 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-14_06,2023-03-14_02,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 bulkscore=0 adultscore=0 suspectscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 impostorscore=0 clxscore=1015 spamscore=0 phishscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303140109 X-MIME-Autoconverted: from 8bit to quoted-printable by mx0a-0031df01.pphosted.com id 32EATXvJ000304 Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Tinh, +Rebecca On Mon, Mar 13, 2023 at 23:52:41 +0700, Tinh Nguyen via groups.io wrote: > On 3/13/2023 10:03 PM, Leif Lindholm wrote: > > On Mon, Mar 13, 2023 at 13:43:21 +0700, Tinh Nguyen wrote: > > > The BIOS Firmware Version in the SMBIOS Type 0 can be fetched from > > > the fixed PcdFirmwareVersionString or platform specific OemMiscLib. > > > In fact, the support from OemMiscLib comes into play when the firmwar= e > > > version may be modified at boot time for extended information. > > Wait. Firmware version modified at boot time for extended information? > > What type of extended information? > > That could be SCP version, TF-A version, etc. Ah, ok - so the edk2 image never knows a proper version name, so you want to keep the Pcd as a fallback only, to provide the edk2 build version if no other info can be retrieved? That's valid, just not a case I would have expected. > > > Therefore, the priority of getting the version from OemMiscLib should > > > be higher. In case there is no modification in the OemMiscLib, > > > we have to keep HII string STR_MISC_BIOS_VERSION empty or 'Not Specif= ied' > > > to indicate that the firmware version should be fetched from > > > the PcdFirmwareVersionString. > > >=20 > > > Reviewed-by: Nhi Pham > > > Signed-off-by: Tinh Nguyen > > > --- > > > ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction= .c | 36 ++++++++++++++------ > > > 1 file changed, 25 insertions(+), 11 deletions(-) > > >=20 > > > diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVen= dorFunction.c b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendor= Function.c > > > index 66ead22a6e2c..31a3f6cde544 100644 > > > --- a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunc= tion.c > > > +++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunc= tion.c > > > @@ -1,6 +1,6 @@ > > > /** @file > > > - Copyright (c) 2022, Ampere Computing LLC. All rights reserved.
> > > + Copyright (c) 2022 - 2023, Ampere Computing LLC. All rights reserv= ed.
> > > Copyright (c) 2021, NUVIA Inc. All rights reserved.
> > > Copyright (c) 2009, Intel Corporation. All rights reserved.
> > > Copyright (c) 2015, Hisilicon Limited. All rights reserved.
> > > @@ -170,6 +170,7 @@ SMBIOS_MISC_TABLE_FUNCTION (MiscBiosVendor) { > > > EFI_STRING_ID TokenToGet; > > > SMBIOS_TABLE_TYPE0 *SmbiosRecord; > > > SMBIOS_TABLE_TYPE0 *InputData; > > > + CHAR16 *DefaultVersionString; > > > // > > > // First check for invalid parameters. > > > @@ -187,17 +188,30 @@ SMBIOS_MISC_TABLE_FUNCTION (MiscBiosVendor) { > > > HiiSetString (mSmbiosMiscHiiHandle, TokenToUpdate, Vendor, NULL= ); > > > } > > > - Version =3D GetBiosVersion (); > > GetBiosVersion exists as a helper function to avoid cluttering > > higher-level functions with unnecessary details. If this change is > > needed, that is where it should go. >=20 > This change is based on existing code, and goal is to get the Firmware > version string from OemMiscLib first, rather than PcdFirmwareVersionStrin= g. > > =A0I would rather not make any changes that aren't relevant. I see now why you want to re-jig the current logic, and that includes the selection logic. But this function is already too long. It needs to be simplified, not made more complex. > > But I still don't understand the purpose of this patch, so cannot > > comment on whether I feel this is the right approach or not. > > Please elaborate. >=20 > The firmware version is currently being updated: >=20 > 1. Get the string from Fixed PcdFirmwareVersionString. >=20 > 2. Check to see if this string is null; if not, update the SMBIOS firmwar= e > version string. >=20 > 3. if PcdFirmwareVersionString is null, retrieve the string from OemMiscL= ib. That's the function - I was asking for the purpose, which you described higher up in your reply. > As you can see, the implementation is intended to honor the > PcdFirmwareVersionString. >=20 > We can't get the extend information (which can be derived from runtime) i= nto > the SMBIOS firmware version string if we don't set PcdFirmwareVersionStri= ng > null >=20 > However,=A0 in some cases we don't want to set PcdFirmwareVersionString t= o > null because it might be used by other modules. Hmm. On one level I think you're highlighting a desire for separation of "firmware version" from "edk2 version", which isn't something the codebase generally does today. But we don't need to solve that completely to make this change. > =A0 I think it makes sense to prioritize OemMiscLib since it's more flexi= ble > than Pcd. No objection to that. But can we do it like this?: Change GetBiosVersion to SetBiosVersion and in MiscBiosVendor, only call SetBiosVersion (); and move the selection logic fully into SetBiosVersion? Rebecca, thoughts? Arguably, once an OemMiscLib dependency was added, the Pcd values became less useful in the core code. / Leif > >=20 > > > + DefaultVersionString =3D HiiGetString ( > > > + mSmbiosMiscHiiHandle, > > > + STRING_TOKEN (STR_MISC_BIOS_VERSION), > > > + NULL > > > + ); > > > - if (StrLen (Version) > 0) { > > > - TokenToUpdate =3D STRING_TOKEN (STR_MISC_BIOS_VERSION); > > > - HiiSetString (mSmbiosMiscHiiHandle, TokenToUpdate, Version, NULL= ); > > > - } else { > > > - OemUpdateSmbiosInfo ( > > > - mSmbiosMiscHiiHandle, > > > - STRING_TOKEN (STR_MISC_BIOS_VERSION), > > > - BiosVersionType00 > > > - ); > > > + OemUpdateSmbiosInfo ( > > > + mSmbiosMiscHiiHandle, > > > + STRING_TOKEN (STR_MISC_BIOS_VERSION), > > > + BiosVersionType00 > > > + ); > > > + > > > + Version =3D HiiGetString ( > > > + mSmbiosMiscHiiHandle, > > > + STRING_TOKEN (STR_MISC_BIOS_VERSION), > > > + NULL > > > + ); > > > + > > > + if (((StrCmp (Version, DefaultVersionString) =3D=3D 0) || (StrLen = (Version) =3D=3D 0))) { > > > + Version =3D GetBiosVersion (); > > > + if (StrLen (Version) > 0) { > > > + TokenToUpdate =3D STRING_TOKEN (STR_MISC_BIOS_VERSION); > > > + HiiSetString (mSmbiosMiscHiiHandle, TokenToUpdate, Version, NU= LL); > > > + } > > > } > > > Char16String =3D GetBiosReleaseDate (); > > > --=20 > > > 2.39.2 > > >=20 >=20 >=20 >=20 >=20 >=20