UefiCpuPkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the UefiCpuPkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
This commit is contained in:
committed by
mergify[bot]
parent
91415a36ae
commit
053e878bfb
@@ -17,21 +17,31 @@
|
||||
**/
|
||||
VOID
|
||||
CpuCacheInfoPrintCpuCacheInfoTable (
|
||||
IN CPU_CACHE_INFO *CpuCacheInfo,
|
||||
IN UINTN CpuCacheInfoCount
|
||||
IN CPU_CACHE_INFO *CpuCacheInfo,
|
||||
IN UINTN CpuCacheInfoCount
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
UINTN Index;
|
||||
|
||||
DEBUG ((DEBUG_INFO, "+-------+--------------------------------------------------------------------------------------+\n"));
|
||||
DEBUG ((DEBUG_INFO, "| Index | Packge CoreType CacheLevel CacheType CacheWays (FA|DM) CacheSizeinKB CacheCount |\n"));
|
||||
DEBUG ((DEBUG_INFO, "+-------+--------------------------------------------------------------------------------------+\n"));
|
||||
|
||||
for (Index = 0; Index < CpuCacheInfoCount; Index++) {
|
||||
DEBUG ((DEBUG_INFO, "| %4x | %4x %2x %2x %2x %4x ( %x| %x) %8x %4x |\n",
|
||||
Index, CpuCacheInfo[Index].Package, CpuCacheInfo[Index].CoreType, CpuCacheInfo[Index].CacheLevel,
|
||||
CpuCacheInfo[Index].CacheType, CpuCacheInfo[Index].CacheWays, CpuCacheInfo[Index].FullyAssociativeCache,
|
||||
CpuCacheInfo[Index].DirectMappedCache, CpuCacheInfo[Index].CacheSizeinKB, CpuCacheInfo[Index].CacheCount));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"| %4x | %4x %2x %2x %2x %4x ( %x| %x) %8x %4x |\n",
|
||||
Index,
|
||||
CpuCacheInfo[Index].Package,
|
||||
CpuCacheInfo[Index].CoreType,
|
||||
CpuCacheInfo[Index].CacheLevel,
|
||||
CpuCacheInfo[Index].CacheType,
|
||||
CpuCacheInfo[Index].CacheWays,
|
||||
CpuCacheInfo[Index].FullyAssociativeCache,
|
||||
CpuCacheInfo[Index].DirectMappedCache,
|
||||
CpuCacheInfo[Index].CacheSizeinKB,
|
||||
CpuCacheInfo[Index].CacheCount
|
||||
));
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_INFO, "+-------+--------------------------------------------------------------------------------------+\n"));
|
||||
@@ -50,24 +60,24 @@ CpuCacheInfoPrintCpuCacheInfoTable (
|
||||
INTN
|
||||
EFIAPI
|
||||
CpuCacheInfoCompare (
|
||||
IN CONST VOID *Buffer1,
|
||||
IN CONST VOID *Buffer2
|
||||
IN CONST VOID *Buffer1,
|
||||
IN CONST VOID *Buffer2
|
||||
)
|
||||
{
|
||||
CPU_CACHE_INFO_COMPARATOR Comparator1, Comparator2;
|
||||
CPU_CACHE_INFO_COMPARATOR Comparator1, Comparator2;
|
||||
|
||||
ZeroMem (&Comparator1, sizeof (Comparator1));
|
||||
ZeroMem (&Comparator2, sizeof (Comparator2));
|
||||
|
||||
Comparator1.Bits.Package = ((CPU_CACHE_INFO*)Buffer1)->Package;
|
||||
Comparator1.Bits.CoreType = ((CPU_CACHE_INFO*)Buffer1)->CoreType;
|
||||
Comparator1.Bits.CacheLevel = ((CPU_CACHE_INFO*)Buffer1)->CacheLevel;
|
||||
Comparator1.Bits.CacheType = ((CPU_CACHE_INFO*)Buffer1)->CacheType;
|
||||
Comparator1.Bits.Package = ((CPU_CACHE_INFO *)Buffer1)->Package;
|
||||
Comparator1.Bits.CoreType = ((CPU_CACHE_INFO *)Buffer1)->CoreType;
|
||||
Comparator1.Bits.CacheLevel = ((CPU_CACHE_INFO *)Buffer1)->CacheLevel;
|
||||
Comparator1.Bits.CacheType = ((CPU_CACHE_INFO *)Buffer1)->CacheType;
|
||||
|
||||
Comparator2.Bits.Package = ((CPU_CACHE_INFO*)Buffer2)->Package;
|
||||
Comparator2.Bits.CoreType = ((CPU_CACHE_INFO*)Buffer2)->CoreType;
|
||||
Comparator2.Bits.CacheLevel = ((CPU_CACHE_INFO*)Buffer2)->CacheLevel;
|
||||
Comparator2.Bits.CacheType = ((CPU_CACHE_INFO*)Buffer2)->CacheType;
|
||||
Comparator2.Bits.Package = ((CPU_CACHE_INFO *)Buffer2)->Package;
|
||||
Comparator2.Bits.CoreType = ((CPU_CACHE_INFO *)Buffer2)->CoreType;
|
||||
Comparator2.Bits.CacheLevel = ((CPU_CACHE_INFO *)Buffer2)->CacheLevel;
|
||||
Comparator2.Bits.CacheType = ((CPU_CACHE_INFO *)Buffer2)->CacheType;
|
||||
|
||||
if (Comparator1.Uint64 == Comparator2.Uint64) {
|
||||
return 0;
|
||||
@@ -89,15 +99,15 @@ CpuCacheInfoCompare (
|
||||
**/
|
||||
UINT32
|
||||
CpuCacheInfoGetNumberOfPackages (
|
||||
IN CPUID_PROCESSOR_INFO *ProcessorInfo,
|
||||
IN UINTN NumberOfProcessors,
|
||||
IN OUT UINT32 *Package
|
||||
IN CPUID_PROCESSOR_INFO *ProcessorInfo,
|
||||
IN UINTN NumberOfProcessors,
|
||||
IN OUT UINT32 *Package
|
||||
)
|
||||
{
|
||||
UINTN ProcessorIndex;
|
||||
UINT32 PackageIndex;
|
||||
UINT32 PackageCount;
|
||||
UINT32 CurrentPackage;
|
||||
UINTN ProcessorIndex;
|
||||
UINT32 PackageIndex;
|
||||
UINT32 PackageCount;
|
||||
UINT32 CurrentPackage;
|
||||
|
||||
PackageCount = 0;
|
||||
|
||||
@@ -135,21 +145,21 @@ CpuCacheInfoGetNumberOfPackages (
|
||||
@retval Return the number of CoreType of requested package.
|
||||
**/
|
||||
UINTN
|
||||
CpuCacheInfoGetNumberOfCoreTypePerPackage(
|
||||
IN CPUID_PROCESSOR_INFO *ProcessorInfo,
|
||||
IN UINTN NumberOfProcessors,
|
||||
IN UINTN Package
|
||||
CpuCacheInfoGetNumberOfCoreTypePerPackage (
|
||||
IN CPUID_PROCESSOR_INFO *ProcessorInfo,
|
||||
IN UINTN NumberOfProcessors,
|
||||
IN UINTN Package
|
||||
)
|
||||
{
|
||||
UINTN ProcessorIndex;
|
||||
UINTN ProcessorIndex;
|
||||
//
|
||||
// Core Type value comes from CPUID.1Ah.EAX[31:24].
|
||||
// So max number of core types should be MAX_UINT8.
|
||||
//
|
||||
UINT8 CoreType[MAX_UINT8];
|
||||
UINTN CoreTypeIndex;
|
||||
UINTN CoreTypeCount;
|
||||
UINT8 CurrentCoreType;
|
||||
UINT8 CoreType[MAX_UINT8];
|
||||
UINTN CoreTypeIndex;
|
||||
UINTN CoreTypeCount;
|
||||
UINT8 CurrentCoreType;
|
||||
|
||||
//
|
||||
// CoreType array is empty.
|
||||
@@ -192,23 +202,23 @@ CpuCacheInfoGetNumberOfCoreTypePerPackage(
|
||||
VOID
|
||||
EFIAPI
|
||||
CpuCacheInfoCollectCoreAndCacheData (
|
||||
IN OUT VOID *Buffer
|
||||
IN OUT VOID *Buffer
|
||||
)
|
||||
{
|
||||
UINTN ProcessorIndex;
|
||||
UINT32 CpuidMaxInput;
|
||||
UINT8 CacheParamLeafIndex;
|
||||
CPUID_CACHE_PARAMS_EAX CacheParamEax;
|
||||
CPUID_CACHE_PARAMS_EBX CacheParamEbx;
|
||||
UINT32 CacheParamEcx;
|
||||
CPUID_CACHE_PARAMS_EDX CacheParamEdx;
|
||||
CPUID_NATIVE_MODEL_ID_AND_CORE_TYPE_EAX NativeModelIdAndCoreTypeEax;
|
||||
COLLECT_CPUID_CACHE_DATA_CONTEXT *Context;
|
||||
CPUID_CACHE_DATA *CacheData;
|
||||
UINTN ProcessorIndex;
|
||||
UINT32 CpuidMaxInput;
|
||||
UINT8 CacheParamLeafIndex;
|
||||
CPUID_CACHE_PARAMS_EAX CacheParamEax;
|
||||
CPUID_CACHE_PARAMS_EBX CacheParamEbx;
|
||||
UINT32 CacheParamEcx;
|
||||
CPUID_CACHE_PARAMS_EDX CacheParamEdx;
|
||||
CPUID_NATIVE_MODEL_ID_AND_CORE_TYPE_EAX NativeModelIdAndCoreTypeEax;
|
||||
COLLECT_CPUID_CACHE_DATA_CONTEXT *Context;
|
||||
CPUID_CACHE_DATA *CacheData;
|
||||
|
||||
Context = (COLLECT_CPUID_CACHE_DATA_CONTEXT *)Buffer;
|
||||
Context = (COLLECT_CPUID_CACHE_DATA_CONTEXT *)Buffer;
|
||||
ProcessorIndex = CpuCacheInfoWhoAmI (Context->MpServices);
|
||||
CacheData = &Context->CacheData[MAX_NUM_OF_CACHE_PARAMS_LEAF * ProcessorIndex];
|
||||
CacheData = &Context->CacheData[MAX_NUM_OF_CACHE_PARAMS_LEAF * ProcessorIndex];
|
||||
|
||||
AsmCpuid (CPUID_SIGNATURE, &CpuidMaxInput, NULL, NULL, NULL);
|
||||
|
||||
@@ -218,7 +228,7 @@ CpuCacheInfoCollectCoreAndCacheData (
|
||||
Context->ProcessorInfo[ProcessorIndex].CoreType = 0;
|
||||
if (CpuidMaxInput >= CPUID_HYBRID_INFORMATION) {
|
||||
AsmCpuidEx (CPUID_HYBRID_INFORMATION, CPUID_HYBRID_INFORMATION_MAIN_LEAF, &NativeModelIdAndCoreTypeEax.Uint32, NULL, NULL, NULL);
|
||||
Context->ProcessorInfo[ProcessorIndex].CoreType = (UINT8) NativeModelIdAndCoreTypeEax.Bits.CoreType;
|
||||
Context->ProcessorInfo[ProcessorIndex].CoreType = (UINT8)NativeModelIdAndCoreTypeEax.Bits.CoreType;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -240,7 +250,7 @@ CpuCacheInfoCollectCoreAndCacheData (
|
||||
CacheData[CacheParamLeafIndex].DirectMappedCache = (UINT8)(CacheParamEdx.Bits.ComplexCacheIndexing == 0);
|
||||
CacheData[CacheParamLeafIndex].CacheShareBits = (UINT16)CacheParamEax.Bits.MaximumAddressableIdsForLogicalProcessors;
|
||||
CacheData[CacheParamLeafIndex].CacheSizeinKB = (CacheParamEbx.Bits.Ways + 1) *
|
||||
(CacheParamEbx.Bits.LinePartitions + 1) * (CacheParamEbx.Bits.LineSize + 1) * (CacheParamEcx + 1) / SIZE_1KB;
|
||||
(CacheParamEbx.Bits.LinePartitions + 1) * (CacheParamEbx.Bits.LineSize + 1) * (CacheParamEcx + 1) / SIZE_1KB;
|
||||
|
||||
CacheParamLeafIndex++;
|
||||
}
|
||||
@@ -264,25 +274,25 @@ CpuCacheInfoCollectCoreAndCacheData (
|
||||
**/
|
||||
EFI_STATUS
|
||||
CpuCacheInfoCollectCpuCacheInfoData (
|
||||
IN CPUID_CACHE_DATA *CacheData,
|
||||
IN CPUID_PROCESSOR_INFO *ProcessorInfo,
|
||||
IN UINTN NumberOfProcessors,
|
||||
IN OUT CPU_CACHE_INFO *CacheInfo,
|
||||
IN OUT UINTN *CacheInfoCount
|
||||
IN CPUID_CACHE_DATA *CacheData,
|
||||
IN CPUID_PROCESSOR_INFO *ProcessorInfo,
|
||||
IN UINTN NumberOfProcessors,
|
||||
IN OUT CPU_CACHE_INFO *CacheInfo,
|
||||
IN OUT UINTN *CacheInfoCount
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT32 NumberOfPackage;
|
||||
UINT32 Package[MAX_NUM_OF_PACKAGE];
|
||||
UINTN PackageIndex;
|
||||
UINTN TotalNumberOfCoreType;
|
||||
UINTN MaxCacheInfoCount;
|
||||
CPU_CACHE_INFO *LocalCacheInfo;
|
||||
UINTN CacheInfoIndex;
|
||||
UINTN LocalCacheInfoCount;
|
||||
UINTN Index;
|
||||
UINTN NextIndex;
|
||||
CPU_CACHE_INFO SortBuffer;
|
||||
EFI_STATUS Status;
|
||||
UINT32 NumberOfPackage;
|
||||
UINT32 Package[MAX_NUM_OF_PACKAGE];
|
||||
UINTN PackageIndex;
|
||||
UINTN TotalNumberOfCoreType;
|
||||
UINTN MaxCacheInfoCount;
|
||||
CPU_CACHE_INFO *LocalCacheInfo;
|
||||
UINTN CacheInfoIndex;
|
||||
UINTN LocalCacheInfoCount;
|
||||
UINTN Index;
|
||||
UINTN NextIndex;
|
||||
CPU_CACHE_INFO SortBuffer;
|
||||
|
||||
//
|
||||
// Get number of Packages and Package ID.
|
||||
@@ -299,7 +309,7 @@ CpuCacheInfoCollectCpuCacheInfoData (
|
||||
}
|
||||
|
||||
MaxCacheInfoCount = TotalNumberOfCoreType * MAX_NUM_OF_CACHE_PARAMS_LEAF;
|
||||
LocalCacheInfo = AllocatePages (EFI_SIZE_TO_PAGES (MaxCacheInfoCount * sizeof (*LocalCacheInfo)));
|
||||
LocalCacheInfo = AllocatePages (EFI_SIZE_TO_PAGES (MaxCacheInfoCount * sizeof (*LocalCacheInfo)));
|
||||
ASSERT (LocalCacheInfo != NULL);
|
||||
if (LocalCacheInfo == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
@@ -320,12 +330,13 @@ CpuCacheInfoCollectCpuCacheInfoData (
|
||||
continue;
|
||||
}
|
||||
|
||||
if (CacheData[Index].CacheLevel == CacheData[NextIndex].CacheLevel &&
|
||||
CacheData[Index].CacheType == CacheData[NextIndex].CacheType &&
|
||||
ProcessorInfo[Index / MAX_NUM_OF_CACHE_PARAMS_LEAF].Package == ProcessorInfo[NextIndex / MAX_NUM_OF_CACHE_PARAMS_LEAF].Package &&
|
||||
ProcessorInfo[Index / MAX_NUM_OF_CACHE_PARAMS_LEAF].CoreType == ProcessorInfo[NextIndex / MAX_NUM_OF_CACHE_PARAMS_LEAF].CoreType &&
|
||||
(ProcessorInfo[Index / MAX_NUM_OF_CACHE_PARAMS_LEAF].ApicId & ~CacheData[Index].CacheShareBits) ==
|
||||
(ProcessorInfo[NextIndex / MAX_NUM_OF_CACHE_PARAMS_LEAF].ApicId & ~CacheData[NextIndex].CacheShareBits)) {
|
||||
if ((CacheData[Index].CacheLevel == CacheData[NextIndex].CacheLevel) &&
|
||||
(CacheData[Index].CacheType == CacheData[NextIndex].CacheType) &&
|
||||
(ProcessorInfo[Index / MAX_NUM_OF_CACHE_PARAMS_LEAF].Package == ProcessorInfo[NextIndex / MAX_NUM_OF_CACHE_PARAMS_LEAF].Package) &&
|
||||
(ProcessorInfo[Index / MAX_NUM_OF_CACHE_PARAMS_LEAF].CoreType == ProcessorInfo[NextIndex / MAX_NUM_OF_CACHE_PARAMS_LEAF].CoreType) &&
|
||||
((ProcessorInfo[Index / MAX_NUM_OF_CACHE_PARAMS_LEAF].ApicId & ~CacheData[Index].CacheShareBits) ==
|
||||
(ProcessorInfo[NextIndex / MAX_NUM_OF_CACHE_PARAMS_LEAF].ApicId & ~CacheData[NextIndex].CacheShareBits)))
|
||||
{
|
||||
CacheData[NextIndex].CacheSizeinKB = 0; // uses the sharing cache
|
||||
}
|
||||
}
|
||||
@@ -334,10 +345,11 @@ CpuCacheInfoCollectCpuCacheInfoData (
|
||||
// For the cache that already exists in LocalCacheInfo, increase its CacheCount.
|
||||
//
|
||||
for (CacheInfoIndex = 0; CacheInfoIndex < LocalCacheInfoCount; CacheInfoIndex++) {
|
||||
if (LocalCacheInfo[CacheInfoIndex].Package == ProcessorInfo[Index / MAX_NUM_OF_CACHE_PARAMS_LEAF].Package &&
|
||||
LocalCacheInfo[CacheInfoIndex].CoreType == ProcessorInfo[Index / MAX_NUM_OF_CACHE_PARAMS_LEAF].CoreType &&
|
||||
LocalCacheInfo[CacheInfoIndex].CacheLevel == CacheData[Index].CacheLevel &&
|
||||
LocalCacheInfo[CacheInfoIndex].CacheType == CacheData[Index].CacheType) {
|
||||
if ((LocalCacheInfo[CacheInfoIndex].Package == ProcessorInfo[Index / MAX_NUM_OF_CACHE_PARAMS_LEAF].Package) &&
|
||||
(LocalCacheInfo[CacheInfoIndex].CoreType == ProcessorInfo[Index / MAX_NUM_OF_CACHE_PARAMS_LEAF].CoreType) &&
|
||||
(LocalCacheInfo[CacheInfoIndex].CacheLevel == CacheData[Index].CacheLevel) &&
|
||||
(LocalCacheInfo[CacheInfoIndex].CacheType == CacheData[Index].CacheType))
|
||||
{
|
||||
LocalCacheInfo[CacheInfoIndex].CacheCount++;
|
||||
break;
|
||||
}
|
||||
@@ -370,11 +382,11 @@ CpuCacheInfoCollectCpuCacheInfoData (
|
||||
//
|
||||
// Sort LocalCacheInfo array by CPU package ID, core type, cache level and cache type.
|
||||
//
|
||||
QuickSort (LocalCacheInfo, LocalCacheInfoCount, sizeof (*LocalCacheInfo), CpuCacheInfoCompare, (VOID*) &SortBuffer);
|
||||
QuickSort (LocalCacheInfo, LocalCacheInfoCount, sizeof (*LocalCacheInfo), CpuCacheInfoCompare, (VOID *)&SortBuffer);
|
||||
CopyMem (CacheInfo, LocalCacheInfo, sizeof (*CacheInfo) * LocalCacheInfoCount);
|
||||
DEBUG_CODE (
|
||||
CpuCacheInfoPrintCpuCacheInfoTable (CacheInfo, LocalCacheInfoCount);
|
||||
);
|
||||
);
|
||||
Status = EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -405,23 +417,23 @@ CpuCacheInfoCollectCpuCacheInfoData (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GetCpuCacheInfo (
|
||||
IN OUT CPU_CACHE_INFO *CpuCacheInfo,
|
||||
IN OUT UINTN *CpuCacheInfoCount
|
||||
IN OUT CPU_CACHE_INFO *CpuCacheInfo,
|
||||
IN OUT UINTN *CpuCacheInfoCount
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT32 CpuidMaxInput;
|
||||
UINT32 NumberOfProcessors;
|
||||
UINTN CacheDataCount;
|
||||
UINTN ProcessorIndex;
|
||||
EFI_PROCESSOR_INFORMATION ProcessorInfo;
|
||||
EFI_STATUS Status;
|
||||
UINT32 CpuidMaxInput;
|
||||
UINT32 NumberOfProcessors;
|
||||
UINTN CacheDataCount;
|
||||
UINTN ProcessorIndex;
|
||||
EFI_PROCESSOR_INFORMATION ProcessorInfo;
|
||||
COLLECT_CPUID_CACHE_DATA_CONTEXT Context;
|
||||
|
||||
if (CpuCacheInfoCount == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (*CpuCacheInfoCount != 0 && CpuCacheInfo == NULL) {
|
||||
if ((*CpuCacheInfoCount != 0) && (CpuCacheInfo == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -445,13 +457,14 @@ GetCpuCacheInfo (
|
||||
if (Context.ProcessorInfo == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
//
|
||||
// Initialize COLLECT_CPUID_CACHE_DATA_CONTEXT.CacheData.
|
||||
// CacheData array consists of CPUID_CACHE_DATA data structure for each Cpuid Cache Parameter Leaf
|
||||
// per logical processor. The array begin with data of each Cache Parameter Leaf of processor 0, followed
|
||||
// by data of each Cache Parameter Leaf of processor 1 ...
|
||||
//
|
||||
CacheDataCount = NumberOfProcessors * MAX_NUM_OF_CACHE_PARAMS_LEAF;
|
||||
CacheDataCount = NumberOfProcessors * MAX_NUM_OF_CACHE_PARAMS_LEAF;
|
||||
Context.CacheData = AllocatePages (EFI_SIZE_TO_PAGES (CacheDataCount * sizeof (*Context.CacheData)));
|
||||
ASSERT (Context.CacheData != NULL);
|
||||
if (Context.CacheData == NULL) {
|
||||
@@ -467,7 +480,7 @@ GetCpuCacheInfo (
|
||||
for (ProcessorIndex = 0; ProcessorIndex < NumberOfProcessors; ProcessorIndex++) {
|
||||
CpuCacheInfoGetProcessorInfo (Context.MpServices, ProcessorIndex, &ProcessorInfo);
|
||||
Context.ProcessorInfo[ProcessorIndex].Package = ProcessorInfo.Location.Package;
|
||||
Context.ProcessorInfo[ProcessorIndex].ApicId = (UINT32) ProcessorInfo.ProcessorId;
|
||||
Context.ProcessorInfo[ProcessorIndex].ApicId = (UINT32)ProcessorInfo.ProcessorId;
|
||||
}
|
||||
|
||||
//
|
||||
|
@@ -23,10 +23,10 @@
|
||||
**/
|
||||
EFI_STATUS
|
||||
CpuCacheInfoGetMpServices (
|
||||
OUT MP_SERVICES *MpServices
|
||||
OUT MP_SERVICES *MpServices
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = gBS->LocateProtocol (&gEfiMpServiceProtocolGuid, NULL, (VOID **)&MpServices->Protocol);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
@@ -43,12 +43,12 @@ CpuCacheInfoGetMpServices (
|
||||
**/
|
||||
VOID
|
||||
CpuCacheInfoStartupAllCPUs (
|
||||
IN MP_SERVICES MpServices,
|
||||
IN EFI_AP_PROCEDURE Procedure,
|
||||
IN VOID *ProcedureArgument
|
||||
IN MP_SERVICES MpServices,
|
||||
IN EFI_AP_PROCEDURE Procedure,
|
||||
IN VOID *ProcedureArgument
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = MpServices.Protocol->StartupAllAPs (MpServices.Protocol, Procedure, FALSE, NULL, 0, ProcedureArgument, NULL);
|
||||
if (Status == EFI_NOT_STARTED) {
|
||||
@@ -58,6 +58,7 @@ CpuCacheInfoStartupAllCPUs (
|
||||
//
|
||||
Status = EFI_SUCCESS;
|
||||
}
|
||||
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Procedure (ProcedureArgument);
|
||||
@@ -72,12 +73,12 @@ CpuCacheInfoStartupAllCPUs (
|
||||
**/
|
||||
VOID
|
||||
CpuCacheInfoGetProcessorInfo (
|
||||
IN MP_SERVICES MpServices,
|
||||
IN UINTN ProcessorNum,
|
||||
OUT EFI_PROCESSOR_INFORMATION *ProcessorInfo
|
||||
IN MP_SERVICES MpServices,
|
||||
IN UINTN ProcessorNum,
|
||||
OUT EFI_PROCESSOR_INFORMATION *ProcessorInfo
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = MpServices.Protocol->GetProcessorInfo (MpServices.Protocol, ProcessorNum, ProcessorInfo);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
@@ -92,11 +93,11 @@ CpuCacheInfoGetProcessorInfo (
|
||||
**/
|
||||
UINT32
|
||||
CpuCacheInfoWhoAmI (
|
||||
IN MP_SERVICES MpServices
|
||||
IN MP_SERVICES MpServices
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN ProcessorNum;
|
||||
EFI_STATUS Status;
|
||||
UINTN ProcessorNum;
|
||||
|
||||
Status = MpServices.Protocol->WhoAmI (MpServices.Protocol, &ProcessorNum);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
@@ -113,12 +114,12 @@ CpuCacheInfoWhoAmI (
|
||||
**/
|
||||
UINT32
|
||||
CpuCacheInfoGetNumberOfProcessors (
|
||||
IN MP_SERVICES MpServices
|
||||
IN MP_SERVICES MpServices
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN NumberOfProcessor;
|
||||
UINTN NumberOfEnabledProcessor;
|
||||
EFI_STATUS Status;
|
||||
UINTN NumberOfProcessor;
|
||||
UINTN NumberOfEnabledProcessor;
|
||||
|
||||
Status = MpServices.Protocol->GetNumberOfProcessors (MpServices.Protocol, &NumberOfProcessor, &NumberOfEnabledProcessor);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
@@ -25,24 +25,24 @@ typedef union {
|
||||
// Type of the cache that this package's this type of logical processor corresponds to.
|
||||
// Value = CPUID.04h:EAX[04:00]
|
||||
//
|
||||
UINT32 CacheType : 5;
|
||||
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;
|
||||
UINT32 CacheLevel : 3;
|
||||
//
|
||||
// Core type of logical processor.
|
||||
// Value = CPUID.1Ah:EAX[31:24]
|
||||
//
|
||||
UINT32 CoreType : 8;
|
||||
UINT32 Reserved : 16;
|
||||
UINT32 CoreType : 8;
|
||||
UINT32 Reserved : 16;
|
||||
//
|
||||
// Package number.
|
||||
//
|
||||
UINT32 Package;
|
||||
UINT32 Package;
|
||||
} Bits;
|
||||
UINT64 Uint64;
|
||||
UINT64 Uint64;
|
||||
} CPU_CACHE_INFO_COMPARATOR;
|
||||
|
||||
typedef struct {
|
||||
@@ -50,17 +50,17 @@ typedef struct {
|
||||
// Package ID, the information comes from
|
||||
// EFI_CPU_PHYSICAL_LOCATION.Package
|
||||
//
|
||||
UINT32 Package;
|
||||
UINT32 Package;
|
||||
//
|
||||
// APIC ID, the information comes from
|
||||
// EFI_PROCESSOR_INFORMATION.ProcessorId
|
||||
//
|
||||
UINT32 ApicId;
|
||||
UINT32 ApicId;
|
||||
//
|
||||
// Core type of logical processor.
|
||||
// Value = CPUID.1Ah:EAX[31:24]
|
||||
//
|
||||
UINT8 CoreType;
|
||||
UINT8 CoreType;
|
||||
} CPUID_PROCESSOR_INFO;
|
||||
|
||||
typedef struct {
|
||||
@@ -68,39 +68,39 @@ typedef struct {
|
||||
// Level of the cache.
|
||||
// Value = CPUID.04h:EAX[07:05]
|
||||
//
|
||||
UINT8 CacheLevel : 3;
|
||||
UINT8 CacheLevel : 3;
|
||||
//
|
||||
// Type of the cache.
|
||||
// Value = CPUID.04h:EAX[04:00]
|
||||
//
|
||||
UINT8 CacheType : 5;
|
||||
UINT8 CacheType : 5;
|
||||
//
|
||||
// Ways of associativity.
|
||||
// Value = CPUID.04h:EBX[31:22]
|
||||
//
|
||||
UINT16 CacheWays : 10;
|
||||
UINT16 CacheWays : 10;
|
||||
//
|
||||
// Fully associative cache.
|
||||
// Value = CPUID.04h:EAX[09]
|
||||
//
|
||||
UINT16 FullyAssociativeCache : 1;
|
||||
UINT16 FullyAssociativeCache : 1;
|
||||
//
|
||||
// Direct mapped cache.
|
||||
// Value = CPUID.04h:EDX[02]
|
||||
//
|
||||
UINT16 DirectMappedCache : 1;
|
||||
UINT16 Reserved : 4;
|
||||
UINT16 DirectMappedCache : 1;
|
||||
UINT16 Reserved : 4;
|
||||
//
|
||||
// Cache share bits.
|
||||
// Value = CPUID.04h:EAX[25:14]
|
||||
//
|
||||
UINT16 CacheShareBits;
|
||||
UINT16 CacheShareBits;
|
||||
//
|
||||
// Size of single cache.
|
||||
// Value = (CPUID.04h:EBX[31:22] + 1) * (CPUID.04h:EBX[21:12] + 1) *
|
||||
// (CPUID.04h:EBX[11:00] + 1) * (CPUID.04h:ECX[31:00] + 1)
|
||||
//
|
||||
UINT32 CacheSizeinKB;
|
||||
UINT32 CacheSizeinKB;
|
||||
} CPUID_CACHE_DATA;
|
||||
|
||||
typedef union {
|
||||
@@ -109,24 +109,23 @@ typedef union {
|
||||
} MP_SERVICES;
|
||||
|
||||
typedef struct {
|
||||
MP_SERVICES MpServices;
|
||||
CPUID_PROCESSOR_INFO *ProcessorInfo;
|
||||
CPUID_CACHE_DATA *CacheData;
|
||||
MP_SERVICES MpServices;
|
||||
CPUID_PROCESSOR_INFO *ProcessorInfo;
|
||||
CPUID_CACHE_DATA *CacheData;
|
||||
} COLLECT_CPUID_CACHE_DATA_CONTEXT;
|
||||
|
||||
|
||||
/*
|
||||
Defines the maximum count of Deterministic Cache Parameters Leaf of all APs and BSP.
|
||||
To save boot time, skip starting up all APs to calculate each AP's count of Deterministic
|
||||
Cache Parameters Leaf, so use a definition instead.
|
||||
Anyway, definition value will be checked in CpuCacheInfoCollectCoreAndCacheData function.
|
||||
*/
|
||||
#define MAX_NUM_OF_CACHE_PARAMS_LEAF 6
|
||||
#define MAX_NUM_OF_CACHE_PARAMS_LEAF 6
|
||||
|
||||
/*
|
||||
Defines the maximum count of packages.
|
||||
*/
|
||||
#define MAX_NUM_OF_PACKAGE 100
|
||||
#define MAX_NUM_OF_PACKAGE 100
|
||||
|
||||
/**
|
||||
Get EDKII_PEI_MP_SERVICES2_PPI or EFI_MP_SERVICES_PROTOCOL pointer.
|
||||
@@ -139,7 +138,7 @@ typedef struct {
|
||||
**/
|
||||
EFI_STATUS
|
||||
CpuCacheInfoGetMpServices (
|
||||
OUT MP_SERVICES *MpServices
|
||||
OUT MP_SERVICES *MpServices
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -151,9 +150,9 @@ CpuCacheInfoGetMpServices (
|
||||
**/
|
||||
VOID
|
||||
CpuCacheInfoStartupAllCPUs (
|
||||
IN MP_SERVICES MpServices,
|
||||
IN EFI_AP_PROCEDURE Procedure,
|
||||
IN VOID *ProcedureArgument
|
||||
IN MP_SERVICES MpServices,
|
||||
IN EFI_AP_PROCEDURE Procedure,
|
||||
IN VOID *ProcedureArgument
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -165,9 +164,9 @@ CpuCacheInfoStartupAllCPUs (
|
||||
**/
|
||||
VOID
|
||||
CpuCacheInfoGetProcessorInfo (
|
||||
IN MP_SERVICES MpServices,
|
||||
IN UINTN ProcessorNum,
|
||||
OUT EFI_PROCESSOR_INFORMATION *ProcessorInfo
|
||||
IN MP_SERVICES MpServices,
|
||||
IN UINTN ProcessorNum,
|
||||
OUT EFI_PROCESSOR_INFORMATION *ProcessorInfo
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -179,7 +178,7 @@ CpuCacheInfoGetProcessorInfo (
|
||||
**/
|
||||
UINT32
|
||||
CpuCacheInfoWhoAmI (
|
||||
IN MP_SERVICES MpServices
|
||||
IN MP_SERVICES MpServices
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -191,6 +190,7 @@ CpuCacheInfoWhoAmI (
|
||||
**/
|
||||
UINT32
|
||||
CpuCacheInfoGetNumberOfProcessors (
|
||||
IN MP_SERVICES MpServices
|
||||
IN MP_SERVICES MpServices
|
||||
);
|
||||
|
||||
#endif
|
||||
|
@@ -24,10 +24,10 @@
|
||||
**/
|
||||
EFI_STATUS
|
||||
CpuCacheInfoGetMpServices (
|
||||
OUT MP_SERVICES *MpServices
|
||||
OUT MP_SERVICES *MpServices
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = PeiServicesLocatePpi (&gEdkiiPeiMpServices2PpiGuid, 0, NULL, (VOID **)&MpServices->Ppi);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
@@ -44,12 +44,12 @@ CpuCacheInfoGetMpServices (
|
||||
**/
|
||||
VOID
|
||||
CpuCacheInfoStartupAllCPUs (
|
||||
IN MP_SERVICES MpServices,
|
||||
IN EFI_AP_PROCEDURE Procedure,
|
||||
IN VOID *ProcedureArgument
|
||||
IN MP_SERVICES MpServices,
|
||||
IN EFI_AP_PROCEDURE Procedure,
|
||||
IN VOID *ProcedureArgument
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = MpServices.Ppi->StartupAllCPUs (MpServices.Ppi, Procedure, 0, ProcedureArgument);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
@@ -64,12 +64,12 @@ CpuCacheInfoStartupAllCPUs (
|
||||
**/
|
||||
VOID
|
||||
CpuCacheInfoGetProcessorInfo (
|
||||
IN MP_SERVICES MpServices,
|
||||
IN UINTN ProcessorNum,
|
||||
OUT EFI_PROCESSOR_INFORMATION *ProcessorInfo
|
||||
IN MP_SERVICES MpServices,
|
||||
IN UINTN ProcessorNum,
|
||||
OUT EFI_PROCESSOR_INFORMATION *ProcessorInfo
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = MpServices.Ppi->GetProcessorInfo (MpServices.Ppi, ProcessorNum, ProcessorInfo);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
@@ -84,11 +84,11 @@ CpuCacheInfoGetProcessorInfo (
|
||||
**/
|
||||
UINT32
|
||||
CpuCacheInfoWhoAmI (
|
||||
IN MP_SERVICES MpServices
|
||||
IN MP_SERVICES MpServices
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN ProcessorNum;
|
||||
EFI_STATUS Status;
|
||||
UINTN ProcessorNum;
|
||||
|
||||
Status = MpServices.Ppi->WhoAmI (MpServices.Ppi, &ProcessorNum);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
@@ -105,12 +105,12 @@ CpuCacheInfoWhoAmI (
|
||||
**/
|
||||
UINT32
|
||||
CpuCacheInfoGetNumberOfProcessors (
|
||||
IN MP_SERVICES MpServices
|
||||
IN MP_SERVICES MpServices
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN NumberOfProcessor;
|
||||
UINTN NumberOfEnabledProcessor;
|
||||
EFI_STATUS Status;
|
||||
UINTN NumberOfProcessor;
|
||||
UINTN NumberOfEnabledProcessor;
|
||||
|
||||
Status = MpServices.Ppi->GetNumberOfProcessors (MpServices.Ppi, &NumberOfProcessor, &NumberOfEnabledProcessor);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
Reference in New Issue
Block a user