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