summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHoraceX Lien <horacex.lien@intel.com>2023-08-30 17:00:24 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-09-26 23:56:43 +0000
commitbe971fc302cbef8f47e2612eda114135f21205e6 (patch)
treeeccd21281f28a97fbf67816ee6e2169b7e665c4e
parentbf0bdacdd6f6cdd2e9ac5db14b6daf19a5a5bd57 (diff)
downloadedk2-be971fc302cbef8f47e2612eda114135f21205e6.tar.gz
edk2-be971fc302cbef8f47e2612eda114135f21205e6.tar.bz2
edk2-be971fc302cbef8f47e2612eda114135f21205e6.zip
MdeModulePkg/SmbiosDxe: Fix BcdRevision is not match with SMBIOS version
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4544 These value of Major/Minor version are updated from SMBIOS memory data, but BCD Revision is updated from PCD PcdSmbiosVersion. We should also update BCD Revision from SMBIOS memory data, to ensure that get consistent version value. Cc: Zhiguang Liu <zhiguang.liu@intel.com> Reviewed-by: Gua Guo <gua.guo@intel.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Zhichao Gao <zhichao.gao@intel.com> Signed-off-by: HoraceX Lien <horacex.lien@intel.com>
-rw-r--r--MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
index 1a86e69d3c..2ef7b8e21c 100644
--- a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
+++ b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
@@ -1072,14 +1072,18 @@ SmbiosCreateTable (
DEBUG ((DEBUG_INFO, "SmbiosCreateTable: Initialize 32-bit entry point structure\n"));
EntryPointStructureData.MajorVersion = mPrivateData.Smbios.MajorVersion;
EntryPointStructureData.MinorVersion = mPrivateData.Smbios.MinorVersion;
- EntryPointStructureData.SmbiosBcdRevision = (UINT8)((PcdGet16 (PcdSmbiosVersion) >> 4) & 0xf0) | (UINT8)(PcdGet16 (PcdSmbiosVersion) & 0x0f);
- PhysicalAddress = 0xffffffff;
- Status = gBS->AllocatePages (
- AllocateMaxAddress,
- EfiRuntimeServicesData,
- EFI_SIZE_TO_PAGES (sizeof (SMBIOS_TABLE_ENTRY_POINT)),
- &PhysicalAddress
- );
+ EntryPointStructureData.SmbiosBcdRevision = 0;
+ if ((mPrivateData.Smbios.MajorVersion <= 9) && (mPrivateData.Smbios.MinorVersion <= 9)) {
+ EntryPointStructureData.SmbiosBcdRevision = ((mPrivateData.Smbios.MajorVersion & 0x0f) << 4) | (mPrivateData.Smbios.MinorVersion & 0x0f);
+ }
+
+ PhysicalAddress = 0xffffffff;
+ Status = gBS->AllocatePages (
+ AllocateMaxAddress,
+ EfiRuntimeServicesData,
+ EFI_SIZE_TO_PAGES (sizeof (SMBIOS_TABLE_ENTRY_POINT)),
+ &PhysicalAddress
+ );
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "SmbiosCreateTable () could not allocate EntryPointStructure < 4GB\n"));
Status = gBS->AllocatePages (