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