]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.c
EmbeddedPkg: Apply uncrustify changes
[mirror_edk2.git] / EmbeddedPkg / Library / NonCoherentDmaLib / NonCoherentDmaLib.c
index 1aec86fffd06c8b94aabbb135169e19b81929cfd..44a78c947ef4962a7e264a6a935a4b014247a8d5 100644 (file)
 #include <Protocol/Cpu.h>\r
 \r
 typedef struct {\r
-  EFI_PHYSICAL_ADDRESS      HostAddress;\r
-  VOID                      *BufferAddress;\r
-  UINTN                     NumberOfBytes;\r
-  DMA_MAP_OPERATION         Operation;\r
-  BOOLEAN                   DoubleBuffer;\r
+  EFI_PHYSICAL_ADDRESS    HostAddress;\r
+  VOID                    *BufferAddress;\r
+  UINTN                   NumberOfBytes;\r
+  DMA_MAP_OPERATION       Operation;\r
+  BOOLEAN                 DoubleBuffer;\r
 } MAP_INFO_INSTANCE;\r
 \r
-\r
 typedef struct {\r
-  LIST_ENTRY          Link;\r
-  VOID                *HostAddress;\r
-  UINTN               NumPages;\r
-  UINT64              Attributes;\r
+  LIST_ENTRY    Link;\r
+  VOID          *HostAddress;\r
+  UINTN         NumPages;\r
+  UINT64        Attributes;\r
 } UNCACHED_ALLOCATION;\r
 \r
-STATIC EFI_CPU_ARCH_PROTOCOL      *mCpu;\r
-STATIC LIST_ENTRY                 UncachedAllocationList;\r
+STATIC EFI_CPU_ARCH_PROTOCOL  *mCpu;\r
+STATIC LIST_ENTRY             UncachedAllocationList;\r
 \r
-STATIC PHYSICAL_ADDRESS           mDmaHostAddressLimit;\r
+STATIC PHYSICAL_ADDRESS  mDmaHostAddressLimit;\r
 \r
 STATIC\r
 PHYSICAL_ADDRESS\r
 HostToDeviceAddress (\r
-  IN  VOID      *Address\r
+  IN  VOID  *Address\r
   )\r
 {\r
   return (PHYSICAL_ADDRESS)(UINTN)Address + PcdGet64 (PcdDmaDeviceOffset);\r
@@ -95,13 +94,14 @@ InternalAllocateAlignedPages (
   if (Pages == 0) {\r
     return NULL;\r
   }\r
+\r
   if (Alignment > EFI_PAGE_SIZE) {\r
     //\r
     // Calculate the total number of pages since alignment is larger than page\r
     // size.\r
     //\r
-    AlignmentMask  = Alignment - 1;\r
-    RealPages      = Pages + EFI_SIZE_TO_PAGES (Alignment);\r
+    AlignmentMask = Alignment - 1;\r
+    RealPages     = Pages + EFI_SIZE_TO_PAGES (Alignment);\r
     //\r
     // Make sure that Pages plus EFI_SIZE_TO_PAGES (Alignment) does not\r
     // overflow.\r
@@ -109,11 +109,16 @@ InternalAllocateAlignedPages (
     ASSERT (RealPages > Pages);\r
 \r
     Memory = mDmaHostAddressLimit;\r
-    Status = gBS->AllocatePages (AllocateMaxAddress, MemoryType, RealPages,\r
-                    &Memory);\r
+    Status = gBS->AllocatePages (\r
+                    AllocateMaxAddress,\r
+                    MemoryType,\r
+                    RealPages,\r
+                    &Memory\r
+                    );\r
     if (EFI_ERROR (Status)) {\r
       return NULL;\r
     }\r
+\r
     AlignedMemory  = ((UINTN)Memory + AlignmentMask) & ~AlignmentMask;\r
     UnalignedPages = EFI_SIZE_TO_PAGES (AlignedMemory - (UINTN)Memory);\r
     if (UnalignedPages > 0) {\r
@@ -123,6 +128,7 @@ InternalAllocateAlignedPages (
       Status = gBS->FreePages (Memory, UnalignedPages);\r
       ASSERT_EFI_ERROR (Status);\r
     }\r
+\r
     Memory         = AlignedMemory + EFI_PAGES_TO_SIZE (Pages);\r
     UnalignedPages = RealPages - Pages - UnalignedPages;\r
     if (UnalignedPages > 0) {\r
@@ -137,13 +143,19 @@ InternalAllocateAlignedPages (
     // Do not over-allocate pages in this case.\r
     //\r
     Memory = mDmaHostAddressLimit;\r
-    Status = gBS->AllocatePages (AllocateMaxAddress, MemoryType, Pages,\r
-                    &Memory);\r
+    Status = gBS->AllocatePages (\r
+                    AllocateMaxAddress,\r
+                    MemoryType,\r
+                    Pages,\r
+                    &Memory\r
+                    );\r
     if (EFI_ERROR (Status)) {\r
       return NULL;\r
     }\r
+\r
     AlignedMemory = (UINTN)Memory;\r
   }\r
+\r
   return (VOID *)AlignedMemory;\r
 }\r
 \r
@@ -177,23 +189,24 @@ InternalAllocateAlignedPages (
 EFI_STATUS\r
 EFIAPI\r
 DmaMap (\r
-  IN     DMA_MAP_OPERATION              Operation,\r
-  IN     VOID                           *HostAddress,\r
-  IN OUT UINTN                          *NumberOfBytes,\r
-  OUT    PHYSICAL_ADDRESS               *DeviceAddress,\r
-  OUT    VOID                           **Mapping\r
+  IN     DMA_MAP_OPERATION  Operation,\r
+  IN     VOID               *HostAddress,\r
+  IN OUT UINTN              *NumberOfBytes,\r
+  OUT    PHYSICAL_ADDRESS   *DeviceAddress,\r
+  OUT    VOID               **Mapping\r
   )\r
 {\r
-  EFI_STATUS                      Status;\r
-  MAP_INFO_INSTANCE               *Map;\r
-  VOID                            *Buffer;\r
-  EFI_GCD_MEMORY_SPACE_DESCRIPTOR GcdDescriptor;\r
-  UINTN                           AllocSize;\r
-\r
-  if (HostAddress == NULL ||\r
-      NumberOfBytes == NULL ||\r
-      DeviceAddress == NULL ||\r
-      Mapping == NULL ) {\r
+  EFI_STATUS                       Status;\r
+  MAP_INFO_INSTANCE                *Map;\r
+  VOID                             *Buffer;\r
+  EFI_GCD_MEMORY_SPACE_DESCRIPTOR  GcdDescriptor;\r
+  UINTN                            AllocSize;\r
+\r
+  if ((HostAddress == NULL) ||\r
+      (NumberOfBytes == NULL) ||\r
+      (DeviceAddress == NULL) ||\r
+      (Mapping == NULL))\r
+  {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
@@ -206,19 +219,20 @@ DmaMap (
   // Remember range so we can flush on the other side\r
   Map = AllocatePool (sizeof (MAP_INFO_INSTANCE));\r
   if (Map == NULL) {\r
-    return  EFI_OUT_OF_RESOURCES;\r
+    return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
   if (((UINTN)HostAddress + *NumberOfBytes) > mDmaHostAddressLimit) {\r
-\r
     if (Operation == MapOperationBusMasterCommonBuffer) {\r
       goto CommonBufferError;\r
     }\r
 \r
-    AllocSize = ALIGN_VALUE (*NumberOfBytes, mCpu->DmaBufferAlignment);\r
-    Map->BufferAddress = InternalAllocateAlignedPages (EfiBootServicesData,\r
+    AllocSize          = ALIGN_VALUE (*NumberOfBytes, mCpu->DmaBufferAlignment);\r
+    Map->BufferAddress = InternalAllocateAlignedPages (\r
+                           EfiBootServicesData,\r
                            EFI_SIZE_TO_PAGES (AllocSize),\r
-                           mCpu->DmaBufferAlignment);\r
+                           mCpu->DmaBufferAlignment\r
+                           );\r
     if (Map->BufferAddress == NULL) {\r
       Status = EFI_OUT_OF_RESOURCES;\r
       goto FreeMapInfo;\r
@@ -227,17 +241,22 @@ DmaMap (
     if (Operation == MapOperationBusMasterRead) {\r
       CopyMem (Map->BufferAddress, (VOID *)(UINTN)HostAddress, *NumberOfBytes);\r
     }\r
-    mCpu->FlushDataCache (mCpu, (UINTN)Map->BufferAddress, AllocSize,\r
-            EfiCpuFlushTypeWriteBack);\r
 \r
-    *DeviceAddress = HostToDeviceAddress (Map->BufferAddress);\r
-  } else if (Operation != MapOperationBusMasterRead &&\r
-      ((((UINTN)HostAddress & (mCpu->DmaBufferAlignment - 1)) != 0) ||\r
-       ((*NumberOfBytes & (mCpu->DmaBufferAlignment - 1)) != 0))) {\r
+    mCpu->FlushDataCache (\r
+            mCpu,\r
+            (UINTN)Map->BufferAddress,\r
+            AllocSize,\r
+            EfiCpuFlushTypeWriteBack\r
+            );\r
 \r
+    *DeviceAddress = HostToDeviceAddress (Map->BufferAddress);\r
+  } else if ((Operation != MapOperationBusMasterRead) &&\r
+             ((((UINTN)HostAddress & (mCpu->DmaBufferAlignment - 1)) != 0) ||\r
+              ((*NumberOfBytes & (mCpu->DmaBufferAlignment - 1)) != 0)))\r
+  {\r
     // Get the cacheability of the region\r
     Status = gDS->GetMemorySpaceDescriptor ((UINTN)HostAddress, &GcdDescriptor);\r
-    if (EFI_ERROR(Status)) {\r
+    if (EFI_ERROR (Status)) {\r
       goto FreeMapInfo;\r
     }\r
 \r
@@ -259,15 +278,15 @@ DmaMap (
       // we only have to add (alignment - 8) worth of padding.\r
       //\r
       Map->DoubleBuffer = TRUE;\r
-      AllocSize = ALIGN_VALUE (*NumberOfBytes, mCpu->DmaBufferAlignment) +\r
-                  (mCpu->DmaBufferAlignment - 8);\r
+      AllocSize         = ALIGN_VALUE (*NumberOfBytes, mCpu->DmaBufferAlignment) +\r
+                          (mCpu->DmaBufferAlignment - 8);\r
       Map->BufferAddress = AllocatePool (AllocSize);\r
       if (Map->BufferAddress == NULL) {\r
         Status = EFI_OUT_OF_RESOURCES;\r
         goto FreeMapInfo;\r
       }\r
 \r
-      Buffer = ALIGN_POINTER (Map->BufferAddress, mCpu->DmaBufferAlignment);\r
+      Buffer         = ALIGN_POINTER (Map->BufferAddress, mCpu->DmaBufferAlignment);\r
       *DeviceAddress = HostToDeviceAddress (Buffer);\r
 \r
       //\r
@@ -275,13 +294,17 @@ DmaMap (
       // prevents them from being written back unexpectedly, potentially\r
       // overwriting the data we receive from the device.\r
       //\r
-      mCpu->FlushDataCache (mCpu, (UINTN)Buffer, *NumberOfBytes,\r
-              EfiCpuFlushTypeWriteBack);\r
+      mCpu->FlushDataCache (\r
+              mCpu,\r
+              (UINTN)Buffer,\r
+              *NumberOfBytes,\r
+              EfiCpuFlushTypeWriteBack\r
+              );\r
     } else {\r
-      Map->DoubleBuffer  = FALSE;\r
+      Map->DoubleBuffer = FALSE;\r
     }\r
   } else {\r
-    Map->DoubleBuffer  = FALSE;\r
+    Map->DoubleBuffer = FALSE;\r
 \r
     DEBUG_CODE_BEGIN ();\r
 \r
@@ -293,17 +316,23 @@ DmaMap (
     // that we are not trying to create a consistent mapping for cached memory.\r
     //\r
     Status = gDS->GetMemorySpaceDescriptor ((UINTN)HostAddress, &GcdDescriptor);\r
-    ASSERT_EFI_ERROR(Status);\r
+    ASSERT_EFI_ERROR (Status);\r
 \r
-    ASSERT (Operation != MapOperationBusMasterCommonBuffer ||\r
-            (GcdDescriptor.Attributes & (EFI_MEMORY_WB | EFI_MEMORY_WT)) == 0);\r
+    ASSERT (\r
+      Operation != MapOperationBusMasterCommonBuffer ||\r
+      (GcdDescriptor.Attributes & (EFI_MEMORY_WB | EFI_MEMORY_WT)) == 0\r
+      );\r
 \r
     DEBUG_CODE_END ();\r
 \r
     // Flush the Data Cache (should not have any effect if the memory region is\r
     // uncached)\r
-    mCpu->FlushDataCache (mCpu, (UINTN)HostAddress, *NumberOfBytes,\r
-            EfiCpuFlushTypeWriteBackInvalidate);\r
+    mCpu->FlushDataCache (\r
+            mCpu,\r
+            (UINTN)HostAddress,\r
+            *NumberOfBytes,\r
+            EfiCpuFlushTypeWriteBackInvalidate\r
+            );\r
   }\r
 \r
   Map->HostAddress   = (UINTN)HostAddress;\r
@@ -315,10 +344,13 @@ DmaMap (
   return EFI_SUCCESS;\r
 \r
 CommonBufferError:\r
-  DEBUG ((DEBUG_ERROR,\r
+  DEBUG ((\r
+    DEBUG_ERROR,\r
     "%a: Operation type 'MapOperationBusMasterCommonBuffer' is only "\r
     "supported\non memory regions that were allocated using "\r
-    "DmaAllocateBuffer ()\n", __FUNCTION__));\r
+    "DmaAllocateBuffer ()\n",\r
+    __FUNCTION__\r
+    ));\r
   Status = EFI_UNSUPPORTED;\r
 FreeMapInfo:\r
   FreePool (Map);\r
@@ -326,7 +358,6 @@ FreeMapInfo:
   return Status;\r
 }\r
 \r
-\r
 /**\r
   Completes the DmaMapBusMasterRead(), DmaMapBusMasterWrite(), or\r
   DmaMapBusMasterCommonBuffer() operation and releases any corresponding\r
@@ -344,13 +375,13 @@ FreeMapInfo:
 EFI_STATUS\r
 EFIAPI\r
 DmaUnmap (\r
-  IN  VOID                         *Mapping\r
+  IN  VOID  *Mapping\r
   )\r
 {\r
-  MAP_INFO_INSTANCE *Map;\r
-  EFI_STATUS        Status;\r
-  VOID              *Buffer;\r
-  UINTN             AllocSize;\r
+  MAP_INFO_INSTANCE  *Map;\r
+  EFI_STATUS         Status;\r
+  VOID               *Buffer;\r
+  UINTN              AllocSize;\r
 \r
   if (Mapping == NULL) {\r
     ASSERT (FALSE);\r
@@ -363,14 +394,21 @@ DmaUnmap (
   if (((UINTN)Map->HostAddress + Map->NumberOfBytes) > mDmaHostAddressLimit) {\r
     AllocSize = ALIGN_VALUE (Map->NumberOfBytes, mCpu->DmaBufferAlignment);\r
     if (Map->Operation == MapOperationBusMasterWrite) {\r
-      mCpu->FlushDataCache (mCpu, (UINTN)Map->BufferAddress, AllocSize,\r
-              EfiCpuFlushTypeInvalidate);\r
-      CopyMem ((VOID *)(UINTN)Map->HostAddress, Map->BufferAddress,\r
-        Map->NumberOfBytes);\r
+      mCpu->FlushDataCache (\r
+              mCpu,\r
+              (UINTN)Map->BufferAddress,\r
+              AllocSize,\r
+              EfiCpuFlushTypeInvalidate\r
+              );\r
+      CopyMem (\r
+        (VOID *)(UINTN)Map->HostAddress,\r
+        Map->BufferAddress,\r
+        Map->NumberOfBytes\r
+        );\r
     }\r
+\r
     FreePages (Map->BufferAddress, EFI_SIZE_TO_PAGES (AllocSize));\r
   } else if (Map->DoubleBuffer) {\r
-\r
     ASSERT (Map->Operation == MapOperationBusMasterWrite);\r
 \r
     if (Map->Operation != MapOperationBusMasterWrite) {\r
@@ -378,8 +416,12 @@ DmaUnmap (
     } else {\r
       Buffer = ALIGN_POINTER (Map->BufferAddress, mCpu->DmaBufferAlignment);\r
 \r
-      mCpu->FlushDataCache (mCpu, (UINTN)Buffer, Map->NumberOfBytes,\r
-              EfiCpuFlushTypeInvalidate);\r
+      mCpu->FlushDataCache (\r
+              mCpu,\r
+              (UINTN)Buffer,\r
+              Map->NumberOfBytes,\r
+              EfiCpuFlushTypeInvalidate\r
+              );\r
 \r
       CopyMem ((VOID *)(UINTN)Map->HostAddress, Buffer, Map->NumberOfBytes);\r
 \r
@@ -390,8 +432,12 @@ DmaUnmap (
       //\r
       // Make sure we read buffer from uncached memory and not the cache\r
       //\r
-      mCpu->FlushDataCache (mCpu, Map->HostAddress, Map->NumberOfBytes,\r
-              EfiCpuFlushTypeInvalidate);\r
+      mCpu->FlushDataCache (\r
+              mCpu,\r
+              Map->HostAddress,\r
+              Map->NumberOfBytes,\r
+              EfiCpuFlushTypeInvalidate\r
+              );\r
     }\r
   }\r
 \r
@@ -418,9 +464,9 @@ DmaUnmap (
 EFI_STATUS\r
 EFIAPI\r
 DmaAllocateBuffer (\r
-  IN  EFI_MEMORY_TYPE              MemoryType,\r
-  IN  UINTN                        Pages,\r
-  OUT VOID                         **HostAddress\r
+  IN  EFI_MEMORY_TYPE  MemoryType,\r
+  IN  UINTN            Pages,\r
+  OUT VOID             **HostAddress\r
   )\r
 {\r
   return DmaAllocateAlignedBuffer (MemoryType, Pages, 0, HostAddress);\r
@@ -446,29 +492,31 @@ DmaAllocateBuffer (
 EFI_STATUS\r
 EFIAPI\r
 DmaAllocateAlignedBuffer (\r
-  IN  EFI_MEMORY_TYPE              MemoryType,\r
-  IN  UINTN                        Pages,\r
-  IN  UINTN                        Alignment,\r
-  OUT VOID                         **HostAddress\r
+  IN  EFI_MEMORY_TYPE  MemoryType,\r
+  IN  UINTN            Pages,\r
+  IN  UINTN            Alignment,\r
+  OUT VOID             **HostAddress\r
   )\r
 {\r
-  EFI_GCD_MEMORY_SPACE_DESCRIPTOR   GcdDescriptor;\r
-  VOID                              *Allocation;\r
-  UINT64                            MemType;\r
-  UNCACHED_ALLOCATION               *Alloc;\r
-  EFI_STATUS                        Status;\r
+  EFI_GCD_MEMORY_SPACE_DESCRIPTOR  GcdDescriptor;\r
+  VOID                             *Allocation;\r
+  UINT64                           MemType;\r
+  UNCACHED_ALLOCATION              *Alloc;\r
+  EFI_STATUS                       Status;\r
 \r
   if (Alignment == 0) {\r
     Alignment = EFI_PAGE_SIZE;\r
   }\r
 \r
-  if (HostAddress == NULL ||\r
-      (Alignment & (Alignment - 1)) != 0) {\r
+  if ((HostAddress == NULL) ||\r
+      ((Alignment & (Alignment - 1)) != 0))\r
+  {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  if (MemoryType == EfiBootServicesData ||\r
-      MemoryType == EfiRuntimeServicesData) {\r
+  if ((MemoryType == EfiBootServicesData) ||\r
+      (MemoryType == EfiRuntimeServicesData))\r
+  {\r
     Allocation = InternalAllocateAlignedPages (MemoryType, Pages, Alignment);\r
   } else {\r
     return EFI_INVALID_PARAMETER;\r
@@ -480,7 +528,7 @@ DmaAllocateAlignedBuffer (
 \r
   // Get the cacheability of the region\r
   Status = gDS->GetMemorySpaceDescriptor ((UINTN)Allocation, &GcdDescriptor);\r
-  if (EFI_ERROR(Status)) {\r
+  if (EFI_ERROR (Status)) {\r
     goto FreeBuffer;\r
   }\r
 \r
@@ -500,23 +548,27 @@ DmaAllocateAlignedBuffer (
   }\r
 \r
   Alloc->HostAddress = Allocation;\r
-  Alloc->NumPages = Pages;\r
-  Alloc->Attributes = GcdDescriptor.Attributes;\r
+  Alloc->NumPages    = Pages;\r
+  Alloc->Attributes  = GcdDescriptor.Attributes;\r
 \r
   InsertHeadList (&UncachedAllocationList, &Alloc->Link);\r
 \r
   // Remap the region with the new attributes\r
-  Status = gDS->SetMemorySpaceAttributes ((PHYSICAL_ADDRESS)(UINTN)Allocation,\r
-                                          EFI_PAGES_TO_SIZE (Pages),\r
-                                          MemType);\r
+  Status = gDS->SetMemorySpaceAttributes (\r
+                  (PHYSICAL_ADDRESS)(UINTN)Allocation,\r
+                  EFI_PAGES_TO_SIZE (Pages),\r
+                  MemType\r
+                  );\r
   if (EFI_ERROR (Status)) {\r
     goto FreeAlloc;\r
   }\r
 \r
-  Status = mCpu->FlushDataCache (mCpu,\r
-                                 (PHYSICAL_ADDRESS)(UINTN)Allocation,\r
-                                 EFI_PAGES_TO_SIZE (Pages),\r
-                                 EfiCpuFlushTypeInvalidate);\r
+  Status = mCpu->FlushDataCache (\r
+                   mCpu,\r
+                   (PHYSICAL_ADDRESS)(UINTN)Allocation,\r
+                   EFI_PAGES_TO_SIZE (Pages),\r
+                   EfiCpuFlushTypeInvalidate\r
+                   );\r
   if (EFI_ERROR (Status)) {\r
     goto FreeAlloc;\r
   }\r
@@ -534,7 +586,6 @@ FreeBuffer:
   return Status;\r
 }\r
 \r
-\r
 /**\r
   Frees memory that was allocated with DmaAllocateBuffer().\r
 \r
@@ -551,25 +602,25 @@ FreeBuffer:
 EFI_STATUS\r
 EFIAPI\r
 DmaFreeBuffer (\r
-  IN  UINTN                        Pages,\r
-  IN  VOID                         *HostAddress\r
+  IN  UINTN  Pages,\r
+  IN  VOID   *HostAddress\r
   )\r
 {\r
-  LIST_ENTRY                       *Link;\r
-  UNCACHED_ALLOCATION              *Alloc;\r
-  BOOLEAN                          Found;\r
-  EFI_STATUS                       Status;\r
+  LIST_ENTRY           *Link;\r
+  UNCACHED_ALLOCATION  *Alloc;\r
+  BOOLEAN              Found;\r
+  EFI_STATUS           Status;\r
 \r
   if (HostAddress == NULL) {\r
-     return EFI_INVALID_PARAMETER;\r
+    return EFI_INVALID_PARAMETER;\r
   }\r
 \r
   for (Link = GetFirstNode (&UncachedAllocationList), Found = FALSE;\r
        !IsNull (&UncachedAllocationList, Link);\r
-       Link = GetNextNode (&UncachedAllocationList, Link)) {\r
-\r
+       Link = GetNextNode (&UncachedAllocationList, Link))\r
+  {\r
     Alloc = BASE_CR (Link, UNCACHED_ALLOCATION, Link);\r
-    if (Alloc->HostAddress == HostAddress && Alloc->NumPages == Pages) {\r
+    if ((Alloc->HostAddress == HostAddress) && (Alloc->NumPages == Pages)) {\r
       Found = TRUE;\r
       break;\r
     }\r
@@ -582,9 +633,11 @@ DmaFreeBuffer (
 \r
   RemoveEntryList (&Alloc->Link);\r
 \r
-  Status = gDS->SetMemorySpaceAttributes ((PHYSICAL_ADDRESS)(UINTN)HostAddress,\r
-                                          EFI_PAGES_TO_SIZE (Pages),\r
-                                          Alloc->Attributes);\r
+  Status = gDS->SetMemorySpaceAttributes (\r
+                  (PHYSICAL_ADDRESS)(UINTN)HostAddress,\r
+                  EFI_PAGES_TO_SIZE (Pages),\r
+                  Alloc->Attributes\r
+                  );\r
   if (EFI_ERROR (Status)) {\r
     goto FreeAlloc;\r
   }\r
@@ -600,12 +653,11 @@ FreeAlloc:
   return Status;\r
 }\r
 \r
-\r
 EFI_STATUS\r
 EFIAPI\r
 NonCoherentDmaLibConstructor (\r
-  IN EFI_HANDLE       ImageHandle,\r
-  IN EFI_SYSTEM_TABLE *SystemTable\r
+  IN EFI_HANDLE        ImageHandle,\r
+  IN EFI_SYSTEM_TABLE  *SystemTable\r
   )\r
 {\r
   InitializeListHead (&UncachedAllocationList);\r