1 /** @file 2 Contains function prototypes for Memory Services in DxeCore. 3 4 This header file borrows the DxeCore Memory Allocation services as the primitive 5 for memory allocation. 6 7 Copyright (c) 2008, Intel Corporation. All rights reserved.<BR> 8 This program and the accompanying materials 9 are licensed and made available under the terms and conditions of the BSD License 10 which accompanies this distribution. The full text of the license may be found at 11 http://opensource.org/licenses/bsd-license.php 12 13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 15 16 **/ 17 18 #ifndef _DXE_CORE_MEMORY_ALLOCATION_SERVICES_H_ 19 #define _DXE_CORE_MEMORY_ALLOCATION_SERVICES_H_ 20 21 22 /** 23 Allocates pages from the memory map. 24 25 @param Type The type of allocation to perform 26 @param MemoryType The type of memory to turn the allocated pages 27 into 28 @param NumberOfPages The number of pages to allocate 29 @param Memory A pointer to receive the base allocated memory 30 address 31 32 @return Status. On success, Memory is filled in with the base address allocated 33 @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in 34 spec. 35 @retval EFI_NOT_FOUND Could not allocate pages match the requirement. 36 @retval EFI_OUT_OF_RESOURCES No enough pages to allocate. 37 @retval EFI_SUCCESS Pages successfully allocated. 38 39 **/ 40 EFI_STATUS 41 EFIAPI 42 CoreAllocatePages ( 43 IN EFI_ALLOCATE_TYPE Type, 44 IN EFI_MEMORY_TYPE MemoryType, 45 IN UINTN NumberOfPages, 46 IN OUT EFI_PHYSICAL_ADDRESS *Memory 47 ); 48 49 50 51 /** 52 Frees previous allocated pages. 53 54 @param Memory Base address of memory being freed 55 @param NumberOfPages The number of pages to free 56 57 @retval EFI_NOT_FOUND Could not find the entry that covers the range 58 @retval EFI_INVALID_PARAMETER Address not aligned 59 @return EFI_SUCCESS -Pages successfully freed. 60 61 **/ 62 EFI_STATUS 63 EFIAPI 64 CoreFreePages ( 65 IN EFI_PHYSICAL_ADDRESS Memory, 66 IN UINTN NumberOfPages 67 ); 68 69 70 /** 71 Allocate pool of a particular type. 72 73 @param PoolType Type of pool to allocate 74 @param Size The amount of pool to allocate 75 @param Buffer The address to return a pointer to the allocated 76 pool 77 78 @retval EFI_INVALID_PARAMETER PoolType not valid 79 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed. 80 @retval EFI_SUCCESS Pool successfully allocated. 81 82 **/ 83 EFI_STATUS 84 EFIAPI 85 CoreAllocatePool ( 86 IN EFI_MEMORY_TYPE PoolType, 87 IN UINTN Size, 88 OUT VOID **Buffer 89 ); 90 91 /** 92 Frees pool. 93 94 @param Buffer The allocated pool entry to free 95 96 @retval EFI_INVALID_PARAMETER Buffer is not a valid value. 97 @retval EFI_SUCCESS Pool successfully freed. 98 99 **/ 100 EFI_STATUS 101 EFIAPI 102 CoreFreePool ( 103 IN VOID *Buffer 104 ); 105 106 #endif 107