]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationServices.h
73b3569b64a4abf1ab8e96da698a667690e473c0
[mirror_edk2.git] / MdeModulePkg / Library / DxeCoreMemoryAllocationLib / DxeCoreMemoryAllocationServices.h
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 - 2018, Intel Corporation. All rights reserved.<BR>
8 SPDX-License-Identifier: BSD-2-Clause-Patent
9
10 **/
11
12 #ifndef _DXE_CORE_MEMORY_ALLOCATION_SERVICES_H_
13 #define _DXE_CORE_MEMORY_ALLOCATION_SERVICES_H_
14
15
16 /**
17 Allocates pages from the memory map.
18
19 @param Type The type of allocation to perform
20 @param MemoryType The type of memory to turn the allocated pages
21 into
22 @param NumberOfPages The number of pages to allocate
23 @param Memory A pointer to receive the base allocated memory
24 address
25
26 @return Status. On success, Memory is filled in with the base address allocated
27 @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in
28 spec.
29 @retval EFI_NOT_FOUND Could not allocate pages match the requirement.
30 @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.
31 @retval EFI_SUCCESS Pages successfully allocated.
32
33 **/
34 EFI_STATUS
35 EFIAPI
36 CoreAllocatePages (
37 IN EFI_ALLOCATE_TYPE Type,
38 IN EFI_MEMORY_TYPE MemoryType,
39 IN UINTN NumberOfPages,
40 IN OUT EFI_PHYSICAL_ADDRESS *Memory
41 );
42
43
44
45 /**
46 Frees previous allocated pages.
47
48 @param Memory Base address of memory being freed
49 @param NumberOfPages The number of pages to free
50
51 @retval EFI_NOT_FOUND Could not find the entry that covers the range
52 @retval EFI_INVALID_PARAMETER Address not aligned
53 @return EFI_SUCCESS -Pages successfully freed.
54
55 **/
56 EFI_STATUS
57 EFIAPI
58 CoreFreePages (
59 IN EFI_PHYSICAL_ADDRESS Memory,
60 IN UINTN NumberOfPages
61 );
62
63
64 /**
65 Allocate pool of a particular type.
66
67 @param PoolType Type of pool to allocate
68 @param Size The amount of pool to allocate
69 @param Buffer The address to return a pointer to the allocated
70 pool
71
72 @retval EFI_INVALID_PARAMETER PoolType not valid
73 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
74 @retval EFI_SUCCESS Pool successfully allocated.
75
76 **/
77 EFI_STATUS
78 EFIAPI
79 CoreAllocatePool (
80 IN EFI_MEMORY_TYPE PoolType,
81 IN UINTN Size,
82 OUT VOID **Buffer
83 );
84
85 /**
86 Frees pool.
87
88 @param Buffer The allocated pool entry to free
89
90 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
91 @retval EFI_SUCCESS Pool successfully freed.
92
93 **/
94 EFI_STATUS
95 EFIAPI
96 CoreFreePool (
97 IN VOID *Buffer
98 );
99
100 #endif