#include <Library/PrePiLib.h>\r
#include <Library/DebugLib.h>\r
\r
-/**\r
- Allocates one or more 4KB pages of type EfiBootServicesData.\r
-\r
- Allocates the number of 4KB pages of MemoryType and returns a pointer to the\r
- allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL\r
- is returned. If there is not enough memory remaining to satisfy the request, then NULL is\r
- returned.\r
-\r
- @param Pages The number of 4 KB pages to allocate.\r
-\r
- @return A pointer to the allocated buffer or NULL if allocation fails.\r
-\r
-**/\r
+STATIC\r
VOID *\r
EFIAPI\r
-AllocatePages (\r
- IN UINTN Pages\r
+InternalAllocatePages (\r
+ IN UINTN Pages,\r
+ IN EFI_MEMORY_TYPE MemoryType\r
)\r
{\r
EFI_PEI_HOB_POINTERS Hob;\r
BuildMemoryAllocationHob (\r
Hob.HandoffInformationTable->EfiFreeMemoryTop,\r
Pages * EFI_PAGE_SIZE,\r
- EfiBootServicesData\r
+ MemoryType\r
);\r
return (VOID *)(UINTN)Hob.HandoffInformationTable->EfiFreeMemoryTop;\r
}\r
}\r
\r
+/**\r
+ Allocates one or more 4KB pages of type EfiBootServicesData.\r
+\r
+ Allocates the number of 4KB pages of MemoryType and returns a pointer to the\r
+ allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL\r
+ is returned. If there is not enough memory remaining to satisfy the request, then NULL is\r
+ returned.\r
+\r
+ @param Pages The number of 4 KB pages to allocate.\r
+\r
+ @return A pointer to the allocated buffer or NULL if allocation fails.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+AllocatePages (\r
+ IN UINTN Pages\r
+ )\r
+{\r
+ return InternalAllocatePages (Pages, EfiBootServicesData);\r
+}\r
+\r
+/**\r
+ Allocates one or more 4KB pages of type EfiRuntimeServicesData.\r
+\r
+ Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a pointer to the\r
+ allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL\r
+ is returned. If there is not enough memory remaining to satisfy the request, then NULL is\r
+ returned.\r
+\r
+ @param Pages The number of 4 KB pages to allocate.\r
+\r
+ @return A pointer to the allocated buffer or NULL if allocation fails.\r
+\r
+**/\r
+VOID *\r
+EFIAPI\r
+AllocateRuntimePages (\r
+ IN UINTN Pages\r
+ )\r
+{\r
+ return InternalAllocatePages (Pages, EfiRuntimeServicesData);\r
+}\r
+\r
/**\r
Allocates one or more 4KB pages of type EfiBootServicesData at a specified alignment.\r
\r