]>
git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Universal/Smbios/ProcessorSubClassDxe/SmbiosProcessorArm.c
2 Functions for ARM processor information
4 Copyright (c) 2021, NUVIA Inc. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
11 #include <IndustryStandard/ArmCache.h>
12 #include <Library/ArmLib.h>
14 #include "SmbiosProcessor.h"
16 /** Gets the size of the specified cache.
18 @param CacheLevel The cache level (L1, L2 etc.).
19 @param DataCache Whether the cache is a dedicated data cache.
20 @param UnifiedCache Whether the cache is a unified cache.
22 @return The cache size.
25 SmbiosProcessorGetCacheSize (
28 IN BOOLEAN UnifiedCache
34 BOOLEAN CcidxSupported
;
37 // Read the CCSIDR register to get the cache architecture
39 Csselr
.Bits
.Level
= CacheLevel
- 1;
40 Csselr
.Bits
.InD
= (!DataCache
&& !UnifiedCache
);
42 Ccsidr
.Data
= ReadCCSIDR (Csselr
.Data
);
44 CcidxSupported
= ArmHasCcidx ();
47 Ccsidr2
.Data
= ReadCCSIDR2 (Csselr
.Data
);
48 CacheSize
= (1 << (Ccsidr
.BitsCcidxAA32
.LineSize
+ 4)) *
49 (Ccsidr
.BitsCcidxAA32
.Associativity
+ 1) *
50 (Ccsidr2
.Bits
.NumSets
+ 1);
52 CacheSize
= (1 << (Ccsidr
.BitsNonCcidx
.LineSize
+ 4)) *
53 (Ccsidr
.BitsNonCcidx
.Associativity
+ 1) *
54 (Ccsidr
.BitsNonCcidx
.NumSets
+ 1);
60 /** Gets the associativity of the specified cache.
62 @param CacheLevel The cache level (L1, L2 etc.).
63 @param DataCache Whether the cache is a dedicated data cache.
64 @param UnifiedCache Whether the cache is a unified cache.
66 @return The cache associativity.
69 SmbiosProcessorGetCacheAssociativity (
72 IN BOOLEAN UnifiedCache
77 BOOLEAN CcidxSupported
;
80 // Read the CCSIDR register to get the cache architecture
82 Csselr
.Bits
.Level
= CacheLevel
- 1;
83 Csselr
.Bits
.InD
= (!DataCache
&& !UnifiedCache
);
85 Ccsidr
.Data
= ReadCCSIDR (Csselr
.Data
);
87 CcidxSupported
= ArmHasCcidx ();
90 Associativity
= Ccsidr
.BitsCcidxAA32
.Associativity
+ 1;
92 Associativity
= Ccsidr
.BitsNonCcidx
.Associativity
+ 1;