MdeModulePkg: Update the SMBIOS version by UPL

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>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: James Lu <james.lu@intel.com>
Reviewed-by: Gua Guo <gua.guo@intel.com>
Signed-off-by: KasimX Liu <kasimx.liu@intel.com>
This commit is contained in:
KasimX Liu 2022-08-05 16:17:21 +08:00 committed by mergify[bot]
parent a2b61de2f6
commit 809b5a3d2a
2 changed files with 34 additions and 8 deletions

View File

@ -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;
@ -1479,6 +1481,9 @@ IsValidSmbios20Table (
return FALSE;
}
*MajorVersion = SmbiosTable->MajorVersion;
*MinorVersion = SmbiosTable->MinorVersion;
//
// The whole struct check sum should be zero
//
@ -1522,7 +1527,9 @@ BOOLEAN
IsValidSmbios30Table (
IN VOID *TableEntry,
OUT VOID **TableAddress,
OUT UINTN *TableMaximumSize
OUT UINTN *TableMaximumSize,
OUT UINT8 *MajorVersion,
OUT UINT8 *MinorVersion
)
{
UINT8 Checksum;
@ -1542,6 +1549,9 @@ IsValidSmbios30Table (
return FALSE;
}
*MajorVersion = SmbiosTable->MajorVersion;
*MinorVersion = SmbiosTable->MinorVersion;
//
// The whole struct check sum should be zero
//
@ -1575,7 +1585,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 +1595,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,9 +1707,14 @@ RetrieveSmbiosFromHob (
UNIVERSAL_PAYLOAD_GENERIC_HEADER *GenericHeader;
VOID *TableAddress;
UINTN TableMaximumSize;
UINT8 MajorVersion;
UINT8 MinorVersion;
Status = EFI_NOT_FOUND;
MajorVersion = 0;
MinorVersion = 0;
for (Index = 0; Index < ARRAY_SIZE (mIsSmbiosTableValid); Index++) {
GuidHob = GetFirstGuidHob (mIsSmbiosTableValid[Index].Guid);
if (GuidHob == NULL) {
@ -1709,9 +1729,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;

View File

@ -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;