summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2008-08-24 05:00:30 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2008-08-24 05:00:30 +0000
commit9e6fa6d24598927d90a253e038f7a5d5de994029 (patch)
tree62341c7e4a7d9a09eed49498336cc6fb5088ca3d
parent822a6944bcfc11b562bf6599a4649ddd285dc08a (diff)
downloadedk2-9e6fa6d24598927d90a253e038f7a5d5de994029.tar.gz
edk2-9e6fa6d24598927d90a253e038f7a5d5de994029.tar.bz2
edk2-9e6fa6d24598927d90a253e038f7a5d5de994029.zip
Clean up DxeMemoryAllocationLib and PeiMemoryAllocationLib.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5722 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--MdePkg/Library/DxeHobLib/HobLib.c5
-rw-r--r--MdePkg/Library/DxeMemoryAllocationLib/DxeMemoryAllocationLib.inf2
-rw-r--r--MdePkg/Library/DxeMemoryAllocationLib/MemoryAllocationLib.c15
-rw-r--r--MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c16
-rw-r--r--MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf3
5 files changed, 21 insertions, 20 deletions
diff --git a/MdePkg/Library/DxeHobLib/HobLib.c b/MdePkg/Library/DxeHobLib/HobLib.c
index e13469534a..810bfa5fbf 100644
--- a/MdePkg/Library/DxeHobLib/HobLib.c
+++ b/MdePkg/Library/DxeHobLib/HobLib.c
@@ -34,7 +34,8 @@ STATIC VOID *mHobList = NULL;
@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.
+ @retval EFI_SUCCESS The constructor successfully gets HobList.
+ @retval Other value The constructor can't get HobList.
**/
EFI_STATUS
@@ -50,7 +51,7 @@ HobLibConstructor (
ASSERT_EFI_ERROR (Status);
ASSERT (mHobList != NULL);
- return EFI_SUCCESS;
+ return Status;
}
/**
diff --git a/MdePkg/Library/DxeMemoryAllocationLib/DxeMemoryAllocationLib.inf b/MdePkg/Library/DxeMemoryAllocationLib/DxeMemoryAllocationLib.inf
index 4031b82124..5e473c0a89 100644
--- a/MdePkg/Library/DxeMemoryAllocationLib/DxeMemoryAllocationLib.inf
+++ b/MdePkg/Library/DxeMemoryAllocationLib/DxeMemoryAllocationLib.inf
@@ -3,7 +3,7 @@
#
# Memory Allocation Library that uses EFI Boot Services to allocate
# and free memory.
-# Copyright (c) 2007, Intel Corporation
+# Copyright (c) 2007 - 2008, Intel Corporation
#
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
diff --git a/MdePkg/Library/DxeMemoryAllocationLib/MemoryAllocationLib.c b/MdePkg/Library/DxeMemoryAllocationLib/MemoryAllocationLib.c
index a4b397383b..e8229f76be 100644
--- a/MdePkg/Library/DxeMemoryAllocationLib/MemoryAllocationLib.c
+++ b/MdePkg/Library/DxeMemoryAllocationLib/MemoryAllocationLib.c
@@ -1,7 +1,8 @@
/** @file
- Support routines for memory allocation routines for use with drivers.
+ Support routines for memory allocation routines based
+ on boot services for Dxe phase drivers.
- Copyright (c) 2006, Intel Corporation<BR>
+ Copyright (c) 2006 - 2008, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -49,7 +50,7 @@ InternalAllocatePages (
Status = gBS->AllocatePages (AllocateAnyPages, MemoryType, Pages, &Memory);
if (EFI_ERROR (Status)) {
- Memory = 0;
+ return NULL;
}
return (VOID *) (UINTN) Memory;
}
@@ -536,7 +537,7 @@ AllocateReservedZeroPool (
allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
is not enough memory remaining to satisfy the request, then NULL is returned.
If Buffer is NULL, then ASSERT().
- If AllocationSize is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
+ If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
@param PoolType The type of pool to allocate.
@param AllocationSize The number of bytes to allocate and zero.
@@ -572,7 +573,7 @@ InternalAllocateCopyPool (
allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
is not enough memory remaining to satisfy the request, then NULL is returned.
If Buffer is NULL, then ASSERT().
- If AllocationSize is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
+ If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
@param AllocationSize The number of bytes to allocate and zero.
@param Buffer The buffer to copy to the allocated buffer.
@@ -598,7 +599,7 @@ AllocateCopyPool (
allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
is not enough memory remaining to satisfy the request, then NULL is returned.
If Buffer is NULL, then ASSERT().
- If AllocationSize is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
+ If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
@param AllocationSize The number of bytes to allocate and zero.
@param Buffer The buffer to copy to the allocated buffer.
@@ -624,7 +625,7 @@ AllocateRuntimeCopyPool (
allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
is not enough memory remaining to satisfy the request, then NULL is returned.
If Buffer is NULL, then ASSERT().
- If AllocationSize is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
+ If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
@param AllocationSize The number of bytes to allocate and zero.
@param Buffer The buffer to copy to the allocated buffer.
diff --git a/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c b/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c
index 09c90cb1b0..f937369cc7 100644
--- a/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c
+++ b/MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c
@@ -1,7 +1,8 @@
/** @file
- Support routines for memory allocation routines for use with drivers.
+ Support routines for memory allocation routines
+ based on PeiService for PEI phase drivers.
- Copyright (c) 2006, Intel Corporation<BR>
+ Copyright (c) 2006 - 2008, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -17,7 +18,6 @@
#include <Library/MemoryAllocationLib.h>
-#include <Library/PeiServicesTablePointerLib.h>
#include <Library/PeiServicesLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
@@ -51,7 +51,7 @@ InternalAllocatePages (
Status = PeiServicesAllocatePages (MemoryType, Pages, &Memory);
if (EFI_ERROR (Status)) {
- Memory = 0;
+ return NULL;
}
return (VOID *) (UINTN) Memory;
}
@@ -511,7 +511,7 @@ AllocateReservedZeroPool (
allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
is not enough memory remaining to satisfy the request, then NULL is returned.
If Buffer is NULL, then ASSERT().
- If AllocationSize is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
+ If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
@param PoolType The type of pool to allocate.
@param AllocationSize The number of bytes to allocate and zero.
@@ -547,7 +547,7 @@ InternalAllocateCopyPool (
allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
is not enough memory remaining to satisfy the request, then NULL is returned.
If Buffer is NULL, then ASSERT().
- If AllocationSize is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
+ If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
@param AllocationSize The number of bytes to allocate and zero.
@param Buffer The buffer to copy to the allocated buffer.
@@ -582,7 +582,7 @@ AllocateCopyPool (
allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
is not enough memory remaining to satisfy the request, then NULL is returned.
If Buffer is NULL, then ASSERT().
- If AllocationSize is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
+ If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
@param AllocationSize The number of bytes to allocate and zero.
@param Buffer The buffer to copy to the allocated buffer.
@@ -608,7 +608,7 @@ AllocateRuntimeCopyPool (
allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
is not enough memory remaining to satisfy the request, then NULL is returned.
If Buffer is NULL, then ASSERT().
- If AllocationSize is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
+ If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
@param AllocationSize The number of bytes to allocate and zero.
@param Buffer The buffer to copy to the allocated buffer.
diff --git a/MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf b/MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
index 081d287035..6cb6327f3b 100644
--- a/MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
+++ b/MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
@@ -3,7 +3,7 @@
#
# Memory Allocation Library that uses PEI Services to allocate memory.
# Free operations are ignored.
-# Copyright (c) 2007, Intel Corporation
+# Copyright (c) 2007 - 2008, Intel Corporation
#
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@@ -40,6 +40,5 @@
[LibraryClasses]
DebugLib
BaseMemoryLib
- PeiServicesTablePointerLib
PeiServicesLib