Reviewed-by: Andrei Warkentin ________________________________ From: Samer El-Haj-Mahmoud Sent: Monday, July 20, 2020 1:16 PM To: devel@edk2.groups.io Cc: Leif Lindholm ; Pete Batard ; Andrei Warkentin ; Ard Biesheuvel Subject: [edk2-platform][PATCH v1 2/7] Platforms/RaspberryPi: SMBIOS Type 2 and Type 3 fixes Various fixes for SMBIOS Types 2 and 3: - Add LocationInChassis string to Type 2 - Update Type 3 NumberofPowerCords to 1 - Add ChassisHandle refernce to Type2. This requires moving the Type 3 population to happen before Type 2 Cc: Leif Lindholm Cc: Pete Batard Cc: Andrei Warkentin Cc: Ard Biesheuvel Signed-off-by: Samer El-Haj-Mahmoud --- Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c | 41 ++++++++++++-------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c index 6eef66f125f8..170f1843f90b 100644 --- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c +++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c @@ -176,7 +176,7 @@ SMBIOS_TABLE_TYPE2 mBoardInfoType2 = { 0, // HotSwappable :1; 0, // Reserved :3; }, - 0, // LocationInChassis String + 6, // LocationInChassis String 0, // ChassisHandle; BaseBoardTypeMotherBoard, // BoardType; 0, // NumberOfContainedObjectHandles; @@ -191,6 +191,7 @@ CHAR8 *mBoardInfoType2Strings[] = { mSysInfoVersionName, mSysInfoSerial, mChassisAssetTag, + "Internal", NULL }; @@ -210,7 +211,7 @@ SMBIOS_TABLE_TYPE3 mEnclosureInfoType3 = { ChassisSecurityStatusNone,// SecurityStatus; { 0, 0, 0, 0 }, // OemDefined[4]; 0, // Height; - 0, // NumberofPowerCords; + 1, // NumberofPowerCords; 0, // ContainedElementCount; 0, // ContainedElementRecordLength; { { 0 } }, // ContainedElements[1]; @@ -782,9 +783,22 @@ BoardInfoUpdateSmbiosType2 ( VOID ) { - UINTN Size; - CHAR16 AssetTagVar[ASSET_TAG_STR_STORAGE_SIZE] = L""; - EFI_STATUS Status; + + LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mBoardInfoType2, mBoardInfoType2Strings, NULL); +} + +/*********************************************************************** + SMBIOS data update TYPE3 Enclosure Information +************************************************************************/ +VOID +EnclosureInfoUpdateSmbiosType3 ( + VOID + ) +{ + UINTN Size; + EFI_STATUS Status; + EFI_SMBIOS_HANDLE SmbiosHandle; + CHAR16 AssetTagVar[ASSET_TAG_STR_STORAGE_SIZE] = L""; Size = sizeof(AssetTagVar); Status = gRT->GetVariable(L"AssetTag", @@ -802,18 +816,10 @@ BoardInfoUpdateSmbiosType2 ( } DEBUG ((DEBUG_INFO, "System Asset Tag : %a\n", mChassisAssetTag)); - LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mBoardInfoType2, mBoardInfoType2Strings, NULL); -} + LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mEnclosureInfoType3, mEnclosureInfoType3Strings, &SmbiosHandle); -/*********************************************************************** - SMBIOS data update TYPE3 Enclosure Information -************************************************************************/ -VOID -EnclosureInfoUpdateSmbiosType3 ( - VOID - ) -{ - LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mEnclosureInfoType3, mEnclosureInfoType3Strings, NULL); + // Set Type2 ChassisHandle to point to the newly added Type3 handle + mBoardInfoType2.ChassisHandle = (UINT16) SmbiosHandle; } /*********************************************************************** @@ -982,9 +988,10 @@ PlatformSmbiosDriverEntryPoint ( SysInfoUpdateSmbiosType1 (); + EnclosureInfoUpdateSmbiosType3 (); // Add Type 3 first to get chassis handle for use in Type 2 + BoardInfoUpdateSmbiosType2 (); - EnclosureInfoUpdateSmbiosType3 (); ProcessorInfoUpdateSmbiosType4 (4); //One example for creating and updating -- 2.17.1