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 <Chipset/ArmV7.h>
17 #include <Library/ArmLib.h>
18 #include <Library/BaseLib.h>
19 #include <Library/IoLib.h>
21 #include "ArmLibPrivate.h"
25 ArmDataCacheLineLength (
29 UINT32 CCSIDR
= ReadCCSIDR (0) & 7;
31 // * 4 converts to bytes
32 return (1 << (CCSIDR
+ 2)) * 4;
37 ArmInstructionCacheLineLength (
41 UINT32 CCSIDR
= ReadCCSIDR (1) & 7;
43 // * 4 converts to bytes
44 return (1 << (CCSIDR
+ 2)) * 4;
51 ArmV7DataCacheOperation (
52 IN ARM_V7_CACHE_OPERATION DataCacheOperation
55 UINTN SavedInterruptState
;
57 SavedInterruptState
= ArmGetInterruptState ();
58 ArmDisableInterrupts ();
60 ArmV7AllDataCachesOperation (DataCacheOperation
);
62 ArmDrainWriteBuffer ();
64 if (SavedInterruptState
) {
65 ArmEnableInterrupts ();
71 ArmInvalidateDataCache (
75 ArmDrainWriteBuffer ();
76 ArmV7DataCacheOperation (ArmInvalidateDataCacheEntryBySetWay
);
81 ArmCleanInvalidateDataCache (
85 ArmDrainWriteBuffer ();
86 ArmV7DataCacheOperation (ArmCleanInvalidateDataCacheEntryBySetWay
);
95 ArmDrainWriteBuffer ();
96 ArmV7DataCacheOperation (ArmCleanDataCacheEntryBySetWay
);