UefiCpuPkg/MpService: GetProcessorInfo returns 6-level topology

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>
This commit is contained in:
Ray Ni 2019-03-25 17:32:15 +08:00 committed by mergify[bot]
parent 15ac284815
commit 9099dcbd61
1 changed files with 19 additions and 0 deletions

View File

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