]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.c
ArmPkg/UncachedMemoryAllocationLib: Removed unused header (Protocol/Cpu.h)
[mirror_edk2.git] / ArmPkg / Library / UncachedMemoryAllocationLib / UncachedMemoryAllocationLib.c
index bf1497daf0877c8b45696e670558981cf974c758..a24300312e240f48468203897407cb9232c5459a 100644 (file)
@@ -1,10 +1,10 @@
 /** @file\r
-  UncachedMemoryAllocation lib that uses DXE CPU driver to chnage cachability for\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.\r
+  Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>\r
   \r
-  All rights reserved. This program and the accompanying materials\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
@@ -14,6 +14,7 @@
 \r
 **/\r
 \r
+#include <Base.h>\r
 #include <Library/BaseLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
@@ -24,8 +25,6 @@
 #include <Library/ArmLib.h>\r
 #include <Library/DxeServicesTableLib.h>\r
 \r
-#include <Protocol/Cpu.h>\r
-\r
 VOID *\r
 UncachedInternalAllocatePages (\r
   IN EFI_MEMORY_TYPE  MemoryType,  \r
@@ -41,8 +40,6 @@ UncachedInternalAllocateAlignedPages (
   \r
   \r
 \r
-EFI_CPU_ARCH_PROTOCOL           *gDebugUncachedCpu;\r
-\r
 //\r
 // Assume all of memory has the same cache attributes, unless we do our magic\r
 //\r
@@ -244,10 +241,8 @@ UncachedInternalAllocateAlignedPages (
     gAttributes = Descriptor.Attributes;\r
   }\r
   \r
-  Status = gDebugUncachedCpu->SetMemoryAttributes (gDebugUncachedCpu, Memory, EFI_PAGES_TO_SIZE (Pages), EFI_MEMORY_UC);\r
-  if (EFI_ERROR (Status)) {\r
-    return NULL;\r
-  }\r
+  Status = gDS->SetMemorySpaceAttributes (Memory, EFI_PAGES_TO_SIZE (Pages), EFI_MEMORY_WC);\r
+  ASSERT_EFI_ERROR (Status);\r
   \r
   return (VOID *)(UINTN)Memory;\r
 }\r
@@ -266,7 +261,7 @@ UncachedFreeAlignedPages (
   ASSERT (Pages != 0);\r
   \r
   Memory = (EFI_PHYSICAL_ADDRESS) (UINTN) Buffer;\r
-  Status = gDebugUncachedCpu->SetMemoryAttributes (gDebugUncachedCpu, Memory, EFI_PAGES_TO_SIZE (Pages), gAttributes);\r
+  Status = gDS->SetMemorySpaceAttributes (Memory, EFI_PAGES_TO_SIZE (Pages), gAttributes);\r
   \r
   Status = gBS->FreePages (Memory, Pages);\r
   ASSERT_EFI_ERROR (Status);\r
@@ -593,35 +588,3 @@ UncachedSafeFreePool (
   }\r
 }\r
 \r
-/**\r
-  The constructor function caches the pointer of DXE Services Table.\r
-\r
-  The constructor function caches the pointer of DXE Services Table.\r
-  It will ASSERT() if that operation fails.\r
-  It will ASSERT() if the pointer of DXE Services Table is NULL.\r
-  It will always return EFI_SUCCESS.\r
-\r
-  @param  ImageHandle   The firmware allocated handle for the EFI image.\r
-  @param  SystemTable   A pointer to the EFI System Table.\r
-\r
-  @retval EFI_SUCCESS   The constructor always returns EFI_SUCCESS.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-UncachedMemoryAllocationLibConstructor (\r
-  IN EFI_HANDLE        ImageHandle,\r
-  IN EFI_SYSTEM_TABLE  *SystemTable\r
-  )\r
-{\r
-  EFI_STATUS    Status;\r
-  \r
-  Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID **)&gDebugUncachedCpu);\r
-  ASSERT_EFI_ERROR(Status);\r
-\r
-\r
-  return Status;\r
-}\r
-\r
-\r
-\r