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/PcdLib.h>
23 IN LINE_OPERATION LineOperation
26 UINTN ArmCacheLineLength
= ArmDataCacheLineLength();
27 UINTN ArmCacheLineAlignmentMask
= ArmCacheLineLength
- 1;
29 // Align address (rounding down)
30 UINTN AlignedAddress
= (UINTN
)Start
- ((UINTN
)Start
& ArmCacheLineAlignmentMask
);
31 UINTN EndAddress
= (UINTN
)Start
+ Length
;
33 // Perform the line operation on an address in each cache line
34 while (AlignedAddress
< EndAddress
) {
35 LineOperation(AlignedAddress
);
36 AlignedAddress
+= ArmCacheLineLength
;
42 InvalidateInstructionCache (
47 ArmInvalidateInstructionCache();
56 ArmInvalidateDataCache();
61 InvalidateInstructionCacheRange (
66 CacheRangeOperation (Address
, Length
, ArmCleanDataCacheEntryByMVA
);
67 ArmInvalidateInstructionCache ();
73 WriteBackInvalidateDataCache (
77 ArmCleanInvalidateDataCache();
82 WriteBackInvalidateDataCacheRange (
87 CacheRangeOperation(Address
, Length
, ArmCleanInvalidateDataCacheEntryByMVA
);
102 WriteBackDataCacheRange (
107 CacheRangeOperation(Address
, Length
, ArmCleanDataCacheEntryByMVA
);
113 InvalidateDataCacheRange (
118 CacheRangeOperation(Address
, Length
, ArmInvalidateDataCacheEntryByMVA
);