]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPkg/Library/ArmLib/Arm/ArmV7Lib.c
ArmPkg/ArmBaseLib: clean up directory structure
[mirror_edk2.git] / ArmPkg / Library / ArmLib / Arm / ArmV7Lib.c
diff --git a/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.c b/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.c
new file mode 100644 (file)
index 0000000..23a7f2f
--- /dev/null
@@ -0,0 +1,70 @@
+/** @file\r
+\r
+  Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
+  Copyright (c) 2011 - 2014, ARM Limited. All rights reserved.\r
+\r
+  This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+#include <Uefi.h>\r
+#include <Chipset/ArmV7.h>\r
+#include <Library/ArmLib.h>\r
+#include <Library/BaseLib.h>\r
+#include <Library/IoLib.h>\r
+#include "ArmV7Lib.h"\r
+#include "ArmLibPrivate.h"\r
+\r
+VOID\r
+ArmV7DataCacheOperation (\r
+  IN  ARM_V7_CACHE_OPERATION  DataCacheOperation\r
+  )\r
+{\r
+  UINTN     SavedInterruptState;\r
+\r
+  SavedInterruptState = ArmGetInterruptState ();\r
+  ArmDisableInterrupts ();\r
+\r
+  ArmV7AllDataCachesOperation (DataCacheOperation);\r
+\r
+  ArmDataSynchronizationBarrier ();\r
+\r
+  if (SavedInterruptState) {\r
+    ArmEnableInterrupts ();\r
+  }\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+ArmInvalidateDataCache (\r
+  VOID\r
+  )\r
+{\r
+  ArmDataSynchronizationBarrier ();\r
+  ArmV7DataCacheOperation (ArmInvalidateDataCacheEntryBySetWay);\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+ArmCleanInvalidateDataCache (\r
+  VOID\r
+  )\r
+{\r
+  ArmDataSynchronizationBarrier ();\r
+  ArmV7DataCacheOperation (ArmCleanInvalidateDataCacheEntryBySetWay);\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+ArmCleanDataCache (\r
+  VOID\r
+  )\r
+{\r
+  ArmDataSynchronizationBarrier ();\r
+  ArmV7DataCacheOperation (ArmCleanDataCacheEntryBySetWay);\r
+}\r