]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/Library/MpInitLib/Microcode.c
UefiCpuPkg/MpInitLib: Always get CPUID & PlatformID in MicrocodeDetect()
[mirror_edk2.git] / UefiCpuPkg / Library / MpInitLib / Microcode.c
index 9389e52ae519a1df30d16b5f30aa219cd6a29acb..247f835b09fc6ac792de1a8cafd3df05f0a06b92 100644 (file)
@@ -93,6 +93,7 @@ MicrocodeDetect (
   UINT32                                  InCompleteCheckSum32;\r
   BOOLEAN                                 CorrectMicrocode;\r
   VOID                                    *MicrocodeData;\r
+  MSR_IA32_PLATFORM_ID_REGISTER           PlatformIdMsr;\r
   UINT32                                  ThreadId;\r
   BOOLEAN                                 IsBspCallIn;\r
 \r
@@ -115,8 +116,18 @@ MicrocodeDetect (
   }\r
 \r
   ExtendedTableLength = 0;\r
-  Eax.Uint32 = CpuMpData->CpuData[ProcessorNumber].ProcessorSignature;\r
-  PlatformId = CpuMpData->CpuData[ProcessorNumber].PlatformId;\r
+  //\r
+  // Here data of CPUID leafs have not been collected into context buffer, so\r
+  // GetProcessorCpuid() cannot be used here to retrieve CPUID data.\r
+  //\r
+  AsmCpuid (CPUID_VERSION_INFO, &Eax.Uint32, NULL, NULL, NULL);\r
+\r
+  //\r
+  // The index of platform information resides in bits 50:52 of MSR IA32_PLATFORM_ID\r
+  //\r
+  PlatformIdMsr.Uint64 = AsmReadMsr64 (MSR_IA32_PLATFORM_ID);\r
+  PlatformId = (UINT8) PlatformIdMsr.Bits.PlatformId;\r
+\r
 \r
   //\r
   // Check whether AP has same processor with BSP.\r