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
14 #include <Library/MemoryAllocationLib.h>
15 #include <Library/UefiBootServicesTableLib.h>
16 #include <Library/BaseMemoryLib.h>
17 #include <Library/DebugLib.h>
20 Allocates one or more 4KB pages of a certain memory type.
22 Allocates the number of 4KB pages of a certain memory type and returns a pointer to the allocated
23 buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL is returned.
24 If there is not enough memory remaining to satisfy the request, then NULL is returned.
26 @param MemoryType The type of memory to allocate.
27 @param Pages The number of 4 KB pages to allocate.
29 @return A pointer to the allocated buffer or NULL if allocation fails.
33 InternalAllocatePages (
34 IN EFI_MEMORY_TYPE MemoryType
,
39 EFI_PHYSICAL_ADDRESS Memory
;
45 Status
= gBS
->AllocatePages (AllocateAnyPages
, MemoryType
, Pages
, &Memory
);
46 if (EFI_ERROR (Status
)) {
49 return (VOID
*) (UINTN
) Memory
;
53 Allocates one or more 4KB pages of type EfiBootServicesData.
55 Allocates the number of 4KB pages of type EfiBootServicesData and returns a pointer to the
56 allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL
57 is returned. If there is not enough memory remaining to satisfy the request, then NULL is
60 @param Pages The number of 4 KB pages to allocate.
62 @return A pointer to the allocated buffer or NULL if allocation fails.
71 return InternalAllocatePages (EfiBootServicesData
, Pages
);
75 Allocates one or more 4KB pages of type EfiRuntimeServicesData.
77 Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a pointer to the
78 allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL
79 is returned. If there is not enough memory remaining to satisfy the request, then NULL is
82 @param Pages The number of 4 KB pages to allocate.
84 @return A pointer to the allocated buffer or NULL if allocation fails.
89 AllocateRuntimePages (
93 return InternalAllocatePages (EfiRuntimeServicesData
, Pages
);
97 Allocates one or more 4KB pages of type EfiReservedMemoryType.
99 Allocates the number of 4KB pages of type EfiReservedMemoryType and returns a pointer to the
100 allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL
101 is returned. If there is not enough memory remaining to satisfy the request, then NULL is
104 @param Pages The number of 4 KB pages to allocate.
106 @return A pointer to the allocated buffer or NULL if allocation fails.
111 AllocateReservedPages (
115 return InternalAllocatePages (EfiReservedMemoryType
, Pages
);
119 Frees one or more 4KB pages that were previously allocated with one of the page allocation
120 functions in the Memory Allocation Library.
122 Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer
123 must have been allocated on a previous call to the page allocation services of the Memory
124 Allocation Library. If it is not possible to free allocated pages, then this function will
127 If Buffer was not allocated with a page allocation function in the Memory Allocation Library,
129 If Pages is zero, then ASSERT().
131 @param Buffer The pointer to the buffer of pages to free.
132 @param Pages The number of 4 KB pages to free.
145 Status
= gBS
->FreePages ((EFI_PHYSICAL_ADDRESS
) (UINTN
) Buffer
, Pages
);
146 ASSERT_EFI_ERROR (Status
);
150 Allocates one or more 4KB pages of a certain memory type at a specified alignment.
152 Allocates the number of 4KB pages specified by Pages of a certain memory type with an alignment
153 specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is returned.
154 If there is not enough memory at the specified alignment remaining to satisfy the request, then
156 If Alignment is not a power of two and Alignment is not zero, then ASSERT().
157 If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().
159 @param MemoryType The type of memory to allocate.
160 @param Pages The number of 4 KB pages to allocate.
161 @param Alignment The requested alignment of the allocation. Must be a power of two.
162 If Alignment is zero, then byte alignment is used.
164 @return A pointer to the allocated buffer or NULL if allocation fails.
168 InternalAllocateAlignedPages (
169 IN EFI_MEMORY_TYPE MemoryType
,
175 EFI_PHYSICAL_ADDRESS Memory
;
178 UINTN UnalignedPages
;
182 // Alignment must be a power of two or zero.
184 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
)) {
204 AlignedMemory
= ((UINTN
) Memory
+ AlignmentMask
) & ~AlignmentMask
;
205 UnalignedPages
= EFI_SIZE_TO_PAGES (AlignedMemory
- (UINTN
) Memory
);
206 if (UnalignedPages
> 0) {
208 // Free first unaligned page(s).
210 Status
= gBS
->FreePages (Memory
, UnalignedPages
);
211 ASSERT_EFI_ERROR (Status
);
213 Memory
= AlignedMemory
+ EFI_PAGES_TO_SIZE (Pages
);
214 UnalignedPages
= RealPages
- Pages
- UnalignedPages
;
215 if (UnalignedPages
> 0) {
217 // Free last unaligned page(s).
219 Status
= gBS
->FreePages (Memory
, UnalignedPages
);
220 ASSERT_EFI_ERROR (Status
);
224 // Do not over-allocate pages in this case.
226 Status
= gBS
->AllocatePages (AllocateAnyPages
, MemoryType
, Pages
, &Memory
);
227 if (EFI_ERROR (Status
)) {
230 AlignedMemory
= (UINTN
) Memory
;
232 return (VOID
*) AlignedMemory
;
236 Allocates one or more 4KB pages of type EfiBootServicesData at a specified alignment.
238 Allocates the number of 4KB pages specified by Pages of type EfiBootServicesData with an
239 alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is
240 returned. If there is not enough memory at the specified alignment remaining to satisfy the
241 request, then NULL is returned.
243 If Alignment is not a power of two and Alignment is not zero, then ASSERT().
244 If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().
246 @param Pages The number of 4 KB pages to allocate.
247 @param Alignment The requested alignment of the allocation. Must be a power of two.
248 If Alignment is zero, then byte alignment is used.
250 @return A pointer to the allocated buffer or NULL if allocation fails.
255 AllocateAlignedPages (
260 return InternalAllocateAlignedPages (EfiBootServicesData
, Pages
, Alignment
);
264 Allocates one or more 4KB pages of type EfiRuntimeServicesData at a specified alignment.
266 Allocates the number of 4KB pages specified by Pages of type EfiRuntimeServicesData with an
267 alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is
268 returned. If there is not enough memory at the specified alignment remaining to satisfy the
269 request, then NULL is returned.
271 If Alignment is not a power of two and Alignment is not zero, then ASSERT().
272 If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().
274 @param Pages The number of 4 KB pages to allocate.
275 @param Alignment The requested alignment of the allocation. Must be a power of two.
276 If Alignment is zero, then byte alignment is used.
278 @return A pointer to the allocated buffer or NULL if allocation fails.
283 AllocateAlignedRuntimePages (
288 return InternalAllocateAlignedPages (EfiRuntimeServicesData
, Pages
, Alignment
);
292 Allocates one or more 4KB pages of type EfiReservedMemoryType at a specified alignment.
294 Allocates the number of 4KB pages specified by Pages of type EfiReservedMemoryType with an
295 alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is
296 returned. If there is not enough memory at the specified alignment remaining to satisfy the
297 request, then NULL is returned.
299 If Alignment is not a power of two and Alignment is not zero, then ASSERT().
300 If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().
302 @param Pages The number of 4 KB pages to allocate.
303 @param Alignment The requested alignment of the allocation. Must be a power of two.
304 If Alignment is zero, then byte alignment is used.
306 @return A pointer to the allocated buffer or NULL if allocation fails.
311 AllocateAlignedReservedPages (
316 return InternalAllocateAlignedPages (EfiReservedMemoryType
, Pages
, Alignment
);
320 Frees one or more 4KB pages that were previously allocated with one of the aligned page
321 allocation functions in the Memory Allocation Library.
323 Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer
324 must have been allocated on a previous call to the aligned page allocation services of the Memory
325 Allocation Library. If it is not possible to free allocated pages, then this function will
328 If Buffer was not allocated with an aligned page allocation function in the Memory Allocation
329 Library, then ASSERT().
330 If Pages is zero, then ASSERT().
332 @param Buffer The pointer to the buffer of pages to free.
333 @param Pages The number of 4 KB pages to free.
346 Status
= gBS
->FreePages ((EFI_PHYSICAL_ADDRESS
) (UINTN
) Buffer
, Pages
);
347 ASSERT_EFI_ERROR (Status
);
351 Allocates a buffer of a certain pool type.
353 Allocates the number bytes specified by AllocationSize of a certain pool type and returns a
354 pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
355 returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
357 @param MemoryType The type of memory to allocate.
358 @param AllocationSize The number of bytes to allocate.
360 @return A pointer to the allocated buffer or NULL if allocation fails.
364 InternalAllocatePool (
365 IN EFI_MEMORY_TYPE MemoryType
,
366 IN UINTN AllocationSize
372 Status
= gBS
->AllocatePool (MemoryType
, AllocationSize
, &Memory
);
373 if (EFI_ERROR (Status
)) {
380 Allocates a buffer of type EfiBootServicesData.
382 Allocates the number bytes specified by AllocationSize of type EfiBootServicesData and returns a
383 pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
384 returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
386 @param AllocationSize The number of bytes to allocate.
388 @return A pointer to the allocated buffer or NULL if allocation fails.
394 IN UINTN AllocationSize
397 return InternalAllocatePool (EfiBootServicesData
, AllocationSize
);
401 Allocates a buffer of type EfiRuntimeServicesData.
403 Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData and returns
404 a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
405 returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
407 @param AllocationSize The number of bytes to allocate.
409 @return A pointer to the allocated buffer or NULL if allocation fails.
414 AllocateRuntimePool (
415 IN UINTN AllocationSize
418 return InternalAllocatePool (EfiRuntimeServicesData
, AllocationSize
);
422 Allocates a buffer of type EfiReservedMemoryType.
424 Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType and returns
425 a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
426 returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
428 @param AllocationSize The number of bytes to allocate.
430 @return A pointer to the allocated buffer or NULL if allocation fails.
435 AllocateReservedPool (
436 IN UINTN AllocationSize
439 return InternalAllocatePool (EfiReservedMemoryType
, AllocationSize
);
443 Allocates and zeros a buffer of a certain pool type.
445 Allocates the number bytes specified by AllocationSize of a certain pool type, clears the buffer
446 with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid
447 buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request,
448 then NULL is returned.
450 @param PoolType The type of memory to allocate.
451 @param AllocationSize The number of bytes to allocate and zero.
453 @return A pointer to the allocated buffer or NULL if allocation fails.
457 InternalAllocateZeroPool (
458 IN EFI_MEMORY_TYPE PoolType
,
459 IN UINTN AllocationSize
464 Memory
= InternalAllocatePool (PoolType
, AllocationSize
);
465 if (Memory
!= NULL
) {
466 Memory
= ZeroMem (Memory
, AllocationSize
);
472 Allocates and zeros a buffer of type EfiBootServicesData.
474 Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, clears the
475 buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
476 valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the
477 request, then NULL is returned.
479 @param AllocationSize The number of bytes to allocate and zero.
481 @return A pointer to the allocated buffer or NULL if allocation fails.
487 IN UINTN AllocationSize
490 return InternalAllocateZeroPool (EfiBootServicesData
, AllocationSize
);
494 Allocates and zeros a buffer of type EfiRuntimeServicesData.
496 Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, clears the
497 buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
498 valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the
499 request, then NULL is returned.
501 @param AllocationSize The number of bytes to allocate and zero.
503 @return A pointer to the allocated buffer or NULL if allocation fails.
508 AllocateRuntimeZeroPool (
509 IN UINTN AllocationSize
512 return InternalAllocateZeroPool (EfiRuntimeServicesData
, AllocationSize
);
516 Allocates and zeros a buffer of type EfiReservedMemoryType.
518 Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, clears the
519 buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
520 valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the
521 request, then NULL is returned.
523 @param AllocationSize The number of bytes to allocate and zero.
525 @return A pointer to the allocated buffer or NULL if allocation fails.
530 AllocateReservedZeroPool (
531 IN UINTN AllocationSize
534 return InternalAllocateZeroPool (EfiReservedMemoryType
, AllocationSize
);
538 Copies a buffer to an allocated buffer of a certain pool type.
540 Allocates the number bytes specified by AllocationSize of a certain pool type, copies
541 AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the
542 allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
543 is not enough memory remaining to satisfy the request, then NULL is returned.
544 If Buffer is NULL, then ASSERT().
545 If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
547 @param PoolType The type of pool to allocate.
548 @param AllocationSize The number of bytes to allocate and zero.
549 @param Buffer The buffer to copy to the allocated buffer.
551 @return A pointer to the allocated buffer or NULL if allocation fails.
555 InternalAllocateCopyPool (
556 IN EFI_MEMORY_TYPE PoolType
,
557 IN UINTN AllocationSize
,
558 IN CONST VOID
*Buffer
563 ASSERT (Buffer
!= NULL
);
564 ASSERT (AllocationSize
<= (MAX_ADDRESS
- (UINTN
) Buffer
+ 1));
566 Memory
= InternalAllocatePool (PoolType
, AllocationSize
);
567 if (Memory
!= NULL
) {
568 Memory
= CopyMem (Memory
, Buffer
, AllocationSize
);
574 Copies a buffer to an allocated buffer of type EfiBootServicesData.
576 Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, copies
577 AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the
578 allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
579 is not enough memory remaining to satisfy the request, then NULL is returned.
581 If Buffer is NULL, then ASSERT().
582 If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
584 @param AllocationSize The number of bytes to allocate and zero.
585 @param Buffer The buffer to copy to the allocated buffer.
587 @return A pointer to the allocated buffer or NULL if allocation fails.
593 IN UINTN AllocationSize
,
594 IN CONST VOID
*Buffer
597 return InternalAllocateCopyPool (EfiBootServicesData
, AllocationSize
, Buffer
);
601 Copies a buffer to an allocated buffer of type EfiRuntimeServicesData.
603 Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, copies
604 AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the
605 allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
606 is not enough memory remaining to satisfy the request, then NULL is returned.
608 If Buffer is NULL, then ASSERT().
609 If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
611 @param AllocationSize The number of bytes to allocate and zero.
612 @param Buffer The buffer to copy to the allocated buffer.
614 @return A pointer to the allocated buffer or NULL if allocation fails.
619 AllocateRuntimeCopyPool (
620 IN UINTN AllocationSize
,
621 IN CONST VOID
*Buffer
624 return InternalAllocateCopyPool (EfiRuntimeServicesData
, AllocationSize
, Buffer
);
628 Copies a buffer to an allocated buffer of type EfiReservedMemoryType.
630 Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, copies
631 AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the
632 allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
633 is not enough memory remaining to satisfy the request, then NULL is returned.
635 If Buffer is NULL, then ASSERT().
636 If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
638 @param AllocationSize The number of bytes to allocate and zero.
639 @param Buffer The buffer to copy to the allocated buffer.
641 @return A pointer to the allocated buffer or NULL if allocation fails.
646 AllocateReservedCopyPool (
647 IN UINTN AllocationSize
,
648 IN CONST VOID
*Buffer
651 return InternalAllocateCopyPool (EfiReservedMemoryType
, AllocationSize
, Buffer
);
655 Reallocates a buffer of a specified memory type.
657 Allocates and zeros the number bytes specified by NewSize from memory of the type
658 specified by PoolType. If OldBuffer is not NULL, then the smaller of OldSize and
659 NewSize bytes are copied from OldBuffer to the newly allocated buffer, and
660 OldBuffer is freed. A pointer to the newly allocated buffer is returned.
661 If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
662 enough memory remaining to satisfy the request, then NULL is returned.
664 If the allocation of the new buffer is successful and the smaller of NewSize and OldSize
665 is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
667 @param PoolType The type of pool to allocate.
668 @param OldSize The size, in bytes, of OldBuffer.
669 @param NewSize The size, in bytes, of the buffer to reallocate.
670 @param OldBuffer The buffer to copy to the allocated buffer. This is an optional
671 parameter that may be NULL.
673 @return A pointer to the allocated buffer or NULL if allocation fails.
677 InternalReallocatePool (
678 IN EFI_MEMORY_TYPE PoolType
,
681 IN VOID
*OldBuffer OPTIONAL
686 NewBuffer
= InternalAllocateZeroPool (PoolType
, NewSize
);
687 if (NewBuffer
!= NULL
&& OldBuffer
!= NULL
) {
688 CopyMem (NewBuffer
, OldBuffer
, MIN (OldSize
, NewSize
));
689 FreePool (OldBuffer
);
695 Reallocates a buffer of type EfiBootServicesData.
697 Allocates and zeros the number bytes specified by NewSize from memory of type
698 EfiBootServicesData. If OldBuffer is not NULL, then the smaller of OldSize and
699 NewSize bytes are copied from OldBuffer to the newly allocated buffer, and
700 OldBuffer is freed. A pointer to the newly allocated buffer is returned.
701 If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
702 enough memory remaining to satisfy the request, then NULL is returned.
704 If the allocation of the new buffer is successful and the smaller of NewSize and OldSize
705 is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
707 @param OldSize The size, in bytes, of OldBuffer.
708 @param NewSize The size, in bytes, of the buffer to reallocate.
709 @param OldBuffer The buffer to copy to the allocated buffer. This is an optional
710 parameter that may be NULL.
712 @return A pointer to the allocated buffer or NULL if allocation fails.
720 IN VOID
*OldBuffer OPTIONAL
723 return InternalReallocatePool (EfiBootServicesData
, OldSize
, NewSize
, OldBuffer
);
727 Reallocates a buffer of type EfiRuntimeServicesData.
729 Allocates and zeros the number bytes specified by NewSize from memory of type
730 EfiRuntimeServicesData. If OldBuffer is not NULL, then the smaller of OldSize and
731 NewSize bytes are copied from OldBuffer to the newly allocated buffer, and
732 OldBuffer is freed. A pointer to the newly allocated buffer is returned.
733 If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
734 enough memory remaining to satisfy the request, then NULL is returned.
736 If the allocation of the new buffer is successful and the smaller of NewSize and OldSize
737 is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
739 @param OldSize The size, in bytes, of OldBuffer.
740 @param NewSize The size, in bytes, of the buffer to reallocate.
741 @param OldBuffer The buffer to copy to the allocated buffer. This is an optional
742 parameter that may be NULL.
744 @return A pointer to the allocated buffer or NULL if allocation fails.
749 ReallocateRuntimePool (
752 IN VOID
*OldBuffer OPTIONAL
755 return InternalReallocatePool (EfiRuntimeServicesData
, OldSize
, NewSize
, OldBuffer
);
759 Reallocates a buffer of type EfiReservedMemoryType.
761 Allocates and zeros the number bytes specified by NewSize from memory of type
762 EfiReservedMemoryType. If OldBuffer is not NULL, then the smaller of OldSize and
763 NewSize bytes are copied from OldBuffer to the newly allocated buffer, and
764 OldBuffer is freed. A pointer to the newly allocated buffer is returned.
765 If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
766 enough memory remaining to satisfy the request, then NULL is returned.
768 If the allocation of the new buffer is successful and the smaller of NewSize and OldSize
769 is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
771 @param OldSize The size, in bytes, of OldBuffer.
772 @param NewSize The size, in bytes, of the buffer to reallocate.
773 @param OldBuffer The buffer to copy to the allocated buffer. This is an optional
774 parameter that may be NULL.
776 @return A pointer to the allocated buffer or NULL if allocation fails.
781 ReallocateReservedPool (
784 IN VOID
*OldBuffer OPTIONAL
787 return InternalReallocatePool (EfiReservedMemoryType
, OldSize
, NewSize
, OldBuffer
);
791 Frees a buffer that was previously allocated with one of the pool allocation functions in the
792 Memory Allocation Library.
794 Frees the buffer specified by Buffer. Buffer must have been allocated on a previous call to the
795 pool allocation services of the Memory Allocation Library. If it is not possible to free pool
796 resources, then this function will perform no actions.
798 If Buffer was not allocated with a pool allocation function in the Memory Allocation Library,
801 @param Buffer The pointer to the buffer to free.
812 Status
= gBS
->FreePool (Buffer
);
813 ASSERT_EFI_ERROR (Status
);