]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMaintenanceLib.c
ARM Packages: Fixed line endings
[mirror_edk2.git] / ArmPkg / Library / ArmCacheMaintenanceLib / ArmCacheMaintenanceLib.c
index 0dd453003c577409052d2cfd8da3da724dd305c5..2557a2cf096abe4d7d13fd4c3ce9ec80c7882092 100644 (file)
-/** @file
-
-  Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
-  
-  This program and the accompanying materials
-  are licensed and made available under the terms and conditions of the BSD License
-  which accompanies this distribution.  The full text of the license may be found at
-  http://opensource.org/licenses/bsd-license.php
-
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-#include <Base.h>
-#include <Library/ArmLib.h>
-#include <Library/PcdLib.h>
-
-VOID
-CacheRangeOperation (
-  IN  VOID            *Start,
-  IN  UINTN           Length,
-  IN  CACHE_OPERATION CacheOperation,
-  IN  LINE_OPERATION  LineOperation
-  )
-{
-  UINTN ArmCacheLineLength         = ArmDataCacheLineLength();
-  UINTN ArmCacheLineAlignmentMask  = ArmCacheLineLength - 1;
-  UINTN ArmCacheOperationThreshold = PcdGet32(PcdArmCacheOperationThreshold);
-  
-  if ((CacheOperation != NULL) && (Length >= ArmCacheOperationThreshold)) {
-    CacheOperation ();
-  } else {
-    // Align address (rounding down)
-    UINTN AlignedAddress = (UINTN)Start - ((UINTN)Start & ArmCacheLineAlignmentMask);
-    UINTN EndAddress     = (UINTN)Start + Length;
-
-    // Perform the line operation on an address in each cache line
-    while (AlignedAddress < EndAddress) {
-      LineOperation(AlignedAddress);
-      AlignedAddress += ArmCacheLineLength;
-    }
-  }
-}
-
-VOID
-EFIAPI
-InvalidateInstructionCache (
-  VOID
-  )
-{
-  ArmCleanDataCache();
-  ArmInvalidateInstructionCache();
-}
-
-VOID
-EFIAPI
-InvalidateDataCache (
-  VOID
-  )
-{
-  ArmInvalidateDataCache();
-}
-
-VOID *
-EFIAPI
-InvalidateInstructionCacheRange (
-  IN      VOID                      *Address,
-  IN      UINTN                     Length
-  )
-{
-  CacheRangeOperation (Address, Length, ArmCleanDataCacheToPoU, ArmCleanDataCacheEntryByMVA);
-  ArmInvalidateInstructionCache ();
-  return Address;
-}
-
-VOID
-EFIAPI
-WriteBackInvalidateDataCache (
-  VOID
-  )
-{
-  ArmCleanInvalidateDataCache();
-}
-
-VOID *
-EFIAPI
-WriteBackInvalidateDataCacheRange (
-  IN      VOID                      *Address,
-  IN      UINTN                     Length
-  )
-{
-  CacheRangeOperation(Address, Length, ArmCleanInvalidateDataCache, ArmCleanInvalidateDataCacheEntryByMVA);
-  return Address;
-}
-
-VOID
-EFIAPI
-WriteBackDataCache (
-  VOID
-  )
-{
-  ArmCleanDataCache();
-}
-
-VOID *
-EFIAPI
-WriteBackDataCacheRange (
-  IN      VOID                      *Address,
-  IN      UINTN                     Length
-  )
-{
-  CacheRangeOperation(Address, Length, ArmCleanDataCache, ArmCleanDataCacheEntryByMVA);
-  return Address;
-}
-
-VOID *
-EFIAPI
-InvalidateDataCacheRange (
-  IN      VOID                      *Address,
-  IN      UINTN                     Length
-  )
-{
-  CacheRangeOperation(Address, Length, NULL, ArmInvalidateDataCacheEntryByMVA);
-  return Address;
-}
+/** @file\r
+\r
+  Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\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 <Base.h>\r
+#include <Library/ArmLib.h>\r
+#include <Library/PcdLib.h>\r
+\r
+VOID\r
+CacheRangeOperation (\r
+  IN  VOID            *Start,\r
+  IN  UINTN           Length,\r
+  IN  CACHE_OPERATION CacheOperation,\r
+  IN  LINE_OPERATION  LineOperation\r
+  )\r
+{\r
+  UINTN ArmCacheLineLength         = ArmDataCacheLineLength();\r
+  UINTN ArmCacheLineAlignmentMask  = ArmCacheLineLength - 1;\r
+  UINTN ArmCacheOperationThreshold = PcdGet32(PcdArmCacheOperationThreshold);\r
+  \r
+  if ((CacheOperation != NULL) && (Length >= ArmCacheOperationThreshold)) {\r
+    CacheOperation ();\r
+  } else {\r
+    // Align address (rounding down)\r
+    UINTN AlignedAddress = (UINTN)Start - ((UINTN)Start & ArmCacheLineAlignmentMask);\r
+    UINTN EndAddress     = (UINTN)Start + Length;\r
+\r
+    // Perform the line operation on an address in each cache line\r
+    while (AlignedAddress < EndAddress) {\r
+      LineOperation(AlignedAddress);\r
+      AlignedAddress += ArmCacheLineLength;\r
+    }\r
+  }\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+InvalidateInstructionCache (\r
+  VOID\r
+  )\r
+{\r
+  ArmCleanDataCache();\r
+  ArmInvalidateInstructionCache();\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+InvalidateDataCache (\r
+  VOID\r
+  )\r
+{\r
+  ArmInvalidateDataCache();\r
+}\r
+\r
+VOID *\r
+EFIAPI\r
+InvalidateInstructionCacheRange (\r
+  IN      VOID                      *Address,\r
+  IN      UINTN                     Length\r
+  )\r
+{\r
+  CacheRangeOperation (Address, Length, ArmCleanDataCacheToPoU, ArmCleanDataCacheEntryByMVA);\r
+  ArmInvalidateInstructionCache ();\r
+  return Address;\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+WriteBackInvalidateDataCache (\r
+  VOID\r
+  )\r
+{\r
+  ArmCleanInvalidateDataCache();\r
+}\r
+\r
+VOID *\r
+EFIAPI\r
+WriteBackInvalidateDataCacheRange (\r
+  IN      VOID                      *Address,\r
+  IN      UINTN                     Length\r
+  )\r
+{\r
+  CacheRangeOperation(Address, Length, ArmCleanInvalidateDataCache, ArmCleanInvalidateDataCacheEntryByMVA);\r
+  return Address;\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+WriteBackDataCache (\r
+  VOID\r
+  )\r
+{\r
+  ArmCleanDataCache();\r
+}\r
+\r
+VOID *\r
+EFIAPI\r
+WriteBackDataCacheRange (\r
+  IN      VOID                      *Address,\r
+  IN      UINTN                     Length\r
+  )\r
+{\r
+  CacheRangeOperation(Address, Length, ArmCleanDataCache, ArmCleanDataCacheEntryByMVA);\r
+  return Address;\r
+}\r
+\r
+VOID *\r
+EFIAPI\r
+InvalidateDataCacheRange (\r
+  IN      VOID                      *Address,\r
+  IN      UINTN                     Length\r
+  )\r
+{\r
+  CacheRangeOperation(Address, Length, NULL, ArmInvalidateDataCacheEntryByMVA);\r
+  return Address;\r
+}\r