[PATCH] MdeModulePkg: Update the SMBIOS version by UPL


kasimx.liu@...
 

From: KasimX Liu <kasimx.liu@...>

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

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

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

Join devel@edk2.groups.io to automatically receive all group messages.