2 Support routines for memory allocation routines based on Standalone MM Core internal functions.
4 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
5 Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.<BR>
7 This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 #include <Library/BaseMemoryLib.h>
20 #include <Library/DebugLib.h>
21 #include <Library/MemoryAllocationLib.h>
22 #include <Library/MmServicesTableLib.h>
25 Allocates one or more 4KB pages of a certain memory type.
27 Allocates the number of 4KB pages of a certain memory type and returns a pointer to the allocated
28 buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL is returned.
29 If there is not enough memory remaining to satisfy the request, then NULL is returned.
31 @param MemoryType The type of memory to allocate.
32 @param Pages The number of 4 KB pages to allocate.
34 @return A pointer to the allocated buffer or NULL if allocation fails.
38 InternalAllocatePages (
39 IN EFI_MEMORY_TYPE MemoryType
,
44 EFI_PHYSICAL_ADDRESS Memory
;
50 Status
= gMmst
->MmAllocatePages (AllocateAnyPages
, MemoryType
, Pages
, &Memory
);
51 if (EFI_ERROR (Status
)) {
54 return (VOID
*)(UINTN
)Memory
;
58 Allocates one or more 4KB pages of type EfiBootServicesData.
60 Allocates the number of 4KB pages of type EfiBootServicesData and returns a pointer to the
61 allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL
62 is returned. If there is not enough memory remaining to satisfy the request, then NULL is
65 @param Pages The number of 4 KB pages to allocate.
67 @return A pointer to the allocated buffer or NULL if allocation fails.
76 return InternalAllocatePages (EfiRuntimeServicesData
, Pages
);
80 Allocates one or more 4KB pages of type EfiRuntimeServicesData.
82 Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a pointer to the
83 allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL
84 is returned. If there is not enough memory remaining to satisfy the request, then NULL is
87 @param Pages The number of 4 KB pages to allocate.
89 @return A pointer to the allocated buffer or NULL if allocation fails.
94 AllocateRuntimePages (
98 return InternalAllocatePages (EfiRuntimeServicesData
, Pages
);
102 Allocates one or more 4KB pages of type EfiReservedMemoryType.
104 Allocates the number of 4KB pages of type EfiReservedMemoryType and returns a pointer to the
105 allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL
106 is returned. If there is not enough memory remaining to satisfy the request, then NULL is
109 @param Pages The number of 4 KB pages to allocate.
111 @return A pointer to the allocated buffer or NULL if allocation fails.
116 AllocateReservedPages (
124 Frees one or more 4KB pages that were previously allocated with one of the page allocation
125 functions in the Memory Allocation Library.
127 Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer
128 must have been allocated on a previous call to the page allocation services of the Memory
129 Allocation Library. If it is not possible to free allocated pages, then this function will
132 If Buffer was not allocated with a page allocation function in the Memory Allocation Library,
134 If Pages is zero, then ASSERT().
136 @param Buffer Pointer to the buffer of pages to free.
137 @param Pages The number of 4 KB pages to free.
150 Status
= gMmst
->MmFreePages ((EFI_PHYSICAL_ADDRESS
) (UINTN
)Buffer
, Pages
);
151 ASSERT_EFI_ERROR (Status
);
155 Allocates one or more 4KB pages of a certain memory type at a specified alignment.
157 Allocates the number of 4KB pages specified by Pages of a certain memory type with an alignment
158 specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is returned.
159 If there is not enough memory at the specified alignment remaining to satisfy the request, then
161 If Alignment is not a power of two and Alignment is not zero, then ASSERT().
162 If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().
164 @param MemoryType The type of memory to allocate.
165 @param Pages The number of 4 KB pages to allocate.
166 @param Alignment The requested alignment of the allocation. Must be a power of two.
167 If Alignment is zero, then byte alignment is used.
169 @return A pointer to the allocated buffer or NULL if allocation fails.
173 InternalAllocateAlignedPages (
174 IN EFI_MEMORY_TYPE MemoryType
,
180 EFI_PHYSICAL_ADDRESS Memory
;
183 UINTN UnalignedPages
;
187 // Alignment must be a power of two or zero.
189 ASSERT ((Alignment
& (Alignment
- 1)) == 0);
194 if (Alignment
> EFI_PAGE_SIZE
) {
196 // Calculate the total number of pages since alignment is larger than page size.
198 AlignmentMask
= Alignment
- 1;
199 RealPages
= Pages
+ EFI_SIZE_TO_PAGES (Alignment
);
201 // Make sure that Pages plus EFI_SIZE_TO_PAGES (Alignment) does not overflow.
203 ASSERT (RealPages
> Pages
);
205 Status
= gMmst
->MmAllocatePages (AllocateAnyPages
, MemoryType
, RealPages
, &Memory
);
206 if (EFI_ERROR (Status
)) {
209 AlignedMemory
= ((UINTN
)Memory
+ AlignmentMask
) & ~AlignmentMask
;
210 UnalignedPages
= EFI_SIZE_TO_PAGES (AlignedMemory
- (UINTN
) Memory
);
211 if (UnalignedPages
> 0) {
213 // Free first unaligned page(s).
215 Status
= gMmst
->MmFreePages (Memory
, UnalignedPages
);
216 ASSERT_EFI_ERROR (Status
);
218 Memory
= (EFI_PHYSICAL_ADDRESS
)(AlignedMemory
+ EFI_PAGES_TO_SIZE (Pages
));
219 UnalignedPages
= RealPages
- Pages
- UnalignedPages
;
220 if (UnalignedPages
> 0) {
222 // Free last unaligned page(s).
224 Status
= gMmst
->MmFreePages (Memory
, UnalignedPages
);
225 ASSERT_EFI_ERROR (Status
);
229 // Do not over-allocate pages in this case.
231 Status
= gMmst
->MmAllocatePages (AllocateAnyPages
, MemoryType
, Pages
, &Memory
);
232 if (EFI_ERROR (Status
)) {
235 AlignedMemory
= (UINTN
) Memory
;
237 return (VOID
*) AlignedMemory
;
241 Allocates one or more 4KB pages of type EfiBootServicesData at a specified alignment.
243 Allocates the number of 4KB pages specified by Pages of type EfiBootServicesData with an
244 alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is
245 returned. If there is not enough memory at the specified alignment remaining to satisfy the
246 request, then NULL is returned.
248 If Alignment is not a power of two and Alignment is not zero, then ASSERT().
249 If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().
251 @param Pages The number of 4 KB pages to allocate.
252 @param Alignment The requested alignment of the allocation. Must be a power of two.
253 If Alignment is zero, then byte alignment is used.
255 @return A pointer to the allocated buffer or NULL if allocation fails.
260 AllocateAlignedPages (
265 return InternalAllocateAlignedPages (EfiRuntimeServicesData
, Pages
, Alignment
);
269 Allocates one or more 4KB pages of type EfiRuntimeServicesData at a specified alignment.
271 Allocates the number of 4KB pages specified by Pages of type EfiRuntimeServicesData with an
272 alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is
273 returned. If there is not enough memory at the specified alignment remaining to satisfy the
274 request, then NULL is returned.
276 If Alignment is not a power of two and Alignment is not zero, then ASSERT().
277 If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().
279 @param Pages The number of 4 KB pages to allocate.
280 @param Alignment The requested alignment of the allocation. Must be a power of two.
281 If Alignment is zero, then byte alignment is used.
283 @return A pointer to the allocated buffer or NULL if allocation fails.
288 AllocateAlignedRuntimePages (
293 return InternalAllocateAlignedPages (EfiRuntimeServicesData
, Pages
, Alignment
);
297 Allocates one or more 4KB pages of type EfiReservedMemoryType at a specified alignment.
299 Allocates the number of 4KB pages specified by Pages of type EfiReservedMemoryType with an
300 alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is
301 returned. If there is not enough memory at the specified alignment remaining to satisfy the
302 request, then NULL is returned.
304 If Alignment is not a power of two and Alignment is not zero, then ASSERT().
305 If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().
307 @param Pages The number of 4 KB pages to allocate.
308 @param Alignment The requested alignment of the allocation. Must be a power of two.
309 If Alignment is zero, then byte alignment is used.
311 @return A pointer to the allocated buffer or NULL if allocation fails.
316 AllocateAlignedReservedPages (
325 Frees one or more 4KB pages that were previously allocated with one of the aligned page
326 allocation functions in the Memory Allocation Library.
328 Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer
329 must have been allocated on a previous call to the aligned page allocation services of the Memory
330 Allocation Library. If it is not possible to free allocated pages, then this function will
333 If Buffer was not allocated with an aligned page allocation function in the Memory Allocation
334 Library, then ASSERT().
335 If Pages is zero, then ASSERT().
337 @param Buffer Pointer to the buffer of pages to free.
338 @param Pages The number of 4 KB pages to free.
351 Status
= gMmst
->MmFreePages ((EFI_PHYSICAL_ADDRESS
)(UINTN
)Buffer
, Pages
);
352 ASSERT_EFI_ERROR (Status
);
356 Allocates a buffer of a certain pool type.
358 Allocates the number bytes specified by AllocationSize of a certain pool type and returns a
359 pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
360 returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
362 @param MemoryType The type of memory to allocate.
363 @param AllocationSize The number of bytes to allocate.
365 @return A pointer to the allocated buffer or NULL if allocation fails.
369 InternalAllocatePool (
370 IN EFI_MEMORY_TYPE MemoryType
,
371 IN UINTN AllocationSize
379 Status
= gMmst
->MmAllocatePool (MemoryType
, AllocationSize
, &Memory
);
380 if (EFI_ERROR (Status
)) {
387 Allocates a buffer of type EfiBootServicesData.
389 Allocates the number bytes specified by AllocationSize of type EfiBootServicesData and returns a
390 pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
391 returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
393 @param AllocationSize The number of bytes to allocate.
395 @return A pointer to the allocated buffer or NULL if allocation fails.
401 IN UINTN AllocationSize
404 return InternalAllocatePool (EfiRuntimeServicesData
, AllocationSize
);
408 Allocates a buffer of type EfiRuntimeServicesData.
410 Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData and returns
411 a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
412 returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
414 @param AllocationSize The number of bytes to allocate.
416 @return A pointer to the allocated buffer or NULL if allocation fails.
421 AllocateRuntimePool (
422 IN UINTN AllocationSize
425 return InternalAllocatePool (EfiRuntimeServicesData
, AllocationSize
);
429 Allocates a buffer of type EfiReservedMemoryType.
431 Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType and returns
432 a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
433 returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
435 @param AllocationSize The number of bytes to allocate.
437 @return A pointer to the allocated buffer or NULL if allocation fails.
442 AllocateReservedPool (
443 IN UINTN AllocationSize
450 Allocates and zeros a buffer of a certain pool type.
452 Allocates the number bytes specified by AllocationSize of a certain pool type, clears the buffer
453 with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid
454 buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request,
455 then NULL is returned.
457 @param PoolType The type of memory to allocate.
458 @param AllocationSize The number of bytes to allocate and zero.
460 @return A pointer to the allocated buffer or NULL if allocation fails.
464 InternalAllocateZeroPool (
465 IN EFI_MEMORY_TYPE PoolType
,
466 IN UINTN AllocationSize
471 Memory
= InternalAllocatePool (PoolType
, AllocationSize
);
472 if (Memory
!= NULL
) {
473 Memory
= ZeroMem (Memory
, AllocationSize
);
479 Allocates and zeros a buffer of type EfiBootServicesData.
481 Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, clears the
482 buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
483 valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the
484 request, then NULL is returned.
486 @param AllocationSize The number of bytes to allocate and zero.
488 @return A pointer to the allocated buffer or NULL if allocation fails.
494 IN UINTN AllocationSize
497 return InternalAllocateZeroPool (EfiRuntimeServicesData
, AllocationSize
);
501 Allocates and zeros a buffer of type EfiRuntimeServicesData.
503 Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, clears the
504 buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
505 valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the
506 request, then NULL is returned.
508 @param AllocationSize The number of bytes to allocate and zero.
510 @return A pointer to the allocated buffer or NULL if allocation fails.
515 AllocateRuntimeZeroPool (
516 IN UINTN AllocationSize
519 return InternalAllocateZeroPool (EfiRuntimeServicesData
, AllocationSize
);
523 Allocates and zeros a buffer of type EfiReservedMemoryType.
525 Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, clears the
526 buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
527 valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the
528 request, then NULL is returned.
530 @param AllocationSize The number of bytes to allocate and zero.
532 @return A pointer to the allocated buffer or NULL if allocation fails.
537 AllocateReservedZeroPool (
538 IN UINTN AllocationSize
545 Copies a buffer to an allocated buffer of a certain pool type.
547 Allocates the number bytes specified by AllocationSize of a certain pool type, copies
548 AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the
549 allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
550 is not enough memory remaining to satisfy the request, then NULL is returned.
551 If Buffer is NULL, then ASSERT().
552 If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
554 @param PoolType The type of pool to allocate.
555 @param AllocationSize The number of bytes to allocate and zero.
556 @param Buffer The buffer to copy to the allocated buffer.
558 @return A pointer to the allocated buffer or NULL if allocation fails.
562 InternalAllocateCopyPool (
563 IN EFI_MEMORY_TYPE PoolType
,
564 IN UINTN AllocationSize
,
565 IN CONST VOID
*Buffer
570 ASSERT (Buffer
!= NULL
);
571 ASSERT (AllocationSize
<= (MAX_ADDRESS
- (UINTN
) Buffer
+ 1));
573 Memory
= InternalAllocatePool (PoolType
, AllocationSize
);
574 if (Memory
!= NULL
) {
575 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 (EfiRuntimeServicesData
, 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
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
);
702 Reallocates a buffer of type EfiBootServicesData.
704 Allocates and zeros the number bytes specified by NewSize from memory of type
705 EfiBootServicesData. If OldBuffer is not NULL, then the smaller of OldSize and
706 NewSize bytes are copied from OldBuffer to the newly allocated buffer, and
707 OldBuffer is freed. A pointer to the newly allocated buffer is returned.
708 If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
709 enough memory remaining to satisfy the request, then NULL is returned.
711 If the allocation of the new buffer is successful and the smaller of NewSize and OldSize
712 is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
714 @param OldSize The size, in bytes, of OldBuffer.
715 @param NewSize The size, in bytes, of the buffer to reallocate.
716 @param OldBuffer The buffer to copy to the allocated buffer. This is an optional
717 parameter that may be NULL.
719 @return A pointer to the allocated buffer or NULL if allocation fails.
727 IN VOID
*OldBuffer OPTIONAL
730 return InternalReallocatePool (EfiRuntimeServicesData
, OldSize
, NewSize
, OldBuffer
);
734 Reallocates a buffer of type EfiRuntimeServicesData.
736 Allocates and zeros the number bytes specified by NewSize from memory of type
737 EfiRuntimeServicesData. If OldBuffer is not NULL, then the smaller of OldSize and
738 NewSize bytes are copied from OldBuffer to the newly allocated buffer, and
739 OldBuffer is freed. A pointer to the newly allocated buffer is returned.
740 If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
741 enough memory remaining to satisfy the request, then NULL is returned.
743 If the allocation of the new buffer is successful and the smaller of NewSize and OldSize
744 is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
746 @param OldSize The size, in bytes, of OldBuffer.
747 @param NewSize The size, in bytes, of the buffer to reallocate.
748 @param OldBuffer The buffer to copy to the allocated buffer. This is an optional
749 parameter that may be NULL.
751 @return A pointer to the allocated buffer or NULL if allocation fails.
756 ReallocateRuntimePool (
759 IN VOID
*OldBuffer OPTIONAL
762 return InternalReallocatePool (EfiRuntimeServicesData
, OldSize
, NewSize
, OldBuffer
);
766 Reallocates a buffer of type EfiReservedMemoryType.
768 Allocates and zeros the number bytes specified by NewSize from memory of type
769 EfiReservedMemoryType. If OldBuffer is not NULL, then the smaller of OldSize and
770 NewSize bytes are copied from OldBuffer to the newly allocated buffer, and
771 OldBuffer is freed. A pointer to the newly allocated buffer is returned.
772 If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
773 enough memory remaining to satisfy the request, then NULL is returned.
775 If the allocation of the new buffer is successful and the smaller of NewSize and OldSize
776 is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
778 @param OldSize The size, in bytes, of OldBuffer.
779 @param NewSize The size, in bytes, of the buffer to reallocate.
780 @param OldBuffer The buffer to copy to the allocated buffer. This is an optional
781 parameter that may be NULL.
783 @return A pointer to the allocated buffer or NULL if allocation fails.
788 ReallocateReservedPool (
791 IN VOID
*OldBuffer OPTIONAL
798 Frees a buffer that was previously allocated with one of the pool allocation functions in the
799 Memory Allocation Library.
801 Frees the buffer specified by Buffer. Buffer must have been allocated on a previous call to the
802 pool allocation services of the Memory Allocation Library. If it is not possible to free pool
803 resources, then this function will perform no actions.
805 If Buffer was not allocated with a pool allocation function in the Memory Allocation Library,
808 @param Buffer Pointer to the buffer to free.
819 Status
= gMmst
->MmFreePool (Buffer
);
820 ASSERT_EFI_ERROR (Status
);