[edk2-devel] [edk2-platform][PATCH v1 2/7] Platforms/RaspberryPi: SMBIOS Type 2 and Type 3 fixes

Samer El-Haj-Mahmoud samer.el-haj-mahmoud at arm.com
Mon Jul 20 18:16:41 UTC 2020


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 <leif at nuviainc.com>
Cc: Pete Batard <pete at akeo.ie>
Cc: Andrei Warkentin <awarkentin at vmware.com>
Cc: Ard Biesheuvel <ard.biesheuvel at arm.com>
Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud at arm.com>
---
 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


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62858): https://edk2.groups.io/g/devel/message/62858
Mute This Topic: https://groups.io/mt/75687845/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list