]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.c
ArmPkg: remove UncachedMemoryAllocationLib
[mirror_edk2.git] / ArmPkg / Library / UncachedMemoryAllocationLib / UncachedMemoryAllocationLib.c
diff --git a/ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.c b/ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.c
deleted file mode 100644 (file)
index fdaaf2d..0000000
+++ /dev/null
@@ -1,719 +0,0 @@
-/** @file\r
-  UncachedMemoryAllocation lib that uses DXE Service to change cachability for\r
-  a buffer.\r
-\r
-  Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>\r
-  Copyright (c) 2014, AMR Ltd. 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
-\r
-#include <Base.h>\r
-#include <Library/BaseLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/MemoryAllocationLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/UncachedMemoryAllocationLib.h>\r
-#include <Library/PcdLib.h>\r
-#include <Library/ArmLib.h>\r
-#include <Library/DxeServicesTableLib.h>\r
-#include <Library/CacheMaintenanceLib.h>\r
-\r
-#include <Protocol/Cpu.h>\r
-\r
-STATIC EFI_CPU_ARCH_PROTOCOL    *mCpu;\r
-\r
-VOID *\r
-UncachedInternalAllocatePages (\r
-  IN EFI_MEMORY_TYPE  MemoryType,\r
-  IN UINTN            Pages\r
-  );\r
-\r
-VOID *\r
-UncachedInternalAllocateAlignedPages (\r
-  IN EFI_MEMORY_TYPE  MemoryType,\r
-  IN UINTN            Pages,\r
-  IN UINTN            Alignment\r
-  );\r
-\r
-\r
-\r
-typedef struct {\r
-  EFI_PHYSICAL_ADDRESS  Base;\r
-  VOID                  *Allocation;\r
-  UINTN                 Pages;\r
-  EFI_MEMORY_TYPE       MemoryType;\r
-  BOOLEAN               Allocated;\r
-  LIST_ENTRY            Link;\r
-  UINT64                Attributes;\r
-} FREE_PAGE_NODE;\r
-\r
-STATIC LIST_ENTRY  mPageList = INITIALIZE_LIST_HEAD_VARIABLE (mPageList);\r
-// Track the size of the non-allocated buffer in the linked-list\r
-STATIC UINTN   mFreedBufferSize = 0;\r
-\r
-/**\r
- * This function firstly checks if the requested allocation can fit into one\r
- * of the previously allocated buffer.\r
- * If the requested allocation does not fit in the existing pool then\r
- * the function makes a new allocation.\r
- *\r
- * @param MemoryType    Type of memory requested for the new allocation\r
- * @param Pages         Number of requested page\r
- * @param Alignment     Required alignment\r
- * @param Allocation    Address of the newly allocated buffer\r
- *\r
- * @return EFI_SUCCESS  If the function manage to allocate a buffer\r
- * @return !EFI_SUCCESS If the function did not manage to allocate a buffer\r
- */\r
-STATIC\r
-EFI_STATUS\r
-AllocatePagesFromList (\r
-  IN EFI_MEMORY_TYPE  MemoryType,\r
-  IN UINTN            Pages,\r
-  IN UINTN            Alignment,\r
-  OUT VOID            **Allocation\r
-  )\r
-{\r
-  EFI_STATUS       Status;\r
-  LIST_ENTRY      *Link;\r
-  FREE_PAGE_NODE  *Node;\r
-  FREE_PAGE_NODE  *NewNode;\r
-  UINTN            AlignmentMask;\r
-  EFI_PHYSICAL_ADDRESS Memory;\r
-  EFI_GCD_MEMORY_SPACE_DESCRIPTOR Descriptor;\r
-\r
-  // Alignment must be a power of two or zero.\r
-  ASSERT ((Alignment & (Alignment - 1)) == 0);\r
-\r
-  //\r
-  // Look in our list for the smallest page that could satisfy the new allocation\r
-  //\r
-  Node = NULL;\r
-  NewNode = NULL;\r
-  for (Link = mPageList.ForwardLink; Link != &mPageList; Link = Link->ForwardLink) {\r
-    Node = BASE_CR (Link, FREE_PAGE_NODE, Link);\r
-    if ((Node->Allocated == FALSE) && (Node->MemoryType == MemoryType)) {\r
-      // We have a node that fits our requirements\r
-      if (((UINTN)Node->Base & (Alignment - 1)) == 0) {\r
-        // We found a page that matches the page size\r
-        if (Node->Pages == Pages) {\r
-          Node->Allocated  = TRUE;\r
-          Node->Allocation = (VOID*)(UINTN)Node->Base;\r
-          *Allocation      = Node->Allocation;\r
-\r
-          // Update the size of the freed buffer\r
-          mFreedBufferSize  -= Pages * EFI_PAGE_SIZE;\r
-          return EFI_SUCCESS;\r
-        } else if (Node->Pages > Pages) {\r
-          if (NewNode == NULL) {\r
-            // It is the first node that could contain our new allocation\r
-            NewNode = Node;\r
-          } else if (NewNode->Pages > Node->Pages) {\r
-            // This node offers a smaller number of page.\r
-            NewNode = Node;\r
-          }\r
-        }\r
-      }\r
-    }\r
-  }\r
-  // Check if we have found a node that could contain our new allocation\r
-  if (NewNode != NULL) {\r
-    NewNode->Allocated  = TRUE;\r
-    NewNode->Allocation = (VOID*)(UINTN)NewNode->Base;\r
-    *Allocation         = NewNode->Allocation;\r
-    mFreedBufferSize    -= NewNode->Pages * EFI_PAGE_SIZE;\r
-    return EFI_SUCCESS;\r
-  }\r
-\r
-  //\r
-  // Otherwise, we need to allocate a new buffer\r
-  //\r
-\r
-  // We do not want to over-allocate in case the alignment requirement does not\r
-  // require extra pages\r
-  if (Alignment > EFI_PAGE_SIZE) {\r
-    AlignmentMask  = Alignment - 1;\r
-    Pages          += EFI_SIZE_TO_PAGES (Alignment);\r
-  } else {\r
-    AlignmentMask  = 0;\r
-  }\r
-\r
-  Status = gBS->AllocatePages (AllocateAnyPages, MemoryType, Pages, &Memory);\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-\r
-  Status = gDS->GetMemorySpaceDescriptor (Memory, &Descriptor);\r
-  if (EFI_ERROR (Status)) {\r
-    goto FreePages;\r
-  }\r
-\r
-  Status = gDS->SetMemorySpaceAttributes (Memory, EFI_PAGES_TO_SIZE (Pages),\r
-                  EFI_MEMORY_WC);\r
-  if (EFI_ERROR (Status)) {\r
-    goto FreePages;\r
-  }\r
-\r
-  //\r
-  // EFI_CPU_ARCH_PROTOCOL::SetMemoryAttributes() will preserve the original\r
-  // memory type attribute if no memory type is passed. Permission attributes\r
-  // will be replaced, so EFI_MEMORY_RO will be removed if present (although\r
-  // it would be a bug if that were the case for an AllocatePages() allocation)\r
-  //\r
-  Status = mCpu->SetMemoryAttributes (mCpu, Memory, EFI_PAGES_TO_SIZE (Pages),\r
-                   EFI_MEMORY_XP);\r
-  if (EFI_ERROR (Status)) {\r
-    goto FreePages;\r
-  }\r
-\r
-  InvalidateDataCacheRange ((VOID *)(UINTN)Memory, EFI_PAGES_TO_SIZE (Pages));\r
-\r
-  NewNode = AllocatePool (sizeof (FREE_PAGE_NODE));\r
-  if (NewNode == NULL) {\r
-    ASSERT (FALSE);\r
-    Status = EFI_OUT_OF_RESOURCES;\r
-    goto FreePages;\r
-  }\r
-\r
-  NewNode->Base       = Memory;\r
-  NewNode->Allocation = (VOID*)(((UINTN)Memory + AlignmentMask) & ~AlignmentMask);\r
-  NewNode->Pages      = Pages;\r
-  NewNode->Allocated  = TRUE;\r
-  NewNode->MemoryType = MemoryType;\r
-  NewNode->Attributes = Descriptor.Attributes;\r
-\r
-  InsertTailList (&mPageList, &NewNode->Link);\r
-\r
-  *Allocation = NewNode->Allocation;\r
-  return EFI_SUCCESS;\r
-\r
-FreePages:\r
-  gBS->FreePages (Memory, Pages);\r
-  return Status;\r
-}\r
-\r
-/**\r
- * Free the memory allocation\r
- *\r
- * This function will actually try to find the allocation in the linked list.\r
- * And it will then mark the entry as freed.\r
- *\r
- * @param  Allocation  Base address of the buffer to free\r
- *\r
- * @return EFI_SUCCESS            The allocation has been freed\r
- * @return EFI_NOT_FOUND          The allocation was not found in the pool.\r
- * @return EFI_INVALID_PARAMETER  If Allocation is NULL\r
- *\r
- */\r
-STATIC\r
-EFI_STATUS\r
-FreePagesFromList (\r
-  IN  VOID  *Allocation\r
-  )\r
-{\r
-  LIST_ENTRY      *Link;\r
-  FREE_PAGE_NODE  *Node;\r
-\r
-  if (Allocation == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  for (Link = mPageList.ForwardLink; Link != &mPageList; Link = Link->ForwardLink) {\r
-    Node = BASE_CR (Link, FREE_PAGE_NODE, Link);\r
-    if ((UINTN)Node->Allocation == (UINTN)Allocation) {\r
-      Node->Allocated = FALSE;\r
-\r
-      // Update the size of the freed buffer\r
-      mFreedBufferSize  += Node->Pages * EFI_PAGE_SIZE;\r
-\r
-      // If the size of the non-allocated reaches the threshold we raise a warning.\r
-      // It might be an expected behaviour in some cases.\r
-      // We might device to free some of these buffers later on.\r
-      if (mFreedBufferSize > PcdGet64 (PcdArmFreeUncachedMemorySizeThreshold)) {\r
-        DEBUG ((EFI_D_WARN, "Warning: The list of non-allocated buffer has reach the threshold.\n"));\r
-      }\r
-      return EFI_SUCCESS;\r
-    }\r
-  }\r
-\r
-  return EFI_NOT_FOUND;\r
-}\r
-\r
-/**\r
- * This function is automatically invoked when the driver exits\r
- * It frees all the non-allocated memory buffer.\r
- * This function is not responsible to free allocated buffer (eg: case of memory leak,\r
- * runtime allocation).\r
- */\r
-EFI_STATUS\r
-EFIAPI\r
-UncachedMemoryAllocationLibConstructor (\r
-  IN EFI_HANDLE        ImageHandle,\r
-  IN EFI_SYSTEM_TABLE  *SystemTable\r
-  )\r
-{\r
-  return gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID **)&mCpu);\r
-}\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-UncachedMemoryAllocationLibDestructor (\r
-  IN EFI_HANDLE        ImageHandle,\r
-  IN EFI_SYSTEM_TABLE  *SystemTable\r
-  )\r
-{\r
-  LIST_ENTRY      *Link;\r
-  FREE_PAGE_NODE  *OldNode;\r
-\r
-  // Test if the list is empty\r
-  Link = mPageList.ForwardLink;\r
-  if (Link == &mPageList) {\r
-    return EFI_SUCCESS;\r
-  }\r
-\r
-  // Free all the pages and nodes\r
-  do {\r
-    OldNode = BASE_CR (Link, FREE_PAGE_NODE, Link);\r
-    // Point to the next entry\r
-    Link = Link->ForwardLink;\r
-\r
-    // We only free the non-allocated buffer\r
-    if (OldNode->Allocated == FALSE) {\r
-      gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)OldNode->Base, OldNode->Pages);\r
-\r
-      gDS->SetMemorySpaceAttributes ((EFI_PHYSICAL_ADDRESS)(UINTN)OldNode->Base,\r
-             EFI_PAGES_TO_SIZE (OldNode->Pages), OldNode->Attributes);\r
-\r
-      RemoveEntryList (&OldNode->Link);\r
-      FreePool (OldNode);\r
-    }\r
-  } while (Link != &mPageList);\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-/**\r
-  Converts a cached or uncached address to a physical address suitable for use in SoC registers.\r
-\r
-  @param  VirtualAddress                 The pointer to convert.\r
-\r
-  @return The physical address of the supplied virtual pointer.\r
-\r
-**/\r
-EFI_PHYSICAL_ADDRESS\r
-ConvertToPhysicalAddress (\r
-  IN VOID *VirtualAddress\r
-  )\r
-{\r
-  return (EFI_PHYSICAL_ADDRESS)(UINTN)VirtualAddress;\r
-}\r
-\r
-\r
-VOID *\r
-UncachedInternalAllocatePages (\r
-  IN EFI_MEMORY_TYPE  MemoryType,\r
-  IN UINTN            Pages\r
-  )\r
-{\r
-  return UncachedInternalAllocateAlignedPages (MemoryType, Pages, EFI_PAGE_SIZE);\r
-}\r
-\r
-\r
-VOID *\r
-EFIAPI\r
-UncachedAllocatePages (\r
-  IN UINTN  Pages\r
-  )\r
-{\r
-  return UncachedInternalAllocatePages (EfiBootServicesData, Pages);\r
-}\r
-\r
-VOID *\r
-EFIAPI\r
-UncachedAllocateRuntimePages (\r
-  IN UINTN  Pages\r
-  )\r
-{\r
-  return UncachedInternalAllocatePages (EfiRuntimeServicesData, Pages);\r
-}\r
-\r
-VOID *\r
-EFIAPI\r
-UncachedAllocateReservedPages (\r
-  IN UINTN  Pages\r
-  )\r
-{\r
-  return UncachedInternalAllocatePages (EfiReservedMemoryType, Pages);\r
-}\r
-\r
-\r
-\r
-VOID\r
-EFIAPI\r
-UncachedFreePages (\r
-  IN VOID   *Buffer,\r
-  IN UINTN  Pages\r
-  )\r
-{\r
-  UncachedFreeAlignedPages (Buffer, Pages);\r
-  return;\r
-}\r
-\r
-\r
-VOID *\r
-UncachedInternalAllocateAlignedPages (\r
-  IN EFI_MEMORY_TYPE  MemoryType,\r
-  IN UINTN            Pages,\r
-  IN UINTN            Alignment\r
-  )\r
-{\r
-  EFI_STATUS Status;\r
-  VOID   *Allocation;\r
-\r
-  if (Pages == 0) {\r
-    return NULL;\r
-  }\r
-\r
-  Allocation = NULL;\r
-  Status = AllocatePagesFromList (MemoryType, Pages, Alignment, &Allocation);\r
-  if (EFI_ERROR (Status)) {\r
-    ASSERT_EFI_ERROR (Status);\r
-    return NULL;\r
-  } else {\r
-    return Allocation;\r
-  }\r
-}\r
-\r
-\r
-VOID\r
-EFIAPI\r
-UncachedFreeAlignedPages (\r
-  IN VOID   *Buffer,\r
-  IN UINTN  Pages\r
-  )\r
-{\r
-  FreePagesFromList (Buffer);\r
-}\r
-\r
-\r
-VOID *\r
-UncachedInternalAllocateAlignedPool (\r
-  IN EFI_MEMORY_TYPE  PoolType,\r
-  IN UINTN            AllocationSize,\r
-  IN UINTN            Alignment\r
-  )\r
-{\r
-  VOID      *AlignedAddress;\r
-\r
-  //\r
-  // Alignment must be a power of two or zero.\r
-  //\r
-  ASSERT ((Alignment & (Alignment - 1)) == 0);\r
-\r
-  if (Alignment < EFI_PAGE_SIZE) {\r
-    Alignment = EFI_PAGE_SIZE;\r
-  }\r
-\r
-  AlignedAddress = UncachedInternalAllocateAlignedPages (PoolType, EFI_SIZE_TO_PAGES (AllocationSize), Alignment);\r
-  if (AlignedAddress == NULL) {\r
-    return NULL;\r
-  }\r
-\r
-  return (VOID *) AlignedAddress;\r
-}\r
-\r
-VOID *\r
-EFIAPI\r
-UncachedAllocateAlignedPool (\r
-  IN UINTN  AllocationSize,\r
-  IN UINTN  Alignment\r
-  )\r
-{\r
-  return UncachedInternalAllocateAlignedPool (EfiBootServicesData, AllocationSize, Alignment);\r
-}\r
-\r
-VOID *\r
-EFIAPI\r
-UncachedAllocateAlignedRuntimePool (\r
-  IN UINTN  AllocationSize,\r
-  IN UINTN  Alignment\r
-  )\r
-{\r
-  return UncachedInternalAllocateAlignedPool (EfiRuntimeServicesData, AllocationSize, Alignment);\r
-}\r
-\r
-VOID *\r
-EFIAPI\r
-UncachedAllocateAlignedReservedPool (\r
-  IN UINTN  AllocationSize,\r
-  IN UINTN  Alignment\r
-  )\r
-{\r
-  return UncachedInternalAllocateAlignedPool (EfiReservedMemoryType, AllocationSize, Alignment);\r
-}\r
-\r
-VOID *\r
-UncachedInternalAllocateAlignedZeroPool (\r
-  IN EFI_MEMORY_TYPE  PoolType,\r
-  IN UINTN            AllocationSize,\r
-  IN UINTN            Alignment\r
-  )\r
-{\r
-  VOID    *Memory;\r
-  Memory = UncachedInternalAllocateAlignedPool (PoolType, AllocationSize, Alignment);\r
-  if (Memory != NULL) {\r
-    Memory = ZeroMem (Memory, AllocationSize);\r
-  }\r
-  return Memory;\r
-}\r
-\r
-VOID *\r
-EFIAPI\r
-UncachedAllocateAlignedZeroPool (\r
-  IN UINTN  AllocationSize,\r
-  IN UINTN  Alignment\r
-  )\r
-{\r
-  return UncachedInternalAllocateAlignedZeroPool (EfiBootServicesData, AllocationSize, Alignment);\r
-}\r
-\r
-VOID *\r
-EFIAPI\r
-UncachedAllocateAlignedRuntimeZeroPool (\r
-  IN UINTN  AllocationSize,\r
-  IN UINTN  Alignment\r
-  )\r
-{\r
-  return UncachedInternalAllocateAlignedZeroPool (EfiRuntimeServicesData, AllocationSize, Alignment);\r
-}\r
-\r
-VOID *\r
-EFIAPI\r
-UncachedAllocateAlignedReservedZeroPool (\r
-  IN UINTN  AllocationSize,\r
-  IN UINTN  Alignment\r
-  )\r
-{\r
-  return UncachedInternalAllocateAlignedZeroPool (EfiReservedMemoryType, AllocationSize, Alignment);\r
-}\r
-\r
-VOID *\r
-UncachedInternalAllocateAlignedCopyPool (\r
-  IN EFI_MEMORY_TYPE  PoolType,\r
-  IN UINTN            AllocationSize,\r
-  IN CONST VOID       *Buffer,\r
-  IN UINTN            Alignment\r
-  )\r
-{\r
-  VOID  *Memory;\r
-\r
-  ASSERT (Buffer != NULL);\r
-  ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1));\r
-\r
-  Memory = UncachedInternalAllocateAlignedPool (PoolType, AllocationSize, Alignment);\r
-  if (Memory != NULL) {\r
-    Memory = CopyMem (Memory, Buffer, AllocationSize);\r
-  }\r
-  return Memory;\r
-}\r
-\r
-VOID *\r
-EFIAPI\r
-UncachedAllocateAlignedCopyPool (\r
-  IN UINTN       AllocationSize,\r
-  IN CONST VOID  *Buffer,\r
-  IN UINTN       Alignment\r
-  )\r
-{\r
-  return UncachedInternalAllocateAlignedCopyPool (EfiBootServicesData, AllocationSize, Buffer, Alignment);\r
-}\r
-\r
-VOID *\r
-EFIAPI\r
-UncachedAllocateAlignedRuntimeCopyPool (\r
-  IN UINTN       AllocationSize,\r
-  IN CONST VOID  *Buffer,\r
-  IN UINTN       Alignment\r
-  )\r
-{\r
-  return UncachedInternalAllocateAlignedCopyPool (EfiRuntimeServicesData, AllocationSize, Buffer, Alignment);\r
-}\r
-\r
-VOID *\r
-EFIAPI\r
-UncachedAllocateAlignedReservedCopyPool (\r
-  IN UINTN       AllocationSize,\r
-  IN CONST VOID  *Buffer,\r
-  IN UINTN       Alignment\r
-  )\r
-{\r
-  return UncachedInternalAllocateAlignedCopyPool (EfiReservedMemoryType, AllocationSize, Buffer, Alignment);\r
-}\r
-\r
-VOID\r
-EFIAPI\r
-UncachedFreeAlignedPool (\r
-  IN VOID   *Allocation\r
-  )\r
-{\r
-  UncachedFreePages (Allocation, 0);\r
-}\r
-\r
-VOID *\r
-UncachedInternalAllocatePool (\r
-  IN EFI_MEMORY_TYPE  MemoryType,\r
-  IN UINTN            AllocationSize\r
-  )\r
-{\r
-  UINTN CacheLineLength = ArmCacheWritebackGranule ();\r
-  return UncachedInternalAllocateAlignedPool (MemoryType, AllocationSize, CacheLineLength);\r
-}\r
-\r
-VOID *\r
-EFIAPI\r
-UncachedAllocatePool (\r
-  IN UINTN  AllocationSize\r
-  )\r
-{\r
-  return UncachedInternalAllocatePool (EfiBootServicesData, AllocationSize);\r
-}\r
-\r
-VOID *\r
-EFIAPI\r
-UncachedAllocateRuntimePool (\r
-  IN UINTN  AllocationSize\r
-  )\r
-{\r
-  return UncachedInternalAllocatePool (EfiRuntimeServicesData, AllocationSize);\r
-}\r
-\r
-VOID *\r
-EFIAPI\r
-UncachedAllocateReservedPool (\r
-  IN UINTN  AllocationSize\r
-  )\r
-{\r
-  return UncachedInternalAllocatePool (EfiReservedMemoryType, AllocationSize);\r
-}\r
-\r
-VOID *\r
-UncachedInternalAllocateZeroPool (\r
-  IN EFI_MEMORY_TYPE  PoolType,\r
-  IN UINTN            AllocationSize\r
-  )\r
-{\r
-  VOID  *Memory;\r
-\r
-  Memory = UncachedInternalAllocatePool (PoolType, AllocationSize);\r
-  if (Memory != NULL) {\r
-    Memory = ZeroMem (Memory, AllocationSize);\r
-  }\r
-  return Memory;\r
-}\r
-\r
-VOID *\r
-EFIAPI\r
-UncachedAllocateZeroPool (\r
-  IN UINTN  AllocationSize\r
-  )\r
-{\r
-  return UncachedInternalAllocateZeroPool (EfiBootServicesData, AllocationSize);\r
-}\r
-\r
-VOID *\r
-EFIAPI\r
-UncachedAllocateRuntimeZeroPool (\r
-  IN UINTN  AllocationSize\r
-  )\r
-{\r
-  return UncachedInternalAllocateZeroPool (EfiRuntimeServicesData, AllocationSize);\r
-}\r
-\r
-VOID *\r
-EFIAPI\r
-UncachedAllocateReservedZeroPool (\r
-  IN UINTN  AllocationSize\r
-  )\r
-{\r
-  return UncachedInternalAllocateZeroPool (EfiReservedMemoryType, AllocationSize);\r
-}\r
-\r
-VOID *\r
-UncachedInternalAllocateCopyPool (\r
-  IN EFI_MEMORY_TYPE  PoolType,\r
-  IN UINTN            AllocationSize,\r
-  IN CONST VOID       *Buffer\r
-  )\r
-{\r
-  VOID  *Memory;\r
-\r
-  ASSERT (Buffer != NULL);\r
-  ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1));\r
-\r
-  Memory = UncachedInternalAllocatePool (PoolType, AllocationSize);\r
-  if (Memory != NULL) {\r
-     Memory = CopyMem (Memory, Buffer, AllocationSize);\r
-  }\r
-  return Memory;\r
-}\r
-\r
-VOID *\r
-EFIAPI\r
-UncachedAllocateCopyPool (\r
-  IN UINTN       AllocationSize,\r
-  IN CONST VOID  *Buffer\r
-  )\r
-{\r
-  return UncachedInternalAllocateCopyPool (EfiBootServicesData, AllocationSize, Buffer);\r
-}\r
-\r
-VOID *\r
-EFIAPI\r
-UncachedAllocateRuntimeCopyPool (\r
-  IN UINTN       AllocationSize,\r
-  IN CONST VOID  *Buffer\r
-  )\r
-{\r
-  return UncachedInternalAllocateCopyPool (EfiRuntimeServicesData, AllocationSize, Buffer);\r
-}\r
-\r
-VOID *\r
-EFIAPI\r
-UncachedAllocateReservedCopyPool (\r
-  IN UINTN       AllocationSize,\r
-  IN CONST VOID  *Buffer\r
-  )\r
-{\r
-  return UncachedInternalAllocateCopyPool (EfiReservedMemoryType, AllocationSize, Buffer);\r
-}\r
-\r
-VOID\r
-EFIAPI\r
-UncachedFreePool (\r
-  IN VOID   *Buffer\r
-  )\r
-{\r
-  UncachedFreeAlignedPool (Buffer);\r
-}\r
-\r
-VOID\r
-EFIAPI\r
-UncachedSafeFreePool (\r
-  IN VOID   *Buffer\r
-  )\r
-{\r
-  if (Buffer != NULL) {\r
-    UncachedFreePool (Buffer);\r
-    Buffer = NULL;\r
-  }\r
-}\r
-\r