]>
Commit | Line | Data |
---|---|---|
959ccb23 | 1 | /** @file\r |
2 | Include file that supportes UEFI.\r | |
3 | \r | |
4 | This include file must only contain things defined in the UEFI 2.0 specification.\r | |
5 | If a code construct is defined in the UEFI 2.0 specification it must be included\r | |
6 | by this include file.\r | |
7 | \r | |
8 | Copyright (c) 2006 - 2007, Intel Corporation\r | |
9 | All rights reserved. This program and the accompanying materials\r | |
10 | are licensed and made available under the terms and conditions of the BSD License\r | |
11 | which accompanies this distribution. The full text of the license may be found at\r | |
12 | http://opensource.org/licenses/bsd-license.php\r | |
13 | \r | |
14 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
15 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
16 | \r | |
17 | Module Name: UefiSpec.h\r | |
18 | \r | |
19 | **/\r | |
20 | \r | |
21 | #ifndef __UEFI_SPEC_H__\r | |
22 | #define __UEFI_SPEC_H__\r | |
23 | \r | |
24 | #include <Uefi/UefiMultiPhase.h>\r | |
25 | \r | |
26 | #include <Protocol/DevicePath.h>\r | |
27 | #include <Protocol/SimpleTextIn.h>\r | |
28 | #include <Protocol/SimpleTextOut.h>\r | |
29 | \r | |
30 | //\r | |
31 | // Networking Definitions\r | |
32 | //\r | |
33 | typedef struct {\r | |
34 | UINT8 Addr[4];\r | |
35 | } EFI_IPv4_ADDRESS;\r | |
36 | \r | |
37 | typedef struct {\r | |
38 | UINT8 Addr[16];\r | |
39 | } EFI_IPv6_ADDRESS;\r | |
40 | \r | |
41 | typedef struct {\r | |
42 | UINT8 Addr[32];\r | |
43 | } EFI_MAC_ADDRESS;\r | |
44 | \r | |
45 | typedef union {\r | |
46 | UINT32 Addr[4];\r | |
47 | EFI_IPv4_ADDRESS v4;\r | |
48 | EFI_IPv6_ADDRESS v6;\r | |
49 | } EFI_IP_ADDRESS;\r | |
50 | \r | |
51 | \r | |
52 | //\r | |
53 | // Enumeration of memory allocation.\r | |
54 | // \r | |
55 | typedef enum {\r | |
56 | AllocateAnyPages,\r | |
57 | AllocateMaxAddress,\r | |
58 | AllocateAddress,\r | |
59 | MaxAllocateType\r | |
60 | } EFI_ALLOCATE_TYPE;\r | |
61 | \r | |
62 | \r | |
63 | //\r | |
64 | // possible caching types for the memory range\r | |
65 | //\r | |
66 | #define EFI_MEMORY_UC 0x0000000000000001ULL\r | |
67 | #define EFI_MEMORY_WC 0x0000000000000002ULL\r | |
68 | #define EFI_MEMORY_WT 0x0000000000000004ULL\r | |
69 | #define EFI_MEMORY_WB 0x0000000000000008ULL\r | |
70 | #define EFI_MEMORY_UCE 0x0000000000000010ULL\r | |
71 | \r | |
72 | //\r | |
73 | // physical memory protection on range\r | |
74 | //\r | |
75 | #define EFI_MEMORY_WP 0x0000000000001000ULL\r | |
76 | #define EFI_MEMORY_RP 0x0000000000002000ULL\r | |
77 | #define EFI_MEMORY_XP 0x0000000000004000ULL\r | |
78 | \r | |
79 | //\r | |
80 | // range requires a runtime mapping\r | |
81 | //\r | |
82 | #define EFI_MEMORY_RUNTIME 0x8000000000000000ULL\r | |
83 | \r | |
84 | #define EFI_MEMORY_DESCRIPTOR_VERSION 1\r | |
85 | typedef struct {\r | |
86 | UINT32 Type;\r | |
87 | EFI_PHYSICAL_ADDRESS PhysicalStart;\r | |
88 | EFI_VIRTUAL_ADDRESS VirtualStart;\r | |
89 | UINT64 NumberOfPages;\r | |
90 | UINT64 Attribute;\r | |
91 | } EFI_MEMORY_DESCRIPTOR;\r | |
92 | \r | |
93 | //\r | |
94 | // Build macros to find next EFI_MEMORY_DESCRIPTOR.\r | |
95 | // \r | |
96 | #define NextMemoryDescriptor(_Ptr, _Size) ((EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) (_Ptr)) + (_Size)))\r | |
97 | #define NEXT_MEMORY_DESCRIPTOR(_Ptr, _Size) NextMemoryDescriptor (_Ptr, _Size)\r | |
98 | \r | |
99 | //\r | |
100 | // Declare forward referenced data structures\r | |
101 | //\r | |
102 | typedef struct _EFI_SYSTEM_TABLE EFI_SYSTEM_TABLE;\r | |
103 | \r | |
104 | /**\r | |
105 | Allocates memory pages from the system.\r | |
106 | \r | |
107 | @param Type The type of allocation to perform.\r | |
108 | @param MemoryType The type of memory to allocate.\r | |
109 | @param Pages The number of contiguous 4 KB pages to allocate.\r | |
110 | @param Memory Pointer to a physical address. On input, the way in which the address is\r | |
111 | used depends on the value of Type.\r | |
112 | \r | |
113 | @retval EFI_SUCCESS The requested pages were allocated.\r | |
114 | @retval EFI_INVALID_PARAMETER 1) Type is not AllocateAnyPages or\r | |
115 | AllocateMaxAddress or AllocateAddress.\r | |
116 | 2) MemoryType is in the range\r | |
117 | EfiMaxMemoryType..0x7FFFFFFF.\r | |
118 | @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.\r | |
119 | @retval EFI_NOT_FOUND The requested pages could not be found.\r | |
120 | \r | |
121 | **/\r | |
122 | typedef\r | |
123 | EFI_STATUS\r | |
124 | (EFIAPI *EFI_ALLOCATE_PAGES) (\r | |
125 | IN EFI_ALLOCATE_TYPE Type,\r | |
126 | IN EFI_MEMORY_TYPE MemoryType,\r | |
127 | IN UINTN Pages,\r | |
128 | IN OUT EFI_PHYSICAL_ADDRESS *Memory\r | |
129 | );\r | |
130 | \r | |
131 | /**\r | |
132 | Frees memory pages.\r | |
133 | \r | |
134 | @param Memory The base physical address of the pages to be freed.\r | |
135 | @param Pages The number of contiguous 4 KB pages to free.\r | |
136 | \r | |
137 | @retval EFI_SUCCESS The requested pages were freed.\r | |
138 | @retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or Pages is invalid.\r | |
139 | @retval EFI_NOT_FOUND The requested memory pages were not allocated with\r | |
140 | AllocatePages().\r | |
141 | \r | |
142 | **/\r | |
143 | typedef\r | |
144 | EFI_STATUS\r | |
145 | (EFIAPI *EFI_FREE_PAGES) (\r | |
146 | IN EFI_PHYSICAL_ADDRESS Memory,\r | |
147 | IN UINTN Pages\r | |
148 | );\r | |
149 | \r | |
150 | /**\r | |
151 | Returns the current memory map.\r | |
152 | \r | |
153 | @param MemoryMapSize A pointer to the size, in bytes, of the MemoryMap buffer.\r | |
154 | @param MemoryMap A pointer to the buffer in which firmware places the current memory\r | |
155 | map.\r | |
156 | @param MapKey A pointer to the location in which firmware returns the key for the\r | |
157 | current memory map.\r | |
158 | @param DescriptorSize A pointer to the location in which firmware returns the size, in bytes, of\r | |
159 | an individual EFI_MEMORY_DESCRIPTOR.\r | |
160 | @param DescriptorVersion A pointer to the location in which firmware returns the version number\r | |
161 | associated with the EFI_MEMORY_DESCRIPTOR.\r | |
162 | \r | |
163 | @retval EFI_SUCCESS The memory map was returned in the MemoryMap buffer.\r | |
164 | @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current buffer size\r | |
165 | needed to hold the memory map is returned in MemoryMapSize.\r | |
166 | @retval EFI_INVALID_PARAMETER 1) MemoryMapSize is NULL.\r | |
167 | 2) The MemoryMap buffer is not too small and MemoryMap is\r | |
168 | NULL.\r | |
169 | \r | |
170 | **/\r | |
171 | typedef\r | |
172 | EFI_STATUS\r | |
173 | (EFIAPI *EFI_GET_MEMORY_MAP) (\r | |
174 | IN OUT UINTN *MemoryMapSize,\r | |
175 | IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap,\r | |
176 | OUT UINTN *MapKey,\r | |
177 | OUT UINTN *DescriptorSize,\r | |
178 | OUT UINT32 *DescriptorVersion\r | |
179 | );\r | |
180 | \r | |
181 | /**\r | |
182 | Allocates pool memory.\r | |
183 | \r | |
184 | @param PoolType The type of pool to allocate.\r | |
185 | @param Size The number of bytes to allocate from the pool.\r | |
186 | @param Buffer A pointer to a pointer to the allocated buffer if the call succeeds;\r | |
187 | undefined otherwise.\r | |
188 | \r | |
189 | @retval EFI_SUCCESS The requested number of bytes was allocated.\r | |
190 | @retval EFI_OUT_OF_RESOURCES The pool requested could not be allocated.\r | |
191 | @retval EFI_INVALID_PARAMETER PoolType was invalid.\r | |
192 | \r | |
193 | **/\r | |
194 | typedef\r | |
195 | EFI_STATUS\r | |
196 | (EFIAPI *EFI_ALLOCATE_POOL) (\r | |
197 | IN EFI_MEMORY_TYPE PoolType,\r | |
198 | IN UINTN Size,\r | |
199 | OUT VOID **Buffer\r | |
200 | );\r | |
201 | \r | |
202 | /**\r | |
203 | Returns pool memory to the system.\r | |
204 | \r | |
205 | @param Buffer Pointer to the buffer to free.\r | |
206 | \r | |
207 | @retval EFI_SUCCESS The memory was returned to the system.\r | |
208 | @retval EFI_INVALID_PARAMETER Buffer was invalid.\r | |
209 | \r | |
210 | **/\r | |
211 | typedef\r | |
212 | EFI_STATUS\r | |
213 | (EFIAPI *EFI_FREE_POOL) (\r | |
214 | IN VOID *Buffer\r | |
215 | );\r | |
216 | \r | |
217 | /**\r | |
218 | Changes the runtime addressing mode of EFI firmware from physical to virtual.\r | |
219 | \r | |
220 | @param MemoryMapSize The size in bytes of VirtualMap.\r | |
221 | @param DescriptorSize The size in bytes of an entry in the VirtualMap.\r | |
222 | @param DescriptorVersion The version of the structure entries in VirtualMap.\r | |
223 | @param VirtualMap An array of memory descriptors which contain new virtual\r | |
224 | address mapping information for all runtime ranges.\r | |
225 | \r | |
226 | @retval EFI_SUCCESS The virtual address map has been applied.\r | |
227 | @retval EFI_UNSUPPORTED EFI firmware is not at runtime, or the EFI firmware is already in\r | |
228 | virtual address mapped mode.\r | |
229 | @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is invalid.\r | |
230 | @retval EFI_NO_MAPPING A virtual address was not supplied for a range in the memory\r | |
231 | map that requires a mapping.\r | |
232 | @retval EFI_NOT_FOUND A virtual address was supplied for an address that is not found\r | |
233 | in the memory map.\r | |
234 | \r | |
235 | **/\r | |
236 | typedef\r | |
237 | EFI_STATUS\r | |
238 | (EFIAPI *EFI_SET_VIRTUAL_ADDRESS_MAP) (\r | |
239 | IN UINTN MemoryMapSize,\r | |
240 | IN UINTN DescriptorSize,\r | |
241 | IN UINT32 DescriptorVersion,\r | |
242 | IN EFI_MEMORY_DESCRIPTOR *VirtualMap\r | |
243 | );\r | |
244 | \r | |
245 | /**\r | |
246 | Connects one or more drivers to a controller.\r | |
247 | \r | |
248 | @param ControllerHandle The handle of the controller to which driver(s) are to be connected.\r | |
249 | @param DriverImageHandle A pointer to an ordered list handles that support the\r | |
250 | EFI_DRIVER_BINDING_PROTOCOL.\r | |
251 | @param RemainingDevicePath A pointer to the device path that specifies a child of the\r | |
252 | controller specified by ControllerHandle.\r | |
253 | @param Recursive If TRUE, then ConnectController() is called recursively\r | |
254 | until the entire tree of controllers below the controller specified\r | |
255 | by ControllerHandle have been created. If FALSE, then\r | |
256 | the tree of controllers is only expanded one level.\r | |
257 | \r | |
258 | @retval EFI_SUCCESS 1) One or more drivers were connected to ControllerHandle.\r | |
259 | 2) No drivers were connected to ControllerHandle, but\r | |
260 | RemainingDevicePath is not NULL, and it is an End Device\r | |
261 | Path Node.\r | |
262 | @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r | |
263 | @retval EFI_NOT_FOUND 1) There are no EFI_DRIVER_BINDING_PROTOCOL instances\r | |
264 | present in the system.\r | |
265 | 2) No drivers were connected to ControllerHandle.\r | |
266 | \r | |
267 | **/\r | |
268 | typedef\r | |
269 | EFI_STATUS\r | |
270 | (EFIAPI *EFI_CONNECT_CONTROLLER) (\r | |
271 | IN EFI_HANDLE ControllerHandle,\r | |
272 | IN EFI_HANDLE *DriverImageHandle, OPTIONAL\r | |
273 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath, OPTIONAL\r | |
274 | IN BOOLEAN Recursive\r | |
275 | );\r | |
276 | \r | |
277 | /**\r | |
278 | Disconnects one or more drivers from a controller.\r | |
279 | \r | |
280 | @param ControllerHandle The handle of the controller from which driver(s) are to be disconnected.\r | |
281 | @param DriverImageHandle The driver to disconnect from ControllerHandle.\r | |
282 | @param ChildHandle The handle of the child to destroy.\r | |
283 | \r | |
284 | @retval EFI_SUCCESS 1) One or more drivers were disconnected from the controller.\r | |
285 | 2) On entry, no drivers are managing ControllerHandle.\r | |
286 | 3) DriverImageHandle is not NULL, and on entry\r | |
287 | DriverImageHandle is not managing ControllerHandle.\r | |
288 | \r | |
289 | @retval EFI_INVALID_PARAMETER One ore more parameters are invalid.\r | |
290 | @retval EFI_OUT_OF_RESOURCES There are not enough resources available to disconnect any drivers from\r | |
291 | ControllerHandle.\r | |
292 | @retval EFI_DEVICE_ERROR The controller could not be disconnected because of a device error.\r | |
293 | \r | |
294 | **/\r | |
295 | typedef\r | |
296 | EFI_STATUS\r | |
297 | (EFIAPI *EFI_DISCONNECT_CONTROLLER) (\r | |
298 | IN EFI_HANDLE ControllerHandle,\r | |
299 | IN EFI_HANDLE DriverImageHandle, OPTIONAL\r | |
300 | IN EFI_HANDLE ChildHandle OPTIONAL\r | |
301 | );\r | |
302 | \r | |
303 | \r | |
304 | \r | |
305 | //\r | |
306 | // ConvertPointer DebugDisposition type.\r | |
307 | //\r | |
308 | #define EFI_OPTIONAL_PTR 0x00000001\r | |
309 | #define EFI_OPTIONAL_POINTER EFI_OPTIONAL_PTR\r | |
310 | \r | |
311 | /**\r | |
312 | Determines the new virtual address that is to be used on subsequent memory accesses.\r | |
313 | \r | |
314 | @param DebugDisposition Supplies type information for the pointer being converted.\r | |
315 | @param Address A pointer to a pointer that is to be fixed to be the value needed\r | |
316 | for the new virtual address mappings being applied.\r | |
317 | \r | |
318 | @retval EFI_SUCCESS The pointer pointed to by Address was modified.\r | |
319 | @retval EFI_INVALID_PARAMETER 1) Address is NULL.\r | |
320 | 2) *Address is NULL and DebugDisposition does\r | |
321 | not have the EFI_OPTIONAL_PTR bit set.\r | |
322 | @retval EFI_NOT_FOUND The pointer pointed to by Address was not found to be part\r | |
323 | of the current memory map. This is normally fatal.\r | |
324 | \r | |
325 | **/\r | |
326 | typedef\r | |
327 | EFI_STATUS\r | |
328 | (EFIAPI *EFI_CONVERT_POINTER) (\r | |
329 | IN UINTN DebugDisposition,\r | |
330 | IN OUT VOID **Address\r | |
331 | );\r | |
332 | \r | |
333 | \r | |
334 | //\r | |
335 |