// 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
//\r
// Load Microcode on BSP\r
//\r
- MicrocodeDetect ();\r
+ MicrocodeDetect (PeiCpuMpData);\r
//\r
// Store BSP's MTRR setting\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
- VOID\r
+ IN PEI_CPU_MP_DATA *PeiCpuMpData\r
)\r
{\r
UINT64 MicrocodePatchAddress;\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
- 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