]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/PeiMemoryAllocationLib/MemoryAllocationLibInternals.h
Updated headers to follow coding standard
[mirror_edk2.git] / MdePkg / Library / PeiMemoryAllocationLib / MemoryAllocationLibInternals.h
CommitLineData
e386b444 1/** @file\r
2 Internal include file of PEI Memory Allocation Library.\r
3\r
842f5579 4 Copyright (c) 2006, Intel Corporation<BR>\r
e386b444 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 __PEI_MEMORY_ALLOCATION_LIB_INTERNALS_H__\r
16#define __PEI_MEMORY_ALLOCATION_LIB_INTERNALS_H__\r
17\r
e386b444 18/**\r
19 Allocates one or more 4KB pages of a certain memory type.\r
20\r
21 Allocates the number of 4KB pages of a certain memory type and returns a pointer to the allocated\r
22 buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL is returned.\r
23 If there is not enough memory remaining to satisfy the request, then NULL is returned.\r
24\r
25 @param MemoryType The type of memory to allocate.\r
26 @param Pages The number of 4 KB pages to allocate.\r
27\r
28 @return A pointer to the allocated buffer or NULL if allocation fails.\r
29\r
30**/\r
31VOID *\r
32InternalAllocatePages (\r
33 IN EFI_MEMORY_TYPE MemoryType, \r
34 IN UINTN Pages\r
35 );\r
36\r
37/**\r
38 Allocates one or more 4KB pages of a certain memory type at a specified alignment.\r
39\r
40 Allocates the number of 4KB pages specified by Pages of a certain memory type with an alignment\r
41 specified by Alignment. The allocated buffer is returned. If Pages is 0, then NULL is returned.\r
42 If there is not enough memory at the specified alignment remaining to satisfy the request, then\r
43 NULL is returned.\r
44 If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r
45\r
46 @param MemoryType The type of memory to allocate.\r
47 @param Pages The number of 4 KB pages to allocate.\r
48 @param Alignment The requested alignment of the allocation. Must be a power of two.\r
49 If Alignment is zero, then byte alignment is used.\r
50\r
51 @return A pointer to the allocated buffer or NULL if allocation fails.\r
52\r
53**/\r
54VOID *\r
55InternalAllocateAlignedPages (\r
56 IN EFI_MEMORY_TYPE MemoryType, \r
57 IN UINTN Pages,\r
58 IN UINTN Alignment\r
59 );\r
60\r
61/**\r
62 Allocates a buffer of a certain pool type.\r
63\r
64 Allocates the number bytes specified by AllocationSize of a certain pool type and returns a\r
65 pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is\r
66 returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.\r
67\r
68 @param MemoryType The type of memory to allocate.\r
69 @param AllocationSize The number of bytes to allocate.\r
70\r
71 @return A pointer to the allocated buffer or NULL if allocation fails.\r
72\r
73**/\r
74VOID *\r
75InternalAllocatePool (\r
76 IN EFI_MEMORY_TYPE MemoryType, \r
77 IN UINTN AllocationSize\r
78 );\r
79\r
80/**\r
81 Allocates and zeros a buffer of a certian pool type.\r
82\r
83 Allocates the number bytes specified by AllocationSize of a certian pool type, clears the buffer\r
84 with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid\r
85 buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request,\r
86 then NULL is returned.\r
87\r
88 @param PoolType The type of memory to allocate.\r
89 @param AllocationSize The number of bytes to allocate and zero.\r
90\r
91 @return A pointer to the allocated buffer or NULL if allocation fails.\r
92\r
93**/\r
94VOID *\r
95InternalAllocateZeroPool (\r
96 IN EFI_MEMORY_TYPE PoolType, \r
97 IN UINTN AllocationSize\r
98 );\r
99\r
100/**\r
101 Copies a buffer to an allocated buffer of a certian pool type.\r
102\r
103 Allocates the number bytes specified by AllocationSize of a certian pool type, copies\r
104 AllocationSize bytes from Buffer to the newly allocated buffer, and returns a pointer to the\r
105 allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there\r
106 is not enough memory remaining to satisfy the request, then NULL is returned.\r
107 If Buffer is NULL, then ASSERT().\r
108 If AllocationSize is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT(). \r
109\r
110 @param PoolType The type of pool to allocate.\r
111 @param AllocationSize The number of bytes to allocate and zero.\r
112 @param Buffer The buffer to copy to the allocated buffer.\r
113\r
114 @return A pointer to the allocated buffer or NULL if allocation fails.\r
115\r
116**/\r
117VOID *\r
118InternalAllocateCopyPool (\r
119 IN EFI_MEMORY_TYPE PoolType, \r
120 IN UINTN AllocationSize,\r
121 IN CONST VOID *Buffer\r
122 );\r
123\r
124/**\r
125 Allocates a buffer of a certain pool type at a specified alignment.\r
126\r
127 Allocates the number bytes specified by AllocationSize of a certain pool type with an alignment\r
128 specified by Alignment. The allocated buffer is returned. If AllocationSize is 0, then a valid\r
129 buffer of 0 size is returned. If there is not enough memory at the specified alignment remaining\r
130 to satisfy the request, then NULL is returned.\r
131 If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r
132\r
133 @param PoolType The type of pool to allocate.\r
134 @param AllocationSize The number of bytes to allocate.\r
135 @param Alignment The requested alignment of the allocation. Must be a power of two. If Alignment is zero, then byte alignment is used.\r
136 If Alignment is zero, then byte alignment is used.\r
137\r
138 @return A pointer to the allocated buffer or NULL if allocation fails.\r
139\r
140**/\r
141VOID *\r
142InternalAllocateAlignedPool (\r
143 IN EFI_MEMORY_TYPE PoolType,\r
144 IN UINTN AllocationSize,\r
145 IN UINTN Alignment\r
146 );\r
147\r
148/**\r
149 Allocates and zeros a buffer of a certain pool type at a specified alignment.\r
150\r
151 Allocates the number bytes specified by AllocationSize of a certain pool type with an alignment\r
152 specified by Alignment, clears the buffer with zeros, and returns a pointer to the allocated\r
153 buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not\r
154 enough memory at the specified alignment remaining to satisfy the request, then NULL is returned.\r
155 If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r
156\r
157 @param PoolType The type of pool to allocate.\r
158 @param AllocationSize The number of bytes to allocate.\r
159 @param Alignment The requested alignment of the allocation. Must be a power of two.\r
160 If Alignment is zero, then byte alignment is used.\r
161\r
162 @return A pointer to the allocated buffer or NULL if allocation fails.\r
163\r
164**/\r
165VOID *\r
166InternalAllocateAlignedZeroPool (\r
167 IN EFI_MEMORY_TYPE PoolType,\r
168 IN UINTN AllocationSize,\r
169 IN UINTN Alignment\r
170 );\r
171\r
172/**\r
173 Copies a buffer to an allocated buffer of a certain pool type at a specified alignment.\r
174\r
175 Allocates the number bytes specified by AllocationSize of a certain pool type with an alignment\r
176 specified by Alignment. The allocated buffer is returned. If AllocationSize is 0, then a valid\r
177 buffer of 0 size is returned. If there is not enough memory at the specified alignment remaining\r
178 to satisfy the request, then NULL is returned.\r
179 If Alignment is not a power of two and Alignment is not zero, then ASSERT().\r
180\r
181 @param PoolType The type of pool to allocate.\r
182 @param AllocationSize The number of bytes to allocate.\r
183 @param Buffer The buffer to copy to the allocated buffer.\r
184 @param Alignment The requested alignment of the allocation. Must be a power of two.\r
185 If Alignment is zero, then byte alignment is used.\r
186\r
187 @return A pointer to the allocated buffer or NULL if allocation fails.\r
188\r
189**/\r
190VOID *\r
191InternalAllocateAlignedCopyPool (\r
192 IN EFI_MEMORY_TYPE PoolType,\r
193 IN UINTN AllocationSize,\r
194 IN CONST VOID *Buffer,\r
195 IN UINTN Alignment\r
196 );\r
197\r
198#endif\r