1
1
/** @file
2
2
Provides cache info for each package, core type, cache level and cache type.
3
3
4
- Copyright (c) 2020 Intel Corporation. All rights reserved.<BR>
4
+ Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.<BR>
5
5
SPDX-License-Identifier: BSD-2-Clause-Patent
6
6
7
7
**/
@@ -23,18 +23,18 @@ CpuCacheInfoPrintCpuCacheInfoTable (
23
23
{
24
24
UINTN Index ;
25
25
26
- DEBUG ((DEBUG_INFO , "+-------+-------------------------------------------------------------------------------+\n" ));
27
- DEBUG ((DEBUG_INFO , "| Index | Packge CoreType CacheLevel CacheType CacheWays CacheSizeinKB CacheCount |\n" ));
28
- DEBUG ((DEBUG_INFO , "+-------+-------------------------------------------------------------------------------+\n" ));
26
+ DEBUG ((DEBUG_INFO , "+-------+-------------------------------------------------------------------------------------- +\n" ));
27
+ DEBUG ((DEBUG_INFO , "| Index | Packge CoreType CacheLevel CacheType CacheWays (FA|DM) CacheSizeinKB CacheCount |\n" ));
28
+ DEBUG ((DEBUG_INFO , "+-------+-------------------------------------------------------------------------------------- +\n" ));
29
29
30
30
for (Index = 0 ; Index < CpuCacheInfoCount ; Index ++ ) {
31
- DEBUG ((DEBUG_INFO , "| %4x | %4x %2x %2x %2x %4x % 8x %4x |\n" , Index ,
32
- CpuCacheInfo [Index ].Package , CpuCacheInfo [Index ].CoreType , CpuCacheInfo [Index ].CacheLevel ,
33
- CpuCacheInfo [Index ].CacheType , CpuCacheInfo [Index ].CacheWays , CpuCacheInfo [Index ].CacheSizeinKB ,
34
- CpuCacheInfo [Index ].CacheCount ));
31
+ DEBUG ((DEBUG_INFO , "| %4x | %4x %2x %2x %2x %4x ( %x| %x) % 8x %4x |\n" ,
32
+ Index , CpuCacheInfo [Index ].Package , CpuCacheInfo [Index ].CoreType , CpuCacheInfo [Index ].CacheLevel ,
33
+ CpuCacheInfo [Index ].CacheType , CpuCacheInfo [Index ].CacheWays , CpuCacheInfo [Index ].FullyAssociativeCache ,
34
+ CpuCacheInfo [Index ].DirectMappedCache , CpuCacheInfo [ Index ]. CacheSizeinKB , CpuCacheInfo [ Index ]. CacheCount ));
35
35
}
36
36
37
- DEBUG ((DEBUG_INFO , "+-------+-------------------------------------------------------------------------------+\n" ));
37
+ DEBUG ((DEBUG_INFO , "+-------+-------------------------------------------------------------------------------------- +\n" ));
38
38
}
39
39
40
40
/**
@@ -160,6 +160,7 @@ CpuCacheInfoCollectCoreAndCacheData (
160
160
CPUID_CACHE_PARAMS_EAX CacheParamEax ;
161
161
CPUID_CACHE_PARAMS_EBX CacheParamEbx ;
162
162
UINT32 CacheParamEcx ;
163
+ CPUID_CACHE_PARAMS_EDX CacheParamEdx ;
163
164
CPUID_NATIVE_MODEL_ID_AND_CORE_TYPE_EAX NativeModelIdAndCoreTypeEax ;
164
165
COLLECT_CPUID_CACHE_DATA_CONTEXT * Context ;
165
166
CPUID_CACHE_DATA * CacheData ;
@@ -185,17 +186,19 @@ CpuCacheInfoCollectCoreAndCacheData (
185
186
CacheParamLeafIndex = 0 ;
186
187
187
188
while (CacheParamLeafIndex < MAX_NUM_OF_CACHE_PARAMS_LEAF ) {
188
- AsmCpuidEx (CPUID_CACHE_PARAMS , CacheParamLeafIndex , & CacheParamEax .Uint32 , & CacheParamEbx .Uint32 , & CacheParamEcx , NULL );
189
+ AsmCpuidEx (CPUID_CACHE_PARAMS , CacheParamLeafIndex , & CacheParamEax .Uint32 , & CacheParamEbx .Uint32 , & CacheParamEcx , & CacheParamEdx . Uint32 );
189
190
190
191
if (CacheParamEax .Bits .CacheType == 0 ) {
191
192
break ;
192
193
}
193
194
194
- CacheData [CacheParamLeafIndex ].CacheLevel = (UINT8 )CacheParamEax .Bits .CacheLevel ;
195
- CacheData [CacheParamLeafIndex ].CacheType = (UINT8 )CacheParamEax .Bits .CacheType ;
196
- CacheData [CacheParamLeafIndex ].CacheWays = (UINT16 )CacheParamEbx .Bits .Ways ;
197
- CacheData [CacheParamLeafIndex ].CacheShareBits = (UINT16 )CacheParamEax .Bits .MaximumAddressableIdsForLogicalProcessors ;
198
- CacheData [CacheParamLeafIndex ].CacheSizeinKB = (CacheParamEbx .Bits .Ways + 1 ) *
195
+ CacheData [CacheParamLeafIndex ].CacheLevel = (UINT8 )CacheParamEax .Bits .CacheLevel ;
196
+ CacheData [CacheParamLeafIndex ].CacheType = (UINT8 )CacheParamEax .Bits .CacheType ;
197
+ CacheData [CacheParamLeafIndex ].CacheWays = (UINT16 )CacheParamEbx .Bits .Ways ;
198
+ CacheData [CacheParamLeafIndex ].FullyAssociativeCache = (UINT8 )CacheParamEax .Bits .FullyAssociativeCache ;
199
+ CacheData [CacheParamLeafIndex ].DirectMappedCache = (UINT8 )CacheParamEdx .Bits .ComplexCacheIndexing ;
200
+ CacheData [CacheParamLeafIndex ].CacheShareBits = (UINT16 )CacheParamEax .Bits .MaximumAddressableIdsForLogicalProcessors ;
201
+ CacheData [CacheParamLeafIndex ].CacheSizeinKB = (CacheParamEbx .Bits .Ways + 1 ) *
199
202
(CacheParamEbx .Bits .LinePartitions + 1 ) * (CacheParamEbx .Bits .LineSize + 1 ) * (CacheParamEcx + 1 ) / SIZE_1KB ;
200
203
201
204
CacheParamLeafIndex ++ ;
@@ -305,13 +308,15 @@ CpuCacheInfoCollectCpuCacheInfoData (
305
308
if (CacheInfoIndex == LocalCacheInfoCount ) {
306
309
ASSERT (LocalCacheInfoCount < MaxCacheInfoCount );
307
310
308
- LocalCacheInfo [LocalCacheInfoCount ].Package = ProcessorInfo [Index / MAX_NUM_OF_CACHE_PARAMS_LEAF ].Package ;
309
- LocalCacheInfo [LocalCacheInfoCount ].CoreType = ProcessorInfo [Index / MAX_NUM_OF_CACHE_PARAMS_LEAF ].CoreType ;
310
- LocalCacheInfo [LocalCacheInfoCount ].CacheLevel = CacheData [Index ].CacheLevel ;
311
- LocalCacheInfo [LocalCacheInfoCount ].CacheType = CacheData [Index ].CacheType ;
312
- LocalCacheInfo [LocalCacheInfoCount ].CacheWays = CacheData [Index ].CacheWays ;
313
- LocalCacheInfo [LocalCacheInfoCount ].CacheSizeinKB = CacheData [Index ].CacheSizeinKB ;
314
- LocalCacheInfo [LocalCacheInfoCount ].CacheCount = 1 ;
311
+ LocalCacheInfo [LocalCacheInfoCount ].Package = ProcessorInfo [Index / MAX_NUM_OF_CACHE_PARAMS_LEAF ].Package ;
312
+ LocalCacheInfo [LocalCacheInfoCount ].CoreType = ProcessorInfo [Index / MAX_NUM_OF_CACHE_PARAMS_LEAF ].CoreType ;
313
+ LocalCacheInfo [LocalCacheInfoCount ].CacheLevel = CacheData [Index ].CacheLevel ;
314
+ LocalCacheInfo [LocalCacheInfoCount ].CacheType = CacheData [Index ].CacheType ;
315
+ LocalCacheInfo [LocalCacheInfoCount ].CacheWays = CacheData [Index ].CacheWays ;
316
+ LocalCacheInfo [LocalCacheInfoCount ].FullyAssociativeCache = CacheData [Index ].FullyAssociativeCache ;
317
+ LocalCacheInfo [LocalCacheInfoCount ].DirectMappedCache = CacheData [Index ].DirectMappedCache ;
318
+ LocalCacheInfo [LocalCacheInfoCount ].CacheSizeinKB = CacheData [Index ].CacheSizeinKB ;
319
+ LocalCacheInfo [LocalCacheInfoCount ].CacheCount = 1 ;
315
320
316
321
LocalCacheInfoCount ++ ;
317
322
}
0 commit comments