Home | History | Annotate | Download | only in AArch64
      1 /** @file
      2 
      3   Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
      4   Portions copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>
      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 
     16 #include <Uefi.h>
     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"
     23 
     24 VOID
     25 AArch64DataCacheOperation (
     26   IN  AARCH64_CACHE_OPERATION  DataCacheOperation
     27   )
     28 {
     29   UINTN     SavedInterruptState;
     30 
     31   SavedInterruptState = ArmGetInterruptState ();
     32   ArmDisableInterrupts();
     33 
     34   AArch64AllDataCachesOperation (DataCacheOperation);
     35 
     36   ArmDataSynchronizationBarrier ();
     37 
     38   if (SavedInterruptState) {
     39     ArmEnableInterrupts ();
     40   }
     41 }
     42 
     43 VOID
     44 EFIAPI
     45 ArmInvalidateDataCache (
     46   VOID
     47   )
     48 {
     49   ArmDataSynchronizationBarrier ();
     50   AArch64DataCacheOperation (ArmInvalidateDataCacheEntryBySetWay);
     51 }
     52 
     53 VOID
     54 EFIAPI
     55 ArmCleanInvalidateDataCache (
     56   VOID
     57   )
     58 {
     59   ArmDataSynchronizationBarrier ();
     60   AArch64DataCacheOperation (ArmCleanInvalidateDataCacheEntryBySetWay);
     61 }
     62 
     63 VOID
     64 EFIAPI
     65 ArmCleanDataCache (
     66   VOID
     67   )
     68 {
     69   ArmDataSynchronizationBarrier ();
     70   AArch64DataCacheOperation (ArmCleanDataCacheEntryBySetWay);
     71 }
     72