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

* Re: [PATCH v2] MdeModulePkg: Update the SMBIOS version by UPL
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Ni, Ray @ 2022-08-10  5:30 UTC (permalink / raw)
  To: Liu, KasimX, devel@edk2.groups.io; +Cc: Dong, Guo, Lu, James, Guo, Gua

Reviewed-by: Ray Ni <ray.ni@intel.com>

> -----Original Message-----
> From: Liu, KasimX <kasimx.liu@intel.com>
> Sent: Tuesday, August 9, 2022 1:40 PM
> To: devel@edk2.groups.io
> Cc: Liu, KasimX <kasimx.liu@intel.com>; Dong, Guo <guo.dong@intel.com>;
> Ni, Ray <ray.ni@intel.com>; Lu, James <james.lu@intel.com>; Guo, Gua
> <gua.guo@intel.com>
> Subject: [PATCH v2] MdeModulePkg: Update the SMBIOS version by UPL
> 
> 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	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] MdeModulePkg: Update the SMBIOS version by UPL
  2022-08-10  5:30 ` Ni, Ray
@ 2022-08-10  5:39   ` Guo, Gua
  2022-08-10 11:22     ` Liu, KasimX
  0 siblings, 1 reply; 4+ messages in thread
From: Guo, Gua @ 2022-08-10  5:39 UTC (permalink / raw)
  To: Ni, Ray, Liu, KasimX, devel@edk2.groups.io; +Cc: Dong, Guo, Lu, James

Reviewed-by: Gua Guo <gua.guo@intel.com>

-----Original Message-----
From: Ni, Ray <ray.ni@intel.com> 
Sent: Wednesday, August 10, 2022 1:30 PM
To: Liu, KasimX <kasimx.liu@intel.com>; devel@edk2.groups.io
Cc: Dong, Guo <guo.dong@intel.com>; Lu, James <james.lu@intel.com>; Guo, Gua <gua.guo@intel.com>
Subject: RE: [PATCH v2] MdeModulePkg: Update the SMBIOS version by UPL

Reviewed-by: Ray Ni <ray.ni@intel.com>

> -----Original Message-----
> From: Liu, KasimX <kasimx.liu@intel.com>
> Sent: Tuesday, August 9, 2022 1:40 PM
> To: devel@edk2.groups.io
> Cc: Liu, KasimX <kasimx.liu@intel.com>; Dong, Guo 
> <guo.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Lu, James 
> <james.lu@intel.com>; Guo, Gua <gua.guo@intel.com>
> Subject: [PATCH v2] MdeModulePkg: Update the SMBIOS version by UPL
> 
> 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	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] MdeModulePkg: Update the SMBIOS version by UPL
  2022-08-10  5:39   ` Guo, Gua
@ 2022-08-10 11:22     ` Liu, KasimX
  0 siblings, 0 replies; 4+ messages in thread
From: Liu, KasimX @ 2022-08-10 11:22 UTC (permalink / raw)
  To: Guo, Gua, Ni, Ray, devel@edk2.groups.io; +Cc: Dong, Guo, Lu, James

Hi @Ni, Ray

Thanks for the reply and reviewed-by.

I've created the PR, could you help me add push label when you're available. I think we're better to check in the solution.
https://github.com/tianocore/edk2/pull/3188

-----Original Message-----
From: Guo, Gua <gua.guo@intel.com> 
Sent: Wednesday, August 10, 2022 1:40 PM
To: Ni, Ray <ray.ni@intel.com>; Liu, KasimX <kasimx.liu@intel.com>; devel@edk2.groups.io
Cc: Dong, Guo <guo.dong@intel.com>; Lu, James <james.lu@intel.com>
Subject: RE: [PATCH v2] MdeModulePkg: Update the SMBIOS version by UPL

Reviewed-by: Gua Guo <gua.guo@intel.com>

-----Original Message-----
From: Ni, Ray <ray.ni@intel.com>
Sent: Wednesday, August 10, 2022 1:30 PM
To: Liu, KasimX <kasimx.liu@intel.com>; devel@edk2.groups.io
Cc: Dong, Guo <guo.dong@intel.com>; Lu, James <james.lu@intel.com>; Guo, Gua <gua.guo@intel.com>
Subject: RE: [PATCH v2] MdeModulePkg: Update the SMBIOS version by UPL

Reviewed-by: Ray Ni <ray.ni@intel.com>

> -----Original Message-----
> From: Liu, KasimX <kasimx.liu@intel.com>
> Sent: Tuesday, August 9, 2022 1:40 PM
> To: devel@edk2.groups.io
> Cc: Liu, KasimX <kasimx.liu@intel.com>; Dong, Guo 
> <guo.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Lu, James 
> <james.lu@intel.com>; Guo, Gua <gua.guo@intel.com>
> Subject: [PATCH v2] MdeModulePkg: Update the SMBIOS version by UPL
> 
> 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	[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