From 25d7db8cc4b04d6dd1d95129550c977ed0a8ed3c Mon Sep 17 00:00:00 2001 From: Qiu Shumin Date: Fri, 19 Jun 2015 01:56:15 +0000 Subject: MdePkg: Enhance the comments for SmmMemoryAllocationLib instance. Per PI spec all allocation of SMRAM should use EfiRuntimeServicesCode or EfiRuntimeServicesData. So SMM instance use EfiRuntimeServicesCode as the default memory allocation type instead of EfiBootServicesData. This patch clarify this usage in comments. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Qiu Shumin Reviewed-by: Liming Gao git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17666 6f19259b-4bc3-4df7-8a09-765794883524 --- .../SmmMemoryAllocationLib/MemoryAllocationLib.c | 37 +++++++++++----------- 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'MdePkg') diff --git a/MdePkg/Library/SmmMemoryAllocationLib/MemoryAllocationLib.c b/MdePkg/Library/SmmMemoryAllocationLib/MemoryAllocationLib.c index ab27ac6583..30670bf071 100644 --- a/MdePkg/Library/SmmMemoryAllocationLib/MemoryAllocationLib.c +++ b/MdePkg/Library/SmmMemoryAllocationLib/MemoryAllocationLib.c @@ -4,12 +4,13 @@ The PI System Management Mode Core Interface Specification only allows the use of EfiRuntimeServicesCode and EfiRuntimeServicesData memory types for memory - allocations through the SMM Services Table. The functions in the Memory - Allocation Library use EfiBootServicesData as the default memory allocation - type. For this SMM specific instance of the Memory Allocation Library, - EfiRuntimeServicesData is used as the default memory type for all allocations. - In addition, allocation for the Reserved memory types are not supported and - will always return NULL. + allocations through the SMM Services Table as the SMRAM space should be + reserved after BDS phase. The functions in the Memory Allocation Library use + EfiBootServicesData as the default memory allocation type. For this SMM + specific instance of the Memory Allocation Library, EfiRuntimeServicesData + is used as the default memory type for all allocations. In addition, + allocation for the Reserved memory types are not supported and will always + return NULL. Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
This program and the accompanying materials @@ -169,9 +170,9 @@ InternalAllocatePages ( } /** - Allocates one or more 4KB pages of type EfiBootServicesData. + Allocates one or more 4KB pages of type EfiRuntimeServicesData. - Allocates the number of 4KB pages of type EfiBootServicesData and returns a pointer + Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a pointer to the allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. @@ -365,9 +366,9 @@ InternalAllocateAlignedPages ( } /** - Allocates one or more 4KB pages of type EfiBootServicesData at a specified alignment. + Allocates one or more 4KB pages of type EfiRuntimeServicesData at a specified alignment. - Allocates the number of 4KB pages specified by Pages of type EfiBootServicesData + Allocates the number of 4KB pages specified by Pages of type EfiRuntimeServicesData with an alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is returned. If there is not enough memory at the specified alignment remaining to satisfy the request, then NULL is returned. @@ -525,9 +526,9 @@ InternalAllocatePool ( } /** - Allocates a buffer of type EfiBootServicesData. + Allocates a buffer of type EfiRuntimeServicesData. - Allocates the number bytes specified by AllocationSize of type EfiBootServicesData + Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData and returns a pointer to the 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. @@ -620,9 +621,9 @@ InternalAllocateZeroPool ( } /** - Allocates and zeros a buffer of type EfiBootServicesData. + Allocates and zeros a buffer of type EfiRuntimeServicesData. - Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, + Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, clears the buffer with zeros, and returns a pointer to the 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. @@ -722,9 +723,9 @@ InternalAllocateCopyPool ( } /** - Copies a buffer to an allocated buffer of type EfiBootServicesData. + Copies a buffer to an allocated buffer of type EfiRuntimeServicesData. - Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, + Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, copies AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the 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 @@ -846,10 +847,10 @@ InternalReallocatePool ( } /** - Reallocates a buffer of type EfiBootServicesData. + Reallocates a buffer of type EfiRuntimeServicesData. Allocates and zeros the number bytes specified by NewSize from memory of type - EfiBootServicesData. If OldBuffer is not NULL, then the smaller of OldSize and + EfiRuntimeServicesData. If OldBuffer is not NULL, then the smaller of OldSize and NewSize bytes are copied from OldBuffer to the newly allocated buffer, and OldBuffer is freed. A pointer to the newly allocated buffer is returned. If NewSize is 0, then a valid buffer of 0 size is returned. If there is not -- cgit v1.2.3