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. All rights reserved.<BR>
15 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
36 to the allocated buffer. The buffer returned is aligned on a 4KB boundary. If
37 Pages is 0, then NULL is returned. If there is not enough memory remaining to
38 satisfy the request, then NULL is returned.
40 @param MemoryType The type of memory to allocate.
41 @param Pages The number of 4 KB pages to allocate.
43 @return A pointer to the allocated buffer or NULL if allocation fails.
47 InternalAllocatePages (
48 IN EFI_MEMORY_TYPE MemoryType
,
53 EFI_PHYSICAL_ADDRESS Memory
;
59 Status
= gSmst
->SmmAllocatePages (AllocateAnyPages
, MemoryType
, Pages
, &Memory
);
60 if (EFI_ERROR (Status
)) {
63 return (VOID
*) (UINTN
) Memory
;
67 Allocates one or more 4KB pages of type EfiBootServicesData.
69 Allocates the number of 4KB pages of type EfiBootServicesData and returns a pointer
70 to the allocated buffer. The buffer returned is aligned on a 4KB boundary. If
71 Pages is 0, then NULL is returned. If there is not enough memory remaining to
72 satisfy the request, then NULL is returned.
74 @param Pages The number of 4 KB pages to allocate.
76 @return A pointer to the allocated buffer or NULL if allocation fails.
85 return InternalAllocatePages (EfiRuntimeServicesData
, Pages
);
89 Allocates one or more 4KB pages of type EfiRuntimeServicesData.
91 Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a
92 pointer to the allocated buffer. The buffer returned is aligned on a 4KB boundary.
93 If Pages is 0, then NULL is returned. If there is not enough memory remaining
94 to satisfy the request, then NULL is returned.
96 @param Pages The number of 4 KB pages to allocate.
98 @return A pointer to the allocated buffer or NULL if allocation fails.
103 AllocateRuntimePages (
107 return InternalAllocatePages (EfiRuntimeServicesData
, Pages
);
111 Allocates one or more 4KB pages of type EfiReservedMemoryType.
113 Allocates the number of 4KB pages of type EfiReservedMemoryType and returns a
114 pointer to the allocated buffer. The buffer returned is aligned on a 4KB boundary.
115 If Pages is 0, then NULL is returned. If there is not enough memory remaining
116 to satisfy the request, then NULL is returned.
118 @param Pages The number of 4 KB pages to allocate.
120 @return A pointer to the allocated buffer or NULL if allocation fails.
125 AllocateReservedPages (
133 Frees one or more 4KB pages that were previously allocated with one of the page allocation
134 functions in the Memory Allocation Library.
136 Frees the number of 4KB pages specified by Pages from the buffer specified by Buffer.
137 Buffer must have been allocated on a previous call to the page allocation services
138 of the Memory Allocation Library. If it is not possible to free allocated pages,
139 then this function will perform no actions.
141 If Buffer was not allocated with a page allocation function in the Memory Allocation
142 Library, then ASSERT().
143 If Pages is zero, then ASSERT().
145 @param Buffer The pointer to the buffer of pages to free.
146 @param Pages The number of 4 KB pages to free.
159 Status
= gSmst
->SmmFreePages ((EFI_PHYSICAL_ADDRESS
) (UINTN
) Buffer
, Pages
);
160 ASSERT_EFI_ERROR (Status
);
164 Allocates one or more 4KB pages of a certain memory type at a specified alignment.
166 Allocates the number of 4KB pages specified by Pages of a certain memory type
167 with an alignment specified by Alignment. The allocated buffer is returned.
168 If Pages is 0, then NULL is returned. If there is not enough memory at the
169 specified alignment remaining to satisfy the request, then NULL is returned.
170 If Alignment is not a power of two and Alignment is not zero, then ASSERT().
172 @param MemoryType The type of memory to allocate.
173 @param Pages The number of 4 KB pages to allocate.
174 @param Alignment The requested alignment of the allocation.
175 Must be a power of two.
176 If Alignment is zero, then byte alignment is used.
178 @return A pointer to the allocated buffer or NULL if allocation fails.
182 InternalAllocateAlignedPages (
183 IN EFI_MEMORY_TYPE MemoryType
,
189 EFI_PHYSICAL_ADDRESS Memory
;
192 UINTN UnalignedPages
;
196 // Alignment must be a power of two or zero.
198 ASSERT ((Alignment
& (Alignment
- 1)) == 0);
203 if (Alignment
> EFI_PAGE_SIZE
) {
205 // Caculate the total number of pages since alignment is larger than page size.
207 AlignmentMask
= Alignment
- 1;
208 RealPages
= Pages
+ EFI_SIZE_TO_PAGES (Alignment
);
210 // Make sure that Pages plus EFI_SIZE_TO_PAGES (Alignment) does not overflow.
212 ASSERT (RealPages
> Pages
);
214 Status
= gSmst
->SmmAllocatePages (AllocateAnyPages
, MemoryType
, RealPages
, &Memory
);
215 if (EFI_ERROR (Status
)) {
218 AlignedMemory
= ((UINTN
) Memory
+ AlignmentMask
) & ~AlignmentMask
;
219 UnalignedPages
= EFI_SIZE_TO_PAGES (AlignedMemory
- (UINTN
) Memory
);
220 if (UnalignedPages
> 0) {
222 // Free first unaligned page(s).
224 Status
= gSmst
->SmmFreePages (Memory
, UnalignedPages
);
225 ASSERT_EFI_ERROR (Status
);
227 Memory
= (EFI_PHYSICAL_ADDRESS
) (AlignedMemory
+ EFI_PAGES_TO_SIZE (Pages
));
228 UnalignedPages
= RealPages
- Pages
- UnalignedPages
;
229 if (UnalignedPages
> 0) {
231 // Free last unaligned page(s).
233 Status
= gSmst
->SmmFreePages (Memory
, UnalignedPages
);
234 ASSERT_EFI_ERROR (Status
);
238 // Do not over-allocate pages in this case.
240 Status
= gSmst
->SmmAllocatePages (AllocateAnyPages
, MemoryType
, Pages
, &Memory
);
241 if (EFI_ERROR (Status
)) {
244 AlignedMemory
= (UINTN
) Memory
;
246 return (VOID
*) AlignedMemory
;
250 Allocates one or more 4KB pages of type EfiBootServicesData at a specified alignment.
252 Allocates the number of 4KB pages specified by Pages of type EfiBootServicesData
253 with an alignment specified by Alignment. The allocated buffer is returned.
254 If Pages is 0, then NULL is returned. If there is not enough memory at the
255 specified alignment remaining to satisfy the request, then NULL is returned.
257 If Alignment is not a power of two and Alignment is not zero, then ASSERT().
259 @param Pages The number of 4 KB pages to allocate.
260 @param Alignment The requested alignment of the allocation.
261 Must be a power of two.
262 If Alignment is zero, then byte alignment is used.
264 @return A pointer to the allocated buffer or NULL if allocation fails.
269 AllocateAlignedPages (
274 return InternalAllocateAlignedPages (EfiRuntimeServicesData
, Pages
, Alignment
);
278 Allocates one or more 4KB pages of type EfiRuntimeServicesData at a specified alignment.
280 Allocates the number of 4KB pages specified by Pages of type EfiRuntimeServicesData
281 with an alignment specified by Alignment. The allocated buffer is returned.
282 If Pages is 0, then NULL is returned. If there is not enough memory at the
283 specified alignment remaining to satisfy the request, then NULL is returned.
285 If Alignment is not a power of two and Alignment is not zero, then ASSERT().
287 @param Pages The number of 4 KB pages to allocate.
288 @param Alignment The requested alignment of the allocation.
289 Must be a power of two.
290 If Alignment is zero, then byte alignment is used.
292 @return A pointer to the allocated buffer or NULL if allocation fails.
297 AllocateAlignedRuntimePages (
302 return InternalAllocateAlignedPages (EfiRuntimeServicesData
, Pages
, Alignment
);
306 Allocates one or more 4KB pages of type EfiReservedMemoryType at a specified alignment.
308 Allocates the number of 4KB pages specified by Pages of type EfiReservedMemoryType
309 with an alignment specified by Alignment. The allocated buffer is returned.
310 If Pages is 0, then NULL is returned. If there is not enough memory at the
311 specified alignment remaining to satisfy the request, then NULL is returned.
313 If Alignment is not a power of two and Alignment is not zero, then ASSERT().
315 @param Pages The number of 4 KB pages to allocate.
316 @param Alignment The requested alignment of the allocation.
317 Must be a power of two.
318 If Alignment is zero, then byte alignment is used.
320 @return A pointer to the allocated buffer or NULL if allocation fails.
325 AllocateAlignedReservedPages (
334 Frees one or more 4KB pages that were previously allocated with one of the aligned page
335 allocation functions in the Memory Allocation Library.
337 Frees the number of 4KB pages specified by Pages from the buffer specified by
338 Buffer. Buffer must have been allocated on a previous call to the aligned page
339 allocation services of the Memory Allocation Library. If it is not possible to
340 free allocated pages, then this function will perform no actions.
342 If Buffer was not allocated with an aligned page allocation function in the
343 Memory Allocation Library, then ASSERT().
344 If Pages is zero, then ASSERT().
346 @param Buffer The pointer to the buffer of pages to free.
347 @param Pages The number of 4 KB pages to free.
360 Status
= gSmst
->SmmFreePages ((EFI_PHYSICAL_ADDRESS
) (UINTN
) Buffer
, Pages
);
361 ASSERT_EFI_ERROR (Status
);
365 Allocates a buffer of a certain pool type.
367 Allocates the number bytes specified by AllocationSize of a certain pool type
368 and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
369 valid buffer of 0 size is returned. If there is not enough memory remaining to
370 satisfy the request, then NULL is returned.
372 @param MemoryType The type of memory to allocate.
373 @param AllocationSize The number of bytes to allocate.
375 @return A pointer to the allocated buffer or NULL if allocation fails.
379 InternalAllocatePool (
380 IN EFI_MEMORY_TYPE MemoryType
,
381 IN UINTN AllocationSize
387 Status
= gSmst
->SmmAllocatePool (MemoryType
, AllocationSize
, &Memory
);
388 if (EFI_ERROR (Status
)) {
395 Allocates a buffer of type EfiBootServicesData.
397 Allocates the number bytes specified by AllocationSize of type EfiBootServicesData
398 and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
399 valid buffer of 0 size is returned. If there is not enough memory remaining to
400 satisfy the request, then NULL is returned.
402 @param AllocationSize The number of bytes to allocate.
404 @return A pointer to the allocated buffer or NULL if allocation fails.
410 IN UINTN AllocationSize
413 return InternalAllocatePool (EfiRuntimeServicesData
, AllocationSize
);
417 Allocates a buffer of type EfiRuntimeServicesData.
419 Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData
420 and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
421 valid buffer of 0 size is returned. If there is not enough memory remaining to
422 satisfy the request, then NULL is returned.
424 @param AllocationSize The number of bytes to allocate.
426 @return A pointer to the allocated buffer or NULL if allocation fails.
431 AllocateRuntimePool (
432 IN UINTN AllocationSize
435 return InternalAllocatePool (EfiRuntimeServicesData
, AllocationSize
);
439 Allocates a buffer of type EfiReservedMemoryType.
441 Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType
442 and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
443 valid buffer of 0 size is returned. If there is not enough memory remaining to
444 satisfy the request, then NULL is returned.
446 @param AllocationSize The number of bytes to allocate.
448 @return A pointer to the allocated buffer or NULL if allocation fails.
453 AllocateReservedPool (
454 IN UINTN AllocationSize
461 Allocates and zeros a buffer of a certain pool type.
463 Allocates the number bytes specified by AllocationSize of a certain pool type,
464 clears the buffer with zeros, and returns a pointer to the allocated buffer.
465 If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is
466 not enough memory remaining to satisfy the request, then NULL is returned.
468 @param PoolType The type of memory to allocate.
469 @param AllocationSize The number of bytes to allocate and zero.
471 @return A pointer to the allocated buffer or NULL if allocation fails.
475 InternalAllocateZeroPool (
476 IN EFI_MEMORY_TYPE PoolType
,
477 IN UINTN AllocationSize
482 Memory
= InternalAllocatePool (PoolType
, AllocationSize
);
483 if (Memory
!= NULL
) {
484 Memory
= ZeroMem (Memory
, AllocationSize
);
490 Allocates and zeros a buffer of type EfiBootServicesData.
492 Allocates the number bytes specified by AllocationSize of type EfiBootServicesData,
493 clears the buffer with zeros, and returns a pointer to the allocated buffer.
494 If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is
495 not enough memory remaining to satisfy the request, then NULL is returned.
497 @param AllocationSize The number of bytes to allocate and zero.
499 @return A pointer to the allocated buffer or NULL if allocation fails.
505 IN UINTN AllocationSize
508 return InternalAllocateZeroPool (EfiRuntimeServicesData
, AllocationSize
);
512 Allocates and zeros a buffer of type EfiRuntimeServicesData.
514 Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData,
515 clears the buffer with zeros, and returns a pointer to the allocated buffer.
516 If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is
517 not enough memory remaining to satisfy the request, then NULL is returned.
519 @param AllocationSize The number of bytes to allocate and zero.
521 @return A pointer to the allocated buffer or NULL if allocation fails.
526 AllocateRuntimeZeroPool (
527 IN UINTN AllocationSize
530 return InternalAllocateZeroPool (EfiRuntimeServicesData
, AllocationSize
);
534 Allocates and zeros a buffer of type EfiReservedMemoryType.
536 Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType,
537 clears the buffer with zeros, and returns a pointer to the allocated buffer.
538 If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is
539 not enough memory remaining to satisfy the request, then NULL is returned.
541 @param AllocationSize The number of bytes to allocate and zero.
543 @return A pointer to the allocated buffer or NULL if allocation fails.
548 AllocateReservedZeroPool (
549 IN UINTN AllocationSize
556 Copies a buffer to an allocated buffer of a certain pool type.
558 Allocates the number bytes specified by AllocationSize of a certain pool type,
559 copies AllocationSize bytes from Buffer to the newly allocated buffer, and returns
560 a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer
561 of 0 size is returned. If there is not enough memory remaining to satisfy the
562 request, then NULL is returned. If Buffer is NULL, then ASSERT().
563 If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
565 @param PoolType The type of pool to allocate.
566 @param AllocationSize The number of bytes to allocate and zero.
567 @param Buffer The buffer to copy to the allocated buffer.
569 @return A pointer to the allocated buffer or NULL if allocation fails.
573 InternalAllocateCopyPool (
574 IN EFI_MEMORY_TYPE PoolType
,
575 IN UINTN AllocationSize
,
576 IN CONST VOID
*Buffer
581 ASSERT (Buffer
!= NULL
);
582 ASSERT (AllocationSize
<= (MAX_ADDRESS
- (UINTN
) Buffer
+ 1));
584 Memory
= InternalAllocatePool (PoolType
, AllocationSize
);
585 if (Memory
!= NULL
) {
586 Memory
= CopyMem (Memory
, Buffer
, AllocationSize
);
592 Copies a buffer to an allocated buffer of type EfiBootServicesData.
594 Allocates the number bytes specified by AllocationSize of type EfiBootServicesData,
595 copies AllocationSize bytes from Buffer to the newly allocated buffer, and returns
596 a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer
597 of 0 size is returned. If there is not enough memory remaining to satisfy the
598 request, then NULL is returned.
600 If Buffer is NULL, then ASSERT().
601 If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
603 @param AllocationSize The number of bytes to allocate and zero.
604 @param Buffer The buffer to copy to the allocated buffer.
606 @return A pointer to the allocated buffer or NULL if allocation fails.
612 IN UINTN AllocationSize
,
613 IN CONST VOID
*Buffer
616 return InternalAllocateCopyPool (EfiRuntimeServicesData
, AllocationSize
, Buffer
);
620 Copies a buffer to an allocated buffer of type EfiRuntimeServicesData.
622 Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData,
623 copies AllocationSize bytes from Buffer to the newly allocated buffer, and returns
624 a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer
625 of 0 size is returned. If there is not enough memory remaining to satisfy the
626 request, then NULL is returned.
628 If Buffer is NULL, then ASSERT().
629 If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
631 @param AllocationSize The number of bytes to allocate and zero.
632 @param Buffer The buffer to copy to the allocated buffer.
634 @return A pointer to the allocated buffer or NULL if allocation fails.
639 AllocateRuntimeCopyPool (
640 IN UINTN AllocationSize
,
641 IN CONST VOID
*Buffer
644 return InternalAllocateCopyPool (EfiRuntimeServicesData
, AllocationSize
, Buffer
);
648 Copies a buffer to an allocated buffer of type EfiReservedMemoryType.
650 Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType,
651 copies AllocationSize bytes from Buffer to the newly allocated buffer, and returns
652 a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer
653 of 0 size is returned. If there is not enough memory remaining to satisfy the
654 request, then NULL is returned.
656 If Buffer is NULL, then ASSERT().
657 If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
659 @param AllocationSize The number of bytes to allocate and zero.
660 @param Buffer The buffer to copy to the allocated buffer.
662 @return A pointer to the allocated buffer or NULL if allocation fails.
667 AllocateReservedCopyPool (
668 IN UINTN AllocationSize
,
669 IN CONST VOID
*Buffer
676 Reallocates a buffer of a specified memory type.
678 Allocates and zeros the number bytes specified by NewSize from memory of the type
679 specified by PoolType. If OldBuffer is not NULL, then the smaller of OldSize and
680 NewSize bytes are copied from OldBuffer to the newly allocated buffer, and
681 OldBuffer is freed. A pointer to the newly allocated buffer is returned.
682 If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
683 enough memory remaining to satisfy the request, then NULL is returned.
685 If the allocation of the new buffer is successful and the smaller of NewSize
686 and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
688 @param PoolType The type of pool to allocate.
689 @param OldSize The size, in bytes, of OldBuffer.
690 @param NewSize The size, in bytes, of the buffer to reallocate.
691 @param OldBuffer The buffer to copy to the allocated buffer. This is an
692 optional parameter that may be NULL.
694 @return A pointer to the allocated buffer or NULL if allocation fails.
698 InternalReallocatePool (
699 IN EFI_MEMORY_TYPE PoolType
,
702 IN VOID
*OldBuffer OPTIONAL
707 NewBuffer
= InternalAllocateZeroPool (PoolType
, NewSize
);
708 if (NewBuffer
!= NULL
&& OldBuffer
!= NULL
) {
709 CopyMem (NewBuffer
, OldBuffer
, MIN (OldSize
, NewSize
));
710 FreePool (OldBuffer
);
716 Reallocates a buffer of type EfiBootServicesData.
718 Allocates and zeros the number bytes specified by NewSize from memory of type
719 EfiBootServicesData. If OldBuffer is not NULL, then the smaller of OldSize and
720 NewSize bytes are copied from OldBuffer to the newly allocated buffer, and
721 OldBuffer is freed. A pointer to the newly allocated buffer is returned.
722 If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
723 enough memory remaining to satisfy the request, then NULL is returned.
725 If the allocation of the new buffer is successful and the smaller of NewSize
726 and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
728 @param OldSize The size, in bytes, of OldBuffer.
729 @param NewSize The size, in bytes, of the buffer to reallocate.
730 @param OldBuffer The buffer to copy to the allocated buffer. This is an
731 optional parameter that may be NULL.
733 @return A pointer to the allocated buffer or NULL if allocation fails.
741 IN VOID
*OldBuffer OPTIONAL
744 return InternalReallocatePool (EfiRuntimeServicesData
, OldSize
, NewSize
, OldBuffer
);
748 Reallocates a buffer of type EfiRuntimeServicesData.
750 Allocates and zeros the number bytes specified by NewSize from memory of type
751 EfiRuntimeServicesData. If OldBuffer is not NULL, then the smaller of OldSize
752 and NewSize bytes are copied from OldBuffer to the newly allocated buffer, and
753 OldBuffer is freed. A pointer to the newly allocated buffer is returned.
754 If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
755 enough memory remaining to satisfy the request, then NULL is returned.
757 If the allocation of the new buffer is successful and the smaller of NewSize
758 and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
760 @param OldSize The size, in bytes, of OldBuffer.
761 @param NewSize The size, in bytes, of the buffer to reallocate.
762 @param OldBuffer The buffer to copy to the allocated buffer. This is an
763 optional parameter that may be NULL.
765 @return A pointer to the allocated buffer or NULL if allocation fails.
770 ReallocateRuntimePool (
773 IN VOID
*OldBuffer OPTIONAL
776 return InternalReallocatePool (EfiRuntimeServicesData
, OldSize
, NewSize
, OldBuffer
);
780 Reallocates a buffer of type EfiReservedMemoryType.
782 Allocates and zeros the number bytes specified by NewSize from memory of type
783 EfiReservedMemoryType. If OldBuffer is not NULL, then the smaller of OldSize
784 and NewSize bytes are copied from OldBuffer to the newly allocated buffer, and
785 OldBuffer is freed. A pointer to the newly allocated buffer is returned.
786 If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
787 enough memory remaining to satisfy the request, then NULL is returned.
789 If the allocation of the new buffer is successful and the smaller of NewSize
790 and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
792 @param OldSize The size, in bytes, of OldBuffer.
793 @param NewSize The size, in bytes, of the buffer to reallocate.
794 @param OldBuffer The buffer to copy to the allocated buffer. This is an
795 optional parameter that may be NULL.
797 @return A pointer to the allocated buffer or NULL if allocation fails.
802 ReallocateReservedPool (
805 IN VOID
*OldBuffer OPTIONAL
812 Frees a buffer that was previously allocated with one of the pool allocation
813 functions in the Memory Allocation Library.
815 Frees the buffer specified by Buffer. Buffer must have been allocated on a
816 previous call to the pool allocation services of the Memory Allocation Library.
817 If it is not possible to free pool resources, then this function will perform
820 If Buffer was not allocated with a pool allocation function in the Memory
821 Allocation Library, then ASSERT().
823 @param Buffer The pointer to the buffer to free.
834 Status
= gSmst
->SmmFreePool (Buffer
);
835 ASSERT_EFI_ERROR (Status
);