]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Uefi/UefiSpec.h
Initial import.
[mirror_edk2.git] / MdePkg / Include / Uefi / UefiSpec.h
Content-type: text/html ]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Uefi/UefiSpec.h


500 - Internal Server Error

Malformed UTF-8 character (fatal) at (eval 6) line 1, <$fd> line 863.
CommitLineData
878ddf1f 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, 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 <Common/MultiPhase.h>\r
25\r
26//\r
27// EFI Data Types based on ANSI C integer types in EfiBind.h\r
28//\r
29\r
30\r
31//\r
32// EFI Data Types derived from other EFI data types.\r
33//\r
34\r
35#define NULL_HANDLE ((VOID *) 0)\r
36\r
37typedef VOID *EFI_EVENT;\r
38typedef UINTN EFI_TPL;\r
39\r
40//\r
41// EFI Time Abstraction:\r
42// Year: 2000 - 20XX\r
43// Month: 1 - 12\r
44// Day: 1 - 31\r
45// Hour: 0 - 23\r
46// Minute: 0 - 59\r
47// Second: 0 - 59\r
48// Nanosecond: 0 - 999,999,999\r
49// TimeZone: -1440 to 1440 or 2047\r
50//\r
51typedef struct {\r
52 UINT16 Year;\r
53 UINT8 Month;\r
54 UINT8 Day;\r
55 UINT8 Hour;\r
56 UINT8 Minute;\r
57 UINT8 Second;\r
58 UINT8 Pad1;\r
59 UINT32 Nanosecond;\r
60 INT16 TimeZone;\r
61 UINT8 Daylight;\r
62 UINT8 Pad2;\r
63} EFI_TIME;\r
64\r
65//\r
66// Bit definitions for EFI_TIME.Daylight\r
67//\r
68#define EFI_TIME_ADJUST_DAYLIGHT 0x01\r
69#define EFI_TIME_IN_DAYLIGHT 0x02\r
70\r
71//\r
72// Value definition for EFI_TIME.TimeZone\r
73//\r
74#define EFI_UNSPECIFIED_TIMEZONE 0x07FF\r
75\r
76//\r
77// Networking\r
78//\r
79typedef struct {\r
80 UINT8 Addr[4];\r
81} EFI_IPv4_ADDRESS;\r
82\r
83typedef struct {\r
84 UINT8 Addr[16];\r
85} EFI_IPv6_ADDRESS;\r
86\r
87typedef struct {\r
88 UINT8 Addr[32];\r
89} EFI_MAC_ADDRESS;\r
90\r
91typedef union {\r
92 UINT32 Addr[4];\r
93 EFI_IPv4_ADDRESS v4;\r
94 EFI_IPv6_ADDRESS v6;\r
95} EFI_IP_ADDRESS;\r
96\r
97\r
98typedef enum {\r
99 AllocateAnyPages,\r
100 AllocateMaxAddress,\r
101 AllocateAddress,\r
102 MaxAllocateType\r
103} EFI_ALLOCATE_TYPE;\r
104\r
105\r
106//\r
107// possible caching types for the memory range\r
108//\r
109#define EFI_MEMORY_UC 0x0000000000000001ULL\r
110#define EFI_MEMORY_WC 0x0000000000000002ULL\r
111#define EFI_MEMORY_WT 0x0000000000000004ULL\r
112#define EFI_MEMORY_WB 0x0000000000000008ULL\r
113#define EFI_MEMORY_UCE 0x0000000000000010ULL\r
114\r
115//\r
116// physical memory protection on range\r
117//\r
118#define EFI_MEMORY_WP 0x0000000000001000ULL\r
119#define EFI_MEMORY_RP 0x0000000000002000ULL\r
120#define EFI_MEMORY_XP 0x0000000000004000ULL\r
121\r
122//\r
123// range requires a runtime mapping\r
124//\r
125#define EFI_MEMORY_RUNTIME 0x8000000000000000ULL\r
126\r
127typedef UINT64 EFI_VIRTUAL_ADDRESS;\r
128\r
129#define EFI_MEMORY_DESCRIPTOR_VERSION 1\r
130typedef struct {\r
131 UINT32 Type;\r
132 UINT32 Pad;\r
133 EFI_PHYSICAL_ADDRESS PhysicalStart;\r
134 EFI_VIRTUAL_ADDRESS VirtualStart;\r
135 UINT64 NumberOfPages;\r
136 UINT64 Attribute;\r
137} EFI_MEMORY_DESCRIPTOR;\r
138\r
139//\r
140// EFI_FIELD_OFFSET - returns the byte offset to a field within a structure\r
141//\r
142#define EFI_FIELD_OFFSET(TYPE,Field) ((UINTN)(&(((TYPE *) 0)->Field)))\r
143\r
144#include <Protocol/DevicePath.h>\r
145#include <Protocol/SimpleTextIn.h>\r
146#include <Protocol/SimpleTextOut.h>\r
147\r
148//\r
149// Declare forward referenced data structures\r
150//\r
151typedef struct _EFI_SYSTEM_TABLE EFI_SYSTEM_TABLE;\r
152\r
153/**\r
154 Allocates memory pages from the system.\r
155 \r
156 @param Type The type of allocation to perform.\r
157 @param MemoryType The type of memory to allocate.\r
158 @param Pages The number of contiguous 4 KB pages to allocate.\r
159 @param Memory Pointer to a physical address. On input, the way in which the address is\r
160 used depends on the value of Type. \r
161 \r
162 @retval EFI_SUCCESS The requested pages were allocated.\r
163 @retval EFI_INVALID_PARAMETER 1) Type is not AllocateAnyPages or\r
164 AllocateMaxAddress or AllocateAddress.\r
165 2) MemoryType is in the range\r
166 EfiMaxMemoryType..0x7FFFFFFF.\r
167 @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.\r
168 @retval EFI_NOT_FOUND The requested pages could not be found.\r
169 \r
170**/ \r
171typedef \r
172EFI_STATUS \r
173(EFIAPI *EFI_ALLOCATE_PAGES) (\r
174 IN EFI_ALLOCATE_TYPE Type,\r
175 IN EFI_MEMORY_TYPE MemoryType,\r
176 IN UINTN Pages,\r
177 IN OUT EFI_PHYSICAL_ADDRESS *Memory\r
178 );\r
179\r
180/**\r
181 Frees memory pages.\r
182 \r
183 @param Memory The base physical address of the pages to be freed.\r
184 @param Pages The number of contiguous 4 KB pages to free.\r
185 \r
186 @retval EFI_SUCCESS The requested pages were freed.\r
187 @retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or Pages is invalid. \r
188 @retval EFI_NOT_FOUND The requested memory pages were not allocated with\r
189 AllocatePages().\r
190 \r
191**/ \r
192typedef\r
193EFI_STATUS\r
194(EFIAPI *EFI_FREE_PAGES) (\r
195 IN EFI_PHYSICAL_ADDRESS Memory,\r
196 IN UINTN Pages\r
197 );\r
198\r
199/**\r
200 Returns the current memory map.\r
201 \r
202 @param MemoryMapSize A pointer to the size, in bytes, of the MemoryMap buffer.\r
203 @param MemoryMap A pointer to the buffer in which firmware places the current memory\r
204 map.\r
205 @param MapKey A pointer to the location in which firmware returns the key for the\r
206 current memory map. \r
207 @param DescriptorSize A pointer to the location in which firmware returns the size, in bytes, of\r
208 an individual EFI_MEMORY_DESCRIPTOR. \r
209 @param DescriptorVersion A pointer to the location in which firmware returns the version number\r
210 associated with the EFI_MEMORY_DESCRIPTOR. \r
211 \r
212 @retval EFI_SUCCESS The memory map was returned in the MemoryMap buffer.\r
213 @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current buffer size\r
214 needed to hold the memory map is returned in MemoryMapSize.\r
215 @retval EFI_INVALID_PARAMETER 1) MemoryMapSize is NULL.\r
216 2) The MemoryMap buffer is not too small and MemoryMap is\r
217 NULL. \r
218 \r
219**/ \r
220typedef\r
221EFI_STATUS\r
222(EFIAPI *EFI_GET_MEMORY_MAP) (\r
223 IN OUT UINTN *MemoryMapSize,\r
224 IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap,\r
225 OUT UINTN *MapKey,\r
226 OUT UINTN *DescriptorSize,\r
227 OUT UINT32 *DescriptorVersion\r
228 );\r
229\r
230#define NextMemoryDescriptor(_Ptr, _Size) ((EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) (_Ptr)) + (_Size)))\r
231#define NEXT_MEMORY_DESCRIPTOR(_Ptr, _Size) NextMemoryDescriptor (_Ptr, _Size)\r
232\r
233/**\r
234 Allocates pool memory.\r
235 \r
236 @param PoolType The type of pool to allocate.\r
237 @param Size The number of bytes to allocate from the pool. \r
238 @param Buffer A pointer to a pointer to the allocated buffer if the call succeeds;\r
239 undefined otherwise. \r
240 \r
241 @retval EFI_SUCCESS The requested number of bytes was allocated.\r
242 @retval EFI_OUT_OF_RESOURCES The pool requested could not be allocated. \r
243 @retval EFI_INVALID_PARAMETER PoolType was invalid. \r
244 \r
245**/ \r
246typedef\r
247EFI_STATUS\r
248(EFIAPI *EFI_ALLOCATE_POOL) (\r
249 IN EFI_MEMORY_TYPE PoolType,\r
250 IN UINTN Size,\r
251 OUT VOID **Buffer\r
252 );\r
253\r
254/**\r
255 Returns pool memory to the system.\r
256 \r
257 @param Buffer Pointer to the buffer to free. \r
258 \r
259 @retval EFI_SUCCESS The memory was returned to the system. \r
260 @retval EFI_INVALID_PARAMETER Buffer was invalid.\r
261 \r
262**/ \r
263typedef\r
264EFI_STATUS\r
265(EFIAPI *EFI_FREE_POOL) (\r
266 IN VOID *Buffer\r
267 );\r
268\r
269/**\r
270 Changes the runtime addressing mode of EFI firmware from physical to virtual.\r
271 \r
272 @param MemoryMapSize The size in bytes of VirtualMap.\r
273 @param DescriptorSize The size in bytes of an entry in the VirtualMap.\r
274 @param DescriptorVersion The version of the structure entries in VirtualMap.\r
275 @param VirtualMap An array of memory descriptors which contain new virtual\r
276 address mapping information for all runtime ranges.\r
277 \r
278 @retval EFI_SUCCESS The virtual address map has been applied.\r
279 @retval EFI_UNSUPPORTED EFI firmware is not at runtime, or the EFI firmware is already in\r
280 virtual address mapped mode. \r
281 @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is invalid. \r
282 @retval EFI_NO_MAPPING A virtual address was not supplied for a range in the memory\r
283 map that requires a mapping. \r
284 @retval EFI_NOT_FOUND A virtual address was supplied for an address that is not found\r
285 in the memory map. \r
286 \r
287**/ \r
288typedef\r
289EFI_STATUS\r
290(EFIAPI *EFI_SET_VIRTUAL_ADDRESS_MAP) (\r
291 IN UINTN MemoryMapSize,\r
292 IN UINTN DescriptorSize,\r
293 IN UINT32 DescriptorVersion,\r
294 IN EFI_MEMORY_DESCRIPTOR *VirtualMap\r
295 );\r
296\r
297/**\r
298 Connects one or more drivers to a controller.\r
299 \r
300 @param ControllerHandle The handle of the controller to which driver(s) are to be connected.\r
301 @param DriverImageHandle A pointer to an ordered list handles that support the\r
302 EFI_DRIVER_BINDING_PROTOCOL. \r
303 @param RemainingDevicePath A pointer to the device path that specifies a child of the\r
304 controller specified by ControllerHandle. \r
305 @param Recursive If TRUE, then ConnectController() is called recursively \r
306 until the entire tree of controllers below the controller specified\r
307 by ControllerHandle have been created. If FALSE, then \r
308 the tree of controllers is only expanded one level. \r
309 \r
310 @retval EFI_SUCCESS 1) One or more drivers were connected to ControllerHandle.\r
311 2) No drivers were connected to ControllerHandle, but \r
312 RemainingDevicePath is not NULL, and it is an End Device\r
313 Path Node. \r
314 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE. \r
315 @retval EFI_NOT_FOUND 1) There are no EFI_DRIVER_BINDING_PROTOCOL instances\r
316 present in the system. \r
317 2) No drivers were connected to ControllerHandle.\r
318 \r
319**/ \r
320typedef\r
321EFI_STATUS\r
322(EFIAPI *EFI_CONNECT_CONTROLLER) (\r
323 IN EFI_HANDLE ControllerHandle,\r
324 IN EFI_HANDLE *DriverImageHandle, OPTIONAL\r
325 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath, OPTIONAL\r
326 IN BOOLEAN Recursive\r
327 );\r
328\r
329/**\r
330 Disconnects one or more drivers from a controller.\r
331 \r
332 @param ControllerHandle The handle of the controller from which driver(s) are to be disconnected.\r
333 @param DriverImageHandle The driver to disconnect from ControllerHandle. \r
334 @param ChildHandle The handle of the child to destroy. \r
335 \r
336 @retval EFI_SUCCESS 1) One or more drivers were disconnected from the controller.\r
337 2) On entry, no drivers are managing ControllerHandle.\r
338 3) DriverImageHandle is not NULL, and on entry\r
339 DriverImageHandle is not managing ControllerHandle.\r
340 \r
341 @retval EFI_INVALID_PARAMETER One ore more parameters are invalid.\r
342 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to disconnect any drivers from\r
343 ControllerHandle. \r
344 @retval EFI_DEVICE_ERROR The controller could not be disconnected because of a device error. \r
345 \r
346**/ \r
347typedef\r
348EFI_STATUS\r
349(EFIAPI *EFI_DISCONNECT_CONTROLLER) (\r
350 IN EFI_HANDLE ControllerHandle,\r
351 IN EFI_HANDLE DriverImageHandle, OPTIONAL\r
352 IN EFI_HANDLE ChildHandle OPTIONAL\r
353 );\r
354\r
355//\r
356// ConvertPointer DebugDisposition type.\r
357//\r
358#define EFI_OPTIONAL_PTR 0x00000001\r
359#define EFI_OPTIONAL_POINTER EFI_OPTIONAL_PTR\r
360\r
361/**\r
362 Determines the new virtual address that is to be used on subsequent memory accesses.\r
363 \r
364 @param DebugDisposition Supplies type information for the pointer being converted.\r
365 @param Address A pointer to a pointer that is to be fixed to be the value needed\r
366 for the new virtual address mappings being applied. \r
367 \r
368 @retval EFI_SUCCESS The pointer pointed to by Address was modified. \r
369 @retval EFI_INVALID_PARAMETER 1) Address is NULL.\r
370 2) *Address is NULL and DebugDisposition does\r
371 not have the EFI_OPTIONAL_PTR bit set. \r
372 @retval EFI_NOT_FOUND The pointer pointed to by Address was not found to be part\r
373 of the current memory map. This is normally fatal. \r
374 \r
375**/ \r
376typedef\r
377EFI_STATUS\r
378(EFIAPI *EFI_CONVERT_POINTER) (\r
379 IN UINTN DebugDisposition,\r
380 IN OUT VOID **Address\r
381 );\r
382\r
383//\r
384// EFI Event Types (name defined in spec)\r
385//\r
386#define EVENT_TIMER 0x80000000\r
387#define EVENT_RUNTIME 0x40000000\r
388#define EVENT_RUNTIME_CONTEXT 0x20000000\r
389\r
390#define EVENT_NOTIFY_WAIT 0x00000100\r
391#define EVENT_NOTIFY_SIGNAL 0x00000200\r
392\r
393#define EVENT_SIGNAL_EXIT_BOOT_SERVICES 0x00000201\r
394#define EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE 0x60000202\r
395\r
396#if ((EDK_RELEASE_VERSION != 0) && (EFI_SPECIFICATION_VERSION < 0x00020000))\r
397//\r
398// Prior to UEFI 2.0 Tiano extended these enums. This was replaced by\r
399// CreateEventEx() Event Groups in UEFI 2.0\r
400//\r
401#define EFI_EVENT_NOTIFY_SIGNAL_ALL 0x00000400\r
402\r
403#define EFI_EVENT_SIGNAL_READY_TO_BOOT 0x00000203\r
404#define EFI_EVENT_SIGNAL_LEGACY_BOOT 0x00000204\r
405\r
406#endif\r
407\r
408//\r
409// EFI Event Types (name following coding style)\r
410//\r
411#define EFI_EVENT_TIMER EVENT_TIMER\r
412#define EFI_EVENT_RUNTIME EVENT_RUNTIME\r
413#define EFI_EVENT_RUNTIME_CONTEXT EVENT_RUNTIME_CONTEXT\r
414\r
415#define EFI_EVENT_NOTIFY_WAIT EVENT_NOTIFY_WAIT\r
416#define EFI_EVENT_NOTIFY_SIGNAL EVENT_NOTIFY_SIGNAL\r
417\r
418#define EFI_EVENT_SIGNAL_EXIT_BOOT_SERVICES EVENT_SIGNAL_EXIT_BOOT_SERVICES\r
419#define EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE\r
420\r
421\r
422/** \r
423 Invoke a notification event\r
424 \r
425 @param Event Event whose notification function is being invoked.\r
426