2 Support routines for memory allocation routines based
3 on boot services for Dxe phase drivers.
5 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
12 #include <Library/MemoryAllocationLib.h>
13 #include <Library/UefiBootServicesTableLib.h>
14 #include <Library/BaseMemoryLib.h>
15 #include <Library/DebugLib.h>
18 Allocates one or more 4KB pages of a certain memory type.
20 Allocates the number of 4KB pages of a certain memory type and returns a pointer to the allocated
21 buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL is returned.
22 If there is not enough memory remaining to satisfy the request, then NULL is returned.
24 @param MemoryType The type of memory to allocate.
25 @param Pages The number of 4 KB pages to allocate.
27 @return A pointer to the allocated buffer or NULL if allocation fails.
31 InternalAllocatePages (
32 IN EFI_MEMORY_TYPE MemoryType
,
37 EFI_PHYSICAL_ADDRESS Memory
;
43 Status
= gBS
->AllocatePages (AllocateAnyPages
, MemoryType
, Pages
, &Memory
);
44 if (EFI_ERROR (Status
)) {
48 return (VOID
*)(UINTN
)Memory
;
52 Allocates one or more 4KB pages of type EfiBootServicesData.
54 Allocates the number of 4KB pages of type EfiBootServicesData and returns a pointer to the
55 allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL
56 is returned. If there is not enough memory remaining to satisfy the request, then NULL is
59 @param Pages The number of 4 KB pages to allocate.
61 @return A pointer to the allocated buffer or NULL if allocation fails.
70 return InternalAllocatePages (EfiBootServicesData
, Pages
);
74 Allocates one or more 4KB pages of type EfiRuntimeServicesData.
76 Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a pointer to the
77 allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL
78 is returned. If there is not enough memory remaining to satisfy the request, then NULL is
81 @param Pages The number of 4 KB pages to allocate.
83 @return A pointer to the allocated buffer or NULL if allocation fails.
88 AllocateRuntimePages (
92 return InternalAllocatePages (EfiRuntimeServicesData
, Pages
);
96 Allocates one or more 4KB pages of type EfiReservedMemoryType.
98 Allocates the number of 4KB pages of type EfiReservedMemoryType and returns a pointer to the
99 allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL
100 is returned. If there is not enough memory remaining to satisfy the request, then NULL is
103 @param Pages The number of 4 KB pages to allocate.
105 @return A pointer to the allocated buffer or NULL if allocation fails.
110 AllocateReservedPages (
114 return InternalAllocatePages (EfiReservedMemoryType
, Pages
);
118 Frees one or more 4KB pages that were previously allocated with one of the page allocation
119 functions in the Memory Allocation Library.
121 Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer
122 must have been allocated on a previous call to the page allocation services of the Memory
123 Allocation Library. If it is not possible to free allocated pages, then this function will
126 If Buffer was not allocated with a page allocation function in the Memory Allocation Library,
128 If Pages is zero, then ASSERT().
130 @param Buffer The pointer to the buffer of pages to free.
131 @param Pages The number of 4 KB pages to free.
144 Status
= gBS
->FreePages ((EFI_PHYSICAL_ADDRESS
)(UINTN
)Buffer
, Pages
);
145 ASSERT_EFI_ERROR (Status
);
149 Allocates one or more 4KB pages of a certain memory type at a specified alignment.
151 Allocates the number of 4KB pages specified by Pages of a certain memory type with an alignment
152 specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is returned.
153 If there is not enough memory at the specified alignment remaining to satisfy the request, then
155 If Alignment is not a power of two and Alignment is not zero, then ASSERT().
156 If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().
158 @param MemoryType The type of memory to allocate.
159 @param Pages The number of 4 KB pages to allocate.
160 @param Alignment The requested alignment of the allocation. Must be a power of two.
161 If Alignment is zero, then byte alignment is used.
163 @return A pointer to the allocated buffer or NULL if allocation fails.
167 InternalAllocateAlignedPages (
168 IN EFI_MEMORY_TYPE MemoryType
,
174 EFI_PHYSICAL_ADDRESS Memory
;
177 UINTN UnalignedPages
;
181 // Alignment must be a power of two or zero.
183 ASSERT ((Alignment
& (Alignment
- 1)) == 0);
189 if (Alignment
> EFI_PAGE_SIZE
) {
191 // Calculate the total number of pages since alignment is larger than page size.
193 AlignmentMask
= Alignment
- 1;
194 RealPages
= Pages
+ EFI_SIZE_TO_PAGES (Alignment
);
196 // Make sure that Pages plus EFI_SIZE_TO_PAGES (Alignment) does not overflow.
198 ASSERT (RealPages
> Pages
);
200 Status
= gBS
->AllocatePages (AllocateAnyPages
, MemoryType
, RealPages
, &Memory
);
201 if (EFI_ERROR (Status
)) {
205 AlignedMemory
= ((UINTN
)Memory
+ AlignmentMask
) & ~AlignmentMask
;
206 UnalignedPages
= EFI_SIZE_TO_PAGES (AlignedMemory
- (UINTN
)Memory
);
207 if (UnalignedPages
> 0) {
209 // Free first unaligned page(s).
211 Status
= gBS
->FreePages (Memory
, UnalignedPages
);
212 ASSERT_EFI_ERROR (Status
);
215 Memory
= AlignedMemory
+ EFI_PAGES_TO_SIZE (Pages
);
216 UnalignedPages
= RealPages
- Pages
- UnalignedPages
;
217 if (UnalignedPages
> 0) {
219 // Free last unaligned page(s).
221 Status
= gBS
->FreePages (Memory
, UnalignedPages
);
222 ASSERT_EFI_ERROR (Status
);
226 // Do not over-allocate pages in this case.
228 Status
= gBS
->AllocatePages (AllocateAnyPages
, MemoryType
, Pages
, &Memory
);
229 if (EFI_ERROR (Status
)) {
233 AlignedMemory
= (UINTN
)Memory
;
236 return (VOID
*)AlignedMemory
;
240 Allocates one or more 4KB pages of type EfiBootServicesData at a specified alignment.
242 Allocates the number of 4KB pages specified by Pages of type EfiBootServicesData with an
243 alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is
244 returned. If there is not enough memory at the specified alignment remaining to satisfy the
245 request, then NULL is returned.
247 If Alignment is not a power of two and Alignment is not zero, then ASSERT().
248 If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().
250 @param Pages The number of 4 KB pages to allocate.
251 @param Alignment The requested alignment of the allocation. Must be a power of two.
252 If Alignment is zero, then byte alignment is used.
254 @return A pointer to the allocated buffer or NULL if allocation fails.
259 AllocateAlignedPages (
264 return InternalAllocateAlignedPages (EfiBootServicesData
, Pages
, Alignment
);
268 Allocates one or more 4KB pages of type EfiRuntimeServicesData at a specified alignment.
270 Allocates the number of 4KB pages specified by Pages of type EfiRuntimeServicesData with an
271 alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is
272 returned. If there is not enough memory at the specified alignment remaining to satisfy the
273 request, then NULL is returned.
275 If Alignment is not a power of two and Alignment is not zero, then ASSERT().
276 If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().
278 @param Pages The number of 4 KB pages to allocate.
279 @param Alignment The requested alignment of the allocation. Must be a power of two.
280 If Alignment is zero, then byte alignment is used.
282 @return A pointer to the allocated buffer or NULL if allocation fails.
287 AllocateAlignedRuntimePages (
292 return InternalAllocateAlignedPages (EfiRuntimeServicesData
, Pages
, Alignment
);
296 Allocates one or more 4KB pages of type EfiReservedMemoryType at a specified alignment.
298 Allocates the number of 4KB pages specified by Pages of type EfiReservedMemoryType with an
299 alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is
300 returned. If there is not enough memory at the specified alignment remaining to satisfy the
301 request, then NULL is returned.
303 If Alignment is not a power of two and Alignment is not zero, then ASSERT().
304 If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().
306 @param Pages The number of 4 KB pages to allocate.
307 @param Alignment The requested alignment of the allocation. Must be a power of two.
308 If Alignment is zero, then byte alignment is used.
310 @return A pointer to the allocated buffer or NULL if allocation fails.
315 AllocateAlignedReservedPages (
320 return InternalAllocateAlignedPages (EfiReservedMemoryType
, Pages
, Alignment
);
324 Frees one or more 4KB pages that were previously allocated with one of the aligned page
325 allocation functions in the Memory Allocation Library.
327 Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer
328 must have been allocated on a previous call to the aligned page allocation services of the Memory
329 Allocation Library. If it is not possible to free allocated pages, then this function will
332 If Buffer was not allocated with an aligned page allocation function in the Memory Allocation
333 Library, then ASSERT().
334 If Pages is zero, then ASSERT().
336 @param Buffer The pointer to the buffer of pages to free.
337 @param Pages The number of 4 KB pages to free.
350 Status
= gBS
->FreePages ((EFI_PHYSICAL_ADDRESS
)(UINTN
)Buffer
, Pages
);
351 ASSERT_EFI_ERROR (Status
);
355 Allocates a buffer of a certain pool type.
357 Allocates the number bytes specified by AllocationSize of a certain pool type and returns a
358 pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
359 returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
361 @param MemoryType The type of memory to allocate.
362 @param AllocationSize The number of bytes to allocate.
364 @return A pointer to the allocated buffer or NULL if allocation fails.
368 InternalAllocatePool (
369 IN EFI_MEMORY_TYPE MemoryType
,
370 IN UINTN AllocationSize
376 Status
= gBS
->AllocatePool (MemoryType
, AllocationSize
, &Memory
);
377 if (EFI_ERROR (Status
)) {
385 Allocates a buffer of type EfiBootServicesData.
387 Allocates the number bytes specified by AllocationSize of type EfiBootServicesData and returns a
388 pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
389 returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
391 @param AllocationSize The number of bytes to allocate.
393 @return A pointer to the allocated buffer or NULL if allocation fails.
399 IN UINTN AllocationSize
402 return InternalAllocatePool (EfiBootServicesData
, AllocationSize
);
406 Allocates a buffer of type EfiRuntimeServicesData.
408 Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData and returns
409 a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
410 returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
412 @param AllocationSize The number of bytes to allocate.
414 @return A pointer to the allocated buffer or NULL if allocation fails.
419 AllocateRuntimePool (
420 IN UINTN AllocationSize
423 return InternalAllocatePool (EfiRuntimeServicesData
, AllocationSize
);
427 Allocates a buffer of type EfiReservedMemoryType.
429 Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType and returns
430 a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
431 returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
433 @param AllocationSize The number of bytes to allocate.
435 @return A pointer to the allocated buffer or NULL if allocation fails.
440 AllocateReservedPool (
441 IN UINTN AllocationSize
444 return InternalAllocatePool (EfiReservedMemoryType
, AllocationSize
);
448 Allocates and zeros a buffer of a certain pool type.
450 Allocates the number bytes specified by AllocationSize of a certain pool type, clears the buffer
451 with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid
452 buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request,
453 then NULL is returned.
455 @param PoolType The type of memory to allocate.
456 @param AllocationSize The number of bytes to allocate and zero.
458 @return A pointer to the allocated buffer or NULL if allocation fails.
462 InternalAllocateZeroPool (
463 IN EFI_MEMORY_TYPE PoolType
,
464 IN UINTN AllocationSize
469 Memory
= InternalAllocatePool (PoolType
, AllocationSize
);
470 if (Memory
!= NULL
) {
471 Memory
= ZeroMem (Memory
, AllocationSize
);
478 Allocates and zeros a buffer of type EfiBootServicesData.
480 Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, clears the
481 buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
482 valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the
483 request, then NULL is returned.
485 @param AllocationSize The number of bytes to allocate and zero.
487 @return A pointer to the allocated buffer or NULL if allocation fails.
493 IN UINTN AllocationSize
496 return InternalAllocateZeroPool (EfiBootServicesData
, AllocationSize
);
500 Allocates and zeros a buffer of type EfiRuntimeServicesData.
502 Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, clears the
503 buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
504 valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the
505 request, then NULL is returned.
507 @param AllocationSize The number of bytes to allocate and zero.
509 @return A pointer to the allocated buffer or NULL if allocation fails.
514 AllocateRuntimeZeroPool (
515 IN UINTN AllocationSize
518 return InternalAllocateZeroPool (EfiRuntimeServicesData
, AllocationSize
);
522 Allocates and zeros a buffer of type EfiReservedMemoryType.
524 Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, clears the
525 buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
526 valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the
527 request, then NULL is returned.
529 @param AllocationSize The number of bytes to allocate and zero.
531 @return A pointer to the allocated buffer or NULL if allocation fails.
536 AllocateReservedZeroPool (
537 IN UINTN AllocationSize
540 return InternalAllocateZeroPool (EfiReservedMemoryType
, AllocationSize
);
544 Copies a buffer to an allocated buffer of a certain pool type.
546 Allocates the number bytes specified by AllocationSize of a certain pool type, copies
547 AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the
548 allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
549 is not enough memory remaining to satisfy the request, then NULL is returned.
550 If Buffer is NULL, then ASSERT().
551 If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
553 @param PoolType The type of pool to allocate.
554 @param AllocationSize The number of bytes to allocate and zero.
555 @param Buffer The buffer to copy to the allocated buffer.
557 @return A pointer to the allocated buffer or NULL if allocation fails.
561 InternalAllocateCopyPool (
562 IN EFI_MEMORY_TYPE PoolType
,
563 IN UINTN AllocationSize
,
564 IN CONST VOID
*Buffer
569 ASSERT (Buffer
!= NULL
);
570 ASSERT (AllocationSize
<= (MAX_ADDRESS
- (UINTN
)Buffer
+ 1));
572 Memory
= InternalAllocatePool (PoolType
, AllocationSize
);
573 if (Memory
!= NULL
) {
574 Memory
= CopyMem (Memory
, Buffer
, AllocationSize
);
581 Copies a buffer to an allocated buffer of type EfiBootServicesData.
583 Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, copies
584 AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the
585 allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
586 is not enough memory remaining to satisfy the request, then NULL is returned.
588 If Buffer is NULL, then ASSERT().
589 If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
591 @param AllocationSize The number of bytes to allocate and zero.
592 @param Buffer The buffer to copy to the allocated buffer.
594 @return A pointer to the allocated buffer or NULL if allocation fails.
600 IN UINTN AllocationSize
,
601 IN CONST VOID
*Buffer
604 return InternalAllocateCopyPool (EfiBootServicesData
, AllocationSize
, Buffer
);
608 Copies a buffer to an allocated buffer of type EfiRuntimeServicesData.
610 Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, copies
611 AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the
612 allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
613 is not enough memory remaining to satisfy the request, then NULL is returned.
615 If Buffer is NULL, then ASSERT().
616 If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
618 @param AllocationSize The number of bytes to allocate and zero.
619 @param Buffer The buffer to copy to the allocated buffer.
621 @return A pointer to the allocated buffer or NULL if allocation fails.
626 AllocateRuntimeCopyPool (
627 IN UINTN AllocationSize
,
628 IN CONST VOID
*Buffer
631 return InternalAllocateCopyPool (EfiRuntimeServicesData
, AllocationSize
, Buffer
);
635 Copies a buffer to an allocated buffer of type EfiReservedMemoryType.
637 Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, copies
638 AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the
639 allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
640 is not enough memory remaining to satisfy the request, then NULL is returned.
642 If Buffer is NULL, then ASSERT().
643 If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
645 @param AllocationSize The number of bytes to allocate and zero.
646 @param Buffer The buffer to copy to the allocated buffer.
648 @return A pointer to the allocated buffer or NULL if allocation fails.
653 AllocateReservedCopyPool (
654 IN UINTN AllocationSize
,
655 IN CONST VOID
*Buffer
658 return InternalAllocateCopyPool (EfiReservedMemoryType
, AllocationSize
, Buffer
);
662 Reallocates a buffer of a specified memory type.
664 Allocates and zeros the number bytes specified by NewSize from memory of the type
665 specified by PoolType. If OldBuffer is not NULL, then the smaller of OldSize and
666 NewSize bytes are copied from OldBuffer to the newly allocated buffer, and
667 OldBuffer is freed. A pointer to the newly allocated buffer is returned.
668 If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
669 enough memory remaining to satisfy the request, then NULL is returned.
671 If the allocation of the new buffer is successful and the smaller of NewSize and OldSize
672 is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
674 @param PoolType The type of pool to allocate.
675 @param OldSize The size, in bytes, of OldBuffer.
676 @param NewSize The size, in bytes, of the buffer to reallocate.
677 @param OldBuffer The buffer to copy to the allocated buffer. This is an optional
678 parameter that may be NULL.
680 @return A pointer to the allocated buffer or NULL if allocation fails.
684 InternalReallocatePool (
685 IN EFI_MEMORY_TYPE PoolType
,
688 IN VOID
*OldBuffer OPTIONAL
693 NewBuffer
= InternalAllocateZeroPool (PoolType
, NewSize
);
694 if ((NewBuffer
!= NULL
) && (OldBuffer
!= NULL
)) {
695 CopyMem (NewBuffer
, OldBuffer
, MIN (OldSize
, NewSize
));
696 FreePool (OldBuffer
);
703 Reallocates a buffer of type EfiBootServicesData.
705 Allocates and zeros the number bytes specified by NewSize from memory of type
706 EfiBootServicesData. If OldBuffer is not NULL, then the smaller of OldSize and
707 NewSize bytes are copied from OldBuffer to the newly allocated buffer, and
708 OldBuffer is freed. A pointer to the newly allocated buffer is returned.
709 If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
710 enough memory remaining to satisfy the request, then NULL is returned.
712 If the allocation of the new buffer is successful and the smaller of NewSize and OldSize
713 is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
715 @param OldSize The size, in bytes, of OldBuffer.
716 @param NewSize The size, in bytes, of the buffer to reallocate.
717 @param OldBuffer The buffer to copy to the allocated buffer. This is an optional
718 parameter that may be NULL.
720 @return A pointer to the allocated buffer or NULL if allocation fails.
728 IN VOID
*OldBuffer OPTIONAL
731 return InternalReallocatePool (EfiBootServicesData
, OldSize
, NewSize
, OldBuffer
);
735 Reallocates a buffer of type EfiRuntimeServicesData.
737 Allocates and zeros the number bytes specified by NewSize from memory of type
738 EfiRuntimeServicesData. If OldBuffer is not NULL, then the smaller of OldSize and
739 NewSize bytes are copied from OldBuffer to the newly allocated buffer, and
740 OldBuffer is freed. A pointer to the newly allocated buffer is returned.
741 If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
742 enough memory remaining to satisfy the request, then NULL is returned.
744 If the allocation of the new buffer is successful and the smaller of NewSize and OldSize
745 is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
747 @param OldSize The size, in bytes, of OldBuffer.
748 @param NewSize The size, in bytes, of the buffer to reallocate.
749 @param OldBuffer The buffer to copy to the allocated buffer. This is an optional
750 parameter that may be NULL.
752 @return A pointer to the allocated buffer or NULL if allocation fails.
757 ReallocateRuntimePool (
760 IN VOID
*OldBuffer OPTIONAL
763 return InternalReallocatePool (EfiRuntimeServicesData
, OldSize
, NewSize
, OldBuffer
);
767 Reallocates a buffer of type EfiReservedMemoryType.
769 Allocates and zeros the number bytes specified by NewSize from memory of type
770 EfiReservedMemoryType. If OldBuffer is not NULL, then the smaller of OldSize and
771 NewSize bytes are copied from OldBuffer to the newly allocated buffer, and
772 OldBuffer is freed. A pointer to the newly allocated buffer is returned.
773 If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
774 enough memory remaining to satisfy the request, then NULL is returned.
776 If the allocation of the new buffer is successful and the smaller of NewSize and OldSize
777 is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
779 @param OldSize The size, in bytes, of OldBuffer.
780 @param NewSize The size, in bytes, of the buffer to reallocate.
781 @param OldBuffer The buffer to copy to the allocated buffer. This is an optional
782 parameter that may be NULL.
784 @return A pointer to the allocated buffer or NULL if allocation fails.
789 ReallocateReservedPool (
792 IN VOID
*OldBuffer OPTIONAL
795 return InternalReallocatePool (EfiReservedMemoryType
, OldSize
, NewSize
, OldBuffer
);
799 Frees a buffer that was previously allocated with one of the pool allocation functions in the
800 Memory Allocation Library.
802 Frees the buffer specified by Buffer. Buffer must have been allocated on a previous call to the
803 pool allocation services of the Memory Allocation Library. If it is not possible to free pool
804 resources, then this function will perform no actions.
806 If Buffer was not allocated with a pool allocation function in the Memory Allocation Library,
809 @param Buffer The pointer to the buffer to free.
820 Status
= gBS
->FreePool (Buffer
);
821 ASSERT_EFI_ERROR (Status
);