]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/DxeMemoryAllocationLib/MemoryAllocationLibInternals.h
Change NameGuid to FvFileName
[mirror_edk2.git] / MdePkg / Library / DxeMemoryAllocationLib / MemoryAllocationLibInternals.h
CommitLineData
e386b444 1/** @file\r
2 Internal include file of DXE Memory Allocation Library.\r
3\r
4 Copyright (c) 2006, Intel Corporation\r
5 All rights reserved. This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
e386b444 13**/\r
14\r
15#ifndef __DXE_MEMORY_ALLOCATION_LIB_INTERNALS_H__\r
16#define __DXE_MEMORY_ALLOCATION_LIB_INTERNALS_H__\r
17\r
f734a10a
A
18#include <PiDxe.h>\r
19#include <Library/MemoryAllocationLib.h>\r
20#include <Library/UefiBootServicesTableLib.h>\r
21#include <Library/BaseMemoryLib.h>\r
22#include <Library/DebugLib.h>\r
23\r
24\r
e386b444 25/**\r
26 Allocates one or more 4KB pages of a certain memory type.\r
27\r
28 Allocates the number of 4KB pages of a certain memory type and returns a pointer to the allocated\r
29 buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL is returned.\r
30 If there is not enough memory remaining to satisfy the request, then NULL is returned.\r
31\r
32 @param MemoryType The type of memory to allocate.\r
33 @param Pages The number of 4 KB pages to allocate.\r
34\r
35 @return A pointer to the allocated buffer or NULL if allocation fails.\r
36\r
37**/\r
38VOID *\r
39InternalAllocatePages (\r
40 IN EFI_MEMORY_TYPE MemoryType, \r
41 IN UINTN Pages\r
42 );\r
43\r
44/**\r
45 Allocates one or more 4KB pages of a certain memory type at a specified alignment.\r
46\r
47 Allocates the number of 4KB pages specified by Pages of a certain memory type with an alignment\r
48 specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is returned.\r
49 If there is not enough memory at the specified alignment remaining to satisfy the request, then\r
50 NULL is returned.\r
51 If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r
52\r
53 @param MemoryType The type of memory to allocate.\r
54 @param Pages The number of 4 KB pages to allocate.\r
55 @param Alignment The requested alignment of the allocation. Must be a power of two.\r
56 If Alignment is zero, then byte alignment is used.\r
57\r
58 @return A pointer to the allocated buffer or NULL if allocation fails.\r
59\r
60**/\r
61VOID *\r
62InternalAllocateAlignedPages (\r
63 IN EFI_MEMORY_TYPE MemoryType, \r
64 IN UINTN Pages,\r
65 IN UINTN Alignment\r
66 );\r
67\r
68/**\r
69 Allocates a buffer of a certain pool type.\r
70\r
71 Allocates the number bytes specified by AllocationSize of a certain pool type and returns a\r
72 pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is\r
73 returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.\r
74\r
75 @param MemoryType The type of memory to allocate.\r
76 @param AllocationSize The number of bytes to allocate.\r
77\r
78 @return A pointer to the allocated buffer or NULL if allocation fails.\r
79\r
80**/\r
81VOID *\r
82InternalAllocatePool (\r
83 IN EFI_MEMORY_TYPE MemoryType, \r
84 IN UINTN AllocationSize\r
85 );\r
86\r
87/**\r
88 Allocates and zeros a buffer of a certian pool type.\r
89\r
90 Allocates the number bytes specified by AllocationSize of a certian pool type, clears the buffer\r
91 with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid\r
92 buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request,\r
93 then NULL is returned.\r
94\r
95 @param PoolType The type of memory to allocate.\r
96 @param AllocationSize The number of bytes to allocate and zero.\r
97\r
98 @return A pointer to the allocated buffer or NULL if allocation fails.\r
99\r
100**/\r
101VOID *\r
102InternalAllocateZeroPool (\r
103 IN EFI_MEMORY_TYPE PoolType, \r
104 IN UINTN AllocationSize\r
105 );\r
106\r
107/**\r
108 Copies a buffer to an allocated buffer of a certian pool type.\r
109\r
110 Allocates the number bytes specified by AllocationSize of a certian pool type, copies\r
111 AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the\r
112 allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there\r
113 is not enough memory remaining to satisfy the request, then NULL is returned.\r
114 If Buffer is NULL, then ASSERT().\r
115 If AllocationSize is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
116\r
117 @param PoolType The type of pool to allocate.\r
118 @param AllocationSize The number of bytes to allocate and zero.\r
119 @param Buffer The buffer to copy to the allocated buffer.\r
120\r
121 @return A pointer to the allocated buffer or NULL if allocation fails.\r
122\r
123**/\r
124VOID *\r
125InternalAllocateCopyPool (\r
126 IN EFI_MEMORY_TYPE PoolType, \r
127 IN UINTN AllocationSize,\r
128 IN CONST VOID *Buffer\r
129 );\r
130\r
131/**\r
132 Allocates a buffer of a certain pool type at a specified alignment.\r
133\r
134 Allocates the number bytes specified by AllocationSize of a certain pool type with an alignment\r
135 specified by Alignment. The allocated buffer is returned. If AllocationSize is 0, then a valid\r
136 buffer of 0 size is returned. If there is not enough memory at the specified alignment remaining\r
137 to satisfy the request, then NULL is returned.\r
138 If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r
139\r
140 @param PoolType The type of pool to allocate.\r
141 @param AllocationSize The number of bytes to allocate.\r
142 @param Alignment The requested alignment of the allocation. Must be a power of two. If Alignment is zero, then byte alignment is used.\r
143 If Alignment is zero, then byte alignment is used.\r
144\r
145 @return A pointer to the allocated buffer or NULL if allocation fails.\r
146\r
147**/\r
148VOID *\r
149InternalAllocateAlignedPool (\r
150 IN EFI_MEMORY_TYPE PoolType,\r
151 IN UINTN AllocationSize,\r
152 IN UINTN Alignment\r
153 );\r
154\r
155/**\r
156 Allocates and zeros a buffer of a certain pool type at a specified alignment.\r
157\r
158 Allocates the number bytes specified by AllocationSize of a certain pool type with an alignment\r
159 specified by Alignment, clears the buffer with zeros, and returns a pointer to the allocated\r
160 buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not\r
161 enough memory at the specified alignment remaining to satisfy the request, then NULL is returned.\r
162 If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r
163\r
164 @param PoolType The type of pool to allocate.\r
165 @param AllocationSize The number of bytes to allocate.\r
166 @param Alignment The requested alignment of the allocation. Must be a power of two.\r
167 If Alignment is zero, then byte alignment is used.\r
168\r
169 @return A pointer to the allocated buffer or NULL if allocation fails.\r
170\r
171**/\r
172VOID *\r
173InternalAllocateAlignedZeroPool (\r
174 IN EFI_MEMORY_TYPE PoolType,\r
175 IN UINTN AllocationSize,\r
176 IN UINTN Alignment\r
177 );\r
178\r
179/**\r
180 Copies a buffer to an allocated buffer of a certain pool type at a specified alignment.\r
181\r
182 Allocates the number bytes specified by AllocationSize of a certain pool type with an alignment\r
183 specified by Alignment. The allocated buffer is returned. If AllocationSize is 0, then a valid\r
184 buffer of 0 size is returned. If there is not enough memory at the specified alignment remaining\r
185 to satisfy the request, then NULL is returned.\r
186 If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r
187\r
188 @param PoolType The type of pool to allocate.\r
189 @param AllocationSize The number of bytes to allocate.\r
190 @param Buffer The buffer to copy to the allocated buffer.\r
191 @param Alignment The requested alignment of the allocation. Must be a power of two.\r
192 If Alignment is zero, then byte alignment is used.\r
193\r
194 @return A pointer to the allocated buffer or NULL if allocation fails.\r
195\r
196**/\r
197VOID *\r
198InternalAllocateAlignedCopyPool (\r
199 IN EFI_MEMORY_TYPE PoolType,\r
200 IN UINTN AllocationSize,\r
201 IN CONST VOID *Buffer,\r
202 IN UINTN Alignment\r
203 );\r
204\r
205#endif\r