3 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
4 Copyright (c) 2011 - 2014, ARM Limited. All rights reserved.
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include <Library/ArmLib.h>
17 #include <Library/DebugLib.h>
18 #include <Library/PcdLib.h>
24 IN LINE_OPERATION LineOperation
27 UINTN ArmCacheLineLength
= ArmDataCacheLineLength();
28 UINTN ArmCacheLineAlignmentMask
= ArmCacheLineLength
- 1;
30 // Align address (rounding down)
31 UINTN AlignedAddress
= (UINTN
)Start
- ((UINTN
)Start
& ArmCacheLineAlignmentMask
);
32 UINTN EndAddress
= (UINTN
)Start
+ Length
;
34 // Perform the line operation on an address in each cache line
35 while (AlignedAddress
< EndAddress
) {
36 LineOperation(AlignedAddress
);
37 AlignedAddress
+= ArmCacheLineLength
;
39 ArmDataSynchronizationBarrier ();
44 InvalidateInstructionCache (
62 InvalidateInstructionCacheRange (
67 CacheRangeOperation (Address
, Length
, ArmCleanDataCacheEntryToPoUByMVA
);
68 ArmInvalidateInstructionCache ();
74 WriteBackInvalidateDataCache (
83 WriteBackInvalidateDataCacheRange (
88 CacheRangeOperation(Address
, Length
, ArmCleanInvalidateDataCacheEntryByMVA
);
103 WriteBackDataCacheRange (
108 CacheRangeOperation(Address
, Length
, ArmCleanDataCacheEntryByMVA
);
114 InvalidateDataCacheRange (
119 CacheRangeOperation(Address
, Length
, ArmInvalidateDataCacheEntryByMVA
);