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 SPDX-License-Identifier: BSD-2-Clause-Patent
13 #include <Library/BaseMemoryLib.h>
14 #include <Library/DebugLib.h>
15 #include <Library/MemoryAllocationLib.h>
16 #include <Library/MmServicesTableLib.h>
19 Allocates one or more 4KB pages of a certain memory type.
21 Allocates the number of 4KB pages of a certain memory type and returns a pointer to the allocated
22 buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL is returned.
23 If there is not enough memory remaining to satisfy the request, then NULL is returned.
25 @param MemoryType The type of memory to allocate.
26 @param Pages The number of 4 KB pages to allocate.
28 @return A pointer to the allocated buffer or NULL if allocation fails.
32 InternalAllocatePages (
33 IN EFI_MEMORY_TYPE MemoryType
,
38 EFI_PHYSICAL_ADDRESS Memory
;
44 Status
= gMmst
->MmAllocatePages (AllocateAnyPages
, MemoryType
, Pages
, &Memory
);
45 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 (EfiRuntimeServicesData
, 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 (
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 Pointer to the buffer of pages to free.
131 @param Pages The number of 4 KB pages to free.
144 Status
= gMmst
->MmFreePages ((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);
188 if (Alignment
> EFI_PAGE_SIZE
) {
190 // Calculate the total number of pages since alignment is larger than page size.
192 AlignmentMask
= Alignment
- 1;
193 RealPages
= Pages
+ EFI_SIZE_TO_PAGES (Alignment
);
195 // Make sure that Pages plus EFI_SIZE_TO_PAGES (Alignment) does not overflow.
197 ASSERT (RealPages
> Pages
);
199 Status
= gMmst
->MmAllocatePages (AllocateAnyPages
, MemoryType
, RealPages
, &Memory
);
200 if (EFI_ERROR (Status
)) {
203 AlignedMemory
= ((UINTN
)Memory
+ AlignmentMask
) & ~AlignmentMask
;
204 UnalignedPages
= EFI_SIZE_TO_PAGES (AlignedMemory
- (UINTN
) Memory
);
205 if (UnalignedPages
> 0) {
207 // Free first unaligned page(s).
209 Status
= gMmst
->MmFreePages (Memory
, UnalignedPages
);
210 ASSERT_EFI_ERROR (Status
);
212 Memory
= (EFI_PHYSICAL_ADDRESS
)(AlignedMemory
+ EFI_PAGES_TO_SIZE (Pages
));
213 UnalignedPages
= RealPages
- Pages
- UnalignedPages
;
214 if (UnalignedPages
> 0) {
216 // Free last unaligned page(s).
218 Status
= gMmst
->MmFreePages (Memory
, UnalignedPages
);
219 ASSERT_EFI_ERROR (Status
);
223 // Do not over-allocate pages in this case.
225 Status
= gMmst
->MmAllocatePages (AllocateAnyPages
, MemoryType
, Pages
, &Memory
);
226 if (EFI_ERROR (Status
)) {
229 AlignedMemory
= (UINTN
) Memory
;
231 return (VOID
*) AlignedMemory
;
235 Allocates one or more 4KB pages of type EfiBootServicesData at a specified alignment.
237 Allocates the number of 4KB pages specified by Pages of type EfiBootServicesData with an
238 alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is
239 returned. If there is not enough memory at the specified alignment remaining to satisfy the
240 request, then NULL is returned.
242 If Alignment is not a power of two and Alignment is not zero, then ASSERT().
243 If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().
245 @param Pages The number of 4 KB pages to allocate.
246 @param Alignment The requested alignment of the allocation. Must be a power of two.
247 If Alignment is zero, then byte alignment is used.
249 @return A pointer to the allocated buffer or NULL if allocation fails.
254 AllocateAlignedPages (
259 return InternalAllocateAlignedPages (EfiRuntimeServicesData
, Pages
, Alignment
);
263 Allocates one or more 4KB pages of type EfiRuntimeServicesData at a specified alignment.
265 Allocates the number of 4KB pages specified by Pages of type EfiRuntimeServicesData with an
266 alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is
267 returned. If there is not enough memory at the specified alignment remaining to satisfy the
268 request, then NULL is returned.
270 If Alignment is not a power of two and Alignment is not zero, then ASSERT().
271 If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().
273 @param Pages The number of 4 KB pages to allocate.
274 @param Alignment The requested alignment of the allocation. Must be a power of two.
275 If Alignment is zero, then byte alignment is used.
277 @return A pointer to the allocated buffer or NULL if allocation fails.
282 AllocateAlignedRuntimePages (
287 return InternalAllocateAlignedPages (EfiRuntimeServicesData
, Pages
, Alignment
);
291 Allocates one or more 4KB pages of type EfiReservedMemoryType at a specified alignment.
293 Allocates the number of 4KB pages specified by Pages of type EfiReservedMemoryType with an
294 alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is
295 returned. If there is not enough memory at the specified alignment remaining to satisfy the
296 request, then NULL is returned.
298 If Alignment is not a power of two and Alignment is not zero, then ASSERT().
299 If Pages plus EFI_SIZE_TO_PAGES (Alignment) overflows, then ASSERT().
301 @param Pages The number of 4 KB pages to allocate.
302 @param Alignment The requested alignment of the allocation. Must be a power of two.
303 If Alignment is zero, then byte alignment is used.
305 @return A pointer to the allocated buffer or NULL if allocation fails.
310 AllocateAlignedReservedPages (
319 Frees one or more 4KB pages that were previously allocated with one of the aligned page
320 allocation functions in the Memory Allocation Library.
322 Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer
323 must have been allocated on a previous call to the aligned page allocation services of the Memory
324 Allocation Library. If it is not possible to free allocated pages, then this function will
327 If Buffer was not allocated with an aligned page allocation function in the Memory Allocation
328 Library, then ASSERT().
329 If Pages is zero, then ASSERT().
331 @param Buffer Pointer to the buffer of pages to free.
332 @param Pages The number of 4 KB pages to free.
345 Status
= gMmst
->MmFreePages ((EFI_PHYSICAL_ADDRESS
)(UINTN
)Buffer
, Pages
);
346 ASSERT_EFI_ERROR (Status
);
350 Allocates a buffer of a certain pool type.
352 Allocates the number bytes specified by AllocationSize of a certain pool type and returns a
353 pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
354 returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
356 @param MemoryType The type of memory to allocate.
357 @param AllocationSize The number of bytes to allocate.
359 @return A pointer to the allocated buffer or NULL if allocation fails.
363 InternalAllocatePool (
364 IN EFI_MEMORY_TYPE MemoryType
,
365 IN UINTN AllocationSize
373 Status
= gMmst
->MmAllocatePool (MemoryType
, AllocationSize
, &Memory
);
374 if (EFI_ERROR (Status
)) {
381 Allocates a buffer of type EfiBootServicesData.
383 Allocates the number bytes specified by AllocationSize of type EfiBootServicesData and returns a
384 pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
385 returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
387 @param AllocationSize The number of bytes to allocate.
389 @return A pointer to the allocated buffer or NULL if allocation fails.
395 IN UINTN AllocationSize
398 return InternalAllocatePool (EfiRuntimeServicesData
, AllocationSize
);
402 Allocates a buffer of type EfiRuntimeServicesData.
404 Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData and returns
405 a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
406 returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
408 @param AllocationSize The number of bytes to allocate.
410 @return A pointer to the allocated buffer or NULL if allocation fails.
415 AllocateRuntimePool (
416 IN UINTN AllocationSize
419 return InternalAllocatePool (EfiRuntimeServicesData
, AllocationSize
);
423 Allocates a buffer of type EfiReservedMemoryType.
425 Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType and returns
426 a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
427 returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
429 @param AllocationSize The number of bytes to allocate.
431 @return A pointer to the allocated buffer or NULL if allocation fails.
436 AllocateReservedPool (
437 IN UINTN AllocationSize
444 Allocates and zeros a buffer of a certain pool type.
446 Allocates the number bytes specified by AllocationSize of a certain pool type, clears the buffer
447 with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid
448 buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request,
449 then NULL is returned.
451 @param PoolType The type of memory to allocate.
452 @param AllocationSize The number of bytes to allocate and zero.
454 @return A pointer to the allocated buffer or NULL if allocation fails.
458 InternalAllocateZeroPool (
459 IN EFI_MEMORY_TYPE PoolType
,
460 IN UINTN AllocationSize
465 Memory
= InternalAllocatePool (PoolType
, AllocationSize
);
466 if (Memory
!= NULL
) {
467 Memory
= ZeroMem (Memory
, AllocationSize
);
473 Allocates and zeros a buffer of type EfiBootServicesData.
475 Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, clears the
476 buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
477 valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the
478 request, then NULL is returned.
480 @param AllocationSize The number of bytes to allocate and zero.
482 @return A pointer to the allocated buffer or NULL if allocation fails.
488 IN UINTN AllocationSize
491 return InternalAllocateZeroPool (EfiRuntimeServicesData
, AllocationSize
);
495 Allocates and zeros a buffer of type EfiRuntimeServicesData.
497 Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, clears the
498 buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
499 valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the
500 request, then NULL is returned.
502 @param AllocationSize The number of bytes to allocate and zero.
504 @return A pointer to the allocated buffer or NULL if allocation fails.
509 AllocateRuntimeZeroPool (
510 IN UINTN AllocationSize
513 return InternalAllocateZeroPool (EfiRuntimeServicesData
, AllocationSize
);
517 Allocates and zeros a buffer of type EfiReservedMemoryType.
519 Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, clears the
520 buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
521 valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the
522 request, then NULL is returned.
524 @param AllocationSize The number of bytes to allocate and zero.
526 @return A pointer to the allocated buffer or NULL if allocation fails.
531 AllocateReservedZeroPool (
532 IN UINTN AllocationSize
539 Copies a buffer to an allocated buffer of a certain pool type.
541 Allocates the number bytes specified by AllocationSize of a certain pool type, copies
542 AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the
543 allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
544 is not enough memory remaining to satisfy the request, then NULL is returned.
545 If Buffer is NULL, then ASSERT().
546 If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
548 @param PoolType The type of pool to allocate.
549 @param AllocationSize The number of bytes to allocate and zero.
550 @param Buffer The buffer to copy to the allocated buffer.
552 @return A pointer to the allocated buffer or NULL if allocation fails.
556 InternalAllocateCopyPool (
557 IN EFI_MEMORY_TYPE PoolType
,
558 IN UINTN AllocationSize
,
559 IN CONST VOID
*Buffer
564 ASSERT (Buffer
!= NULL
);
565 ASSERT (AllocationSize
<= (MAX_ADDRESS
- (UINTN
) Buffer
+ 1));
567 Memory
= InternalAllocatePool (PoolType
, AllocationSize
);
568 if (Memory
!= NULL
) {
569 Memory
= CopyMem (Memory
, Buffer
, AllocationSize
);
575 Copies a buffer to an allocated buffer of type EfiBootServicesData.
577 Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, copies
578 AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the
579 allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
580 is not enough memory remaining to satisfy the request, then NULL is returned.
582 If Buffer is NULL, then ASSERT().
583 If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
585 @param AllocationSize The number of bytes to allocate and zero.
586 @param Buffer The buffer to copy to the allocated buffer.
588 @return A pointer to the allocated buffer or NULL if allocation fails.
594 IN UINTN AllocationSize
,
595 IN CONST VOID
*Buffer
598 return InternalAllocateCopyPool (EfiRuntimeServicesData
, AllocationSize
, Buffer
);
602 Copies a buffer to an allocated buffer of type EfiRuntimeServicesData.
604 Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, copies
605 AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the
606 allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
607 is not enough memory remaining to satisfy the request, then NULL is returned.
609 If Buffer is NULL, then ASSERT().
610 If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
612 @param AllocationSize The number of bytes to allocate and zero.
613 @param Buffer The buffer to copy to the allocated buffer.
615 @return A pointer to the allocated buffer or NULL if allocation fails.
620 AllocateRuntimeCopyPool (
621 IN UINTN AllocationSize
,
622 IN CONST VOID
*Buffer
625 return InternalAllocateCopyPool (EfiRuntimeServicesData
, AllocationSize
, Buffer
);
629 Copies a buffer to an allocated buffer of type EfiReservedMemoryType.
631 Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, copies
632 AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the
633 allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
634 is not enough memory remaining to satisfy the request, then NULL is returned.
636 If Buffer is NULL, then ASSERT().
637 If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
639 @param AllocationSize The number of bytes to allocate and zero.
640 @param Buffer The buffer to copy to the allocated buffer.
642 @return A pointer to the allocated buffer or NULL if allocation fails.
647 AllocateReservedCopyPool (
648 IN UINTN AllocationSize
,
649 IN CONST VOID
*Buffer
656 Reallocates a buffer of a specified memory type.
658 Allocates and zeros the number bytes specified by NewSize from memory of the type
659 specified by PoolType. If OldBuffer is not NULL, then the smaller of OldSize and
660 NewSize bytes are copied from OldBuffer to the newly allocated buffer, and
661 OldBuffer is freed. A pointer to the newly allocated buffer is returned.
662 If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
663 enough memory remaining to satisfy the request, then NULL is returned.
665 If the allocation of the new buffer is successful and the smaller of NewSize and OldSize
666 is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
668 @param PoolType The type of pool to allocate.
669 @param OldSize The size, in bytes, of OldBuffer.
670 @param NewSize The size, in bytes, of the buffer to reallocate.
671 @param OldBuffer The buffer to copy to the allocated buffer. This is an optional
672 parameter that may be NULL.
674 @return A pointer to the allocated buffer or NULL if allocation fails.
678 InternalReallocatePool (
679 IN EFI_MEMORY_TYPE PoolType
,
682 IN VOID
*OldBuffer OPTIONAL
687 NewBuffer
= InternalAllocateZeroPool (PoolType
, NewSize
);
688 if (NewBuffer
!= NULL
&& OldBuffer
!= NULL
) {
689 CopyMem (NewBuffer
, OldBuffer
, MIN (OldSize
, NewSize
));
690 FreePool (OldBuffer
);
696 Reallocates a buffer of type EfiBootServicesData.
698 Allocates and zeros the number bytes specified by NewSize from memory of type
699 EfiBootServicesData. If OldBuffer is not NULL, then the smaller of OldSize and
700 NewSize bytes are copied from OldBuffer to the newly allocated buffer, and
701 OldBuffer is freed. A pointer to the newly allocated buffer is returned.
702 If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
703 enough memory remaining to satisfy the request, then NULL is returned.
705 If the allocation of the new buffer is successful and the smaller of NewSize and OldSize
706 is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
708 @param OldSize The size, in bytes, of OldBuffer.
709 @param NewSize The size, in bytes, of the buffer to reallocate.
710 @param OldBuffer The buffer to copy to the allocated buffer. This is an optional
711 parameter that may be NULL.
713 @return A pointer to the allocated buffer or NULL if allocation fails.
721 IN VOID
*OldBuffer OPTIONAL
724 return InternalReallocatePool (EfiRuntimeServicesData
, OldSize
, NewSize
, OldBuffer
);
728 Reallocates a buffer of type EfiRuntimeServicesData.
730 Allocates and zeros the number bytes specified by NewSize from memory of type
731 EfiRuntimeServicesData. If OldBuffer is not NULL, then the smaller of OldSize and
732 NewSize bytes are copied from OldBuffer to the newly allocated buffer, and
733 OldBuffer is freed. A pointer to the newly allocated buffer is returned.
734 If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
735 enough memory remaining to satisfy the request, then NULL is returned.
737 If the allocation of the new buffer is successful and the smaller of NewSize and OldSize
738 is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
740 @param OldSize The size, in bytes, of OldBuffer.
741 @param NewSize The size, in bytes, of the buffer to reallocate.
742 @param OldBuffer The buffer to copy to the allocated buffer. This is an optional
743 parameter that may be NULL.
745 @return A pointer to the allocated buffer or NULL if allocation fails.
750 ReallocateRuntimePool (
753 IN VOID
*OldBuffer OPTIONAL
756 return InternalReallocatePool (EfiRuntimeServicesData
, OldSize
, NewSize
, OldBuffer
);
760 Reallocates a buffer of type EfiReservedMemoryType.
762 Allocates and zeros the number bytes specified by NewSize from memory of type
763 EfiReservedMemoryType. If OldBuffer is not NULL, then the smaller of OldSize and
764 NewSize bytes are copied from OldBuffer to the newly allocated buffer, and
765 OldBuffer is freed. A pointer to the newly allocated buffer is returned.
766 If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
767 enough memory remaining to satisfy the request, then NULL is returned.
769 If the allocation of the new buffer is successful and the smaller of NewSize and OldSize
770 is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
772 @param OldSize The size, in bytes, of OldBuffer.
773 @param NewSize The size, in bytes, of the buffer to reallocate.
774 @param OldBuffer The buffer to copy to the allocated buffer. This is an optional
775 parameter that may be NULL.
777 @return A pointer to the allocated buffer or NULL if allocation fails.
782 ReallocateReservedPool (
785 IN VOID
*OldBuffer OPTIONAL
792 Frees a buffer that was previously allocated with one of the pool allocation functions in the
793 Memory Allocation Library.
795 Frees the buffer specified by Buffer. Buffer must have been allocated on a previous call to the
796 pool allocation services of the Memory Allocation Library. If it is not possible to free pool
797 resources, then this function will perform no actions.
799 If Buffer was not allocated with a pool allocation function in the Memory Allocation Library,
802 @param Buffer Pointer to the buffer to free.
813 Status
= gMmst
->MmFreePool (Buffer
);
814 ASSERT_EFI_ERROR (Status
);