]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg/CpuMpPei: Dump message if microcode signature not matched
authorJeff Fan <jeff.fan@intel.com>
Fri, 1 Jul 2016 06:52:12 +0000 (14:52 +0800)
committerJeff Fan <jeff.fan@intel.com>
Wed, 13 Jul 2016 07:41:49 +0000 (15:41 +0800)
Verification microcode signature is one enhancement and not one requirement from
IA32 SDM. This update is just to dump debug message instead of ASSERT() if the
updated microcode signature does not match the loaded microcode signature.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com>
UefiCpuPkg/CpuMpPei/CpuMpPei.c
UefiCpuPkg/CpuMpPei/CpuMpPei.h
UefiCpuPkg/CpuMpPei/Microcode.c
UefiCpuPkg/CpuMpPei/Microcode.h

index 4ed1da98787858e8008df9614e45900333c5ff2c..bccff24cc1920d514775fbbbe15eb5ea09b5232c 100644 (file)
@@ -302,7 +302,7 @@ ApCFunction (
       // Sync BSP's Mtrr table to all wakeup APs and load microcode on APs.\r
       //\r
       MtrrSetAllMtrrs (&PeiCpuMpData->MtrrTable);\r
-      MicrocodeDetect ();\r
+      MicrocodeDetect (PeiCpuMpData);\r
       PeiCpuMpData->CpuData[ProcessorNumber].State = CpuStateIdle;\r
     } else {\r
       //\r
@@ -624,7 +624,7 @@ CountProcessorNumber (
   //\r
   // Load Microcode on BSP\r
   //\r
-  MicrocodeDetect ();\r
+  MicrocodeDetect (PeiCpuMpData);\r
   //\r
   // Store BSP's MTRR setting\r
   //\r
index afbcb6e5790a2cbe205669efb7cdbcc1cd2ade34..5e56934a27b761fc2a691b25eae127fbb325f9c2 100644 (file)
@@ -321,4 +321,14 @@ SecPlatformInformation2 (
      OUT EFI_SEC_PLATFORM_INFORMATION_RECORD2 *PlatformInformationRecord2\r
   );\r
 \r
+/**\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
+  IN PEI_CPU_MP_DATA            *PeiCpuMpData\r
+  );\r
+\r
 #endif\r
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
index ea686690ff70de5fdfdca1ffac49245b6f878c5b..f7d23a08fd28d580a6b37537ebd5c68f6c512d97 100644 (file)
@@ -56,13 +56,4 @@ typedef struct {
   UINT32  ProcessorChecksum;\r
 } EFI_CPU_MICROCODE_EXTENDED_TABLE;\r
 \r
-/**\r
-  Detect whether specified processor can find matching microcode patch and load it.\r
-\r
-**/\r
-VOID\r
-MicrocodeDetect (\r
-  VOID\r
-  );\r
-\r
 #endif\r