[edk2-devel] [PATCH] MdeModulePkg: Update the SMBIOS version by UPL

kasimx.liu@intel.com posted 1 patch 6 days, 15 hours ago
Failed in applying to current master (apply log)
MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
[edk2-devel] [PATCH] MdeModulePkg: Update the SMBIOS version by UPL
Posted by kasimx.liu@intel.com 6 days, 15 hours ago
From: KasimX Liu <kasimx.liu@intel.com>

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4013

For the SMBIOS version can be update by UPL,we create
the gUniversalPayloadSmbios3TableGuid HOB to store
the value then updated version.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: James Lu <james.lu@intel.com>
Cc: Gua Guo <gua.guo@intel.com>
Signed-off-by: KasimX Liu <kasimx.liu@intel.com>
---
 MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
index 81df59cd0f..5ee76c7129 100644
--- a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
+++ b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
@@ -1746,14 +1746,30 @@ SmbiosDriverEntryPoint (
   )
 {
   EFI_STATUS  Status;
+  EFI_HOB_GUID_TYPE               *GuidHob;
+  UNIVERSAL_PAYLOAD_SMBIOS_TABLE  *Smbiostable;
+  SMBIOS_TABLE_3_0_ENTRY_POINT    *Smbios30EntryPoint;
+
+  GuidHob = NULL;
+  Smbiostable = NULL;
+  Smbios30EntryPoint = NULL;
 
   mPrivateData.Signature           = SMBIOS_INSTANCE_SIGNATURE;
   mPrivateData.Smbios.Add          = SmbiosAdd;
   mPrivateData.Smbios.UpdateString = SmbiosUpdateString;
   mPrivateData.Smbios.Remove       = SmbiosRemove;
   mPrivateData.Smbios.GetNext      = SmbiosGetNext;
-  mPrivateData.Smbios.MajorVersion = (UINT8)(PcdGet16 (PcdSmbiosVersion) >> 8);
-  mPrivateData.Smbios.MinorVersion = (UINT8)(PcdGet16 (PcdSmbiosVersion) & 0x00ff);
+
+  GuidHob = GetFirstGuidHob (&gUniversalPayloadSmbios3TableGuid);
+  if (GuidHob != NULL){
+    Smbiostable = (UNIVERSAL_PAYLOAD_SMBIOS_TABLE *) (UINTN *)(GET_GUID_HOB_DATA (GuidHob));
+    Smbios30EntryPoint = (SMBIOS_TABLE_3_0_ENTRY_POINT *)Smbiostable->SmBiosEntryPoint;
+    mPrivateData.Smbios.MajorVersion = Smbios30EntryPoint->MajorVersion;
+    mPrivateData.Smbios.MinorVersion = Smbios30EntryPoint->MinorVersion;
+  } else {
+    mPrivateData.Smbios.MajorVersion = (UINT8)(PcdGet16 (PcdSmbiosVersion) >> 8);
+    mPrivateData.Smbios.MinorVersion = (UINT8)(PcdGet16 (PcdSmbiosVersion) & 0x00ff);
+  }
 
   InitializeListHead (&mPrivateData.DataListHead);
   InitializeListHead (&mPrivateData.AllocatedHandleListHead);
-- 
2.32.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92163): https://edk2.groups.io/g/devel/message/92163
Mute This Topic: https://groups.io/mt/92831590/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-