2 Support routines for memory allocation routines based
3 on SMM Services Table services for SMM phase drivers.
5 The PI System Management Mode Core Interface Specification only allows the use
6 of EfiRuntimeServicesCode and EfiRuntimeServicesData memory types for memory
7 allocations through the SMM Services Table. The functions in the Memory
8 Allocation Library use EfiBootServicesData as the default memory allocation
9 type. For this SMM specific instance of the Memory Allocation Library,
10 EfiRuntimeServicesData is used as the default memory type for all allocations.
11 In addition, allocation for the Reserved memory types are not supported and
12 will always return NULL.
14 Copyright (c) 2006 - 2010, Intel Corporation<BR>
15 All rights reserved. This program and the accompanying materials
16 are licensed and made available under the terms and conditions of the BSD License
17 which accompanies this distribution. The full text of the license may be found at
18 http://opensource.org/licenses/bsd-license.php
20 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
21 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
27 #include <Library/MemoryAllocationLib.h>
28 #include <Library/SmmServicesTableLib.h>
29 #include <Library/BaseMemoryLib.h>
30 #include <Library/DebugLib.h>
33 Allocates one or more 4KB pages of a certain memory type.
35 Allocates the number of 4KB pages of a certain memory type and returns a pointer to the allocated
36 buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL is returned.
37 If there is not enough memory remaining to satisfy the request, then NULL is returned.
39 @param MemoryType The type of memory to allocate.
40 @param Pages The number of 4 KB pages to allocate.
42 @return A pointer to the allocated buffer or NULL if allocation fails.
46 InternalAllocatePages (
47 IN EFI_MEMORY_TYPE MemoryType
,
52 EFI_PHYSICAL_ADDRESS Memory
;
58 Status
= gSmst
->SmmAllocatePages (AllocateAnyPages
, MemoryType
, Pages
, &Memory
);
59 if (EFI_ERROR (Status
)) {
62 return (VOID
*) (UINTN
) Memory
;
66 Allocates one or more 4KB pages of type EfiBootServicesData.
68 Allocates the number of 4KB pages of type EfiBootServicesData and returns a pointer to the
69 allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL
70 is returned. If there is not enough memory remaining to satisfy the request, then NULL is
73 @param Pages The number of 4 KB pages to allocate.
75 @return A pointer to the allocated buffer or NULL if allocation fails.
84 return InternalAllocatePages (EfiRuntimeServicesData
, Pages
);
88 Allocates one or more 4KB pages of type EfiRuntimeServicesData.
90 Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a pointer to the
91 allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL
92 is returned. If there is not enough memory remaining to satisfy the request, then NULL is
95 @param Pages The number of 4 KB pages to allocate.
97 @return A pointer to the allocated buffer or NULL if allocation fails.
102 AllocateRuntimePages (
106 return InternalAllocatePages (EfiRuntimeServicesData
, Pages
);
110 Allocates one or more 4KB pages of type EfiReservedMemoryType.
112 Allocates the number of 4KB pages of type EfiReservedMemoryType and returns a pointer to the
113 allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL
114 is returned. If there is not enough memory remaining to satisfy the request, then NULL is
117 @param Pages The number of 4 KB pages to allocate.
119 @return A pointer to the allocated buffer or NULL if allocation fails.
124 AllocateReservedPages (
132 Frees one or more 4KB pages that were previously allocated with one of the page allocation
133 functions in the Memory Allocation Library.
135 Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer
136 must have been allocated on a previous call to the page allocation services of the Memory
137 Allocation Library. If it is not possible to free allocated pages, then this function will
140 If Buffer was not allocated with a page allocation function in the Memory Allocation Library,
142 If Pages is zero, then ASSERT().
144 @param Buffer Pointer to the buffer of pages to free.
145 @param Pages The number of 4 KB pages to free.
158 Status
= gSmst
->SmmFreePages ((EFI_PHYSICAL_ADDRESS
) (UINTN
) Buffer
, Pages
);
159 ASSERT_EFI_ERROR (Status
);
163 Allocates one or more 4KB pages of a certain memory type at a specified alignment.
165 Allocates the number of 4KB pages specified by Pages of a certain memory type with an alignment
166 specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is returned.
167 If there is not enough memory at the specified alignment remaining to satisfy the request, then
169 If Alignment is not a power of two and Alignment is not zero, then ASSERT().
171 @param MemoryType The type of memory to allocate.
172 @param Pages The number of 4 KB pages to allocate.
173 @param Alignment The requested alignment of the allocation. Must be a power of two.
174 If Alignment is zero, then byte alignment is used.
176 @return A pointer to the allocated buffer or NULL if allocation fails.
180 InternalAllocateAlignedPages (
181 IN EFI_MEMORY_TYPE MemoryType
,
187 EFI_PHYSICAL_ADDRESS Memory
;
190 UINTN UnalignedPages
;
194 // Alignment must be a power of two or zero.
196 ASSERT ((Alignment
& (Alignment
- 1)) == 0);
201 if (Alignment
> EFI_PAGE_SIZE
) {
203 // Caculate the total number of pages since alignment is larger than page size.
205 AlignmentMask
= Alignment
- 1;
206 RealPages
= Pages
+ EFI_SIZE_TO_PAGES (Alignment
);
208 // Make sure that Pages plus EFI_SIZE_TO_PAGES (Alignment) does not overflow.
210 ASSERT (RealPages
> Pages
);
212 Status
= gSmst
->SmmAllocatePages (AllocateAnyPages
, MemoryType
, RealPages
, &Memory
);
213 if (EFI_ERROR (Status
)) {
216 AlignedMemory
= ((UINTN
) Memory
+ AlignmentMask
) & ~AlignmentMask
;
217 UnalignedPages
= EFI_SIZE_TO_PAGES (AlignedMemory
- (UINTN
) Memory
);
218 if (UnalignedPages
> 0) {
220 // Free first unaligned page(s).
222 Status
= gSmst
->SmmFreePages (Memory
, UnalignedPages
);
223 ASSERT_EFI_ERROR (Status
);
225 Memory
= (EFI_PHYSICAL_ADDRESS
) (AlignedMemory
+ EFI_PAGES_TO_SIZE (Pages
));
226 UnalignedPages
= RealPages
- Pages
- UnalignedPages
;
227 if (UnalignedPages
> 0) {
229 // Free last unaligned page(s).
231 Status
= gSmst
->SmmFreePages (Memory
, UnalignedPages
);
232 ASSERT_EFI_ERROR (Status
);
236 // Do not over-allocate pages in this case.
238 Status
= gSmst
->SmmAllocatePages (AllocateAnyPages
, MemoryType
, Pages
, &Memory
);
239 if (EFI_ERROR (Status
)) {
242 AlignedMemory
= (UINTN
) Memory
;
244 return (VOID
*) AlignedMemory
;
248 Allocates one or more 4KB pages of type EfiBootServicesData at a specified alignment.
250 Allocates the number of 4KB pages specified by Pages of type EfiBootServicesData with an
251 alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is
252 returned. If there is not enough memory at the specified alignment remaining to satisfy the
253 request, then NULL is returned.
255 If Alignment is not a power of two and Alignment is not zero, then ASSERT().
257 @param Pages The number of 4 KB pages to allocate.
258 @param Alignment The requested alignment of the allocation. Must be a power of two.
259 If Alignment is zero, then byte alignment is used.
261 @return A pointer to the allocated buffer or NULL if allocation fails.
266 AllocateAlignedPages (
271 return InternalAllocateAlignedPages (EfiRuntimeServicesData
, Pages
, Alignment
);
275 Allocates one or more 4KB pages of type EfiRuntimeServicesData at a specified alignment.
277 Allocates the number of 4KB pages specified by Pages of type EfiRuntimeServicesData with an
278 alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is
279 returned. If there is not enough memory at the specified alignment remaining to satisfy the
280 request, then NULL is returned.
282 If Alignment is not a power of two and Alignment is not zero, then ASSERT().
284 @param Pages The number of 4 KB pages to allocate.
285 @param Alignment The requested alignment of the allocation. Must be a power of two.
286 If Alignment is zero, then byte alignment is used.
288 @return A pointer to the allocated buffer or NULL if allocation fails.
293 AllocateAlignedRuntimePages (
298 return InternalAllocateAlignedPages (EfiRuntimeServicesData
, Pages
, Alignment
);
302 Allocates one or more 4KB pages of type EfiReservedMemoryType at a specified alignment.
304 Allocates the number of 4KB pages specified by Pages of type EfiReservedMemoryType with an
305 alignment specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is
306 returned. If there is not enough memory at the specified alignment remaining to satisfy the
307 request, then NULL is returned.
309 If Alignment is not a power of two and Alignment is not zero, then ASSERT().
311 @param Pages The number of 4 KB pages to allocate.
312 @param Alignment The requested alignment of the allocation. Must be a power of two.
313 If Alignment is zero, then byte alignment is used.
315 @return A pointer to the allocated buffer or NULL if allocation fails.
320 AllocateAlignedReservedPages (
329 Frees one or more 4KB pages that were previously allocated with one of the aligned page
330 allocation functions in the Memory Allocation Library.
332 Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer. Buffer
333 must have been allocated on a previous call to the aligned page allocation services of the Memory
334 Allocation Library. If it is not possible to free allocated pages, then this function will
337 If Buffer was not allocated with an aligned page allocation function in the Memory Allocation
338 Library, then ASSERT().
339 If Pages is zero, then ASSERT().
341 @param Buffer Pointer to the buffer of pages to free.
342 @param Pages The number of 4 KB pages to free.
355 Status
= gSmst
->SmmFreePages ((EFI_PHYSICAL_ADDRESS
) (UINTN
) Buffer
, Pages
);
356 ASSERT_EFI_ERROR (Status
);
360 Allocates a buffer of a certain pool type.
362 Allocates the number bytes specified by AllocationSize of a certain pool type and returns a
363 pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
364 returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
366 @param MemoryType The type of memory to allocate.
367 @param AllocationSize The number of bytes to allocate.
369 @return A pointer to the allocated buffer or NULL if allocation fails.
373 InternalAllocatePool (
374 IN EFI_MEMORY_TYPE MemoryType
,
375 IN UINTN AllocationSize
381 Status
= gSmst
->SmmAllocatePool (MemoryType
, AllocationSize
, &Memory
);
382 if (EFI_ERROR (Status
)) {
389 Allocates a buffer of type EfiBootServicesData.
391 Allocates the number bytes specified by AllocationSize of type EfiBootServicesData and returns a
392 pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
393 returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
395 @param AllocationSize The number of bytes to allocate.
397 @return A pointer to the allocated buffer or NULL if allocation fails.
403 IN UINTN AllocationSize
406 return InternalAllocatePool (EfiRuntimeServicesData
, AllocationSize
);
410 Allocates a buffer of type EfiRuntimeServicesData.
412 Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData and returns
413 a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
414 returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
416 @param AllocationSize The number of bytes to allocate.
418 @return A pointer to the allocated buffer or NULL if allocation fails.
423 AllocateRuntimePool (
424 IN UINTN AllocationSize
427 return InternalAllocatePool (EfiRuntimeServicesData
, AllocationSize
);
431 Allocates a buffer of type EfiReservedMemoryType.
433 Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType and returns
434 a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
435 returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
437 @param AllocationSize The number of bytes to allocate.
439 @return A pointer to the allocated buffer or NULL if allocation fails.
444 AllocateReservedPool (
445 IN UINTN AllocationSize
452 Allocates and zeros a buffer of a certain pool type.
454 Allocates the number bytes specified by AllocationSize of a certain pool type, clears the buffer
455 with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid
456 buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request,
457 then NULL is returned.
459 @param PoolType The type of memory to allocate.
460 @param AllocationSize The number of bytes to allocate and zero.
462 @return A pointer to the allocated buffer or NULL if allocation fails.
466 InternalAllocateZeroPool (
467 IN EFI_MEMORY_TYPE PoolType
,
468 IN UINTN AllocationSize
473 Memory
= InternalAllocatePool (PoolType
, AllocationSize
);
474 if (Memory
!= NULL
) {
475 Memory
= ZeroMem (Memory
, AllocationSize
);
481 Allocates and zeros a buffer of type EfiBootServicesData.
483 Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, clears the
484 buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
485 valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the
486 request, then NULL is returned.
488 @param AllocationSize The number of bytes to allocate and zero.
490 @return A pointer to the allocated buffer or NULL if allocation fails.
496 IN UINTN AllocationSize
499 return InternalAllocateZeroPool (EfiRuntimeServicesData
, AllocationSize
);
503 Allocates and zeros a buffer of type EfiRuntimeServicesData.
505 Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, clears the
506 buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
507 valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the
508 request, then NULL is returned.
510 @param AllocationSize The number of bytes to allocate and zero.
512 @return A pointer to the allocated buffer or NULL if allocation fails.
517 AllocateRuntimeZeroPool (
518 IN UINTN AllocationSize
521 return InternalAllocateZeroPool (EfiRuntimeServicesData
, AllocationSize
);
525 Allocates and zeros a buffer of type EfiReservedMemoryType.
527 Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, clears the
528 buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
529 valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the
530 request, then NULL is returned.
532 @param AllocationSize The number of bytes to allocate and zero.
534 @return A pointer to the allocated buffer or NULL if allocation fails.
539 AllocateReservedZeroPool (
540 IN UINTN AllocationSize
547 Copies a buffer to an allocated buffer of a certain pool type.
549 Allocates the number bytes specified by AllocationSize of a certain pool type, copies
550 AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the
551 allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
552 is not enough memory remaining to satisfy the request, then NULL is returned.
553 If Buffer is NULL, then ASSERT().
554 If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
556 @param PoolType The type of pool to allocate.
557 @param AllocationSize The number of bytes to allocate and zero.
558 @param Buffer The buffer to copy to the allocated buffer.
560 @return A pointer to the allocated buffer or NULL if allocation fails.
564 InternalAllocateCopyPool (
565 IN EFI_MEMORY_TYPE PoolType
,
566 IN UINTN AllocationSize
,
567 IN CONST VOID
*Buffer
572 ASSERT (Buffer
!= NULL
);
573 ASSERT (AllocationSize
<= (MAX_ADDRESS
- (UINTN
) Buffer
+ 1));
575 Memory
= InternalAllocatePool (PoolType
, AllocationSize
);
576 if (Memory
!= NULL
) {
577 Memory
= CopyMem (Memory
, Buffer
, AllocationSize
);
583 Copies a buffer to an allocated buffer of type EfiBootServicesData.
585 Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, copies
586 AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the
587 allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
588 is not enough memory remaining to satisfy the request, then NULL is returned.
590 If Buffer is NULL, then ASSERT().
591 If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
593 @param AllocationSize The number of bytes to allocate and zero.
594 @param Buffer The buffer to copy to the allocated buffer.
596 @return A pointer to the allocated buffer or NULL if allocation fails.
602 IN UINTN AllocationSize
,
603 IN CONST VOID
*Buffer
606 return InternalAllocateCopyPool (EfiRuntimeServicesData
, AllocationSize
, Buffer
);
610 Copies a buffer to an allocated buffer of type EfiRuntimeServicesData.
612 Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, copies
613 AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the
614 allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
615 is not enough memory remaining to satisfy the request, then NULL is returned.
617 If Buffer is NULL, then ASSERT().
618 If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
620 @param AllocationSize The number of bytes to allocate and zero.
621 @param Buffer The buffer to copy to the allocated buffer.
623 @return A pointer to the allocated buffer or NULL if allocation fails.
628 AllocateRuntimeCopyPool (
629 IN UINTN AllocationSize
,
630 IN CONST VOID
*Buffer
633 return InternalAllocateCopyPool (EfiRuntimeServicesData
, AllocationSize
, Buffer
);
637 Copies a buffer to an allocated buffer of type EfiReservedMemoryType.
639 Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType, copies
640 AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the
641 allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there
642 is not enough memory remaining to satisfy the request, then NULL is returned.
644 If Buffer is NULL, then ASSERT().
645 If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
647 @param AllocationSize The number of bytes to allocate and zero.
648 @param Buffer The buffer to copy to the allocated buffer.
650 @return A pointer to the allocated buffer or NULL if allocation fails.
655 AllocateReservedCopyPool (
656 IN UINTN AllocationSize
,
657 IN CONST VOID
*Buffer
664 Reallocates a buffer of a specified memory type.
666 Allocates and zeros the number bytes specified by NewSize from memory of the type
667 specified by PoolType. If OldBuffer is not NULL, then the smaller of OldSize and
668 NewSize bytes are copied from OldBuffer to the newly allocated buffer, and
669 OldBuffer is freed. A pointer to the newly allocated buffer is returned.
670 If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
671 enough memory remaining to satisfy the request, then NULL is returned.
673 If the allocation of the new buffer is successful and the smaller of NewSize and OldSize
674 is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
676 @param PoolType The type of pool to allocate.
677 @param OldSize The size, in bytes, of OldBuffer.
678 @param NewSize The size, in bytes, of the buffer to reallocate.
679 @param OldBuffer The buffer to copy to the allocated buffer. This is an optional
680 parameter that may be NULL.
682 @return A pointer to the allocated buffer or NULL if allocation fails.
686 InternalReallocatePool (
687 IN EFI_MEMORY_TYPE PoolType
,
690 IN VOID
*OldBuffer OPTIONAL
695 NewBuffer
= InternalAllocateZeroPool (PoolType
, NewSize
);
696 if (NewBuffer
!= NULL
&& OldBuffer
!= NULL
) {
697 CopyMem (NewBuffer
, OldBuffer
, MIN (OldSize
, NewSize
));
698 FreePool (OldBuffer
);
704 Reallocates a buffer of type EfiBootServicesData.
706 Allocates and zeros the number bytes specified by NewSize from memory of type
707 EfiBootServicesData. If OldBuffer is not NULL, then the smaller of OldSize and
708 NewSize bytes are copied from OldBuffer to the newly allocated buffer, and
709 OldBuffer is freed. A pointer to the newly allocated buffer is returned.
710 If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
711 enough memory remaining to satisfy the request, then NULL is returned.
713 If the allocation of the new buffer is successful and the smaller of NewSize and OldSize
714 is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
716 @param OldSize The size, in bytes, of OldBuffer.
717 @param NewSize The size, in bytes, of the buffer to reallocate.
718 @param OldBuffer The buffer to copy to the allocated buffer. This is an optional
719 parameter that may be NULL.
721 @return A pointer to the allocated buffer or NULL if allocation fails.
729 IN VOID
*OldBuffer OPTIONAL
732 return InternalReallocatePool (EfiRuntimeServicesData
, OldSize
, NewSize
, OldBuffer
);
736 Reallocates a buffer of type EfiRuntimeServicesData.
738 Allocates and zeros the number bytes specified by NewSize from memory of type
739 EfiRuntimeServicesData. If OldBuffer is not NULL, then the smaller of OldSize and
740 NewSize bytes are copied from OldBuffer to the newly allocated buffer, and
741 OldBuffer is freed. A pointer to the newly allocated buffer is returned.
742 If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
743 enough memory remaining to satisfy the request, then NULL is returned.
745 If the allocation of the new buffer is successful and the smaller of NewSize and OldSize
746 is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
748 @param OldSize The size, in bytes, of OldBuffer.
749 @param NewSize The size, in bytes, of the buffer to reallocate.
750 @param OldBuffer The buffer to copy to the allocated buffer. This is an optional
751 parameter that may be NULL.
753 @return A pointer to the allocated buffer or NULL if allocation fails.
758 ReallocateRuntimePool (
761 IN VOID
*OldBuffer OPTIONAL
764 return InternalReallocatePool (EfiRuntimeServicesData
, OldSize
, NewSize
, OldBuffer
);
768 Reallocates a buffer of type EfiReservedMemoryType.
770 Allocates and zeros the number bytes specified by NewSize from memory of type
771 EfiReservedMemoryType. If OldBuffer is not NULL, then the smaller of OldSize and
772 NewSize bytes are copied from OldBuffer to the newly allocated buffer, and
773 OldBuffer is freed. A pointer to the newly allocated buffer is returned.
774 If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
775 enough memory remaining to satisfy the request, then NULL is returned.
777 If the allocation of the new buffer is successful and the smaller of NewSize and OldSize
778 is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
780 @param OldSize The size, in bytes, of OldBuffer.
781 @param NewSize The size, in bytes, of the buffer to reallocate.
782 @param OldBuffer The buffer to copy to the allocated buffer. This is an optional
783 parameter that may be NULL.
785 @return A pointer to the allocated buffer or NULL if allocation fails.
790 ReallocateReservedPool (
793 IN VOID
*OldBuffer OPTIONAL
800 Frees a buffer that was previously allocated with one of the pool allocation functions in the
801 Memory Allocation Library.
803 Frees the buffer specified by Buffer. Buffer must have been allocated on a previous call to the
804 pool allocation services of the Memory Allocation Library. If it is not possible to free pool
805 resources, then this function will perform no actions.
807 If Buffer was not allocated with a pool allocation function in the Memory Allocation Library,
810 @param Buffer Pointer to the buffer to free.
821 Status
= gSmst
->SmmFreePool (Buffer
);
822 ASSERT_EFI_ERROR (Status
);