summaryrefslogtreecommitdiff
path: root/ArmPkg
diff options
context:
space:
mode:
authorEugene Cohen <eugene@hp.com>2013-07-15 23:59:58 +0000
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2013-07-15 23:59:58 +0000
commita7463b30402033eb87dba85e32819f2e3a3201ba (patch)
tree6bd4c47082d041577e18f79f2089d1dfefafa363 /ArmPkg
parentb95a25d1ca5db400338d65792aa9da15c2c6f706 (diff)
downloadedk2-platforms-a7463b30402033eb87dba85e32819f2e3a3201ba.tar.xz
ArmPkg: Fix UncachedFreeAlignedPages in UncachedMemoryAllocationLib
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
Diffstat (limited to 'ArmPkg')
-rw-r--r--ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.c38
-rw-r--r--ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf10
2 files changed, 5 insertions, 43 deletions
diff --git a/ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.c b/ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.c
index 4db93dbd2d..c06fa7f3eb 100644
--- a/ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.c
+++ b/ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.c
@@ -1,5 +1,5 @@
/** @file
- UncachedMemoryAllocation lib that uses DXE CPU driver to chnage cachability for
+ UncachedMemoryAllocation lib that uses DXE Service to change cachability for
a buffer.
Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
@@ -42,8 +42,6 @@ UncachedInternalAllocateAlignedPages (
-EFI_CPU_ARCH_PROTOCOL *gDebugUncachedCpu;
-
//
// Assume all of memory has the same cache attributes, unless we do our magic
//
@@ -265,7 +263,7 @@ UncachedFreeAlignedPages (
ASSERT (Pages != 0);
Memory = (EFI_PHYSICAL_ADDRESS) (UINTN) Buffer;
- Status = gDebugUncachedCpu->SetMemoryAttributes (gDebugUncachedCpu, Memory, EFI_PAGES_TO_SIZE (Pages), gAttributes);
+ Status = gDS->SetMemorySpaceAttributes (Memory, EFI_PAGES_TO_SIZE (Pages), gAttributes);
Status = gBS->FreePages (Memory, Pages);
ASSERT_EFI_ERROR (Status);
@@ -592,35 +590,3 @@ UncachedSafeFreePool (
}
}
-/**
- The constructor function caches the pointer of DXE Services Table.
-
- The constructor function caches the pointer of DXE Services Table.
- It will ASSERT() if that operation fails.
- It will ASSERT() if the pointer of DXE Services Table is NULL.
- It will always return EFI_SUCCESS.
-
- @param ImageHandle The firmware allocated handle for the EFI image.
- @param SystemTable A pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
-
-**/
-EFI_STATUS
-EFIAPI
-UncachedMemoryAllocationLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID **)&gDebugUncachedCpu);
- ASSERT_EFI_ERROR(Status);
-
-
- return Status;
-}
-
-
-
diff --git a/ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf b/ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf
index a48d94eef4..3fc16699c9 100644
--- a/ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf
+++ b/ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf
@@ -1,5 +1,7 @@
#/** @file
-# Semihosting serail port lib
+#
+# UncachedMemoryAllocation lib that uses DXE Service to change cachability for
+# a buffer.
#
# Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
#
@@ -20,7 +22,6 @@
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
LIBRARY_CLASS = UncachedMemoryAllocationLib
- CONSTRUCTOR = UncachedMemoryAllocationLibConstructor
[Sources.common]
UncachedMemoryAllocationLib.c
@@ -29,14 +30,9 @@
ArmPkg/ArmPkg.dec
MdePkg/MdePkg.dec
-[Protocols]
- gEfiCpuArchProtocolGuid
-
[LibraryClasses]
BaseLib
ArmLib
MemoryAllocationLib
DxeServicesTableLib
-[Depex]
- gEfiCpuArchProtocolGuid \ No newline at end of file