/** @file | |
Contains function prototypes for Memory Services in the SMM Core. | |
This header file borrows the PiSmmCore Memory Allocation services as the primitive | |
for memory allocation. | |
Copyright (c) 2008 - 2010, 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 | |
http://opensource.org/licenses/bsd-license.php | |
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, | |
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. | |
**/ | |
#ifndef _PI_SMM_CORE_MEMORY_ALLOCATION_SERVICES_H_ | |
#define _PI_SMM_CORE_MEMORY_ALLOCATION_SERVICES_H_ | |
/** | |
Allocates pages from the memory map. | |
@param Type The type of allocation to perform | |
@param MemoryType The type of memory to turn the allocated pages | |
into | |
@param NumberOfPages The number of pages to allocate | |
@param Memory A pointer to receive the base allocated memory | |
address | |
@retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in spec. | |
@retval EFI_NOT_FOUND Could not allocate pages match the requirement. | |
@retval EFI_OUT_OF_RESOURCES No enough pages to allocate. | |
@retval EFI_SUCCESS Pages successfully allocated. | |
**/ | |
EFI_STATUS | |
EFIAPI | |
SmmAllocatePages ( | |
IN EFI_ALLOCATE_TYPE Type, | |
IN EFI_MEMORY_TYPE MemoryType, | |
IN UINTN NumberOfPages, | |
OUT EFI_PHYSICAL_ADDRESS *Memory | |
); | |
/** | |
Frees previous allocated pages. | |
@param Memory Base address of memory being freed | |
@param NumberOfPages The number of pages to free | |
@retval EFI_NOT_FOUND Could not find the entry that covers the range | |
@retval EFI_INVALID_PARAMETER Address not aligned | |
@return EFI_SUCCESS Pages successfully freed. | |
**/ | |
EFI_STATUS | |
EFIAPI | |
SmmFreePages ( | |
IN EFI_PHYSICAL_ADDRESS Memory, | |
IN UINTN NumberOfPages | |
); | |
/** | |
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 | |
@retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed. | |
@retval EFI_SUCCESS Pool successfully allocated. | |
**/ | |
EFI_STATUS | |
EFIAPI | |
SmmAllocatePool ( | |
IN EFI_MEMORY_TYPE PoolType, | |
IN UINTN Size, | |
OUT VOID **Buffer | |
); | |
/** | |
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 | |
SmmFreePool ( | |
IN VOID *Buffer | |
); | |
#endif |