mirror of
https://github.com/tianocore/edk2
synced 2026-08-27 00:23:19 -04:00
UefiCpuPkg/MpInitLib: Skip ucode rev dump if not loaded in the library
MicrocodeDetect() loads microcode in the first thread of each core and populates MicrocodeRevision and MicrocodeEntryAddr fields. AMD CPUs use a separate function to load microcode, leaving MicrocodePatchRegionSize as zero. In the case, the function returns early without populating these fields, leaving them as zero. As a result, the misleading debug output (Microcode revision = 00000000, expected = 00000000) may appear on AMD systems, implying microcode was not applied when it actually was. To avoid the confusion, skip the microcode revision dump when it is not loaded in the library. Signed-off-by: Phil Noh <Phil.Noh@amd.com>
This commit is contained in:
parent
83060dd335
commit
d2e5c5781e
1 changed files with 34 additions and 26 deletions
|
|
@ -2465,37 +2465,45 @@ MpInitLibInitialize (
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Dump the microcode revision for each core.
|
||||
//
|
||||
DEBUG_CODE_BEGIN ();
|
||||
UINT32 ThreadId;
|
||||
UINT32 ExpectedMicrocodeRevision;
|
||||
if (CpuMpData->MicrocodePatchRegionSize != 0) {
|
||||
//
|
||||
// Dump the microcode revision for each core.
|
||||
//
|
||||
DEBUG_CODE_BEGIN ();
|
||||
UINT32 ThreadId;
|
||||
UINT32 ExpectedMicrocodeRevision;
|
||||
|
||||
CpuInfoInHob = (CPU_INFO_IN_HOB *)(UINTN)CpuMpData->CpuInfoInHob;
|
||||
for (Index = 0; Index < CpuMpData->CpuCount; Index++) {
|
||||
GetProcessorLocationByApicId (CpuInfoInHob[Index].InitialApicId, NULL, NULL, &ThreadId);
|
||||
if (ThreadId == 0) {
|
||||
//
|
||||
// MicrocodeDetect() loads microcode in first thread of each core, so,
|
||||
// CpuMpData->CpuData[Index].MicrocodeEntryAddr is initialized only for first thread of each core.
|
||||
//
|
||||
ExpectedMicrocodeRevision = 0;
|
||||
if (CpuMpData->CpuData[Index].MicrocodeEntryAddr != 0) {
|
||||
ExpectedMicrocodeRevision = ((CPU_MICROCODE_HEADER *)(UINTN)CpuMpData->CpuData[Index].MicrocodeEntryAddr)->UpdateRevision;
|
||||
CpuInfoInHob = (CPU_INFO_IN_HOB *)(UINTN)CpuMpData->CpuInfoInHob;
|
||||
for (Index = 0; Index < CpuMpData->CpuCount; Index++) {
|
||||
GetProcessorLocationByApicId (CpuInfoInHob[Index].InitialApicId, NULL, NULL, &ThreadId);
|
||||
if (ThreadId == 0) {
|
||||
//
|
||||
// MicrocodeDetect() loads microcode in first thread of each core, so,
|
||||
// CpuMpData->CpuData[Index].MicrocodeEntryAddr is initialized only for first thread of each core.
|
||||
//
|
||||
ExpectedMicrocodeRevision = 0;
|
||||
if (CpuMpData->CpuData[Index].MicrocodeEntryAddr != 0) {
|
||||
ExpectedMicrocodeRevision = ((CPU_MICROCODE_HEADER *)(UINTN)CpuMpData->CpuData[Index].MicrocodeEntryAddr)->UpdateRevision;
|
||||
}
|
||||
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"CPU[%04d]: Microcode revision = %08x, expected = %08x\n",
|
||||
Index,
|
||||
CpuMpData->CpuData[Index].MicrocodeRevision,
|
||||
ExpectedMicrocodeRevision
|
||||
));
|
||||
}
|
||||
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"CPU[%04d]: Microcode revision = %08x, expected = %08x\n",
|
||||
Index,
|
||||
CpuMpData->CpuData[Index].MicrocodeRevision,
|
||||
ExpectedMicrocodeRevision
|
||||
));
|
||||
}
|
||||
|
||||
DEBUG_CODE_END ();
|
||||
} else {
|
||||
//
|
||||
// There is no microcode patches
|
||||
//
|
||||
DEBUG ((DEBUG_INFO, "No Microcode patch file found\n"));
|
||||
}
|
||||
|
||||
DEBUG_CODE_END ();
|
||||
//
|
||||
// Initialize global data for MP support
|
||||
//
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue