]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg/MpService: GetProcessorInfo returns 6-level topology
authorRay Ni <ray.ni@intel.com>
Mon, 25 Mar 2019 09:32:15 +0000 (17:32 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fri, 15 May 2020 08:48:35 +0000 (08:48 +0000)
Intel SDM introduces 6-levels for describing the CPU topology:
* Package
* Module
* Tile
* Die
* Core
* Thread

A PI spec ECR was submitted to enhance CPU_MP PPI/Protocol to
support returning such information through GetProcessorInfo().
An accordingly change was implemented and pushed to edk2-staging.

Now the PI spec has been published.
The patch is cherry-picked from edk2-staging to edk2.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
UefiCpuPkg/Library/MpInitLib/MpLib.c

index cbc5594c786a82ad68627e1bf54b137775f9d13a..ab7a8ed6633a52b0c7d4cb3b5d0646a5800916dd 100644 (file)
@@ -1879,10 +1879,17 @@ MpInitLibGetProcessorInfo (
   CPU_MP_DATA            *CpuMpData;\r
   UINTN                  CallerNumber;\r
   CPU_INFO_IN_HOB        *CpuInfoInHob;\r
+  UINTN                  OriginalProcessorNumber;\r
 \r
   CpuMpData = GetCpuMpData ();\r
   CpuInfoInHob = (CPU_INFO_IN_HOB *) (UINTN) CpuMpData->CpuInfoInHob;\r
 \r
+  //\r
+  // Lower 24 bits contains the actual processor number.\r
+  //\r
+  OriginalProcessorNumber = ProcessorNumber;\r
+  ProcessorNumber &= BIT24 - 1;\r
+\r
   //\r
   // Check whether caller processor is BSP\r
   //\r
@@ -1923,6 +1930,18 @@ MpInitLibGetProcessorInfo (
     &ProcessorInfoBuffer->Location.Thread\r
     );\r
 \r
+  if ((OriginalProcessorNumber & CPU_V2_EXTENDED_TOPOLOGY) != 0) {\r
+    GetProcessorLocation2ByApicId (\r
+      CpuInfoInHob[ProcessorNumber].ApicId,\r
+      &ProcessorInfoBuffer->ExtendedInformation.Location2.Package,\r
+      &ProcessorInfoBuffer->ExtendedInformation.Location2.Die,\r
+      &ProcessorInfoBuffer->ExtendedInformation.Location2.Tile,\r
+      &ProcessorInfoBuffer->ExtendedInformation.Location2.Module,\r
+      &ProcessorInfoBuffer->ExtendedInformation.Location2.Core,\r
+      &ProcessorInfoBuffer->ExtendedInformation.Location2.Thread\r
+      );\r
+  }\r
+\r
   if (HealthData != NULL) {\r
     HealthData->Uint32 = CpuInfoInHob[ProcessorNumber].Health;\r
   }\r