UefiCpuPkg/CpuCacheInfoLib: Sort CpuCacheInfo array

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3508

Sort the CpuCacheInfo array by CPU package ID, core type, cache level
and cache type.

Signed-off-by: Jason Lou <yun.lou@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
This commit is contained in:
Lou, Yun
2021-08-06 22:37:13 +08:00
committed by mergify[bot]
parent 97fdcbda4e
commit 4de77ae989
5 changed files with 80 additions and 4 deletions

View File

@@ -17,8 +17,35 @@
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/SortLib.h>
#include <Library/CpuCacheInfoLib.h>
typedef union {
struct {
//
// Type of the cache that this package's this type of logical processor corresponds to.
// Value = CPUID.04h:EAX[04:00]
//
UINT32 CacheType : 5;
//
// Level of the cache that this package's this type of logical processor corresponds to.
// Value = CPUID.04h:EAX[07:05]
//
UINT32 CacheLevel : 3;
//
// Core type of logical processor.
// Value = CPUID.1Ah:EAX[31:24]
//
UINT32 CoreType : 8;
UINT32 Reserved : 16;
//
// Package number.
//
UINT32 Package;
} Bits;
UINT64 Uint64;
} CPU_CACHE_INFO_COMPARATOR;
typedef struct {
//
// Package ID, the information comes from