public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2] MdeModulePkg: Update the SMBIOS version by UPL
@ 2022-08-09  5:40 kasimx.liu
  2022-08-10  5:30 ` Ni, Ray
  0 siblings, 1 reply; 4+ messages in thread
From: kasimx.liu @ 2022-08-09  5:40 UTC (permalink / raw)
  To: devel; +Cc: KasimX Liu, Guo Dong, Ray Ni, James Lu, Gua Guo

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 | 25 ++++++++++++++++----
 MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.h | 12 +++++++---
 2 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
index 81df59cd0f..7c1e2adc02 100644
--- a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
+++ b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
@@ -1447,7 +1447,9 @@ BOOLEAN
 IsValidSmbios20Table (
   IN  VOID   *TableEntry,
   OUT VOID   **TableAddress,
-  OUT UINTN  *TableMaximumSize
+  OUT UINTN  *TableMaximumSize,
+  OUT UINT8  *MajorVersion,
+  OUT UINT8  *MinorVersion
   )
 {
   UINT8                     Checksum;
@@ -1478,6 +1480,8 @@ IsValidSmbios20Table (
   if (SmbiosTable->MajorVersion < 2) {
     return FALSE;
   }
+  *MajorVersion = SmbiosTable->MajorVersion;
+  *MinorVersion = SmbiosTable->MinorVersion;
 
   //
   // The whole struct check sum should be zero
@@ -1522,7 +1526,9 @@ BOOLEAN
 IsValidSmbios30Table (
   IN  VOID   *TableEntry,
   OUT VOID   **TableAddress,
-  OUT UINTN  *TableMaximumSize
+  OUT UINTN  *TableMaximumSize,
+  OUT UINT8  *MajorVersion,
+  OUT UINT8  *MinorVersion
   )
 {
   UINT8                         Checksum;
@@ -1541,6 +1547,8 @@ IsValidSmbios30Table (
   if (SmbiosTable->MajorVersion < 3) {
     return FALSE;
   }
+  *MajorVersion = SmbiosTable->MajorVersion;
+  *MinorVersion = SmbiosTable->MinorVersion;
 
   //
   // The whole struct check sum should be zero
@@ -1575,7 +1583,9 @@ EFI_STATUS
 ParseAndAddExistingSmbiosTable (
   IN EFI_HANDLE                ImageHandle,
   IN SMBIOS_STRUCTURE_POINTER  Smbios,
-  IN UINTN                     Length
+  IN UINTN                     Length,
+  IN UINT8                     MajorVersion,
+  IN UINT8                     MinorVersion
   )
 {
   EFI_STATUS                Status;
@@ -1583,6 +1593,9 @@ ParseAndAddExistingSmbiosTable (
   EFI_SMBIOS_HANDLE         SmbiosHandle;
   SMBIOS_STRUCTURE_POINTER  SmbiosEnd;
 
+  mPrivateData.Smbios.MajorVersion = MajorVersion;
+  mPrivateData.Smbios.MinorVersion = MinorVersion;
+
   SmbiosEnd.Raw = Smbios.Raw + Length;
 
   if ((Smbios.Raw >= SmbiosEnd.Raw) || (Smbios.Raw == NULL)) {
@@ -1692,6 +1705,8 @@ RetrieveSmbiosFromHob (
   UNIVERSAL_PAYLOAD_GENERIC_HEADER  *GenericHeader;
   VOID                              *TableAddress;
   UINTN                             TableMaximumSize;
+  UINT8                             MajorVersion;
+  UINT8                             MinorVersion;
 
   Status = EFI_NOT_FOUND;
 
@@ -1709,9 +1724,9 @@ RetrieveSmbiosFromHob (
         //
         SmBiosTableAdress = (UNIVERSAL_PAYLOAD_SMBIOS_TABLE *)GET_GUID_HOB_DATA (GuidHob);
         if (GenericHeader->Length >= UNIVERSAL_PAYLOAD_SIZEOF_THROUGH_FIELD (UNIVERSAL_PAYLOAD_SMBIOS_TABLE, SmBiosEntryPoint)) {
-          if (mIsSmbiosTableValid[Index].IsValid ((VOID *)(UINTN)SmBiosTableAdress->SmBiosEntryPoint, &TableAddress, &TableMaximumSize)) {
+          if (mIsSmbiosTableValid[Index].IsValid ((VOID *)(UINTN)SmBiosTableAdress->SmBiosEntryPoint, &TableAddress, &TableMaximumSize,&MajorVersion,&MinorVersion)) {
             Smbios.Raw = TableAddress;
-            Status     = ParseAndAddExistingSmbiosTable (ImageHandle, Smbios, TableMaximumSize);
+            Status     = ParseAndAddExistingSmbiosTable (ImageHandle, Smbios, TableMaximumSize,MajorVersion,MinorVersion);
             if (EFI_ERROR (Status)) {
               DEBUG ((DEBUG_ERROR, "RetrieveSmbiosFromHob: Failed to parse preinstalled tables from Guid Hob\n"));
               Status = EFI_UNSUPPORTED;
diff --git a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.h b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.h
index 019798ea77..f1500beabd 100644
--- a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.h
+++ b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.h
@@ -136,7 +136,9 @@ BOOLEAN
 IsValidSmbios30Table (
   IN  VOID   *TableEntry,
   OUT VOID   **TableAddress,
-  OUT UINTN  *TableMaximumSize
+  OUT UINTN  *TableMaximumSize,
+  OUT UINT8  *MajorVersion,
+  OUT UINT8  *MinorVersion
   );
 
 /**
@@ -155,7 +157,9 @@ BOOLEAN
 IsValidSmbios20Table (
   IN  VOID   *TableEntry,
   OUT VOID   **TableAddress,
-  OUT UINTN  *TableMaximumSize
+  OUT UINTN  *TableMaximumSize,
+  OUT UINT8  *MajorVersion,
+  OUT UINT8  *MinorVersion
   );
 
 /**
@@ -174,7 +178,9 @@ BOOLEAN
 (*IS_SMBIOS_TABLE_VALID) (
   IN  VOID   *TableEntry,
   OUT VOID   **TableAddress,
-  OUT UINTN  *TableMaximumSize
+  OUT UINTN  *TableMaximumSize,
+  OUT UINT8  *MajorVersion,
+  OUT UINT8  *MinorVersion
   );
 typedef struct {
   EFI_GUID                 *Guid;
-- 
2.32.0.windows.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-08-10 11:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-09  5:40 [PATCH v2] MdeModulePkg: Update the SMBIOS version by UPL kasimx.liu
2022-08-10  5:30 ` Ni, Ray
2022-08-10  5:39   ` Guo, Gua
2022-08-10 11:22     ` Liu, KasimX

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox