<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Consolas, Courier, monospace; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family: Consolas, Courier, monospace; background-color: rgb(255, 255, 255); display: inline !important">Reviewed-by: Andrei Warkentin <awarkentin@vmware.com></span><br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com><br>
<b>Sent:</b> Monday, July 20, 2020 1:16 PM<br>
<b>To:</b> devel@edk2.groups.io <devel@edk2.groups.io><br>
<b>Cc:</b> Leif Lindholm <leif@nuviainc.com>; Pete Batard <pete@akeo.ie>; Andrei Warkentin <awarkentin@vmware.com>; Ard Biesheuvel <ard.biesheuvel@arm.com><br>
<b>Subject:</b> [edk2-platform][PATCH v1 5/7] Platforms/RaspberryPi: SMBIOS Type 7 fixes</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Various fixes and enhancements for SMBIOS Type 7:<br>
 - Break into 3 instances (L1 Instruction, L1 Data, and L2 cache)<br>
 - Use correct values for RPi4 and RPi3 SoCs<br>
 - Add Type 4 association with type 7 handles<br>
<br>
Cc: Leif Lindholm <leif@nuviainc.com><br>
Cc: Pete Batard <pete@akeo.ie><br>
Cc: Andrei Warkentin <awarkentin@vmware.com><br>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com><br>
Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com><br>
---<br>
 Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c | 146 ++++++++++++++++++--<br>
 1 file changed, 133 insertions(+), 13 deletions(-)<br>
<br>
diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c<br>
index 4dcdec5615dc..4ee8ae6ebfc9 100644<br>
--- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c<br>
+++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c<br>
@@ -291,12 +291,24 @@ CHAR8 *mProcessorInfoType4Strings[] = {<br>
 /***********************************************************************<br>
         SMBIOS data definition  TYPE7  Cache Information<br>
 ************************************************************************/<br>
-SMBIOS_TABLE_TYPE7 mCacheInfoType7 = {<br>
+SMBIOS_TABLE_TYPE7 mCacheInfoType7_L1I = {<br>
   { EFI_SMBIOS_TYPE_CACHE_INFORMATION, sizeof (SMBIOS_TABLE_TYPE7), 0 },<br>
   1,                        // SocketDesignation String<br>
-  0x018A,                                       // Cache Configuration<br>
-  0x00FF,                                       // Maximum Size 256k<br>
-  0x00FF,                                       // Install Size 256k<br>
+  0x380,                    // Cache Configuration<br>
+       //Cache Level        :3  (L1)<br>
+       //Cache Socketed     :1  (Not Socketed)<br>
+       //Reserved           :1<br>
+       //Location           :2  (Internal)<br>
+       //Enabled/Disabled   :1  (Enabled)<br>
+       //Operational Mode   :2  (Unknown)<br>
+       //Reserved           :6<br>
+#if (RPI_MODEL == 4)<br>
+  0x0030,                   // Maximum Size (RPi4: 48KB)<br>
+  0x0030,                   // Install Size (RPi4: 48KB)<br>
+#else<br>
+  0x0010,                   // Maximum Size (RPi3: 16KB)<br>
+  0x0010,                   // Install Size (RPi3: 16KB)<br>
+#endif<br>
   {                         // Supported SRAM Type<br>
     0,  //Other             :1<br>
     0,  //Unknown           :1<br>
@@ -317,16 +329,115 @@ SMBIOS_TABLE_TYPE7 mCacheInfoType7 = {<br>
     0,  //Asynchronous      :1<br>
     0   //Reserved          :9<br>
   },<br>
-  0,                                            // Cache Speed unknown<br>
-  CacheErrorMultiBit,           // Error Correction Multi<br>
-  CacheTypeUnknown,                     // System Cache Type<br>
-  CacheAssociativity2Way        // Associativity<br>
+  0,                        // Cache Speed unknown<br>
+  CacheErrorParity,         // Error Correction<br>
+  CacheTypeInstruction,     // System Cache Type<br>
+  CacheAssociativity2Way    // Associativity  (RPi4 L1 Instruction cache is 3-way set associative, but SMBIOS spec does not define that)<br>
 };<br>
-CHAR8  *mCacheInfoType7Strings[] = {<br>
-  "Cache1",<br>
+CHAR8  *mCacheInfoType7Strings_L1I[] = {<br>
+  "L1 Instruction",<br>
   NULL<br>
 };<br>
 <br>
+SMBIOS_TABLE_TYPE7 mCacheInfoType7_L1D = {<br>
+  { EFI_SMBIOS_TYPE_CACHE_INFORMATION, sizeof (SMBIOS_TABLE_TYPE7), 0 },<br>
+  1,                        // SocketDesignation String<br>
+  0x180,                    // Cache Configuration<br>
+       //Cache Level        :3  (L1)<br>
+       //Cache Socketed     :1  (Not Socketed)<br>
+       //Reserved           :1<br>
+       //Location           :2  (Internal)<br>
+       //Enabled/Disabled   :1  (Enabled)<br>
+       //Operational Mode   :2  (WB)<br>
+       //Reserved           :6<br>
+#if (RPI_MODEL == 4)<br>
+  0x0020,                   // Maximum Size (RPi4: 32KB)<br>
+  0x0020,                   // Install Size (RPi4: 32KB)<br>
+#else<br>
+  0x0010,                   // Maximum Size (RPi3: 16KB)<br>
+  0x0010,                   // Install Size (RPi3: 16KB)<br>
+#endif<br>
+  {                         // Supported SRAM Type<br>
+    0,  //Other             :1<br>
+    0,  //Unknown           :1<br>
+    0,  //NonBurst          :1<br>
+    1,  //Burst             :1<br>
+    0,  //PiplelineBurst    :1<br>
+    1,  //Synchronous       :1<br>
+    0,  //Asynchronous      :1<br>
+    0   //Reserved          :9<br>
+  },<br>
+  {                         // Current SRAM Type<br>
+    0,  //Other             :1<br>
+    0,  //Unknown           :1<br>
+    0,  //NonBurst          :1<br>
+    1,  //Burst             :1<br>
+    0,  //PiplelineBurst    :1<br>
+    1,  //Synchronous       :1<br>
+    0,  //Asynchronous      :1<br>
+    0   //Reserved          :9<br>
+  },<br>
+  0,                        // Cache Speed unknown<br>
+  CacheErrorSingleBit,      // Error Correction<br>
+  CacheTypeData,            // System Cache Type<br>
+#if (RPI_MODEL == 4)<br>
+  CacheAssociativity2Way    // Associativity<br>
+#else<br>
+  CacheAssociativity4Way    // Associativity<br>
+#endif<br>
+};<br>
+CHAR8  *mCacheInfoType7Strings_L1D[] = {<br>
+  "L1 Data",<br>
+  NULL<br>
+};<br>
+<br>
+SMBIOS_TABLE_TYPE7 mCacheInfoType7_L2 = {<br>
+  { EFI_SMBIOS_TYPE_CACHE_INFORMATION, sizeof (SMBIOS_TABLE_TYPE7), 0 },<br>
+  1,                        // SocketDesignation String<br>
+  0x0181,                   // Cache Configuration<br>
+       //Cache Level        :3  (L2)<br>
+       //Cache Socketed     :1  (Not Socketed)<br>
+       //Reserved           :1<br>
+       //Location           :2  (Internal)<br>
+       //Enabled/Disabled   :1  (Enabled)<br>
+       //Operational Mode   :2  (WB)<br>
+       //Reserved           :6<br>
+#if (RPI_MODEL == 4)<br>
+  0x0400,                   // Maximum Size (RPi4: 1MB)<br>
+  0x0400,                   // Install Size (RPi4: 1MB)<br>
+#else<br>
+  0x0200,                   // Maximum Size (RPi3: 512KB)<br>
+  0x0200,                   // Install Size (RPi3: 512KB)<br>
+#endif<br>
+  {                         // Supported SRAM Type<br>
+    0,  //Other             :1<br>
+    0,  //Unknown           :1<br>
+    0,  //NonBurst          :1<br>
+    1,  //Burst             :1<br>
+    0,  //PiplelineBurst    :1<br>
+    1,  //Synchronous       :1<br>
+    0,  //Asynchronous      :1<br>
+    0   //Reserved          :9<br>
+  },<br>
+  {                         // Current SRAM Type<br>
+    0,  //Other             :1<br>
+    0,  //Unknown           :1<br>
+    0,  //NonBurst          :1<br>
+    1,  //Burst             :1<br>
+    0,  //PiplelineBurst    :1<br>
+    1,  //Synchronous       :1<br>
+    0,  //Asynchronous      :1<br>
+    0   //Reserved          :9<br>
+  },<br>
+  0,                        // Cache Speed unknown<br>
+  CacheErrorSingleBit,      // Error Correction Multi<br>
+  CacheTypeUnified,         // System Cache Type<br>
+  CacheAssociativity16Way   // Associativity<br>
+};<br>
+CHAR8  *mCacheInfoType7Strings_L2[] = {<br>
+  "L2",<br>
+  NULL<br>
+};<br>
 /***********************************************************************<br>
         SMBIOS data definition  TYPE9  System Slot Information<br>
 ************************************************************************/<br>
@@ -846,7 +957,17 @@ CacheInfoUpdateSmbiosType7 (<br>
   VOID<br>
   )<br>
 {<br>
-  LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mCacheInfoType7, mCacheInfoType7Strings, NULL);<br>
+  EFI_SMBIOS_HANDLE SmbiosHandle;<br>
+<br>
+  LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mCacheInfoType7_L1I, mCacheInfoType7Strings_L1I, NULL);<br>
+<br>
+  LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mCacheInfoType7_L1D, mCacheInfoType7Strings_L1D, &SmbiosHandle);<br>
+  // Set Type4 L1CacheHandle to point to the newly added L1 Data Cache<br>
+  mProcessorInfoType4.L1CacheHandle = (UINT16) SmbiosHandle;<br>
+<br>
+  LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mCacheInfoType7_L2, mCacheInfoType7Strings_L2, &SmbiosHandle);<br>
+  // Set Type4 L2CacheHandle to point to the newly added L2 Cache<br>
+  mProcessorInfoType4.L2CacheHandle = (UINT16) SmbiosHandle;<br>
 }<br>
 <br>
 /***********************************************************************<br>
@@ -972,11 +1093,10 @@ PlatformSmbiosDriverEntryPoint (<br>
 <br>
   BoardInfoUpdateSmbiosType2 ();<br>
 <br>
+  CacheInfoUpdateSmbiosType7 (); // Add Type 7 first to get Cache handle for use in Type 4<br>
 <br>
   ProcessorInfoUpdateSmbiosType4 (4);   //One example for creating and updating<br>
 <br>
-  CacheInfoUpdateSmbiosType7 ();<br>
-<br>
   SysSlotInfoUpdateSmbiosType9 ();<br>
 <br>
   OemStringsUpdateSmbiosType11 ();<br>
-- <br>
2.17.1<br>
<br>
</div>
</span></font></div>
</body>
</html>

<div width="1" style="color:white;clear:both">_._,_._,_</div>
<hr>
Groups.io Links:<p>


You receive all messages sent to this group.



<p>

<a target="_blank" href="https://edk2.groups.io/g/devel/message/62868">View/Reply Online (#62868)</a> |


  


|


  
    <a target="_blank" href="https://groups.io/mt/75687847/1813853">Mute This Topic</a>
  

| <a href="https://edk2.groups.io/g/devel/post">New Topic</a><br>



<br>

<a href="https://edk2.groups.io/g/devel/editsub/1813853">Your Subscription</a> |
<a href="mailto:devel+owner@edk2.groups.io">Contact Group Owner</a> |

<a href="https://edk2.groups.io/g/devel/unsub">Unsubscribe</a>

 [edk2-devel-archive@redhat.com]<br>
<div width="1" style="color:white;clear:both">_._,_._,_</div>