TianoCore EDK2 master
Loading...
Searching...
No Matches
ArmLib.c
Go to the documentation of this file.
1
10#include <Base.h>
11
12#include <Library/ArmLib.h>
13
14#include "ArmLibPrivate.h"
15
16VOID
17EFIAPI
18ArmSetAuxCrBit (
19 IN UINT32 Bits
20 )
21{
22 ArmWriteAuxCr (ArmReadAuxCr () | Bits);
23}
24
25VOID
26EFIAPI
27ArmUnsetAuxCrBit (
28 IN UINT32 Bits
29 )
30{
31 ArmWriteAuxCr (ArmReadAuxCr () & ~Bits);
32}
33
34//
35// Helper functions for accessing CPUACTLR
36//
37
38VOID
39EFIAPI
40ArmSetCpuActlrBit (
41 IN UINTN Bits
42 )
43{
44 ArmWriteCpuActlr (ArmReadCpuActlr () | Bits);
45}
46
47VOID
48EFIAPI
49ArmUnsetCpuActlrBit (
50 IN UINTN Bits
51 )
52{
53 ArmWriteCpuActlr (ArmReadCpuActlr () & ~Bits);
54}
55
57EFIAPI
58ArmDataCacheLineLength (
59 VOID
60 )
61{
62 return 4 << ((ArmCacheInfo () >> 16) & 0xf); // CTR_EL0.DminLine
63}
64
66EFIAPI
67ArmInstructionCacheLineLength (
68 VOID
69 )
70{
71 return 4 << (ArmCacheInfo () & 0xf); // CTR_EL0.IminLine
72}
73
75EFIAPI
76ArmCacheWritebackGranule (
77 VOID
78 )
79{
80 UINTN CWG;
81
82 CWG = (ArmCacheInfo () >> 24) & 0xf; // CTR_EL0.CWG
83
84 if (CWG == 0) {
85 return SIZE_2KB;
86 }
87
88 return 4 << CWG;
89}
UINT64 UINTN
#define IN
Definition: Base.h:279