public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Samer El-Haj-Mahmoud" <samer.el-haj-mahmoud@arm.com>
To: devel@edk2.groups.io
Cc: Leif Lindholm <leif@nuviainc.com>, Pete Batard <pete@akeo.ie>,
	Andrei Warkentin <awarkentin@vmware.com>,
	Ard Biesheuvel <ard.biesheuvel@arm.com>
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	[thread overview]
Message-ID: <20200720181646.2891-3-Samer.El-Haj-Mahmoud@arm.com> (raw)
In-Reply-To: <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 <leif@nuviainc.com>
Cc: Pete Batard <pete@akeo.ie>
Cc: Andrei Warkentin <awarkentin@vmware.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@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


  parent reply	other threads:[~2020-07-20 18:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-20 18:16 [edk2-platform][PATCH v1 0/7] Platform/RaspberryPi : SMBIOS fixes and cleanup Samer El-Haj-Mahmoud
2020-07-20 18:16 ` [edk2-platform][PATCH v1 1/7] Platforms/RaspberryPi: Fix NULL AssetTag in SMBIOS Samer El-Haj-Mahmoud
2020-07-20 21:52   ` Andrei Warkentin
2020-07-20 18:16 ` Samer El-Haj-Mahmoud [this message]
2020-07-20 21:53   ` [edk2-platform][PATCH v1 2/7] Platforms/RaspberryPi: SMBIOS Type 2 and Type 3 fixes Andrei Warkentin
2020-07-20 18:16 ` [edk2-platform][PATCH v1 3/7] Platforms/RaspberryPi: SMBIOS Type 0 fixes Samer El-Haj-Mahmoud
2020-07-20 21:53   ` Andrei Warkentin
2020-07-20 18:16 ` [edk2-platform][PATCH v1 4/7] Platforms/RaspberryPi: SMBIOS Type 4 fixes Samer El-Haj-Mahmoud
2020-07-20 21:55   ` Andrei Warkentin
2020-07-20 18:16 ` [edk2-platform][PATCH v1 5/7] Platforms/RaspberryPi: SMBIOS Type 7 fixes Samer El-Haj-Mahmoud
2020-07-20 21:54   ` Andrei Warkentin
2020-07-20 18:16 ` [edk2-platform][PATCH v1 6/7] Platforms/RaspberryPi: SMBIOS Memory Types fixes Samer El-Haj-Mahmoud
2020-07-20 21:55   ` Andrei Warkentin
2020-07-20 18:16 ` [edk2-platform][PATCH v1 7/7] Platforms/RaspberryPi: SMBIOS minor cleanup Samer El-Haj-Mahmoud
2020-08-12 16:27   ` Pete Batard
2020-08-13 13:47 ` [edk2-platform][PATCH v1 0/7] Platform/RaspberryPi : SMBIOS fixes and cleanup Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200720181646.2891-3-Samer.El-Haj-Mahmoud@arm.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox