]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPkg/Library/DebugUncachedMemoryAllocationLib/DebugUncachedMemoryAllocationLib.c
ARM Packages: Removed trailing spaces
[mirror_edk2.git] / ArmPkg / Library / DebugUncachedMemoryAllocationLib / DebugUncachedMemoryAllocationLib.c
index 6253c0d5c7a7925cd8d930808582d58b30e88020..00e01a905c853c8754b236ccadf4f868b1ec5abf 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Debug version of the UncachedMemoryAllocation lib that uses the VirtualUncachedPages\r
   protocol, produced by the DXE CPU driver, to produce debuggable uncached memory buffers.\r
-  \r
+\r
   The DMA rules for EFI contain the concept of a PCI (DMA master) address for memory and\r
   a CPU (C code) address for the memory buffer that don't have to be the same.  There seem to\r
   be common errors out there with folks mixing up the two addresses.  This library causes\r
@@ -11,7 +11,7 @@
   PcdArmUncachedMemoryMask ored into the physical address.\r
 \r
   Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>\r
-  \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
 \r
 VOID *\r
 UncachedInternalAllocatePages (\r
-  IN EFI_MEMORY_TYPE  MemoryType,  \r
+  IN EFI_MEMORY_TYPE  MemoryType,\r
   IN UINTN            Pages\r
   );\r
 \r
 VOID *\r
 UncachedInternalAllocateAlignedPages (\r
-  IN EFI_MEMORY_TYPE  MemoryType,  \r
+  IN EFI_MEMORY_TYPE  MemoryType,\r
   IN UINTN            Pages,\r
   IN UINTN            Alignment\r
   );\r
-  \r
-  \r
+\r
+\r
 \r
 EFI_CPU_ARCH_PROTOCOL           *gDebugUncachedCpu;\r
 VIRTUAL_UNCACHED_PAGES_PROTOCOL *gVirtualUncachedPages;\r
@@ -75,13 +75,13 @@ AddPagesToList (
   )\r
 {\r
   FREE_PAGE_NODE  *NewNode;\r
-  \r
+\r
   NewNode = AllocatePool (sizeof (LIST_ENTRY));\r
   if (NewNode == NULL) {\r
     ASSERT (FALSE);\r
     return;\r
   }\r
-  \r
+\r
   NewNode->Buffer     = Buffer;\r
   NewNode->Allocation = Allocation;\r
   NewNode->Pages      = Pages;\r
@@ -102,13 +102,13 @@ RemovePagesFromList (
 \r
   *Allocation = NULL;\r
   *Pages = 0;\r
-  \r
+\r
   for (Link = mPageList.ForwardLink; Link != &mPageList; Link = Link->ForwardLink) {\r
     OldNode = BASE_CR (Link, FREE_PAGE_NODE, Link);\r
     if (OldNode->Buffer == Buffer) {\r
       *Allocation = OldNode->Allocation;\r
       *Pages = OldNode->Pages;\r
-      \r
+\r
       RemoveEntryList (&OldNode->Link);\r
       FreePool (OldNode);\r
       return;\r
@@ -127,9 +127,9 @@ ConvertToPhysicalAddress (
 {\r
   UINTN UncachedMemoryMask = (UINTN)PcdGet64 (PcdArmUncachedMemoryMask);\r
   UINTN PhysicalAddress;\r
-  \r
+\r
   PhysicalAddress = (UINTN)VirtualAddress & ~UncachedMemoryMask;\r
-  \r
+\r
   return (EFI_PHYSICAL_ADDRESS)PhysicalAddress;\r
 }\r
 \r
@@ -141,9 +141,9 @@ ConvertToUncachedAddress (
 {\r
   UINTN UncachedMemoryMask = (UINTN)PcdGet64 (PcdArmUncachedMemoryMask);\r
   UINTN UncachedAddress;\r
-  \r
+\r
   UncachedAddress = (UINTN)Address | UncachedMemoryMask;\r
-  \r
+\r
   return (VOID *)UncachedAddress;\r
 }\r
 \r
@@ -151,7 +151,7 @@ ConvertToUncachedAddress (
 \r
 VOID *\r
 UncachedInternalAllocatePages (\r
-  IN EFI_MEMORY_TYPE  MemoryType,  \r
+  IN EFI_MEMORY_TYPE  MemoryType,\r
   IN UINTN            Pages\r
   )\r
 {\r
@@ -202,7 +202,7 @@ UncachedFreePages (
 \r
 VOID *\r
 UncachedInternalAllocateAlignedPages (\r
-  IN EFI_MEMORY_TYPE  MemoryType,  \r
+  IN EFI_MEMORY_TYPE  MemoryType,\r
   IN UINTN            Pages,\r
   IN UINTN            Alignment\r
   )\r
@@ -218,7 +218,7 @@ UncachedInternalAllocateAlignedPages (
   // Alignment must be a power of two or zero.\r
   //\r
   ASSERT ((Alignment & (Alignment - 1)) == 0);\r
\r
+\r
   if (Pages == 0) {\r
     return NULL;\r
   }\r
@@ -232,7 +232,7 @@ UncachedInternalAllocateAlignedPages (
     // Make sure that Pages plus EFI_SIZE_TO_PAGES (Alignment) does not overflow.\r
     //\r
     ASSERT (RealPages > Pages);\r
\r
+\r
     Status         = gBS->AllocatePages (AllocateAnyPages, MemoryType, RealPages, &Memory);\r
     if (EFI_ERROR (Status)) {\r
       return NULL;\r
@@ -265,14 +265,14 @@ UncachedInternalAllocateAlignedPages (
     }\r
     AlignedMemory  = (UINTN) Memory;\r
   }\r
-  \r
+\r
   Status = gVirtualUncachedPages->ConvertPages (gVirtualUncachedPages, AlignedMemory, Pages * EFI_PAGE_SIZE, PcdGet64 (PcdArmUncachedMemoryMask), &gAttributes);\r
   if (EFI_ERROR (Status)) {\r
     return NULL;\r
   }\r
-  \r
+\r
   AlignedMemory = (EFI_PHYSICAL_ADDRESS)(UINTN)ConvertToUncachedAddress ((VOID *)(UINTN)AlignedMemory);\r
-  \r
+\r
   return (VOID *)(UINTN)AlignedMemory;\r
 }\r
 \r
@@ -285,15 +285,15 @@ UncachedFreeAlignedPages (
   )\r
 {\r
   EFI_STATUS            Status;\r
-  EFI_PHYSICAL_ADDRESS  Memory; \r
+  EFI_PHYSICAL_ADDRESS  Memory;\r
 \r
   ASSERT (Pages != 0);\r
-  \r
+\r
   Memory = ConvertToPhysicalAddress (Buffer);\r
-  \r
+\r
   Status = gVirtualUncachedPages->RevertPages (gVirtualUncachedPages, Memory, Pages * EFI_PAGE_SIZE, PcdGet64 (PcdArmUncachedMemoryMask), gAttributes);\r
 \r
-  \r
+\r
   Status = gBS->FreePages ((EFI_PHYSICAL_ADDRESS) (UINTN) Memory, Pages);\r
   ASSERT_EFI_ERROR (Status);\r
 }\r
@@ -309,7 +309,7 @@ UncachedInternalAllocateAlignedPool (
   )\r
 {\r
   VOID      *AlignedAddress;\r
-  \r
+\r
   //\r
   // Alignment must be a power of two or zero.\r
   //\r
@@ -318,7 +318,7 @@ UncachedInternalAllocateAlignedPool (
   if (Alignment < EFI_PAGE_SIZE) {\r
     Alignment = EFI_PAGE_SIZE;\r
   }\r
-    \r
+\r
   AlignedAddress = UncachedInternalAllocateAlignedPages (PoolType, EFI_SIZE_TO_PAGES (AllocationSize), Alignment);\r
   if (AlignedAddress == NULL) {\r
     return NULL;\r
@@ -413,7 +413,7 @@ UncachedInternalAllocateAlignedCopyPool (
   )\r
 {\r
   VOID  *Memory;\r
-  \r
+\r
   ASSERT (Buffer != NULL);\r
   ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1));\r
 \r
@@ -465,7 +465,7 @@ UncachedFreeAlignedPool (
 {\r
   VOID    *Allocation;\r
   UINTN   Pages;\r
-  \r
+\r
   RemovePagesFromList (Buffer, &Allocation, &Pages);\r
 \r
   UncachedFreePages (Allocation, Pages);\r
@@ -473,7 +473,7 @@ UncachedFreeAlignedPool (
 \r
 VOID *\r
 UncachedInternalAllocatePool (\r
-  IN EFI_MEMORY_TYPE  MemoryType,  \r
+  IN EFI_MEMORY_TYPE  MemoryType,\r
   IN UINTN            AllocationSize\r
   )\r
 {\r
@@ -510,9 +510,9 @@ UncachedAllocateReservedPool (
 \r
 VOID *\r
 UncachedInternalAllocateZeroPool (\r
-  IN EFI_MEMORY_TYPE  PoolType,  \r
+  IN EFI_MEMORY_TYPE  PoolType,\r
   IN UINTN            AllocationSize\r
-  ) \r
+  )\r
 {\r
   VOID  *Memory;\r
 \r
@@ -552,10 +552,10 @@ UncachedAllocateReservedZeroPool (
 \r
 VOID *\r
 UncachedInternalAllocateCopyPool (\r
-  IN EFI_MEMORY_TYPE  PoolType,  \r
+  IN EFI_MEMORY_TYPE  PoolType,\r
   IN UINTN            AllocationSize,\r
   IN CONST VOID       *Buffer\r
-  ) \r
+  )\r
 {\r
   VOID  *Memory;\r
 \r
@@ -567,7 +567,7 @@ UncachedInternalAllocateCopyPool (
      Memory = CopyMem (Memory, Buffer, AllocationSize);\r
   }\r
   return Memory;\r
-} \r
+}\r
 \r
 VOID *\r
 EFIAPI\r
@@ -642,7 +642,7 @@ DebugUncachedMemoryAllocationLibConstructor (
   )\r
 {\r
   EFI_STATUS    Status;\r
-  \r
+\r
   Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID **)&gDebugUncachedCpu);\r
   ASSERT_EFI_ERROR(Status);\r
 \r