/** @file Contains function prototypes for Memory Services in DxeCore. This header file borrows the DxeCore Memory Allocation services as the primitive for memory allocation. Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ #ifndef _DXE_CORE_MEMORY_ALLOCATION_SERVICES_H_ #define _DXE_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 @return Status. On success, Memory is filled in with the base address allocated @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 CoreAllocatePages ( IN EFI_ALLOCATE_TYPE Type, IN EFI_MEMORY_TYPE MemoryType, IN UINTN NumberOfPages, IN 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 CoreFreePages ( 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 CoreAllocatePool ( 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 CoreFreePool ( IN VOID *Buffer ); #endif