TianoCore EDK2 master
Loading...
Searching...
No Matches
ArmCacheMaintenanceLib.c
Go to the documentation of this file.
1
9#include <Base.h>
10#include <Library/ArmLib.h>
11#include <Library/DebugLib.h>
12#include <Library/PcdLib.h>
13
15VOID
16CacheRangeOperation (
17 IN VOID *Start,
18 IN UINTN Length,
19 IN LINE_OPERATION LineOperation,
20 IN UINTN LineLength
21 )
22{
23 UINTN ArmCacheLineAlignmentMask;
24 // Align address (rounding down)
25 UINTN AlignedAddress;
26 UINTN EndAddress;
27
28 ArmCacheLineAlignmentMask = LineLength - 1;
29 AlignedAddress = (UINTN)Start - ((UINTN)Start & ArmCacheLineAlignmentMask);
30 EndAddress = (UINTN)Start + Length;
31
32 // Perform the line operation on an address in each cache line
33 while (AlignedAddress < EndAddress) {
34 LineOperation (AlignedAddress);
35 AlignedAddress += LineLength;
36 }
37
38 ArmDataSynchronizationBarrier ();
39}
40
41VOID
42EFIAPI
44 VOID
45 )
46{
47 ASSERT (FALSE);
48}
49
50VOID
51EFIAPI
53 VOID
54 )
55{
56 ASSERT (FALSE);
57}
58
59VOID *
60EFIAPI
62 IN VOID *Address,
63 IN UINTN Length
64 )
65{
66 CacheRangeOperation (
67 Address,
68 Length,
69 ArmCleanDataCacheEntryToPoUByMVA,
70 ArmDataCacheLineLength ()
71 );
72 CacheRangeOperation (
73 Address,
74 Length,
75 ArmInvalidateInstructionCacheEntryToPoUByMVA,
76 ArmInstructionCacheLineLength ()
77 );
78
79 ArmInstructionSynchronizationBarrier ();
80
81 return Address;
82}
83
84VOID
85EFIAPI
87 VOID
88 )
89{
90 ASSERT (FALSE);
91}
92
93VOID *
94EFIAPI
96 IN VOID *Address,
97 IN UINTN Length
98 )
99{
100 CacheRangeOperation (
101 Address,
102 Length,
103 ArmCleanInvalidateDataCacheEntryByMVA,
104 ArmDataCacheLineLength ()
105 );
106 return Address;
107}
108
109VOID
110EFIAPI
112 VOID
113 )
114{
115 ASSERT (FALSE);
116}
117
118VOID *
119EFIAPI
121 IN VOID *Address,
122 IN UINTN Length
123 )
124{
125 CacheRangeOperation (
126 Address,
127 Length,
128 ArmCleanDataCacheEntryByMVA,
129 ArmDataCacheLineLength ()
130 );
131 return Address;
132}
133
134VOID *
135EFIAPI
137 IN VOID *Address,
138 IN UINTN Length
139 )
140{
141 CacheRangeOperation (
142 Address,
143 Length,
144 ArmInvalidateDataCacheEntryByMVA,
145 ArmDataCacheLineLength ()
146 );
147 return Address;
148}
UINT64 UINTN
VOID EFIAPI InvalidateDataCache(VOID)
VOID *EFIAPI WriteBackDataCacheRange(IN VOID *Address, IN UINTN Length)
VOID *EFIAPI InvalidateDataCacheRange(IN VOID *Address, IN UINTN Length)
VOID *EFIAPI WriteBackInvalidateDataCacheRange(IN VOID *Address, IN UINTN Length)
VOID EFIAPI InvalidateInstructionCache(VOID)
VOID EFIAPI WriteBackInvalidateDataCache(VOID)
VOID EFIAPI WriteBackDataCache(VOID)
VOID *EFIAPI InvalidateInstructionCacheRange(IN VOID *Address, IN UINTN Length)
#define STATIC
Definition: Base.h:264
#define FALSE
Definition: Base.h:307
#define IN
Definition: Base.h:279