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 5/7] Platforms/RaspberryPi: SMBIOS Type 7 fixes
Date: Mon, 20 Jul 2020 21:54:50 +0000	[thread overview]
Message-ID: <BN6PR05MB341110347374499FDA382CB0B97B0@BN6PR05MB3411.namprd05.prod.outlook.com> (raw)
In-Reply-To: <20200720181646.2891-6-Samer.El-Haj-Mahmoud@arm.com>

[-- Attachment #1: Type: text/plain, Size: 8677 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 5/7] Platforms/RaspberryPi: SMBIOS Type 7 fixes

Various fixes and enhancements for SMBIOS Type 7:
 - Break into 3 instances (L1 Instruction, L1 Data, and L2 cache)
 - Use correct values for RPi4 and RPi3 SoCs
 - Add Type 4 association with type 7 handles

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 | 146 ++++++++++++++++++--
 1 file changed, 133 insertions(+), 13 deletions(-)

diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
index 4dcdec5615dc..4ee8ae6ebfc9 100644
--- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
+++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
@@ -291,12 +291,24 @@ CHAR8 *mProcessorInfoType4Strings[] = {
 /***********************************************************************
         SMBIOS data definition  TYPE7  Cache Information
 ************************************************************************/
-SMBIOS_TABLE_TYPE7 mCacheInfoType7 = {
+SMBIOS_TABLE_TYPE7 mCacheInfoType7_L1I = {
   { EFI_SMBIOS_TYPE_CACHE_INFORMATION, sizeof (SMBIOS_TABLE_TYPE7), 0 },
   1,                        // SocketDesignation String
-  0x018A,                                       // Cache Configuration
-  0x00FF,                                       // Maximum Size 256k
-  0x00FF,                                       // Install Size 256k
+  0x380,                    // Cache Configuration
+       //Cache Level        :3  (L1)
+       //Cache Socketed     :1  (Not Socketed)
+       //Reserved           :1
+       //Location           :2  (Internal)
+       //Enabled/Disabled   :1  (Enabled)
+       //Operational Mode   :2  (Unknown)
+       //Reserved           :6
+#if (RPI_MODEL == 4)
+  0x0030,                   // Maximum Size (RPi4: 48KB)
+  0x0030,                   // Install Size (RPi4: 48KB)
+#else
+  0x0010,                   // Maximum Size (RPi3: 16KB)
+  0x0010,                   // Install Size (RPi3: 16KB)
+#endif
   {                         // Supported SRAM Type
     0,  //Other             :1
     0,  //Unknown           :1
@@ -317,16 +329,115 @@ SMBIOS_TABLE_TYPE7 mCacheInfoType7 = {
     0,  //Asynchronous      :1
     0   //Reserved          :9
   },
-  0,                                            // Cache Speed unknown
-  CacheErrorMultiBit,           // Error Correction Multi
-  CacheTypeUnknown,                     // System Cache Type
-  CacheAssociativity2Way        // Associativity
+  0,                        // Cache Speed unknown
+  CacheErrorParity,         // Error Correction
+  CacheTypeInstruction,     // System Cache Type
+  CacheAssociativity2Way    // Associativity  (RPi4 L1 Instruction cache is 3-way set associative, but SMBIOS spec does not define that)
 };
-CHAR8  *mCacheInfoType7Strings[] = {
-  "Cache1",
+CHAR8  *mCacheInfoType7Strings_L1I[] = {
+  "L1 Instruction",
   NULL
 };

+SMBIOS_TABLE_TYPE7 mCacheInfoType7_L1D = {
+  { EFI_SMBIOS_TYPE_CACHE_INFORMATION, sizeof (SMBIOS_TABLE_TYPE7), 0 },
+  1,                        // SocketDesignation String
+  0x180,                    // Cache Configuration
+       //Cache Level        :3  (L1)
+       //Cache Socketed     :1  (Not Socketed)
+       //Reserved           :1
+       //Location           :2  (Internal)
+       //Enabled/Disabled   :1  (Enabled)
+       //Operational Mode   :2  (WB)
+       //Reserved           :6
+#if (RPI_MODEL == 4)
+  0x0020,                   // Maximum Size (RPi4: 32KB)
+  0x0020,                   // Install Size (RPi4: 32KB)
+#else
+  0x0010,                   // Maximum Size (RPi3: 16KB)
+  0x0010,                   // Install Size (RPi3: 16KB)
+#endif
+  {                         // Supported SRAM Type
+    0,  //Other             :1
+    0,  //Unknown           :1
+    0,  //NonBurst          :1
+    1,  //Burst             :1
+    0,  //PiplelineBurst    :1
+    1,  //Synchronous       :1
+    0,  //Asynchronous      :1
+    0   //Reserved          :9
+  },
+  {                         // Current SRAM Type
+    0,  //Other             :1
+    0,  //Unknown           :1
+    0,  //NonBurst          :1
+    1,  //Burst             :1
+    0,  //PiplelineBurst    :1
+    1,  //Synchronous       :1
+    0,  //Asynchronous      :1
+    0   //Reserved          :9
+  },
+  0,                        // Cache Speed unknown
+  CacheErrorSingleBit,      // Error Correction
+  CacheTypeData,            // System Cache Type
+#if (RPI_MODEL == 4)
+  CacheAssociativity2Way    // Associativity
+#else
+  CacheAssociativity4Way    // Associativity
+#endif
+};
+CHAR8  *mCacheInfoType7Strings_L1D[] = {
+  "L1 Data",
+  NULL
+};
+
+SMBIOS_TABLE_TYPE7 mCacheInfoType7_L2 = {
+  { EFI_SMBIOS_TYPE_CACHE_INFORMATION, sizeof (SMBIOS_TABLE_TYPE7), 0 },
+  1,                        // SocketDesignation String
+  0x0181,                   // Cache Configuration
+       //Cache Level        :3  (L2)
+       //Cache Socketed     :1  (Not Socketed)
+       //Reserved           :1
+       //Location           :2  (Internal)
+       //Enabled/Disabled   :1  (Enabled)
+       //Operational Mode   :2  (WB)
+       //Reserved           :6
+#if (RPI_MODEL == 4)
+  0x0400,                   // Maximum Size (RPi4: 1MB)
+  0x0400,                   // Install Size (RPi4: 1MB)
+#else
+  0x0200,                   // Maximum Size (RPi3: 512KB)
+  0x0200,                   // Install Size (RPi3: 512KB)
+#endif
+  {                         // Supported SRAM Type
+    0,  //Other             :1
+    0,  //Unknown           :1
+    0,  //NonBurst          :1
+    1,  //Burst             :1
+    0,  //PiplelineBurst    :1
+    1,  //Synchronous       :1
+    0,  //Asynchronous      :1
+    0   //Reserved          :9
+  },
+  {                         // Current SRAM Type
+    0,  //Other             :1
+    0,  //Unknown           :1
+    0,  //NonBurst          :1
+    1,  //Burst             :1
+    0,  //PiplelineBurst    :1
+    1,  //Synchronous       :1
+    0,  //Asynchronous      :1
+    0   //Reserved          :9
+  },
+  0,                        // Cache Speed unknown
+  CacheErrorSingleBit,      // Error Correction Multi
+  CacheTypeUnified,         // System Cache Type
+  CacheAssociativity16Way   // Associativity
+};
+CHAR8  *mCacheInfoType7Strings_L2[] = {
+  "L2",
+  NULL
+};
 /***********************************************************************
         SMBIOS data definition  TYPE9  System Slot Information
 ************************************************************************/
@@ -846,7 +957,17 @@ CacheInfoUpdateSmbiosType7 (
   VOID
   )
 {
-  LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mCacheInfoType7, mCacheInfoType7Strings, NULL);
+  EFI_SMBIOS_HANDLE SmbiosHandle;
+
+  LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mCacheInfoType7_L1I, mCacheInfoType7Strings_L1I, NULL);
+
+  LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mCacheInfoType7_L1D, mCacheInfoType7Strings_L1D, &SmbiosHandle);
+  // Set Type4 L1CacheHandle to point to the newly added L1 Data Cache
+  mProcessorInfoType4.L1CacheHandle = (UINT16) SmbiosHandle;
+
+  LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mCacheInfoType7_L2, mCacheInfoType7Strings_L2, &SmbiosHandle);
+  // Set Type4 L2CacheHandle to point to the newly added L2 Cache
+  mProcessorInfoType4.L2CacheHandle = (UINT16) SmbiosHandle;
 }

 /***********************************************************************
@@ -972,11 +1093,10 @@ PlatformSmbiosDriverEntryPoint (

   BoardInfoUpdateSmbiosType2 ();

+  CacheInfoUpdateSmbiosType7 (); // Add Type 7 first to get Cache handle for use in Type 4

   ProcessorInfoUpdateSmbiosType4 (4);   //One example for creating and updating

-  CacheInfoUpdateSmbiosType7 ();
-
   SysSlotInfoUpdateSmbiosType9 ();

   OemStringsUpdateSmbiosType11 ();
--
2.17.1


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

  reply	other threads:[~2020-07-20 21:54 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
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 [this message]
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=BN6PR05MB341110347374499FDA382CB0B97B0@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