]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/CpuMpPei/Microcode.c
UefiCpuPkg/CpuMpPei: Load microcode if found newer revision
[mirror_edk2.git] / UefiCpuPkg / CpuMpPei / Microcode.c
index 70e149be877262973e67fd36cd990f432a23a037..9dcbf99db3b6e5d676ac2d5d12bbaacaeadcc4ec 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Implementation of loading microcode on processors.\r
 \r
-  Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -57,7 +57,6 @@ MicrocodeDetect (
   UINTN                                   TotalSize;\r
   UINT32                                  CheckSum32;\r
   BOOLEAN                                 CorrectMicrocode;\r
-  INT32                                   CurrentSignature;\r
   MICROCODE_INFO                          MicrocodeInfo;\r
 \r
   ZeroMem (&MicrocodeInfo, sizeof (MICROCODE_INFO));\r
@@ -181,17 +180,20 @@ MicrocodeDetect (
 \r
   if (LatestRevision > 0) {\r
     //\r
-    // Get microcode update signature of currently loaded microcode update\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
-    CurrentSignature = GetCurrentMicrocodeSignature ();\r
-    //\r
-    // If no microcode update has been loaded, then trigger microcode load.\r
-    //\r
-    if (CurrentSignature == 0) {\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