On 10/10/19 21:26, Eduardo Habkost wrote:

> Topology info is already available on CPUID.

Independently of everything else, thanks for pointing this out.

The edk2 library called "LocalApicLib" has two relevant functions:

> /**
>   Get Package ID/Core ID/Thread ID of a processor.
>
>   The algorithm assumes the target system has symmetry across physical
>   package  boundaries with respect to the number of logical processors
>   per package,  number of cores per package.
>
>   @param[in]  InitialApicId  Initial APIC ID of the target logical processor.
>   @param[out]  Package       Returns the processor package ID.
>   @param[out]  Core          Returns the processor core ID.
>   @param[out]  Thread        Returns the processor thread ID.
> **/
> VOID
> EFIAPI
> GetProcessorLocationByApicId (
>   IN  UINT32  InitialApicId,
>   OUT UINT32  *Package  OPTIONAL,
>   OUT UINT32  *Core    OPTIONAL,
>   OUT UINT32  *Thread  OPTIONAL
>   );
>
> /**
>   Get Package ID/Module ID/Tile ID/Die ID/Core ID/Thread ID of a processor.
>
>   The algorithm assumes the target system has symmetry across physical
>   package boundaries with respect to the number of threads per core, number of
>   cores per module, number of modules per tile, number of tiles per die, 
> number
>   of dies per package.
>
>   @param[in]   InitialApicId Initial APIC ID of the target logical processor.
>   @param[out]  Package       Returns the processor package ID.
>   @param[out]  Die           Returns the processor die ID.
>   @param[out]  Tile          Returns the processor tile ID.
>   @param[out]  Module        Returns the processor module ID.
>   @param[out]  Core          Returns the processor core ID.
>   @param[out]  Thread        Returns the processor thread ID.
> **/
> VOID
> EFIAPI
> GetProcessorLocation2ByApicId (
>   IN  UINT32  InitialApicId,
>   OUT UINT32  *Package  OPTIONAL,
>   OUT UINT32  *Die      OPTIONAL,
>   OUT UINT32  *Tile     OPTIONAL,
>   OUT UINT32  *Module   OPTIONAL,
>   OUT UINT32  *Core     OPTIONAL,
>   OUT UINT32  *Thread   OPTIONAL
>   );

They are implemented with heavy CPUID usage.

So... just give me the APIC-ID. That's the primary key in edk2 for identifying
x86 processors.

Thanks
Laszlo

Reply via email to