public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ray" <ray.ni@intel.com>
To: "Liu, KasimX" <kasimx.liu@intel.com>,
	"devel@edk2.groups.io" <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
Date: Wed, 10 Aug 2022 05:30:11 +0000	[thread overview]
Message-ID: <MWHPR11MB1631D9C957C58D239FA1EEC18C659@MWHPR11MB1631.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20220809054008.1437-1-kasimx.liu@intel.com>

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


  reply	other threads:[~2022-08-10  5:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-09  5:40 [PATCH v2] MdeModulePkg: Update the SMBIOS version by UPL kasimx.liu
2022-08-10  5:30 ` Ni, Ray [this message]
2022-08-10  5:39   ` Guo, Gua
2022-08-10 11:22     ` Liu, KasimX

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MWHPR11MB1631D9C957C58D239FA1EEC18C659@MWHPR11MB1631.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox