]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Uefi/UefiSpec.h
synchronize asm and s file
[mirror_edk2.git] / MdePkg / Include / Uefi / UefiSpec.h
CommitLineData
959ccb23 1/** @file\r
e0c047a0 2 Include file that supports UEFI.\r
959ccb23 3\r
e0c047a0 4 This include file must only contain things defined in the UEFI 2.1 specification.\r
5 If a code construct is defined in the UEFI 2.1 specification it must be included\r
959ccb23 6 by this include file.\r
7\r
e0c047a0 8 Copyright (c) 2006 - 2008, Intel Corporation\r
959ccb23 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
959ccb23 17**/\r
18\r
19#ifndef __UEFI_SPEC_H__\r
20#define __UEFI_SPEC_H__\r
21\r
22#include <Uefi/UefiMultiPhase.h>\r
23\r
24#include <Protocol/DevicePath.h>\r
25#include <Protocol/SimpleTextIn.h>\r
26#include <Protocol/SimpleTextOut.h>\r
27\r
8b13229b 28///\r
29/// Enumeration of memory allocation.\r
30///\r
959ccb23 31typedef enum {\r
32 AllocateAnyPages,\r
33 AllocateMaxAddress,\r
34 AllocateAddress,\r
35 MaxAllocateType\r
36} EFI_ALLOCATE_TYPE;\r
37\r
5413e8e8 38//\r
39// Bit definitions for EFI_TIME.Daylight\r
40//\r
41#define EFI_TIME_ADJUST_DAYLIGHT 0x01\r
42#define EFI_TIME_IN_DAYLIGHT 0x02\r
43\r
8b13229b 44///\r
45/// Value definition for EFI_TIME.TimeZone\r
46///\r
5413e8e8 47#define EFI_UNSPECIFIED_TIMEZONE 0x07FF\r
959ccb23 48\r
49//\r
e0c047a0 50// Memory cacheability attributes\r
959ccb23 51//\r
52#define EFI_MEMORY_UC 0x0000000000000001ULL\r
53#define EFI_MEMORY_WC 0x0000000000000002ULL\r
54#define EFI_MEMORY_WT 0x0000000000000004ULL\r
55#define EFI_MEMORY_WB 0x0000000000000008ULL\r
56#define EFI_MEMORY_UCE 0x0000000000000010ULL\r
959ccb23 57//\r
e0c047a0 58// Physical memory protection attributes\r
959ccb23 59//\r
00edb218
A
60#define EFI_MEMORY_WP 0x0000000000001000ULL\r
61#define EFI_MEMORY_RP 0x0000000000002000ULL\r
62#define EFI_MEMORY_XP 0x0000000000004000ULL\r
e0c047a0 63//\r
64// Runtime memory attribute\r
65//\r
66#define EFI_MEMORY_RUNTIME 0x8000000000000000ULL\r
959ccb23 67\r
8b13229b 68///\r
e0c047a0 69/// Memory descriptor version number\r
8b13229b 70///\r
959ccb23 71#define EFI_MEMORY_DESCRIPTOR_VERSION 1\r
e0c047a0 72\r
73///\r
74/// Definition of memory descriptor\r
75///\r
959ccb23 76typedef struct {\r
00edb218
A
77 UINT32 Type;\r
78 EFI_PHYSICAL_ADDRESS PhysicalStart;\r
79 EFI_VIRTUAL_ADDRESS VirtualStart;\r
80 UINT64 NumberOfPages;\r
81 UINT64 Attribute;\r
959ccb23 82} EFI_MEMORY_DESCRIPTOR;\r
83\r
8b13229b 84///\r
85/// Build macros to find next EFI_MEMORY_DESCRIPTOR.\r
86///\r
959ccb23 87#define NextMemoryDescriptor(_Ptr, _Size) ((EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) (_Ptr)) + (_Size)))\r
88#define NEXT_MEMORY_DESCRIPTOR(_Ptr, _Size) NextMemoryDescriptor (_Ptr, _Size)\r
89\r
8b13229b 90///\r
91/// Declare forward referenced data structures\r
92///\r
959ccb23 93typedef struct _EFI_SYSTEM_TABLE EFI_SYSTEM_TABLE;\r
94\r
95/**\r
96 Allocates memory pages from the system.\r
97\r
98 @param Type The type of allocation to perform.\r
99 @param MemoryType The type of memory to allocate.\r
100 @param Pages The number of contiguous 4 KB pages to allocate.\r
101 @param Memory Pointer to a physical address. On input, the way in which the address is\r
102 used depends on the value of Type.\r
103\r
104 @retval EFI_SUCCESS The requested pages were allocated.\r
105 @retval EFI_INVALID_PARAMETER 1) Type is not AllocateAnyPages or\r
106 AllocateMaxAddress or AllocateAddress.\r
107 2) MemoryType is in the range\r
108 EfiMaxMemoryType..0x7FFFFFFF.\r
109 @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.\r
110 @retval EFI_NOT_FOUND The requested pages could not be found.\r
111\r
112**/\r
113typedef\r
114EFI_STATUS\r
8b13229b 115(EFIAPI *EFI_ALLOCATE_PAGES)(\r
959ccb23 116 IN EFI_ALLOCATE_TYPE Type,\r
117 IN EFI_MEMORY_TYPE MemoryType,\r
118 IN UINTN Pages,\r
119 IN OUT EFI_PHYSICAL_ADDRESS *Memory\r
120 );\r
121\r
122/**\r
123 Frees memory pages.\r
124\r
125 @param Memory The base physical address of the pages to be freed.\r
126 @param Pages The number of contiguous 4 KB pages to free.\r
127\r
128 @retval EFI_SUCCESS The requested pages were freed.\r
129 @retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or Pages is invalid.\r
130 @retval EFI_NOT_FOUND The requested memory pages were not allocated with\r
131 AllocatePages().\r
132\r
133**/\r
134typedef\r
135EFI_STATUS\r
8b13229b 136(EFIAPI *EFI_FREE_PAGES)(\r
959ccb23 137 IN EFI_PHYSICAL_ADDRESS Memory,\r
138 IN UINTN Pages\r
139 );\r
140\r
141/**\r
142 Returns the current memory map.\r
143\r
144 @param MemoryMapSize A pointer to the size, in bytes, of the MemoryMap buffer.\r
e0c047a0 145 On input, this is the size of the buffer allocated by the caller.\r
146 On output, it is the size of the buffer returned by the firmware if\r
147 the buffer was large enough, or the size of the buffer needed to contain\r
148 the map if the buffer was too small.\r
959ccb23 149 @param MemoryMap A pointer to the buffer in which firmware places the current memory\r
150 map.\r
151 @param MapKey A pointer to the location in which firmware returns the key for the\r
152 current memory map.\r
153 @param DescriptorSize A pointer to the location in which firmware returns the size, in bytes, of\r
154 an individual EFI_MEMORY_DESCRIPTOR.\r
155 @param DescriptorVersion A pointer to the location in which firmware returns the version number\r
156 associated with the EFI_MEMORY_DESCRIPTOR.\r
157\r
158 @retval EFI_SUCCESS The memory map was returned in the MemoryMap buffer.\r
159 @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current buffer size\r
160 needed to hold the memory map is returned in MemoryMapSize.\r
161 @retval EFI_INVALID_PARAMETER 1) MemoryMapSize is NULL.\r
162 2) The MemoryMap buffer is not too small and MemoryMap is\r
163 NULL.\r
164\r
165**/\r
166typedef\r
167EFI_STATUS\r
8b13229b 168(EFIAPI *EFI_GET_MEMORY_MAP)(\r
959ccb23 169 IN OUT UINTN *MemoryMapSize,\r
170 IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap,\r
171 OUT UINTN *MapKey,\r
172 OUT UINTN *DescriptorSize,\r
173 OUT UINT32 *DescriptorVersion\r
174 );\r
175\r
176/**\r
177 Allocates pool memory.\r
178\r
179 @param PoolType The type of pool to allocate.\r
180 @param Size The number of bytes to allocate from the pool.\r
181 @param Buffer A pointer to a pointer to the allocated buffer if the call succeeds;\r
182 undefined otherwise.\r
183\r
184 @retval EFI_SUCCESS The requested number of bytes was allocated.\r
185 @retval EFI_OUT_OF_RESOURCES The pool requested could not be allocated.\r
186 @retval EFI_INVALID_PARAMETER PoolType was invalid.\r
187\r
188**/\r
189typedef\r
190EFI_STATUS\r
8b13229b 191(EFIAPI *EFI_ALLOCATE_POOL)(\r
959ccb23 192 IN EFI_MEMORY_TYPE PoolType,\r
193 IN UINTN Size,\r
194 OUT VOID **Buffer\r
195 );\r
196\r
197/**\r
198 Returns pool memory to the system.\r
199\r
200 @param Buffer Pointer to the buffer to free.\r
201\r
202 @retval EFI_SUCCESS The memory was returned to the system.\r
203 @retval EFI_INVALID_PARAMETER Buffer was invalid.\r
204\r
205**/\r
206typedef\r
207EFI_STATUS\r
8b13229b 208(EFIAPI *EFI_FREE_POOL)(\r
959ccb23 209 IN VOID *Buffer\r
210 );\r
211\r
212/**\r
213 Changes the runtime addressing mode of EFI firmware from physical to virtual.\r
214\r
215 @param MemoryMapSize The size in bytes of VirtualMap.\r
216 @param DescriptorSize The size in bytes of an entry in the VirtualMap.\r
217 @param DescriptorVersion The version of the structure entries in VirtualMap.\r
218 @param VirtualMap An array of memory descriptors which contain new virtual\r
219 address mapping information for all runtime ranges.\r
220\r
221 @retval EFI_SUCCESS The virtual address map has been applied.\r
222 @retval EFI_UNSUPPORTED EFI firmware is not at runtime, or the EFI firmware is already in\r
223 virtual address mapped mode.\r
224 @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is invalid.\r
225 @retval EFI_NO_MAPPING A virtual address was not supplied for a range in the memory\r
226 map that requires a mapping.\r
227 @retval EFI_NOT_FOUND A virtual address was supplied for an address that is not found\r
228 in the memory map.\r
229\r
230**/\r
231typedef\r
232EFI_STATUS\r
8b13229b 233(EFIAPI *EFI_SET_VIRTUAL_ADDRESS_MAP)(\r
959ccb23 234 IN UINTN MemoryMapSize,\r
235 IN UINTN DescriptorSize,\r
236 IN UINT32 DescriptorVersion,\r
237 IN EFI_MEMORY_DESCRIPTOR *VirtualMap\r
238 );\r
239\r
240/**\r
241 Connects one or more drivers to a controller.\r
242\r
243 @param ControllerHandle The handle of the controller to which driver(s) are to be connected.\r
244 @param DriverImageHandle A pointer to an ordered list handles that support the\r
245 EFI_DRIVER_BINDING_PROTOCOL.\r
246 @param RemainingDevicePath A pointer to the device path that specifies a child of the\r
247 controller specified by ControllerHandle.\r
248 @param Recursive If TRUE, then ConnectController() is called recursively\r
249 until the entire tree of controllers below the controller specified\r
250 by ControllerHandle have been created. If FALSE, then\r
251 the tree of controllers is only expanded one level.\r
252\r
253 @retval EFI_SUCCESS 1) One or more drivers were connected to ControllerHandle.\r
254 2) No drivers were connected to ControllerHandle, but\r
255 RemainingDevicePath is not NULL, and it is an End Device\r
256 Path Node.\r
257 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
258 @retval EFI_NOT_FOUND 1) There are no EFI_DRIVER_BINDING_PROTOCOL instances\r
259 present in the system.\r
260 2) No drivers were connected to ControllerHandle.\r
261\r
262**/\r
263typedef\r
264EFI_STATUS\r
8b13229b 265(EFIAPI *EFI_CONNECT_CONTROLLER)(\r
959ccb23 266 IN EFI_HANDLE ControllerHandle,\r
267 IN EFI_HANDLE *DriverImageHandle, OPTIONAL\r
268 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath, OPTIONAL\r
269 IN BOOLEAN Recursive\r
270 );\r
271\r
272/**\r
273 Disconnects one or more drivers from a controller.\r
274\r
275 @param ControllerHandle The handle of the controller from which driver(s) are to be disconnected.\r
276 @param DriverImageHandle The driver to disconnect from ControllerHandle.\r
e0c047a0 277 If DriverImageHandle is NULL, then all the drivers currently managing\r
278 ControllerHandle are disconnected from ControllerHandle.\r
959ccb23 279 @param ChildHandle The handle of the child to destroy.\r
e0c047a0 280 If ChildHandle is NULL, then all the children of ControllerHandle are\r
281 destroyed before the drivers are disconnected from ControllerHandle.\r
959ccb23 282\r
283 @retval EFI_SUCCESS 1) One or more drivers were disconnected from the controller.\r
284 2) On entry, no drivers are managing ControllerHandle.\r
285 3) DriverImageHandle is not NULL, and on entry\r
286 DriverImageHandle is not managing ControllerHandle.\r
e0c047a0 287 @retval EFI_INVALID_PARAMETER 1) ControllerHandle is not a valid EFI_HANDLE.\r
288 2) DriverImageHandle is not NULL, and it is not a valid EFI_HANDLE.\r
289 3) ChildHandle is not NULL, and it is not a valid EFI_HANDLE.\r
290 4) DriverImageHandle does not support the EFI_DRIVER_BINDING_PROTOCOL.\r
959ccb23 291 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to disconnect any drivers from\r
292 ControllerHandle.\r
293 @retval EFI_DEVICE_ERROR The controller could not be disconnected because of a device error.\r
294\r
295**/\r
296typedef\r
297EFI_STATUS\r
8b13229b 298(EFIAPI *EFI_DISCONNECT_CONTROLLER)(\r
959ccb23 299 IN EFI_HANDLE ControllerHandle,\r
300 IN EFI_HANDLE DriverImageHandle, OPTIONAL\r
301 IN EFI_HANDLE ChildHandle OPTIONAL\r
302 );\r
303\r
304\r
305\r
306//\r
307// ConvertPointer DebugDisposition type.\r
308//\r
309#define EFI_OPTIONAL_PTR 0x00000001\r
310#define EFI_OPTIONAL_POINTER EFI_OPTIONAL_PTR\r
311\r
312/**\r
313 Determines the new virtual address that is to be used on subsequent memory accesses.\r
314\r
315 @param DebugDisposition Supplies type information for the pointer being converted.\r
316 @param Address A pointer to a pointer that is to be fixed to be the value needed\r
317 for the new virtual address mappings being applied.\r
318\r
319 @retval EFI_SUCCESS The pointer pointed to by Address was modified.\r
320 @retval EFI_INVALID_PARAMETER 1) Address is NULL.\r
321 2) *Address is NULL and DebugDisposition does\r
322 not have the EFI_OPTIONAL_PTR bit set.\r
323 @retval EFI_NOT_FOUND The pointer pointed to by Address was not found to be part\r
324 of the current memory map. This is normally fatal.\r
325\r
326**/\r
327typedef\r
328EFI_STATUS\r
8b13229b 329(EFIAPI *EFI_CONVERT_POINTER)(\r
959ccb23 330 IN UINTN DebugDisposition,\r
331 IN OUT VOID **Address\r
332 );\r
333\r
334\r
335//\r
ac644614 336// These types can be ORed together as needed - for example,\r
93ce5aca 337// EVT_TIMER might be Ored with EVT_NOTIFY_WAIT or\r
959ccb23 338// EVT_NOTIFY_SIGNAL.\r
339//\r
00edb218
A
340#define EVT_TIMER 0x80000000\r
341#define EVT_RUNTIME 0x40000000\r
00edb218
A
342#define EVT_NOTIFY_WAIT 0x00000100\r
343#define EVT_NOTIFY_SIGNAL 0x00000200\r
93ce5aca 344\r
00edb218 345#define EVT_SIGNAL_EXIT_BOOT_SERVICES 0x00000201\r
93ce5aca 346#define EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE 0x60000202\r
959ccb23 347\r
348//\r
ac644614 349// The event's NotifyContext pointer points to a runtime memory\r
d0c64728 350// address.\r
959ccb23 351// The event is deprecated in UEFI2.0 and later specifications.\r
d0c64728 352//\r
959ccb23 353#define EVT_RUNTIME_CONTEXT 0x20000000\r
354\r
355\r
356/**\r
357 Invoke a notification event\r
358\r
359 @param Event Event whose notification function is being invoked.\r
360 @param Context Pointer to the notification function's context,\r
361 which is implementation-dependent.\r
362\r
363**/\r
364typedef\r
365VOID\r
8b13229b 366(EFIAPI *EFI_EVENT_NOTIFY)(\r
959ccb23 367 IN EFI_EVENT Event,\r
368 IN VOID *Context\r
369 );\r
370\r
371/**\r
372 Creates an event.\r
373\r
374 @param Type The type of event to create and its mode and attributes.\r
e0c047a0 375 @param NotifyTpl The task priority level of event notifications, if needed.\r
959ccb23 376 @param NotifyFunction Pointer to the event's notification function, if any.\r
377 @param NotifyContext Pointer to the notification function's context; corresponds to parameter\r
378 Context in the notification function.\r
379 @param Event Pointer to the newly created event if the call succeeds; undefined\r
380 otherwise.\r
381\r
382 @retval EFI_SUCCESS The event structure was created.\r
383 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
384 @retval EFI_OUT_OF_RESOURCES The event could not be allocated.\r
385\r
386**/\r
387typedef\r
388EFI_STATUS\r
8b13229b 389(EFIAPI *EFI_CREATE_EVENT)(\r
959ccb23 390 IN UINT32 Type,\r
391 IN EFI_TPL NotifyTpl,\r
392 IN EFI_EVENT_NOTIFY NotifyFunction,\r
393 IN VOID *NotifyContext,\r
394 OUT EFI_EVENT *Event\r
395 );\r
396\r
397/**\r
398 Creates an event in a group.\r
399\r
400 @param Type The type of event to create and its mode and attributes.\r
e0c047a0 401 @param NotifyTpl The task priority level of event notifications,if needed.\r
959ccb23 402 @param NotifyFunction Pointer to the event's notification function, if any.\r
403 @param NotifyContext Pointer to the notification function's context; corresponds to parameter\r
404 Context in the notification function.\r
405 @param EventGroup Pointer to the unique identifier of the group to which this event belongs.\r
e0c047a0 406 If this is NULL, then the function behaves as if the parameters were passed\r
407 to CreateEvent.\r
959ccb23 408 @param Event Pointer to the newly created event if the call succeeds; undefined\r
409 otherwise.\r
410\r
411 @retval EFI_SUCCESS The event structure was created.\r
412 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
413 @retval EFI_OUT_OF_RESOURCES The event could not be allocated.\r
414\r
415**/\r
416typedef\r
417EFI_STATUS\r
8b13229b 418(EFIAPI *EFI_CREATE_EVENT_EX)(\r
959ccb23 419 IN UINT32 Type,\r
e0c047a0 420 IN EFI_TPL NotifyTpl,\r
959ccb23 421 IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL,\r
422 IN CONST VOID *NotifyContext OPTIONAL,\r
423 IN CONST EFI_GUID *EventGroup OPTIONAL,\r
424 OUT EFI_EVENT *Event\r
425 );\r
426\r
e0c047a0 427///\r
428/// Timer delay types\r
429///\r
959ccb23 430typedef enum {\r
431 TimerCancel,\r
432 TimerPeriodic,\r
433 TimerRelative\r
434} EFI_TIMER_DELAY;\r
435\r
436/**\r
437 Sets the type of timer and the trigger time for a timer event.\r
438\r
439 @param Event The timer event that is to be signaled at the specified time.\r
440 @param Type The type of time that is specified in TriggerTime.\r
441 @param TriggerTime The number of 100ns units until the timer expires.\r
e0c047a0 442 A TriggerTime of 0 is legal.\r
443 If Type is TimerRelative and TriggerTime is 0, then the timer\r
444 event will be signaled on the next timer tick.\r
445 If Type is TimerPeriodic and TriggerTime is 0, then the timer\r
446 event will be signaled on every timer tick.\r
959ccb23 447\r
448 @retval EFI_SUCCESS The event has been set to be signaled at the requested time.\r
449 @retval EFI_INVALID_PARAMETER Event or Type is not valid.\r
450\r
451**/\r
452typedef\r
453EFI_STATUS\r
8b13229b 454(EFIAPI *EFI_SET_TIMER)(\r
959ccb23 455 IN EFI_EVENT Event,\r
456 IN EFI_TIMER_DELAY Type,\r
457 IN UINT64 TriggerTime\r
458 );\r
459\r
460/**\r
461 Signals an event.\r
462\r
463 @param Event The event to signal.\r
464\r
465 @retval EFI_SUCCESS The event has been signaled.\r
466\r
467**/\r
468typedef\r
469EFI_STATUS\r
8b13229b 470(EFIAPI *EFI_SIGNAL_EVENT)(\r
959ccb23 471 IN EFI_EVENT Event\r
472 );\r
473\r
474/**\r
475 Stops execution until an event is signaled.\r
476\r
477 @param NumberOfEvents The number of events in the Event array.\r
478 @param Event An array of EFI_EVENT.\r
479 @param Index Pointer to the index of the event which satisfied the wait condition.\r
480\r
481 @retval EFI_SUCCESS The event indicated by Index was signaled.\r
482 @retval EFI_INVALID_PARAMETER 1) NumberOfEvents is 0.\r
483 2) The event indicated by Index is of type\r
484 EVT_NOTIFY_SIGNAL.\r
485 @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION.\r
486\r
487**/\r
488typedef\r
489EFI_STATUS\r
8b13229b 490(EFIAPI *EFI_WAIT_FOR_EVENT)(\r
959ccb23 491 IN UINTN NumberOfEvents,\r
492 IN EFI_EVENT *Event,\r
493 OUT UINTN *Index\r
494 );\r
495\r
496/**\r
497 Closes an event.\r
498\r
499 @param Event The event to close.\r
500\r
501 @retval EFI_SUCCESS The event has been closed.\r
502\r
503**/\r
504typedef\r
505EFI_STATUS\r
8b13229b 506(EFIAPI *EFI_CLOSE_EVENT)(\r
959ccb23 507 IN EFI_EVENT Event\r
508 );\r
509\r
510/**\r
511 Checks whether an event is in the signaled state.\r
512\r
513 @param Event The event to check.\r
514\r
515 @retval EFI_SUCCESS The event is in the signaled state.\r
516 @retval EFI_NOT_READY The event is not in the signaled state.\r
517 @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL.\r
518\r
519**/\r
520typedef\r
521EFI_STATUS\r
8b13229b 522(EFIAPI *EFI_CHECK_EVENT)(\r
959ccb23 523 IN EFI_EVENT Event\r
524 );\r
525\r
526\r
527//\r
e0c047a0 528// Task priority level\r
959ccb23 529//\r
530#define TPL_APPLICATION 4\r
531#define TPL_CALLBACK 8\r
532#define TPL_NOTIFY 16\r
533#define TPL_HIGH_LEVEL 31\r
534\r
535\r
536/**\r
537 Raises a task's priority level and returns its previous level.\r
538\r
539 @param NewTpl The new task priority level.\r
540\r
e0c047a0 541 @return Previous task priority level\r
959ccb23 542\r
543**/\r
544typedef\r
545EFI_TPL\r
8b13229b 546(EFIAPI *EFI_RAISE_TPL)(\r
959ccb23 547 IN EFI_TPL NewTpl\r
548 );\r
549\r
550/**\r
551 Restores a task's priority level to its previous value.\r
552\r
e0c047a0 553 @param OldTpl The previous task priority level to restore.\r
959ccb23 554\r
555**/\r
556typedef\r
557VOID\r
8b13229b 558(EFIAPI *EFI_RESTORE_TPL)(\r
959ccb23 559 IN EFI_TPL OldTpl\r
560 );\r
561\r
562/**\r
563 Returns the value of a variable.\r
564\r
565 @param VariableName A Null-terminated Unicode string that is the name of the\r
566 vendor's variable.\r
567 @param VendorGuid A unique identifier for the vendor.\r
568 @param Attributes If not NULL, a pointer to the memory location to return the\r
569 attributes bitmask for the variable.\r
570 @param DataSize On input, the size in bytes of the return Data buffer.\r
571 On output the size of data returned in Data.\r
572 @param Data The buffer to return the contents of the variable.\r
573\r
e0c047a0 574 @retval EFI_SUCCESS The function completed successfully.\r
575 @retval EFI_NOT_FOUND The variable was not found.\r
576 @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the result.\r
577 @retval EFI_INVALID_PARAMETER VariableName is NULL.\r
578 @retval EFI_INVALID_PARAMETER VendorGuid is NULL.\r
579 @retval EFI_INVALID_PARAMETER DataSize is NULL.\r
580 @retval EFI_INVALID_PARAMETER The DataSize is not too small and Data is NULL.\r
581 @retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error.\r
582 @retval EFI_SECURITY_VIOLATION The variable could not be retrieved due to an authentication failure.\r
959ccb23 583\r
584**/\r
585typedef\r
586EFI_STATUS\r
8b13229b 587(EFIAPI *EFI_GET_VARIABLE)(\r
959ccb23 588 IN CHAR16 *VariableName,\r
589 IN EFI_GUID *VendorGuid,\r
590 OUT UINT32 *Attributes, OPTIONAL\r
591 IN OUT UINTN *DataSize,\r
592 OUT VOID *Data\r
593 );\r
594\r
595/**\r
596 Enumerates the current variable names.\r
597\r
598 @param VariableNameSize The size of the VariableName buffer.\r
599 @param VariableName On input, supplies the last VariableName that was returned\r
600 by GetNextVariableName(). On output, returns the Nullterminated\r
601 Unicode string of the current variable.\r
602 @param VendorGuid On input, supplies the last VendorGuid that was returned by\r
603 GetNextVariableName(). On output, returns the\r
604 VendorGuid of the current variable.\r
605\r
606 @retval EFI_SUCCESS The function completed successfully.\r
607 @retval EFI_NOT_FOUND The next variable was not found.\r
608 @retval EFI_BUFFER_TOO_SMALL The VariableNameSize is too small for the result.\r
e0c047a0 609 @retval EFI_INVALID_PARAMETER VariableNameSize is NULL.\r
610 @retval EFI_INVALID_PARAMETER VariableName is NULL.\r
611 @retval EFI_INVALID_PARAMETER VendorGuid is NULL.\r
959ccb23 612 @retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error.\r
613\r
614**/\r
615typedef\r
616EFI_STATUS\r
8b13229b 617(EFIAPI *EFI_GET_NEXT_VARIABLE_NAME)(\r
959ccb23 618 IN OUT UINTN *VariableNameSize,\r
619 IN OUT CHAR16 *VariableName,\r
620 IN OUT EFI_GUID *VendorGuid\r
621 );\r
622\r
623/**\r
624 Sets the value of a variable.\r
625\r
626 @param VariableName A Null-terminated Unicode string that is the name of the\r
627 vendor's variable.\r
628 @param VendorGuid A unique identifier for the vendor.\r
629 @param Attributes Attributes bitmask to set for the variable.\r
630 @param DataSize The size in bytes of the Data buffer.\r
631 @param Data The contents for the variable.\r
632\r
e0c047a0 633 @retval EFI_SUCCESS The firmware has successfully stored the variable and its data as\r
634 defined by the Attributes.\r
635 @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied, or the\r
636 DataSize exceeds the maximum allowed.\r
637 @retval EFI_INVALID_PARAMETER VariableName is an empty Unicode string.\r
638 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.\r
639 @retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error.\r
640 @retval EFI_WRITE_PROTECTED The variable in question is read-only.\r
641 @retval EFI_WRITE_PROTECTED The variable in question cannot be deleted.\r
642 @retval EFI_SECURITY_VIOLATION The variable could not be retrieved due to an authentication failure.\r
643 @retval EFI_NOT_FOUND The variable trying to be updated or deleted was not found.\r
959ccb23 644\r
645**/\r
646typedef\r
647EFI_STATUS\r
8b13229b 648(EFIAPI *EFI_SET_VARIABLE)(\r
959ccb23 649 IN CHAR16 *VariableName,\r
650 IN EFI_GUID *VendorGuid,\r
651 IN UINT32 Attributes,\r
652 IN UINTN DataSize,\r
653 IN VOID *Data\r
654 );\r
655\r
656\r
e0c047a0 657///\r
658/// This provides the capabilities of the\r
659/// real time clock device as exposed through the EFI interfaces.\r
660///\r
959ccb23 661typedef struct {\r
00edb218
A
662 UINT32 Resolution;\r
663 UINT32 Accuracy;\r
664 BOOLEAN SetsToZero;\r
959ccb23 665} EFI_TIME_CAPABILITIES;\r
666\r
667/**\r
668 Returns the current time and date information, and the time-keeping capabilities\r
669 of the hardware platform.\r
670\r
671 @param Time A pointer to storage to receive a snapshot of the current time.\r
672 @param Capabilities An optional pointer to a buffer to receive the real time clock\r
673 device's capabilities.\r
674\r
675 @retval EFI_SUCCESS The operation completed successfully.\r
676 @retval EFI_INVALID_PARAMETER Time is NULL.\r
677 @retval EFI_DEVICE_ERROR The time could not be retrieved due to hardware error.\r
678\r
679**/\r
680typedef\r
681EFI_STATUS\r
8b13229b 682(EFIAPI *EFI_GET_TIME)(\r
959ccb23 683 OUT EFI_TIME *Time,\r
684 OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL\r
685 );\r
686\r
687/**\r
688 Sets the current local time and date information.\r
689\r
690 @param Time A pointer to the current time.\r
691\r
692 @retval EFI_SUCCESS The operation completed successfully.\r
693 @retval EFI_INVALID_PARAMETER A time field is out of range.\r
694 @retval EFI_DEVICE_ERROR The time could not be set due due to hardware error.\r
695\r
696**/\r
697typedef\r
698EFI_STATUS\r
8b13229b 699(EFIAPI *EFI_SET_TIME)(\r
959ccb23 700 IN EFI_TIME *Time\r
701 );\r
702\r
703/**\r
704 Returns the current wakeup alarm clock setting.\r
705\r
706 @param Enabled Indicates if the alarm is currently enabled or disabled.\r
707 @param Pending Indicates if the alarm signal is pending and requires acknowledgement.\r
708 @param Time The current alarm setting.\r
709\r
710 @retval EFI_SUCCESS The alarm settings were returned.\r
e0c047a0 711 @retval EFI_INVALID_PARAMETER Enabled is NULL.\r
712 @retval EFI_INVALID_PARAMETER Pending is NULL.\r
713 @retval EFI_INVALID_PARAMETER Time is NULL.\r
959ccb23 714 @retval EFI_DEVICE_ERROR The wakeup time could not be retrieved due to a hardware error.\r
e0c047a0 715 @retval EFI_UNSUPPORTED A wakeup timer is not supported on this platform.\r
959ccb23 716\r
717**/\r
718typedef\r
719EFI_STATUS\r
8b13229b 720(EFIAPI *EFI_GET_WAKEUP_TIME)(\r
959ccb23 721 OUT BOOLEAN *Enabled,\r
722 OUT BOOLEAN *Pending,\r
723 OUT EFI_TIME *Time\r
724 );\r
725\r
726/**\r
727 Sets the system wakeup alarm clock time.\r
728\r
729 @param Enabled Enable or disable the wakeup alarm.\r
730 @param Time If Enable is TRUE, the time to set the wakeup alarm for.\r
e0c047a0 731 If Enable is FALSE, then this parameter is optional, and may be NULL.\r
959ccb23 732\r
733 @retval EFI_SUCCESS If Enable is TRUE, then the wakeup alarm was enabled. If\r
734 Enable is FALSE, then the wakeup alarm was disabled.\r
735 @retval EFI_INVALID_PARAMETER A time field is out of range.\r
736 @retval EFI_DEVICE_ERROR The wakeup time could not be set due to a hardware error.\r
737 @retval EFI_UNSUPPORTED A wakeup timer is not supported on this platform.\r
738\r
739**/\r
740typedef\r
741EFI_STATUS\r
8b13229b 742(EFIAPI *EFI_SET_WAKEUP_TIME)(\r
959ccb23 743 IN BOOLEAN Enable,\r
744 IN EFI_TIME *Time OPTIONAL\r
745 );\r
746\r
747/**\r
e0c047a0 748 This is the declaration of an EFI image entry point. This entry point is\r
749 the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including\r
750 both device drivers and bus drivers.\r
959ccb23 751\r
e0c047a0 752 @param ImageHandle The firmware allocated handle for the UEFI image.\r
753 @param SystemTable A pointer to the EFI System Table.\r
959ccb23 754\r
755 @retval EFI_SUCCESS The operation completed successfully.\r
e0c047a0 756 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
959ccb23 757\r
758**/\r
759typedef\r
760EFI_STATUS\r
8b13229b 761(EFIAPI *EFI_IMAGE_ENTRY_POINT)(\r
959ccb23 762 IN EFI_HANDLE ImageHandle,\r
763 IN EFI_SYSTEM_TABLE *SystemTable\r
764 );\r
765\r
766/**\r
767 Loads an EFI image into memory.\r
768\r
769 @param BootPolicy If TRUE, indicates that the request originates from the boot\r
770 manager, and that the boot manager is attempting to load\r
771 FilePath as a boot selection. Ignored if SourceBuffer is\r
772 not NULL.\r
773 @param ParentImageHandle The caller's image handle.\r
e0c047a0 774 @param DevicePath The DeviceHandle specific file path from which the image is\r
959ccb23 775 loaded.\r
776 @param SourceBuffer If not NULL, a pointer to the memory location containing a copy\r
777 of the image to be loaded.\r
e0c047a0 778 @param SourceSize The size in bytes of SourceBuffer. Ignored if SourceBuffer is NULL.\r
959ccb23 779 @param ImageHandle Pointer to the returned image handle that is created when the\r
780 image is successfully loaded.\r
781\r
782 @retval EFI_SUCCESS Image was loaded into memory correctly.\r
e0c047a0 783 @retval EFI_NOT_FOUND Both SourceBuffer and DevicePath are NULL.\r
959ccb23 784 @retval EFI_INVALID_PARAMETER One or more parametes are invalid.\r
785 @retval EFI_UNSUPPORTED The image type is not supported.\r
786 @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient resources.\r
787 @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not\r
788 understood.\r
789 @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error.\r
790\r
791**/\r
792typedef\r
793EFI_STATUS\r
8b13229b 794(EFIAPI *EFI_IMAGE_LOAD)(\r
959ccb23 795 IN BOOLEAN BootPolicy,\r
796 IN EFI_HANDLE ParentImageHandle,\r
e0c047a0 797 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
959ccb23 798 IN VOID *SourceBuffer OPTIONAL,\r
799 IN UINTN SourceSize,\r
800 OUT EFI_HANDLE *ImageHandle\r
801 );\r
802\r
803/**\r
804 Transfers control to a loaded image's entry point.\r
805\r
806 @param ImageHandle Handle of image to be started.\r
807 @param ExitDataSize Pointer to the size, in bytes, of ExitData.\r
808 @param ExitData Pointer to a pointer to a data buffer that includes a Null-terminated\r
809 Unicode string, optionally followed by additional binary data.\r
810\r
811 @retval EFI_INVALID_PARAMETER ImageHandle is either an invalid image handle or the image\r
812 has already been initialized with StartImage\r
e0c047a0 813 @return Exit code from image\r
959ccb23 814\r
815**/\r
816typedef\r
817EFI_STATUS\r
8b13229b 818(EFIAPI *EFI_IMAGE_START)(\r
959ccb23 819 IN EFI_HANDLE ImageHandle,\r
820 OUT UINTN *ExitDataSize,\r
821 OUT CHAR16 **ExitData OPTIONAL\r
822 );\r
823\r
824/**\r
825 Terminates a loaded EFI image and returns control to boot services.\r
826\r
827 @param ImageHandle Handle that identifies the image.\r
828 @param ExitStatus The image's exit code.\r
829 @param ExitDataSize The size, in bytes, of ExitData.\r
830 @param ExitData Pointer to a data buffer that includes a Null-terminated Unicode string,\r
831 optionally followed by additional binary data.\r
832\r
833 @retval EFI_SUCCESS The image specified by ImageHandle was unloaded.\r
834 @retval EFI_INVALID_PARAMETER The image specified by ImageHandle has been loaded and\r
835 started with LoadImage() and StartImage(), but the\r
836 image is not the currently executing image.\r
837\r
838**/\r
839typedef\r
840EFI_STATUS\r
8b13229b 841(EFIAPI *EFI_EXIT)(\r
959ccb23 842 IN EFI_HANDLE ImageHandle,\r
843 IN EFI_STATUS ExitStatus,\r
844 IN UINTN ExitDataSize,\r
845 IN CHAR16 *ExitData OPTIONAL\r
846 );\r
847\r
848/**\r
849 Unloads an image.\r
850\r
851 @param ImageHandle Handle that identifies the image to be unloaded.\r
852\r
853 @retval EFI_SUCCESS The image has been unloaded.\r
854 @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle.\r
855 @retval EFI_UNSUPPORTED The image has been started, and does not support unload.\r
e0c047a0 856 @return Exit code from the image's unload handler\r
959ccb23 857\r
858**/\r
859typedef\r
860EFI_STATUS\r
8b13229b 861(EFIAPI *EFI_IMAGE_UNLOAD)(\r
959ccb23 862 IN EFI_HANDLE ImageHandle\r
863 );\r
864\r
865/**\r
866 Terminates all boot services.\r
867\r
868 @param ImageHandle Handle that identifies the exiting image.\r
869 @param MapKey Key to the latest memory map.\r
870\r
871 @retval EFI_SUCCESS Boot services have been terminated.\r
872 @retval EFI_INVALID_PARAMETER MapKey is incorrect.\r
873\r
874**/\r
875typedef\r
876EFI_STATUS\r
8b13229b 877(EFIAPI *EFI_EXIT_BOOT_SERVICES)(\r
959ccb23 878 IN EFI_HANDLE ImageHandle,\r
879 IN UINTN MapKey\r
880 );\r
881\r
882/**\r
883 Induces a fine-grained stall.\r
884\r
885 @param Microseconds The number of microseconds to stall execution.\r
886\r
887 @retval EFI_SUCCESS Execution was stalled at least the requested number of\r
888 Microseconds.\r
889\r
890**/\r
891typedef\r
892EFI_STATUS\r
8b13229b 893(EFIAPI *EFI_STALL)(\r
959ccb23 894 IN UINTN Microseconds\r
895 );\r
896\r
897/**\r
898 Sets the system's watchdog timer.\r
899\r
900 @param Timeout The number of seconds to set the watchdog timer to.\r
901 @param WatchdogCode The numeric code to log on a watchdog timer timeout event.\r
902 @param DataSize The size, in bytes, of WatchdogData.\r
903 @param WatchdogData A data buffer that includes a Null-terminated Unicode string, optionally\r
904 followed by additional binary data.\r
905\r
906 @retval EFI_SUCCESS The timeout has been set.\r
907 @retval EFI_INVALID_PARAMETER The supplied WatchdogCode is invalid.\r
908 @retval EFI_UNSUPPORTED The system does not have a watchdog timer.\r
909 @retval EFI_DEVICE_ERROR The watch dog timer could not be programmed due to a hardware\r
910 error.\r
911\r
912**/\r
913typedef\r
914EFI_STATUS\r
8b13229b 915(EFIAPI *EFI_SET_WATCHDOG_TIMER)(\r
959ccb23 916 IN UINTN Timeout,\r
917 IN UINT64 WatchdogCode,\r
918 IN UINTN DataSize,\r
919 IN CHAR16 *WatchdogData OPTIONAL\r
920 );\r
921\r
e0c047a0 922///\r
923/// Enumeration of reset types.\r
924///\r
959ccb23 925typedef enum {\r
926 EfiResetCold,\r
927 EfiResetWarm,\r
928 EfiResetShutdown,\r
981a648d 929 EfiResetUpdate\r
959ccb23 930} EFI_RESET_TYPE;\r
931\r
932/**\r
933 Resets the entire platform.\r
934\r
935 @param ResetType The type of reset to perform.\r
936 @param ResetStatus The status code for the reset.\r
937 @param DataSize The size, in bytes, of WatchdogData.\r
938 @param ResetData For a ResetType of EfiResetCold, EfiResetWarm, or\r
939 EfiResetShutdown the data buffer starts with a Null-terminated\r
940 Unicode string, optionally followed by additional binary data.\r
941\r
942**/\r
943typedef\r
944VOID\r
8b13229b 945(EFIAPI *EFI_RESET_SYSTEM)(\r
959ccb23 946 IN EFI_RESET_TYPE ResetType,\r
947 IN EFI_STATUS ResetStatus,\r
948 IN UINTN DataSize,\r
949 IN CHAR16 *ResetData OPTIONAL\r
950 );\r
951\r
952/**\r
953 Returns a monotonically increasing count for the platform.\r
954\r
955 @param Count Pointer to returned value.\r
956\r
957 @retval EFI_SUCCESS The next monotonic count was returned.\r
958 @retval EFI_INVALID_PARAMETER Count is NULL.\r
959 @retval EFI_DEVICE_ERROR The device is not functioning properly.\r
960\r
961**/\r
962typedef\r
963EFI_STATUS\r
8b13229b 964(EFIAPI *EFI_GET_NEXT_MONOTONIC_COUNT)(\r
959ccb23 965 OUT UINT64 *Count\r
966 );\r
967\r
968/**\r
969 Returns the next high 32 bits of the platform's monotonic counter.\r
970\r
971 @param HighCount Pointer to returned value.\r
972\r
973 @retval EFI_SUCCESS The next high monotonic count was returned.\r
974 @retval EFI_INVALID_PARAMETER HighCount is NULL.\r
975 @retval EFI_DEVICE_ERROR The device is not functioning properly.\r
976\r
977**/\r
978typedef\r
979EFI_STATUS\r
8b13229b 980(EFIAPI *EFI_GET_NEXT_HIGH_MONO_COUNT)(\r
959ccb23 981 OUT UINT32 *HighCount\r
982 );\r
983\r
984/**\r
985 Computes and returns a 32-bit CRC for a data buffer.\r
986\r
987 @param Data A pointer to the buffer on which the 32-bit CRC is to be computed.\r
988 @param DataSize The number of bytes in the buffer Data.\r
989 @param Crc32 The 32-bit CRC that was computed for the data buffer specified by Data\r
990 and DataSize.\r
991\r
992 @retval EFI_SUCCESS The 32-bit CRC was computed for the data buffer and returned in\r
993 Crc32.\r
e0c047a0 994 @retval EFI_INVALID_PARAMETER Data is NULL.\r
995 @retval EFI_INVALID_PARAMETER Crc32 is NULL.\r
996 @retval EFI_INVALID_PARAMETER DataSize is 0.\r
959ccb23 997\r
998**/\r
999typedef\r
1000EFI_STATUS\r
8b13229b 1001(EFIAPI *EFI_CALCULATE_CRC32)(\r
959ccb23 1002 IN VOID *Data,\r
1003 IN UINTN DataSize,\r
1004 OUT UINT32 *Crc32\r
1005 );\r
1006\r
1007/**\r
1008 Copies the contents of one buffer to another buffer.\r
1009\r
1010 @param Destination Pointer to the destination buffer of the memory copy.\r
1011 @param Source Pointer to the source buffer of the memory copy.\r
1012 @param Length Number of bytes to copy from Source to Destination.\r
1013\r
1014**/\r
1015typedef\r
1016VOID\r
8b13229b 1017(EFIAPI *EFI_COPY_MEM)(\r
959ccb23 1018 IN VOID *Destination,\r
1019 IN VOID *Source,\r
1020 IN UINTN Length\r
1021 );\r
1022\r
1023/**\r
1024 The SetMem() function fills a buffer with a specified value.\r
1025\r
1026 @param Buffer Pointer to the buffer to fill.\r
1027 @param Size Number of bytes in Buffer to fill.\r
1028 @param Value Value to fill Buffer with.\r
1029\r
1030**/\r
1031typedef\r
1032VOID\r
8b13229b 1033(EFIAPI *EFI_SET_MEM)(\r
959ccb23 1034 IN VOID *Buffer,\r
1035 IN UINTN Size,\r
1036 IN UINT8 Value\r
1037 );\r
1038\r
1039\r
1040//\r
1041// Protocol handler functions\r
1042//\r
1043typedef enum {\r
1044 EFI_NATIVE_INTERFACE\r
1045} EFI_INTERFACE_TYPE;\r
1046\r
1047/**\r
1048 Installs a protocol interface on a device handle. If the handle does not exist, it is created and added\r
1049 to the list of handles in the system. InstallMultipleProtocolInterfaces() performs\r
1050 more error checking than InstallProtocolInterface(), so it is recommended that\r
1051 InstallMultipleProtocolInterfaces() be used in place of\r
1052 InstallProtocolInterface()\r
1053\r
1054 @param Handle A pointer to the EFI_HANDLE on which the interface is to be installed.\r
1055 @param Protocol The numeric ID of the protocol interface.\r
1056 @param InterfaceType Indicates whether Interface is supplied in native form.\r
1057 @param Interface A pointer to the protocol interface.\r
1058\r
1059 @retval EFI_SUCCESS The protocol interface was installed.\r
1060 @retval EFI_OUT_OF_RESOURCES Space for a new handle could not be allocated.\r
e0c047a0 1061 @retval EFI_INVALID_PARAMETER Handle is NULL.\r
1062 @retval EFI_INVALID_PARAMETER Protocol is NULL.\r
1063 @retval EFI_INVALID_PARAMETER InterfaceType is not EFI_NATIVE_INTERFACE.\r
1064 @retval EFI_INVALID_PARAMETER Protocol is already installed on the handle specified by Handle.\r
959ccb23 1065\r
1066**/\r
1067typedef\r
1068EFI_STATUS\r
8b13229b 1069(EFIAPI *EFI_INSTALL_PROTOCOL_INTERFACE)(\r
959ccb23 1070 IN OUT EFI_HANDLE *Handle,\r
1071 IN EFI_GUID *Protocol,\r
1072 IN EFI_INTERFACE_TYPE InterfaceType,\r
1073 IN VOID *Interface\r
1074 );\r
1075\r
1076/**\r
1077 Installs one or more protocol interfaces into the boot services environment.\r
1078\r
1079 @param Handle The handle to install the new protocol interfaces on, or NULL if a new\r
1080 handle is to be allocated.\r
1081 @param ... A variable argument list containing pairs of protocol GUIDs and protocol\r
1082 interfaces.\r
1083\r
1084 @retval EFI_SUCCESS All the protocol interface was installed.\r
1085 @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.\r
1086 @retval EFI_ALREADY_STARTED A Device Path Protocol instance was passed in that is already present in\r
1087 the handle database.\r
1088\r
1089**/\r
1090typedef\r
1091EFI_STATUS\r
8b13229b 1092(EFIAPI *EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES)(\r
959ccb23 1093 IN OUT EFI_HANDLE *Handle,\r
1094 ...\r
1095 );\r
1096\r
1097/**\r
1098 Reinstalls a protocol interface on a device handle.\r
1099\r
1100 @param Handle Handle on which the interface is to be reinstalled.\r
1101 @param Protocol The numeric ID of the interface.\r
1102 @param OldInterface A pointer to the old interface. NULL can be used if a structure is not\r
1103 associated with Protocol.\r
1104 @param NewInterface A pointer to the new interface.\r
1105\r
1106 @retval EFI_SUCCESS The protocol interface was reinstalled.\r
1107 @retval EFI_NOT_FOUND The OldInterface on the handle was not found.\r
1108 @retval EFI_ACCESS_DENIED The protocol interface could not be reinstalled,\r
1109 because OldInterface is still being used by a\r
1110 driver that will not release it.\r
e0c047a0 1111 @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.\r
1112 @retval EFI_INVALID_PARAMETER Protocol is NULL.\r
959ccb23 1113\r
1114**/\r
1115typedef\r
1116EFI_STATUS\r
8b13229b 1117(EFIAPI *EFI_REINSTALL_PROTOCOL_INTERFACE)(\r
959ccb23 1118 IN EFI_HANDLE Handle,\r
1119 IN EFI_GUID *Protocol,\r
1120 IN VOID *OldInterface,\r
1121 IN VOID *NewInterface\r
1122 );\r
1123\r
1124/**\r
1125 Removes a protocol interface from a device handle. It is recommended that\r
1126 UninstallMultipleProtocolInterfaces() be used in place of\r
1127 UninstallProtocolInterface().\r
1128\r
1129 @param Handle The handle on which the interface was installed.\r
1130 @param Protocol The numeric ID of the interface.\r
1131 @param Interface A pointer to the interface.\r
1132\r
1133 @retval EFI_SUCCESS The interface was removed.\r
1134 @retval EFI_NOT_FOUND The interface was not found.\r
1135 @retval EFI_ACCESS_DENIED The interface was not removed because the interface\r
1136 is still being used by a driver.\r
e0c047a0 1137 @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.\r
1138 @retval EFI_INVALID_PARAMETER Protocol is NULL.\r
959ccb23 1139\r
1140**/\r
1141typedef\r
1142EFI_STATUS\r
8b13229b 1143(EFIAPI *EFI_UNINSTALL_PROTOCOL_INTERFACE)(\r
959ccb23 1144 IN EFI_HANDLE Handle,\r
1145 IN EFI_GUID *Protocol,\r
1146 IN VOID *Interface\r
1147 );\r
1148\r
1149/**\r
1150 Removes one or more protocol interfaces into the boot services environment.\r
1151\r
1152 @param Handle The handle to remove the protocol interfaces from.\r
1153 @param ... A variable argument list containing pairs of protocol GUIDs and\r
1154 protocol interfaces.\r
1155\r
1156 @retval EFI_SUCCESS All the protocol interfaces were removed.\r
1157 @retval EFI_INVALID_PARAMETER One of the protocol interfaces was not previously installed on Handle.\r
1158\r
1159**/\r
1160typedef\r
1161EFI_STATUS\r
8b13229b 1162(EFIAPI *EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES)(\r
959ccb23 1163 IN EFI_HANDLE Handle,\r
1164 ...\r
1165 );\r
1166\r
1167/**\r
1168 Queries a handle to determine if it supports a specified protocol.\r
1169\r
1170 @param Handle The handle being queried.\r
1171 @param Protocol The published unique identifier of the protocol.\r
1172 @param Interface Supplies the address where a pointer to the corresponding Protocol\r
1173 Interface is returned.\r
e0c047a0 1174\r
959ccb23 1175 @retval EFI_SUCCESS The interface information for the specified protocol was returned.\r
1176 @retval EFI_UNSUPPORTED The device does not support the specified protocol.\r
e0c047a0 1177 @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.\r
1178 @retval EFI_INVALID_PARAMETER Protocol is NULL.\r
1179 @retval EFI_INVALID_PARAMETER Interface is NULL.\r
959ccb23 1180\r
1181**/\r
1182typedef\r
1183EFI_STATUS\r
8b13229b 1184(EFIAPI *EFI_HANDLE_PROTOCOL)(\r
959ccb23 1185 IN EFI_HANDLE Handle,\r
1186 IN EFI_GUID *Protocol,\r
1187 OUT VOID **Interface\r
1188 );\r
1189\r
1190#define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL 0x00000001\r
1191#define EFI_OPEN_PROTOCOL_GET_PROTOCOL 0x00000002\r
1192#define EFI_OPEN_PROTOCOL_TEST_PROTOCOL 0x00000004\r
1193#define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008\r
1194#define EFI_OPEN_PROTOCOL_BY_DRIVER 0x00000010\r
1195#define EFI_OPEN_PROTOCOL_EXCLUSIVE 0x00000020\r
1196\r
1197/**\r
1198 Queries a handle to determine if it supports a specified protocol. If the protocol is supported by the\r
1199 handle, it opens the protocol on behalf of the calling agent.\r
1200\r
1201 @param Handle The handle for the protocol interface that is being opened.\r
1202 @param Protocol The published unique identifier of the protocol.\r
1203 @param Interface Supplies the address where a pointer to the corresponding Protocol\r
1204 Interface is returned.\r
1205 @param AgentHandle The handle of the agent that is opening the protocol interface\r
1206 specified by Protocol and Interface.\r
1207 @param ControllerHandle If the agent that is opening a protocol is a driver that follows the\r
1208 UEFI Driver Model, then this parameter is the controller handle\r
1209 that requires the protocol interface. If the agent does not follow\r
1210 the UEFI Driver Model, then this parameter is optional and may\r
1211 be NULL.\r
1212 @param Attributes The open mode of the protocol interface specified by Handle\r
1213 and Protocol.\r
1214\r
1215 @retval EFI_SUCCESS An item was added to the open list for the protocol interface, and the\r
1216 protocol interface was returned in Interface.\r
1217 @retval EFI_UNSUPPORTED Handle does not support Protocol.\r
1218 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
1219 @retval EFI_ACCESS_DENIED Required attributes can't be supported in current environment.\r
1220 @retval EFI_ALREADY_STARTED Item on the open list already has requierd attributes whose agent\r
1221 handle is the same as AgentHandle.\r
1222\r
1223**/\r
1224typedef\r
1225EFI_STATUS\r
8b13229b 1226(EFIAPI *EFI_OPEN_PROTOCOL)(\r
959ccb23 1227 IN EFI_HANDLE Handle,\r
1228 IN EFI_GUID *Protocol,\r
e0c047a0 1229 OUT VOID **Interface, OPTIONAL\r
959ccb23 1230 IN EFI_HANDLE AgentHandle,\r
e0c047a0 1231 IN EFI_HANDLE ControllerHandle,\r
959ccb23 1232 IN UINT32 Attributes\r
1233 );\r
1234\r
1235\r
1236/**\r
1237 Closes a protocol on a handle that was opened using OpenProtocol().\r
1238\r
1239 @param Handle The handle for the protocol interface that was previously opened\r
1240 with OpenProtocol(), and is now being closed.\r
1241 @param Protocol The published unique identifier of the protocol.\r
959ccb23 1242 @param AgentHandle The handle of the agent that is closing the protocol interface.\r
1243 @param ControllerHandle If the agent that opened a protocol is a driver that follows the\r
1244 UEFI Driver Model, then this parameter is the controller handle\r
1245 that required the protocol interface.\r
1246\r
1247 @retval EFI_SUCCESS The protocol instance was closed.\r
e0c047a0 1248 @retval EFI_INVALID_PARAMETER 1) Handle is not a valid EFI_HANDLE.\r
1249 2) AgentHandle is not a valid EFI_HANDLE.\r
1250 3) ControllerHandle is not NULL and ControllerHandle is not a valid EFI_HANDLE.\r
1251 4) Protocol is NULL.\r
959ccb23 1252 @retval EFI_NOT_FOUND 1) Handle does not support the protocol specified by Protocol.\r
1253 2) The protocol interface specified by Handle and Protocol is not\r
1254 currently open by AgentHandle and ControllerHandle.\r
1255\r
1256**/\r
1257typedef\r
1258EFI_STATUS\r
8b13229b 1259(EFIAPI *EFI_CLOSE_PROTOCOL)(\r
959ccb23 1260 IN EFI_HANDLE Handle,\r
1261 IN EFI_GUID *Protocol,\r
1262 IN EFI_HANDLE AgentHandle,\r
1263 IN EFI_HANDLE ControllerHandle\r
1264 );\r
1265\r
1266\r
1267typedef struct {\r
1268 EFI_HANDLE AgentHandle;\r
1269 EFI_HANDLE ControllerHandle;\r
1270 UINT32 Attributes;\r
1271 UINT32 OpenCount;\r
1272} EFI_OPEN_PROTOCOL_INFORMATION_ENTRY;\r
1273\r
1274/**\r
1275 Retrieves the list of agents that currently have a protocol interface opened.\r
1276\r
1277 @param Handle The handle for the protocol interface that is being queried.\r
1278 @param Protocol The published unique identifier of the protocol.\r
1279 @param EntryBuffer A pointer to a buffer of open protocol information in the form of\r
1280 EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.\r
1281 @param EntryCount A pointer to the number of entries in EntryBuffer.\r
1282\r
1283 @retval EFI_SUCCESS The open protocol information was returned in EntryBuffer, and the\r
1284 number of entries was returned EntryCount.\r
1285 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to allocate EntryBuffer.\r
1286 @retval EFI_NOT_FOUND Handle does not support the protocol specified by Protocol.\r
1287\r
1288**/\r
1289typedef\r
1290EFI_STATUS\r
8b13229b 1291(EFIAPI *EFI_OPEN_PROTOCOL_INFORMATION)(\r
959ccb23 1292 IN EFI_HANDLE Handle,\r
1293 IN EFI_GUID *Protocol,\r
e0c047a0 1294 OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,\r
959ccb23 1295 OUT UINTN *EntryCount\r
1296 );\r
1297\r
1298/**\r
1299 Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated\r
1300 from pool.\r
1301\r
1302 @param Handle The handle from which to retrieve the list of protocol interface\r
1303 GUIDs.\r
1304 @param ProtocolBuffer A pointer to the list of protocol interface GUID pointers that are\r
1305 installed on Handle.\r
1306 @param ProtocolBufferCount A pointer to the number of GUID pointers present in\r
1307 ProtocolBuffer.\r
1308\r
1309 @retval EFI_SUCCESS The list of protocol interface GUIDs installed on Handle was returned in\r
1310 ProtocolBuffer. The number of protocol interface GUIDs was\r
1311 returned in ProtocolBufferCount.\r
1312 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the results.\r
e0c047a0 1313 @retval EFI_INVALID_PARAMETER Handle is NULL.\r
1314 @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.\r
1315 @retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.\r
1316 @retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.\r
959ccb23 1317\r
1318**/\r
1319typedef\r
1320EFI_STATUS\r
8b13229b 1321(EFIAPI *EFI_PROTOCOLS_PER_HANDLE)(\r
959ccb23 1322 IN EFI_HANDLE Handle,\r
1323 OUT EFI_GUID ***ProtocolBuffer,\r
1324 OUT UINTN *ProtocolBufferCount\r
1325 );\r
1326\r
1327/**\r
1328 Creates an event that is to be signaled whenever an interface is installed for a specified protocol.\r
1329\r
1330 @param Protocol The numeric ID of the protocol for which the event is to be registered.\r
1331 @param Event Event that is to be signaled whenever a protocol interface is registered\r
1332 for Protocol.\r
1333 @param Registration A pointer to a memory location to receive the registration value.\r
1334\r
1335 @retval EFI_SUCCESS The notification event has been registered.\r
1336 @retval EFI_OUT_OF_RESOURCES Space for the notification event could not be allocated.\r
e0c047a0 1337 @retval EFI_INVALID_PARAMETER Protocol is NULL.\r
1338 @retval EFI_INVALID_PARAMETER Event is NULL.\r
1339 @retval EFI_INVALID_PARAMETER Registration is NULL.\r
959ccb23 1340\r
1341**/\r
1342typedef\r
1343EFI_STATUS\r
8b13229b 1344(EFIAPI *EFI_REGISTER_PROTOCOL_NOTIFY)(\r
959ccb23 1345 IN EFI_GUID *Protocol,\r
1346 IN EFI_EVENT Event,\r
1347 OUT VOID **Registration\r
1348 );\r
1349\r
1350\r
1351typedef enum {\r
1352 AllHandles,\r
1353 ByRegisterNotify,\r
1354 ByProtocol\r
1355} EFI_LOCATE_SEARCH_TYPE;\r
1356\r
1357/**\r
1358 Returns an array of handles that support a specified protocol.\r
1359\r
1360 @param SearchType Specifies which handle(s) are to be returned.\r
1361 @param Protocol Specifies the protocol to search by.\r
1362 @param SearchKey Specifies the search key.\r
1363 @param BufferSize On input, the size in bytes of Buffer. On output, the size in bytes of\r
1364 the array returned in Buffer (if the buffer was large enough) or the\r
1365 size, in bytes, of the buffer needed to obtain the array (if the buffer was\r
1366 not large enough).\r
1367 @param Buffer The buffer in which the array is returned.\r
1368\r
1369 @retval EFI_SUCCESS The array of handles was returned.\r
1370 @retval EFI_NOT_FOUND No handles match the search.\r
1371 @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small for the result.\r
e0c047a0 1372 @retval EFI_INVALID_PARAMETER SearchType is not a member of EFI_LOCATE_SEARCH_TYPE.\r
1373 @retval EFI_INVALID_PARAMETER SearchType is ByRegisterNotify and SearchKey is NULL.\r
1374 @retval EFI_INVALID_PARAMETER SearchType is ByProtocol and Protocol is NULL.\r
1375 @retval EFI_INVALID_PARAMETER One or more matches are found and BufferSize is NULL.\r
1376 @retval EFI_INVALID_PARAMETER BufferSize is large enough for the result and Buffer is NULL.\r
959ccb23 1377\r
1378**/\r
1379typedef\r
1380EFI_STATUS\r
8b13229b 1381(EFIAPI *EFI_LOCATE_HANDLE)(\r
959ccb23 1382 IN EFI_LOCATE_SEARCH_TYPE SearchType,\r
1383 IN EFI_GUID *Protocol, OPTIONAL\r
1384 IN VOID *SearchKey, OPTIONAL\r
1385 IN OUT UINTN *BufferSize,\r
1386 OUT EFI_HANDLE *Buffer\r
1387 );\r
1388\r
1389/**\r
1390 Locates the handle to a device on the device path that supports the specified protocol.\r
1391\r
1392 @param Protocol Specifies the protocol to search for.\r
1393 @param DevicePath On input, a pointer to a pointer to the device path. On output, the device\r
1394 path pointer is modified to point to the remaining part of the device\r
1395 path.\r
1396 @param Device A pointer to the returned device handle.\r
1397\r
1398 @retval EFI_SUCCESS The resulting handle was returned.\r
1399 @retval EFI_NOT_FOUND No handles match the search.\r
e0c047a0 1400 @retval EFI_INVALID_PARAMETER Protocol is NULL.\r
1401 @retval EFI_INVALID_PARAMETER DevicePath is NULL.\r
1402 @retval EFI_INVALID_PARAMETER A handle matched the search and Device is NULL.\r
959ccb23 1403\r
1404**/\r
1405typedef\r
1406EFI_STATUS\r
8b13229b 1407(EFIAPI *EFI_LOCATE_DEVICE_PATH)(\r
959ccb23 1408 IN EFI_GUID *Protocol,\r
1409 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,\r
1410 OUT EFI_HANDLE *Device\r
1411 );\r
1412\r
1413/**\r
1414 Adds, updates, or removes a configuration table entry from the EFI System Table.\r
1415\r
1416 @param Guid A pointer to the GUID for the entry to add, update, or remove.\r
1417 @param Table A pointer to the configuration table for the entry to add, update, or\r
1418 remove. May be NULL.\r
1419\r
1420 @retval EFI_SUCCESS The (Guid, Table) pair was added, updated, or removed.\r
1421 @retval EFI_NOT_FOUND An attempt was made to delete a nonexistent entry.\r
1422 @retval EFI_INVALID_PARAMETER Guid is not valid.\r
1423 @retval EFI_OUT_OF_RESOURCES There is not enough memory available to complete the operation.\r
1424\r
1425**/\r
1426typedef\r
1427EFI_STATUS\r
8b13229b 1428(EFIAPI *EFI_INSTALL_CONFIGURATION_TABLE)(\r
959ccb23 1429 IN EFI_GUID *Guid,\r
1430 IN VOID *Table\r
1431 );\r
1432\r
1433\r
1434/**\r
1435 Returns an array of handles that support the requested protocol in a buffer allocated from pool.\r
1436\r
1437 @param SearchType Specifies which handle(s) are to be returned.\r
e0c047a0 1438 @param Protocol Provides the protocol to search by.\r
1439 This parameter is only valid for a SearchType of ByProtocol.\r
959ccb23 1440 @param SearchKey Supplies the search key depending on the SearchType.\r
1441 @param NoHandles The number of handles returned in Buffer.\r
1442 @param Buffer A pointer to the buffer to return the requested array of handles that\r
1443 support Protocol.\r
1444\r
1445 @retval EFI_SUCCESS The array of handles was returned in Buffer, and the number of\r
1446 handles in Buffer was returned in NoHandles.\r
1447 @retval EFI_NOT_FOUND No handles match the search.\r
1448 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the matching results.\r
e0c047a0 1449 @retval EFI_INVALID_PARAMETER NoHandles is NULL.\r
1450 @retval EFI_INVALID_PARAMETER Buffer is NULL.\r
959ccb23 1451\r
1452**/\r
1453typedef\r
1454EFI_STATUS\r
8b13229b 1455(EFIAPI *EFI_LOCATE_HANDLE_BUFFER)(\r
959ccb23 1456 IN EFI_LOCATE_SEARCH_TYPE SearchType,\r
1457 IN EFI_GUID *Protocol, OPTIONAL\r
1458 IN VOID *SearchKey, OPTIONAL\r
1459 IN OUT UINTN *NoHandles,\r
1460 OUT EFI_HANDLE **Buffer\r
1461 );\r
1462\r
1463/**\r
1464 Returns the first protocol instance that matches the given protocol.\r
1465\r
1466 @param Protocol Provides the protocol to search for.\r
1467 @param Registration Optional registration key returned from\r
1468 RegisterProtocolNotify().\r
1469 @param Interface On return, a pointer to the first interface that matches Protocol and\r
1470 Registration.\r
1471\r
1472 @retval EFI_SUCCESS A protocol instance matching Protocol was found and returned in\r
1473 Interface.\r
1474 @retval EFI_NOT_FOUND No protocol instances were found that match Protocol and\r
1475 Registration.\r
1476 @retval EFI_INVALID_PARAMETER Interface is NULL.\r
1477\r
1478**/\r
1479typedef\r
1480EFI_STATUS\r
8b13229b 1481(EFIAPI *EFI_LOCATE_PROTOCOL)(\r
959ccb23 1482 IN EFI_GUID *Protocol,\r
1483 IN VOID *Registration, OPTIONAL\r
1484 OUT VOID **Interface\r
1485 );\r
1486\r
1487typedef struct {\r
1488 UINT64 Length;\r
1489 union {\r
1490 EFI_PHYSICAL_ADDRESS DataBlock;\r
1491 EFI_PHYSICAL_ADDRESS ContinuationPointer;\r
1492 } Union;\r
45ad5569 1493} EFI_CAPSULE_BLOCK_DESCRIPTOR;\r
959ccb23 1494\r
1495typedef struct {\r
1496 EFI_GUID CapsuleGuid;\r
1497 UINT32 HeaderSize;\r
1498 UINT32 Flags;\r
1499 UINT32 CapsuleImageSize;\r
45ad5569 1500} EFI_CAPSULE_HEADER;\r
959ccb23 1501\r
e0c047a0 1502//\r
1503// The EFI System Table entry must point to an array of capsules\r
1504// that contain the same CapsuleGuid value. The array must be\r
1505// prefixed by a UINT32 that represents the size of the array of capsules.\r
1506//\r
176a6bb3
LG
1507typedef struct {\r
1508 UINT32 CapsuleArrayNumber;\r
1509 VOID* CapsulePtr[1];\r
1510} EFI_CAPSULE_TABLE;\r
1511\r
959ccb23 1512#define CAPSULE_FLAGS_PERSIST_ACROSS_RESET 0x00010000\r
1513#define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE 0x00020000\r
1514\r
1515/**\r
1516 Passes capsules to the firmware with both virtual and physical mapping. Depending on the intended\r
1517 consumption, the firmware may process the capsule immediately. If the payload should persist\r
1518 across a system reset, the reset value returned from EFI_QueryCapsuleCapabilities must\r
1519 be passed into ResetSystem() and will cause the capsule to be processed by the firmware as\r
1520 part of the reset process.\r
1521\r
1522 @param CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules\r
1523 being passed into update capsule.\r
1524 @param CapsuleCount Number of pointers to EFI_CAPSULE_HEADER in\r
1525 CaspuleHeaderArray.\r
1526 @param ScatterGatherList Physical pointer to a set of\r
1527 EFI_CAPSULE_BLOCK_DESCRIPTOR that describes the\r
1528 location in physical memory of a set of capsules.\r
1529\r
1530 @retval EFI_SUCCESS Valid capsule was passed. If\r
1531 CAPSULE_FLAGS_PERSIT_ACROSS_RESET is not set, the\r
1532 capsule has been successfully processed by the firmware.\r
1533 @retval EFI_DEVICE_ERROR The capsule update was started, but failed due to a device error.\r
1534 @retval EFI_INVALID_PARAMETER CapsuleSize is NULL.\r
e0c047a0 1535 @retval EFI_UNSUPPORTED The capsule type is not supported on this platform.\r
1536 @retval EFI_OUT_OF_RESOURCES There were insufficient resources to process the capsule.\r
959ccb23 1537\r
1538**/\r
1539typedef\r
1540EFI_STATUS\r
8b13229b 1541(EFIAPI *EFI_UPDATE_CAPSULE)(\r
531febc2 1542 IN EFI_CAPSULE_HEADER **CapsuleHeaderArray,\r
959ccb23 1543 IN UINTN CapsuleCount,\r
1544 IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL\r
1545 );\r
1546\r
1547/**\r
1548 Returns if the capsule can be supported via UpdateCapsule().\r
1549\r
1550 @param CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules\r
1551 being passed into update capsule.\r
1552 @param CapsuleCount Number of pointers to EFI_CAPSULE_HEADER in\r
1553 CaspuleHeaderArray.\r
1554 @param MaxiumCapsuleSize On output the maximum size that UpdateCapsule() can\r
1555 support as an argument to UpdateCapsule() via\r
1556 CapsuleHeaderArray and ScatterGatherList.\r
1557 @param ResetType Returns the type of reset required for the capsule update.\r
1558\r
1559 @retval EFI_SUCCESS Valid answer returned.\r
1560 @retval EFI_UNSUPPORTED The capsule type is not supported on this platform, and\r
1561 MaximumCapsuleSize and ResetType are undefined.\r
1562 @retval EFI_INVALID_PARAMETER MaximumCapsuleSize is NULL.\r
e0c047a0 1563 @retval EFI_OUT_OF_RESOURCES There were insufficient resources to process the query request.\r
959ccb23 1564\r
1565**/\r
1566typedef\r
1567EFI_STATUS\r
8b13229b 1568(EFIAPI *EFI_QUERY_CAPSULE_CAPABILITIES)(\r
531febc2 1569 IN EFI_CAPSULE_HEADER **CapsuleHeaderArray,\r
959ccb23 1570 IN UINTN CapsuleCount,\r
1571 OUT UINT64 *MaximumCapsuleSize,\r
1572 OUT EFI_RESET_TYPE *ResetType\r
1573 );\r
1574\r
1575/**\r
1576 Returns information about the EFI variables.\r
1577\r
1578 @param Attributes Attributes bitmask to specify the type of variables on\r
1579 which to return information.\r
1580 @param MaximumVariableStorageSize On output the maximum size of the storage space\r
1581 available for the EFI variables associated with the\r
1582 attributes specified.\r
1583 @param RemainingVariableStorageSize Returns the remaining size of the storage space\r
1584 available for the EFI variables associated with the\r
1585 attributes specified.\r
1586 @param MaximumVariableSize Returns the maximum size of the individual EFI\r
1587 variables associated with the attributes specified.\r
1588\r
1589 @retval EFI_SUCCESS Valid answer returned.\r
1590 @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied\r
1591 @retval EFI_UNSUPPORTED The attribute is not supported on this platform, and the\r
1592 MaximumVariableStorageSize,\r
1593 RemainingVariableStorageSize, MaximumVariableSize\r
1594 are undefined.\r
1595\r
1596**/\r
1597typedef\r
1598EFI_STATUS\r
8b13229b 1599(EFIAPI *EFI_QUERY_VARIABLE_INFO)(\r
959ccb23 1600 IN UINT32 Attributes,\r
1601 OUT UINT64 *MaximumVariableStorageSize,\r
1602 OUT UINT64 *RemainingVariableStorageSize,\r
1603 OUT UINT64 *MaximumVariableSize\r
1604 );\r
1605\r
1606\r
1607//\r
1608// EFI Runtime Services Table\r
1609//\r
f490a61d 1610#define EFI_SYSTEM_TABLE_SIGNATURE 0x5453595320494249ULL\r
00edb218
A
1611#define EFI_SYSTEM_TABLE_REVISION ((2<<16) | (10))\r
1612#define EFI_2_10_SYSTEM_TABLE_REVISION ((2<<16) | (10))\r
1613#define EFI_2_00_SYSTEM_TABLE_REVISION ((2<<16) | (00))\r
1614#define EFI_1_10_SYSTEM_TABLE_REVISION ((1<<16) | (10))\r
1615#define EFI_1_02_SYSTEM_TABLE_REVISION ((1<<16) | (02))\r
959ccb23 1616\r
f490a61d 1617#define EFI_RUNTIME_SERVICES_SIGNATURE 0x56524553544e5552ULL\r
d1f95000 1618#define EFI_RUNTIME_SERVICES_REVISION EFI_2_10_SYSTEM_TABLE_REVISION\r
959ccb23 1619\r
e0c047a0 1620///\r
1621/// EFI Runtime Services Table\r
1622///\r
959ccb23 1623typedef struct {\r
e0c047a0 1624 ///\r
1625 /// The table header for the EFI Runtime Services Table.\r
1626 ///\r
c9a0a0fc 1627 EFI_TABLE_HEADER Hdr;\r
00edb218
A
1628\r
1629 //\r
1630 // Time Services\r
1631 //\r
1632 EFI_GET_TIME GetTime;\r
1633 EFI_SET_TIME SetTime;\r
1634 EFI_GET_WAKEUP_TIME GetWakeupTime;\r
1635 EFI_SET_WAKEUP_TIME SetWakeupTime;\r
1636\r
1637 //\r
1638 // Virtual Memory Services\r
1639 //\r
1640 EFI_SET_VIRTUAL_ADDRESS_MAP SetVirtualAddressMap;\r
1641 EFI_CONVERT_POINTER ConvertPointer;\r
1642\r
1643 //\r
1644 // Variable Services\r
1645 //\r
1646 EFI_GET_VARIABLE GetVariable;\r
1647 EFI_GET_NEXT_VARIABLE_NAME GetNextVariableName;\r
1648 EFI_SET_VARIABLE SetVariable;\r
1649\r
1650 //\r
1651 // Miscellaneous Services\r
1652 //\r
1653 EFI_GET_NEXT_HIGH_MONO_COUNT GetNextHighMonotonicCount;\r
1654 EFI_RESET_SYSTEM ResetSystem;\r
1655\r
1656 //\r
1657 // UEFI 2.0 Capsule Services\r
1658 //\r
1659 EFI_UPDATE_CAPSULE UpdateCapsule;\r
1660 EFI_QUERY_CAPSULE_CAPABILITIES QueryCapsuleCapabilities;\r
1661\r
1662 //\r
1663 // Miscellaneous UEFI 2.0 Service\r
1664 //\r
1665 EFI_QUERY_VARIABLE_INFO QueryVariableInfo;\r
959ccb23 1666} EFI_RUNTIME_SERVICES;\r
1667\r
1668\r
f490a61d 1669#define EFI_BOOT_SERVICES_SIGNATURE 0x56524553544f4f42ULL\r
d1f95000 1670#define EFI_BOOT_SERVICES_REVISION EFI_2_10_SYSTEM_TABLE_REVISION\r
959ccb23 1671\r
e0c047a0 1672///\r
1673/// EFI Boot Services Table\r
1674///\r
959ccb23 1675typedef struct {\r
e0c047a0 1676 ///\r
1677 /// The table header for the EFI Boot Services Table.\r
1678 ///\r
c9a0a0fc 1679 EFI_TABLE_HEADER Hdr;\r
d0c64728 1680\r
00edb218
A
1681 //\r
1682 // Task Priority Services\r
1683 //\r
1684 EFI_RAISE_TPL RaiseTPL;\r
1685 EFI_RESTORE_TPL RestoreTPL;\r
1686\r
1687 //\r
1688 // Memory Services\r
1689 //\r
1690 EFI_ALLOCATE_PAGES AllocatePages;\r
1691 EFI_FREE_PAGES FreePages;\r
1692 EFI_GET_MEMORY_MAP GetMemoryMap;\r
1693 EFI_ALLOCATE_POOL AllocatePool;\r
1694 EFI_FREE_POOL FreePool;\r
1695\r
1696 //\r
1697 // Event & Timer Services\r
1698 //\r
1699 EFI_CREATE_EVENT CreateEvent;\r
1700 EFI_SET_TIMER SetTimer;\r
1701 EFI_WAIT_FOR_EVENT WaitForEvent;\r
1702 EFI_SIGNAL_EVENT SignalEvent;\r
1703 EFI_CLOSE_EVENT CloseEvent;\r
1704 EFI_CHECK_EVENT CheckEvent;\r
1705\r
1706 //\r
1707 // Protocol Handler Services\r
1708 //\r
1709 EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface;\r
1710 EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface;\r
1711 EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface;\r
1712 EFI_HANDLE_PROTOCOL HandleProtocol;\r
1713 VOID *Reserved;\r
1714 EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify;\r
1715 EFI_LOCATE_HANDLE LocateHandle;\r
1716 EFI_LOCATE_DEVICE_PATH LocateDevicePath;\r
1717 EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable;\r
1718\r
1719 //\r
1720 // Image Services\r
1721 //\r
1722 EFI_IMAGE_LOAD LoadImage;\r
1723 EFI_IMAGE_START StartImage;\r
1724 EFI_EXIT Exit;\r
1725 EFI_IMAGE_UNLOAD UnloadImage;\r
1726 EFI_EXIT_BOOT_SERVICES ExitBootServices;\r
1727\r
1728 //\r
1729 // Miscellaneous Services\r
1730 //\r
1731 EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount;\r
1732 EFI_STALL Stall;\r
1733 EFI_SET_WATCHDOG_TIMER SetWatchdogTimer;\r
1734\r
1735 //\r
1736 // DriverSupport Services\r
1737 //\r
1738 EFI_CONNECT_CONTROLLER ConnectController;\r
1739 EFI_DISCONNECT_CONTROLLER DisconnectController;\r
1740\r
1741 //\r
1742 // Open and Close Protocol Services\r
1743 //\r
1744 EFI_OPEN_PROTOCOL OpenProtocol;\r
1745 EFI_CLOSE_PROTOCOL CloseProtocol;\r
1746 EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation;\r
1747\r
1748 //\r
1749 // Library Services\r
1750 //\r
1751 EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle;\r
1752 EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer;\r
1753 EFI_LOCATE_PROTOCOL LocateProtocol;\r
1754 EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces;\r
1755 EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces;\r
1756\r
1757 //\r
1758 // 32-bit CRC Services\r
1759 //\r
1760 EFI_CALCULATE_CRC32 CalculateCrc32;\r
1761\r
1762 //\r
1763 // Miscellaneous Services\r
1764 //\r
1765 EFI_COPY_MEM CopyMem;\r
1766 EFI_SET_MEM SetMem;\r
00edb218 1767 EFI_CREATE_EVENT_EX CreateEventEx;\r
959ccb23 1768} EFI_BOOT_SERVICES;\r
1769\r
e0c047a0 1770///\r
1771/// Contains a set of GUID/pointer pairs comprised of the ConfigurationTable field in the\r
1772/// EFI System Table.\r
1773///\r
959ccb23 1774typedef struct{\r
e0c047a0 1775 ///\r
1776 /// The 128-bit GUID value that uniquely identifies the system configuration table.\r
1777 ///\r
00edb218 1778 EFI_GUID VendorGuid;\r
e0c047a0 1779 ///\r
1780 /// A pointer to the table associated with VendorGuid.\r
1781 ///\r
00edb218 1782 VOID *VendorTable;\r
959ccb23 1783} EFI_CONFIGURATION_TABLE;\r
1784\r
e0c047a0 1785///\r
1786/// EFI System Table\r
1787///\r
959ccb23 1788struct _EFI_SYSTEM_TABLE {\r
e0c047a0 1789 ///\r
1790 /// The table header for the EFI System Table.\r
1791 ///\r
c9a0a0fc 1792 EFI_TABLE_HEADER Hdr;\r
e0c047a0 1793 ///\r
1794 /// A pointer to a null terminated Unicode string that identifies\r
1795 /// the vendor that produces the system firmware for the platform.\r
1796 ///\r
00edb218 1797 CHAR16 *FirmwareVendor;\r
e0c047a0 1798 ///\r
1799 /// A firmware vendor specific value that identifies the revision\r
1800 /// of the system firmware for the platform.\r
1801 ///\r
00edb218 1802 UINT32 FirmwareRevision;\r
e0c047a0 1803 ///\r
1804 /// The handle for the active console input device.\r
1805 ///\r
00edb218 1806 EFI_HANDLE ConsoleInHandle;\r
e0c047a0 1807 ///\r
1808 /// A pointer to the SIMPLE_INPUT_PROTOCOL interface that is\r
1809 /// associated with ConsoleInHandle.\r
1810 ///\r
00edb218 1811 EFI_SIMPLE_TEXT_INPUT_PROTOCOL *ConIn;\r
e0c047a0 1812 ///\r
1813 /// The handle for the active console output device.\r
1814 ///\r
00edb218 1815 EFI_HANDLE ConsoleOutHandle;\r
e0c047a0 1816 ///\r
1817 /// A pointer to the SIMPLE_TEXT_OUTPUT_PROTOCOL interface\r
1818 /// that is associated with ConsoleOutHandle.\r
1819 ///\r
00edb218 1820 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut;\r
e0c047a0 1821 ///\r
1822 /// The handle for the active standard error console device.\r
1823 ///\r
00edb218 1824 EFI_HANDLE StandardErrorHandle;\r
e0c047a0 1825 ///\r
1826 /// A pointer to the SIMPLE_TEXT_OUTPUT_PROTOCOL interface\r
1827 /// that is associated with StandardErrorHandle.\r
1828 ///\r
00edb218 1829 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *StdErr;\r
e0c047a0 1830 ///\r
1831 /// A pointer to the EFI Runtime Services Table.\r
1832 ///\r
00edb218 1833 EFI_RUNTIME_SERVICES *RuntimeServices;\r
e0c047a0 1834 ///\r
1835 /// A pointer to the EFI Boot Services Table.\r
1836 ///\r
00edb218 1837 EFI_BOOT_SERVICES *BootServices;\r
e0c047a0 1838 ///\r
1839 /// The number of system configuration tables in the buffer ConfigurationTable.\r
1840 ///\r
00edb218 1841 UINTN NumberOfTableEntries;\r
e0c047a0 1842 ///\r
1843 /// A pointer to the system configuration tables.\r
1844 /// The number of entries in the table is NumberOfTableEntries.\r
1845 ///\r
00edb218 1846 EFI_CONFIGURATION_TABLE *ConfigurationTable;\r
959ccb23 1847};\r
1848\r
95cba3ee
A
1849//\r
1850// EFI Load Options Attributes\r
1851//\r
1852#define LOAD_OPTION_ACTIVE 0x00000001\r
1853#define LOAD_OPTION_FORCE_RECONNECT 0x00000002\r
95cba3ee
A
1854#define LOAD_OPTION_HIDDEN 0x00000008\r
1855#define LOAD_OPTION_CATEGORY 0x00001F00\r
1856\r
1857#define LOAD_OPTION_CATEGORY_BOOT 0x00000000\r
1858#define LOAD_OPTION_CATEGORY_APP 0x00000100\r
1859\r
1860#define EFI_BOOT_OPTION_SUPPORT_KEY 0x00000001\r
1861#define EFI_BOOT_OPTION_SUPPORT_APP 0x00000002\r
1862#define EFI_BOOT_OPTION_SUPPORT_COUNT 0x00000300\r
1863\r
1864typedef union {\r
1865 struct {\r
1866 UINT32 Revision : 8;\r
1867 UINT32 ShiftPressed : 1;\r
1868 UINT32 ControlPressed : 1;\r
1869 UINT32 AltPressed : 1;\r
1870 UINT32 LogoPressed : 1;\r
1871 UINT32 MenuPressed : 1;\r
1872 UINT32 SysReqPessed : 1;\r
1873 UINT32 Reserved : 16;\r
1874 UINT32 InputKeyCount : 2;\r
e0c047a0 1875 } Options;\r
95cba3ee 1876 UINT32 PackedValue;\r
0d332fdc 1877} HOT_KEY_EFI_KEY_DATA;\r
95cba3ee
A
1878\r
1879typedef struct {\r
0d332fdc
A
1880 HOT_KEY_EFI_KEY_DATA KeyOptions;\r
1881 UINT32 BootOptionCrc;\r
1882 UINT16 BootOption;\r
1883//EFI_INPUT_KEY Keys[];\r
95cba3ee
A
1884} EFI_KEY_OPTION;\r
1885\r
4bb89f14
A
1886#define EFI_KEY_OPTION_SHIFT 0x00000001\r
1887#define EFI_KEY_OPTION_CONTROL 0x00000002\r
1888#define EFI_KEY_OPTION_ALT 0x00000004\r
1889#define EFI_KEY_OPTION_LOGO 0x00000008\r
1890#define EFI_KEY_OPTION_MENU 0x00000010\r
1891#define EFI_KEY_OPTION_SYSREQ 0x00000020\r
1892#define EFI_KEY_CODE_COUNT 0x00000300\r
1893\r
1894\r
959ccb23 1895//\r
1896// EFI File location to boot from on removable media devices\r
1897//\r
1898#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32 L"\\EFI\\BOOT\\BOOTIA32.EFI"\r
1899#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64 L"\\EFI\\BOOT\\BOOTIA64.EFI"\r
1900#define EFI_REMOVABLE_MEDIA_FILE_NAME_X64 L"\\EFI\\BOOT\\BOOTX64.EFI"\r
959ccb23 1901\r
1902#if defined (MDE_CPU_IA32)\r
1903 #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_IA32\r
1904#elif defined (MDE_CPU_IPF)\r
1905 #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_IA64\r
1906#elif defined (MDE_CPU_X64)\r
1907 #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_X64\r
1908#elif defined (MDE_CPU_EBC)\r
959ccb23 1909#else\r
1910 #error Unknown Processor Type\r
1911#endif\r
1912\r
959ccb23 1913#include <Uefi/UefiPxe.h>\r
1914#include <Uefi/UefiGpt.h>\r
1915#include <Uefi/UefiInternalFormRepresentation.h>\r
1916\r
1917#endif\r