diff options
author | Tinh Nguyen <tinhnguyen@os.amperecomputing.com> | 2023-03-27 01:35:43 +0700 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2023-03-28 15:03:15 +0000 |
commit | 07e17188df9042d6a6af96f21b0fb7bc5595ec07 (patch) | |
tree | 0a33f5ebad9ff20803fe814c9b3732abde4b81e6 /ArmPkg/Universal/Smbios/SmbiosMiscDxe | |
parent | e4b3fd905a170b185dcea11e2997cfe935fea208 (diff) | |
download | edk2-07e17188df9042d6a6af96f21b0fb7bc5595ec07.zip edk2-07e17188df9042d6a6af96f21b0fb7bc5595ec07.tar.gz edk2-07e17188df9042d6a6af96f21b0fb7bc5595ec07.tar.bz2 |
ArmPkg/SmbiosMiscDxe: Adjust the priority of getting firmware version
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>
Diffstat (limited to 'ArmPkg/Universal/Smbios/SmbiosMiscDxe')
-rw-r--r-- | ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c | 62 |
1 files changed, 38 insertions, 24 deletions
diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c index 66ead22..c9f25b7 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;
-
- ReleaseString = (CHAR16 *)FixedPcdGetPtr (PcdFirmwareVersionString);
-
- return ReleaseString;
+ CHAR16 *DefaultVersionString;
+ CHAR16 *Version;
+ EFI_STRING_ID TokenToUpdate;
+
+ DefaultVersionString = HiiGetString (
+ mSmbiosMiscHiiHandle,
+ STRING_TOKEN (STR_MISC_BIOS_VERSION),
+ NULL
+ );
+
+ 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) {
|