]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/CpuMpPei/Microcode.c
UefiCpuPkg/CpuMpPei: Dump message if microcode signature not matched
[mirror_edk2.git] / UefiCpuPkg / CpuMpPei / Microcode.c
index 67280d334d33fd8774ee93b2d09574283d8a6bec..82d49d7cb9b15c2679e314a096552fc0cf3eb308 100644 (file)
@@ -36,10 +36,11 @@ GetCurrentMicrocodeSignature (
 /**\r
   Detect whether specified processor can find matching microcode patch and load it.\r
 \r
+  @param PeiCpuMpData        Pointer to PEI CPU MP Data\r
 **/\r
 VOID\r
 MicrocodeDetect (\r
-  VOID\r
+  IN PEI_CPU_MP_DATA            *PeiCpuMpData\r
   )\r
 {\r
   UINT64                                  MicrocodePatchAddress;\r
@@ -187,25 +188,29 @@ MicrocodeDetect (
     MicrocodeEntryPoint = (EFI_CPU_MICROCODE_HEADER *) (((UINTN) MicrocodeEntryPoint) + TotalSize);\r
   } while (((UINTN) MicrocodeEntryPoint < MicrocodeEnd));\r
 \r
-  if (LatestRevision > 0) {\r
+  if (LatestRevision > CurrentRevision) {\r
     //\r
     // BIOS only authenticate updates that contain a numerically larger revision\r
     // than the currently loaded revision, where Current Signature < New Update\r
     // Revision. A processor with no loaded update is considered to have a\r
     // revision equal to zero.\r
     //\r
-    if (LatestRevision > GetCurrentMicrocodeSignature ()) {\r
-      AsmWriteMsr64 (\r
-        EFI_MSR_IA32_BIOS_UPDT_TRIG,\r
-        (UINT64) (UINTN) MicrocodeInfo.MicrocodeData\r
-        );\r
-      //\r
-      // Get and verify new microcode signature\r
-      //\r
-      ASSERT (LatestRevision == GetCurrentMicrocodeSignature ());\r
-      MicrocodeInfo.Load = TRUE;\r
-    } else {\r
-      MicrocodeInfo.Load = FALSE;\r
+    AsmWriteMsr64 (\r
+      EFI_MSR_IA32_BIOS_UPDT_TRIG,\r
+      (UINT64) (UINTN) MicrocodeInfo.MicrocodeData\r
+      );\r
+    //\r
+    // Get and check new microcode signature\r
+    //\r
+    CurrentRevision = GetCurrentMicrocodeSignature ();\r
+    if (CurrentRevision != LatestRevision) {\r
+      AcquireSpinLock(&PeiCpuMpData->MpLock);\r
+      DEBUG ((EFI_D_ERROR, "Updated microcode signature [0x%08x] does not match \\r
+                loaded microcode signature [0x%08x]\n", CurrentRevision, LatestRevision));\r
+      ReleaseSpinLock(&PeiCpuMpData->MpLock);\r
     }\r
+    MicrocodeInfo.Load = TRUE;\r
+  } else {\r
+    MicrocodeInfo.Load = FALSE;\r
   }\r
 }\r