|
14 | 14 | #include <Library/PrePiLib.h>
|
15 | 15 | #include <Library/DebugLib.h>
|
16 | 16 |
|
17 |
| -/** |
18 |
| - Allocates one or more 4KB pages of type EfiBootServicesData. |
19 |
| -
|
20 |
| - Allocates the number of 4KB pages of MemoryType and returns a pointer to the |
21 |
| - allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL |
22 |
| - is returned. If there is not enough memory remaining to satisfy the request, then NULL is |
23 |
| - returned. |
24 |
| -
|
25 |
| - @param Pages The number of 4 KB pages to allocate. |
26 |
| -
|
27 |
| - @return A pointer to the allocated buffer or NULL if allocation fails. |
28 |
| -
|
29 |
| -**/ |
| 17 | +STATIC |
30 | 18 | VOID *
|
31 | 19 | EFIAPI
|
32 |
| -AllocatePages ( |
33 |
| - IN UINTN Pages |
| 20 | +InternalAllocatePages ( |
| 21 | + IN UINTN Pages, |
| 22 | + IN EFI_MEMORY_TYPE MemoryType |
34 | 23 | )
|
35 | 24 | {
|
36 | 25 | EFI_PEI_HOB_POINTERS Hob;
|
@@ -65,12 +54,56 @@ AllocatePages (
|
65 | 54 | BuildMemoryAllocationHob (
|
66 | 55 | Hob.HandoffInformationTable->EfiFreeMemoryTop,
|
67 | 56 | Pages * EFI_PAGE_SIZE,
|
68 |
| - EfiBootServicesData |
| 57 | + MemoryType |
69 | 58 | );
|
70 | 59 | return (VOID *)(UINTN)Hob.HandoffInformationTable->EfiFreeMemoryTop;
|
71 | 60 | }
|
72 | 61 | }
|
73 | 62 |
|
| 63 | +/** |
| 64 | + Allocates one or more 4KB pages of type EfiBootServicesData. |
| 65 | +
|
| 66 | + Allocates the number of 4KB pages of MemoryType and returns a pointer to the |
| 67 | + allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL |
| 68 | + is returned. If there is not enough memory remaining to satisfy the request, then NULL is |
| 69 | + returned. |
| 70 | +
|
| 71 | + @param Pages The number of 4 KB pages to allocate. |
| 72 | +
|
| 73 | + @return A pointer to the allocated buffer or NULL if allocation fails. |
| 74 | +
|
| 75 | +**/ |
| 76 | +VOID * |
| 77 | +EFIAPI |
| 78 | +AllocatePages ( |
| 79 | + IN UINTN Pages |
| 80 | + ) |
| 81 | +{ |
| 82 | + return InternalAllocatePages (Pages, EfiBootServicesData); |
| 83 | +} |
| 84 | + |
| 85 | +/** |
| 86 | + Allocates one or more 4KB pages of type EfiRuntimeServicesData. |
| 87 | +
|
| 88 | + Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a pointer to the |
| 89 | + allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL |
| 90 | + is returned. If there is not enough memory remaining to satisfy the request, then NULL is |
| 91 | + returned. |
| 92 | +
|
| 93 | + @param Pages The number of 4 KB pages to allocate. |
| 94 | +
|
| 95 | + @return A pointer to the allocated buffer or NULL if allocation fails. |
| 96 | +
|
| 97 | +**/ |
| 98 | +VOID * |
| 99 | +EFIAPI |
| 100 | +AllocateRuntimePages ( |
| 101 | + IN UINTN Pages |
| 102 | + ) |
| 103 | +{ |
| 104 | + return InternalAllocatePages (Pages, EfiRuntimeServicesData); |
| 105 | +} |
| 106 | + |
74 | 107 | /**
|
75 | 108 | Allocates one or more 4KB pages of type EfiBootServicesData at a specified alignment.
|
76 | 109 |
|
|
0 commit comments