1 /** @file 2 3 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR> 4 Copyright (c) 2011 - 2014, ARM Limited. All rights reserved. 5 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 10 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. 13 14 **/ 15 #include <Uefi.h> 16 #include <Chipset/ArmV7.h> 17 #include <Library/ArmLib.h> 18 #include <Library/BaseLib.h> 19 #include <Library/IoLib.h> 20 #include "ArmV7Lib.h" 21 #include "ArmLibPrivate.h" 22 23 VOID ArmV7DataCacheOperation(IN ARM_V7_CACHE_OPERATION DataCacheOperation)24ArmV7DataCacheOperation ( 25 IN ARM_V7_CACHE_OPERATION DataCacheOperation 26 ) 27 { 28 UINTN SavedInterruptState; 29 30 SavedInterruptState = ArmGetInterruptState (); 31 ArmDisableInterrupts (); 32 33 ArmV7AllDataCachesOperation (DataCacheOperation); 34 35 ArmDataSynchronizationBarrier (); 36 37 if (SavedInterruptState) { 38 ArmEnableInterrupts (); 39 } 40 } 41 42 VOID 43 EFIAPI ArmInvalidateDataCache(VOID)44ArmInvalidateDataCache ( 45 VOID 46 ) 47 { 48 ArmDataSynchronizationBarrier (); 49 ArmV7DataCacheOperation (ArmInvalidateDataCacheEntryBySetWay); 50 } 51 52 VOID 53 EFIAPI ArmCleanInvalidateDataCache(VOID)54ArmCleanInvalidateDataCache ( 55 VOID 56 ) 57 { 58 ArmDataSynchronizationBarrier (); 59 ArmV7DataCacheOperation (ArmCleanInvalidateDataCacheEntryBySetWay); 60 } 61 62 VOID 63 EFIAPI ArmCleanDataCache(VOID)64ArmCleanDataCache ( 65 VOID 66 ) 67 { 68 ArmDataSynchronizationBarrier (); 69 ArmV7DataCacheOperation (ArmCleanDataCacheEntryBySetWay); 70 } 71