]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg/MpInitLib: Collect processors' CPUID & Platform ID info
authorHao A Wu <hao.a.wu@intel.com>
Thu, 19 Dec 2019 05:36:24 +0000 (13:36 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Thu, 2 Jan 2020 03:10:36 +0000 (03:10 +0000)
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2429

This commit will collect the CPUID and Platform ID information for each
processor within system. They will be stored in the CPU_AP_DATA structure.

These information will be used in the next commit to decide whether a
microcode patch will be loaded into memory.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
UefiCpuPkg/Library/MpInitLib/MpLib.c
UefiCpuPkg/Library/MpInitLib/MpLib.h

index d32adf0780b72cf7c9934832532e653c021c4b9f..d5077e080e495f0864682ae42e152396c9302a1e 100644 (file)
@@ -548,7 +548,8 @@ InitializeApData (
   IN     UINT64           ApTopOfStack\r
   )\r
 {\r
   IN     UINT64           ApTopOfStack\r
   )\r
 {\r
-  CPU_INFO_IN_HOB          *CpuInfoInHob;\r
+  CPU_INFO_IN_HOB                  *CpuInfoInHob;\r
+  MSR_IA32_PLATFORM_ID_REGISTER    PlatformIdMsr;\r
 \r
   CpuInfoInHob = (CPU_INFO_IN_HOB *) (UINTN) CpuMpData->CpuInfoInHob;\r
   CpuInfoInHob[ProcessorNumber].InitialApicId = GetInitialApicId ();\r
 \r
   CpuInfoInHob = (CPU_INFO_IN_HOB *) (UINTN) CpuMpData->CpuInfoInHob;\r
   CpuInfoInHob[ProcessorNumber].InitialApicId = GetInitialApicId ();\r
@@ -559,6 +560,17 @@ InitializeApData (
   CpuMpData->CpuData[ProcessorNumber].Waiting    = FALSE;\r
   CpuMpData->CpuData[ProcessorNumber].CpuHealthy = (BistData == 0) ? TRUE : FALSE;\r
 \r
   CpuMpData->CpuData[ProcessorNumber].Waiting    = FALSE;\r
   CpuMpData->CpuData[ProcessorNumber].CpuHealthy = (BistData == 0) ? TRUE : FALSE;\r
 \r
+  PlatformIdMsr.Uint64 = AsmReadMsr64 (MSR_IA32_PLATFORM_ID);\r
+  CpuMpData->CpuData[ProcessorNumber].PlatformId = (UINT8) PlatformIdMsr.Bits.PlatformId;\r
+\r
+  AsmCpuid (\r
+    CPUID_VERSION_INFO,\r
+    &CpuMpData->CpuData[ProcessorNumber].ProcessorSignature,\r
+    NULL,\r
+    NULL,\r
+    NULL\r
+    );\r
+\r
   InitializeSpinLock(&CpuMpData->CpuData[ProcessorNumber].ApLock);\r
   SetApState (&CpuMpData->CpuData[ProcessorNumber], CpuStateIdle);\r
 }\r
   InitializeSpinLock(&CpuMpData->CpuData[ProcessorNumber].ApLock);\r
   SetApState (&CpuMpData->CpuData[ProcessorNumber], CpuStateIdle);\r
 }\r
index 8fa07b12c5e11aa4a17c958546a6b7d3d886e7e1..4440dc2701f9b872c96c8844de747def238b523b 100644 (file)
@@ -122,6 +122,8 @@ typedef struct {
   UINT64                         CurrentTime;\r
   UINT64                         TotalTime;\r
   EFI_EVENT                      WaitEvent;\r
   UINT64                         CurrentTime;\r
   UINT64                         TotalTime;\r
   EFI_EVENT                      WaitEvent;\r
+  UINT32                         ProcessorSignature;\r
+  UINT8                          PlatformId;\r
 } CPU_AP_DATA;\r
 \r
 //\r
 } CPU_AP_DATA;\r
 \r
 //\r