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