summaryrefslogtreecommitdiffstats
path: root/UefiCpuPkg/CpuMpPei
diff options
context:
space:
mode:
authorJeff Fan <jeff.fan@intel.com>2016-07-01 14:52:12 +0800
committerJeff Fan <jeff.fan@intel.com>2016-07-13 15:41:49 +0800
commit719ff8cf3e8f3abc967de8a0a71319ce66ff2d9d (patch)
treef9bb941c6f995de1dd7dd921b11f464baa7bf015 /UefiCpuPkg/CpuMpPei
parent46fd118219fcce638f1eb9c861f4a037530b64b9 (diff)
downloadedk2-719ff8cf3e8f3abc967de8a0a71319ce66ff2d9d.tar.gz
edk2-719ff8cf3e8f3abc967de8a0a71319ce66ff2d9d.tar.bz2
edk2-719ff8cf3e8f3abc967de8a0a71319ce66ff2d9d.zip
UefiCpuPkg/CpuMpPei: Dump message if microcode signature not matched
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>
Diffstat (limited to 'UefiCpuPkg/CpuMpPei')
-rw-r--r--UefiCpuPkg/CpuMpPei/CpuMpPei.c4
-rw-r--r--UefiCpuPkg/CpuMpPei/CpuMpPei.h10
-rw-r--r--UefiCpuPkg/CpuMpPei/Microcode.c33
-rw-r--r--UefiCpuPkg/CpuMpPei/Microcode.h9
4 files changed, 31 insertions, 25 deletions
diff --git a/UefiCpuPkg/CpuMpPei/CpuMpPei.c b/UefiCpuPkg/CpuMpPei/CpuMpPei.c
index 4ed1da9878..bccff24cc1 100644
--- a/UefiCpuPkg/CpuMpPei/CpuMpPei.c
+++ b/UefiCpuPkg/CpuMpPei/CpuMpPei.c
@@ -302,7 +302,7 @@ ApCFunction (
// Sync BSP's Mtrr table to all wakeup APs and load microcode on APs.
//
MtrrSetAllMtrrs (&PeiCpuMpData->MtrrTable);
- MicrocodeDetect ();
+ MicrocodeDetect (PeiCpuMpData);
PeiCpuMpData->CpuData[ProcessorNumber].State = CpuStateIdle;
} else {
//
@@ -624,7 +624,7 @@ CountProcessorNumber (
//
// Load Microcode on BSP
//
- MicrocodeDetect ();
+ MicrocodeDetect (PeiCpuMpData);
//
// Store BSP's MTRR setting
//
diff --git a/UefiCpuPkg/CpuMpPei/CpuMpPei.h b/UefiCpuPkg/CpuMpPei/CpuMpPei.h
index afbcb6e579..5e56934a27 100644
--- a/UefiCpuPkg/CpuMpPei/CpuMpPei.h
+++ b/UefiCpuPkg/CpuMpPei/CpuMpPei.h
@@ -321,4 +321,14 @@ SecPlatformInformation2 (
OUT EFI_SEC_PLATFORM_INFORMATION_RECORD2 *PlatformInformationRecord2
);
+/**
+ Detect whether specified processor can find matching microcode patch and load it.
+
+ @param PeiCpuMpData Pointer to PEI CPU MP Data
+**/
+VOID
+MicrocodeDetect (
+ IN PEI_CPU_MP_DATA *PeiCpuMpData
+ );
+
#endif
diff --git a/UefiCpuPkg/CpuMpPei/Microcode.c b/UefiCpuPkg/CpuMpPei/Microcode.c
index 67280d334d..82d49d7cb9 100644
--- a/UefiCpuPkg/CpuMpPei/Microcode.c
+++ b/UefiCpuPkg/CpuMpPei/Microcode.c
@@ -36,10 +36,11 @@ GetCurrentMicrocodeSignature (
/**
Detect whether specified processor can find matching microcode patch and load it.
+ @param PeiCpuMpData Pointer to PEI CPU MP Data
**/
VOID
MicrocodeDetect (
- VOID
+ IN PEI_CPU_MP_DATA *PeiCpuMpData
)
{
UINT64 MicrocodePatchAddress;
@@ -187,25 +188,29 @@ MicrocodeDetect (
MicrocodeEntryPoint = (EFI_CPU_MICROCODE_HEADER *) (((UINTN) MicrocodeEntryPoint) + TotalSize);
} while (((UINTN) MicrocodeEntryPoint < MicrocodeEnd));
- if (LatestRevision > 0) {
+ if (LatestRevision > CurrentRevision) {
//
// BIOS only authenticate updates that contain a numerically larger revision
// than the currently loaded revision, where Current Signature < New Update
// Revision. A processor with no loaded update is considered to have a
// revision equal to zero.
//
- if (LatestRevision > GetCurrentMicrocodeSignature ()) {
- AsmWriteMsr64 (
- EFI_MSR_IA32_BIOS_UPDT_TRIG,
- (UINT64) (UINTN) MicrocodeInfo.MicrocodeData
- );
- //
- // Get and verify new microcode signature
- //
- ASSERT (LatestRevision == GetCurrentMicrocodeSignature ());
- MicrocodeInfo.Load = TRUE;
- } else {
- MicrocodeInfo.Load = FALSE;
+ AsmWriteMsr64 (
+ EFI_MSR_IA32_BIOS_UPDT_TRIG,
+ (UINT64) (UINTN) MicrocodeInfo.MicrocodeData
+ );
+ //
+ // Get and check new microcode signature
+ //
+ CurrentRevision = GetCurrentMicrocodeSignature ();
+ if (CurrentRevision != LatestRevision) {
+ AcquireSpinLock(&PeiCpuMpData->MpLock);
+ DEBUG ((EFI_D_ERROR, "Updated microcode signature [0x%08x] does not match \
+ loaded microcode signature [0x%08x]\n", CurrentRevision, LatestRevision));
+ ReleaseSpinLock(&PeiCpuMpData->MpLock);
}
+ MicrocodeInfo.Load = TRUE;
+ } else {
+ MicrocodeInfo.Load = FALSE;
}
}
diff --git a/UefiCpuPkg/CpuMpPei/Microcode.h b/UefiCpuPkg/CpuMpPei/Microcode.h
index ea686690ff..f7d23a08fd 100644
--- a/UefiCpuPkg/CpuMpPei/Microcode.h
+++ b/UefiCpuPkg/CpuMpPei/Microcode.h
@@ -56,13 +56,4 @@ typedef struct {
UINT32 ProcessorChecksum;
} EFI_CPU_MICROCODE_EXTENDED_TABLE;
-/**
- Detect whether specified processor can find matching microcode patch and load it.
-
-**/
-VOID
-MicrocodeDetect (
- VOID
- );
-
#endif