From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web08.8523.1660023617580915935 for ; Mon, 08 Aug 2022 22:40:18 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=GZ87cLYV; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: kasimx.liu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660023617; x=1691559617; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=pdmZaDISYxB2DsZCFLbjmmifHD2KAEwGKPZenE8O6P4=; b=GZ87cLYV7sZzUETb+cC19ziDrwO4WQSEC/pWbvaAG5ox/yOntHkN85Z3 snKAcM+vaNFOY+lo+OFkacYbjHJ3HNFLixRtneZ4Ki0E6bBo79BZmYc9N +g2RiaFMlUWpWHz0NA/oj4IA8kMEquOXq+mbQQ+FMIZz+Tkgxz9GfCoVR etMSBVG4TQIb0n+OdHO9VNijJoha2jeeIoY+DQtQg3UaHTH54DicLv4MQ WANBC/jNs4/Ihcg1nhSDSSvQhNWXv/1dVe8CvEJiGD96+dXiZyrM/rVtd 4Tp1gOBp6QS076KK9c3DEnOHzpS4W/OyL6fxPMy9lSqYUSP4mrcTCeA3+ A==; X-IronPort-AV: E=McAfee;i="6400,9594,10433"; a="290763454" X-IronPort-AV: E=Sophos;i="5.93,223,1654585200"; d="scan'208";a="290763454" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Aug 2022 22:40:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,223,1654585200"; d="scan'208";a="707704475" Received: from jenkailx-win10.gar.corp.intel.com ([10.227.107.9]) by fmsmga002.fm.intel.com with ESMTP; 08 Aug 2022 22:40:13 -0700 From: kasimx.liu@intel.com To: devel@edk2.groups.io Cc: KasimX Liu , Guo Dong , Ray Ni , James Lu , Gua Guo Subject: [PATCH v2] MdeModulePkg: Update the SMBIOS version by UPL Date: Tue, 9 Aug 2022 13:40:08 +0800 Message-Id: <20220809054008.1437-1-kasimx.liu@intel.com> X-Mailer: git-send-email 2.32.0.windows.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: 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 Cc: Ray Ni Cc: James Lu Cc: Gua Guo Signed-off-by: KasimX Liu --- 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/Un= iversal/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 (=0D IN VOID *TableEntry,=0D OUT VOID **TableAddress,=0D - OUT UINTN *TableMaximumSize=0D + OUT UINTN *TableMaximumSize,=0D + OUT UINT8 *MajorVersion,=0D + OUT UINT8 *MinorVersion=0D )=0D {=0D UINT8 Checksum;=0D @@ -1478,6 +1480,8 @@ IsValidSmbios20Table ( if (SmbiosTable->MajorVersion < 2) {=0D return FALSE;=0D }=0D + *MajorVersion =3D SmbiosTable->MajorVersion;=0D + *MinorVersion =3D SmbiosTable->MinorVersion;=0D =0D //=0D // The whole struct check sum should be zero=0D @@ -1522,7 +1526,9 @@ BOOLEAN IsValidSmbios30Table (=0D IN VOID *TableEntry,=0D OUT VOID **TableAddress,=0D - OUT UINTN *TableMaximumSize=0D + OUT UINTN *TableMaximumSize,=0D + OUT UINT8 *MajorVersion,=0D + OUT UINT8 *MinorVersion=0D )=0D {=0D UINT8 Checksum;=0D @@ -1541,6 +1547,8 @@ IsValidSmbios30Table ( if (SmbiosTable->MajorVersion < 3) {=0D return FALSE;=0D }=0D + *MajorVersion =3D SmbiosTable->MajorVersion;=0D + *MinorVersion =3D SmbiosTable->MinorVersion;=0D =0D //=0D // The whole struct check sum should be zero=0D @@ -1575,7 +1583,9 @@ EFI_STATUS ParseAndAddExistingSmbiosTable (=0D IN EFI_HANDLE ImageHandle,=0D IN SMBIOS_STRUCTURE_POINTER Smbios,=0D - IN UINTN Length=0D + IN UINTN Length,=0D + IN UINT8 MajorVersion,=0D + IN UINT8 MinorVersion=0D )=0D {=0D EFI_STATUS Status;=0D @@ -1583,6 +1593,9 @@ ParseAndAddExistingSmbiosTable ( EFI_SMBIOS_HANDLE SmbiosHandle;=0D SMBIOS_STRUCTURE_POINTER SmbiosEnd;=0D =0D + mPrivateData.Smbios.MajorVersion =3D MajorVersion;=0D + mPrivateData.Smbios.MinorVersion =3D MinorVersion;=0D +=0D SmbiosEnd.Raw =3D Smbios.Raw + Length;=0D =0D if ((Smbios.Raw >=3D SmbiosEnd.Raw) || (Smbios.Raw =3D=3D NULL)) {=0D @@ -1692,6 +1705,8 @@ RetrieveSmbiosFromHob ( UNIVERSAL_PAYLOAD_GENERIC_HEADER *GenericHeader;=0D VOID *TableAddress;=0D UINTN TableMaximumSize;=0D + UINT8 MajorVersion;=0D + UINT8 MinorVersion;=0D =0D Status =3D EFI_NOT_FOUND;=0D =0D @@ -1709,9 +1724,9 @@ RetrieveSmbiosFromHob ( //=0D SmBiosTableAdress =3D (UNIVERSAL_PAYLOAD_SMBIOS_TABLE *)GET_GUID_H= OB_DATA (GuidHob);=0D if (GenericHeader->Length >=3D UNIVERSAL_PAYLOAD_SIZEOF_THROUGH_FI= ELD (UNIVERSAL_PAYLOAD_SMBIOS_TABLE, SmBiosEntryPoint)) {=0D - if (mIsSmbiosTableValid[Index].IsValid ((VOID *)(UINTN)SmBiosTab= leAdress->SmBiosEntryPoint, &TableAddress, &TableMaximumSize)) {=0D + if (mIsSmbiosTableValid[Index].IsValid ((VOID *)(UINTN)SmBiosTab= leAdress->SmBiosEntryPoint, &TableAddress, &TableMaximumSize,&MajorVersion,= &MinorVersion)) {=0D Smbios.Raw =3D TableAddress;=0D - Status =3D ParseAndAddExistingSmbiosTable (ImageHandle, Sm= bios, TableMaximumSize);=0D + Status =3D ParseAndAddExistingSmbiosTable (ImageHandle, Sm= bios, TableMaximumSize,MajorVersion,MinorVersion);=0D if (EFI_ERROR (Status)) {=0D DEBUG ((DEBUG_ERROR, "RetrieveSmbiosFromHob: Failed to parse= preinstalled tables from Guid Hob\n"));=0D Status =3D EFI_UNSUPPORTED;=0D diff --git a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.h b/MdeModulePkg/Un= iversal/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 (=0D IN VOID *TableEntry,=0D OUT VOID **TableAddress,=0D - OUT UINTN *TableMaximumSize=0D + OUT UINTN *TableMaximumSize,=0D + OUT UINT8 *MajorVersion,=0D + OUT UINT8 *MinorVersion=0D );=0D =0D /**=0D @@ -155,7 +157,9 @@ BOOLEAN IsValidSmbios20Table (=0D IN VOID *TableEntry,=0D OUT VOID **TableAddress,=0D - OUT UINTN *TableMaximumSize=0D + OUT UINTN *TableMaximumSize,=0D + OUT UINT8 *MajorVersion,=0D + OUT UINT8 *MinorVersion=0D );=0D =0D /**=0D @@ -174,7 +178,9 @@ BOOLEAN (*IS_SMBIOS_TABLE_VALID) (=0D IN VOID *TableEntry,=0D OUT VOID **TableAddress,=0D - OUT UINTN *TableMaximumSize=0D + OUT UINTN *TableMaximumSize,=0D + OUT UINT8 *MajorVersion,=0D + OUT UINT8 *MinorVersion=0D );=0D typedef struct {=0D EFI_GUID *Guid;=0D --=20 2.32.0.windows.2