From: "Leif Lindholm" <quic_llindhol@quicinc.com>
To: Tinh Nguyen <tinhnguyen@os.amperecomputing.com>
Cc: <devel@edk2.groups.io>, <patches@amperecomputing.com>,
<ardb+tianocore@kernel.org>, <nhi@os.amperecomputing.com>,
<rebecca@bsdio.com>, <osd@smith-denny.com>
Subject: Re: [PATCH v4 1/1] ArmPkg/SmbiosMiscDxe: Adjust the priority of getting firmware version
Date: Tue, 28 Mar 2023 16:10:28 +0100 [thread overview]
Message-ID: <ZCMDZMdXkx9CwWOn@qc-i7.hemma.eciton.net> (raw)
In-Reply-To: <20230326183543.1980914-1-tinhnguyen@os.amperecomputing.com>
On Mon, Mar 27, 2023 at 01:35:43 +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 firmware
> version may be modified at boot time for extended information.
> 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 Specified'
> to indicate that the firmware version should be fetched from
> the PcdFirmwareVersionString.
>
> Signed-off-by: Tinh Nguyen <tinhnguyen@os.amperecomputing.com>
> Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
> Reviewed-by: Oliver Smith-Denny <osd@smith-denny.com>
> Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
Thanks, merged as 07e17188df90.
/
Leif
> ---
>
> Changes since v1:
> + Change GetBiosVersion () to SetBiosVersion () and move the selection logic
> fully into SetBiosVersion ().
> Changes since v2:
> + Add R-B by Rebecca and remove @retval
> VOID
> Changes since v3:
> + Change the function's comment. Add R-B by Leif and Oliver.
>
> ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c | 58 ++++++++++++--------
> 1 file changed, 36 insertions(+), 22 deletions(-)
>
> diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c
> index 66ead22a6e2c..c9f25b750254 100644
> --- a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c
> +++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c
> @@ -1,6 +1,6 @@
> /** @file
>
> - Copyright (c) 2022, Ampere Computing LLC. All rights reserved.<BR>
> + Copyright (c) 2022 - 2023, Ampere Computing LLC. All rights reserved.<BR>
> Copyright (c) 2021, NUVIA Inc. All rights reserved.<BR>
> Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
> Copyright (c) 2015, Hisilicon Limited. All rights reserved.<BR>
> @@ -124,22 +124,47 @@ GetBiosReleaseDate (
> return ReleaseDate;
> }
>
> -/**
> - Fetches the firmware ('BIOS') version from the
> - FirmwareVersionInfo HOB.
> +/** Fetches the Firmware version string for SMBIOS type 0
> +
> + This function first acquires the firmware version string from OemMiscLib;
> + if it is invalid, PcdFirmwareVersionString is used as a fallback,
> + and then sets it in SMBIOS type 0.
>
> - @return The version as a UTF-16 string
> **/
> -CHAR16 *
> -GetBiosVersion (
> +VOID
> +SetBiosVersion (
> VOID
> )
> {
> - CHAR16 *ReleaseString;
> + CHAR16 *DefaultVersionString;
> + CHAR16 *Version;
> + EFI_STRING_ID TokenToUpdate;
>
> - ReleaseString = (CHAR16 *)FixedPcdGetPtr (PcdFirmwareVersionString);
> + DefaultVersionString = HiiGetString (
> + mSmbiosMiscHiiHandle,
> + STRING_TOKEN (STR_MISC_BIOS_VERSION),
> + NULL
> + );
>
> - return ReleaseString;
> + OemUpdateSmbiosInfo (
> + mSmbiosMiscHiiHandle,
> + STRING_TOKEN (STR_MISC_BIOS_VERSION),
> + BiosVersionType00
> + );
> +
> + Version = HiiGetString (
> + mSmbiosMiscHiiHandle,
> + STRING_TOKEN (STR_MISC_BIOS_VERSION),
> + NULL
> + );
> +
> + if (((StrCmp (Version, DefaultVersionString) == 0) || (StrLen (Version) == 0))) {
> + Version = (CHAR16 *)FixedPcdGetPtr (PcdFirmwareVersionString);
> + if (StrLen (Version) > 0) {
> + TokenToUpdate = STRING_TOKEN (STR_MISC_BIOS_VERSION);
> + HiiSetString (mSmbiosMiscHiiHandle, TokenToUpdate, Version, NULL);
> + }
> + }
> }
>
> /**
> @@ -187,18 +212,7 @@ SMBIOS_MISC_TABLE_FUNCTION (MiscBiosVendor) {
> HiiSetString (mSmbiosMiscHiiHandle, TokenToUpdate, Vendor, NULL);
> }
>
> - Version = GetBiosVersion ();
> -
> - if (StrLen (Version) > 0) {
> - TokenToUpdate = STRING_TOKEN (STR_MISC_BIOS_VERSION);
> - HiiSetString (mSmbiosMiscHiiHandle, TokenToUpdate, Version, NULL);
> - } else {
> - OemUpdateSmbiosInfo (
> - mSmbiosMiscHiiHandle,
> - STRING_TOKEN (STR_MISC_BIOS_VERSION),
> - BiosVersionType00
> - );
> - }
> + SetBiosVersion ();
>
> Char16String = GetBiosReleaseDate ();
> if (StrLen (Char16String) > 0) {
> --
> 2.39.2
prev parent reply other threads:[~2023-03-28 15:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-26 18:35 [PATCH v4 1/1] ArmPkg/SmbiosMiscDxe: Adjust the priority of getting firmware version Tinh Nguyen
2023-03-28 15:10 ` Leif Lindholm [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZCMDZMdXkx9CwWOn@qc-i7.hemma.eciton.net \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox