]>
Commit | Line | Data |
---|---|---|
878ddf1f | 1 | /*++\r |
2 | \r | |
3 | Copyright (c) 2006, Intel Corporation \r | |
4 | All rights reserved. This program and the accompanying materials \r | |
5 | are licensed and made available under the terms and conditions of the BSD License \r | |
6 | which accompanies this distribution. The full text of the license may be found at \r | |
7 | http://opensource.org/licenses/bsd-license.php \r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
11 | \r | |
12 | Module Name:\r | |
13 | \r | |
14 | imem.h\r | |
15 | \r | |
16 | Abstract:\r | |
17 | \r | |
18 | Head file to imem.h\r | |
19 | \r | |
20 | \r | |
21 | Revision History\r | |
22 | \r | |
23 | --*/\r | |
24 | \r | |
25 | #ifndef _IMEM_H_\r | |
26 | #define _IMEM_H_\r | |
27 | \r | |
28 | #if defined (MDE_CPU_IPF)\r | |
29 | //\r | |
30 | // For Itanium machines make the default allocations 8K aligned\r | |
31 | //\r | |
32 | #define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE * 2)\r | |
33 | #define DEFAULT_PAGE_ALLOCATION (EFI_PAGE_SIZE * 2)\r | |
34 | \r | |
35 | #else\r | |
36 | //\r | |
37 | // For genric EFI machines make the default allocations 4K aligned\r | |
38 | //\r | |
39 | #define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE)\r | |
40 | #define DEFAULT_PAGE_ALLOCATION (EFI_PAGE_SIZE)\r | |
41 | \r | |
42 | #endif\r | |
43 | \r | |
44 | \r | |
45 | //\r | |
46 | // MEMORY_MAP_ENTRY\r | |
47 | //\r | |
48 | \r | |
49 | #define MEMORY_MAP_SIGNATURE EFI_SIGNATURE_32('m','m','a','p')\r | |
50 | typedef struct {\r | |
51 | UINTN Signature;\r | |
52 | LIST_ENTRY Link;\r | |
53 | BOOLEAN FromPool;\r | |
54 | \r | |
55 | EFI_MEMORY_TYPE Type;\r | |
56 | UINT64 Start;\r | |
57 | UINT64 End;\r | |
58 | \r | |
59 | UINT64 VirtualStart;\r | |
60 | UINT64 Attribute;\r | |
61 | } MEMORY_MAP;\r | |
62 | \r | |
63 | //\r | |
64 | // Internal prototypes\r | |
65 | //\r | |
66 | \r | |
67 | VOID *\r | |
68 | CoreAllocatePoolPages (\r | |
69 | IN EFI_MEMORY_TYPE PoolType,\r | |
70 | IN UINTN NumberOfPages,\r | |
71 | IN UINTN Alignment\r | |
72 | )\r | |
73 | /*++\r | |
74 | \r | |
75 | Routine Description:\r | |
76 | \r | |
77 | Internal function. Used by the pool functions to allocate pages\r | |
78 | to back pool allocation requests.\r | |
79 | \r | |
80 | Arguments:\r | |
81 | \r | |
82 | PoolType - The type of memory for the new pool pages\r | |
83 | \r | |
84 | NumberOfPages - No of pages to allocate\r | |
85 | \r | |
86 | Alignment - Bits to align.\r | |
87 | \r | |
88 | Returns:\r | |
89 | \r | |
90 | The allocated memory, or NULL\r | |
91 | \r | |
92 | --*/\r | |
93 | ;\r | |
94 | \r | |
95 | \r | |
96 | VOID\r | |
97 | CoreFreePoolPages (\r | |
98 | IN EFI_PHYSICAL_ADDRESS Memory,\r | |
99 | IN UINTN NumberOfPages\r | |
100 | )\r | |
101 | /*++\r | |
102 | \r | |
103 | Routine Description:\r | |
104 | \r | |
105 | Internal function. Frees pool pages allocated via AllocatePoolPages ()\r | |
106 | \r | |
107 | Arguments:\r | |
108 | \r | |
109 | Memory - The base address to free\r | |
110 | \r | |
111 | NumberOfPages - The number of pages to free\r | |
112 | \r | |
113 | Returns:\r | |
114 | \r | |
115 | None\r | |
116 | \r | |
117 | --*/\r | |
118 | ;\r | |
119 | \r | |
120 | \r | |
121 | VOID *\r | |
122 | CoreAllocatePoolI (\r | |
123 | IN EFI_MEMORY_TYPE PoolType,\r | |
124 | IN UINTN Size\r | |
125 | )\r | |
126 | /*++\r | |
127 | \r | |
128 | Routine Description:\r | |
129 | \r | |
130 | Internal function to allocate pool of a particular type.\r | |
131 | \r | |
132 | Caller must have the memory lock held\r | |
133 | \r | |
134 | \r | |
135 | Arguments:\r | |
136 | \r | |
137 | PoolType - Type of pool to allocate\r | |
138 | \r | |
139 | Size - The amount of pool to allocate\r | |
140 | \r | |
141 | Returns:\r | |
142 | \r | |
143 | The allocate pool, or NULL\r | |
144 | \r | |
145 | --*/\r | |
146 | ;\r | |
147 | \r | |
148 | \r | |
149 | EFI_STATUS\r | |
150 | CoreFreePoolI (\r | |
151 | IN VOID *Buffer\r | |
152 | )\r | |
153 | /*++\r | |
154 | \r | |
155 | Routine Description:\r | |
156 | \r | |
157 | Internal function to free a pool entry.\r | |
158 | \r | |
159 | Caller must have the memory lock held\r | |
160 | \r | |
161 | \r | |
162 | Arguments:\r | |
163 | \r | |
164 | Buffer - The allocated pool entry to free\r | |
165 | \r | |
166 | Returns:\r | |
167 | \r | |
168 | EFI_INVALID_PARAMETER - Buffer not valid\r | |
169 | \r | |
170 | EFI_SUCCESS - Buffer successfully freed.\r | |
171 | \r | |
172 | --*/\r | |
173 | ;\r | |
174 | \r | |
175 | \r | |
176 | VOID\r | |
177 | CoreAcquireMemoryLock (\r | |
178 | VOID\r | |
179 | )\r | |
180 | /*++\r | |
181 | \r | |
182 | Routine Description:\r | |
183 | \r | |
184 | Enter critical section by gaining lock on gMemoryLock\r | |
185 | \r | |
186 | Arguments:\r | |
187 | \r | |
188 | None\r | |
189 | \r | |
190 | Returns:\r | |
191 | \r | |
192 | None\r | |
193 | \r | |
194 | --*/\r | |
195 | ;\r | |
196 | \r | |
197 | VOID\r | |
198 | CoreReleaseMemoryLock (\r | |
199 | VOID\r | |
200 | )\r | |
201 | /*++\r | |
202 | \r | |
203 | Routine Description:\r | |
204 | \r | |
205 | Exit critical section by releasing lock on gMemoryLock\r | |
206 | \r | |
207 | Arguments:\r | |
208 | \r | |
209 | None\r | |
210 | \r | |
211 | Returns:\r | |
212 | \r | |
213 | None\r | |
214 | \r | |
215 | --*/\r | |
216 | ;\r | |
217 | \r | |
218 | \r | |
219 | //\r | |
220 | // Internal Global data\r | |
221 | //\r | |
222 | \r | |
223 | extern EFI_LOCK gMemoryLock; \r | |
224 | extern LIST_ENTRY gMemoryMap;\r | |
225 | extern MEMORY_MAP *gMemoryLastConvert;\r | |
226 | extern LIST_ENTRY mGcdMemorySpaceMap;\r | |
227 | #endif\r |