]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLib.c
UEFI HII: Merge UEFI HII support changes from branch.
[mirror_edk2.git] / MdePkg / Library / PeiMemoryAllocationLib / MemoryAllocationLib.c
index ae3481d19c9fc9c22898e16f6f7147328a2775df..80a01aac7b830cabb981161b121c6ad9a5aa53b8 100644 (file)
   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
 \r
-  Module Name:  MemoryAllocationLib.c\r
-\r
 **/\r
 \r
 \r
+#include <PiPei.h>\r
+\r
+\r
+#include <Library/MemoryAllocationLib.h>\r
+#include <Library/PeiServicesTablePointerLib.h>\r
+#include <Library/PeiServicesLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/DebugLib.h>\r
+\r
+#include "MemoryAllocationLibInternals.h"\r
+\r
 /**\r
   Allocates one or more 4KB pages of a certain memory type.\r
 \r
@@ -36,14 +45,12 @@ InternalAllocatePages (
 {\r
   EFI_STATUS            Status;\r
   EFI_PHYSICAL_ADDRESS  Memory; \r
-  EFI_PEI_SERVICES      **PeiServices;\r
 \r
   if (Pages == 0) {\r
     return NULL;\r
   }\r
 \r
-  PeiServices = GetPeiServicesTablePointer ();\r
-  Status = (*PeiServices)->AllocatePages (PeiServices, MemoryType, Pages, &Memory);\r
+  Status = PeiServicesAllocatePages (MemoryType, Pages, &Memory);\r
   if (EFI_ERROR (Status)) {\r
     Memory = 0;\r
   }\r
@@ -345,12 +352,9 @@ AllocatePool (
   )\r
 {\r
   EFI_STATUS        Status;\r
-  EFI_PEI_SERVICES  **PeiServices;\r
   VOID              *Buffer;\r
   \r
-  PeiServices = GetPeiServicesTablePointer ();\r
-\r
-  Status = (*PeiServices)->AllocatePool (PeiServices, AllocationSize, &Buffer);\r
+  Status = PeiServicesAllocatePool (AllocationSize, &Buffer);\r
   if (EFI_ERROR (Status)) {\r
     Buffer = NULL;\r
   }\r
@@ -1071,3 +1075,16 @@ FreeAlignedPool (
   // PEI phase does not support to free pool, so leave it as NOP.\r
   //\r
 }\r
+\r
+\r
+VOID\r
+EFIAPI\r
+SafeFreePool (\r
+  IN VOID   *Buffer\r
+  )\r
+{\r
+  //\r
+  // PEI phase does not support to free pool, so leave it as NOP.\r
+  //\r
+}\r
+\r