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>
// Sync BSP's Mtrr table to all wakeup APs and load microcode on APs.\r
//\r
MtrrSetAllMtrrs (&PeiCpuMpData->MtrrTable);\r
// Sync BSP's Mtrr table to all wakeup APs and load microcode on APs.\r
//\r
MtrrSetAllMtrrs (&PeiCpuMpData->MtrrTable);\r
+ MicrocodeDetect (PeiCpuMpData);\r
PeiCpuMpData->CpuData[ProcessorNumber].State = CpuStateIdle;\r
} else {\r
//\r
PeiCpuMpData->CpuData[ProcessorNumber].State = CpuStateIdle;\r
} else {\r
//\r
//\r
// Load Microcode on BSP\r
//\r
//\r
// Load Microcode on BSP\r
//\r
+ MicrocodeDetect (PeiCpuMpData);\r
//\r
// Store BSP's MTRR setting\r
//\r
//\r
// Store BSP's MTRR setting\r
//\r
OUT EFI_SEC_PLATFORM_INFORMATION_RECORD2 *PlatformInformationRecord2\r
);\r
\r
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
/**\r
Detect whether specified processor can find matching microcode patch and load it.\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
**/\r
VOID\r
MicrocodeDetect (\r
+ IN PEI_CPU_MP_DATA *PeiCpuMpData\r
)\r
{\r
UINT64 MicrocodePatchAddress;\r
)\r
{\r
UINT64 MicrocodePatchAddress;\r
MicrocodeEntryPoint = (EFI_CPU_MICROCODE_HEADER *) (((UINTN) MicrocodeEntryPoint) + TotalSize);\r
} while (((UINTN) MicrocodeEntryPoint < MicrocodeEnd));\r
\r
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
//\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
+ MicrocodeInfo.Load = TRUE;\r
+ } else {\r
+ MicrocodeInfo.Load = FALSE;\r
UINT32 ProcessorChecksum;\r
} EFI_CPU_MICROCODE_EXTENDED_TABLE;\r
\r
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