]>
Commit | Line | Data |
---|---|---|
878ddf1f | 1 | /** @file\r |
24e25d11 | 2 | Memory Allocation Library Services\r |
878ddf1f | 3 | \r |
24e25d11 | 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 | |
878ddf1f | 9 | \r |
24e25d11 | 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 | |
878ddf1f | 12 | \r |
24e25d11 | 13 | Module Name: MemoryAllocationLib.h\r |
878ddf1f | 14 | \r |
15 | **/\r | |
16 | \r | |
17 | #ifndef __MEMORY_ALLOCATION_LIB_H__\r | |
18 | #define __MEMORY_ALLOCATION_LIB_H__\r | |
19 | \r | |
20 | /**\r | |
1f33a17f | 21 | Allocates one or more 4KB pages of type EfiBootServicesData.\r |
878ddf1f | 22 | \r |
1f33a17f | 23 | Allocates the number of 4KB pages of type EfiBootServicesData and returns a pointer to the\r |
24 | allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL\r | |
25 | is returned. If there is not enough memory remaining to satisfy the request, then NULL is\r | |
26 | returned.\r | |
878ddf1f | 27 | \r |
1f33a17f | 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 | |
878ddf1f | 31 | \r |
32 | **/\r | |
33 | VOID *\r | |
34 | EFIAPI\r | |
35 | AllocatePages (\r | |
36 | IN UINTN Pages\r | |
1f33a17f | 37 | );\r |
878ddf1f | 38 | \r |
39 | /**\r | |
1f33a17f | 40 | Allocates one or more 4KB pages of type EfiRuntimeServicesData.\r |
41 | \r | |
42 | Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a pointer to the\r | |
43 | allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL\r | |
44 | is returned. If there is not enough memory remaining to satisfy the request, then NULL is\r | |
45 | returned.\r | |
878ddf1f | 46 | \r |
1f33a17f | 47 | @param Pages The number of 4 KB pages to allocate.\r |
878ddf1f | 48 | \r |
1f33a17f | 49 | @return A pointer to the allocated buffer or NULL if allocation fails.\r |
878ddf1f | 50 | \r |
51 | **/\r | |
52 | VOID *\r | |
53 | EFIAPI\r | |
54 | AllocateRuntimePages (\r | |
55 | IN UINTN Pages\r | |
1f33a17f | 56 | );\r |
878ddf1f | 57 | \r |
58 | /**\r | |
1f33a17f | 59 | Allocates one or more 4KB pages of type EfiReservedMemoryType.\r |
878ddf1f | 60 | \r |
1f33a17f | 61 | Allocates the number of 4KB pages of type EfiReservedMemoryType and returns a pointer to the\r |
62 | allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL\r | |
63 | is returned. If there is not enough memory remaining to satisfy the request, then NULL is\r | |
64 | returned.\r | |
878ddf1f | 65 | \r |
1f33a17f | 66 | @param Pages The number of 4 KB pages to allocate.\r |
67 | \r | |
68 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
878ddf1f | 69 | \r |
70 | **/\r | |
71 | VOID *\r | |
72 | EFIAPI\r | |
73 | AllocateReservedPages (\r | |
74 | IN UINTN Pages\r | |
1f33a17f | 75 | );\r |
878ddf1f | 76 | \r |
77 | /**\r | |
1f33a17f | 78 | Frees one or more 4KB pages that were previously allocated with one of the page allocation\r |
79 | functions in the Memory Allocation Library.\r | |
80 | \r | |
81 | Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer\r | |
82 | must have been allocated on a previous call to the page allocation services of the Memory\r | |
83 | Allocation Library.\r | |
84 | If Buffer was not allocated with a page allocation function in the Memory Allocation Library,\r | |
85 | then ASSERT().\r | |
86 | If Pages is zero, then ASSERT().\r | |
87 | \r | |
88 | @param Buffer Pointer to the buffer of pages to free.\r | |
89 | @param Pages The number of 4 KB pages to free.\r | |
878ddf1f | 90 | \r |
91 | **/\r | |
92 | VOID\r | |
93 | EFIAPI\r | |
94 | FreePages (\r | |
95 | IN VOID *Buffer,\r | |
96 | IN UINTN Pages\r | |
1f33a17f | 97 | );\r |
878ddf1f | 98 | \r |
99 | /**\r | |
1f33a17f | 100 | Allocates one or more 4KB pages of type EfiBootServicesData at a specified alignment.\r |
101 | \r | |
102 | Allocates the number of 4KB pages specified by Pages of type EfiBootServicesData with an\r | |
103 | alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is\r | |
104 | returned. If there is not enough memory at the specified alignment remaining to satisfy the\r | |
105 | request, then NULL is returned.\r | |
106 | If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r | |
878ddf1f | 107 | \r |
1f33a17f | 108 | @param Pages The number of 4 KB pages to allocate.\r |
109 | @param Alignment The requested alignment of the allocation. Must be a power of two.\r | |
110 | If Alignment is zero, then byte alignment is used.\r | |
878ddf1f | 111 | \r |
1f33a17f | 112 | @return A pointer to the allocated buffer or NULL if allocation fails.\r |
878ddf1f | 113 | \r |
114 | **/\r | |
115 | VOID *\r | |
116 | EFIAPI\r | |
117 | AllocateAlignedPages (\r | |
118 | IN UINTN Pages,\r | |
119 | IN UINTN Alignment\r | |
1f33a17f | 120 | );\r |
878ddf1f | 121 | \r |
122 | /**\r | |
1f33a17f | 123 | Allocates one or more 4KB pages of type EfiRuntimeServicesData at a specified alignment.\r |
878ddf1f | 124 | \r |
1f33a17f | 125 | Allocates the number of 4KB pages specified by Pages of type EfiRuntimeServicesData with an\r |
126 | alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is\r | |
127 | returned. If there is not enough memory at the specified alignment remaining to satisfy the\r | |
128 | request, then NULL is returned.\r | |
129 | If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r | |
878ddf1f | 130 | \r |
1f33a17f | 131 | @param Pages The number of 4 KB pages to allocate.\r |
132 | @param Alignment The requested alignment of the allocation. Must be a power of two.\r | |
133 | If Alignment is zero, then byte alignment is used.\r | |
134 | \r | |
135 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
878ddf1f | 136 | \r |
137 | **/\r | |
138 | VOID *\r | |
139 | EFIAPI\r | |
140 | AllocateAlignedRuntimePages (\r | |
141 | IN UINTN Pages,\r | |
142 | IN UINTN Alignment\r | |
1f33a17f | 143 | );\r |
878ddf1f | 144 | \r |
145 | /**\r | |
24e25d11 | 146 | Allocates one or more 4KB pages of type EfiReservedMemoryType at a specified alignment.\r |
878ddf1f | 147 | \r |
1f33a17f | 148 | Allocates the number of 4KB pages specified by Pages of type EfiReservedMemoryType with an\r |
149 | alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is\r | |
150 | returned. If there is not enough memory at the specified alignment remaining to satisfy the\r | |
151 | request, then NULL is returned.\r | |
152 | If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r | |
153 | \r | |
154 | @param Pages The number of 4 KB pages to allocate.\r | |
155 | @param Alignment The requested alignment of the allocation. Must be a power of two.\r | |
156 | If Alignment is zero, then byte alignment is used.\r | |
878ddf1f | 157 | \r |
1f33a17f | 158 | @return A pointer to the allocated buffer or NULL if allocation fails.\r |
878ddf1f | 159 | \r |
160 | **/\r | |
161 | VOID *\r | |
162 | EFIAPI\r | |
163 | AllocateAlignedReservedPages (\r | |
164 | IN UINTN Pages,\r | |
165 | IN UINTN Alignment\r | |
1f33a17f | 166 | );\r |
878ddf1f | 167 | \r |
168 | /**\r | |
1f33a17f | 169 | Frees one or more 4KB pages that were previously allocated with one of the aligned page\r |
170 | allocation functions in the Memory Allocation Library.\r | |
171 | \r | |
172 | Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer\r | |
173 | must have been allocated on a previous call to the aligned page allocation services of the Memory\r | |
174 | Allocation Library.\r | |
175 | If Buffer was not allocated with an aligned page allocation function in the Memory Allocation\r | |
176 | Library, then ASSERT().\r | |
177 | If Pages is zero, then ASSERT().\r | |
178 | \r | |
179 | @param Buffer Pointer to the buffer of pages to free.\r | |
180 | @param Pages The number of 4 KB pages to free.\r | |
878ddf1f | 181 | \r |
182 | **/\r | |
183 | VOID\r | |
184 | EFIAPI\r | |
185 | FreeAlignedPages (\r | |
186 | IN VOID *Buffer,\r | |
187 | IN UINTN Pages\r | |
1f33a17f | 188 | );\r |
878ddf1f | 189 | \r |
190 | /**\r | |
24e25d11 | 191 | Allocates a buffer of type EfiBootServicesData.\r |
878ddf1f | 192 | \r |
1f33a17f | 193 | Allocates the number bytes specified by AllocationSize of type EfiBootServicesData and returns a\r |
194 | pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is\r | |
195 | returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.\r | |
878ddf1f | 196 | \r |
1f33a17f | 197 | @param AllocationSize The number of bytes to allocate.\r |
198 | \r | |
199 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
878ddf1f | 200 | \r |
201 | **/\r | |
202 | VOID *\r | |
203 | EFIAPI\r | |
204 | AllocatePool (\r | |
205 | IN UINTN AllocationSize\r | |
1f33a17f | 206 | );\r |
878ddf1f | 207 | \r |
208 | /**\r | |
24e25d11 | 209 | Allocates a buffer of type EfiRuntimeServicesData.\r |
878ddf1f | 210 | \r |
1f33a17f | 211 | Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData and returns\r |
212 | a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is\r | |
213 | returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.\r | |
214 | \r | |
215 | @param AllocationSize The number of bytes to allocate.\r | |
878ddf1f | 216 | \r |
1f33a17f | 217 | @return A pointer to the allocated buffer or NULL if allocation fails.\r |
878ddf1f | 218 | \r |
219 | **/\r | |
220 | VOID *\r | |
221 | EFIAPI\r | |
222 | AllocateRuntimePool (\r | |
223 | IN UINTN AllocationSize\r | |
1f33a17f | 224 | );\r |
878ddf1f | 225 | \r |
226 | /**\r | |
1f33a17f | 227 | Allocates a buffer of type EfieservedMemoryType.\r |
878ddf1f | 228 | \r |
1f33a17f | 229 | Allocates the number bytes specified by AllocationSize of type EfieservedMemoryType and returns\r |
230 | a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is\r | |
231 | returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.\r | |
878ddf1f | 232 | \r |
1f33a17f | 233 | @param AllocationSize The number of bytes to allocate.\r |
234 | \r | |
235 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
878ddf1f | 236 | \r |
237 | **/\r | |
238 | VOID *\r | |
239 | EFIAPI\r | |
240 | AllocateReservedPool (\r | |
241 | IN UINTN AllocationSize\r | |
1f33a17f | 242 | );\r |
878ddf1f | 243 | \r |
244 | /**\r | |
24e25d11 | 245 | Allocates and zeros a buffer of type EfiBootServicesData.\r |
878ddf1f | 246 | \r |
1f33a17f | 247 | Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, clears the\r |
248 | buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a\r | |
249 | valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the\r | |
250 | request, then NULL is returned.\r | |
251 | \r | |
252 | @param AllocationSize The number of bytes to allocate and zero.\r | |
878ddf1f | 253 | \r |
1f33a17f | 254 | @return A pointer to the allocated buffer or NULL if allocation fails.\r |
878ddf1f | 255 | \r |
256 | **/\r | |
257 | VOID *\r | |
258 | EFIAPI\r | |
259 | AllocateZeroPool (\r | |
260 | IN UINTN AllocationSize\r | |
1f33a17f | 261 | );\r |
878ddf1f | 262 | \r |
263 | /**\r | |
24e25d11 | 264 | Allocates and zeros a buffer of type EfiRuntimeServicesData.\r |
878ddf1f | 265 | \r |
1f33a17f | 266 | Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, clears the\r |
267 | buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a\r | |
268 | valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the\r | |
269 | request, then NULL is returned.\r | |
270 | \r | |
271 | @param AllocationSize The number of bytes to allocate and zero.\r | |
878ddf1f | 272 | \r |
1f33a17f | 273 | @return A pointer to the allocated buffer or NULL if allocation fails.\r |
878ddf1f | 274 | \r |
275 | **/\r | |
276 | VOID *\r | |
277 | EFIAPI\r | |
278 | AllocateRuntimeZeroPool (\r | |
279 | IN UINTN AllocationSize\r | |
1f33a17f | 280 | );\r |
878ddf1f | 281 | \r |
282 | /**\r | |
24e25d11 | 283 | Allocates and zeros a buffer of type EfiReservedMemoryType.\r |
878ddf1f | 284 | \r |
1f33a17f | 285 | Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, clears the\r |
286 | buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a\r | |
287 | valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the\r | |
288 | request, then NULL is returned.\r | |
878ddf1f | 289 | \r |
1f33a17f | 290 | @param AllocationSize The number of bytes to allocate and zero.\r |
291 | \r | |
292 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
878ddf1f | 293 | \r |
294 | **/\r | |
295 | VOID *\r | |
296 | EFIAPI\r | |
297 | AllocateReservedZeroPool (\r | |
298 | IN UINTN AllocationSize\r | |
1f33a17f | 299 | );\r |
878ddf1f | 300 | \r |
301 | /**\r | |
1f33a17f | 302 | Copies a buffer to an allocated buffer of type EfiBootServicesData.\r |
303 | \r | |
304 | Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, copies\r | |
305 | AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the\r | |
306 | allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there\r | |
307 | is not enough memory remaining to satisfy the request, then NULL is returned.\r | |
308 | If Buffer is NULL, then ASSERT().\r | |
511710d6 | 309 | If AllocationSize is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r |
878ddf1f | 310 | \r |
1f33a17f | 311 | @param AllocationSize The number of bytes to allocate and zero.\r |
312 | @param Buffer The buffer to copy to the allocated buffer.\r | |
878ddf1f | 313 | \r |
1f33a17f | 314 | @return A pointer to the allocated buffer or NULL if allocation fails.\r |
878ddf1f | 315 | \r |
316 | **/\r | |
317 | VOID *\r | |
318 | EFIAPI\r | |
319 | AllocateCopyPool (\r | |
320 | IN UINTN AllocationSize,\r | |
321 | IN CONST VOID *Buffer\r | |
1f33a17f | 322 | );\r |
878ddf1f | 323 | \r |
324 | /**\r | |
1f33a17f | 325 | Copies a buffer to an allocated buffer of type EfiRuntimeServicesData.\r |
878ddf1f | 326 | \r |
1f33a17f | 327 | Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, copies\r |
328 | AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the\r | |
329 | allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there\r | |
330 | is not enough memory remaining to satisfy the request, then NULL is returned.\r | |
331 | If Buffer is NULL, then ASSERT().\r | |
511710d6 | 332 | If AllocationSize is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r |
878ddf1f | 333 | \r |
1f33a17f | 334 | @param AllocationSize The number of bytes to allocate and zero.\r |
335 | @param Buffer The buffer to copy to the allocated buffer.\r | |
336 | \r | |
337 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
878ddf1f | 338 | \r |
339 | **/\r | |
340 | VOID *\r | |
341 | EFIAPI\r | |
342 | AllocateRuntimeCopyPool (\r | |
343 | IN UINTN AllocationSize,\r | |
344 | IN CONST VOID *Buffer\r | |
1f33a17f | 345 | );\r |
878ddf1f | 346 | \r |
347 | /**\r | |
1f33a17f | 348 | Copies a buffer to an allocated buffer of type EfiReservedMemoryType.\r |
349 | \r | |
350 | Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, copies\r | |
351 | AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the\r | |
352 | allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there\r | |
353 | is not enough memory remaining to satisfy the request, then NULL is returned.\r | |
354 | If Buffer is NULL, then ASSERT().\r | |
511710d6 | 355 | If AllocationSize is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r |
878ddf1f | 356 | \r |
1f33a17f | 357 | @param AllocationSize The number of bytes to allocate and zero.\r |
358 | @param Buffer The buffer to copy to the allocated buffer.\r | |
878ddf1f | 359 | \r |
1f33a17f | 360 | @return A pointer to the allocated buffer or NULL if allocation fails.\r |
878ddf1f | 361 | \r |
362 | **/\r | |
363 | VOID *\r | |
364 | EFIAPI\r | |
365 | AllocateReservedCopyPool (\r | |
366 | IN UINTN AllocationSize,\r | |
367 | IN CONST VOID *Buffer\r | |
1f33a17f | 368 | );\r |
878ddf1f | 369 | \r |
370 | /**\r | |
1f33a17f | 371 | Frees a buffer that was previously allocated with one of the pool allocation functions in the\r |
372 | Memory Allocation Library.\r | |
878ddf1f | 373 | \r |
1f33a17f | 374 | Frees the buffer specified by Buffer. Buffer must have been allocated on a previous call to the\r |
375 | pool allocation services of the Memory Allocation Library.\r | |
376 | If Buffer was not allocated with a pool allocation function in the Memory Allocation Library,\r | |
377 | then ASSERT().\r | |
878ddf1f | 378 | \r |
1f33a17f | 379 | @param Buffer Pointer to the buffer to free.\r |
878ddf1f | 380 | \r |
381 | **/\r | |
382 | VOID\r | |
383 | EFIAPI\r | |
384 | FreePool (\r | |
385 | IN VOID *Buffer\r | |
1f33a17f | 386 | );\r |
878ddf1f | 387 | \r |
388 | /**\r | |
24e25d11 | 389 | Allocates a buffer of type EfiBootServicesData at a specified alignment.\r |
878ddf1f | 390 | \r |
1f33a17f | 391 | Allocates the number bytes specified by AllocationSize of type EfiBootServicesData with an\r |
392 | alignment specified by Alignment. The allocated buffer is returned. If AllocationSize is 0,\r | |
393 | then a valid buffer of 0 size is returned. If there is not enough memory at the specified\r | |
394 | alignment remaining to satisfy the request, then NULL is returned.\r | |
395 | If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r | |
396 | \r | |
397 | @param AllocationSize The number of bytes to allocate.\r | |
398 | @param Alignment The requested alignment of the allocation. Must be a power of two.\r | |
399 | If Alignment is zero, then byte alignment is used.\r | |
878ddf1f | 400 | \r |
1f33a17f | 401 | @return A pointer to the allocated buffer or NULL if allocation fails.\r |
878ddf1f | 402 | \r |
403 | **/\r | |
404 | VOID *\r | |
405 | EFIAPI\r | |
406 | AllocateAlignedPool (\r | |
407 | IN UINTN AllocationSize,\r | |
408 | IN UINTN Alignment\r | |
1f33a17f | 409 | );\r |
878ddf1f | 410 | \r |
411 | /**\r | |
24e25d11 | 412 | Allocates a buffer of type EfiRuntimeServicesData at a specified alignment.\r |
878ddf1f | 413 | \r |
1f33a17f | 414 | Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData with an\r |
415 | alignment specified by Alignment. The allocated buffer is returned. If AllocationSize is 0,\r | |
416 | then a valid buffer of 0 size is returned. If there is not enough memory at the specified\r | |
417 | alignment remaining to satisfy the request, then NULL is returned.\r | |
418 | If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r | |
419 | \r | |
420 | @param AllocationSize The number of bytes to allocate.\r | |
421 | @param Alignment The requested alignment of the allocation. Must be a power of two.\r | |
422 | If Alignment is zero, then byte alignment is used.\r | |
878ddf1f | 423 | \r |
1f33a17f | 424 | @return A pointer to the allocated buffer or NULL if allocation fails.\r |
878ddf1f | 425 | \r |
426 | **/\r | |
427 | VOID *\r | |
428 | EFIAPI\r | |
429 | AllocateAlignedRuntimePool (\r | |
430 | IN UINTN AllocationSize,\r | |
431 | IN UINTN Alignment\r | |
1f33a17f | 432 | );\r |
878ddf1f | 433 | \r |
434 | /**\r | |
1f33a17f | 435 | Allocates a buffer of type EfieservedMemoryType at a specified alignment.\r |
878ddf1f | 436 | \r |
1f33a17f | 437 | Allocates the number bytes specified by AllocationSize of type EfieservedMemoryType with an\r |
438 | alignment specified by Alignment. The allocated buffer is returned. If AllocationSize is 0,\r | |
439 | then a valid buffer of 0 size is returned. If there is not enough memory at the specified\r | |
440 | alignment remaining to satisfy the request, then NULL is returned.\r | |
441 | If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r | |
878ddf1f | 442 | \r |
1f33a17f | 443 | @param AllocationSize The number of bytes to allocate.\r |
444 | @param Alignment The requested alignment of the allocation. Must be a power of two.\r | |
445 | If Alignment is zero, then byte alignment is used.\r | |
446 | \r | |
447 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
878ddf1f | 448 | \r |
449 | **/\r | |
450 | VOID *\r | |
451 | EFIAPI\r | |
452 | AllocateAlignedReservedPool (\r | |
453 | IN UINTN AllocationSize,\r | |
454 | IN UINTN Alignment\r | |
1f33a17f | 455 | );\r |
878ddf1f | 456 | \r |
457 | /**\r | |
24e25d11 | 458 | Allocates and zeros a buffer of type EfiBootServicesData at a specified alignment.\r |
878ddf1f | 459 | \r |
1f33a17f | 460 | Allocates the number bytes specified by AllocationSize of type EfiBootServicesData with an\r |
461 | alignment specified by Alignment, clears the buffer with zeros, and returns a pointer to the\r | |
462 | allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there\r | |
463 | is not enough memory at the specified alignment remaining to satisfy the request, then NULL is\r | |
464 | returned.\r | |
465 | If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r | |
466 | \r | |
467 | @param AllocationSize The number of bytes to allocate.\r | |
468 | @param Alignment The requested alignment of the allocation. Must be a power of two.\r | |
469 | If Alignment is zero, then byte alignment is used.\r | |
878ddf1f | 470 | \r |
1f33a17f | 471 | @return A pointer to the allocated buffer or NULL if allocation fails.\r |
878ddf1f | 472 | \r |
473 | **/\r | |
474 | VOID *\r | |
475 | EFIAPI\r | |
476 | AllocateAlignedZeroPool (\r | |
477 | IN UINTN AllocationSize,\r | |
478 | IN UINTN Alignment\r | |
1f33a17f | 479 | );\r |
878ddf1f | 480 | \r |
481 | /**\r | |
24e25d11 | 482 | Allocates and zeros a buffer of type EfiRuntimeServicesData at a specified alignment.\r |
878ddf1f | 483 | \r |
1f33a17f | 484 | Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData with an\r |
485 | alignment specified by Alignment, clears the buffer with zeros, and returns a pointer to the\r | |
486 | allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there\r | |
487 | is not enough memory at the specified alignment remaining to satisfy the request, then NULL is\r | |
488 | returned.\r | |
489 | If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r | |
878ddf1f | 490 | \r |
1f33a17f | 491 | @param AllocationSize The number of bytes to allocate.\r |
492 | @param Alignment The requested alignment of the allocation. Must be a power of two.\r | |
493 | If Alignment is zero, then byte alignment is used.\r | |
494 | \r | |
495 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
878ddf1f | 496 | \r |
497 | **/\r | |
498 | VOID *\r | |
499 | EFIAPI\r | |
500 | AllocateAlignedRuntimeZeroPool (\r | |
501 | IN UINTN AllocationSize,\r | |
502 | IN UINTN Alignment\r | |
1f33a17f | 503 | );\r |
878ddf1f | 504 | \r |
505 | /**\r | |
1f33a17f | 506 | Allocates and zeros a buffer of type EfieservedMemoryType at a specified alignment.\r |
507 | \r | |
508 | Allocates the number bytes specified by AllocationSize of type EfieservedMemoryType with an\r | |
509 | alignment specified by Alignment, clears the buffer with zeros, and returns a pointer to the\r | |
510 | allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there\r | |
511 | is not enough memory at the specified alignment remaining to satisfy the request, then NULL is\r | |
512 | returned.\r | |
513 | If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r | |
878ddf1f | 514 | \r |
1f33a17f | 515 | @param AllocationSize The number of bytes to allocate.\r |
516 | @param Alignment The requested alignment of the allocation. Must be a power of two.\r | |
517 | If Alignment is zero, then byte alignment is used.\r | |
878ddf1f | 518 | \r |
1f33a17f | 519 | @return A pointer to the allocated buffer or NULL if allocation fails.\r |
878ddf1f | 520 | \r |
521 | **/\r | |
522 | VOID *\r | |
523 | EFIAPI\r | |
524 | AllocateAlignedReservedZeroPool (\r | |
525 | IN UINTN AllocationSize,\r | |
526 | IN UINTN Alignment\r | |
1f33a17f | 527 | );\r |
878ddf1f | 528 | \r |
529 | /**\r | |
24e25d11 | 530 | Copies a buffer to an allocated buffer of type EfiBootServicesData at a specified alignment.\r |
878ddf1f | 531 | \r |
1f33a17f | 532 | Allocates the number bytes specified by AllocationSize of type EfiBootServicesData type with an\r |
533 | alignment specified by Alignment. The allocated buffer is returned. If AllocationSize is 0,\r | |
534 | then a valid buffer of 0 size is returned. If there is not enough memory at the specified\r | |
535 | alignment remaining to satisfy the request, then NULL is returned.\r | |
536 | If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r | |
878ddf1f | 537 | \r |
1f33a17f | 538 | @param AllocationSize The number of bytes to allocate.\r |
539 | @param Buffer The buffer to copy to the allocated buffer.\r | |
540 | @param Alignment The requested alignment of the allocation. Must be a power of two.\r | |
541 | If Alignment is zero, then byte alignment is used.\r | |
542 | \r | |
543 | @return A pointer to the allocated buffer or NULL if allocation fails.\r | |
878ddf1f | 544 | \r |
545 | **/\r | |
546 | VOID *\r | |
547 | EFIAPI\r | |
548 | AllocateAlignedCopyPool (\r | |
549 | IN UINTN AllocationSize,\r | |
550 | IN CONST VOID *Buffer,\r | |
551 | IN UINTN Alignment\r | |
1f33a17f | 552 | );\r |
878ddf1f | 553 | \r |
554 | /**\r | |
24e25d11 | 555 | Copies a buffer to an allocated buffer of type EfiRuntimeServicesData at a specified alignment.\r |
878ddf1f | 556 | \r |
1f33a17f | 557 | Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData type with an\r |
558 | alignment specified by Alignment. The allocated buffer is returned. If AllocationSize is 0,\r | |
559 | then a valid buffer of 0 size is returned. If there is not enough memory at the specified\r | |
560 | alignment remaining to satisfy the request, then NULL is returned.\r | |
561 | If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r | |
562 | \r | |
563 | @param AllocationSize The number of bytes to allocate.\r | |
564 | @param Buffer The buffer to copy to the allocated buffer.\r | |
565 | @param Alignment The requested alignment of the allocation. Must be a power of two.\r | |
566 | If Alignment is zero, then byte alignment is used.\r | |
878ddf1f | 567 | \r |
1f33a17f | 568 | @return A pointer to the allocated buffer or NULL if allocation fails.\r |
878ddf1f | 569 | \r |
570 | **/\r | |
571 | VOID *\r | |
572 | EFIAPI\r | |
573 | AllocateAlignedRuntimeCopyPool (\r | |
574 | IN UINTN AllocationSize,\r | |
575 | IN CONST VOID *Buffer,\r | |
576 | IN UINTN Alignment\r | |
1f33a17f | 577 | );\r |
878ddf1f | 578 | \r |
579 | /**\r | |
24e25d11 | 580 | Copies a buffer to an allocated buffer of type EfiReservedMemoryType at a specified alignment.\r |
878ddf1f | 581 | \r |
1f33a17f | 582 | Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType type with an\r |
583 | alignment specified by Alignment. The allocated buffer is returned. If AllocationSize is 0,\r | |
584 | then a valid buffer of 0 size is returned. If there is not enough memory at the specified\r | |
585 | alignment remaining to satisfy the request, then NULL is returned.\r | |
586 | If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r | |
587 | \r | |
588 | @param AllocationSize The number of bytes to allocate.\r | |
589 | @param Buffer The buffer to copy to the allocated buffer.\r | |
590 | @param Alignment The requested alignment of the allocation. Must be a power of two.\r | |
591 | If Alignment is zero, then byte alignment is used.\r | |
878ddf1f | 592 | \r |
1f33a17f | 593 | @return A pointer to the allocated buffer or NULL if allocation fails.\r |
878ddf1f | 594 | \r |
595 | **/\r | |
596 | VOID *\r | |
597 | EFIAPI\r | |
598 | AllocateAlignedReservedCopyPool (\r | |
599 | IN UINTN AllocationSize,\r | |
600 | IN CONST VOID *Buffer,\r | |
601 | IN UINTN Alignment\r | |
1f33a17f | 602 | );\r |
878ddf1f | 603 | \r |
604 | /**\r | |
24e25d11 | 605 | Frees a buffer that was previously allocated with one of the aligned pool allocation functions \r |
606 | in the Memory Allocation Library.\r | |
878ddf1f | 607 | \r |
1f33a17f | 608 | Frees the buffer specified by Buffer. Buffer must have been allocated on a previous call to the\r |
609 | aligned pool allocation services of the Memory Allocation Library.\r | |
610 | If Buffer was not allocated with an aligned pool allocation function in the Memory Allocation\r | |
611 | Library, then ASSERT().\r | |
878ddf1f | 612 | \r |
1f33a17f | 613 | @param Buffer Pointer to the buffer to free.\r |
878ddf1f | 614 | \r |
615 | **/\r | |
616 | VOID\r | |
617 | EFIAPI\r | |
618 | FreeAlignedPool (\r | |
619 | IN VOID *Buffer\r | |
1f33a17f | 620 | );\r |
878ddf1f | 621 | \r |
622 | #endif\r |