]>
git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Universal/Smbios/ProcessorSubClassDxe/SmbiosProcessorAArch64.c
2 Functions for AARCH64 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
33 BOOLEAN CcidxSupported
;
37 Csselr
.Bits
.Level
= CacheLevel
- 1;
38 Csselr
.Bits
.InD
= (!DataCache
&& !UnifiedCache
);
40 Ccsidr
.Data
= ReadCCSIDR (Csselr
.Data
);
42 CcidxSupported
= ArmHasCcidx ();
45 CacheSize
= (1 << (Ccsidr
.BitsCcidxAA64
.LineSize
+ 4)) *
46 (Ccsidr
.BitsCcidxAA64
.Associativity
+ 1) *
47 (Ccsidr
.BitsCcidxAA64
.NumSets
+ 1);
49 CacheSize
= (1 << (Ccsidr
.BitsNonCcidx
.LineSize
+ 4)) *
50 (Ccsidr
.BitsNonCcidx
.Associativity
+ 1) *
51 (Ccsidr
.BitsNonCcidx
.NumSets
+ 1);
57 /** Gets the associativity of the specified cache.
59 @param CacheLevel The cache level (L1, L2 etc.).
60 @param DataCache Whether the cache is a dedicated data cache.
61 @param UnifiedCache Whether the cache is a unified cache.
63 @return The cache associativity.
66 SmbiosProcessorGetCacheAssociativity (
69 IN BOOLEAN UnifiedCache
74 BOOLEAN CcidxSupported
;
78 Csselr
.Bits
.Level
= CacheLevel
- 1;
79 Csselr
.Bits
.InD
= (!DataCache
&& !UnifiedCache
);
81 Ccsidr
.Data
= ReadCCSIDR (Csselr
.Data
);
83 CcidxSupported
= ArmHasCcidx ();
86 Associativity
= Ccsidr
.BitsCcidxAA64
.Associativity
+ 1;
88 Associativity
= Ccsidr
.BitsNonCcidx
.Associativity
+ 1;