]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg: Fix UncachedFreeAlignedPages in UncachedMemoryAllocationLib
authorEugene Cohen <eugene@hp.com>
Mon, 15 Jul 2013 23:59:58 +0000 (23:59 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 15 Jul 2013 23:59:58 +0000 (23:59 +0000)
Route both the setting and restoring of cacheability through DXE Services/GCD
and stop using the CPU AP directly.
The patch also removes all references to the CPU AP which eliminates the need
for a library constructor.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eugene Cohen <eugene@hp.com>
Reviewed-by: Senthil Ramakrishnan <senthil.ramakrishnan@hp.com>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14468 6f19259b-4bc3-4df7-8a09-765794883524

ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.c
ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf

index 4db93dbd2d65f68ffe706af81b26b307ac96ac25..c06fa7f3ebd77654a16720a0e1d3886647b8dbc9 100644 (file)
@@ -1,5 +1,5 @@
 /** @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.<BR>\r
@@ -42,8 +42,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
@@ -265,7 +263,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
@@ -592,35 +590,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
index a48d94eef4a227755a2f55567a284ac595e6185e..3fc16699c917c485eabb8376da22df649380c32d 100644 (file)
@@ -1,5 +1,7 @@
 #/** @file\r
-# Semihosting  serail port lib\r
+#\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
 #\r
@@ -20,7 +22,6 @@
   MODULE_TYPE                    = DXE_DRIVER\r
   VERSION_STRING                 = 1.0\r
   LIBRARY_CLASS                  = UncachedMemoryAllocationLib\r
-  CONSTRUCTOR                    = UncachedMemoryAllocationLibConstructor\r
 \r
 [Sources.common]\r
   UncachedMemoryAllocationLib.c\r
   ArmPkg/ArmPkg.dec\r
   MdePkg/MdePkg.dec\r
 \r
-[Protocols]\r
-  gEfiCpuArchProtocolGuid\r
-\r
 [LibraryClasses]\r
   BaseLib\r
   ArmLib\r
   MemoryAllocationLib\r
   DxeServicesTableLib\r
 \r
-[Depex]\r
-  gEfiCpuArchProtocolGuid    \r
\ No newline at end of file