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