iPXE
UefiSpec.h
Go to the documentation of this file.
1 /** @file
2  Include file that supports UEFI.
3 
4  This include file must contain things defined in the UEFI 2.7 specification.
5  If a code construct is defined in the UEFI 2.7 specification it must be included
6  by this include file.
7 
8 Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
9 Portions Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
10 Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
11 
12 SPDX-License-Identifier: BSD-2-Clause-Patent
13 
14 **/
15 
16 #ifndef __UEFI_SPEC_H__
17 #define __UEFI_SPEC_H__
18 
19 FILE_LICENCE ( BSD2_PATENT );
20 
22 
27 
28 ///
29 /// Enumeration of EFI memory allocation types.
30 ///
31 typedef enum {
32  ///
33  /// Allocate any available range of pages that satisfies the request.
34  ///
36  ///
37  /// Allocate any available range of pages whose uppermost address is less than
38  /// or equal to a specified maximum address.
39  ///
41  ///
42  /// Allocate pages at a specified address.
43  ///
45  ///
46  /// Maximum enumeration value that may be used for bounds checking.
47  ///
50 
51 //
52 // Bit definitions for EFI_TIME.Daylight
53 //
54 #define EFI_TIME_ADJUST_DAYLIGHT 0x01
55 #define EFI_TIME_IN_DAYLIGHT 0x02
56 
57 ///
58 /// Value definition for EFI_TIME.TimeZone.
59 ///
60 #define EFI_UNSPECIFIED_TIMEZONE 0x07FF
61 
62 //
63 // Memory cacheability attributes
64 //
65 #define EFI_MEMORY_UC 0x0000000000000001ULL
66 #define EFI_MEMORY_WC 0x0000000000000002ULL
67 #define EFI_MEMORY_WT 0x0000000000000004ULL
68 #define EFI_MEMORY_WB 0x0000000000000008ULL
69 #define EFI_MEMORY_UCE 0x0000000000000010ULL
70 //
71 // Physical memory protection attributes
72 //
73 // Note: UEFI spec 2.5 and following: use EFI_MEMORY_RO as write-protected physical memory
74 // protection attribute. Also, EFI_MEMORY_WP means cacheability attribute.
75 //
76 #define EFI_MEMORY_WP 0x0000000000001000ULL
77 #define EFI_MEMORY_RP 0x0000000000002000ULL
78 #define EFI_MEMORY_XP 0x0000000000004000ULL
79 #define EFI_MEMORY_RO 0x0000000000020000ULL
80 //
81 // Physical memory persistence attribute.
82 // The memory region supports byte-addressable non-volatility.
83 //
84 #define EFI_MEMORY_NV 0x0000000000008000ULL
85 //
86 // The memory region provides higher reliability relative to other memory in the system.
87 // If all memory has the same reliability, then this bit is not used.
88 //
89 #define EFI_MEMORY_MORE_RELIABLE 0x0000000000010000ULL
90 
91 //
92 // Note: UEFI spec 2.8 and following:
93 //
94 // Specific-purpose memory (SPM). The memory is earmarked for
95 // specific purposes such as for specific device drivers or applications.
96 // The SPM attribute serves as a hint to the OS to avoid allocating this
97 // memory for core OS data or code that can not be relocated.
98 //
99 #define EFI_MEMORY_SP 0x0000000000040000ULL
100 //
101 // If this flag is set, the memory region is capable of being
102 // protected with the CPU's memory cryptographic
103 // capabilities. If this flag is clear, the memory region is not
104 // capable of being protected with the CPU's memory
105 // cryptographic capabilities or the CPU does not support CPU
106 // memory cryptographic capabilities.
107 //
108 #define EFI_MEMORY_CPU_CRYPTO 0x0000000000080000ULL
109 
110 //
111 // Runtime memory attribute
112 //
113 #define EFI_MEMORY_RUNTIME 0x8000000000000000ULL
114 
115 //
116 // If this flag is set, the memory region is
117 // described with additional ISA-specific memory attributes
118 // as specified in EFI_MEMORY_ISA_MASK.
119 //
120 #define EFI_MEMORY_ISA_VALID 0x4000000000000000ULL
121 
122 //
123 // Defines the bits reserved for describing optional ISA-specific cacheability
124 // attributes that are not covered by the standard UEFI Memory Attributes cacheability
125 // bits (EFI_MEMORY_UC, EFI_MEMORY_WC, EFI_MEMORY_WT, EFI_MEMORY_WB and EFI_MEMORY_UCE).
126 // See Calling Conventions for further ISA-specific enumeration of these bits.
127 //
128 #define EFI_MEMORY_ISA_MASK 0x0FFFF00000000000ULL
129 
130 //
131 // Attributes bitmasks, grouped by type
132 //
133 #define EFI_CACHE_ATTRIBUTE_MASK (EFI_MEMORY_UC | EFI_MEMORY_WC | EFI_MEMORY_WT | EFI_MEMORY_WB | EFI_MEMORY_UCE | EFI_MEMORY_WP)
134 #define EFI_MEMORY_ACCESS_MASK (EFI_MEMORY_RP | EFI_MEMORY_XP | EFI_MEMORY_RO)
135 #define EFI_MEMORY_ATTRIBUTE_MASK (EFI_MEMORY_ACCESS_MASK | EFI_MEMORY_SP | EFI_MEMORY_CPU_CRYPTO)
136 
137 ///
138 /// Memory descriptor version number.
139 ///
140 #define EFI_MEMORY_DESCRIPTOR_VERSION 1
141 
142 ///
143 /// Definition of an EFI memory descriptor.
144 ///
145 typedef struct {
146  ///
147  /// Type of the memory region.
148  /// Type EFI_MEMORY_TYPE is defined in the
149  /// AllocatePages() function description.
150  ///
152  ///
153  /// Physical address of the first byte in the memory region. PhysicalStart must be
154  /// aligned on a 4 KiB boundary, and must not be above 0xfffffffffffff000. Type
155  /// EFI_PHYSICAL_ADDRESS is defined in the AllocatePages() function description
156  ///
158  ///
159  /// Virtual address of the first byte in the memory region.
160  /// VirtualStart must be aligned on a 4 KiB boundary,
161  /// and must not be above 0xfffffffffffff000.
162  ///
164  ///
165  /// NumberOfPagesNumber of 4 KiB pages in the memory region.
166  /// NumberOfPages must not be 0, and must not be any value
167  /// that would represent a memory page with a start address,
168  /// either physical or virtual, above 0xfffffffffffff000.
169  ///
171  ///
172  /// Attributes of the memory region that describe the bit mask of capabilities
173  /// for that memory region, and not necessarily the current settings for that
174  /// memory region.
175  ///
178 
179 /**
180  Allocates memory pages from the system.
181 
182  @param[in] Type The type of allocation to perform.
183  @param[in] MemoryType The type of memory to allocate.
184  MemoryType values in the range 0x70000000..0x7FFFFFFF
185  are reserved for OEM use. MemoryType values in the range
186  0x80000000..0xFFFFFFFF are reserved for use by UEFI OS loaders
187  that are provided by operating system vendors.
188  @param[in] Pages The number of contiguous 4 KB pages to allocate.
189  @param[in, out] Memory The pointer to a physical address. On input, the way in which the address is
190  used depends on the value of Type.
191 
192  @retval EFI_SUCCESS The requested pages were allocated.
193  @retval EFI_INVALID_PARAMETER 1) Type is not AllocateAnyPages or
194  AllocateMaxAddress or AllocateAddress.
195  2) MemoryType is in the range
196  EfiMaxMemoryType..0x6FFFFFFF.
197  3) Memory is NULL.
198  4) MemoryType is EfiPersistentMemory.
199  @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.
200  @retval EFI_NOT_FOUND The requested pages could not be found.
201 
202 **/
203 typedef
207  IN EFI_MEMORY_TYPE MemoryType,
208  IN UINTN Pages,
209  IN OUT EFI_PHYSICAL_ADDRESS *Memory
210  );
211 
212 /**
213  Frees memory pages.
214 
215  @param[in] Memory The base physical address of the pages to be freed.
216  @param[in] Pages The number of contiguous 4 KB pages to free.
217 
218  @retval EFI_SUCCESS The requested pages were freed.
219  @retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or Pages is invalid.
220  @retval EFI_NOT_FOUND The requested memory pages were not allocated with
221  AllocatePages().
222 
223 **/
224 typedef
227  IN EFI_PHYSICAL_ADDRESS Memory,
228  IN UINTN Pages
229  );
230 
231 /**
232  Returns the current memory map.
233 
234  @param[in, out] MemoryMapSize A pointer to the size, in bytes, of the MemoryMap buffer.
235  On input, this is the size of the buffer allocated by the caller.
236  On output, it is the size of the buffer returned by the firmware if
237  the buffer was large enough, or the size of the buffer needed to contain
238  the map if the buffer was too small.
239  @param[out] MemoryMap A pointer to the buffer in which firmware places the current memory
240  map.
241  @param[out] MapKey A pointer to the location in which firmware returns the key for the
242  current memory map.
243  @param[out] DescriptorSize A pointer to the location in which firmware returns the size, in bytes, of
244  an individual EFI_MEMORY_DESCRIPTOR.
245  @param[out] DescriptorVersion A pointer to the location in which firmware returns the version number
246  associated with the EFI_MEMORY_DESCRIPTOR.
247 
248  @retval EFI_SUCCESS The memory map was returned in the MemoryMap buffer.
249  @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current buffer size
250  needed to hold the memory map is returned in MemoryMapSize.
251  @retval EFI_INVALID_PARAMETER 1) MemoryMapSize is NULL.
252  2) The MemoryMap buffer is not too small and MemoryMap is
253  NULL.
254 
255 **/
256 typedef
259  IN OUT UINTN *MemoryMapSize,
260  OUT EFI_MEMORY_DESCRIPTOR *MemoryMap,
261  OUT UINTN *MapKey,
262  OUT UINTN *DescriptorSize,
263  OUT UINT32 *DescriptorVersion
264  );
265 
266 /**
267  Allocates pool memory.
268 
269  @param[in] PoolType The type of pool to allocate.
270  MemoryType values in the range 0x70000000..0x7FFFFFFF
271  are reserved for OEM use. MemoryType values in the range
272  0x80000000..0xFFFFFFFF are reserved for use by UEFI OS loaders
273  that are provided by operating system vendors.
274  @param[in] Size The number of bytes to allocate from the pool.
275  @param[out] Buffer A pointer to a pointer to the allocated buffer if the call succeeds;
276  undefined otherwise.
277 
278  @retval EFI_SUCCESS The requested number of bytes was allocated.
279  @retval EFI_OUT_OF_RESOURCES The pool requested could not be allocated.
280  @retval EFI_INVALID_PARAMETER Buffer is NULL.
281  PoolType is in the range EfiMaxMemoryType..0x6FFFFFFF.
282  PoolType is EfiPersistentMemory.
283 
284 **/
285 typedef
288  IN EFI_MEMORY_TYPE PoolType,
289  IN UINTN Size,
290  OUT VOID **Buffer
291  );
292 
293 /**
294  Returns pool memory to the system.
295 
296  @param[in] Buffer The pointer to the buffer to free.
297 
298  @retval EFI_SUCCESS The memory was returned to the system.
299  @retval EFI_INVALID_PARAMETER Buffer was invalid.
300 
301 **/
302 typedef
305  IN VOID *Buffer
306  );
307 
308 /**
309  Changes the runtime addressing mode of EFI firmware from physical to virtual.
310 
311  @param[in] MemoryMapSize The size in bytes of VirtualMap.
312  @param[in] DescriptorSize The size in bytes of an entry in the VirtualMap.
313  @param[in] DescriptorVersion The version of the structure entries in VirtualMap.
314  @param[in] VirtualMap An array of memory descriptors which contain new virtual
315  address mapping information for all runtime ranges.
316 
317  @retval EFI_SUCCESS The virtual address map has been applied.
318  @retval EFI_UNSUPPORTED EFI firmware is not at runtime, or the EFI firmware is already in
319  virtual address mapped mode.
320  @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is invalid.
321  @retval EFI_NO_MAPPING A virtual address was not supplied for a range in the memory
322  map that requires a mapping.
323  @retval EFI_NOT_FOUND A virtual address was supplied for an address that is not found
324  in the memory map.
325  @retval EFI_UNSUPPORTED This call is not supported by this platform at the time the call is made.
326  The platform should describe this runtime service as unsupported at runtime
327  via an EFI_RT_PROPERTIES_TABLE configuration table.
328 
329 **/
330 typedef
333  IN UINTN MemoryMapSize,
334  IN UINTN DescriptorSize,
335  IN UINT32 DescriptorVersion,
336  IN EFI_MEMORY_DESCRIPTOR *VirtualMap
337  );
338 
339 /**
340  Connects one or more drivers to a controller.
341 
342  @param[in] ControllerHandle The handle of the controller to which driver(s) are to be connected.
343  @param[in] DriverImageHandle A pointer to an ordered list handles that support the
344  EFI_DRIVER_BINDING_PROTOCOL.
345  @param[in] RemainingDevicePath A pointer to the device path that specifies a child of the
346  controller specified by ControllerHandle.
347  @param[in] Recursive If TRUE, then ConnectController() is called recursively
348  until the entire tree of controllers below the controller specified
349  by ControllerHandle have been created. If FALSE, then
350  the tree of controllers is only expanded one level.
351 
352  @retval EFI_SUCCESS 1) One or more drivers were connected to ControllerHandle.
353  2) No drivers were connected to ControllerHandle, but
354  RemainingDevicePath is not NULL, and it is an End Device
355  Path Node.
356  @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
357  @retval EFI_NOT_FOUND 1) There are no EFI_DRIVER_BINDING_PROTOCOL instances
358  present in the system.
359  2) No drivers were connected to ControllerHandle.
360  @retval EFI_SECURITY_VIOLATION
361  The user has no permission to start UEFI device drivers on the device path
362  associated with the ControllerHandle or specified by the RemainingDevicePath.
363 **/
364 typedef
368  IN EFI_HANDLE *DriverImageHandle OPTIONAL,
369  IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL,
370  IN BOOLEAN Recursive
371  );
372 
373 /**
374  Disconnects one or more drivers from a controller.
375 
376  @param[in] ControllerHandle The handle of the controller from which driver(s) are to be disconnected.
377  @param[in] DriverImageHandle The driver to disconnect from ControllerHandle.
378  If DriverImageHandle is NULL, then all the drivers currently managing
379  ControllerHandle are disconnected from ControllerHandle.
380  @param[in] ChildHandle The handle of the child to destroy.
381  If ChildHandle is NULL, then all the children of ControllerHandle are
382  destroyed before the drivers are disconnected from ControllerHandle.
383 
384  @retval EFI_SUCCESS 1) One or more drivers were disconnected from the controller.
385  2) On entry, no drivers are managing ControllerHandle.
386  3) DriverImageHandle is not NULL, and on entry
387  DriverImageHandle is not managing ControllerHandle.
388  @retval EFI_INVALID_PARAMETER 1) ControllerHandle is NULL.
389  2) DriverImageHandle is not NULL, and it is not a valid EFI_HANDLE.
390  3) ChildHandle is not NULL, and it is not a valid EFI_HANDLE.
391  4) DriverImageHandle does not support the EFI_DRIVER_BINDING_PROTOCOL.
392  @retval EFI_OUT_OF_RESOURCES There are not enough resources available to disconnect any drivers from
393  ControllerHandle.
394  @retval EFI_DEVICE_ERROR The controller could not be disconnected because of a device error.
395 
396 **/
397 typedef
401  IN EFI_HANDLE DriverImageHandle OPTIONAL,
402  IN EFI_HANDLE ChildHandle OPTIONAL
403  );
404 
405 //
406 // ConvertPointer DebugDisposition type.
407 //
408 #define EFI_OPTIONAL_PTR 0x00000001
409 
410 /**
411  Determines the new virtual address that is to be used on subsequent memory accesses.
412 
413  @param[in] DebugDisposition Supplies type information for the pointer being converted.
414  @param[in, out] Address A pointer to a pointer that is to be fixed to be the value needed
415  for the new virtual address mappings being applied.
416 
417  @retval EFI_SUCCESS The pointer pointed to by Address was modified.
418  @retval EFI_NOT_FOUND The pointer pointed to by Address was not found to be part
419  of the current memory map. This is normally fatal.
420  @retval EFI_INVALID_PARAMETER Address is NULL.
421  @retval EFI_INVALID_PARAMETER *Address is NULL and DebugDisposition does
422  not have the EFI_OPTIONAL_PTR bit set.
423  @retval EFI_UNSUPPORTED This call is not supported by this platform at the time the call is made.
424  The platform should describe this runtime service as unsupported at runtime
425  via an EFI_RT_PROPERTIES_TABLE configuration table.
426 
427 **/
428 typedef
431  IN UINTN DebugDisposition,
432  IN OUT VOID **Address
433  );
434 
435 //
436 // These types can be ORed together as needed - for example,
437 // EVT_TIMER might be Ored with EVT_NOTIFY_WAIT or
438 // EVT_NOTIFY_SIGNAL.
439 //
440 #define EVT_TIMER 0x80000000
441 #define EVT_RUNTIME 0x40000000
442 #define EVT_NOTIFY_WAIT 0x00000100
443 #define EVT_NOTIFY_SIGNAL 0x00000200
444 
445 #define EVT_SIGNAL_EXIT_BOOT_SERVICES 0x00000201
446 #define EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE 0x60000202
447 
448 //
449 // The event's NotifyContext pointer points to a runtime memory
450 // address.
451 // The event is deprecated in UEFI2.0 and later specifications.
452 //
453 #define EVT_RUNTIME_CONTEXT 0x20000000
454 
455 /**
456  Invoke a notification event
457 
458  @param[in] Event Event whose notification function is being invoked.
459  @param[in] Context The pointer to the notification function's context,
460  which is implementation-dependent.
461 
462 **/
463 typedef
464 VOID
466  IN EFI_EVENT Event,
467  IN VOID *Context
468  );
469 
470 /**
471  Creates an event.
472 
473  @param[in] Type The type of event to create and its mode and attributes.
474  @param[in] NotifyTpl The task priority level of event notifications, if needed.
475  @param[in] NotifyFunction The pointer to the event's notification function, if any.
476  @param[in] NotifyContext The pointer to the notification function's context; corresponds to parameter
477  Context in the notification function.
478  @param[out] Event The pointer to the newly created event if the call succeeds; undefined
479  otherwise.
480 
481  @retval EFI_SUCCESS The event structure was created.
482  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
483  @retval EFI_OUT_OF_RESOURCES The event could not be allocated.
484 
485 **/
486 typedef
489  IN UINT32 Type,
490  IN EFI_TPL NotifyTpl,
491  IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL,
492  IN VOID *NotifyContext OPTIONAL,
493  OUT EFI_EVENT *Event
494  );
495 
496 /**
497  Creates an event in a group.
498 
499  @param[in] Type The type of event to create and its mode and attributes.
500  @param[in] NotifyTpl The task priority level of event notifications,if needed.
501  @param[in] NotifyFunction The pointer to the event's notification function, if any.
502  @param[in] NotifyContext The pointer to the notification function's context; corresponds to parameter
503  Context in the notification function.
504  @param[in] EventGroup The pointer to the unique identifier of the group to which this event belongs.
505  If this is NULL, then the function behaves as if the parameters were passed
506  to CreateEvent.
507  @param[out] Event The pointer to the newly created event if the call succeeds; undefined
508  otherwise.
509 
510  @retval EFI_SUCCESS The event structure was created.
511  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
512  @retval EFI_OUT_OF_RESOURCES The event could not be allocated.
513 
514 **/
515 typedef
518  IN UINT32 Type,
519  IN EFI_TPL NotifyTpl,
520  IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL,
521  IN CONST VOID *NotifyContext OPTIONAL,
522  IN CONST EFI_GUID *EventGroup OPTIONAL,
523  OUT EFI_EVENT *Event
524  );
525 
526 ///
527 /// Timer delay types
528 ///
529 typedef enum {
530  ///
531  /// An event's timer settings is to be cancelled and not trigger time is to be set/
532  ///
534  ///
535  /// An event is to be signaled periodically at a specified interval from the current time.
536  ///
538  ///
539  /// An event is to be signaled once at a specified interval from the current time.
540  ///
543 
544 /**
545  Sets the type of timer and the trigger time for a timer event.
546 
547  @param[in] Event The timer event that is to be signaled at the specified time.
548  @param[in] Type The type of time that is specified in TriggerTime.
549  @param[in] TriggerTime The number of 100ns units until the timer expires.
550  A TriggerTime of 0 is legal.
551  If Type is TimerRelative and TriggerTime is 0, then the timer
552  event will be signaled on the next timer tick.
553  If Type is TimerPeriodic and TriggerTime is 0, then the timer
554  event will be signaled on every timer tick.
555 
556  @retval EFI_SUCCESS The event has been set to be signaled at the requested time.
557  @retval EFI_INVALID_PARAMETER Event or Type is not valid.
558 
559 **/
560 typedef
563  IN EFI_EVENT Event,
565  IN UINT64 TriggerTime
566  );
567 
568 /**
569  Signals an event.
570 
571  @param[in] Event The event to signal.
572 
573  @retval EFI_SUCCESS The event has been signaled.
574 
575 **/
576 typedef
579  IN EFI_EVENT Event
580  );
581 
582 /**
583  Stops execution until an event is signaled.
584 
585  @param[in] NumberOfEvents The number of events in the Event array.
586  @param[in] Event An array of EFI_EVENT.
587  @param[out] Index The pointer to the index of the event which satisfied the wait condition.
588 
589  @retval EFI_SUCCESS The event indicated by Index was signaled.
590  @retval EFI_INVALID_PARAMETER 1) NumberOfEvents is 0.
591  2) The event indicated by Index is of type
592  EVT_NOTIFY_SIGNAL.
593  @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION.
594 
595 **/
596 typedef
599  IN UINTN NumberOfEvents,
600  IN EFI_EVENT *Event,
601  OUT UINTN *Index
602  );
603 
604 /**
605  Closes an event.
606 
607  @param[in] Event The event to close.
608 
609  @retval EFI_SUCCESS The event has been closed.
610 
611 **/
612 typedef
615  IN EFI_EVENT Event
616  );
617 
618 /**
619  Checks whether an event is in the signaled state.
620 
621  @param[in] Event The event to check.
622 
623  @retval EFI_SUCCESS The event is in the signaled state.
624  @retval EFI_NOT_READY The event is not in the signaled state.
625  @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL.
626 
627 **/
628 typedef
631  IN EFI_EVENT Event
632  );
633 
634 //
635 // Task priority level
636 //
637 #define TPL_APPLICATION 4
638 #define TPL_CALLBACK 8
639 #define TPL_NOTIFY 16
640 #define TPL_HIGH_LEVEL 31
641 
642 /**
643  Raises a task's priority level and returns its previous level.
644 
645  @param[in] NewTpl The new task priority level.
646 
647  @return Previous task priority level
648 
649 **/
650 typedef
651 EFI_TPL
653  IN EFI_TPL NewTpl
654  );
655 
656 /**
657  Restores a task's priority level to its previous value.
658 
659  @param[in] OldTpl The previous task priority level to restore.
660 
661 **/
662 typedef
663 VOID
665  IN EFI_TPL OldTpl
666  );
667 
668 /**
669  Returns the value of a variable.
670 
671  @param[in] VariableName A Null-terminated string that is the name of the vendor's
672  variable.
673  @param[in] VendorGuid A unique identifier for the vendor.
674  @param[out] Attributes If not NULL, a pointer to the memory location to return the
675  attributes bitmask for the variable.
676  @param[in, out] DataSize On input, the size in bytes of the return Data buffer.
677  On output the size of data returned in Data.
678  @param[out] Data The buffer to return the contents of the variable. May be NULL
679  with a zero DataSize in order to determine the size buffer needed.
680 
681  @retval EFI_SUCCESS The function completed successfully.
682  @retval EFI_NOT_FOUND The variable was not found.
683  @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the result.
684  @retval EFI_INVALID_PARAMETER VariableName is NULL.
685  @retval EFI_INVALID_PARAMETER VendorGuid is NULL.
686  @retval EFI_INVALID_PARAMETER DataSize is NULL.
687  @retval EFI_INVALID_PARAMETER The DataSize is not too small and Data is NULL.
688  @retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error.
689  @retval EFI_SECURITY_VIOLATION The variable could not be retrieved due to an authentication failure.
690  @retval EFI_UNSUPPORTED After ExitBootServices() has been called, this return code may be returned
691  if no variable storage is supported. The platform should describe this
692  runtime service as unsupported at runtime via an EFI_RT_PROPERTIES_TABLE
693  configuration table.
694 
695 **/
696 typedef
699  IN CHAR16 *VariableName,
700  IN EFI_GUID *VendorGuid,
701  OUT UINT32 *Attributes OPTIONAL,
702  IN OUT UINTN *DataSize,
703  OUT VOID *Data OPTIONAL
704  );
705 
706 /**
707  Enumerates the current variable names.
708 
709  @param[in, out] VariableNameSize The size of the VariableName buffer. The size must be large
710  enough to fit input string supplied in VariableName buffer.
711  @param[in, out] VariableName On input, supplies the last VariableName that was returned
712  by GetNextVariableName(). On output, returns the Nullterminated
713  string of the current variable.
714  @param[in, out] VendorGuid On input, supplies the last VendorGuid that was returned by
715  GetNextVariableName(). On output, returns the
716  VendorGuid of the current variable.
717 
718  @retval EFI_SUCCESS The function completed successfully.
719  @retval EFI_NOT_FOUND The next variable was not found.
720  @retval EFI_BUFFER_TOO_SMALL The VariableNameSize is too small for the result.
721  VariableNameSize has been updated with the size needed to complete the request.
722  @retval EFI_INVALID_PARAMETER VariableNameSize is NULL.
723  @retval EFI_INVALID_PARAMETER VariableName is NULL.
724  @retval EFI_INVALID_PARAMETER VendorGuid is NULL.
725  @retval EFI_INVALID_PARAMETER The input values of VariableName and VendorGuid are not a name and
726  GUID of an existing variable.
727  @retval EFI_INVALID_PARAMETER Null-terminator is not found in the first VariableNameSize bytes of
728  the input VariableName buffer.
729  @retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error.
730  @retval EFI_UNSUPPORTED After ExitBootServices() has been called, this return code may be returned
731  if no variable storage is supported. The platform should describe this
732  runtime service as unsupported at runtime via an EFI_RT_PROPERTIES_TABLE
733  configuration table.
734 
735 **/
736 typedef
739  IN OUT UINTN *VariableNameSize,
740  IN OUT CHAR16 *VariableName,
741  IN OUT EFI_GUID *VendorGuid
742  );
743 
744 /**
745  Sets the value of a variable.
746 
747  @param[in] VariableName A Null-terminated string that is the name of the vendor's variable.
748  Each VariableName is unique for each VendorGuid. VariableName must
749  contain 1 or more characters. If VariableName is an empty string,
750  then EFI_INVALID_PARAMETER is returned.
751  @param[in] VendorGuid A unique identifier for the vendor.
752  @param[in] Attributes Attributes bitmask to set for the variable.
753  @param[in] DataSize The size in bytes of the Data buffer. Unless the EFI_VARIABLE_APPEND_WRITE or
754  EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS attribute is set, a size of zero
755  causes the variable to be deleted. When the EFI_VARIABLE_APPEND_WRITE attribute is
756  set, then a SetVariable() call with a DataSize of zero will not cause any change to
757  the variable value (the timestamp associated with the variable may be updated however
758  even if no new data value is provided,see the description of the
759  EFI_VARIABLE_AUTHENTICATION_2 descriptor below. In this case the DataSize will not
760  be zero since the EFI_VARIABLE_AUTHENTICATION_2 descriptor will be populated).
761  @param[in] Data The contents for the variable.
762 
763  @retval EFI_SUCCESS The firmware has successfully stored the variable and its data as
764  defined by the Attributes.
765  @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits, name, and GUID was supplied, or the
766  DataSize exceeds the maximum allowed.
767  @retval EFI_INVALID_PARAMETER VariableName is an empty string.
768  @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.
769  @retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error.
770  @retval EFI_WRITE_PROTECTED The variable in question is read-only.
771  @retval EFI_WRITE_PROTECTED The variable in question cannot be deleted.
772  @retval EFI_SECURITY_VIOLATION The variable could not be written due to EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACESS being set,
773  but the AuthInfo does NOT pass the validation check carried out by the firmware.
774 
775  @retval EFI_NOT_FOUND The variable trying to be updated or deleted was not found.
776  @retval EFI_UNSUPPORTED This call is not supported by this platform at the time the call is made.
777  The platform should describe this runtime service as unsupported at runtime
778  via an EFI_RT_PROPERTIES_TABLE configuration table.
779 
780 **/
781 typedef
784  IN CHAR16 *VariableName,
785  IN EFI_GUID *VendorGuid,
786  IN UINT32 Attributes,
787  IN UINTN DataSize,
788  IN VOID *Data
789  );
790 
791 ///
792 /// This provides the capabilities of the
793 /// real time clock device as exposed through the EFI interfaces.
794 ///
795 typedef struct {
796  ///
797  /// Provides the reporting resolution of the real-time clock device in
798  /// counts per second. For a normal PC-AT CMOS RTC device, this
799  /// value would be 1 Hz, or 1, to indicate that the device only reports
800  /// the time to the resolution of 1 second.
801  ///
803  ///
804  /// Provides the timekeeping accuracy of the real-time clock in an
805  /// error rate of 1E-6 parts per million. For a clock with an accuracy
806  /// of 50 parts per million, the value in this field would be
807  /// 50,000,000.
808  ///
810  ///
811  /// A TRUE indicates that a time set operation clears the device's
812  /// time below the Resolution reporting level. A FALSE
813  /// indicates that the state below the Resolution level of the
814  /// device is not cleared when the time is set. Normal PC-AT CMOS
815  /// RTC devices set this value to FALSE.
816  ///
819 
820 /**
821  Returns the current time and date information, and the time-keeping capabilities
822  of the hardware platform.
823 
824  @param[out] Time A pointer to storage to receive a snapshot of the current time.
825  @param[out] Capabilities An optional pointer to a buffer to receive the real time clock
826  device's capabilities.
827 
828  @retval EFI_SUCCESS The operation completed successfully.
829  @retval EFI_INVALID_PARAMETER Time is NULL.
830  @retval EFI_DEVICE_ERROR The time could not be retrieved due to hardware error.
831  @retval EFI_UNSUPPORTED This call is not supported by this platform at the time the call is made.
832  The platform should describe this runtime service as unsupported at runtime
833  via an EFI_RT_PROPERTIES_TABLE configuration table.
834 
835 **/
836 typedef
839  OUT EFI_TIME *Time,
840  OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL
841  );
842 
843 /**
844  Sets the current local time and date information.
845 
846  @param[in] Time A pointer to the current time.
847 
848  @retval EFI_SUCCESS The operation completed successfully.
849  @retval EFI_INVALID_PARAMETER A time field is out of range.
850  @retval EFI_DEVICE_ERROR The time could not be set due due to hardware error.
851  @retval EFI_UNSUPPORTED This call is not supported by this platform at the time the call is made.
852  The platform should describe this runtime service as unsupported at runtime
853  via an EFI_RT_PROPERTIES_TABLE configuration table.
854 
855 **/
856 typedef
859  IN EFI_TIME *Time
860  );
861 
862 /**
863  Returns the current wakeup alarm clock setting.
864 
865  @param[out] Enabled Indicates if the alarm is currently enabled or disabled.
866  @param[out] Pending Indicates if the alarm signal is pending and requires acknowledgement.
867  @param[out] Time The current alarm setting.
868 
869  @retval EFI_SUCCESS The alarm settings were returned.
870  @retval EFI_INVALID_PARAMETER Enabled is NULL.
871  @retval EFI_INVALID_PARAMETER Pending is NULL.
872  @retval EFI_INVALID_PARAMETER Time is NULL.
873  @retval EFI_DEVICE_ERROR The wakeup time could not be retrieved due to a hardware error.
874  @retval EFI_UNSUPPORTED This call is not supported by this platform at the time the call is made.
875  The platform should describe this runtime service as unsupported at runtime
876  via an EFI_RT_PROPERTIES_TABLE configuration table.
877 
878 **/
879 typedef
882  OUT BOOLEAN *Enabled,
883  OUT BOOLEAN *Pending,
884  OUT EFI_TIME *Time
885  );
886 
887 /**
888  Sets the system wakeup alarm clock time.
889 
890  @param[in] Enable Enable or disable the wakeup alarm.
891  @param[in] Time If Enable is TRUE, the time to set the wakeup alarm for.
892  If Enable is FALSE, then this parameter is optional, and may be NULL.
893 
894  @retval EFI_SUCCESS If Enable is TRUE, then the wakeup alarm was enabled. If
895  Enable is FALSE, then the wakeup alarm was disabled.
896  @retval EFI_INVALID_PARAMETER A time field is out of range.
897  @retval EFI_DEVICE_ERROR The wakeup time could not be set due to a hardware error.
898  @retval EFI_UNSUPPORTED This call is not supported by this platform at the time the call is made.
899  The platform should describe this runtime service as unsupported at runtime
900  via an EFI_RT_PROPERTIES_TABLE configuration table.
901 
902 **/
903 typedef
906  IN BOOLEAN Enable,
907  IN EFI_TIME *Time OPTIONAL
908  );
909 
910 /**
911  Loads an EFI image into memory.
912 
913  @param[in] BootPolicy If TRUE, indicates that the request originates from the boot
914  manager, and that the boot manager is attempting to load
915  FilePath as a boot selection. Ignored if SourceBuffer is
916  not NULL.
917  @param[in] ParentImageHandle The caller's image handle.
918  @param[in] DevicePath The DeviceHandle specific file path from which the image is
919  loaded.
920  @param[in] SourceBuffer If not NULL, a pointer to the memory location containing a copy
921  of the image to be loaded.
922  @param[in] SourceSize The size in bytes of SourceBuffer. Ignored if SourceBuffer is NULL.
923  @param[out] ImageHandle The pointer to the returned image handle that is created when the
924  image is successfully loaded.
925 
926  @retval EFI_SUCCESS Image was loaded into memory correctly.
927  @retval EFI_NOT_FOUND Both SourceBuffer and DevicePath are NULL.
928  @retval EFI_INVALID_PARAMETER One or more parametes are invalid.
929  @retval EFI_UNSUPPORTED The image type is not supported.
930  @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient resources.
931  @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not
932  understood.
933  @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error.
934  @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the
935  image from being loaded. NULL is returned in *ImageHandle.
936  @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a
937  valid EFI_LOADED_IMAGE_PROTOCOL. However, the current
938  platform policy specifies that the image should not be started.
939 **/
940 typedef
943  IN BOOLEAN BootPolicy,
944  IN EFI_HANDLE ParentImageHandle,
946  IN VOID *SourceBuffer OPTIONAL,
947  IN UINTN SourceSize,
948  OUT EFI_HANDLE *ImageHandle
949  );
950 
951 /**
952  Transfers control to a loaded image's entry point.
953 
954  @param[in] ImageHandle Handle of image to be started.
955  @param[out] ExitDataSize The pointer to the size, in bytes, of ExitData.
956  @param[out] ExitData The pointer to a pointer to a data buffer that includes a Null-terminated
957  string, optionally followed by additional binary data.
958 
959  @retval EFI_INVALID_PARAMETER ImageHandle is either an invalid image handle or the image
960  has already been initialized with StartImage.
961  @retval EFI_SECURITY_VIOLATION The current platform policy specifies that the image should not be started.
962  @return Exit code from image
963 
964 **/
965 typedef
968  IN EFI_HANDLE ImageHandle,
969  OUT UINTN *ExitDataSize,
970  OUT CHAR16 **ExitData OPTIONAL
971  );
972 
973 /**
974  Terminates a loaded EFI image and returns control to boot services.
975 
976  @param[in] ImageHandle Handle that identifies the image. This parameter is passed to the
977  image on entry.
978  @param[in] ExitStatus The image's exit code.
979  @param[in] ExitDataSize The size, in bytes, of ExitData. Ignored if ExitStatus is EFI_SUCCESS.
980  @param[in] ExitData The pointer to a data buffer that includes a Null-terminated string,
981  optionally followed by additional binary data. The string is a
982  description that the caller may use to further indicate the reason
983  for the image's exit. ExitData is only valid if ExitStatus
984  is something other than EFI_SUCCESS. The ExitData buffer
985  must be allocated by calling AllocatePool().
986 
987  @retval EFI_SUCCESS The image specified by ImageHandle was unloaded.
988  @retval EFI_INVALID_PARAMETER The image specified by ImageHandle has been loaded and
989  started with LoadImage() and StartImage(), but the
990  image is not the currently executing image.
991 
992 **/
993 typedef
996  IN EFI_HANDLE ImageHandle,
997  IN EFI_STATUS ExitStatus,
998  IN UINTN ExitDataSize,
999  IN CHAR16 *ExitData OPTIONAL
1000  );
1001 
1002 /**
1003  Unloads an image.
1004 
1005  @param[in] ImageHandle Handle that identifies the image to be unloaded.
1006 
1007  @retval EFI_SUCCESS The image has been unloaded.
1008  @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle.
1009 
1010 **/
1011 typedef
1012 EFI_STATUS
1014  IN EFI_HANDLE ImageHandle
1015  );
1016 
1017 /**
1018  Terminates all boot services.
1019 
1020  @param[in] ImageHandle Handle that identifies the exiting image.
1021  @param[in] MapKey Key to the latest memory map.
1022 
1023  @retval EFI_SUCCESS Boot services have been terminated.
1024  @retval EFI_INVALID_PARAMETER MapKey is incorrect.
1025 
1026 **/
1027 typedef
1028 EFI_STATUS
1030  IN EFI_HANDLE ImageHandle,
1031  IN UINTN MapKey
1032  );
1033 
1034 /**
1035  Induces a fine-grained stall.
1036 
1037  @param[in] Microseconds The number of microseconds to stall execution.
1038 
1039  @retval EFI_SUCCESS Execution was stalled at least the requested number of
1040  Microseconds.
1041 
1042 **/
1043 typedef
1044 EFI_STATUS
1046  IN UINTN Microseconds
1047  );
1048 
1049 /**
1050  Sets the system's watchdog timer.
1051 
1052  @param[in] Timeout The number of seconds to set the watchdog timer to.
1053  @param[in] WatchdogCode The numeric code to log on a watchdog timer timeout event.
1054  @param[in] DataSize The size, in bytes, of WatchdogData.
1055  @param[in] WatchdogData A data buffer that includes a Null-terminated string, optionally
1056  followed by additional binary data.
1057 
1058  @retval EFI_SUCCESS The timeout has been set.
1059  @retval EFI_INVALID_PARAMETER The supplied WatchdogCode is invalid.
1060  @retval EFI_UNSUPPORTED The system does not have a watchdog timer.
1061  @retval EFI_DEVICE_ERROR The watchdog timer could not be programmed due to a hardware
1062  error.
1063 
1064 **/
1065 typedef
1066 EFI_STATUS
1068  IN UINTN Timeout,
1069  IN UINT64 WatchdogCode,
1070  IN UINTN DataSize,
1071  IN CHAR16 *WatchdogData OPTIONAL
1072  );
1073 
1074 /**
1075  Resets the entire platform.
1076 
1077  @param[in] ResetType The type of reset to perform.
1078  @param[in] ResetStatus The status code for the reset.
1079  @param[in] DataSize The size, in bytes, of ResetData.
1080  @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or
1081  EfiResetShutdown the data buffer starts with a Null-terminated
1082  string, optionally followed by additional binary data.
1083  The string is a description that the caller may use to further
1084  indicate the reason for the system reset.
1085  For a ResetType of EfiResetPlatformSpecific the data buffer
1086  also starts with a Null-terminated string that is followed
1087  by an EFI_GUID that describes the specific type of reset to perform.
1088 **/
1089 typedef
1090 VOID
1092  IN EFI_RESET_TYPE ResetType,
1093  IN EFI_STATUS ResetStatus,
1094  IN UINTN DataSize,
1095  IN VOID *ResetData OPTIONAL
1096  );
1097 
1098 /**
1099  Returns a monotonically increasing count for the platform.
1100 
1101  @param[out] Count The pointer to returned value.
1102 
1103  @retval EFI_SUCCESS The next monotonic count was returned.
1104  @retval EFI_INVALID_PARAMETER Count is NULL.
1105  @retval EFI_DEVICE_ERROR The device is not functioning properly.
1106 
1107 **/
1108 typedef
1109 EFI_STATUS
1111  OUT UINT64 *Count
1112  );
1113 
1114 /**
1115  Returns the next high 32 bits of the platform's monotonic counter.
1116 
1117  @param[out] HighCount The pointer to returned value.
1118 
1119  @retval EFI_SUCCESS The next high monotonic count was returned.
1120  @retval EFI_INVALID_PARAMETER HighCount is NULL.
1121  @retval EFI_DEVICE_ERROR The device is not functioning properly.
1122  @retval EFI_UNSUPPORTED This call is not supported by this platform at the time the call is made.
1123  The platform should describe this runtime service as unsupported at runtime
1124  via an EFI_RT_PROPERTIES_TABLE configuration table.
1125 
1126 **/
1127 typedef
1128 EFI_STATUS
1130  OUT UINT32 *HighCount
1131  );
1132 
1133 /**
1134  Computes and returns a 32-bit CRC for a data buffer.
1135 
1136  @param[in] Data A pointer to the buffer on which the 32-bit CRC is to be computed.
1137  @param[in] DataSize The number of bytes in the buffer Data.
1138  @param[out] Crc32 The 32-bit CRC that was computed for the data buffer specified by Data
1139  and DataSize.
1140 
1141  @retval EFI_SUCCESS The 32-bit CRC was computed for the data buffer and returned in
1142  Crc32.
1143  @retval EFI_INVALID_PARAMETER Data is NULL.
1144  @retval EFI_INVALID_PARAMETER Crc32 is NULL.
1145  @retval EFI_INVALID_PARAMETER DataSize is 0.
1146 
1147 **/
1148 typedef
1149 EFI_STATUS
1151  IN VOID *Data,
1152  IN UINTN DataSize,
1153  OUT UINT32 *Crc32
1154  );
1155 
1156 /**
1157  Copies the contents of one buffer to another buffer.
1158 
1159  @param[in] Destination The pointer to the destination buffer of the memory copy.
1160  @param[in] Source The pointer to the source buffer of the memory copy.
1161  @param[in] Length Number of bytes to copy from Source to Destination.
1162 
1163 **/
1164 typedef
1165 VOID
1167  IN VOID *Destination,
1168  IN VOID *Source,
1169  IN UINTN Length
1170  );
1171 
1172 /**
1173  The SetMem() function fills a buffer with a specified value.
1174 
1175  @param[in] Buffer The pointer to the buffer to fill.
1176  @param[in] Size Number of bytes in Buffer to fill.
1177  @param[in] Value Value to fill Buffer with.
1178 
1179 **/
1180 typedef
1181 VOID
1183  IN VOID *Buffer,
1184  IN UINTN Size,
1185  IN UINT8 Value
1186  );
1187 
1188 ///
1189 /// Enumeration of EFI Interface Types
1190 ///
1191 typedef enum {
1192  ///
1193  /// Indicates that the supplied protocol interface is supplied in native form.
1194  ///
1197 
1198 /**
1199  Installs a protocol interface on a device handle. If the handle does not exist, it is created and added
1200  to the list of handles in the system. InstallMultipleProtocolInterfaces() performs
1201  more error checking than InstallProtocolInterface(), so it is recommended that
1202  InstallMultipleProtocolInterfaces() be used in place of
1203  InstallProtocolInterface()
1204 
1205  @param[in, out] Handle A pointer to the EFI_HANDLE on which the interface is to be installed.
1206  @param[in] Protocol The numeric ID of the protocol interface.
1207  @param[in] InterfaceType Indicates whether Interface is supplied in native form.
1208  @param[in] Interface A pointer to the protocol interface.
1209 
1210  @retval EFI_SUCCESS The protocol interface was installed.
1211  @retval EFI_OUT_OF_RESOURCES Space for a new handle could not be allocated.
1212  @retval EFI_INVALID_PARAMETER Handle is NULL.
1213  @retval EFI_INVALID_PARAMETER Protocol is NULL.
1214  @retval EFI_INVALID_PARAMETER InterfaceType is not EFI_NATIVE_INTERFACE.
1215  @retval EFI_INVALID_PARAMETER Protocol is already installed on the handle specified by Handle.
1216 
1217 **/
1218 typedef
1219 EFI_STATUS
1221  IN OUT EFI_HANDLE *Handle,
1222  IN EFI_GUID *Protocol,
1223  IN EFI_INTERFACE_TYPE InterfaceType,
1224  IN VOID *Interface
1225  );
1226 
1227 /**
1228  Installs one or more protocol interfaces into the boot services environment.
1229 
1230  @param[in, out] Handle The pointer to a handle to install the new protocol interfaces on,
1231  or a pointer to NULL if a new handle is to be allocated.
1232  @param ... A variable argument list containing pairs of protocol GUIDs and protocol
1233  interfaces.
1234 
1235  @retval EFI_SUCCESS All the protocol interface was installed.
1236  @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.
1237  @retval EFI_ALREADY_STARTED A Device Path Protocol instance was passed in that is already present in
1238  the handle database.
1239  @retval EFI_INVALID_PARAMETER Handle is NULL.
1240  @retval EFI_INVALID_PARAMETER Protocol is already installed on the handle specified by Handle.
1241 
1242 **/
1243 typedef
1244 EFI_STATUS
1246  IN OUT EFI_HANDLE *Handle,
1247  ...
1248  );
1249 
1250 /**
1251  Reinstalls a protocol interface on a device handle.
1252 
1253  @param[in] Handle Handle on which the interface is to be reinstalled.
1254  @param[in] Protocol The numeric ID of the interface.
1255  @param[in] OldInterface A pointer to the old interface. NULL can be used if a structure is not
1256  associated with Protocol.
1257  @param[in] NewInterface A pointer to the new interface.
1258 
1259  @retval EFI_SUCCESS The protocol interface was reinstalled.
1260  @retval EFI_NOT_FOUND The OldInterface on the handle was not found.
1261  @retval EFI_ACCESS_DENIED The protocol interface could not be reinstalled,
1262  because OldInterface is still being used by a
1263  driver that will not release it.
1264  @retval EFI_INVALID_PARAMETER Handle is NULL.
1265  @retval EFI_INVALID_PARAMETER Protocol is NULL.
1266 
1267 **/
1268 typedef
1269 EFI_STATUS
1271  IN EFI_HANDLE Handle,
1272  IN EFI_GUID *Protocol,
1273  IN VOID *OldInterface,
1274  IN VOID *NewInterface
1275  );
1276 
1277 /**
1278  Removes a protocol interface from a device handle. It is recommended that
1279  UninstallMultipleProtocolInterfaces() be used in place of
1280  UninstallProtocolInterface().
1281 
1282  @param[in] Handle The handle on which the interface was installed.
1283  @param[in] Protocol The numeric ID of the interface.
1284  @param[in] Interface A pointer to the interface.
1285 
1286  @retval EFI_SUCCESS The interface was removed.
1287  @retval EFI_NOT_FOUND The interface was not found.
1288  @retval EFI_ACCESS_DENIED The interface was not removed because the interface
1289  is still being used by a driver.
1290  @retval EFI_INVALID_PARAMETER Handle is NULL.
1291  @retval EFI_INVALID_PARAMETER Protocol is NULL.
1292 
1293 **/
1294 typedef
1295 EFI_STATUS
1297  IN EFI_HANDLE Handle,
1298  IN EFI_GUID *Protocol,
1299  IN VOID *Interface
1300  );
1301 
1302 /**
1303  Removes one or more protocol interfaces into the boot services environment.
1304 
1305  @param[in] Handle The handle to remove the protocol interfaces from.
1306  @param ... A variable argument list containing pairs of protocol GUIDs and
1307  protocol interfaces.
1308 
1309  @retval EFI_SUCCESS All the protocol interfaces were removed.
1310  @retval EFI_INVALID_PARAMETER One of the protocol interfaces was not previously installed on Handle.
1311 
1312 **/
1313 typedef
1314 EFI_STATUS
1316  IN EFI_HANDLE Handle,
1317  ...
1318  );
1319 
1320 /**
1321  Queries a handle to determine if it supports a specified protocol.
1322 
1323  @param[in] Handle The handle being queried.
1324  @param[in] Protocol The published unique identifier of the protocol.
1325  @param[out] Interface Supplies the address where a pointer to the corresponding Protocol
1326  Interface is returned.
1327 
1328  @retval EFI_SUCCESS The interface information for the specified protocol was returned.
1329  @retval EFI_UNSUPPORTED The device does not support the specified protocol.
1330  @retval EFI_INVALID_PARAMETER Handle is NULL.
1331  @retval EFI_INVALID_PARAMETER Protocol is NULL.
1332  @retval EFI_INVALID_PARAMETER Interface is NULL.
1333 
1334 **/
1335 typedef
1336 EFI_STATUS
1338  IN EFI_HANDLE Handle,
1339  IN EFI_GUID *Protocol,
1340  OUT VOID **Interface
1341  );
1342 
1343 #define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL 0x00000001
1344 #define EFI_OPEN_PROTOCOL_GET_PROTOCOL 0x00000002
1345 #define EFI_OPEN_PROTOCOL_TEST_PROTOCOL 0x00000004
1346 #define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008
1347 #define EFI_OPEN_PROTOCOL_BY_DRIVER 0x00000010
1348 #define EFI_OPEN_PROTOCOL_EXCLUSIVE 0x00000020
1349 
1350 /**
1351  Queries a handle to determine if it supports a specified protocol. If the protocol is supported by the
1352  handle, it opens the protocol on behalf of the calling agent.
1353 
1354  @param[in] Handle The handle for the protocol interface that is being opened.
1355  @param[in] Protocol The published unique identifier of the protocol.
1356  @param[out] Interface Supplies the address where a pointer to the corresponding Protocol
1357  Interface is returned.
1358  @param[in] AgentHandle The handle of the agent that is opening the protocol interface
1359  specified by Protocol and Interface.
1360  @param[in] ControllerHandle If the agent that is opening a protocol is a driver that follows the
1361  UEFI Driver Model, then this parameter is the controller handle
1362  that requires the protocol interface. If the agent does not follow
1363  the UEFI Driver Model, then this parameter is optional and may
1364  be NULL.
1365  @param[in] Attributes The open mode of the protocol interface specified by Handle
1366  and Protocol.
1367 
1368  @retval EFI_SUCCESS An item was added to the open list for the protocol interface, and the
1369  protocol interface was returned in Interface.
1370  @retval EFI_UNSUPPORTED Handle does not support Protocol.
1371  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
1372  @retval EFI_ACCESS_DENIED Required attributes can't be supported in current environment.
1373  @retval EFI_ALREADY_STARTED Item on the open list already has requierd attributes whose agent
1374  handle is the same as AgentHandle.
1375 
1376 **/
1377 typedef
1378 EFI_STATUS
1380  IN EFI_HANDLE Handle,
1381  IN EFI_GUID *Protocol,
1382  OUT VOID **Interface OPTIONAL,
1383  IN EFI_HANDLE AgentHandle,
1385  IN UINT32 Attributes
1386  );
1387 
1388 /**
1389  Closes a protocol on a handle that was opened using OpenProtocol().
1390 
1391  @param[in] Handle The handle for the protocol interface that was previously opened
1392  with OpenProtocol(), and is now being closed.
1393  @param[in] Protocol The published unique identifier of the protocol.
1394  @param[in] AgentHandle The handle of the agent that is closing the protocol interface.
1395  @param[in] ControllerHandle If the agent that opened a protocol is a driver that follows the
1396  UEFI Driver Model, then this parameter is the controller handle
1397  that required the protocol interface.
1398 
1399  @retval EFI_SUCCESS The protocol instance was closed.
1400  @retval EFI_INVALID_PARAMETER 1) Handle is NULL.
1401  2) AgentHandle is NULL.
1402  3) ControllerHandle is not NULL and ControllerHandle is not a valid EFI_HANDLE.
1403  4) Protocol is NULL.
1404  @retval EFI_NOT_FOUND 1) Handle does not support the protocol specified by Protocol.
1405  2) The protocol interface specified by Handle and Protocol is not
1406  currently open by AgentHandle and ControllerHandle.
1407 
1408 **/
1409 typedef
1410 EFI_STATUS
1412  IN EFI_HANDLE Handle,
1413  IN EFI_GUID *Protocol,
1414  IN EFI_HANDLE AgentHandle,
1416  );
1417 
1418 ///
1419 /// EFI Oprn Protocol Information Entry
1420 ///
1421 typedef struct {
1427 
1428 /**
1429  Retrieves the list of agents that currently have a protocol interface opened.
1430 
1431  @param[in] Handle The handle for the protocol interface that is being queried.
1432  @param[in] Protocol The published unique identifier of the protocol.
1433  @param[out] EntryBuffer A pointer to a buffer of open protocol information in the form of
1434  EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.
1435  @param[out] EntryCount A pointer to the number of entries in EntryBuffer.
1436 
1437  @retval EFI_SUCCESS The open protocol information was returned in EntryBuffer, and the
1438  number of entries was returned EntryCount.
1439  @retval EFI_OUT_OF_RESOURCES There are not enough resources available to allocate EntryBuffer.
1440  @retval EFI_NOT_FOUND Handle does not support the protocol specified by Protocol.
1441 
1442 **/
1443 typedef
1444 EFI_STATUS
1446  IN EFI_HANDLE Handle,
1447  IN EFI_GUID *Protocol,
1449  OUT UINTN *EntryCount
1450  );
1451 
1452 /**
1453  Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated
1454  from pool.
1455 
1456  @param[in] Handle The handle from which to retrieve the list of protocol interface
1457  GUIDs.
1458  @param[out] ProtocolBuffer A pointer to the list of protocol interface GUID pointers that are
1459  installed on Handle.
1460  @param[out] ProtocolBufferCount A pointer to the number of GUID pointers present in
1461  ProtocolBuffer.
1462 
1463  @retval EFI_SUCCESS The list of protocol interface GUIDs installed on Handle was returned in
1464  ProtocolBuffer. The number of protocol interface GUIDs was
1465  returned in ProtocolBufferCount.
1466  @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the results.
1467  @retval EFI_INVALID_PARAMETER Handle is NULL.
1468  @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
1469  @retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.
1470  @retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.
1471 
1472 **/
1473 typedef
1474 EFI_STATUS
1476  IN EFI_HANDLE Handle,
1477  OUT EFI_GUID ***ProtocolBuffer,
1478  OUT UINTN *ProtocolBufferCount
1479  );
1480 
1481 /**
1482  Creates an event that is to be signaled whenever an interface is installed for a specified protocol.
1483 
1484  @param[in] Protocol The numeric ID of the protocol for which the event is to be registered.
1485  @param[in] Event Event that is to be signaled whenever a protocol interface is registered
1486  for Protocol.
1487  @param[out] Registration A pointer to a memory location to receive the registration value.
1488 
1489  @retval EFI_SUCCESS The notification event has been registered.
1490  @retval EFI_OUT_OF_RESOURCES Space for the notification event could not be allocated.
1491  @retval EFI_INVALID_PARAMETER Protocol is NULL.
1492  @retval EFI_INVALID_PARAMETER Event is NULL.
1493  @retval EFI_INVALID_PARAMETER Registration is NULL.
1494 
1495 **/
1496 typedef
1497 EFI_STATUS
1499  IN EFI_GUID *Protocol,
1500  IN EFI_EVENT Event,
1501  OUT VOID **Registration
1502  );
1503 
1504 ///
1505 /// Enumeration of EFI Locate Search Types
1506 ///
1507 typedef enum {
1508  ///
1509  /// Retrieve all the handles in the handle database.
1510  ///
1512  ///
1513  /// Retrieve the next handle fron a RegisterProtocolNotify() event.
1514  ///
1516  ///
1517  /// Retrieve the set of handles from the handle database that support a
1518  /// specified protocol.
1519  ///
1522 
1523 /**
1524  Returns an array of handles that support a specified protocol.
1525 
1526  @param[in] SearchType Specifies which handle(s) are to be returned.
1527  @param[in] Protocol Specifies the protocol to search by.
1528  @param[in] SearchKey Specifies the search key.
1529  @param[in, out] BufferSize On input, the size in bytes of Buffer. On output, the size in bytes of
1530  the array returned in Buffer (if the buffer was large enough) or the
1531  size, in bytes, of the buffer needed to obtain the array (if the buffer was
1532  not large enough).
1533  @param[out] Buffer The buffer in which the array is returned.
1534 
1535  @retval EFI_SUCCESS The array of handles was returned.
1536  @retval EFI_NOT_FOUND No handles match the search.
1537  @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small for the result.
1538  @retval EFI_INVALID_PARAMETER SearchType is not a member of EFI_LOCATE_SEARCH_TYPE.
1539  @retval EFI_INVALID_PARAMETER SearchType is ByRegisterNotify and SearchKey is NULL.
1540  @retval EFI_INVALID_PARAMETER SearchType is ByProtocol and Protocol is NULL.
1541  @retval EFI_INVALID_PARAMETER One or more matches are found and BufferSize is NULL.
1542  @retval EFI_INVALID_PARAMETER BufferSize is large enough for the result and Buffer is NULL.
1543 
1544 **/
1545 typedef
1546 EFI_STATUS
1548  IN EFI_LOCATE_SEARCH_TYPE SearchType,
1550  IN VOID *SearchKey OPTIONAL,
1553  );
1554 
1555 /**
1556  Locates the handle to a device on the device path that supports the specified protocol.
1557 
1558  @param[in] Protocol Specifies the protocol to search for.
1559  @param[in, out] DevicePath On input, a pointer to a pointer to the device path. On output, the device
1560  path pointer is modified to point to the remaining part of the device
1561  path.
1562  @param[out] Device A pointer to the returned device handle.
1563 
1564  @retval EFI_SUCCESS The resulting handle was returned.
1565  @retval EFI_NOT_FOUND No handles match the search.
1566  @retval EFI_INVALID_PARAMETER Protocol is NULL.
1567  @retval EFI_INVALID_PARAMETER DevicePath is NULL.
1568  @retval EFI_INVALID_PARAMETER A handle matched the search and Device is NULL.
1569 
1570 **/
1571 typedef
1572 EFI_STATUS
1574  IN EFI_GUID *Protocol,
1575  IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
1576  OUT EFI_HANDLE *Device
1577  );
1578 
1579 /**
1580  Adds, updates, or removes a configuration table entry from the EFI System Table.
1581 
1582  @param[in] Guid A pointer to the GUID for the entry to add, update, or remove.
1583  @param[in] Table A pointer to the configuration table for the entry to add, update, or
1584  remove. May be NULL.
1585 
1586  @retval EFI_SUCCESS The (Guid, Table) pair was added, updated, or removed.
1587  @retval EFI_NOT_FOUND An attempt was made to delete a nonexistent entry.
1588  @retval EFI_INVALID_PARAMETER Guid is NULL.
1589  @retval EFI_OUT_OF_RESOURCES There is not enough memory available to complete the operation.
1590 
1591 **/
1592 typedef
1593 EFI_STATUS
1595  IN EFI_GUID *Guid,
1596  IN VOID *Table
1597  );
1598 
1599 /**
1600  Returns an array of handles that support the requested protocol in a buffer allocated from pool.
1601 
1602  @param[in] SearchType Specifies which handle(s) are to be returned.
1603  @param[in] Protocol Provides the protocol to search by.
1604  This parameter is only valid for a SearchType of ByProtocol.
1605  @param[in] SearchKey Supplies the search key depending on the SearchType.
1606  @param[out] NoHandles The number of handles returned in Buffer.
1607  @param[out] Buffer A pointer to the buffer to return the requested array of handles that
1608  support Protocol.
1609 
1610  @retval EFI_SUCCESS The array of handles was returned in Buffer, and the number of
1611  handles in Buffer was returned in NoHandles.
1612  @retval EFI_NOT_FOUND No handles match the search.
1613  @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the matching results.
1614  @retval EFI_INVALID_PARAMETER NoHandles is NULL.
1615  @retval EFI_INVALID_PARAMETER Buffer is NULL.
1616 
1617 **/
1618 typedef
1619 EFI_STATUS
1621  IN EFI_LOCATE_SEARCH_TYPE SearchType,
1623  IN VOID *SearchKey OPTIONAL,
1624  OUT UINTN *NoHandles,
1626  );
1627 
1628 /**
1629  Returns the first protocol instance that matches the given protocol.
1630 
1631  @param[in] Protocol Provides the protocol to search for.
1632  @param[in] Registration Optional registration key returned from
1633  RegisterProtocolNotify().
1634  @param[out] Interface On return, a pointer to the first interface that matches Protocol and
1635  Registration.
1636 
1637  @retval EFI_SUCCESS A protocol instance matching Protocol was found and returned in
1638  Interface.
1639  @retval EFI_NOT_FOUND No protocol instances were found that match Protocol and
1640  Registration.
1641  @retval EFI_INVALID_PARAMETER Interface is NULL.
1642  Protocol is NULL.
1643 
1644 **/
1645 typedef
1646 EFI_STATUS
1648  IN EFI_GUID *Protocol,
1649  IN VOID *Registration OPTIONAL,
1650  OUT VOID **Interface
1651  );
1652 
1653 ///
1654 /// EFI Capsule Block Descriptor
1655 ///
1656 typedef struct {
1657  ///
1658  /// Length in bytes of the data pointed to by DataBlock/ContinuationPointer.
1659  ///
1661  union {
1662  ///
1663  /// Physical address of the data block. This member of the union is
1664  /// used if Length is not equal to zero.
1665  ///
1667  ///
1668  /// Physical address of another block of
1669  /// EFI_CAPSULE_BLOCK_DESCRIPTOR structures. This
1670  /// member of the union is used if Length is equal to zero. If
1671  /// ContinuationPointer is zero this entry represents the end of the list.
1672  ///
1674  } Union;
1676 
1677 ///
1678 /// EFI Capsule Header.
1679 ///
1680 typedef struct {
1681  ///
1682  /// A GUID that defines the contents of a capsule.
1683  ///
1685  ///
1686  /// The size of the capsule header. This may be larger than the size of
1687  /// the EFI_CAPSULE_HEADER since CapsuleGuid may imply
1688  /// extended header entries
1689  ///
1691  ///
1692  /// Bit-mapped list describing the capsule attributes. The Flag values
1693  /// of 0x0000 - 0xFFFF are defined by CapsuleGuid. Flag values
1694  /// of 0x10000 - 0xFFFFFFFF are defined by this specification
1695  ///
1697  ///
1698  /// Size in bytes of the capsule (including capsule header).
1699  ///
1702 
1703 ///
1704 /// The EFI System Table entry must point to an array of capsules
1705 /// that contain the same CapsuleGuid value. The array must be
1706 /// prefixed by a UINT32 that represents the size of the array of capsules.
1707 ///
1708 typedef struct {
1709  ///
1710  /// the size of the array of capsules.
1711  ///
1713  ///
1714  /// Point to an array of capsules that contain the same CapsuleGuid value.
1715  ///
1716  VOID *CapsulePtr[1];
1718 
1719 #define CAPSULE_FLAGS_PERSIST_ACROSS_RESET 0x00010000
1720 #define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE 0x00020000
1721 #define CAPSULE_FLAGS_INITIATE_RESET 0x00040000
1722 
1723 /**
1724  Passes capsules to the firmware with both virtual and physical mapping. Depending on the intended
1725  consumption, the firmware may process the capsule immediately. If the payload should persist
1726  across a system reset, the reset value returned from EFI_QueryCapsuleCapabilities must
1727  be passed into ResetSystem() and will cause the capsule to be processed by the firmware as
1728  part of the reset process.
1729 
1730  @param[in] CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules
1731  being passed into update capsule.
1732  @param[in] CapsuleCount Number of pointers to EFI_CAPSULE_HEADER in
1733  CaspuleHeaderArray.
1734  @param[in] ScatterGatherList Physical pointer to a set of
1735  EFI_CAPSULE_BLOCK_DESCRIPTOR that describes the
1736  location in physical memory of a set of capsules.
1737 
1738  @retval EFI_SUCCESS Valid capsule was passed. If
1739  CAPSULE_FLAGS_PERSIT_ACROSS_RESET is not set, the
1740  capsule has been successfully processed by the firmware.
1741  @retval EFI_INVALID_PARAMETER CapsuleSize is NULL, or an incompatible set of flags were
1742  set in the capsule header.
1743  @retval EFI_INVALID_PARAMETER CapsuleCount is 0.
1744  @retval EFI_DEVICE_ERROR The capsule update was started, but failed due to a device error.
1745  @retval EFI_UNSUPPORTED The capsule type is not supported on this platform.
1746  @retval EFI_OUT_OF_RESOURCES When ExitBootServices() has been previously called this error indicates the capsule
1747  is compatible with this platform but is not capable of being submitted or processed
1748  in runtime. The caller may resubmit the capsule prior to ExitBootServices().
1749  @retval EFI_OUT_OF_RESOURCES When ExitBootServices() has not been previously called then this error indicates
1750  the capsule is compatible with this platform but there are insufficient resources to process.
1751  @retval EFI_UNSUPPORTED This call is not supported by this platform at the time the call is made.
1752  The platform should describe this runtime service as unsupported at runtime
1753  via an EFI_RT_PROPERTIES_TABLE configuration table.
1754 
1755 **/
1756 typedef
1757 EFI_STATUS
1759  IN EFI_CAPSULE_HEADER **CapsuleHeaderArray,
1760  IN UINTN CapsuleCount,
1761  IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL
1762  );
1763 
1764 /**
1765  Returns if the capsule can be supported via UpdateCapsule().
1766 
1767  @param[in] CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules
1768  being passed into update capsule.
1769  @param[in] CapsuleCount Number of pointers to EFI_CAPSULE_HEADER in
1770  CaspuleHeaderArray.
1771  @param[out] MaxiumCapsuleSize On output the maximum size that UpdateCapsule() can
1772  support as an argument to UpdateCapsule() via
1773  CapsuleHeaderArray and ScatterGatherList.
1774  @param[out] ResetType Returns the type of reset required for the capsule update.
1775 
1776  @retval EFI_SUCCESS Valid answer returned.
1777  @retval EFI_UNSUPPORTED The capsule type is not supported on this platform, and
1778  MaximumCapsuleSize and ResetType are undefined.
1779  @retval EFI_INVALID_PARAMETER MaximumCapsuleSize is NULL.
1780  @retval EFI_OUT_OF_RESOURCES When ExitBootServices() has been previously called this error indicates the capsule
1781  is compatible with this platform but is not capable of being submitted or processed
1782  in runtime. The caller may resubmit the capsule prior to ExitBootServices().
1783  @retval EFI_OUT_OF_RESOURCES When ExitBootServices() has not been previously called then this error indicates
1784  the capsule is compatible with this platform but there are insufficient resources to process.
1785  @retval EFI_UNSUPPORTED This call is not supported by this platform at the time the call is made.
1786  The platform should describe this runtime service as unsupported at runtime
1787  via an EFI_RT_PROPERTIES_TABLE configuration table.
1788 
1789 **/
1790 typedef
1791 EFI_STATUS
1793  IN EFI_CAPSULE_HEADER **CapsuleHeaderArray,
1794  IN UINTN CapsuleCount,
1795  OUT UINT64 *MaximumCapsuleSize,
1796  OUT EFI_RESET_TYPE *ResetType
1797  );
1798 
1799 /**
1800  Returns information about the EFI variables.
1801 
1802  @param[in] Attributes Attributes bitmask to specify the type of variables on
1803  which to return information.
1804  @param[out] MaximumVariableStorageSize On output the maximum size of the storage space
1805  available for the EFI variables associated with the
1806  attributes specified.
1807  @param[out] RemainingVariableStorageSize Returns the remaining size of the storage space
1808  available for the EFI variables associated with the
1809  attributes specified.
1810  @param[out] MaximumVariableSize Returns the maximum size of the individual EFI
1811  variables associated with the attributes specified.
1812 
1813  @retval EFI_SUCCESS Valid answer returned.
1814  @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied
1815  @retval EFI_UNSUPPORTED The attribute is not supported on this platform, and the
1816  MaximumVariableStorageSize,
1817  RemainingVariableStorageSize, MaximumVariableSize
1818  are undefined.
1819 
1820 **/
1821 typedef
1822 EFI_STATUS
1824  IN UINT32 Attributes,
1825  OUT UINT64 *MaximumVariableStorageSize,
1826  OUT UINT64 *RemainingVariableStorageSize,
1827  OUT UINT64 *MaximumVariableSize
1828  );
1829 
1830 //
1831 // Firmware should stop at a firmware user interface on next boot
1832 //
1833 #define EFI_OS_INDICATIONS_BOOT_TO_FW_UI 0x0000000000000001
1834 #define EFI_OS_INDICATIONS_TIMESTAMP_REVOCATION 0x0000000000000002
1835 #define EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED 0x0000000000000004
1836 #define EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED 0x0000000000000008
1837 #define EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED 0x0000000000000010
1838 #define EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY 0x0000000000000040
1839 #define EFI_OS_INDICATIONS_JSON_CONFIG_DATA_REFRESH 0x0000000000000080
1840 
1841 //
1842 // EFI Runtime Services Table
1843 //
1844 #define EFI_SYSTEM_TABLE_SIGNATURE SIGNATURE_64 ('I','B','I',' ','S','Y','S','T')
1845 #define EFI_2_80_SYSTEM_TABLE_REVISION ((2 << 16) | (80))
1846 #define EFI_2_70_SYSTEM_TABLE_REVISION ((2 << 16) | (70))
1847 #define EFI_2_60_SYSTEM_TABLE_REVISION ((2 << 16) | (60))
1848 #define EFI_2_50_SYSTEM_TABLE_REVISION ((2 << 16) | (50))
1849 #define EFI_2_40_SYSTEM_TABLE_REVISION ((2 << 16) | (40))
1850 #define EFI_2_31_SYSTEM_TABLE_REVISION ((2 << 16) | (31))
1851 #define EFI_2_30_SYSTEM_TABLE_REVISION ((2 << 16) | (30))
1852 #define EFI_2_20_SYSTEM_TABLE_REVISION ((2 << 16) | (20))
1853 #define EFI_2_10_SYSTEM_TABLE_REVISION ((2 << 16) | (10))
1854 #define EFI_2_00_SYSTEM_TABLE_REVISION ((2 << 16) | (00))
1855 #define EFI_1_10_SYSTEM_TABLE_REVISION ((1 << 16) | (10))
1856 #define EFI_1_02_SYSTEM_TABLE_REVISION ((1 << 16) | (02))
1857 #define EFI_SYSTEM_TABLE_REVISION EFI_2_70_SYSTEM_TABLE_REVISION
1858 #define EFI_SPECIFICATION_VERSION EFI_SYSTEM_TABLE_REVISION
1859 
1860 #define EFI_RUNTIME_SERVICES_SIGNATURE SIGNATURE_64 ('R','U','N','T','S','E','R','V')
1861 #define EFI_RUNTIME_SERVICES_REVISION EFI_SPECIFICATION_VERSION
1862 
1863 ///
1864 /// EFI Runtime Services Table.
1865 ///
1866 typedef struct {
1867  ///
1868  /// The table header for the EFI Runtime Services Table.
1869  ///
1871 
1872  //
1873  // Time Services
1874  //
1879 
1880  //
1881  // Virtual Memory Services
1882  //
1885 
1886  //
1887  // Variable Services
1888  //
1892 
1893  //
1894  // Miscellaneous Services
1895  //
1898 
1899  //
1900  // UEFI 2.0 Capsule Services
1901  //
1904 
1905  //
1906  // Miscellaneous UEFI 2.0 Service
1907  //
1910 
1911 #define EFI_BOOT_SERVICES_SIGNATURE SIGNATURE_64 ('B','O','O','T','S','E','R','V')
1912 #define EFI_BOOT_SERVICES_REVISION EFI_SPECIFICATION_VERSION
1913 
1914 ///
1915 /// EFI Boot Services Table.
1916 ///
1917 typedef struct {
1918  ///
1919  /// The table header for the EFI Boot Services Table.
1920  ///
1922 
1923  //
1924  // Task Priority Services
1925  //
1928 
1929  //
1930  // Memory Services
1931  //
1937 
1938  //
1939  // Event & Timer Services
1940  //
1947 
1948  //
1949  // Protocol Handler Services
1950  //
1960 
1961  //
1962  // Image Services
1963  //
1969 
1970  //
1971  // Miscellaneous Services
1972  //
1976 
1977  //
1978  // DriverSupport Services
1979  //
1982 
1983  //
1984  // Open and Close Protocol Services
1985  //
1989 
1990  //
1991  // Library Services
1992  //
1998 
1999  //
2000  // 32-bit CRC Services
2001  //
2003 
2004  //
2005  // Miscellaneous Services
2006  //
2011 
2012 ///
2013 /// Contains a set of GUID/pointer pairs comprised of the ConfigurationTable field in the
2014 /// EFI System Table.
2015 ///
2016 typedef struct {
2017  ///
2018  /// The 128-bit GUID value that uniquely identifies the system configuration table.
2019  ///
2021  ///
2022  /// A pointer to the table associated with VendorGuid.
2023  ///
2026 
2027 ///
2028 /// EFI System Table
2029 ///
2030 typedef struct {
2031  ///
2032  /// The table header for the EFI System Table.
2033  ///
2035  ///
2036  /// A pointer to a null terminated string that identifies the vendor
2037  /// that produces the system firmware for the platform.
2038  ///
2040  ///
2041  /// A firmware vendor specific value that identifies the revision
2042  /// of the system firmware for the platform.
2043  ///
2045  ///
2046  /// The handle for the active console input device. This handle must support
2047  /// EFI_SIMPLE_TEXT_INPUT_PROTOCOL and EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.
2048  ///
2050  ///
2051  /// A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL interface that is
2052  /// associated with ConsoleInHandle.
2053  ///
2055  ///
2056  /// The handle for the active console output device.
2057  ///
2059  ///
2060  /// A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface
2061  /// that is associated with ConsoleOutHandle.
2062  ///
2064  ///
2065  /// The handle for the active standard error console device.
2066  /// This handle must support the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.
2067  ///
2069  ///
2070  /// A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface
2071  /// that is associated with StandardErrorHandle.
2072  ///
2074  ///
2075  /// A pointer to the EFI Runtime Services Table.
2076  ///
2078  ///
2079  /// A pointer to the EFI Boot Services Table.
2080  ///
2082  ///
2083  /// The number of system configuration tables in the buffer ConfigurationTable.
2084  ///
2086  ///
2087  /// A pointer to the system configuration tables.
2088  /// The number of entries in the table is NumberOfTableEntries.
2089  ///
2092 
2093 /**
2094  This is the declaration of an EFI image entry point. This entry point is
2095  the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including
2096  both device drivers and bus drivers.
2097 
2098  @param[in] ImageHandle The firmware allocated handle for the UEFI image.
2099  @param[in] SystemTable A pointer to the EFI System Table.
2100 
2101  @retval EFI_SUCCESS The operation completed successfully.
2102  @retval Others An unexpected error occurred.
2103 **/
2104 typedef
2105 EFI_STATUS
2107  IN EFI_HANDLE ImageHandle,
2108  IN EFI_SYSTEM_TABLE *SystemTable
2109  );
2110 
2111 //
2112 // EFI Load Option. This data structure describes format of UEFI boot option variables.
2113 //
2114 // NOTE: EFI Load Option is a byte packed buffer of variable length fields.
2115 // The first two fields have fixed length. They are declared as members of the
2116 // EFI_LOAD_OPTION structure. All the other fields are variable length fields.
2117 // They are listed in the comment block below for reference purposes.
2118 //
2119 #pragma pack(1)
2120 typedef struct _EFI_LOAD_OPTION {
2121  ///
2122  /// The attributes for this load option entry. All unused bits must be zero
2123  /// and are reserved by the UEFI specification for future growth.
2124  ///
2126  ///
2127  /// Length in bytes of the FilePathList. OptionalData starts at offset
2128  /// sizeof(UINT32) + sizeof(UINT16) + StrSize(Description) + FilePathListLength
2129  /// of the EFI_LOAD_OPTION descriptor.
2130  ///
2132  ///
2133  /// The user readable description for the load option.
2134  /// This field ends with a Null character.
2135  ///
2136  // CHAR16 Description[];
2137  ///
2138  /// A packed array of UEFI device paths. The first element of the array is a
2139  /// device path that describes the device and location of the Image for this
2140  /// load option. The FilePathList[0] is specific to the device type. Other
2141  /// device paths may optionally exist in the FilePathList, but their usage is
2142  /// OSV specific. Each element in the array is variable length, and ends at
2143  /// the device path end structure. Because the size of Description is
2144  /// arbitrary, this data structure is not guaranteed to be aligned on a
2145  /// natural boundary. This data structure may have to be copied to an aligned
2146  /// natural boundary before it is used.
2147  ///
2148  // EFI_DEVICE_PATH_PROTOCOL FilePathList[];
2149  ///
2150  /// The remaining bytes in the load option descriptor are a binary data buffer
2151  /// that is passed to the loaded image. If the field is zero bytes long, a
2152  /// NULL pointer is passed to the loaded image. The number of bytes in
2153  /// OptionalData can be computed by subtracting the starting offset of
2154  /// OptionalData from total size in bytes of the EFI_LOAD_OPTION.
2155  ///
2156  // UINT8 OptionalData[];
2157 } EFI_LOAD_OPTION;
2158 #pragma pack()
2159 
2160 //
2161 // EFI Load Options Attributes
2162 //
2163 #define LOAD_OPTION_ACTIVE 0x00000001
2164 #define LOAD_OPTION_FORCE_RECONNECT 0x00000002
2165 #define LOAD_OPTION_HIDDEN 0x00000008
2166 #define LOAD_OPTION_CATEGORY 0x00001F00
2167 
2168 #define LOAD_OPTION_CATEGORY_BOOT 0x00000000
2169 #define LOAD_OPTION_CATEGORY_APP 0x00000100
2170 
2171 #define EFI_BOOT_OPTION_SUPPORT_KEY 0x00000001
2172 #define EFI_BOOT_OPTION_SUPPORT_APP 0x00000002
2173 #define EFI_BOOT_OPTION_SUPPORT_SYSPREP 0x00000010
2174 #define EFI_BOOT_OPTION_SUPPORT_COUNT 0x00000300
2175 
2176 ///
2177 /// EFI Boot Key Data
2178 ///
2179 typedef union {
2180  struct {
2181  ///
2182  /// Indicates the revision of the EFI_KEY_OPTION structure. This revision level should be 0.
2183  ///
2185  ///
2186  /// Either the left or right Shift keys must be pressed (1) or must not be pressed (0).
2187  ///
2189  ///
2190  /// Either the left or right Control keys must be pressed (1) or must not be pressed (0).
2191  ///
2193  ///
2194  /// Either the left or right Alt keys must be pressed (1) or must not be pressed (0).
2195  ///
2197  ///
2198  /// Either the left or right Logo keys must be pressed (1) or must not be pressed (0).
2199  ///
2201  ///
2202  /// The Menu key must be pressed (1) or must not be pressed (0).
2203  ///
2205  ///
2206  /// The SysReq key must be pressed (1) or must not be pressed (0).
2207  ///
2210  ///
2211  /// Specifies the actual number of entries in EFI_KEY_OPTION.Keys, from 0-3. If
2212  /// zero, then only the shift state is considered. If more than one, then the boot option will
2213  /// only be launched if all of the specified keys are pressed with the same shift state.
2214  ///
2216  } Options;
2219 
2220 ///
2221 /// EFI Key Option.
2222 ///
2223 #pragma pack(1)
2224 typedef struct {
2225  ///
2226  /// Specifies options about how the key will be processed.
2227  ///
2229  ///
2230  /// The CRC-32 which should match the CRC-32 of the entire EFI_LOAD_OPTION to
2231  /// which BootOption refers. If the CRC-32s do not match this value, then this key
2232  /// option is ignored.
2233  ///
2235  ///
2236  /// The Boot#### option which will be invoked if this key is pressed and the boot option
2237  /// is active (LOAD_OPTION_ACTIVE is set).
2238  ///
2240  ///
2241  /// The key codes to compare against those returned by the
2242  /// EFI_SIMPLE_TEXT_INPUT and EFI_SIMPLE_TEXT_INPUT_EX protocols.
2243  /// The number of key codes (0-3) is specified by the EFI_KEY_CODE_COUNT field in KeyOptions.
2244  ///
2245  // EFI_INPUT_KEY Keys[];
2246 } EFI_KEY_OPTION;
2247 #pragma pack()
2248 
2249 //
2250 // EFI File location to boot from on removable media devices
2251 //
2252 #define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32 L"\\EFI\\BOOT\\BOOTIA32.EFI"
2253 #define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64 L"\\EFI\\BOOT\\BOOTIA64.EFI"
2254 #define EFI_REMOVABLE_MEDIA_FILE_NAME_X64 L"\\EFI\\BOOT\\BOOTX64.EFI"
2255 #define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM L"\\EFI\\BOOT\\BOOTARM.EFI"
2256 #define EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64 L"\\EFI\\BOOT\\BOOTAA64.EFI"
2257 #define EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64 L"\\EFI\\BOOT\\BOOTRISCV64.EFI"
2258 #define EFI_REMOVABLE_MEDIA_FILE_NAME_LOONGARCH64 L"\\EFI\\BOOT\\BOOTLOONGARCH64.EFI"
2259 
2260 #if !defined (EFI_REMOVABLE_MEDIA_FILE_NAME)
2261  #if defined (MDE_CPU_IA32)
2262 #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_IA32
2263  #elif defined (MDE_CPU_X64)
2264 #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_X64
2265  #elif defined (MDE_CPU_EBC)
2266  #elif defined (MDE_CPU_ARM)
2267 #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_ARM
2268  #elif defined (MDE_CPU_AARCH64)
2269 #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64
2270  #elif defined (MDE_CPU_RISCV64)
2271 #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64
2272  #elif defined (MDE_CPU_LOONGARCH64)
2273 #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_LOONGARCH64
2274  #else
2275  #error Unknown Processor Type
2276  #endif
2277 #endif
2278 
2279 //
2280 // The directory within the active EFI System Partition defined for delivery of capsule to firmware
2281 //
2282 #define EFI_CAPSULE_FILE_DIRECTORY L"\\EFI\\UpdateCapsule\\"
2283 
2284 #include <ipxe/efi/Uefi/UefiPxe.h>
2285 #include <ipxe/efi/Uefi/UefiGpt.h>
2287 
2288 #endif
#define OPTIONAL
Passing the datum to the function is optional, and a NULL is passed if the value is not supplied.
Definition: Base.h:292
EFI_QUERY_VARIABLE_INFO QueryVariableInfo
Definition: UefiSpec.h:1908
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
EFI_STATUS(EFIAPI * EFI_GET_MEMORY_MAP)(IN OUT UINTN *MemoryMapSize, OUT EFI_MEMORY_DESCRIPTOR *MemoryMap, OUT UINTN *MapKey, OUT UINTN *DescriptorSize, OUT UINT32 *DescriptorVersion)
Returns the current memory map.
Definition: UefiSpec.h:258
EFI_SET_TIME SetTime
Definition: UefiSpec.h:1876
EFI_SET_WATCHDOG_TIMER SetWatchdogTimer
Definition: UefiSpec.h:1975
UINT32 InputKeyCount
Specifies the actual number of entries in EFI_KEY_OPTION.Keys, from 0-3.
Definition: UefiSpec.h:2215
EFI_STATUS(EFIAPI * EFI_ALLOCATE_PAGES)(IN EFI_ALLOCATE_TYPE Type, IN EFI_MEMORY_TYPE MemoryType, IN UINTN Pages, IN OUT EFI_PHYSICAL_ADDRESS *Memory)
Allocates memory pages from the system.
Definition: UefiSpec.h:205
EFI_TABLE_HEADER Hdr
The table header for the EFI Runtime Services Table.
Definition: UefiSpec.h:1870
EFI_GET_WAKEUP_TIME GetWakeupTime
Definition: UefiSpec.h:1877
EFI Oprn Protocol Information Entry.
Definition: UefiSpec.h:1421
UINT16 FilePathListLength
Length in bytes of the FilePathList.
Definition: UefiSpec.h:2131
EFI_STATUS(EFIAPI * EFI_INSTALL_PROTOCOL_INTERFACE)(IN OUT EFI_HANDLE *Handle, IN EFI_GUID *Protocol, IN EFI_INTERFACE_TYPE InterfaceType, IN VOID *Interface)
Installs a protocol interface on a device handle.
Definition: UefiSpec.h:1220
UINT32 Flags
Bit-mapped list describing the capsule attributes.
Definition: UefiSpec.h:1696
EFI_RAISE_TPL RaiseTPL
Definition: UefiSpec.h:1926
An event is to be signaled periodically at a specified interval from the current time.
Definition: UefiSpec.h:537
UINT32 ShiftPressed
Either the left or right Shift keys must be pressed (1) or must not be pressed (0).
Definition: UefiSpec.h:2188
EFI_HANDLE ControllerHandle
Definition: UefiSpec.h:1423
The device path protocol as defined in UEFI 2.0.
EFI_STATUS(EFIAPI * EFI_GET_NEXT_HIGH_MONO_COUNT)(OUT UINT32 *HighCount)
Returns the next high 32 bits of the platform's monotonic counter.
Definition: UefiSpec.h:1129
EFI_TPL(EFIAPI * EFI_RAISE_TPL)(IN EFI_TPL NewTpl)
Raises a task's priority level and returns its previous level.
Definition: UefiSpec.h:652
UINT32 ControlPressed
Either the left or right Control keys must be pressed (1) or must not be pressed (0).
Definition: UefiSpec.h:2192
UINT32 PackedValue
Definition: UefiSpec.h:2217
EFI_HANDLE AgentHandle
Definition: UefiSpec.h:1422
UINT8 Type
Definition: Acpi10.h:136
EFI_STATUS(EFIAPI * EFI_GET_WAKEUP_TIME)(OUT BOOLEAN *Enabled, OUT BOOLEAN *Pending, OUT EFI_TIME *Time)
Returns the current wakeup alarm clock setting.
Definition: UefiSpec.h:881
CHAR16 * FirmwareVendor
A pointer to a null terminated string that identifies the vendor that produces the system firmware fo...
Definition: UefiSpec.h:2039
EFI_LOCATE_PROTOCOL LocateProtocol
Definition: UefiSpec.h:1995
EFI_STALL Stall
Definition: UefiSpec.h:1974
EFI_STATUS(EFIAPI * EFI_SET_TIME)(IN EFI_TIME *Time)
Sets the current local time and date information.
Definition: UefiSpec.h:858
An event is to be signaled once at a specified interval from the current time.
Definition: UefiSpec.h:541
EFI_CONVERT_POINTER ConvertPointer
Definition: UefiSpec.h:1884
Definition of an EFI memory descriptor.
Definition: UefiSpec.h:145
EFI_QUERY_CAPSULE_CAPABILITIES QueryCapsuleCapabilities
Definition: UefiSpec.h:1903
EFI_STATUS(EFIAPI * EFI_LOCATE_DEVICE_PATH)(IN EFI_GUID *Protocol, IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath, OUT EFI_HANDLE *Device)
Locates the handle to a device on the device path that supports the specified protocol.
Definition: UefiSpec.h:1573
EFI_STATUS(EFIAPI * EFI_WAIT_FOR_EVENT)(IN UINTN NumberOfEvents, IN EFI_EVENT *Event, OUT UINTN *Index)
Stops execution until an event is signaled.
Definition: UefiSpec.h:598
128 bit buffer containing a unique identifier value.
Definition: Base.h:215
UINT32 FirmwareRevision
A firmware vendor specific value that identifies the revision of the system firmware for the platform...
Definition: UefiSpec.h:2044
struct _EFI_LOAD_OPTION EFI_LOAD_OPTION
Retrieve all the handles in the handle database.
Definition: UefiSpec.h:1511
The EFI_SIMPLE_TEXT_INPUT_PROTOCOL is used on the ConsoleIn device.
Definition: SimpleTextIn.h:118
EFI_STATUS(EFIAPI * EFI_OPEN_PROTOCOL_INFORMATION)(IN EFI_HANDLE Handle, IN EFI_GUID *Protocol, OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer, OUT UINTN *EntryCount)
Retrieves the list of agents that currently have a protocol interface opened.
Definition: UefiSpec.h:1445
UINT32 CapsuleArrayNumber
the size of the array of capsules.
Definition: UefiSpec.h:1712
EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface
Definition: UefiSpec.h:1952
EFI_EXIT_BOOT_SERVICES ExitBootServices
Definition: UefiSpec.h:1968
EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface
Definition: UefiSpec.h:1953
EFI_RESET_TYPE
Enumeration of reset types.
VOID * EFI_EVENT
Handle to an event structure.
Definition: UefiBaseType.h:39
EFI_GUID VendorGuid
The 128-bit GUID value that uniquely identifies the system configuration table.
Definition: UefiSpec.h:2020
EFI_IMAGE_LOAD LoadImage
Definition: UefiSpec.h:1964
unsigned char BOOLEAN
EFI Boot Key Data.
Definition: UefiSpec.h:2179
EFI_STATUS(EFIAPI * EFI_FREE_PAGES)(IN EFI_PHYSICAL_ADDRESS Memory, IN UINTN Pages)
Frees memory pages.
Definition: UefiSpec.h:226
UINT32 Attributes
The attributes for this load option entry.
Definition: UefiSpec.h:2125
EFI_STATUS(EFIAPI * EFI_SIGNAL_EVENT)(IN EFI_EVENT Event)
Signals an event.
Definition: UefiSpec.h:578
EFI_GET_NEXT_HIGH_MONO_COUNT GetNextHighMonotonicCount
Definition: UefiSpec.h:1896
EFI_HANDLE ConsoleInHandle
The handle for the active console input device.
Definition: UefiSpec.h:2049
EFI_STATUS(EFIAPI * EFI_STALL)(IN UINTN Microseconds)
Induces a fine-grained stall.
Definition: UefiSpec.h:1045
EFI_STATUS(EFIAPI * EFI_DISCONNECT_CONTROLLER)(IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE DriverImageHandle OPTIONAL, IN EFI_HANDLE ChildHandle OPTIONAL)
Disconnects one or more drivers from a controller.
Definition: UefiSpec.h:399
FILE_LICENCE(BSD2_PATENT)
EFI_STATUS(EFIAPI * EFI_CALCULATE_CRC32)(IN VOID *Data, IN UINTN DataSize, OUT UINT32 *Crc32)
Computes and returns a 32-bit CRC for a data buffer.
Definition: UefiSpec.h:1150
Retrieve the next handle fron a RegisterProtocolNotify() event.
Definition: UefiSpec.h:1515
EFI_SET_MEM SetMem
Definition: UefiSpec.h:2008
unsigned int UINT32
Definition: ProcessorBind.h:98
UINT8 Length
Definition: Acpi10.h:134
EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces
Definition: UefiSpec.h:1996
This header file contains all of the PXE type definitions, structure prototypes, global variables and...
VOID(EFIAPI * EFI_RESTORE_TPL)(IN EFI_TPL OldTpl)
Restores a task's priority level to its previous value.
Definition: UefiSpec.h:664
UINT16_t BufferSize
Buffer size.
Definition: pxe_api.h:64
EFI_STATUS(EFIAPI * EFI_SET_TIMER)(IN EFI_EVENT Event, IN EFI_TIMER_DELAY Type, IN UINT64 TriggerTime)
Sets the type of timer and the trigger time for a timer event.
Definition: UefiSpec.h:562
unsigned short CHAR16
EFI_CLOSE_EVENT CloseEvent
Definition: UefiSpec.h:1945
EFI_TABLE_HEADER Hdr
The table header for the EFI Boot Services Table.
Definition: UefiSpec.h:1921
EFI_SET_TIMER SetTimer
Definition: UefiSpec.h:1942
EFI_STATUS(EFIAPI * EFI_CLOSE_PROTOCOL)(IN EFI_HANDLE Handle, IN EFI_GUID *Protocol, IN EFI_HANDLE AgentHandle, IN EFI_HANDLE ControllerHandle)
Closes a protocol on a handle that was opened using OpenProtocol().
Definition: UefiSpec.h:1411
EFI_LOCATE_HANDLE LocateHandle
Definition: UefiSpec.h:1957
EFI_IMAGE_UNLOAD UnloadImage
Definition: UefiSpec.h:1967
EFI_BOOT_KEY_DATA KeyData
Specifies options about how the key will be processed.
Definition: UefiSpec.h:2228
This protocol can be used on any device handle to obtain generic path/location information concerning...
Definition: DevicePath.h:45
EFI_STATUS(EFIAPI * EFI_LOCATE_HANDLE)(IN EFI_LOCATE_SEARCH_TYPE SearchType, IN EFI_GUID *Protocol OPTIONAL, IN VOID *SearchKey OPTIONAL, IN OUT UINTN *BufferSize, OUT EFI_HANDLE *Buffer)
Returns an array of handles that support a specified protocol.
Definition: UefiSpec.h:1547
VOID(EFIAPI * EFI_EVENT_NOTIFY)(IN EFI_EVENT Event, IN VOID *Context)
Invoke a notification event.
Definition: UefiSpec.h:465
EFI_STATUS(EFIAPI * EFI_GET_NEXT_VARIABLE_NAME)(IN OUT UINTN *VariableNameSize, IN OUT CHAR16 *VariableName, IN OUT EFI_GUID *VendorGuid)
Enumerates the current variable names.
Definition: UefiSpec.h:738
EFI_STATUS(EFIAPI * EFI_IMAGE_LOAD)(IN BOOLEAN BootPolicy, IN EFI_HANDLE ParentImageHandle, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath OPTIONAL, IN VOID *SourceBuffer OPTIONAL, IN UINTN SourceSize, OUT EFI_HANDLE *ImageHandle)
Loads an EFI image into memory.
Definition: UefiSpec.h:942
EFI_CLOSE_PROTOCOL CloseProtocol
Definition: UefiSpec.h:1987
EFI_STATUS(EFIAPI * EFI_GET_TIME)(OUT EFI_TIME *Time, OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL)
Returns the current time and date information, and the time-keeping capabilities of the hardware plat...
Definition: UefiSpec.h:838
EFI_CREATE_EVENT_EX CreateEventEx
Definition: UefiSpec.h:2009
unsigned char UINT8
UINT64 EFI_PHYSICAL_ADDRESS
64-bit physical memory address.
Definition: UefiBaseType.h:52
EFI_STATUS(EFIAPI * EFI_REINSTALL_PROTOCOL_INTERFACE)(IN EFI_HANDLE Handle, IN EFI_GUID *Protocol, IN VOID *OldInterface, IN VOID *NewInterface)
Reinstalls a protocol interface on a device handle.
Definition: UefiSpec.h:1270
EFI_STATUS(EFIAPI * EFI_UNINSTALL_PROTOCOL_INTERFACE)(IN EFI_HANDLE Handle, IN EFI_GUID *Protocol, IN VOID *Interface)
Removes a protocol interface from a device handle.
Definition: UefiSpec.h:1296
The SIMPLE_TEXT_OUTPUT protocol is used to control text-based output devices.
UINT64 NumberOfPages
NumberOfPagesNumber of 4 KiB pages in the memory region.
Definition: UefiSpec.h:170
EFI_PHYSICAL_ADDRESS DataBlock
Physical address of the data block.
Definition: UefiSpec.h:1666
UINT16_t Size
Size of structure.
Definition: pxe_api.h:58
EFI_TABLE_HEADER Hdr
The table header for the EFI System Table.
Definition: UefiSpec.h:2034
EFI_STATUS(EFIAPI * EFI_EXIT)(IN EFI_HANDLE ImageHandle, IN EFI_STATUS ExitStatus, IN UINTN ExitDataSize, IN CHAR16 *ExitData OPTIONAL)
Terminates a loaded EFI image and returns control to boot services.
Definition: UefiSpec.h:995
EFI_STATUS(EFIAPI * EFI_CREATE_EVENT)(IN UINT32 Type, IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL, IN VOID *NotifyContext OPTIONAL, OUT EFI_EVENT *Event)
Creates an event.
Definition: UefiSpec.h:488
UINT32 HeaderSize
The size of the capsule header.
Definition: UefiSpec.h:1690
UINT32 CapsuleImageSize
Size in bytes of the capsule (including capsule header).
Definition: UefiSpec.h:1700
An event's timer settings is to be cancelled and not trigger time is to be set/.
Definition: UefiSpec.h:533
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL * ConOut
A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface that is associated with ConsoleOutHandle.
Definition: UefiSpec.h:2063
VOID(EFIAPI * EFI_SET_MEM)(IN VOID *Buffer, IN UINTN Size, IN UINT8 Value)
The SetMem() function fills a buffer with a specified value.
Definition: UefiSpec.h:1182
#define OUT
Definition: mlx_utils.h:29
EFI_STATUS(EFIAPI * EFI_OPEN_PROTOCOL)(IN EFI_HANDLE Handle, IN EFI_GUID *Protocol, OUT VOID **Interface OPTIONAL, IN EFI_HANDLE AgentHandle, IN EFI_HANDLE ControllerHandle, IN UINT32 Attributes)
Queries a handle to determine if it supports a specified protocol.
Definition: UefiSpec.h:1379
EFI_STATUS(EFIAPI * EFI_SET_WAKEUP_TIME)(IN BOOLEAN Enable, IN EFI_TIME *Time OPTIONAL)
Sets the system wakeup alarm clock time.
Definition: UefiSpec.h:905
EFI_MEMORY_TYPE
Enumeration of memory types introduced in UEFI.
EFI_STATUS(EFIAPI * EFI_QUERY_VARIABLE_INFO)(IN UINT32 Attributes, OUT UINT64 *MaximumVariableStorageSize, OUT UINT64 *RemainingVariableStorageSize, OUT UINT64 *MaximumVariableSize)
Returns information about the EFI variables.
Definition: UefiSpec.h:1823
EFI_SET_VARIABLE SetVariable
Definition: UefiSpec.h:1891
UINT32 OpenCount
Definition: UefiSpec.h:1425
Allocate pages at a specified address.
Definition: UefiSpec.h:44
EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface
Definition: UefiSpec.h:1951
UINT32 Attributes
Definition: UefiSpec.h:1424
EFI_CREATE_EVENT CreateEvent
Definition: UefiSpec.h:1941
EFI_SIMPLE_TEXT_INPUT_PROTOCOL * ConIn
A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL interface that is associated with ConsoleInHandle.
Definition: UefiSpec.h:2054
EFI_HANDLE_PROTOCOL HandleProtocol
Definition: UefiSpec.h:1954
EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify
Definition: UefiSpec.h:1956
EFI_COPY_MEM CopyMem
Definition: UefiSpec.h:2007
EFI_STATUS(EFIAPI * EFI_LOCATE_PROTOCOL)(IN EFI_GUID *Protocol, IN VOID *Registration OPTIONAL, OUT VOID **Interface)
Returns the first protocol instance that matches the given protocol.
Definition: UefiSpec.h:1647
EFI_STATUS(EFIAPI * EFI_IMAGE_ENTRY_POINT)(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
This is the declaration of an EFI image entry point.
Definition: UefiSpec.h:2106
EFI_GET_VARIABLE GetVariable
Definition: UefiSpec.h:1889
UINT32 Resolution
Provides the reporting resolution of the real-time clock device in counts per second.
Definition: UefiSpec.h:802
BOOLEAN SetsToZero
A TRUE indicates that a time set operation clears the device's time below the Resolution reporting le...
Definition: UefiSpec.h:817
EFI_GUID CapsuleGuid
A GUID that defines the contents of a capsule.
Definition: UefiSpec.h:1684
Maximum enumeration value that may be used for bounds checking.
Definition: UefiSpec.h:48
unsigned short UINT16
EFI Guid Partition Table Format Definition.
This file defines the encoding for the VFR (Visual Form Representation) language.
EFI_SIGNAL_EVENT SignalEvent
Definition: UefiSpec.h:1944
EFI_PHYSICAL_ADDRESS PhysicalStart
Physical address of the first byte in the memory region.
Definition: UefiSpec.h:157
EFI_HANDLE StandardErrorHandle
The handle for the active standard error console device.
Definition: UefiSpec.h:2068
EFI Runtime Services Table.
Definition: UefiSpec.h:1866
VOID(EFIAPI * EFI_COPY_MEM)(IN VOID *Destination, IN VOID *Source, IN UINTN Length)
Copies the contents of one buffer to another buffer.
Definition: UefiSpec.h:1166
EFI_RESET_SYSTEM ResetSystem
Definition: UefiSpec.h:1897
Allocate any available range of pages whose uppermost address is less than or equal to a specified ma...
Definition: UefiSpec.h:40
EFI_STATUS(EFIAPI * EFI_IMAGE_UNLOAD)(IN EFI_HANDLE ImageHandle)
Unloads an image.
Definition: UefiSpec.h:1013
#define EFIAPI
EFI Boot Services Table.
Definition: UefiSpec.h:1917
EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount
Definition: UefiSpec.h:1973
Simple Text Input Ex protocol from the UEFI 2.0 specification.
EFI_STATUS(EFIAPI * EFI_LOCATE_HANDLE_BUFFER)(IN EFI_LOCATE_SEARCH_TYPE SearchType, IN EFI_GUID *Protocol OPTIONAL, IN VOID *SearchKey OPTIONAL, OUT UINTN *NoHandles, OUT EFI_HANDLE **Buffer)
Returns an array of handles that support the requested protocol in a buffer allocated from pool.
Definition: UefiSpec.h:1620
Indicates that the supplied protocol interface is supplied in native form.
Definition: UefiSpec.h:1195
UINT8_t Protocol
Protocol.
Definition: pxe_api.h:64
EFI_STATUS(EFIAPI * EFI_SET_WATCHDOG_TIMER)(IN UINTN Timeout, IN UINT64 WatchdogCode, IN UINTN DataSize, IN CHAR16 *WatchdogData OPTIONAL)
Sets the system's watchdog timer.
Definition: UefiSpec.h:1067
SEGOFF16_t Buffer
Buffer address.
Definition: pxe_api.h:65
This includes some definitions introduced in UEFI that will be used in both PEI and DXE phases.
Simple Text Out protocol from the UEFI 2.0 specification.
EFI_STATUS(EFIAPI * EFI_HANDLE_PROTOCOL)(IN EFI_HANDLE Handle, IN EFI_GUID *Protocol, OUT VOID **Interface)
Queries a handle to determine if it supports a specified protocol.
Definition: UefiSpec.h:1337
EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces
Definition: UefiSpec.h:1997
EFI_CONNECT_CONTROLLER ConnectController
Definition: UefiSpec.h:1980
EFI_GET_TIME GetTime
Definition: UefiSpec.h:1875
UINT32 Revision
Indicates the revision of the EFI_KEY_OPTION structure.
Definition: UefiSpec.h:2184
EFI_STATUS(EFIAPI * EFI_REGISTER_PROTOCOL_NOTIFY)(IN EFI_GUID *Protocol, IN EFI_EVENT Event, OUT VOID **Registration)
Creates an event that is to be signaled whenever an interface is installed for a specified protocol.
Definition: UefiSpec.h:1498
EFI_IMAGE_START StartImage
Definition: UefiSpec.h:1965
EFI_STATUS(EFIAPI * EFI_UPDATE_CAPSULE)(IN EFI_CAPSULE_HEADER **CapsuleHeaderArray, IN UINTN CapsuleCount, IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL)
Passes capsules to the firmware with both virtual and physical mapping.
Definition: UefiSpec.h:1758
UINT64 UINTN
Unsigned value of native width.
EFI System Table.
Definition: UefiSpec.h:2030
EFI_STATUS(EFIAPI * EFI_FREE_POOL)(IN VOID *Buffer)
Returns pool memory to the system.
Definition: UefiSpec.h:304
EFI_VIRTUAL_ADDRESS VirtualStart
Virtual address of the first byte in the memory region.
Definition: UefiSpec.h:163
UINT32 Type
Type of the memory region.
Definition: UefiSpec.h:151
unsigned long Address
Definition: etherboot.h:21
#define VOID
Undeclared type.
Definition: Base.h:271
EFI_HANDLE ConsoleOutHandle
The handle for the active console output device.
Definition: UefiSpec.h:2058
unsigned long long UINT64
Definition: ProcessorBind.h:96
EFI_WAIT_FOR_EVENT WaitForEvent
Definition: UefiSpec.h:1943
EFI_FREE_POOL FreePool
Definition: UefiSpec.h:1936
EFI_HANDLE ControllerHandle
Definition: efi_bofm.c:109
EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation
Definition: UefiSpec.h:1988
EFI Capsule Header.
Definition: UefiSpec.h:1680
EFI Time Abstraction: Year: 1900 - 9999 Month: 1 - 12 Day: 1 - 31 Hour: 0 - 23 Minute: 0 - 59 Second:...
Definition: UefiBaseType.h:70
EFI_STATUS(EFIAPI * EFI_CLOSE_EVENT)(IN EFI_EVENT Event)
Closes an event.
Definition: UefiSpec.h:614
#define IN
Definition: mlx_utils.h:28
EFI Key Option.
Definition: UefiSpec.h:2224
EFI_ALLOCATE_TYPE
Enumeration of EFI memory allocation types.
Definition: UefiSpec.h:31
Simple Text Input protocol from the UEFI 2.0 specification.
EFI_GET_MEMORY_MAP GetMemoryMap
Definition: UefiSpec.h:1934
EFI_ALLOCATE_PAGES AllocatePages
Definition: UefiSpec.h:1932
EFI_STATUS(EFIAPI * EFI_IMAGE_START)(IN EFI_HANDLE ImageHandle, OUT UINTN *ExitDataSize, OUT CHAR16 **ExitData OPTIONAL)
Transfers control to a loaded image's entry point.
Definition: UefiSpec.h:967
EFI_SET_WAKEUP_TIME SetWakeupTime
Definition: UefiSpec.h:1878
EFI_RUNTIME_SERVICES * RuntimeServices
A pointer to the EFI Runtime Services Table.
Definition: UefiSpec.h:2077
UINTN EFI_TPL
Task priority level.
Definition: UefiBaseType.h:43
EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle
Definition: UefiSpec.h:1993
EFI_STATUS(EFIAPI * EFI_SET_VIRTUAL_ADDRESS_MAP)(IN UINTN MemoryMapSize, IN UINTN DescriptorSize, IN UINT32 DescriptorVersion, IN EFI_MEMORY_DESCRIPTOR *VirtualMap)
Changes the runtime addressing mode of EFI firmware from physical to virtual.
Definition: UefiSpec.h:332
#define CONST
Datum is read-only.
Definition: Base.h:261
EFI_STATUS(EFIAPI * EFI_CHECK_EVENT)(IN EFI_EVENT Event)
Checks whether an event is in the signaled state.
Definition: UefiSpec.h:630
EFI_STATUS(EFIAPI * EFI_QUERY_CAPSULE_CAPABILITIES)(IN EFI_CAPSULE_HEADER **CapsuleHeaderArray, IN UINTN CapsuleCount, OUT UINT64 *MaximumCapsuleSize, OUT EFI_RESET_TYPE *ResetType)
Returns if the capsule can be supported via UpdateCapsule().
Definition: UefiSpec.h:1792
EFI_STATUS(EFIAPI * EFI_ALLOCATE_POOL)(IN EFI_MEMORY_TYPE PoolType, IN UINTN Size, OUT VOID **Buffer)
Allocates pool memory.
Definition: UefiSpec.h:287
UINT32 BootOptionCrc
The CRC-32 which should match the CRC-32 of the entire EFI_LOAD_OPTION to which BootOption refers.
Definition: UefiSpec.h:2234
EFI_TIMER_DELAY
Timer delay types.
Definition: UefiSpec.h:529
EFI Capsule Block Descriptor.
Definition: UefiSpec.h:1656
EFI_CHECK_EVENT CheckEvent
Definition: UefiSpec.h:1946
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
EFI_GET_NEXT_VARIABLE_NAME GetNextVariableName
Definition: UefiSpec.h:1890
UINT64 Length
Length in bytes of the data pointed to by DataBlock/ContinuationPointer.
Definition: UefiSpec.h:1660
The EFI System Table entry must point to an array of capsules that contain the same CapsuleGuid value...
Definition: UefiSpec.h:1708
UINTN NumberOfTableEntries
The number of system configuration tables in the buffer ConfigurationTable.
Definition: UefiSpec.h:2085
Allocate any available range of pages that satisfies the request.
Definition: UefiSpec.h:35
Contains a set of GUID/pointer pairs comprised of the ConfigurationTable field in the EFI System Tabl...
Definition: UefiSpec.h:2016
EFI_STATUS(EFIAPI * EFI_INSTALL_CONFIGURATION_TABLE)(IN EFI_GUID *Guid, IN VOID *Table)
Adds, updates, or removes a configuration table entry from the EFI System Table.
Definition: UefiSpec.h:1594
Data structure that precedes all of the standard EFI table types.
Retrieve the set of handles from the handle database that support a specified protocol.
Definition: UefiSpec.h:1520
UINT16 BootOption
The Boot#### option which will be invoked if this key is pressed and the boot option is active (LOAD_...
Definition: UefiSpec.h:2239
EFI_OPEN_PROTOCOL OpenProtocol
Definition: UefiSpec.h:1986
EFI_PHYSICAL_ADDRESS ContinuationPointer
Physical address of another block of EFI_CAPSULE_BLOCK_DESCRIPTOR structures.
Definition: UefiSpec.h:1673
UINT64 Attribute
Attributes of the memory region that describe the bit mask of capabilities for that memory region,...
Definition: UefiSpec.h:176
EFI_LOCATE_SEARCH_TYPE
Enumeration of EFI Locate Search Types.
Definition: UefiSpec.h:1507
EFI_INTERFACE_TYPE
Enumeration of EFI Interface Types.
Definition: UefiSpec.h:1191
EFI_STATUS(EFIAPI * EFI_EXIT_BOOT_SERVICES)(IN EFI_HANDLE ImageHandle, IN UINTN MapKey)
Terminates all boot services.
Definition: UefiSpec.h:1029
EFI_UPDATE_CAPSULE UpdateCapsule
Definition: UefiSpec.h:1902
EFI_RESTORE_TPL RestoreTPL
Definition: UefiSpec.h:1927
EFI_STATUS(EFIAPI * EFI_GET_VARIABLE)(IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, OUT UINT32 *Attributes OPTIONAL, IN OUT UINTN *DataSize, OUT VOID *Data OPTIONAL)
Returns the value of a variable.
Definition: UefiSpec.h:698
EFI_STATUS(EFIAPI * EFI_CONVERT_POINTER)(IN UINTN DebugDisposition, IN OUT VOID **Address)
Determines the new virtual address that is to be used on subsequent memory accesses.
Definition: UefiSpec.h:430
UINT32 SysReqPressed
The SysReq key must be pressed (1) or must not be pressed (0).
Definition: UefiSpec.h:2208
UINT32 MenuPressed
The Menu key must be pressed (1) or must not be pressed (0).
Definition: UefiSpec.h:2204
EFI_SET_VIRTUAL_ADDRESS_MAP SetVirtualAddressMap
Definition: UefiSpec.h:1883
EFI_FREE_PAGES FreePages
Definition: UefiSpec.h:1933
EFI_STATUS(EFIAPI * EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES)(IN OUT EFI_HANDLE *Handle,...)
Installs one or more protocol interfaces into the boot services environment.
Definition: UefiSpec.h:1245
UINT32 AltPressed
Either the left or right Alt keys must be pressed (1) or must not be pressed (0).
Definition: UefiSpec.h:2196
VOID(EFIAPI * EFI_RESET_SYSTEM)(IN EFI_RESET_TYPE ResetType, IN EFI_STATUS ResetStatus, IN UINTN DataSize, IN VOID *ResetData OPTIONAL)
Resets the entire platform.
Definition: UefiSpec.h:1091
EFI_CALCULATE_CRC32 CalculateCrc32
Definition: UefiSpec.h:2002
UINT32 LogoPressed
Either the left or right Logo keys must be pressed (1) or must not be pressed (0).
Definition: UefiSpec.h:2200
EFI_STATUS(EFIAPI * EFI_PROTOCOLS_PER_HANDLE)(IN EFI_HANDLE Handle, OUT EFI_GUID ***ProtocolBuffer, OUT UINTN *ProtocolBufferCount)
Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated f...
Definition: UefiSpec.h:1475
UINT32 Accuracy
Provides the timekeeping accuracy of the real-time clock in an error rate of 1E-6 parts per million.
Definition: UefiSpec.h:809
EFI_STATUS(EFIAPI * EFI_CONNECT_CONTROLLER)(IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE *DriverImageHandle OPTIONAL, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL, IN BOOLEAN Recursive)
Connects one or more drivers to a controller.
Definition: UefiSpec.h:366
EFI_STATUS(EFIAPI * EFI_SET_VARIABLE)(IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, IN UINT32 Attributes, IN UINTN DataSize, IN VOID *Data)
Sets the value of a variable.
Definition: UefiSpec.h:783
EFI_STATUS(EFIAPI * EFI_CREATE_EVENT_EX)(IN UINT32 Type, IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL, IN CONST VOID *NotifyContext OPTIONAL, IN CONST EFI_GUID *EventGroup OPTIONAL, OUT EFI_EVENT *Event)
Creates an event in a group.
Definition: UefiSpec.h:517
UINT64 EFI_VIRTUAL_ADDRESS
64-bit virtual memory address.
Definition: UefiBaseType.h:57
Definition: efi.h:59
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL * StdErr
A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface that is associated with StandardErrorHandl...
Definition: UefiSpec.h:2073
EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer
Definition: UefiSpec.h:1994
EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable
Definition: UefiSpec.h:1959
EFI_LOCATE_DEVICE_PATH LocateDevicePath
Definition: UefiSpec.h:1958
EFI_ALLOCATE_POOL AllocatePool
Definition: UefiSpec.h:1935
EFI_STATUS(EFIAPI * EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES)(IN EFI_HANDLE Handle,...)
Removes one or more protocol interfaces into the boot services environment.
Definition: UefiSpec.h:1315
EFI_CONFIGURATION_TABLE * ConfigurationTable
A pointer to the system configuration tables.
Definition: UefiSpec.h:2090
EFI_STATUS(EFIAPI * EFI_GET_NEXT_MONOTONIC_COUNT)(OUT UINT64 *Count)
Returns a monotonically increasing count for the platform.
Definition: UefiSpec.h:1110
VOID * VendorTable
A pointer to the table associated with VendorGuid.
Definition: UefiSpec.h:2024
This provides the capabilities of the real time clock device as exposed through the EFI interfaces.
Definition: UefiSpec.h:795
EFI_DISCONNECT_CONTROLLER DisconnectController
Definition: UefiSpec.h:1981