public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Andrei Warkentin" <awarkentin@vmware.com>
To: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: Leif Lindholm <leif@nuviainc.com>, Pete Batard <pete@akeo.ie>,
	Ard Biesheuvel <ard.biesheuvel@arm.com>
Subject: Re: [edk2-platform][PATCH v1 4/7] Platforms/RaspberryPi: SMBIOS Type 4 fixes
Date: Mon, 20 Jul 2020 21:55:14 +0000	[thread overview]
Message-ID: <BN6PR05MB34113B5F8CFDC807E6BF725DB97B0@BN6PR05MB3411.namprd05.prod.outlook.com> (raw)
In-Reply-To: <20200720181646.2891-5-Samer.El-Haj-Mahmoud@arm.com>

[-- Attachment #1: Type: text/plain, Size: 7824 bytes --]

Reviewed-by: Andrei Warkentin <awarkentin@vmware.com>
________________________________
From: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
Sent: Monday, July 20, 2020 1:16 PM
To: devel@edk2.groups.io <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 4/7] Platforms/RaspberryPi: SMBIOS Type 4 fixes

Various fixes and enhancements for SMBIOS Type 4:
 - Fix ProcessorId to correctly report the Arm64 MIDR_EL1 value
 - Change ProcessorUpgrade from Other to None
 - Add comments for ProcessorCharacteristics fields
 - Add CoreCount2, EnabledCoreCount2, and ThreadCount2
 - Set LxCacheHandle to 0xFFFF

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.inf |  1 +
 Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c   | 87 ++++++++------------
 2 files changed, 34 insertions(+), 54 deletions(-)

diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf
index 817b902b1fad..2b24b22c25fc 100644
--- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf
+++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf
@@ -31,6 +31,7 @@ [Packages]
   EmbeddedPkg/EmbeddedPkg.dec

 [LibraryClasses]
+  ArmLib
   UefiBootServicesTableLib
   MemoryAllocationLib
   BaseMemoryLib
diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
index 21feab3e47a5..4dcdec5615dc 100644
--- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
+++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
@@ -32,6 +32,7 @@
 #include <Protocol/Smbios.h>
 #include <Protocol/RpiFirmware.h>
 #include <Guid/SmBios.h>
+#include <Library/ArmLib.h>
 #include <Library/DebugLib.h>
 #include <Library/UefiDriverEntryPoint.h>
 #include <Library/UefiLib.h>
@@ -230,55 +231,13 @@ CHAR8 *mEnclosureInfoType3Strings[] = {
 ************************************************************************/
 SMBIOS_TABLE_TYPE4 mProcessorInfoType4 = {
   { EFI_SMBIOS_TYPE_PROCESSOR_INFORMATION, sizeof (SMBIOS_TABLE_TYPE4), 0},
-  1,                    // Socket String
-  CentralProcessor,       // ProcessorType;                                   ///< The enumeration value from PROCESSOR_TYPE_DATA.
+  1,                               // Socket String
+  CentralProcessor,                // ProcessorType;          ///< The enumeration value from PROCESSOR_TYPE_DATA.
   ProcessorFamilyIndicatorFamily2, // ProcessorFamily;        ///< The enumeration value from PROCESSOR_FAMILY2_DATA.
-  2,                    // ProcessorManufacture String;
-  {                     // ProcessorId;
-    {  // PROCESSOR_SIGNATURE
-      0, //  ProcessorSteppingId:4;
-      0, //  ProcessorModel:     4;
-      0, //  ProcessorFamily:    4;
-      0, //  ProcessorType:      2;
-      0, //  ProcessorReserved1: 2;
-      0, //  ProcessorXModel:    4;
-      0, //  ProcessorXFamily:   8;
-      0, //  ProcessorReserved2: 4;
-    },
-
-    {  // PROCESSOR_FEATURE_FLAGS
-      0, //  ProcessorFpu       :1;
-      0, //  ProcessorVme       :1;
-      0, //  ProcessorDe        :1;
-      0, //  ProcessorPse       :1;
-      0, //  ProcessorTsc       :1;
-      0, //  ProcessorMsr       :1;
-      0, //  ProcessorPae       :1;
-      0, //  ProcessorMce       :1;
-      0, //  ProcessorCx8       :1;
-      0, //  ProcessorApic      :1;
-      0, //  ProcessorReserved1 :1;
-      0, //  ProcessorSep       :1;
-      0, //  ProcessorMtrr      :1;
-      0, //  ProcessorPge       :1;
-      0, //  ProcessorMca       :1;
-      0, //  ProcessorCmov      :1;
-      0, //  ProcessorPat       :1;
-      0, //  ProcessorPse36     :1;
-      0, //  ProcessorPsn       :1;
-      0, //  ProcessorClfsh     :1;
-      0, //  ProcessorReserved2 :1;
-      0, //  ProcessorDs        :1;
-      0, //  ProcessorAcpi      :1;
-      0, //  ProcessorMmx       :1;
-      0, //  ProcessorFxsr      :1;
-      0, //  ProcessorSse       :1;
-      0, //  ProcessorSse2      :1;
-      0, //  ProcessorSs        :1;
-      0, //  ProcessorReserved3 :1;
-      0, //  ProcessorTm        :1;
-      0, //  ProcessorReserved4 :2;
-    }
+  2,                               // ProcessorManufacture String;
+  {                                // ProcessorId;
+    { 0x00, 0x00, 0x00, 0x00 },
+    { 0x00, 0x00, 0x00, 0x00 }
   },
   3,                    // ProcessorVersion String;
   {                     // Voltage;
@@ -293,18 +252,31 @@ SMBIOS_TABLE_TYPE4 mProcessorInfoType4 = {
   0,                      // MaxSpeed;
   0,                      // CurrentSpeed;
   0x41,                   // Status;
-  ProcessorUpgradeOther,  // ProcessorUpgrade;      ///< The enumeration value from PROCESSOR_UPGRADE.
-  0,                      // L1CacheHandle;
-  0,                      // L2CacheHandle;
-  0,                      // L3CacheHandle;
+  ProcessorUpgradeNone,   // ProcessorUpgrade;         ///< The enumeration value from PROCESSOR_UPGRADE.
+  0xFFFF,                 // L1CacheHandle;
+  0xFFFF,                 // L2CacheHandle;
+  0xFFFF,                 // L3CacheHandle;
   0,                      // SerialNumber;
   0,                      // AssetTag;
   0,                      // PartNumber;
   4,                      // CoreCount;
   4,                      // EnabledCoreCount;
   4,                      // ThreadCount;
-  0x6C,                   // ProcessorCharacteristics;
+  0x6C,                   // ProcessorCharacteristics; ///< The enumeration value from PROCESSOR_CHARACTERISTIC_FLAGS
+      // ProcessorReserved1              :1;
+      // ProcessorUnknown                :1;
+      // Processor64BitCapble            :1;
+      // ProcessorMultiCore              :1;
+      // ProcessorHardwareThread         :1;
+      // ProcessorExecuteProtection      :1;
+      // ProcessorEnhancedVirtualization :1;
+      // ProcessorPowerPerformanceCtrl    :1;
+      // Processor128bitCapble            :1;
+      // ProcessorReserved2               :7;
   ProcessorFamilyARM,     // ARM Processor Family;
+  0,                      // CoreCount2;
+  0,                      // EnabledCoreCount2;
+  0,                      // ThreadCount2;
 };

 CHAR8 mCpuName[128] = "Unknown ARM CPU";
@@ -832,11 +804,15 @@ ProcessorInfoUpdateSmbiosType4 (
   )
 {
   EFI_STATUS Status;
-  UINT32 Rate;
+  UINT32     Rate;
+  UINT64     *ProcessorId;

   mProcessorInfoType4.CoreCount = (UINT8)MaxCpus;
+  mProcessorInfoType4.CoreCount2 = (UINT8)MaxCpus;
   mProcessorInfoType4.EnabledCoreCount = (UINT8)MaxCpus;
+  mProcessorInfoType4.EnabledCoreCount2 = (UINT8)MaxCpus;
   mProcessorInfoType4.ThreadCount = (UINT8)MaxCpus;
+  mProcessorInfoType4.ThreadCount2 = (UINT8)MaxCpus;

   Status = mFwProtocol->GetMaxClockRate (RPI_MBOX_CLOCK_RATE_ARM, &Rate);
   if (Status != EFI_SUCCESS) {
@@ -856,6 +832,9 @@ ProcessorInfoUpdateSmbiosType4 (

   AsciiStrCpyS (mCpuName, sizeof (mCpuName), mFwProtocol->GetCpuName (-1));

+  ProcessorId = (UINT64 *)&(mProcessorInfoType4.ProcessorId);
+  *ProcessorId = ArmReadMidr();
+
   LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mProcessorInfoType4, mProcessorInfoType4Strings, NULL);
 }

--
2.17.1


[-- Attachment #2: Type: text/html, Size: 16353 bytes --]

  reply	other threads:[~2020-07-20 21:55 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 ` [edk2-platform][PATCH v1 2/7] Platforms/RaspberryPi: SMBIOS Type 2 and Type 3 fixes Samer El-Haj-Mahmoud
2020-07-20 21:53   ` 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 [this message]
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=BN6PR05MB34113B5F8CFDC807E6BF725DB97B0@BN6PR05MB3411.namprd05.prod.outlook.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