public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] MdeModulePkg: Update the SMBIOS version by UPL
@ 2022-08-05  8:45 kasimx.liu
       [not found] ` <DM6PR11MB4027F8D3D941C3E4B849699994639@DM6PR11MB4027.namprd11.prod.outlook.com>
  0 siblings, 1 reply; 2+ messages in thread
From: kasimx.liu @ 2022-08-05  8:45 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 | 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


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

* Re: [PATCH] MdeModulePkg: Update the SMBIOS version by UPL
       [not found]   ` <MWHPR11MB1631AE570809216E2595085F8C639@MWHPR11MB1631.namprd11.prod.outlook.com>
@ 2022-08-08  3:22     ` Ni, Ray
  0 siblings, 0 replies; 2+ messages in thread
From: Ni, Ray @ 2022-08-08  3:22 UTC (permalink / raw)
  To: Liu, KasimX; +Cc: devel@edk2.groups.io, Dong, Guo, Lu, James, Guo, Gua

Re-send to the mailing list.

> -----Original Message-----
> From: Ni, Ray
> Sent: Monday, August 8, 2022 11:20 AM
> To: Liu, KasimX <kasimx.liu@intel.com>
> Subject: RE: [PATCH] MdeModulePkg: Update the SMBIOS version by UPL
> 
> Kasim,
> If you read the existing code in RetrieveSmbiosFromHob(), it only uses the
> HOB data when the data is valid.
> 
> Can you update the patch to:
> 1. do not change SmbiosDriverEntryPoint(). (the entrypoint sets the initial
> version to match to the PCD).
> 2. Change the IsValidSmbios20/30Table () to return the version number
> stored in hob.
> 3. Change RetrieveSmbiosFromHob() to update the version in mPrivateData.
>      I am not sure if it's ok to update the version after
> ParseAndAddExistingSmbiosTable(). Please double check the existing code
> logic.
> 
> 
> Thanks,
> Ray
> 
> >
> > -----Original Message-----
> > From: Liu, KasimX <kasimx.liu@intel.com>
> > Sent: Friday, August 5, 2022 4:46 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] 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 | 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


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

end of thread, other threads:[~2022-08-08  3:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-05  8:45 [PATCH] MdeModulePkg: Update the SMBIOS version by UPL kasimx.liu
     [not found] ` <DM6PR11MB4027F8D3D941C3E4B849699994639@DM6PR11MB4027.namprd11.prod.outlook.com>
     [not found]   ` <MWHPR11MB1631AE570809216E2595085F8C639@MWHPR11MB1631.namprd11.prod.outlook.com>
2022-08-08  3:22     ` Ni, Ray

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