summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Core/Dxe/Mem/Pool.c
diff options
context:
space:
mode:
authorStar Zeng <star.zeng@intel.com>2014-11-12 03:27:48 +0000
committerlzeng14 <lzeng14@Edk2>2014-11-12 03:27:48 +0000
commit84edd20bd0756ef5719835498d4283435d6b5e77 (patch)
tree2fceedfc8b217a7475ec26277c070b9c08991dfd /MdeModulePkg/Core/Dxe/Mem/Pool.c
parentdad83a8c1207e585b2cb417d0680fe2e9452d262 (diff)
downloadedk2-84edd20bd0756ef5719835498d4283435d6b5e77.tar.gz
edk2-84edd20bd0756ef5719835498d4283435d6b5e77.tar.bz2
edk2-84edd20bd0756ef5719835498d4283435d6b5e77.zip
MdeModulePkg DxeCore/PiSmmCore: Add UEFI memory and SMRAM profile support.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16335 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Core/Dxe/Mem/Pool.c')
-rw-r--r--MdeModulePkg/Core/Dxe/Mem/Pool.c55
1 files changed, 53 insertions, 2 deletions
diff --git a/MdeModulePkg/Core/Dxe/Mem/Pool.c b/MdeModulePkg/Core/Dxe/Mem/Pool.c
index 7d250980f0..1891bb7387 100644
--- a/MdeModulePkg/Core/Dxe/Mem/Pool.c
+++ b/MdeModulePkg/Core/Dxe/Mem/Pool.c
@@ -175,7 +175,7 @@ LookupPoolHead (
**/
EFI_STATUS
EFIAPI
-CoreAllocatePool (
+CoreInternalAllocatePool (
IN EFI_MEMORY_TYPE PoolType,
IN UINTN Size,
OUT VOID **Buffer
@@ -218,7 +218,35 @@ CoreAllocatePool (
return (*Buffer != NULL) ? EFI_SUCCESS : EFI_OUT_OF_RESOURCES;
}
+/**
+ Allocate pool of a particular type.
+
+ @param PoolType Type of pool to allocate
+ @param Size The amount of pool to allocate
+ @param Buffer The address to return a pointer to the allocated
+ pool
+
+ @retval EFI_INVALID_PARAMETER PoolType not valid or Buffer is NULL.
+ @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
+ @retval EFI_SUCCESS Pool successfully allocated.
+
+**/
+EFI_STATUS
+EFIAPI
+CoreAllocatePool (
+ IN EFI_MEMORY_TYPE PoolType,
+ IN UINTN Size,
+ OUT VOID **Buffer
+ )
+{
+ EFI_STATUS Status;
+ Status = CoreInternalAllocatePool (PoolType, Size, Buffer);
+ if (!EFI_ERROR (Status)) {
+ CoreUpdateProfile ((EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0), MemoryProfileActionAllocatePool, PoolType, Size, *Buffer);
+ }
+ return Status;
+}
/**
Internal function to allocate pool of a particular type.
@@ -373,7 +401,7 @@ Done:
**/
EFI_STATUS
EFIAPI
-CoreFreePool (
+CoreInternalFreePool (
IN VOID *Buffer
)
{
@@ -389,7 +417,29 @@ CoreFreePool (
return Status;
}
+/**
+ Frees pool.
+
+ @param Buffer The allocated pool entry to free
+
+ @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
+ @retval EFI_SUCCESS Pool successfully freed.
+
+**/
+EFI_STATUS
+EFIAPI
+CoreFreePool (
+ IN VOID *Buffer
+ )
+{
+ EFI_STATUS Status;
+ Status = CoreInternalFreePool (Buffer);
+ if (!EFI_ERROR (Status)) {
+ CoreUpdateProfile ((EFI_PHYSICAL_ADDRESS) (UINTN) RETURN_ADDRESS (0), MemoryProfileActionFreePool, 0, 0, Buffer);
+ }
+ return Status;
+}
/**
Internal function to free a pool entry.
@@ -558,3 +608,4 @@ CoreFreePoolI (
return EFI_SUCCESS;
}
+