From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.1521.1595269016991604188 for ; Mon, 20 Jul 2020 11:16:57 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: samer.el-haj-mahmoud@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0E48912FC; Mon, 20 Jul 2020 11:16:56 -0700 (PDT) Received: from U203705.lan (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C52D63F66F; Mon, 20 Jul 2020 11:16:55 -0700 (PDT) From: "Samer El-Haj-Mahmoud" 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 Date: Mon, 20 Jul 2020 14:16:41 -0400 Message-Id: <20200720181646.2891-3-Samer.El-Haj-Mahmoud@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200720181646.2891-1-Samer.El-Haj-Mahmoud@arm.com> References: <20200720181646.2891-1-Samer.El-Haj-Mahmoud@arm.com> 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