3 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
4 Copyright (c) 2011 - 2021, ARM Limited. All rights reserved.
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #include <Library/ArmLib.h>
11 #include <Library/DebugLib.h>
12 #include <Library/PcdLib.h>
19 IN LINE_OPERATION LineOperation
,
23 UINTN ArmCacheLineAlignmentMask
;
24 // Align address (rounding down)
28 ArmCacheLineAlignmentMask
= LineLength
- 1;
29 AlignedAddress
= (UINTN
)Start
- ((UINTN
)Start
& ArmCacheLineAlignmentMask
);
30 EndAddress
= (UINTN
)Start
+ Length
;
32 // Perform the line operation on an address in each cache line
33 while (AlignedAddress
< EndAddress
) {
34 LineOperation (AlignedAddress
);
35 AlignedAddress
+= LineLength
;
38 ArmDataSynchronizationBarrier ();
43 InvalidateInstructionCache (
61 InvalidateInstructionCacheRange (
69 ArmCleanDataCacheEntryToPoUByMVA
,
70 ArmDataCacheLineLength ()
75 ArmInvalidateInstructionCacheEntryToPoUByMVA
,
76 ArmInstructionCacheLineLength ()
79 ArmInstructionSynchronizationBarrier ();
86 WriteBackInvalidateDataCache (
95 WriteBackInvalidateDataCacheRange (
100 CacheRangeOperation (
103 ArmCleanInvalidateDataCacheEntryByMVA
,
104 ArmDataCacheLineLength ()
120 WriteBackDataCacheRange (
125 CacheRangeOperation (
128 ArmCleanDataCacheEntryByMVA
,
129 ArmDataCacheLineLength ()
136 InvalidateDataCacheRange (
141 CacheRangeOperation (
144 ArmInvalidateDataCacheEntryByMVA
,
145 ArmDataCacheLineLength ()