]>
Commit | Line | Data |
---|---|---|
58251024 | 1 | /** @file\r |
2 | Internal include file of DXE Memory Allocation Library.\r | |
3 | \r | |
4 | Copyright (c) 2006, Intel Corporation\r | |
5 | All rights reserved. This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | Module Name: MemoryAllocationLibInternals.h\r | |
14 | \r | |
15 | **/\r | |
16 | \r | |
17 | #ifndef __DXE_MEMORY_ALLOCATION_LIB_INTERNALS_H__\r | |
18 | #define __DXE_MEMORY_ALLOCATION_LIB_INTERNALS_H__\r | |
19 | \r | |
20 | /**\r | |
21 | Allocates one or more 4KB pages of a certain memory type.\r | |
22 | \r | |
23 | Allocates the number of 4KB pages of a certain memory type and returns a pointer to the allocated\r | |
24 | buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL is returned.\r | |
25 | If there is not enough memory remaining to satisfy the request, then NULL is returned.\r | |
26 | \r | |
27 | @param MemoryType The type of memory to allocate.\r | |
28 | @param Pages The number of 4 KB pages to allocate.\r | |
29 | \r | |
30 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
31 | \r | |
32 | **/\r | |
33 | VOID *\r | |
34 | InternalAllocatePages (\r | |
35 | IN EFI_MEMORY_TYPE MemoryType, \r | |
36 | IN UINTN Pages\r | |
37 | );\r | |
38 | \r | |
39 | /**\r | |
40 | Allocates one or more 4KB pages of a certain memory type at a specified alignment.\r | |
41 | \r | |
42 | Allocates the number of 4KB pages specified by Pages of a certain memory type with an alignment\r | |
43 | specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is returned.\r | |
44 | If there is not enough memory at the specified alignment remaining to satisfy the request, then\r | |
45 | NULL is returned.\r | |
46 | If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r | |
47 | \r | |
48 | @param MemoryType The type of memory to allocate.\r | |
49 | @param Pages The number of 4 KB pages to allocate.\r | |
50 | @param Alignment The requested alignment of the allocation. Must be a power of two.\r | |
51 | If Alignment is zero, then byte alignment is used.\r | |
52 | \r | |
53 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
54 | \r | |
55 | **/\r | |
56 | VOID *\r | |
57 | InternalAllocateAlignedPages (\r | |
58 | IN EFI_MEMORY_TYPE MemoryType, \r | |
59 | IN UINTN Pages,\r | |
60 | IN UINTN Alignment\r | |
61 | );\r | |
62 | \r | |
63 | /**\r | |
64 | Allocates a buffer of a certain pool type.\r | |
65 | \r | |
66 | Allocates the number bytes specified by AllocationSize of a certain pool type and returns a\r | |
67 | pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is\r | |
68 | returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.\r | |
69 | \r | |
70 | @param MemoryType The type of memory to allocate.\r | |
71 | @param AllocationSize The number of bytes to allocate.\r | |
72 | \r | |
73 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
74 | \r | |
75 | **/\r | |
76 | VOID *\r | |
77 | InternalAllocatePool (\r | |
78 | IN EFI_MEMORY_TYPE MemoryType, \r | |
79 | IN UINTN AllocationSize\r | |
80 | );\r | |
81 | \r | |
82 | /**\r | |
83 | Allocates and zeros a buffer of a certian pool type.\r | |
84 | \r | |
85 | Allocates the number bytes specified by AllocationSize of a certian pool type, clears the buffer\r | |
86 | with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid\r | |
87 | buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request,\r | |
88 | then NULL is returned.\r | |
89 | \r | |
90 | @param PoolType The type of memory to allocate.\r | |
91 | @param AllocationSize The number of bytes to allocate and zero.\r | |
92 | \r | |
93 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
94 | \r | |
95 | **/\r | |
96 | VOID *\r | |
97 | InternalAllocateZeroPool (\r | |
98 | IN EFI_MEMORY_TYPE PoolType, \r | |
99 | IN UINTN AllocationSize\r | |
100 | );\r | |
101 | \r | |
102 | /**\r | |
103 | Copies a buffer to an allocated buffer of a certian pool type.\r | |
104 | \r | |
105 | Allocates the number bytes specified by AllocationSize of a certian pool type, copies\r | |
106 | AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the\r | |
107 | allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there\r | |
108 | is not enough memory remaining to satisfy the request, then NULL is returned.\r | |
109 | If Buffer is NULL, then ASSERT().\r | |
110 | If AllocationSize is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r | |
111 | \r | |
112 | @param PoolType The type of pool to allocate.\r | |
113 | @param AllocationSize The number of bytes to allocate and zero.\r | |
114 | @param Buffer The buffer to copy to the allocated buffer.\r | |
115 | \r | |
116 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
117 | \r | |
118 | **/\r | |
119 | VOID *\r | |
120 | InternalAllocateCopyPool (\r | |
121 | IN EFI_MEMORY_TYPE PoolType, \r | |
122 | IN UINTN AllocationSize,\r | |
123 | IN CONST VOID *Buffer\r | |
124 | );\r | |
125 | \r | |
126 | /**\r | |
127 | Allocates a buffer of a certain pool type at a specified alignment.\r | |
128 | \r | |
129 | Allocates the number bytes specified by AllocationSize of a certain pool type with an alignment\r | |
130 | specified by Alignment. The allocated buffer is returned. If AllocationSize is 0, then a valid\r | |
131 | buffer of 0 size is returned. If there is not enough memory at the specified alignment remaining\r | |
132 | to satisfy the request, then NULL is returned.\r | |
133 | If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r | |
134 | \r | |
135 | @param PoolType The type of pool to allocate.\r | |
136 | @param AllocationSize The number of bytes to allocate.\r | |
137 | @param Alignment The requested alignment of the allocation. Must be a power of two. If Alignment is zero, then byte alignment is used.\r | |
138 | If Alignment is zero, then byte alignment is used.\r | |
139 | \r | |
140 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
141 | \r | |
142 | **/\r | |
143 | VOID *\r | |
144 | InternalAllocateAlignedPool (\r | |
145 | IN EFI_MEMORY_TYPE PoolType,\r | |
146 | IN UINTN AllocationSize,\r | |
147 | IN UINTN Alignment\r | |
148 | );\r | |
149 | \r | |
150 | /**\r | |
151 | Allocates and zeros a buffer of a certain pool type at a specified alignment.\r | |
152 | \r | |
153 | Allocates the number bytes specified by AllocationSize of a certain pool type with an alignment\r | |
154 | specified by Alignment, clears the buffer with zeros, and returns a pointer to the allocated\r | |
155 | buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not\r | |
156 | enough memory at the specified alignment remaining to satisfy the request, then NULL is returned.\r | |
157 | If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r | |
158 | \r | |
159 | @param PoolType The type of pool to allocate.\r | |
160 | @param AllocationSize The number of bytes to allocate.\r | |
161 | @param Alignment The requested alignment of the allocation. Must be a power of two.\r | |
162 | If Alignment is zero, then byte alignment is used.\r | |
163 | \r | |
164 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
165 | \r | |
166 | **/\r | |
167 | VOID *\r | |
168 | InternalAllocateAlignedZeroPool (\r | |
169 | IN EFI_MEMORY_TYPE PoolType,\r | |
170 | IN UINTN AllocationSize,\r | |
171 | IN UINTN Alignment\r | |
172 | );\r | |
173 | \r | |
174 | /**\r | |
175 | Copies a buffer to an allocated buffer of a certain pool type at a specified alignment.\r | |
176 | \r | |
177 | Allocates the number bytes specified by AllocationSize of a certain pool type with an alignment\r | |
178 | specified by Alignment. The allocated buffer is returned. If AllocationSize is 0, then a valid\r | |
179 | buffer of 0 size is returned. If there is not enough memory at the specified alignment remaining\r | |
180 | to satisfy the request, then NULL is returned.\r | |
181 | If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r | |
182 | \r | |
183 | @param PoolType The type of pool to allocate.\r | |
184 | @param AllocationSize The number of bytes to allocate.\r | |
185 | @param Buffer The buffer to copy to the allocated buffer.\r | |
186 | @param Alignment The requested alignment of the allocation. Must be a power of two.\r | |
187 | If Alignment is zero, then byte alignment is used.\r | |
188 | \r | |
189 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
190 | \r | |
191 | **/\r | |
192 | VOID *\r | |
193 | InternalAllocateAlignedCopyPool (\r | |
194 | IN EFI_MEMORY_TYPE PoolType,\r | |
195 | IN UINTN AllocationSize,\r | |
196 | IN CONST VOID *Buffer,\r | |
197 | IN UINTN Alignment\r | |
198 | );\r | |
199 | \r | |
200 | #endif\r |