3 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
4 Portions copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>
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.
17 #include <Chipset/AArch64.h>
18 #include <Library/ArmLib.h>
19 #include <Library/BaseLib.h>
20 #include <Library/IoLib.h>
21 #include "AArch64Lib.h"
22 #include "ArmLibPrivate.h"
26 ArmDataCacheLineLength (
30 UINT32 CCSIDR
= ReadCCSIDR (0) & 7;
32 // * 4 converts to bytes
33 return (1 << (CCSIDR
+ 2)) * 4;
38 ArmInstructionCacheLineLength (
42 UINT32 CCSIDR
= ReadCCSIDR (1) & 7;
44 // * 4 converts to bytes
45 return (1 << (CCSIDR
+ 2)) * 4;
50 AArch64DataCacheOperation (
51 IN AARCH64_CACHE_OPERATION DataCacheOperation
54 UINTN SavedInterruptState
;
56 SavedInterruptState
= ArmGetInterruptState ();
57 ArmDisableInterrupts();
59 AArch64AllDataCachesOperation (DataCacheOperation
);
61 ArmDrainWriteBuffer ();
63 if (SavedInterruptState
) {
64 ArmEnableInterrupts ();
70 ArmInvalidateDataCache (
74 ArmDrainWriteBuffer ();
75 AArch64DataCacheOperation (ArmInvalidateDataCacheEntryBySetWay
);
80 ArmCleanInvalidateDataCache (
84 ArmDrainWriteBuffer ();
85 AArch64DataCacheOperation (ArmCleanInvalidateDataCacheEntryBySetWay
);
94 ArmDrainWriteBuffer ();
95 AArch64DataCacheOperation (ArmCleanDataCacheEntryBySetWay
);