xref: /freebsd/sys/contrib/edk2/Include/Uefi/UefiSpec.h (revision 3245fa215aca18d135839a15c80ae1c905666a37)
10d1ba665SWarner Losh /** @file
20d1ba665SWarner Losh   Include file that supports UEFI.
30d1ba665SWarner Losh 
4*3245fa21SMitchell Horne   This include file must contain things defined in the UEFI 2.7 specification.
5*3245fa21SMitchell Horne   If a code construct is defined in the UEFI 2.7 specification it must be included
60d1ba665SWarner Losh   by this include file.
70d1ba665SWarner Losh 
8*3245fa21SMitchell Horne Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
9*3245fa21SMitchell Horne Portions Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
100d1ba665SWarner Losh 
11*3245fa21SMitchell Horne SPDX-License-Identifier: BSD-2-Clause-Patent
120d1ba665SWarner Losh 
130d1ba665SWarner Losh **/
140d1ba665SWarner Losh 
150d1ba665SWarner Losh #ifndef __UEFI_SPEC_H__
160d1ba665SWarner Losh #define __UEFI_SPEC_H__
170d1ba665SWarner Losh 
180d1ba665SWarner Losh #include <Uefi/UefiMultiPhase.h>
190d1ba665SWarner Losh 
200d1ba665SWarner Losh #include <Protocol/DevicePath.h>
210d1ba665SWarner Losh #include <Protocol/SimpleTextIn.h>
220d1ba665SWarner Losh #include <Protocol/SimpleTextInEx.h>
230d1ba665SWarner Losh #include <Protocol/SimpleTextOut.h>
240d1ba665SWarner Losh 
250d1ba665SWarner Losh ///
260d1ba665SWarner Losh /// Enumeration of EFI memory allocation types.
270d1ba665SWarner Losh ///
280d1ba665SWarner Losh typedef enum {
290d1ba665SWarner Losh   ///
300d1ba665SWarner Losh   /// Allocate any available range of pages that satisfies the request.
310d1ba665SWarner Losh   ///
320d1ba665SWarner Losh   AllocateAnyPages,
330d1ba665SWarner Losh   ///
340d1ba665SWarner Losh   /// Allocate any available range of pages whose uppermost address is less than
350d1ba665SWarner Losh   /// or equal to a specified maximum address.
360d1ba665SWarner Losh   ///
370d1ba665SWarner Losh   AllocateMaxAddress,
380d1ba665SWarner Losh   ///
390d1ba665SWarner Losh   /// Allocate pages at a specified address.
400d1ba665SWarner Losh   ///
410d1ba665SWarner Losh   AllocateAddress,
420d1ba665SWarner Losh   ///
430d1ba665SWarner Losh   /// Maximum enumeration value that may be used for bounds checking.
440d1ba665SWarner Losh   ///
450d1ba665SWarner Losh   MaxAllocateType
460d1ba665SWarner Losh } EFI_ALLOCATE_TYPE;
470d1ba665SWarner Losh 
480d1ba665SWarner Losh //
490d1ba665SWarner Losh // Bit definitions for EFI_TIME.Daylight
500d1ba665SWarner Losh //
510d1ba665SWarner Losh #define EFI_TIME_ADJUST_DAYLIGHT  0x01
520d1ba665SWarner Losh #define EFI_TIME_IN_DAYLIGHT      0x02
530d1ba665SWarner Losh 
540d1ba665SWarner Losh ///
550d1ba665SWarner Losh /// Value definition for EFI_TIME.TimeZone.
560d1ba665SWarner Losh ///
570d1ba665SWarner Losh #define EFI_UNSPECIFIED_TIMEZONE  0x07FF
580d1ba665SWarner Losh 
590d1ba665SWarner Losh //
600d1ba665SWarner Losh // Memory cacheability attributes
610d1ba665SWarner Losh //
620d1ba665SWarner Losh #define EFI_MEMORY_UC               0x0000000000000001ULL
630d1ba665SWarner Losh #define EFI_MEMORY_WC               0x0000000000000002ULL
640d1ba665SWarner Losh #define EFI_MEMORY_WT               0x0000000000000004ULL
650d1ba665SWarner Losh #define EFI_MEMORY_WB               0x0000000000000008ULL
660d1ba665SWarner Losh #define EFI_MEMORY_UCE              0x0000000000000010ULL
670d1ba665SWarner Losh //
680d1ba665SWarner Losh // Physical memory protection attributes
690d1ba665SWarner Losh //
700d1ba665SWarner Losh // Note: UEFI spec 2.5 and following: use EFI_MEMORY_RO as write-protected physical memory
710d1ba665SWarner Losh // protection attribute. Also, EFI_MEMORY_WP means cacheability attribute.
720d1ba665SWarner Losh //
730d1ba665SWarner Losh #define EFI_MEMORY_WP               0x0000000000001000ULL
740d1ba665SWarner Losh #define EFI_MEMORY_RP               0x0000000000002000ULL
750d1ba665SWarner Losh #define EFI_MEMORY_XP               0x0000000000004000ULL
760d1ba665SWarner Losh #define EFI_MEMORY_RO               0x0000000000020000ULL
770d1ba665SWarner Losh //
780d1ba665SWarner Losh // Physical memory persistence attribute.
790d1ba665SWarner Losh // The memory region supports byte-addressable non-volatility.
800d1ba665SWarner Losh //
810d1ba665SWarner Losh #define EFI_MEMORY_NV               0x0000000000008000ULL
820d1ba665SWarner Losh //
830d1ba665SWarner Losh // The memory region provides higher reliability relative to other memory in the system.
840d1ba665SWarner Losh // If all memory has the same reliability, then this bit is not used.
850d1ba665SWarner Losh //
860d1ba665SWarner Losh #define EFI_MEMORY_MORE_RELIABLE    0x0000000000010000ULL
87*3245fa21SMitchell Horne 
88*3245fa21SMitchell Horne //
89*3245fa21SMitchell Horne // Note: UEFI spec 2.8 and following:
90*3245fa21SMitchell Horne //
91*3245fa21SMitchell Horne // Specific-purpose memory (SPM). The memory is earmarked for
92*3245fa21SMitchell Horne // specific purposes such as for specific device drivers or applications.
93*3245fa21SMitchell Horne // The SPM attribute serves as a hint to the OS to avoid allocating this
94*3245fa21SMitchell Horne // memory for core OS data or code that can not be relocated.
95*3245fa21SMitchell Horne //
96*3245fa21SMitchell Horne #define EFI_MEMORY_SP               0x0000000000040000ULL
97*3245fa21SMitchell Horne //
98*3245fa21SMitchell Horne // If this flag is set, the memory region is capable of being
99*3245fa21SMitchell Horne // protected with the CPU?s memory cryptographic
100*3245fa21SMitchell Horne // capabilities. If this flag is clear, the memory region is not
101*3245fa21SMitchell Horne // capable of being protected with the CPU?s memory
102*3245fa21SMitchell Horne // cryptographic capabilities or the CPU does not support CPU
103*3245fa21SMitchell Horne // memory cryptographic capabilities.
104*3245fa21SMitchell Horne //
105*3245fa21SMitchell Horne #define EFI_MEMORY_CPU_CRYPTO       0x0000000000080000ULL
106*3245fa21SMitchell Horne 
1070d1ba665SWarner Losh //
1080d1ba665SWarner Losh // Runtime memory attribute
1090d1ba665SWarner Losh //
1100d1ba665SWarner Losh #define EFI_MEMORY_RUNTIME          0x8000000000000000ULL
1110d1ba665SWarner Losh 
1120d1ba665SWarner Losh ///
1130d1ba665SWarner Losh /// Memory descriptor version number.
1140d1ba665SWarner Losh ///
1150d1ba665SWarner Losh #define EFI_MEMORY_DESCRIPTOR_VERSION 1
1160d1ba665SWarner Losh 
1170d1ba665SWarner Losh ///
1180d1ba665SWarner Losh /// Definition of an EFI memory descriptor.
1190d1ba665SWarner Losh ///
1200d1ba665SWarner Losh typedef struct {
1210d1ba665SWarner Losh   ///
122*3245fa21SMitchell Horne   /// Type of the memory region.
123*3245fa21SMitchell Horne   /// Type EFI_MEMORY_TYPE is defined in the
124*3245fa21SMitchell Horne   /// AllocatePages() function description.
1250d1ba665SWarner Losh   ///
1260d1ba665SWarner Losh   UINT32                Type;
1270d1ba665SWarner Losh   ///
128*3245fa21SMitchell Horne   /// Physical address of the first byte in the memory region. PhysicalStart must be
129*3245fa21SMitchell Horne   /// aligned on a 4 KiB boundary, and must not be above 0xfffffffffffff000. Type
130*3245fa21SMitchell Horne   /// EFI_PHYSICAL_ADDRESS is defined in the AllocatePages() function description
1310d1ba665SWarner Losh   ///
1320d1ba665SWarner Losh   EFI_PHYSICAL_ADDRESS  PhysicalStart;
1330d1ba665SWarner Losh   ///
134*3245fa21SMitchell Horne   /// Virtual address of the first byte in the memory region.
135*3245fa21SMitchell Horne   /// VirtualStart must be aligned on a 4 KiB boundary,
136*3245fa21SMitchell Horne   /// and must not be above 0xfffffffffffff000.
1370d1ba665SWarner Losh   ///
1380d1ba665SWarner Losh   EFI_VIRTUAL_ADDRESS   VirtualStart;
1390d1ba665SWarner Losh   ///
140*3245fa21SMitchell Horne   /// NumberOfPagesNumber of 4 KiB pages in the memory region.
141*3245fa21SMitchell Horne   /// NumberOfPages must not be 0, and must not be any value
142*3245fa21SMitchell Horne   /// that would represent a memory page with a start address,
143*3245fa21SMitchell Horne   /// either physical or virtual, above 0xfffffffffffff000.
1440d1ba665SWarner Losh   ///
1450d1ba665SWarner Losh   UINT64                NumberOfPages;
1460d1ba665SWarner Losh   ///
1470d1ba665SWarner Losh   /// Attributes of the memory region that describe the bit mask of capabilities
1480d1ba665SWarner Losh   /// for that memory region, and not necessarily the current settings for that
1490d1ba665SWarner Losh   /// memory region.
1500d1ba665SWarner Losh   ///
1510d1ba665SWarner Losh   UINT64                Attribute;
1520d1ba665SWarner Losh } EFI_MEMORY_DESCRIPTOR;
1530d1ba665SWarner Losh 
1540d1ba665SWarner Losh /**
1550d1ba665SWarner Losh   Allocates memory pages from the system.
1560d1ba665SWarner Losh 
1570d1ba665SWarner Losh   @param[in]       Type         The type of allocation to perform.
1580d1ba665SWarner Losh   @param[in]       MemoryType   The type of memory to allocate.
1590d1ba665SWarner Losh                                 MemoryType values in the range 0x70000000..0x7FFFFFFF
1600d1ba665SWarner Losh                                 are reserved for OEM use. MemoryType values in the range
1610d1ba665SWarner Losh                                 0x80000000..0xFFFFFFFF are reserved for use by UEFI OS loaders
1620d1ba665SWarner Losh                                 that are provided by operating system vendors.
1630d1ba665SWarner Losh   @param[in]       Pages        The number of contiguous 4 KB pages to allocate.
1640d1ba665SWarner Losh   @param[in, out]  Memory       The pointer to a physical address. On input, the way in which the address is
1650d1ba665SWarner Losh                                 used depends on the value of Type.
1660d1ba665SWarner Losh 
1670d1ba665SWarner Losh   @retval EFI_SUCCESS           The requested pages were allocated.
1680d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER 1) Type is not AllocateAnyPages or
1690d1ba665SWarner Losh                                 AllocateMaxAddress or AllocateAddress.
1700d1ba665SWarner Losh                                 2) MemoryType is in the range
1710d1ba665SWarner Losh                                 EfiMaxMemoryType..0x6FFFFFFF.
1720d1ba665SWarner Losh                                 3) Memory is NULL.
1730d1ba665SWarner Losh                                 4) MemoryType is EfiPersistentMemory.
1740d1ba665SWarner Losh   @retval EFI_OUT_OF_RESOURCES  The pages could not be allocated.
1750d1ba665SWarner Losh   @retval EFI_NOT_FOUND         The requested pages could not be found.
1760d1ba665SWarner Losh 
1770d1ba665SWarner Losh **/
1780d1ba665SWarner Losh typedef
1790d1ba665SWarner Losh EFI_STATUS
1800d1ba665SWarner Losh (EFIAPI *EFI_ALLOCATE_PAGES)(
1810d1ba665SWarner Losh   IN     EFI_ALLOCATE_TYPE            Type,
1820d1ba665SWarner Losh   IN     EFI_MEMORY_TYPE              MemoryType,
1830d1ba665SWarner Losh   IN     UINTN                        Pages,
1840d1ba665SWarner Losh   IN OUT EFI_PHYSICAL_ADDRESS         *Memory
1850d1ba665SWarner Losh   );
1860d1ba665SWarner Losh 
1870d1ba665SWarner Losh /**
1880d1ba665SWarner Losh   Frees memory pages.
1890d1ba665SWarner Losh 
1900d1ba665SWarner Losh   @param[in]  Memory      The base physical address of the pages to be freed.
1910d1ba665SWarner Losh   @param[in]  Pages       The number of contiguous 4 KB pages to free.
1920d1ba665SWarner Losh 
1930d1ba665SWarner Losh   @retval EFI_SUCCESS           The requested pages were freed.
1940d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or Pages is invalid.
1950d1ba665SWarner Losh   @retval EFI_NOT_FOUND         The requested memory pages were not allocated with
1960d1ba665SWarner Losh                                 AllocatePages().
1970d1ba665SWarner Losh 
1980d1ba665SWarner Losh **/
1990d1ba665SWarner Losh typedef
2000d1ba665SWarner Losh EFI_STATUS
2010d1ba665SWarner Losh (EFIAPI *EFI_FREE_PAGES)(
2020d1ba665SWarner Losh   IN  EFI_PHYSICAL_ADDRESS         Memory,
2030d1ba665SWarner Losh   IN  UINTN                        Pages
2040d1ba665SWarner Losh   );
2050d1ba665SWarner Losh 
2060d1ba665SWarner Losh /**
2070d1ba665SWarner Losh   Returns the current memory map.
2080d1ba665SWarner Losh 
2090d1ba665SWarner Losh   @param[in, out]  MemoryMapSize         A pointer to the size, in bytes, of the MemoryMap buffer.
2100d1ba665SWarner Losh                                          On input, this is the size of the buffer allocated by the caller.
2110d1ba665SWarner Losh                                          On output, it is the size of the buffer returned by the firmware if
2120d1ba665SWarner Losh                                          the buffer was large enough, or the size of the buffer needed to contain
2130d1ba665SWarner Losh                                          the map if the buffer was too small.
214*3245fa21SMitchell Horne   @param[out]      MemoryMap             A pointer to the buffer in which firmware places the current memory
2150d1ba665SWarner Losh                                          map.
2160d1ba665SWarner Losh   @param[out]      MapKey                A pointer to the location in which firmware returns the key for the
2170d1ba665SWarner Losh                                          current memory map.
2180d1ba665SWarner Losh   @param[out]      DescriptorSize        A pointer to the location in which firmware returns the size, in bytes, of
2190d1ba665SWarner Losh                                          an individual EFI_MEMORY_DESCRIPTOR.
2200d1ba665SWarner Losh   @param[out]      DescriptorVersion     A pointer to the location in which firmware returns the version number
2210d1ba665SWarner Losh                                          associated with the EFI_MEMORY_DESCRIPTOR.
2220d1ba665SWarner Losh 
2230d1ba665SWarner Losh   @retval EFI_SUCCESS           The memory map was returned in the MemoryMap buffer.
2240d1ba665SWarner Losh   @retval EFI_BUFFER_TOO_SMALL  The MemoryMap buffer was too small. The current buffer size
2250d1ba665SWarner Losh                                 needed to hold the memory map is returned in MemoryMapSize.
2260d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER 1) MemoryMapSize is NULL.
2270d1ba665SWarner Losh                                 2) The MemoryMap buffer is not too small and MemoryMap is
2280d1ba665SWarner Losh                                    NULL.
2290d1ba665SWarner Losh 
2300d1ba665SWarner Losh **/
2310d1ba665SWarner Losh typedef
2320d1ba665SWarner Losh EFI_STATUS
2330d1ba665SWarner Losh (EFIAPI *EFI_GET_MEMORY_MAP)(
2340d1ba665SWarner Losh   IN OUT UINTN                       *MemoryMapSize,
235*3245fa21SMitchell Horne   OUT    EFI_MEMORY_DESCRIPTOR       *MemoryMap,
2360d1ba665SWarner Losh   OUT    UINTN                       *MapKey,
2370d1ba665SWarner Losh   OUT    UINTN                       *DescriptorSize,
2380d1ba665SWarner Losh   OUT    UINT32                      *DescriptorVersion
2390d1ba665SWarner Losh   );
2400d1ba665SWarner Losh 
2410d1ba665SWarner Losh /**
2420d1ba665SWarner Losh   Allocates pool memory.
2430d1ba665SWarner Losh 
2440d1ba665SWarner Losh   @param[in]   PoolType         The type of pool to allocate.
2450d1ba665SWarner Losh                                 MemoryType values in the range 0x70000000..0x7FFFFFFF
2460d1ba665SWarner Losh                                 are reserved for OEM use. MemoryType values in the range
2470d1ba665SWarner Losh                                 0x80000000..0xFFFFFFFF are reserved for use by UEFI OS loaders
2480d1ba665SWarner Losh                                 that are provided by operating system vendors.
2490d1ba665SWarner Losh   @param[in]   Size             The number of bytes to allocate from the pool.
2500d1ba665SWarner Losh   @param[out]  Buffer           A pointer to a pointer to the allocated buffer if the call succeeds;
2510d1ba665SWarner Losh                                 undefined otherwise.
2520d1ba665SWarner Losh 
2530d1ba665SWarner Losh   @retval EFI_SUCCESS           The requested number of bytes was allocated.
2540d1ba665SWarner Losh   @retval EFI_OUT_OF_RESOURCES  The pool requested could not be allocated.
2550d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER Buffer is NULL.
2560d1ba665SWarner Losh                                 PoolType is in the range EfiMaxMemoryType..0x6FFFFFFF.
2570d1ba665SWarner Losh                                 PoolType is EfiPersistentMemory.
2580d1ba665SWarner Losh 
2590d1ba665SWarner Losh **/
2600d1ba665SWarner Losh typedef
2610d1ba665SWarner Losh EFI_STATUS
2620d1ba665SWarner Losh (EFIAPI *EFI_ALLOCATE_POOL)(
2630d1ba665SWarner Losh   IN  EFI_MEMORY_TYPE              PoolType,
2640d1ba665SWarner Losh   IN  UINTN                        Size,
2650d1ba665SWarner Losh   OUT VOID                         **Buffer
2660d1ba665SWarner Losh   );
2670d1ba665SWarner Losh 
2680d1ba665SWarner Losh /**
2690d1ba665SWarner Losh   Returns pool memory to the system.
2700d1ba665SWarner Losh 
2710d1ba665SWarner Losh   @param[in]  Buffer            The pointer to the buffer to free.
2720d1ba665SWarner Losh 
2730d1ba665SWarner Losh   @retval EFI_SUCCESS           The memory was returned to the system.
2740d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER Buffer was invalid.
2750d1ba665SWarner Losh 
2760d1ba665SWarner Losh **/
2770d1ba665SWarner Losh typedef
2780d1ba665SWarner Losh EFI_STATUS
2790d1ba665SWarner Losh (EFIAPI *EFI_FREE_POOL)(
2800d1ba665SWarner Losh   IN  VOID                         *Buffer
2810d1ba665SWarner Losh   );
2820d1ba665SWarner Losh 
2830d1ba665SWarner Losh /**
2840d1ba665SWarner Losh   Changes the runtime addressing mode of EFI firmware from physical to virtual.
2850d1ba665SWarner Losh 
2860d1ba665SWarner Losh   @param[in]  MemoryMapSize     The size in bytes of VirtualMap.
2870d1ba665SWarner Losh   @param[in]  DescriptorSize    The size in bytes of an entry in the VirtualMap.
2880d1ba665SWarner Losh   @param[in]  DescriptorVersion The version of the structure entries in VirtualMap.
2890d1ba665SWarner Losh   @param[in]  VirtualMap        An array of memory descriptors which contain new virtual
2900d1ba665SWarner Losh                                 address mapping information for all runtime ranges.
2910d1ba665SWarner Losh 
2920d1ba665SWarner Losh   @retval EFI_SUCCESS           The virtual address map has been applied.
2930d1ba665SWarner Losh   @retval EFI_UNSUPPORTED       EFI firmware is not at runtime, or the EFI firmware is already in
2940d1ba665SWarner Losh                                 virtual address mapped mode.
2950d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is invalid.
2960d1ba665SWarner Losh   @retval EFI_NO_MAPPING        A virtual address was not supplied for a range in the memory
2970d1ba665SWarner Losh                                 map that requires a mapping.
2980d1ba665SWarner Losh   @retval EFI_NOT_FOUND         A virtual address was supplied for an address that is not found
2990d1ba665SWarner Losh                                 in the memory map.
3000d1ba665SWarner Losh 
3010d1ba665SWarner Losh **/
3020d1ba665SWarner Losh typedef
3030d1ba665SWarner Losh EFI_STATUS
3040d1ba665SWarner Losh (EFIAPI *EFI_SET_VIRTUAL_ADDRESS_MAP)(
3050d1ba665SWarner Losh   IN  UINTN                        MemoryMapSize,
3060d1ba665SWarner Losh   IN  UINTN                        DescriptorSize,
3070d1ba665SWarner Losh   IN  UINT32                       DescriptorVersion,
3080d1ba665SWarner Losh   IN  EFI_MEMORY_DESCRIPTOR        *VirtualMap
3090d1ba665SWarner Losh   );
3100d1ba665SWarner Losh 
3110d1ba665SWarner Losh /**
3120d1ba665SWarner Losh   Connects one or more drivers to a controller.
3130d1ba665SWarner Losh 
3140d1ba665SWarner Losh   @param[in]  ControllerHandle      The handle of the controller to which driver(s) are to be connected.
3150d1ba665SWarner Losh   @param[in]  DriverImageHandle     A pointer to an ordered list handles that support the
3160d1ba665SWarner Losh                                     EFI_DRIVER_BINDING_PROTOCOL.
3170d1ba665SWarner Losh   @param[in]  RemainingDevicePath   A pointer to the device path that specifies a child of the
3180d1ba665SWarner Losh                                     controller specified by ControllerHandle.
3190d1ba665SWarner Losh   @param[in]  Recursive             If TRUE, then ConnectController() is called recursively
3200d1ba665SWarner Losh                                     until the entire tree of controllers below the controller specified
3210d1ba665SWarner Losh                                     by ControllerHandle have been created. If FALSE, then
3220d1ba665SWarner Losh                                     the tree of controllers is only expanded one level.
3230d1ba665SWarner Losh 
3240d1ba665SWarner Losh   @retval EFI_SUCCESS           1) One or more drivers were connected to ControllerHandle.
3250d1ba665SWarner Losh                                 2) No drivers were connected to ControllerHandle, but
3260d1ba665SWarner Losh                                 RemainingDevicePath is not NULL, and it is an End Device
3270d1ba665SWarner Losh                                 Path Node.
3280d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
3290d1ba665SWarner Losh   @retval EFI_NOT_FOUND         1) There are no EFI_DRIVER_BINDING_PROTOCOL instances
3300d1ba665SWarner Losh                                 present in the system.
3310d1ba665SWarner Losh                                 2) No drivers were connected to ControllerHandle.
3320d1ba665SWarner Losh   @retval EFI_SECURITY_VIOLATION
3330d1ba665SWarner Losh                                 The user has no permission to start UEFI device drivers on the device path
3340d1ba665SWarner Losh                                 associated with the ControllerHandle or specified by the RemainingDevicePath.
3350d1ba665SWarner Losh **/
3360d1ba665SWarner Losh typedef
3370d1ba665SWarner Losh EFI_STATUS
3380d1ba665SWarner Losh (EFIAPI *EFI_CONNECT_CONTROLLER)(
3390d1ba665SWarner Losh   IN  EFI_HANDLE                    ControllerHandle,
3400d1ba665SWarner Losh   IN  EFI_HANDLE                    *DriverImageHandle,   OPTIONAL
3410d1ba665SWarner Losh   IN  EFI_DEVICE_PATH_PROTOCOL      *RemainingDevicePath, OPTIONAL
3420d1ba665SWarner Losh   IN  BOOLEAN                       Recursive
3430d1ba665SWarner Losh   );
3440d1ba665SWarner Losh 
3450d1ba665SWarner Losh /**
3460d1ba665SWarner Losh   Disconnects one or more drivers from a controller.
3470d1ba665SWarner Losh 
3480d1ba665SWarner Losh   @param[in]  ControllerHandle      The handle of the controller from which driver(s) are to be disconnected.
3490d1ba665SWarner Losh   @param[in]  DriverImageHandle     The driver to disconnect from ControllerHandle.
3500d1ba665SWarner Losh                                     If DriverImageHandle is NULL, then all the drivers currently managing
3510d1ba665SWarner Losh                                     ControllerHandle are disconnected from ControllerHandle.
3520d1ba665SWarner Losh   @param[in]  ChildHandle           The handle of the child to destroy.
3530d1ba665SWarner Losh                                     If ChildHandle is NULL, then all the children of ControllerHandle are
3540d1ba665SWarner Losh                                     destroyed before the drivers are disconnected from ControllerHandle.
3550d1ba665SWarner Losh 
3560d1ba665SWarner Losh   @retval EFI_SUCCESS           1) One or more drivers were disconnected from the controller.
3570d1ba665SWarner Losh                                 2) On entry, no drivers are managing ControllerHandle.
3580d1ba665SWarner Losh                                 3) DriverImageHandle is not NULL, and on entry
3590d1ba665SWarner Losh                                    DriverImageHandle is not managing ControllerHandle.
3600d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER 1) ControllerHandle is NULL.
3610d1ba665SWarner Losh                                 2) DriverImageHandle is not NULL, and it is not a valid EFI_HANDLE.
3620d1ba665SWarner Losh                                 3) ChildHandle is not NULL, and it is not a valid EFI_HANDLE.
3630d1ba665SWarner Losh                                 4) DriverImageHandle does not support the EFI_DRIVER_BINDING_PROTOCOL.
3640d1ba665SWarner Losh   @retval EFI_OUT_OF_RESOURCES  There are not enough resources available to disconnect any drivers from
3650d1ba665SWarner Losh                                 ControllerHandle.
3660d1ba665SWarner Losh   @retval EFI_DEVICE_ERROR      The controller could not be disconnected because of a device error.
3670d1ba665SWarner Losh 
3680d1ba665SWarner Losh **/
3690d1ba665SWarner Losh typedef
3700d1ba665SWarner Losh EFI_STATUS
3710d1ba665SWarner Losh (EFIAPI *EFI_DISCONNECT_CONTROLLER)(
3720d1ba665SWarner Losh   IN  EFI_HANDLE                     ControllerHandle,
3730d1ba665SWarner Losh   IN  EFI_HANDLE                     DriverImageHandle, OPTIONAL
3740d1ba665SWarner Losh   IN  EFI_HANDLE                     ChildHandle        OPTIONAL
3750d1ba665SWarner Losh   );
3760d1ba665SWarner Losh 
3770d1ba665SWarner Losh 
3780d1ba665SWarner Losh 
3790d1ba665SWarner Losh //
3800d1ba665SWarner Losh // ConvertPointer DebugDisposition type.
3810d1ba665SWarner Losh //
3820d1ba665SWarner Losh #define EFI_OPTIONAL_PTR     0x00000001
3830d1ba665SWarner Losh 
3840d1ba665SWarner Losh /**
3850d1ba665SWarner Losh   Determines the new virtual address that is to be used on subsequent memory accesses.
3860d1ba665SWarner Losh 
3870d1ba665SWarner Losh   @param[in]       DebugDisposition  Supplies type information for the pointer being converted.
3880d1ba665SWarner Losh   @param[in, out]  Address           A pointer to a pointer that is to be fixed to be the value needed
3890d1ba665SWarner Losh                                      for the new virtual address mappings being applied.
3900d1ba665SWarner Losh 
3910d1ba665SWarner Losh   @retval EFI_SUCCESS           The pointer pointed to by Address was modified.
3920d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER 1) Address is NULL.
3930d1ba665SWarner Losh                                 2) *Address is NULL and DebugDisposition does
3940d1ba665SWarner Losh                                 not have the EFI_OPTIONAL_PTR bit set.
3950d1ba665SWarner Losh   @retval EFI_NOT_FOUND         The pointer pointed to by Address was not found to be part
3960d1ba665SWarner Losh                                 of the current memory map. This is normally fatal.
3970d1ba665SWarner Losh 
3980d1ba665SWarner Losh **/
3990d1ba665SWarner Losh typedef
4000d1ba665SWarner Losh EFI_STATUS
4010d1ba665SWarner Losh (EFIAPI *EFI_CONVERT_POINTER)(
4020d1ba665SWarner Losh   IN     UINTN                      DebugDisposition,
4030d1ba665SWarner Losh   IN OUT VOID                       **Address
4040d1ba665SWarner Losh   );
4050d1ba665SWarner Losh 
4060d1ba665SWarner Losh 
4070d1ba665SWarner Losh //
4080d1ba665SWarner Losh // These types can be ORed together as needed - for example,
4090d1ba665SWarner Losh // EVT_TIMER might be Ored with EVT_NOTIFY_WAIT or
4100d1ba665SWarner Losh // EVT_NOTIFY_SIGNAL.
4110d1ba665SWarner Losh //
4120d1ba665SWarner Losh #define EVT_TIMER                         0x80000000
4130d1ba665SWarner Losh #define EVT_RUNTIME                       0x40000000
4140d1ba665SWarner Losh #define EVT_NOTIFY_WAIT                   0x00000100
4150d1ba665SWarner Losh #define EVT_NOTIFY_SIGNAL                 0x00000200
4160d1ba665SWarner Losh 
4170d1ba665SWarner Losh #define EVT_SIGNAL_EXIT_BOOT_SERVICES     0x00000201
4180d1ba665SWarner Losh #define EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE 0x60000202
4190d1ba665SWarner Losh 
4200d1ba665SWarner Losh //
4210d1ba665SWarner Losh // The event's NotifyContext pointer points to a runtime memory
4220d1ba665SWarner Losh // address.
4230d1ba665SWarner Losh // The event is deprecated in UEFI2.0 and later specifications.
4240d1ba665SWarner Losh //
4250d1ba665SWarner Losh #define EVT_RUNTIME_CONTEXT               0x20000000
4260d1ba665SWarner Losh 
4270d1ba665SWarner Losh 
4280d1ba665SWarner Losh /**
4290d1ba665SWarner Losh   Invoke a notification event
4300d1ba665SWarner Losh 
4310d1ba665SWarner Losh   @param[in]  Event                 Event whose notification function is being invoked.
4320d1ba665SWarner Losh   @param[in]  Context               The pointer to the notification function's context,
4330d1ba665SWarner Losh                                     which is implementation-dependent.
4340d1ba665SWarner Losh 
4350d1ba665SWarner Losh **/
4360d1ba665SWarner Losh typedef
4370d1ba665SWarner Losh VOID
4380d1ba665SWarner Losh (EFIAPI *EFI_EVENT_NOTIFY)(
4390d1ba665SWarner Losh   IN  EFI_EVENT                Event,
4400d1ba665SWarner Losh   IN  VOID                     *Context
4410d1ba665SWarner Losh   );
4420d1ba665SWarner Losh 
4430d1ba665SWarner Losh /**
4440d1ba665SWarner Losh   Creates an event.
4450d1ba665SWarner Losh 
4460d1ba665SWarner Losh   @param[in]   Type             The type of event to create and its mode and attributes.
4470d1ba665SWarner Losh   @param[in]   NotifyTpl        The task priority level of event notifications, if needed.
4480d1ba665SWarner Losh   @param[in]   NotifyFunction   The pointer to the event's notification function, if any.
4490d1ba665SWarner Losh   @param[in]   NotifyContext    The pointer to the notification function's context; corresponds to parameter
4500d1ba665SWarner Losh                                 Context in the notification function.
4510d1ba665SWarner Losh   @param[out]  Event            The pointer to the newly created event if the call succeeds; undefined
4520d1ba665SWarner Losh                                 otherwise.
4530d1ba665SWarner Losh 
4540d1ba665SWarner Losh   @retval EFI_SUCCESS           The event structure was created.
4550d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
4560d1ba665SWarner Losh   @retval EFI_OUT_OF_RESOURCES  The event could not be allocated.
4570d1ba665SWarner Losh 
4580d1ba665SWarner Losh **/
4590d1ba665SWarner Losh typedef
4600d1ba665SWarner Losh EFI_STATUS
4610d1ba665SWarner Losh (EFIAPI *EFI_CREATE_EVENT)(
4620d1ba665SWarner Losh   IN  UINT32                       Type,
4630d1ba665SWarner Losh   IN  EFI_TPL                      NotifyTpl,
4640d1ba665SWarner Losh   IN  EFI_EVENT_NOTIFY             NotifyFunction,
4650d1ba665SWarner Losh   IN  VOID                         *NotifyContext,
4660d1ba665SWarner Losh   OUT EFI_EVENT                    *Event
4670d1ba665SWarner Losh   );
4680d1ba665SWarner Losh 
4690d1ba665SWarner Losh /**
4700d1ba665SWarner Losh   Creates an event in a group.
4710d1ba665SWarner Losh 
4720d1ba665SWarner Losh   @param[in]   Type             The type of event to create and its mode and attributes.
4730d1ba665SWarner Losh   @param[in]   NotifyTpl        The task priority level of event notifications,if needed.
4740d1ba665SWarner Losh   @param[in]   NotifyFunction   The pointer to the event's notification function, if any.
4750d1ba665SWarner Losh   @param[in]   NotifyContext    The pointer to the notification function's context; corresponds to parameter
4760d1ba665SWarner Losh                                 Context in the notification function.
4770d1ba665SWarner Losh   @param[in]   EventGroup       The pointer to the unique identifier of the group to which this event belongs.
4780d1ba665SWarner Losh                                 If this is NULL, then the function behaves as if the parameters were passed
4790d1ba665SWarner Losh                                 to CreateEvent.
4800d1ba665SWarner Losh   @param[out]  Event            The pointer to the newly created event if the call succeeds; undefined
4810d1ba665SWarner Losh                                 otherwise.
4820d1ba665SWarner Losh 
4830d1ba665SWarner Losh   @retval EFI_SUCCESS           The event structure was created.
4840d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
4850d1ba665SWarner Losh   @retval EFI_OUT_OF_RESOURCES  The event could not be allocated.
4860d1ba665SWarner Losh 
4870d1ba665SWarner Losh **/
4880d1ba665SWarner Losh typedef
4890d1ba665SWarner Losh EFI_STATUS
4900d1ba665SWarner Losh (EFIAPI *EFI_CREATE_EVENT_EX)(
4910d1ba665SWarner Losh   IN       UINT32                 Type,
4920d1ba665SWarner Losh   IN       EFI_TPL                NotifyTpl,
4930d1ba665SWarner Losh   IN       EFI_EVENT_NOTIFY       NotifyFunction OPTIONAL,
4940d1ba665SWarner Losh   IN CONST VOID                   *NotifyContext OPTIONAL,
4950d1ba665SWarner Losh   IN CONST EFI_GUID               *EventGroup    OPTIONAL,
4960d1ba665SWarner Losh   OUT      EFI_EVENT              *Event
4970d1ba665SWarner Losh   );
4980d1ba665SWarner Losh 
4990d1ba665SWarner Losh ///
5000d1ba665SWarner Losh /// Timer delay types
5010d1ba665SWarner Losh ///
5020d1ba665SWarner Losh typedef enum {
5030d1ba665SWarner Losh   ///
5040d1ba665SWarner Losh   /// An event's timer settings is to be cancelled and not trigger time is to be set/
5050d1ba665SWarner Losh   ///
5060d1ba665SWarner Losh   TimerCancel,
5070d1ba665SWarner Losh   ///
5080d1ba665SWarner Losh   /// An event is to be signaled periodically at a specified interval from the current time.
5090d1ba665SWarner Losh   ///
5100d1ba665SWarner Losh   TimerPeriodic,
5110d1ba665SWarner Losh   ///
5120d1ba665SWarner Losh   /// An event is to be signaled once at a specified interval from the current time.
5130d1ba665SWarner Losh   ///
5140d1ba665SWarner Losh   TimerRelative
5150d1ba665SWarner Losh } EFI_TIMER_DELAY;
5160d1ba665SWarner Losh 
5170d1ba665SWarner Losh /**
5180d1ba665SWarner Losh   Sets the type of timer and the trigger time for a timer event.
5190d1ba665SWarner Losh 
5200d1ba665SWarner Losh   @param[in]  Event             The timer event that is to be signaled at the specified time.
5210d1ba665SWarner Losh   @param[in]  Type              The type of time that is specified in TriggerTime.
5220d1ba665SWarner Losh   @param[in]  TriggerTime       The number of 100ns units until the timer expires.
5230d1ba665SWarner Losh                                 A TriggerTime of 0 is legal.
5240d1ba665SWarner Losh                                 If Type is TimerRelative and TriggerTime is 0, then the timer
5250d1ba665SWarner Losh                                 event will be signaled on the next timer tick.
5260d1ba665SWarner Losh                                 If Type is TimerPeriodic and TriggerTime is 0, then the timer
5270d1ba665SWarner Losh                                 event will be signaled on every timer tick.
5280d1ba665SWarner Losh 
5290d1ba665SWarner Losh   @retval EFI_SUCCESS           The event has been set to be signaled at the requested time.
5300d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER Event or Type is not valid.
5310d1ba665SWarner Losh 
5320d1ba665SWarner Losh **/
5330d1ba665SWarner Losh typedef
5340d1ba665SWarner Losh EFI_STATUS
5350d1ba665SWarner Losh (EFIAPI *EFI_SET_TIMER)(
5360d1ba665SWarner Losh   IN  EFI_EVENT                Event,
5370d1ba665SWarner Losh   IN  EFI_TIMER_DELAY          Type,
5380d1ba665SWarner Losh   IN  UINT64                   TriggerTime
5390d1ba665SWarner Losh   );
5400d1ba665SWarner Losh 
5410d1ba665SWarner Losh /**
5420d1ba665SWarner Losh   Signals an event.
5430d1ba665SWarner Losh 
5440d1ba665SWarner Losh   @param[in]  Event             The event to signal.
5450d1ba665SWarner Losh 
5460d1ba665SWarner Losh   @retval EFI_SUCCESS           The event has been signaled.
5470d1ba665SWarner Losh 
5480d1ba665SWarner Losh **/
5490d1ba665SWarner Losh typedef
5500d1ba665SWarner Losh EFI_STATUS
5510d1ba665SWarner Losh (EFIAPI *EFI_SIGNAL_EVENT)(
5520d1ba665SWarner Losh   IN  EFI_EVENT                Event
5530d1ba665SWarner Losh   );
5540d1ba665SWarner Losh 
5550d1ba665SWarner Losh /**
5560d1ba665SWarner Losh   Stops execution until an event is signaled.
5570d1ba665SWarner Losh 
5580d1ba665SWarner Losh   @param[in]   NumberOfEvents   The number of events in the Event array.
5590d1ba665SWarner Losh   @param[in]   Event            An array of EFI_EVENT.
5600d1ba665SWarner Losh   @param[out]  Index            The pointer to the index of the event which satisfied the wait condition.
5610d1ba665SWarner Losh 
5620d1ba665SWarner Losh   @retval EFI_SUCCESS           The event indicated by Index was signaled.
5630d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER 1) NumberOfEvents is 0.
5640d1ba665SWarner Losh                                 2) The event indicated by Index is of type
5650d1ba665SWarner Losh                                    EVT_NOTIFY_SIGNAL.
5660d1ba665SWarner Losh   @retval EFI_UNSUPPORTED       The current TPL is not TPL_APPLICATION.
5670d1ba665SWarner Losh 
5680d1ba665SWarner Losh **/
5690d1ba665SWarner Losh typedef
5700d1ba665SWarner Losh EFI_STATUS
5710d1ba665SWarner Losh (EFIAPI *EFI_WAIT_FOR_EVENT)(
5720d1ba665SWarner Losh   IN  UINTN                    NumberOfEvents,
5730d1ba665SWarner Losh   IN  EFI_EVENT                *Event,
5740d1ba665SWarner Losh   OUT UINTN                    *Index
5750d1ba665SWarner Losh   );
5760d1ba665SWarner Losh 
5770d1ba665SWarner Losh /**
5780d1ba665SWarner Losh   Closes an event.
5790d1ba665SWarner Losh 
5800d1ba665SWarner Losh   @param[in]  Event             The event to close.
5810d1ba665SWarner Losh 
5820d1ba665SWarner Losh   @retval EFI_SUCCESS           The event has been closed.
5830d1ba665SWarner Losh 
5840d1ba665SWarner Losh **/
5850d1ba665SWarner Losh typedef
5860d1ba665SWarner Losh EFI_STATUS
5870d1ba665SWarner Losh (EFIAPI *EFI_CLOSE_EVENT)(
5880d1ba665SWarner Losh   IN EFI_EVENT                Event
5890d1ba665SWarner Losh   );
5900d1ba665SWarner Losh 
5910d1ba665SWarner Losh /**
5920d1ba665SWarner Losh   Checks whether an event is in the signaled state.
5930d1ba665SWarner Losh 
5940d1ba665SWarner Losh   @param[in]  Event             The event to check.
5950d1ba665SWarner Losh 
5960d1ba665SWarner Losh   @retval EFI_SUCCESS           The event is in the signaled state.
5970d1ba665SWarner Losh   @retval EFI_NOT_READY         The event is not in the signaled state.
5980d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL.
5990d1ba665SWarner Losh 
6000d1ba665SWarner Losh **/
6010d1ba665SWarner Losh typedef
6020d1ba665SWarner Losh EFI_STATUS
6030d1ba665SWarner Losh (EFIAPI *EFI_CHECK_EVENT)(
6040d1ba665SWarner Losh   IN EFI_EVENT                Event
6050d1ba665SWarner Losh   );
6060d1ba665SWarner Losh 
6070d1ba665SWarner Losh 
6080d1ba665SWarner Losh //
6090d1ba665SWarner Losh // Task priority level
6100d1ba665SWarner Losh //
6110d1ba665SWarner Losh #define TPL_APPLICATION       4
6120d1ba665SWarner Losh #define TPL_CALLBACK          8
6130d1ba665SWarner Losh #define TPL_NOTIFY            16
6140d1ba665SWarner Losh #define TPL_HIGH_LEVEL        31
6150d1ba665SWarner Losh 
6160d1ba665SWarner Losh 
6170d1ba665SWarner Losh /**
6180d1ba665SWarner Losh   Raises a task's priority level and returns its previous level.
6190d1ba665SWarner Losh 
6200d1ba665SWarner Losh   @param[in]  NewTpl          The new task priority level.
6210d1ba665SWarner Losh 
6220d1ba665SWarner Losh   @return Previous task priority level
6230d1ba665SWarner Losh 
6240d1ba665SWarner Losh **/
6250d1ba665SWarner Losh typedef
6260d1ba665SWarner Losh EFI_TPL
6270d1ba665SWarner Losh (EFIAPI *EFI_RAISE_TPL)(
6280d1ba665SWarner Losh   IN EFI_TPL      NewTpl
6290d1ba665SWarner Losh   );
6300d1ba665SWarner Losh 
6310d1ba665SWarner Losh /**
6320d1ba665SWarner Losh   Restores a task's priority level to its previous value.
6330d1ba665SWarner Losh 
6340d1ba665SWarner Losh   @param[in]  OldTpl          The previous task priority level to restore.
6350d1ba665SWarner Losh 
6360d1ba665SWarner Losh **/
6370d1ba665SWarner Losh typedef
6380d1ba665SWarner Losh VOID
6390d1ba665SWarner Losh (EFIAPI *EFI_RESTORE_TPL)(
6400d1ba665SWarner Losh   IN EFI_TPL      OldTpl
6410d1ba665SWarner Losh   );
6420d1ba665SWarner Losh 
6430d1ba665SWarner Losh /**
6440d1ba665SWarner Losh   Returns the value of a variable.
6450d1ba665SWarner Losh 
6460d1ba665SWarner Losh   @param[in]       VariableName  A Null-terminated string that is the name of the vendor's
6470d1ba665SWarner Losh                                  variable.
6480d1ba665SWarner Losh   @param[in]       VendorGuid    A unique identifier for the vendor.
6490d1ba665SWarner Losh   @param[out]      Attributes    If not NULL, a pointer to the memory location to return the
6500d1ba665SWarner Losh                                  attributes bitmask for the variable.
6510d1ba665SWarner Losh   @param[in, out]  DataSize      On input, the size in bytes of the return Data buffer.
6520d1ba665SWarner Losh                                  On output the size of data returned in Data.
6530d1ba665SWarner Losh   @param[out]      Data          The buffer to return the contents of the variable. May be NULL
6540d1ba665SWarner Losh                                  with a zero DataSize in order to determine the size buffer needed.
6550d1ba665SWarner Losh 
6560d1ba665SWarner Losh   @retval EFI_SUCCESS            The function completed successfully.
6570d1ba665SWarner Losh   @retval EFI_NOT_FOUND          The variable was not found.
6580d1ba665SWarner Losh   @retval EFI_BUFFER_TOO_SMALL   The DataSize is too small for the result.
6590d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER  VariableName is NULL.
6600d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER  VendorGuid is NULL.
6610d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER  DataSize is NULL.
6620d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER  The DataSize is not too small and Data is NULL.
6630d1ba665SWarner Losh   @retval EFI_DEVICE_ERROR       The variable could not be retrieved due to a hardware error.
6640d1ba665SWarner Losh   @retval EFI_SECURITY_VIOLATION The variable could not be retrieved due to an authentication failure.
6650d1ba665SWarner Losh 
6660d1ba665SWarner Losh **/
6670d1ba665SWarner Losh typedef
6680d1ba665SWarner Losh EFI_STATUS
6690d1ba665SWarner Losh (EFIAPI *EFI_GET_VARIABLE)(
6700d1ba665SWarner Losh   IN     CHAR16                      *VariableName,
6710d1ba665SWarner Losh   IN     EFI_GUID                    *VendorGuid,
6720d1ba665SWarner Losh   OUT    UINT32                      *Attributes,    OPTIONAL
6730d1ba665SWarner Losh   IN OUT UINTN                       *DataSize,
6740d1ba665SWarner Losh   OUT    VOID                        *Data           OPTIONAL
6750d1ba665SWarner Losh   );
6760d1ba665SWarner Losh 
6770d1ba665SWarner Losh /**
6780d1ba665SWarner Losh   Enumerates the current variable names.
6790d1ba665SWarner Losh 
680*3245fa21SMitchell Horne   @param[in, out]  VariableNameSize The size of the VariableName buffer. The size must be large
681*3245fa21SMitchell Horne                                     enough to fit input string supplied in VariableName buffer.
6820d1ba665SWarner Losh   @param[in, out]  VariableName     On input, supplies the last VariableName that was returned
6830d1ba665SWarner Losh                                     by GetNextVariableName(). On output, returns the Nullterminated
6840d1ba665SWarner Losh                                     string of the current variable.
6850d1ba665SWarner Losh   @param[in, out]  VendorGuid       On input, supplies the last VendorGuid that was returned by
6860d1ba665SWarner Losh                                     GetNextVariableName(). On output, returns the
6870d1ba665SWarner Losh                                     VendorGuid of the current variable.
6880d1ba665SWarner Losh 
6890d1ba665SWarner Losh   @retval EFI_SUCCESS           The function completed successfully.
6900d1ba665SWarner Losh   @retval EFI_NOT_FOUND         The next variable was not found.
6910d1ba665SWarner Losh   @retval EFI_BUFFER_TOO_SMALL  The VariableNameSize is too small for the result.
692*3245fa21SMitchell Horne                                 VariableNameSize has been updated with the size needed to complete the request.
6930d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER VariableNameSize is NULL.
6940d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER VariableName is NULL.
6950d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER VendorGuid is NULL.
696*3245fa21SMitchell Horne   @retval EFI_INVALID_PARAMETER The input values of VariableName and VendorGuid are not a name and
697*3245fa21SMitchell Horne                                 GUID of an existing variable.
698*3245fa21SMitchell Horne   @retval EFI_INVALID_PARAMETER Null-terminator is not found in the first VariableNameSize bytes of
699*3245fa21SMitchell Horne                                 the input VariableName buffer.
7000d1ba665SWarner Losh   @retval EFI_DEVICE_ERROR      The variable could not be retrieved due to a hardware error.
7010d1ba665SWarner Losh 
7020d1ba665SWarner Losh **/
7030d1ba665SWarner Losh typedef
7040d1ba665SWarner Losh EFI_STATUS
7050d1ba665SWarner Losh (EFIAPI *EFI_GET_NEXT_VARIABLE_NAME)(
7060d1ba665SWarner Losh   IN OUT UINTN                    *VariableNameSize,
7070d1ba665SWarner Losh   IN OUT CHAR16                   *VariableName,
7080d1ba665SWarner Losh   IN OUT EFI_GUID                 *VendorGuid
7090d1ba665SWarner Losh   );
7100d1ba665SWarner Losh 
7110d1ba665SWarner Losh /**
7120d1ba665SWarner Losh   Sets the value of a variable.
7130d1ba665SWarner Losh 
7140d1ba665SWarner Losh   @param[in]  VariableName       A Null-terminated string that is the name of the vendor's variable.
7150d1ba665SWarner Losh                                  Each VariableName is unique for each VendorGuid. VariableName must
7160d1ba665SWarner Losh                                  contain 1 or more characters. If VariableName is an empty string,
7170d1ba665SWarner Losh                                  then EFI_INVALID_PARAMETER is returned.
7180d1ba665SWarner Losh   @param[in]  VendorGuid         A unique identifier for the vendor.
7190d1ba665SWarner Losh   @param[in]  Attributes         Attributes bitmask to set for the variable.
720*3245fa21SMitchell Horne   @param[in]  DataSize           The size in bytes of the Data buffer. Unless the EFI_VARIABLE_APPEND_WRITE or
7210d1ba665SWarner Losh                                  EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS attribute is set, a size of zero
7220d1ba665SWarner Losh                                  causes the variable to be deleted. When the EFI_VARIABLE_APPEND_WRITE attribute is
7230d1ba665SWarner Losh                                  set, then a SetVariable() call with a DataSize of zero will not cause any change to
7240d1ba665SWarner Losh                                  the variable value (the timestamp associated with the variable may be updated however
7250d1ba665SWarner Losh                                  even if no new data value is provided,see the description of the
7260d1ba665SWarner Losh                                  EFI_VARIABLE_AUTHENTICATION_2 descriptor below. In this case the DataSize will not
7270d1ba665SWarner Losh                                  be zero since the EFI_VARIABLE_AUTHENTICATION_2 descriptor will be populated).
7280d1ba665SWarner Losh   @param[in]  Data               The contents for the variable.
7290d1ba665SWarner Losh 
7300d1ba665SWarner Losh   @retval EFI_SUCCESS            The firmware has successfully stored the variable and its data as
7310d1ba665SWarner Losh                                  defined by the Attributes.
7320d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER  An invalid combination of attribute bits, name, and GUID was supplied, or the
7330d1ba665SWarner Losh                                  DataSize exceeds the maximum allowed.
7340d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER  VariableName is an empty string.
7350d1ba665SWarner Losh   @retval EFI_OUT_OF_RESOURCES   Not enough storage is available to hold the variable and its data.
7360d1ba665SWarner Losh   @retval EFI_DEVICE_ERROR       The variable could not be retrieved due to a hardware error.
7370d1ba665SWarner Losh   @retval EFI_WRITE_PROTECTED    The variable in question is read-only.
7380d1ba665SWarner Losh   @retval EFI_WRITE_PROTECTED    The variable in question cannot be deleted.
739*3245fa21SMitchell Horne   @retval EFI_SECURITY_VIOLATION The variable could not be written due to EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACESS being set,
740*3245fa21SMitchell Horne                                  but the AuthInfo does NOT pass the validation check carried out by the firmware.
7410d1ba665SWarner Losh 
7420d1ba665SWarner Losh   @retval EFI_NOT_FOUND          The variable trying to be updated or deleted was not found.
7430d1ba665SWarner Losh 
7440d1ba665SWarner Losh **/
7450d1ba665SWarner Losh typedef
7460d1ba665SWarner Losh EFI_STATUS
7470d1ba665SWarner Losh (EFIAPI *EFI_SET_VARIABLE)(
7480d1ba665SWarner Losh   IN  CHAR16                       *VariableName,
7490d1ba665SWarner Losh   IN  EFI_GUID                     *VendorGuid,
7500d1ba665SWarner Losh   IN  UINT32                       Attributes,
7510d1ba665SWarner Losh   IN  UINTN                        DataSize,
7520d1ba665SWarner Losh   IN  VOID                         *Data
7530d1ba665SWarner Losh   );
7540d1ba665SWarner Losh 
7550d1ba665SWarner Losh 
7560d1ba665SWarner Losh ///
7570d1ba665SWarner Losh /// This provides the capabilities of the
7580d1ba665SWarner Losh /// real time clock device as exposed through the EFI interfaces.
7590d1ba665SWarner Losh ///
7600d1ba665SWarner Losh typedef struct {
7610d1ba665SWarner Losh   ///
7620d1ba665SWarner Losh   /// Provides the reporting resolution of the real-time clock device in
7630d1ba665SWarner Losh   /// counts per second. For a normal PC-AT CMOS RTC device, this
7640d1ba665SWarner Losh   /// value would be 1 Hz, or 1, to indicate that the device only reports
7650d1ba665SWarner Losh   /// the time to the resolution of 1 second.
7660d1ba665SWarner Losh   ///
7670d1ba665SWarner Losh   UINT32    Resolution;
7680d1ba665SWarner Losh   ///
7690d1ba665SWarner Losh   /// Provides the timekeeping accuracy of the real-time clock in an
7700d1ba665SWarner Losh   /// error rate of 1E-6 parts per million. For a clock with an accuracy
7710d1ba665SWarner Losh   /// of 50 parts per million, the value in this field would be
7720d1ba665SWarner Losh   /// 50,000,000.
7730d1ba665SWarner Losh   ///
7740d1ba665SWarner Losh   UINT32    Accuracy;
7750d1ba665SWarner Losh   ///
7760d1ba665SWarner Losh   /// A TRUE indicates that a time set operation clears the device's
7770d1ba665SWarner Losh   /// time below the Resolution reporting level. A FALSE
7780d1ba665SWarner Losh   /// indicates that the state below the Resolution level of the
7790d1ba665SWarner Losh   /// device is not cleared when the time is set. Normal PC-AT CMOS
7800d1ba665SWarner Losh   /// RTC devices set this value to FALSE.
7810d1ba665SWarner Losh   ///
7820d1ba665SWarner Losh   BOOLEAN   SetsToZero;
7830d1ba665SWarner Losh } EFI_TIME_CAPABILITIES;
7840d1ba665SWarner Losh 
7850d1ba665SWarner Losh /**
7860d1ba665SWarner Losh   Returns the current time and date information, and the time-keeping capabilities
7870d1ba665SWarner Losh   of the hardware platform.
7880d1ba665SWarner Losh 
7890d1ba665SWarner Losh   @param[out]  Time             A pointer to storage to receive a snapshot of the current time.
7900d1ba665SWarner Losh   @param[out]  Capabilities     An optional pointer to a buffer to receive the real time clock
7910d1ba665SWarner Losh                                 device's capabilities.
7920d1ba665SWarner Losh 
7930d1ba665SWarner Losh   @retval EFI_SUCCESS           The operation completed successfully.
7940d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER Time is NULL.
7950d1ba665SWarner Losh   @retval EFI_DEVICE_ERROR      The time could not be retrieved due to hardware error.
7960d1ba665SWarner Losh 
7970d1ba665SWarner Losh **/
7980d1ba665SWarner Losh typedef
7990d1ba665SWarner Losh EFI_STATUS
8000d1ba665SWarner Losh (EFIAPI *EFI_GET_TIME)(
8010d1ba665SWarner Losh   OUT  EFI_TIME                    *Time,
8020d1ba665SWarner Losh   OUT  EFI_TIME_CAPABILITIES       *Capabilities OPTIONAL
8030d1ba665SWarner Losh   );
8040d1ba665SWarner Losh 
8050d1ba665SWarner Losh /**
8060d1ba665SWarner Losh   Sets the current local time and date information.
8070d1ba665SWarner Losh 
8080d1ba665SWarner Losh   @param[in]  Time              A pointer to the current time.
8090d1ba665SWarner Losh 
8100d1ba665SWarner Losh   @retval EFI_SUCCESS           The operation completed successfully.
8110d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER A time field is out of range.
8120d1ba665SWarner Losh   @retval EFI_DEVICE_ERROR      The time could not be set due due to hardware error.
8130d1ba665SWarner Losh 
8140d1ba665SWarner Losh **/
8150d1ba665SWarner Losh typedef
8160d1ba665SWarner Losh EFI_STATUS
8170d1ba665SWarner Losh (EFIAPI *EFI_SET_TIME)(
8180d1ba665SWarner Losh   IN  EFI_TIME                     *Time
8190d1ba665SWarner Losh   );
8200d1ba665SWarner Losh 
8210d1ba665SWarner Losh /**
8220d1ba665SWarner Losh   Returns the current wakeup alarm clock setting.
8230d1ba665SWarner Losh 
8240d1ba665SWarner Losh   @param[out]  Enabled          Indicates if the alarm is currently enabled or disabled.
8250d1ba665SWarner Losh   @param[out]  Pending          Indicates if the alarm signal is pending and requires acknowledgement.
8260d1ba665SWarner Losh   @param[out]  Time             The current alarm setting.
8270d1ba665SWarner Losh 
8280d1ba665SWarner Losh   @retval EFI_SUCCESS           The alarm settings were returned.
8290d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER Enabled is NULL.
8300d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER Pending is NULL.
8310d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER Time is NULL.
8320d1ba665SWarner Losh   @retval EFI_DEVICE_ERROR      The wakeup time could not be retrieved due to a hardware error.
8330d1ba665SWarner Losh   @retval EFI_UNSUPPORTED       A wakeup timer is not supported on this platform.
8340d1ba665SWarner Losh 
8350d1ba665SWarner Losh **/
8360d1ba665SWarner Losh typedef
8370d1ba665SWarner Losh EFI_STATUS
8380d1ba665SWarner Losh (EFIAPI *EFI_GET_WAKEUP_TIME)(
8390d1ba665SWarner Losh   OUT BOOLEAN                     *Enabled,
8400d1ba665SWarner Losh   OUT BOOLEAN                     *Pending,
8410d1ba665SWarner Losh   OUT EFI_TIME                    *Time
8420d1ba665SWarner Losh   );
8430d1ba665SWarner Losh 
8440d1ba665SWarner Losh /**
8450d1ba665SWarner Losh   Sets the system wakeup alarm clock time.
8460d1ba665SWarner Losh 
8470d1ba665SWarner Losh   @param[in]  Enable            Enable or disable the wakeup alarm.
8480d1ba665SWarner Losh   @param[in]  Time              If Enable is TRUE, the time to set the wakeup alarm for.
8490d1ba665SWarner Losh                                 If Enable is FALSE, then this parameter is optional, and may be NULL.
8500d1ba665SWarner Losh 
8510d1ba665SWarner Losh   @retval EFI_SUCCESS           If Enable is TRUE, then the wakeup alarm was enabled. If
8520d1ba665SWarner Losh                                 Enable is FALSE, then the wakeup alarm was disabled.
8530d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER A time field is out of range.
8540d1ba665SWarner Losh   @retval EFI_DEVICE_ERROR      The wakeup time could not be set due to a hardware error.
8550d1ba665SWarner Losh   @retval EFI_UNSUPPORTED       A wakeup timer is not supported on this platform.
8560d1ba665SWarner Losh 
8570d1ba665SWarner Losh **/
8580d1ba665SWarner Losh typedef
8590d1ba665SWarner Losh EFI_STATUS
8600d1ba665SWarner Losh (EFIAPI *EFI_SET_WAKEUP_TIME)(
8610d1ba665SWarner Losh   IN  BOOLEAN                      Enable,
8620d1ba665SWarner Losh   IN  EFI_TIME                     *Time   OPTIONAL
8630d1ba665SWarner Losh   );
8640d1ba665SWarner Losh 
8650d1ba665SWarner Losh /**
8660d1ba665SWarner Losh   Loads an EFI image into memory.
8670d1ba665SWarner Losh 
8680d1ba665SWarner Losh   @param[in]   BootPolicy        If TRUE, indicates that the request originates from the boot
8690d1ba665SWarner Losh                                  manager, and that the boot manager is attempting to load
8700d1ba665SWarner Losh                                  FilePath as a boot selection. Ignored if SourceBuffer is
8710d1ba665SWarner Losh                                  not NULL.
8720d1ba665SWarner Losh   @param[in]   ParentImageHandle The caller's image handle.
8730d1ba665SWarner Losh   @param[in]   DevicePath        The DeviceHandle specific file path from which the image is
8740d1ba665SWarner Losh                                  loaded.
8750d1ba665SWarner Losh   @param[in]   SourceBuffer      If not NULL, a pointer to the memory location containing a copy
8760d1ba665SWarner Losh                                  of the image to be loaded.
8770d1ba665SWarner Losh   @param[in]   SourceSize        The size in bytes of SourceBuffer. Ignored if SourceBuffer is NULL.
8780d1ba665SWarner Losh   @param[out]  ImageHandle       The pointer to the returned image handle that is created when the
8790d1ba665SWarner Losh                                  image is successfully loaded.
8800d1ba665SWarner Losh 
8810d1ba665SWarner Losh   @retval EFI_SUCCESS            Image was loaded into memory correctly.
8820d1ba665SWarner Losh   @retval EFI_NOT_FOUND          Both SourceBuffer and DevicePath are NULL.
8830d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER  One or more parametes are invalid.
8840d1ba665SWarner Losh   @retval EFI_UNSUPPORTED        The image type is not supported.
8850d1ba665SWarner Losh   @retval EFI_OUT_OF_RESOURCES   Image was not loaded due to insufficient resources.
8860d1ba665SWarner Losh   @retval EFI_LOAD_ERROR         Image was not loaded because the image format was corrupt or not
8870d1ba665SWarner Losh                                  understood.
8880d1ba665SWarner Losh   @retval EFI_DEVICE_ERROR       Image was not loaded because the device returned a read error.
8890d1ba665SWarner Losh   @retval EFI_ACCESS_DENIED      Image was not loaded because the platform policy prohibits the
8900d1ba665SWarner Losh                                  image from being loaded. NULL is returned in *ImageHandle.
8910d1ba665SWarner Losh   @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a
8920d1ba665SWarner Losh                                  valid EFI_LOADED_IMAGE_PROTOCOL. However, the current
8930d1ba665SWarner Losh                                  platform policy specifies that the image should not be started.
8940d1ba665SWarner Losh **/
8950d1ba665SWarner Losh typedef
8960d1ba665SWarner Losh EFI_STATUS
8970d1ba665SWarner Losh (EFIAPI *EFI_IMAGE_LOAD)(
8980d1ba665SWarner Losh   IN  BOOLEAN                      BootPolicy,
8990d1ba665SWarner Losh   IN  EFI_HANDLE                   ParentImageHandle,
9000d1ba665SWarner Losh   IN  EFI_DEVICE_PATH_PROTOCOL     *DevicePath,
9010d1ba665SWarner Losh   IN  VOID                         *SourceBuffer OPTIONAL,
9020d1ba665SWarner Losh   IN  UINTN                        SourceSize,
9030d1ba665SWarner Losh   OUT EFI_HANDLE                   *ImageHandle
9040d1ba665SWarner Losh   );
9050d1ba665SWarner Losh 
9060d1ba665SWarner Losh /**
9070d1ba665SWarner Losh   Transfers control to a loaded image's entry point.
9080d1ba665SWarner Losh 
9090d1ba665SWarner Losh   @param[in]   ImageHandle       Handle of image to be started.
9100d1ba665SWarner Losh   @param[out]  ExitDataSize      The pointer to the size, in bytes, of ExitData.
9110d1ba665SWarner Losh   @param[out]  ExitData          The pointer to a pointer to a data buffer that includes a Null-terminated
9120d1ba665SWarner Losh                                  string, optionally followed by additional binary data.
9130d1ba665SWarner Losh 
9140d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER  ImageHandle is either an invalid image handle or the image
9150d1ba665SWarner Losh                                  has already been initialized with StartImage.
9160d1ba665SWarner Losh   @retval EFI_SECURITY_VIOLATION The current platform policy specifies that the image should not be started.
9170d1ba665SWarner Losh   @return Exit code from image
9180d1ba665SWarner Losh 
9190d1ba665SWarner Losh **/
9200d1ba665SWarner Losh typedef
9210d1ba665SWarner Losh EFI_STATUS
9220d1ba665SWarner Losh (EFIAPI *EFI_IMAGE_START)(
9230d1ba665SWarner Losh   IN  EFI_HANDLE                  ImageHandle,
9240d1ba665SWarner Losh   OUT UINTN                       *ExitDataSize,
9250d1ba665SWarner Losh   OUT CHAR16                      **ExitData    OPTIONAL
9260d1ba665SWarner Losh   );
9270d1ba665SWarner Losh 
9280d1ba665SWarner Losh /**
9290d1ba665SWarner Losh   Terminates a loaded EFI image and returns control to boot services.
9300d1ba665SWarner Losh 
9310d1ba665SWarner Losh   @param[in]  ImageHandle       Handle that identifies the image. This parameter is passed to the
9320d1ba665SWarner Losh                                 image on entry.
9330d1ba665SWarner Losh   @param[in]  ExitStatus        The image's exit code.
9340d1ba665SWarner Losh   @param[in]  ExitDataSize      The size, in bytes, of ExitData. Ignored if ExitStatus is EFI_SUCCESS.
9350d1ba665SWarner Losh   @param[in]  ExitData          The pointer to a data buffer that includes a Null-terminated string,
9360d1ba665SWarner Losh                                 optionally followed by additional binary data. The string is a
9370d1ba665SWarner Losh                                 description that the caller may use to further indicate the reason
9380d1ba665SWarner Losh                                 for the image's exit. ExitData is only valid if ExitStatus
9390d1ba665SWarner Losh                                 is something other than EFI_SUCCESS. The ExitData buffer
9400d1ba665SWarner Losh                                 must be allocated by calling AllocatePool().
9410d1ba665SWarner Losh 
9420d1ba665SWarner Losh   @retval EFI_SUCCESS           The image specified by ImageHandle was unloaded.
9430d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER The image specified by ImageHandle has been loaded and
9440d1ba665SWarner Losh                                 started with LoadImage() and StartImage(), but the
9450d1ba665SWarner Losh                                 image is not the currently executing image.
9460d1ba665SWarner Losh 
9470d1ba665SWarner Losh **/
9480d1ba665SWarner Losh typedef
9490d1ba665SWarner Losh EFI_STATUS
9500d1ba665SWarner Losh (EFIAPI *EFI_EXIT)(
9510d1ba665SWarner Losh   IN  EFI_HANDLE                   ImageHandle,
9520d1ba665SWarner Losh   IN  EFI_STATUS                   ExitStatus,
9530d1ba665SWarner Losh   IN  UINTN                        ExitDataSize,
9540d1ba665SWarner Losh   IN  CHAR16                       *ExitData     OPTIONAL
9550d1ba665SWarner Losh   );
9560d1ba665SWarner Losh 
9570d1ba665SWarner Losh /**
9580d1ba665SWarner Losh   Unloads an image.
9590d1ba665SWarner Losh 
9600d1ba665SWarner Losh   @param[in]  ImageHandle       Handle that identifies the image to be unloaded.
9610d1ba665SWarner Losh 
9620d1ba665SWarner Losh   @retval EFI_SUCCESS           The image has been unloaded.
9630d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle.
9640d1ba665SWarner Losh 
9650d1ba665SWarner Losh **/
9660d1ba665SWarner Losh typedef
9670d1ba665SWarner Losh EFI_STATUS
9680d1ba665SWarner Losh (EFIAPI *EFI_IMAGE_UNLOAD)(
9690d1ba665SWarner Losh   IN  EFI_HANDLE                   ImageHandle
9700d1ba665SWarner Losh   );
9710d1ba665SWarner Losh 
9720d1ba665SWarner Losh /**
9730d1ba665SWarner Losh   Terminates all boot services.
9740d1ba665SWarner Losh 
9750d1ba665SWarner Losh   @param[in]  ImageHandle       Handle that identifies the exiting image.
9760d1ba665SWarner Losh   @param[in]  MapKey            Key to the latest memory map.
9770d1ba665SWarner Losh 
9780d1ba665SWarner Losh   @retval EFI_SUCCESS           Boot services have been terminated.
9790d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER MapKey is incorrect.
9800d1ba665SWarner Losh 
9810d1ba665SWarner Losh **/
9820d1ba665SWarner Losh typedef
9830d1ba665SWarner Losh EFI_STATUS
9840d1ba665SWarner Losh (EFIAPI *EFI_EXIT_BOOT_SERVICES)(
9850d1ba665SWarner Losh   IN  EFI_HANDLE                   ImageHandle,
9860d1ba665SWarner Losh   IN  UINTN                        MapKey
9870d1ba665SWarner Losh   );
9880d1ba665SWarner Losh 
9890d1ba665SWarner Losh /**
9900d1ba665SWarner Losh   Induces a fine-grained stall.
9910d1ba665SWarner Losh 
9920d1ba665SWarner Losh   @param[in]  Microseconds      The number of microseconds to stall execution.
9930d1ba665SWarner Losh 
9940d1ba665SWarner Losh   @retval EFI_SUCCESS           Execution was stalled at least the requested number of
9950d1ba665SWarner Losh                                 Microseconds.
9960d1ba665SWarner Losh 
9970d1ba665SWarner Losh **/
9980d1ba665SWarner Losh typedef
9990d1ba665SWarner Losh EFI_STATUS
10000d1ba665SWarner Losh (EFIAPI *EFI_STALL)(
10010d1ba665SWarner Losh   IN  UINTN                    Microseconds
10020d1ba665SWarner Losh   );
10030d1ba665SWarner Losh 
10040d1ba665SWarner Losh /**
10050d1ba665SWarner Losh   Sets the system's watchdog timer.
10060d1ba665SWarner Losh 
10070d1ba665SWarner Losh   @param[in]  Timeout           The number of seconds to set the watchdog timer to.
10080d1ba665SWarner Losh   @param[in]  WatchdogCode      The numeric code to log on a watchdog timer timeout event.
10090d1ba665SWarner Losh   @param[in]  DataSize          The size, in bytes, of WatchdogData.
10100d1ba665SWarner Losh   @param[in]  WatchdogData      A data buffer that includes a Null-terminated string, optionally
10110d1ba665SWarner Losh                                 followed by additional binary data.
10120d1ba665SWarner Losh 
10130d1ba665SWarner Losh   @retval EFI_SUCCESS           The timeout has been set.
10140d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER The supplied WatchdogCode is invalid.
10150d1ba665SWarner Losh   @retval EFI_UNSUPPORTED       The system does not have a watchdog timer.
10160d1ba665SWarner Losh   @retval EFI_DEVICE_ERROR      The watchdog timer could not be programmed due to a hardware
10170d1ba665SWarner Losh                                 error.
10180d1ba665SWarner Losh 
10190d1ba665SWarner Losh **/
10200d1ba665SWarner Losh typedef
10210d1ba665SWarner Losh EFI_STATUS
10220d1ba665SWarner Losh (EFIAPI *EFI_SET_WATCHDOG_TIMER)(
10230d1ba665SWarner Losh   IN UINTN                    Timeout,
10240d1ba665SWarner Losh   IN UINT64                   WatchdogCode,
10250d1ba665SWarner Losh   IN UINTN                    DataSize,
10260d1ba665SWarner Losh   IN CHAR16                   *WatchdogData OPTIONAL
10270d1ba665SWarner Losh   );
10280d1ba665SWarner Losh 
10290d1ba665SWarner Losh /**
10300d1ba665SWarner Losh   Resets the entire platform.
10310d1ba665SWarner Losh 
10320d1ba665SWarner Losh   @param[in]  ResetType         The type of reset to perform.
10330d1ba665SWarner Losh   @param[in]  ResetStatus       The status code for the reset.
10340d1ba665SWarner Losh   @param[in]  DataSize          The size, in bytes, of ResetData.
10350d1ba665SWarner Losh   @param[in]  ResetData         For a ResetType of EfiResetCold, EfiResetWarm, or
10360d1ba665SWarner Losh                                 EfiResetShutdown the data buffer starts with a Null-terminated
10370d1ba665SWarner Losh                                 string, optionally followed by additional binary data.
10380d1ba665SWarner Losh                                 The string is a description that the caller may use to further
1039*3245fa21SMitchell Horne                                 indicate the reason for the system reset.
1040*3245fa21SMitchell Horne                                 For a ResetType of EfiResetPlatformSpecific the data buffer
1041*3245fa21SMitchell Horne                                 also starts with a Null-terminated string that is followed
1042*3245fa21SMitchell Horne                                 by an EFI_GUID that describes the specific type of reset to perform.
10430d1ba665SWarner Losh **/
10440d1ba665SWarner Losh typedef
10450d1ba665SWarner Losh VOID
10460d1ba665SWarner Losh (EFIAPI *EFI_RESET_SYSTEM)(
10470d1ba665SWarner Losh   IN EFI_RESET_TYPE           ResetType,
10480d1ba665SWarner Losh   IN EFI_STATUS               ResetStatus,
10490d1ba665SWarner Losh   IN UINTN                    DataSize,
10500d1ba665SWarner Losh   IN VOID                     *ResetData OPTIONAL
10510d1ba665SWarner Losh   );
10520d1ba665SWarner Losh 
10530d1ba665SWarner Losh /**
10540d1ba665SWarner Losh   Returns a monotonically increasing count for the platform.
10550d1ba665SWarner Losh 
10560d1ba665SWarner Losh   @param[out]  Count            The pointer to returned value.
10570d1ba665SWarner Losh 
10580d1ba665SWarner Losh   @retval EFI_SUCCESS           The next monotonic count was returned.
10590d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER Count is NULL.
10600d1ba665SWarner Losh   @retval EFI_DEVICE_ERROR      The device is not functioning properly.
10610d1ba665SWarner Losh 
10620d1ba665SWarner Losh **/
10630d1ba665SWarner Losh typedef
10640d1ba665SWarner Losh EFI_STATUS
10650d1ba665SWarner Losh (EFIAPI *EFI_GET_NEXT_MONOTONIC_COUNT)(
10660d1ba665SWarner Losh   OUT UINT64                  *Count
10670d1ba665SWarner Losh   );
10680d1ba665SWarner Losh 
10690d1ba665SWarner Losh /**
10700d1ba665SWarner Losh   Returns the next high 32 bits of the platform's monotonic counter.
10710d1ba665SWarner Losh 
10720d1ba665SWarner Losh   @param[out]  HighCount        The pointer to returned value.
10730d1ba665SWarner Losh 
10740d1ba665SWarner Losh   @retval EFI_SUCCESS           The next high monotonic count was returned.
10750d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER HighCount is NULL.
10760d1ba665SWarner Losh   @retval EFI_DEVICE_ERROR      The device is not functioning properly.
10770d1ba665SWarner Losh 
10780d1ba665SWarner Losh **/
10790d1ba665SWarner Losh typedef
10800d1ba665SWarner Losh EFI_STATUS
10810d1ba665SWarner Losh (EFIAPI *EFI_GET_NEXT_HIGH_MONO_COUNT)(
10820d1ba665SWarner Losh   OUT UINT32                  *HighCount
10830d1ba665SWarner Losh   );
10840d1ba665SWarner Losh 
10850d1ba665SWarner Losh /**
10860d1ba665SWarner Losh   Computes and returns a 32-bit CRC for a data buffer.
10870d1ba665SWarner Losh 
10880d1ba665SWarner Losh   @param[in]   Data             A pointer to the buffer on which the 32-bit CRC is to be computed.
10890d1ba665SWarner Losh   @param[in]   DataSize         The number of bytes in the buffer Data.
10900d1ba665SWarner Losh   @param[out]  Crc32            The 32-bit CRC that was computed for the data buffer specified by Data
10910d1ba665SWarner Losh                                 and DataSize.
10920d1ba665SWarner Losh 
10930d1ba665SWarner Losh   @retval EFI_SUCCESS           The 32-bit CRC was computed for the data buffer and returned in
10940d1ba665SWarner Losh                                 Crc32.
10950d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER Data is NULL.
10960d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER Crc32 is NULL.
10970d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER DataSize is 0.
10980d1ba665SWarner Losh 
10990d1ba665SWarner Losh **/
11000d1ba665SWarner Losh typedef
11010d1ba665SWarner Losh EFI_STATUS
11020d1ba665SWarner Losh (EFIAPI *EFI_CALCULATE_CRC32)(
11030d1ba665SWarner Losh   IN  VOID                              *Data,
11040d1ba665SWarner Losh   IN  UINTN                             DataSize,
11050d1ba665SWarner Losh   OUT UINT32                            *Crc32
11060d1ba665SWarner Losh   );
11070d1ba665SWarner Losh 
11080d1ba665SWarner Losh /**
11090d1ba665SWarner Losh   Copies the contents of one buffer to another buffer.
11100d1ba665SWarner Losh 
11110d1ba665SWarner Losh   @param[in]  Destination       The pointer to the destination buffer of the memory copy.
11120d1ba665SWarner Losh   @param[in]  Source            The pointer to the source buffer of the memory copy.
11130d1ba665SWarner Losh   @param[in]  Length            Number of bytes to copy from Source to Destination.
11140d1ba665SWarner Losh 
11150d1ba665SWarner Losh **/
11160d1ba665SWarner Losh typedef
11170d1ba665SWarner Losh VOID
11180d1ba665SWarner Losh (EFIAPI *EFI_COPY_MEM)(
11190d1ba665SWarner Losh   IN VOID     *Destination,
11200d1ba665SWarner Losh   IN VOID     *Source,
11210d1ba665SWarner Losh   IN UINTN    Length
11220d1ba665SWarner Losh   );
11230d1ba665SWarner Losh 
11240d1ba665SWarner Losh /**
11250d1ba665SWarner Losh   The SetMem() function fills a buffer with a specified value.
11260d1ba665SWarner Losh 
11270d1ba665SWarner Losh   @param[in]  Buffer            The pointer to the buffer to fill.
11280d1ba665SWarner Losh   @param[in]  Size              Number of bytes in Buffer to fill.
11290d1ba665SWarner Losh   @param[in]  Value             Value to fill Buffer with.
11300d1ba665SWarner Losh 
11310d1ba665SWarner Losh **/
11320d1ba665SWarner Losh typedef
11330d1ba665SWarner Losh VOID
11340d1ba665SWarner Losh (EFIAPI *EFI_SET_MEM)(
11350d1ba665SWarner Losh   IN VOID     *Buffer,
11360d1ba665SWarner Losh   IN UINTN    Size,
11370d1ba665SWarner Losh   IN UINT8    Value
11380d1ba665SWarner Losh   );
11390d1ba665SWarner Losh 
11400d1ba665SWarner Losh ///
11410d1ba665SWarner Losh /// Enumeration of EFI Interface Types
11420d1ba665SWarner Losh ///
11430d1ba665SWarner Losh typedef enum {
11440d1ba665SWarner Losh   ///
11450d1ba665SWarner Losh   /// Indicates that the supplied protocol interface is supplied in native form.
11460d1ba665SWarner Losh   ///
11470d1ba665SWarner Losh   EFI_NATIVE_INTERFACE
11480d1ba665SWarner Losh } EFI_INTERFACE_TYPE;
11490d1ba665SWarner Losh 
11500d1ba665SWarner Losh /**
11510d1ba665SWarner Losh   Installs a protocol interface on a device handle. If the handle does not exist, it is created and added
11520d1ba665SWarner Losh   to the list of handles in the system. InstallMultipleProtocolInterfaces() performs
11530d1ba665SWarner Losh   more error checking than InstallProtocolInterface(), so it is recommended that
11540d1ba665SWarner Losh   InstallMultipleProtocolInterfaces() be used in place of
11550d1ba665SWarner Losh   InstallProtocolInterface()
11560d1ba665SWarner Losh 
11570d1ba665SWarner Losh   @param[in, out]  Handle         A pointer to the EFI_HANDLE on which the interface is to be installed.
11580d1ba665SWarner Losh   @param[in]       Protocol       The numeric ID of the protocol interface.
11590d1ba665SWarner Losh   @param[in]       InterfaceType  Indicates whether Interface is supplied in native form.
11600d1ba665SWarner Losh   @param[in]       Interface      A pointer to the protocol interface.
11610d1ba665SWarner Losh 
11620d1ba665SWarner Losh   @retval EFI_SUCCESS           The protocol interface was installed.
11630d1ba665SWarner Losh   @retval EFI_OUT_OF_RESOURCES  Space for a new handle could not be allocated.
11640d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER Handle is NULL.
11650d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER Protocol is NULL.
11660d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER InterfaceType is not EFI_NATIVE_INTERFACE.
11670d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER Protocol is already installed on the handle specified by Handle.
11680d1ba665SWarner Losh 
11690d1ba665SWarner Losh **/
11700d1ba665SWarner Losh typedef
11710d1ba665SWarner Losh EFI_STATUS
11720d1ba665SWarner Losh (EFIAPI *EFI_INSTALL_PROTOCOL_INTERFACE)(
11730d1ba665SWarner Losh   IN OUT EFI_HANDLE               *Handle,
11740d1ba665SWarner Losh   IN     EFI_GUID                 *Protocol,
11750d1ba665SWarner Losh   IN     EFI_INTERFACE_TYPE       InterfaceType,
11760d1ba665SWarner Losh   IN     VOID                     *Interface
11770d1ba665SWarner Losh   );
11780d1ba665SWarner Losh 
11790d1ba665SWarner Losh /**
11800d1ba665SWarner Losh   Installs one or more protocol interfaces into the boot services environment.
11810d1ba665SWarner Losh 
11820d1ba665SWarner Losh   @param[in, out]  Handle       The pointer to a handle to install the new protocol interfaces on,
11830d1ba665SWarner Losh                                 or a pointer to NULL if a new handle is to be allocated.
11840d1ba665SWarner Losh   @param  ...                   A variable argument list containing pairs of protocol GUIDs and protocol
11850d1ba665SWarner Losh                                 interfaces.
11860d1ba665SWarner Losh 
11870d1ba665SWarner Losh   @retval EFI_SUCCESS           All the protocol interface was installed.
11880d1ba665SWarner Losh   @retval EFI_OUT_OF_RESOURCES  There was not enough memory in pool to install all the protocols.
11890d1ba665SWarner Losh   @retval EFI_ALREADY_STARTED   A Device Path Protocol instance was passed in that is already present in
11900d1ba665SWarner Losh                                 the handle database.
11910d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER Handle is NULL.
11920d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER Protocol is already installed on the handle specified by Handle.
11930d1ba665SWarner Losh 
11940d1ba665SWarner Losh **/
11950d1ba665SWarner Losh typedef
11960d1ba665SWarner Losh EFI_STATUS
11970d1ba665SWarner Losh (EFIAPI *EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES)(
11980d1ba665SWarner Losh   IN OUT EFI_HANDLE           *Handle,
11990d1ba665SWarner Losh   ...
12000d1ba665SWarner Losh   );
12010d1ba665SWarner Losh 
12020d1ba665SWarner Losh /**
12030d1ba665SWarner Losh   Reinstalls a protocol interface on a device handle.
12040d1ba665SWarner Losh 
12050d1ba665SWarner Losh   @param[in]  Handle            Handle on which the interface is to be reinstalled.
12060d1ba665SWarner Losh   @param[in]  Protocol          The numeric ID of the interface.
12070d1ba665SWarner Losh   @param[in]  OldInterface      A pointer to the old interface. NULL can be used if a structure is not
12080d1ba665SWarner Losh                                 associated with Protocol.
12090d1ba665SWarner Losh   @param[in]  NewInterface      A pointer to the new interface.
12100d1ba665SWarner Losh 
12110d1ba665SWarner Losh   @retval EFI_SUCCESS           The protocol interface was reinstalled.
12120d1ba665SWarner Losh   @retval EFI_NOT_FOUND         The OldInterface on the handle was not found.
12130d1ba665SWarner Losh   @retval EFI_ACCESS_DENIED     The protocol interface could not be reinstalled,
12140d1ba665SWarner Losh                                 because OldInterface is still being used by a
12150d1ba665SWarner Losh                                 driver that will not release it.
12160d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER Handle is NULL.
12170d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER Protocol is NULL.
12180d1ba665SWarner Losh 
12190d1ba665SWarner Losh **/
12200d1ba665SWarner Losh typedef
12210d1ba665SWarner Losh EFI_STATUS
12220d1ba665SWarner Losh (EFIAPI *EFI_REINSTALL_PROTOCOL_INTERFACE)(
12230d1ba665SWarner Losh   IN EFI_HANDLE               Handle,
12240d1ba665SWarner Losh   IN EFI_GUID                 *Protocol,
12250d1ba665SWarner Losh   IN VOID                     *OldInterface,
12260d1ba665SWarner Losh   IN VOID                     *NewInterface
12270d1ba665SWarner Losh   );
12280d1ba665SWarner Losh 
12290d1ba665SWarner Losh /**
12300d1ba665SWarner Losh   Removes a protocol interface from a device handle. It is recommended that
12310d1ba665SWarner Losh   UninstallMultipleProtocolInterfaces() be used in place of
12320d1ba665SWarner Losh   UninstallProtocolInterface().
12330d1ba665SWarner Losh 
12340d1ba665SWarner Losh   @param[in]  Handle            The handle on which the interface was installed.
12350d1ba665SWarner Losh   @param[in]  Protocol          The numeric ID of the interface.
12360d1ba665SWarner Losh   @param[in]  Interface         A pointer to the interface.
12370d1ba665SWarner Losh 
12380d1ba665SWarner Losh   @retval EFI_SUCCESS           The interface was removed.
12390d1ba665SWarner Losh   @retval EFI_NOT_FOUND         The interface was not found.
12400d1ba665SWarner Losh   @retval EFI_ACCESS_DENIED     The interface was not removed because the interface
12410d1ba665SWarner Losh                                 is still being used by a driver.
12420d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER Handle is NULL.
12430d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER Protocol is NULL.
12440d1ba665SWarner Losh 
12450d1ba665SWarner Losh **/
12460d1ba665SWarner Losh typedef
12470d1ba665SWarner Losh EFI_STATUS
12480d1ba665SWarner Losh (EFIAPI *EFI_UNINSTALL_PROTOCOL_INTERFACE)(
12490d1ba665SWarner Losh   IN EFI_HANDLE               Handle,
12500d1ba665SWarner Losh   IN EFI_GUID                 *Protocol,
12510d1ba665SWarner Losh   IN VOID                     *Interface
12520d1ba665SWarner Losh   );
12530d1ba665SWarner Losh 
12540d1ba665SWarner Losh /**
12550d1ba665SWarner Losh   Removes one or more protocol interfaces into the boot services environment.
12560d1ba665SWarner Losh 
12570d1ba665SWarner Losh   @param[in]  Handle            The handle to remove the protocol interfaces from.
12580d1ba665SWarner Losh   @param  ...                   A variable argument list containing pairs of protocol GUIDs and
12590d1ba665SWarner Losh                                 protocol interfaces.
12600d1ba665SWarner Losh 
12610d1ba665SWarner Losh   @retval EFI_SUCCESS           All the protocol interfaces were removed.
12620d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER One of the protocol interfaces was not previously installed on Handle.
12630d1ba665SWarner Losh 
12640d1ba665SWarner Losh **/
12650d1ba665SWarner Losh typedef
12660d1ba665SWarner Losh EFI_STATUS
12670d1ba665SWarner Losh (EFIAPI *EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES)(
12680d1ba665SWarner Losh   IN EFI_HANDLE           Handle,
12690d1ba665SWarner Losh   ...
12700d1ba665SWarner Losh   );
12710d1ba665SWarner Losh 
12720d1ba665SWarner Losh /**
12730d1ba665SWarner Losh   Queries a handle to determine if it supports a specified protocol.
12740d1ba665SWarner Losh 
12750d1ba665SWarner Losh   @param[in]   Handle           The handle being queried.
12760d1ba665SWarner Losh   @param[in]   Protocol         The published unique identifier of the protocol.
12770d1ba665SWarner Losh   @param[out]  Interface        Supplies the address where a pointer to the corresponding Protocol
12780d1ba665SWarner Losh                                 Interface is returned.
12790d1ba665SWarner Losh 
12800d1ba665SWarner Losh   @retval EFI_SUCCESS           The interface information for the specified protocol was returned.
12810d1ba665SWarner Losh   @retval EFI_UNSUPPORTED       The device does not support the specified protocol.
12820d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER Handle is NULL.
12830d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER Protocol is NULL.
12840d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER Interface is NULL.
12850d1ba665SWarner Losh 
12860d1ba665SWarner Losh **/
12870d1ba665SWarner Losh typedef
12880d1ba665SWarner Losh EFI_STATUS
12890d1ba665SWarner Losh (EFIAPI *EFI_HANDLE_PROTOCOL)(
12900d1ba665SWarner Losh   IN  EFI_HANDLE               Handle,
12910d1ba665SWarner Losh   IN  EFI_GUID                 *Protocol,
12920d1ba665SWarner Losh   OUT VOID                     **Interface
12930d1ba665SWarner Losh   );
12940d1ba665SWarner Losh 
12950d1ba665SWarner Losh #define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL  0x00000001
12960d1ba665SWarner Losh #define EFI_OPEN_PROTOCOL_GET_PROTOCOL        0x00000002
12970d1ba665SWarner Losh #define EFI_OPEN_PROTOCOL_TEST_PROTOCOL       0x00000004
12980d1ba665SWarner Losh #define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008
12990d1ba665SWarner Losh #define EFI_OPEN_PROTOCOL_BY_DRIVER           0x00000010
13000d1ba665SWarner Losh #define EFI_OPEN_PROTOCOL_EXCLUSIVE           0x00000020
13010d1ba665SWarner Losh 
13020d1ba665SWarner Losh /**
13030d1ba665SWarner Losh   Queries a handle to determine if it supports a specified protocol. If the protocol is supported by the
13040d1ba665SWarner Losh   handle, it opens the protocol on behalf of the calling agent.
13050d1ba665SWarner Losh 
13060d1ba665SWarner Losh   @param[in]   Handle           The handle for the protocol interface that is being opened.
13070d1ba665SWarner Losh   @param[in]   Protocol         The published unique identifier of the protocol.
13080d1ba665SWarner Losh   @param[out]  Interface        Supplies the address where a pointer to the corresponding Protocol
13090d1ba665SWarner Losh                                 Interface is returned.
13100d1ba665SWarner Losh   @param[in]   AgentHandle      The handle of the agent that is opening the protocol interface
13110d1ba665SWarner Losh                                 specified by Protocol and Interface.
13120d1ba665SWarner Losh   @param[in]   ControllerHandle If the agent that is opening a protocol is a driver that follows the
13130d1ba665SWarner Losh                                 UEFI Driver Model, then this parameter is the controller handle
13140d1ba665SWarner Losh                                 that requires the protocol interface. If the agent does not follow
13150d1ba665SWarner Losh                                 the UEFI Driver Model, then this parameter is optional and may
13160d1ba665SWarner Losh                                 be NULL.
13170d1ba665SWarner Losh   @param[in]   Attributes       The open mode of the protocol interface specified by Handle
13180d1ba665SWarner Losh                                 and Protocol.
13190d1ba665SWarner Losh 
13200d1ba665SWarner Losh   @retval EFI_SUCCESS           An item was added to the open list for the protocol interface, and the
13210d1ba665SWarner Losh                                 protocol interface was returned in Interface.
13220d1ba665SWarner Losh   @retval EFI_UNSUPPORTED       Handle does not support Protocol.
13230d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
13240d1ba665SWarner Losh   @retval EFI_ACCESS_DENIED     Required attributes can't be supported in current environment.
13250d1ba665SWarner Losh   @retval EFI_ALREADY_STARTED   Item on the open list already has requierd attributes whose agent
13260d1ba665SWarner Losh                                 handle is the same as AgentHandle.
13270d1ba665SWarner Losh 
13280d1ba665SWarner Losh **/
13290d1ba665SWarner Losh typedef
13300d1ba665SWarner Losh EFI_STATUS
13310d1ba665SWarner Losh (EFIAPI *EFI_OPEN_PROTOCOL)(
13320d1ba665SWarner Losh   IN  EFI_HANDLE                Handle,
13330d1ba665SWarner Losh   IN  EFI_GUID                  *Protocol,
13340d1ba665SWarner Losh   OUT VOID                      **Interface, OPTIONAL
13350d1ba665SWarner Losh   IN  EFI_HANDLE                AgentHandle,
13360d1ba665SWarner Losh   IN  EFI_HANDLE                ControllerHandle,
13370d1ba665SWarner Losh   IN  UINT32                    Attributes
13380d1ba665SWarner Losh   );
13390d1ba665SWarner Losh 
13400d1ba665SWarner Losh 
13410d1ba665SWarner Losh /**
13420d1ba665SWarner Losh   Closes a protocol on a handle that was opened using OpenProtocol().
13430d1ba665SWarner Losh 
13440d1ba665SWarner Losh   @param[in]  Handle            The handle for the protocol interface that was previously opened
13450d1ba665SWarner Losh                                 with OpenProtocol(), and is now being closed.
13460d1ba665SWarner Losh   @param[in]  Protocol          The published unique identifier of the protocol.
13470d1ba665SWarner Losh   @param[in]  AgentHandle       The handle of the agent that is closing the protocol interface.
13480d1ba665SWarner Losh   @param[in]  ControllerHandle  If the agent that opened a protocol is a driver that follows the
13490d1ba665SWarner Losh                                 UEFI Driver Model, then this parameter is the controller handle
13500d1ba665SWarner Losh                                 that required the protocol interface.
13510d1ba665SWarner Losh 
13520d1ba665SWarner Losh   @retval EFI_SUCCESS           The protocol instance was closed.
13530d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER 1) Handle is NULL.
13540d1ba665SWarner Losh                                 2) AgentHandle is NULL.
13550d1ba665SWarner Losh                                 3) ControllerHandle is not NULL and ControllerHandle is not a valid EFI_HANDLE.
13560d1ba665SWarner Losh                                 4) Protocol is NULL.
13570d1ba665SWarner Losh   @retval EFI_NOT_FOUND         1) Handle does not support the protocol specified by Protocol.
13580d1ba665SWarner Losh                                 2) The protocol interface specified by Handle and Protocol is not
13590d1ba665SWarner Losh                                    currently open by AgentHandle and ControllerHandle.
13600d1ba665SWarner Losh 
13610d1ba665SWarner Losh **/
13620d1ba665SWarner Losh typedef
13630d1ba665SWarner Losh EFI_STATUS
13640d1ba665SWarner Losh (EFIAPI *EFI_CLOSE_PROTOCOL)(
13650d1ba665SWarner Losh   IN EFI_HANDLE               Handle,
13660d1ba665SWarner Losh   IN EFI_GUID                 *Protocol,
13670d1ba665SWarner Losh   IN EFI_HANDLE               AgentHandle,
13680d1ba665SWarner Losh   IN EFI_HANDLE               ControllerHandle
13690d1ba665SWarner Losh   );
13700d1ba665SWarner Losh 
13710d1ba665SWarner Losh ///
13720d1ba665SWarner Losh /// EFI Oprn Protocol Information Entry
13730d1ba665SWarner Losh ///
13740d1ba665SWarner Losh typedef struct {
13750d1ba665SWarner Losh   EFI_HANDLE  AgentHandle;
13760d1ba665SWarner Losh   EFI_HANDLE  ControllerHandle;
13770d1ba665SWarner Losh   UINT32      Attributes;
13780d1ba665SWarner Losh   UINT32      OpenCount;
13790d1ba665SWarner Losh } EFI_OPEN_PROTOCOL_INFORMATION_ENTRY;
13800d1ba665SWarner Losh 
13810d1ba665SWarner Losh /**
13820d1ba665SWarner Losh   Retrieves the list of agents that currently have a protocol interface opened.
13830d1ba665SWarner Losh 
13840d1ba665SWarner Losh   @param[in]   Handle           The handle for the protocol interface that is being queried.
13850d1ba665SWarner Losh   @param[in]   Protocol         The published unique identifier of the protocol.
13860d1ba665SWarner Losh   @param[out]  EntryBuffer      A pointer to a buffer of open protocol information in the form of
13870d1ba665SWarner Losh                                 EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.
13880d1ba665SWarner Losh   @param[out]  EntryCount       A pointer to the number of entries in EntryBuffer.
13890d1ba665SWarner Losh 
13900d1ba665SWarner Losh   @retval EFI_SUCCESS           The open protocol information was returned in EntryBuffer, and the
13910d1ba665SWarner Losh                                 number of entries was returned EntryCount.
13920d1ba665SWarner Losh   @retval EFI_OUT_OF_RESOURCES  There are not enough resources available to allocate EntryBuffer.
13930d1ba665SWarner Losh   @retval EFI_NOT_FOUND         Handle does not support the protocol specified by Protocol.
13940d1ba665SWarner Losh 
13950d1ba665SWarner Losh **/
13960d1ba665SWarner Losh typedef
13970d1ba665SWarner Losh EFI_STATUS
13980d1ba665SWarner Losh (EFIAPI *EFI_OPEN_PROTOCOL_INFORMATION)(
13990d1ba665SWarner Losh   IN  EFI_HANDLE                          Handle,
14000d1ba665SWarner Losh   IN  EFI_GUID                            *Protocol,
14010d1ba665SWarner Losh   OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,
14020d1ba665SWarner Losh   OUT UINTN                               *EntryCount
14030d1ba665SWarner Losh   );
14040d1ba665SWarner Losh 
14050d1ba665SWarner Losh /**
14060d1ba665SWarner Losh   Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated
14070d1ba665SWarner Losh   from pool.
14080d1ba665SWarner Losh 
14090d1ba665SWarner Losh   @param[in]   Handle              The handle from which to retrieve the list of protocol interface
14100d1ba665SWarner Losh                                    GUIDs.
14110d1ba665SWarner Losh   @param[out]  ProtocolBuffer      A pointer to the list of protocol interface GUID pointers that are
14120d1ba665SWarner Losh                                    installed on Handle.
14130d1ba665SWarner Losh   @param[out]  ProtocolBufferCount A pointer to the number of GUID pointers present in
14140d1ba665SWarner Losh                                    ProtocolBuffer.
14150d1ba665SWarner Losh 
14160d1ba665SWarner Losh   @retval EFI_SUCCESS           The list of protocol interface GUIDs installed on Handle was returned in
14170d1ba665SWarner Losh                                 ProtocolBuffer. The number of protocol interface GUIDs was
14180d1ba665SWarner Losh                                 returned in ProtocolBufferCount.
14190d1ba665SWarner Losh   @retval EFI_OUT_OF_RESOURCES  There is not enough pool memory to store the results.
14200d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER Handle is NULL.
14210d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
14220d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.
14230d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.
14240d1ba665SWarner Losh 
14250d1ba665SWarner Losh **/
14260d1ba665SWarner Losh typedef
14270d1ba665SWarner Losh EFI_STATUS
14280d1ba665SWarner Losh (EFIAPI *EFI_PROTOCOLS_PER_HANDLE)(
14290d1ba665SWarner Losh   IN  EFI_HANDLE      Handle,
14300d1ba665SWarner Losh   OUT EFI_GUID        ***ProtocolBuffer,
14310d1ba665SWarner Losh   OUT UINTN           *ProtocolBufferCount
14320d1ba665SWarner Losh   );
14330d1ba665SWarner Losh 
14340d1ba665SWarner Losh /**
14350d1ba665SWarner Losh   Creates an event that is to be signaled whenever an interface is installed for a specified protocol.
14360d1ba665SWarner Losh 
14370d1ba665SWarner Losh   @param[in]   Protocol         The numeric ID of the protocol for which the event is to be registered.
14380d1ba665SWarner Losh   @param[in]   Event            Event that is to be signaled whenever a protocol interface is registered
14390d1ba665SWarner Losh                                 for Protocol.
14400d1ba665SWarner Losh   @param[out]  Registration     A pointer to a memory location to receive the registration value.
14410d1ba665SWarner Losh 
14420d1ba665SWarner Losh   @retval EFI_SUCCESS           The notification event has been registered.
14430d1ba665SWarner Losh   @retval EFI_OUT_OF_RESOURCES  Space for the notification event could not be allocated.
14440d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER Protocol is NULL.
14450d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER Event is NULL.
14460d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER Registration is NULL.
14470d1ba665SWarner Losh 
14480d1ba665SWarner Losh **/
14490d1ba665SWarner Losh typedef
14500d1ba665SWarner Losh EFI_STATUS
14510d1ba665SWarner Losh (EFIAPI *EFI_REGISTER_PROTOCOL_NOTIFY)(
14520d1ba665SWarner Losh   IN  EFI_GUID                 *Protocol,
14530d1ba665SWarner Losh   IN  EFI_EVENT                Event,
14540d1ba665SWarner Losh   OUT VOID                     **Registration
14550d1ba665SWarner Losh   );
14560d1ba665SWarner Losh 
14570d1ba665SWarner Losh ///
14580d1ba665SWarner Losh /// Enumeration of EFI Locate Search Types
14590d1ba665SWarner Losh ///
14600d1ba665SWarner Losh typedef enum {
14610d1ba665SWarner Losh   ///
14620d1ba665SWarner Losh   /// Retrieve all the handles in the handle database.
14630d1ba665SWarner Losh   ///
14640d1ba665SWarner Losh   AllHandles,
14650d1ba665SWarner Losh   ///
14660d1ba665SWarner Losh   /// Retrieve the next handle fron a RegisterProtocolNotify() event.
14670d1ba665SWarner Losh   ///
14680d1ba665SWarner Losh   ByRegisterNotify,
14690d1ba665SWarner Losh   ///
14700d1ba665SWarner Losh   /// Retrieve the set of handles from the handle database that support a
14710d1ba665SWarner Losh   /// specified protocol.
14720d1ba665SWarner Losh   ///
14730d1ba665SWarner Losh   ByProtocol
14740d1ba665SWarner Losh } EFI_LOCATE_SEARCH_TYPE;
14750d1ba665SWarner Losh 
14760d1ba665SWarner Losh /**
14770d1ba665SWarner Losh   Returns an array of handles that support a specified protocol.
14780d1ba665SWarner Losh 
14790d1ba665SWarner Losh   @param[in]       SearchType   Specifies which handle(s) are to be returned.
14800d1ba665SWarner Losh   @param[in]       Protocol     Specifies the protocol to search by.
14810d1ba665SWarner Losh   @param[in]       SearchKey    Specifies the search key.
14820d1ba665SWarner Losh   @param[in, out]  BufferSize   On input, the size in bytes of Buffer. On output, the size in bytes of
14830d1ba665SWarner Losh                                 the array returned in Buffer (if the buffer was large enough) or the
14840d1ba665SWarner Losh                                 size, in bytes, of the buffer needed to obtain the array (if the buffer was
14850d1ba665SWarner Losh                                 not large enough).
14860d1ba665SWarner Losh   @param[out]      Buffer       The buffer in which the array is returned.
14870d1ba665SWarner Losh 
14880d1ba665SWarner Losh   @retval EFI_SUCCESS           The array of handles was returned.
14890d1ba665SWarner Losh   @retval EFI_NOT_FOUND         No handles match the search.
14900d1ba665SWarner Losh   @retval EFI_BUFFER_TOO_SMALL  The BufferSize is too small for the result.
14910d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER SearchType is not a member of EFI_LOCATE_SEARCH_TYPE.
14920d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER SearchType is ByRegisterNotify and SearchKey is NULL.
14930d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER SearchType is ByProtocol and Protocol is NULL.
14940d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER One or more matches are found and BufferSize is NULL.
14950d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER BufferSize is large enough for the result and Buffer is NULL.
14960d1ba665SWarner Losh 
14970d1ba665SWarner Losh **/
14980d1ba665SWarner Losh typedef
14990d1ba665SWarner Losh EFI_STATUS
15000d1ba665SWarner Losh (EFIAPI *EFI_LOCATE_HANDLE)(
15010d1ba665SWarner Losh   IN     EFI_LOCATE_SEARCH_TYPE   SearchType,
15020d1ba665SWarner Losh   IN     EFI_GUID                 *Protocol,    OPTIONAL
15030d1ba665SWarner Losh   IN     VOID                     *SearchKey,   OPTIONAL
15040d1ba665SWarner Losh   IN OUT UINTN                    *BufferSize,
15050d1ba665SWarner Losh   OUT    EFI_HANDLE               *Buffer
15060d1ba665SWarner Losh   );
15070d1ba665SWarner Losh 
15080d1ba665SWarner Losh /**
15090d1ba665SWarner Losh   Locates the handle to a device on the device path that supports the specified protocol.
15100d1ba665SWarner Losh 
15110d1ba665SWarner Losh   @param[in]       Protocol     Specifies the protocol to search for.
15120d1ba665SWarner Losh   @param[in, out]  DevicePath   On input, a pointer to a pointer to the device path. On output, the device
15130d1ba665SWarner Losh                                 path pointer is modified to point to the remaining part of the device
15140d1ba665SWarner Losh                                 path.
15150d1ba665SWarner Losh   @param[out]      Device       A pointer to the returned device handle.
15160d1ba665SWarner Losh 
15170d1ba665SWarner Losh   @retval EFI_SUCCESS           The resulting handle was returned.
15180d1ba665SWarner Losh   @retval EFI_NOT_FOUND         No handles match the search.
15190d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER Protocol is NULL.
15200d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER DevicePath is NULL.
15210d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER A handle matched the search and Device is NULL.
15220d1ba665SWarner Losh 
15230d1ba665SWarner Losh **/
15240d1ba665SWarner Losh typedef
15250d1ba665SWarner Losh EFI_STATUS
15260d1ba665SWarner Losh (EFIAPI *EFI_LOCATE_DEVICE_PATH)(
15270d1ba665SWarner Losh   IN     EFI_GUID                         *Protocol,
15280d1ba665SWarner Losh   IN OUT EFI_DEVICE_PATH_PROTOCOL         **DevicePath,
15290d1ba665SWarner Losh   OUT    EFI_HANDLE                       *Device
15300d1ba665SWarner Losh   );
15310d1ba665SWarner Losh 
15320d1ba665SWarner Losh /**
15330d1ba665SWarner Losh   Adds, updates, or removes a configuration table entry from the EFI System Table.
15340d1ba665SWarner Losh 
15350d1ba665SWarner Losh   @param[in]  Guid              A pointer to the GUID for the entry to add, update, or remove.
15360d1ba665SWarner Losh   @param[in]  Table             A pointer to the configuration table for the entry to add, update, or
15370d1ba665SWarner Losh                                 remove. May be NULL.
15380d1ba665SWarner Losh 
15390d1ba665SWarner Losh   @retval EFI_SUCCESS           The (Guid, Table) pair was added, updated, or removed.
15400d1ba665SWarner Losh   @retval EFI_NOT_FOUND         An attempt was made to delete a nonexistent entry.
15410d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER Guid is NULL.
15420d1ba665SWarner Losh   @retval EFI_OUT_OF_RESOURCES  There is not enough memory available to complete the operation.
15430d1ba665SWarner Losh 
15440d1ba665SWarner Losh **/
15450d1ba665SWarner Losh typedef
15460d1ba665SWarner Losh EFI_STATUS
15470d1ba665SWarner Losh (EFIAPI *EFI_INSTALL_CONFIGURATION_TABLE)(
15480d1ba665SWarner Losh   IN EFI_GUID                 *Guid,
15490d1ba665SWarner Losh   IN VOID                     *Table
15500d1ba665SWarner Losh   );
15510d1ba665SWarner Losh 
15520d1ba665SWarner Losh /**
15530d1ba665SWarner Losh   Returns an array of handles that support the requested protocol in a buffer allocated from pool.
15540d1ba665SWarner Losh 
15550d1ba665SWarner Losh   @param[in]       SearchType   Specifies which handle(s) are to be returned.
15560d1ba665SWarner Losh   @param[in]       Protocol     Provides the protocol to search by.
15570d1ba665SWarner Losh                                 This parameter is only valid for a SearchType of ByProtocol.
15580d1ba665SWarner Losh   @param[in]       SearchKey    Supplies the search key depending on the SearchType.
1559*3245fa21SMitchell Horne   @param[out]      NoHandles    The number of handles returned in Buffer.
15600d1ba665SWarner Losh   @param[out]      Buffer       A pointer to the buffer to return the requested array of handles that
15610d1ba665SWarner Losh                                 support Protocol.
15620d1ba665SWarner Losh 
15630d1ba665SWarner Losh   @retval EFI_SUCCESS           The array of handles was returned in Buffer, and the number of
15640d1ba665SWarner Losh                                 handles in Buffer was returned in NoHandles.
15650d1ba665SWarner Losh   @retval EFI_NOT_FOUND         No handles match the search.
15660d1ba665SWarner Losh   @retval EFI_OUT_OF_RESOURCES  There is not enough pool memory to store the matching results.
15670d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER NoHandles is NULL.
15680d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER Buffer is NULL.
15690d1ba665SWarner Losh 
15700d1ba665SWarner Losh **/
15710d1ba665SWarner Losh typedef
15720d1ba665SWarner Losh EFI_STATUS
15730d1ba665SWarner Losh (EFIAPI *EFI_LOCATE_HANDLE_BUFFER)(
15740d1ba665SWarner Losh   IN     EFI_LOCATE_SEARCH_TYPE       SearchType,
15750d1ba665SWarner Losh   IN     EFI_GUID                     *Protocol,      OPTIONAL
15760d1ba665SWarner Losh   IN     VOID                         *SearchKey,     OPTIONAL
1577*3245fa21SMitchell Horne   OUT    UINTN                        *NoHandles,
15780d1ba665SWarner Losh   OUT    EFI_HANDLE                   **Buffer
15790d1ba665SWarner Losh   );
15800d1ba665SWarner Losh 
15810d1ba665SWarner Losh /**
15820d1ba665SWarner Losh   Returns the first protocol instance that matches the given protocol.
15830d1ba665SWarner Losh 
15840d1ba665SWarner Losh   @param[in]  Protocol          Provides the protocol to search for.
15850d1ba665SWarner Losh   @param[in]  Registration      Optional registration key returned from
15860d1ba665SWarner Losh                                 RegisterProtocolNotify().
15870d1ba665SWarner Losh   @param[out]  Interface        On return, a pointer to the first interface that matches Protocol and
15880d1ba665SWarner Losh                                 Registration.
15890d1ba665SWarner Losh 
15900d1ba665SWarner Losh   @retval EFI_SUCCESS           A protocol instance matching Protocol was found and returned in
15910d1ba665SWarner Losh                                 Interface.
15920d1ba665SWarner Losh   @retval EFI_NOT_FOUND         No protocol instances were found that match Protocol and
15930d1ba665SWarner Losh                                 Registration.
15940d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER Interface is NULL.
1595*3245fa21SMitchell Horne                                 Protocol is NULL.
15960d1ba665SWarner Losh 
15970d1ba665SWarner Losh **/
15980d1ba665SWarner Losh typedef
15990d1ba665SWarner Losh EFI_STATUS
16000d1ba665SWarner Losh (EFIAPI *EFI_LOCATE_PROTOCOL)(
16010d1ba665SWarner Losh   IN  EFI_GUID  *Protocol,
16020d1ba665SWarner Losh   IN  VOID      *Registration, OPTIONAL
16030d1ba665SWarner Losh   OUT VOID      **Interface
16040d1ba665SWarner Losh   );
16050d1ba665SWarner Losh 
16060d1ba665SWarner Losh ///
16070d1ba665SWarner Losh /// EFI Capsule Block Descriptor
16080d1ba665SWarner Losh ///
16090d1ba665SWarner Losh typedef struct {
16100d1ba665SWarner Losh   ///
16110d1ba665SWarner Losh   /// Length in bytes of the data pointed to by DataBlock/ContinuationPointer.
16120d1ba665SWarner Losh   ///
16130d1ba665SWarner Losh   UINT64                  Length;
16140d1ba665SWarner Losh   union {
16150d1ba665SWarner Losh     ///
16160d1ba665SWarner Losh     /// Physical address of the data block. This member of the union is
16170d1ba665SWarner Losh     /// used if Length is not equal to zero.
16180d1ba665SWarner Losh     ///
16190d1ba665SWarner Losh     EFI_PHYSICAL_ADDRESS  DataBlock;
16200d1ba665SWarner Losh     ///
16210d1ba665SWarner Losh     /// Physical address of another block of
16220d1ba665SWarner Losh     /// EFI_CAPSULE_BLOCK_DESCRIPTOR structures. This
16230d1ba665SWarner Losh     /// member of the union is used if Length is equal to zero. If
16240d1ba665SWarner Losh     /// ContinuationPointer is zero this entry represents the end of the list.
16250d1ba665SWarner Losh     ///
16260d1ba665SWarner Losh     EFI_PHYSICAL_ADDRESS  ContinuationPointer;
16270d1ba665SWarner Losh   } Union;
16280d1ba665SWarner Losh } EFI_CAPSULE_BLOCK_DESCRIPTOR;
16290d1ba665SWarner Losh 
16300d1ba665SWarner Losh ///
16310d1ba665SWarner Losh /// EFI Capsule Header.
16320d1ba665SWarner Losh ///
16330d1ba665SWarner Losh typedef struct {
16340d1ba665SWarner Losh   ///
16350d1ba665SWarner Losh   /// A GUID that defines the contents of a capsule.
16360d1ba665SWarner Losh   ///
16370d1ba665SWarner Losh   EFI_GUID          CapsuleGuid;
16380d1ba665SWarner Losh   ///
16390d1ba665SWarner Losh   /// The size of the capsule header. This may be larger than the size of
16400d1ba665SWarner Losh   /// the EFI_CAPSULE_HEADER since CapsuleGuid may imply
16410d1ba665SWarner Losh   /// extended header entries
16420d1ba665SWarner Losh   ///
16430d1ba665SWarner Losh   UINT32            HeaderSize;
16440d1ba665SWarner Losh   ///
16450d1ba665SWarner Losh   /// Bit-mapped list describing the capsule attributes. The Flag values
16460d1ba665SWarner Losh   /// of 0x0000 - 0xFFFF are defined by CapsuleGuid. Flag values
16470d1ba665SWarner Losh   /// of 0x10000 - 0xFFFFFFFF are defined by this specification
16480d1ba665SWarner Losh   ///
16490d1ba665SWarner Losh   UINT32            Flags;
16500d1ba665SWarner Losh   ///
16510d1ba665SWarner Losh   /// Size in bytes of the capsule.
16520d1ba665SWarner Losh   ///
16530d1ba665SWarner Losh   UINT32            CapsuleImageSize;
16540d1ba665SWarner Losh } EFI_CAPSULE_HEADER;
16550d1ba665SWarner Losh 
16560d1ba665SWarner Losh ///
16570d1ba665SWarner Losh /// The EFI System Table entry must point to an array of capsules
16580d1ba665SWarner Losh /// that contain the same CapsuleGuid value. The array must be
16590d1ba665SWarner Losh /// prefixed by a UINT32 that represents the size of the array of capsules.
16600d1ba665SWarner Losh ///
16610d1ba665SWarner Losh typedef struct {
16620d1ba665SWarner Losh   ///
16630d1ba665SWarner Losh   /// the size of the array of capsules.
16640d1ba665SWarner Losh   ///
16650d1ba665SWarner Losh   UINT32   CapsuleArrayNumber;
16660d1ba665SWarner Losh   ///
16670d1ba665SWarner Losh   /// Point to an array of capsules that contain the same CapsuleGuid value.
16680d1ba665SWarner Losh   ///
16690d1ba665SWarner Losh   VOID*    CapsulePtr[1];
16700d1ba665SWarner Losh } EFI_CAPSULE_TABLE;
16710d1ba665SWarner Losh 
16720d1ba665SWarner Losh #define CAPSULE_FLAGS_PERSIST_ACROSS_RESET          0x00010000
16730d1ba665SWarner Losh #define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE         0x00020000
16740d1ba665SWarner Losh #define CAPSULE_FLAGS_INITIATE_RESET                0x00040000
16750d1ba665SWarner Losh 
16760d1ba665SWarner Losh /**
16770d1ba665SWarner Losh   Passes capsules to the firmware with both virtual and physical mapping. Depending on the intended
16780d1ba665SWarner Losh   consumption, the firmware may process the capsule immediately. If the payload should persist
16790d1ba665SWarner Losh   across a system reset, the reset value returned from EFI_QueryCapsuleCapabilities must
16800d1ba665SWarner Losh   be passed into ResetSystem() and will cause the capsule to be processed by the firmware as
16810d1ba665SWarner Losh   part of the reset process.
16820d1ba665SWarner Losh 
16830d1ba665SWarner Losh   @param[in]  CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules
16840d1ba665SWarner Losh                                  being passed into update capsule.
16850d1ba665SWarner Losh   @param[in]  CapsuleCount       Number of pointers to EFI_CAPSULE_HEADER in
16860d1ba665SWarner Losh                                  CaspuleHeaderArray.
16870d1ba665SWarner Losh   @param[in]  ScatterGatherList  Physical pointer to a set of
16880d1ba665SWarner Losh                                  EFI_CAPSULE_BLOCK_DESCRIPTOR that describes the
16890d1ba665SWarner Losh                                  location in physical memory of a set of capsules.
16900d1ba665SWarner Losh 
16910d1ba665SWarner Losh   @retval EFI_SUCCESS           Valid capsule was passed. If
16920d1ba665SWarner Losh                                 CAPSULE_FLAGS_PERSIT_ACROSS_RESET is not set, the
16930d1ba665SWarner Losh                                 capsule has been successfully processed by the firmware.
16940d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER CapsuleSize is NULL, or an incompatible set of flags were
16950d1ba665SWarner Losh                                 set in the capsule header.
16960d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER CapsuleCount is 0.
16970d1ba665SWarner Losh   @retval EFI_DEVICE_ERROR      The capsule update was started, but failed due to a device error.
16980d1ba665SWarner Losh   @retval EFI_UNSUPPORTED       The capsule type is not supported on this platform.
16990d1ba665SWarner Losh   @retval EFI_OUT_OF_RESOURCES  When ExitBootServices() has been previously called this error indicates the capsule
17000d1ba665SWarner Losh                                 is compatible with this platform but is not capable of being submitted or processed
17010d1ba665SWarner Losh                                 in runtime. The caller may resubmit the capsule prior to ExitBootServices().
17020d1ba665SWarner Losh   @retval EFI_OUT_OF_RESOURCES  When ExitBootServices() has not been previously called then this error indicates
17030d1ba665SWarner Losh                                 the capsule is compatible with this platform but there are insufficient resources to process.
17040d1ba665SWarner Losh 
17050d1ba665SWarner Losh **/
17060d1ba665SWarner Losh typedef
17070d1ba665SWarner Losh EFI_STATUS
17080d1ba665SWarner Losh (EFIAPI *EFI_UPDATE_CAPSULE)(
17090d1ba665SWarner Losh   IN EFI_CAPSULE_HEADER     **CapsuleHeaderArray,
17100d1ba665SWarner Losh   IN UINTN                  CapsuleCount,
17110d1ba665SWarner Losh   IN EFI_PHYSICAL_ADDRESS   ScatterGatherList   OPTIONAL
17120d1ba665SWarner Losh   );
17130d1ba665SWarner Losh 
17140d1ba665SWarner Losh /**
17150d1ba665SWarner Losh   Returns if the capsule can be supported via UpdateCapsule().
17160d1ba665SWarner Losh 
17170d1ba665SWarner Losh   @param[in]   CapsuleHeaderArray  Virtual pointer to an array of virtual pointers to the capsules
17180d1ba665SWarner Losh                                    being passed into update capsule.
17190d1ba665SWarner Losh   @param[in]   CapsuleCount        Number of pointers to EFI_CAPSULE_HEADER in
17200d1ba665SWarner Losh                                    CaspuleHeaderArray.
17210d1ba665SWarner Losh   @param[out]  MaxiumCapsuleSize   On output the maximum size that UpdateCapsule() can
17220d1ba665SWarner Losh                                    support as an argument to UpdateCapsule() via
17230d1ba665SWarner Losh                                    CapsuleHeaderArray and ScatterGatherList.
17240d1ba665SWarner Losh   @param[out]  ResetType           Returns the type of reset required for the capsule update.
17250d1ba665SWarner Losh 
17260d1ba665SWarner Losh   @retval EFI_SUCCESS           Valid answer returned.
17270d1ba665SWarner Losh   @retval EFI_UNSUPPORTED       The capsule type is not supported on this platform, and
17280d1ba665SWarner Losh                                 MaximumCapsuleSize and ResetType are undefined.
17290d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER MaximumCapsuleSize is NULL.
17300d1ba665SWarner Losh   @retval EFI_OUT_OF_RESOURCES  When ExitBootServices() has been previously called this error indicates the capsule
17310d1ba665SWarner Losh                                 is compatible with this platform but is not capable of being submitted or processed
17320d1ba665SWarner Losh                                 in runtime. The caller may resubmit the capsule prior to ExitBootServices().
17330d1ba665SWarner Losh   @retval EFI_OUT_OF_RESOURCES  When ExitBootServices() has not been previously called then this error indicates
17340d1ba665SWarner Losh                                 the capsule is compatible with this platform but there are insufficient resources to process.
17350d1ba665SWarner Losh 
17360d1ba665SWarner Losh **/
17370d1ba665SWarner Losh typedef
17380d1ba665SWarner Losh EFI_STATUS
17390d1ba665SWarner Losh (EFIAPI *EFI_QUERY_CAPSULE_CAPABILITIES)(
17400d1ba665SWarner Losh   IN  EFI_CAPSULE_HEADER     **CapsuleHeaderArray,
17410d1ba665SWarner Losh   IN  UINTN                  CapsuleCount,
17420d1ba665SWarner Losh   OUT UINT64                 *MaximumCapsuleSize,
17430d1ba665SWarner Losh   OUT EFI_RESET_TYPE         *ResetType
17440d1ba665SWarner Losh   );
17450d1ba665SWarner Losh 
17460d1ba665SWarner Losh /**
17470d1ba665SWarner Losh   Returns information about the EFI variables.
17480d1ba665SWarner Losh 
17490d1ba665SWarner Losh   @param[in]   Attributes                   Attributes bitmask to specify the type of variables on
17500d1ba665SWarner Losh                                             which to return information.
17510d1ba665SWarner Losh   @param[out]  MaximumVariableStorageSize   On output the maximum size of the storage space
17520d1ba665SWarner Losh                                             available for the EFI variables associated with the
17530d1ba665SWarner Losh                                             attributes specified.
17540d1ba665SWarner Losh   @param[out]  RemainingVariableStorageSize Returns the remaining size of the storage space
17550d1ba665SWarner Losh                                             available for the EFI variables associated with the
17560d1ba665SWarner Losh                                             attributes specified.
17570d1ba665SWarner Losh   @param[out]  MaximumVariableSize          Returns the maximum size of the individual EFI
17580d1ba665SWarner Losh                                             variables associated with the attributes specified.
17590d1ba665SWarner Losh 
17600d1ba665SWarner Losh   @retval EFI_SUCCESS                  Valid answer returned.
17610d1ba665SWarner Losh   @retval EFI_INVALID_PARAMETER        An invalid combination of attribute bits was supplied
17620d1ba665SWarner Losh   @retval EFI_UNSUPPORTED              The attribute is not supported on this platform, and the
17630d1ba665SWarner Losh                                        MaximumVariableStorageSize,
17640d1ba665SWarner Losh                                        RemainingVariableStorageSize, MaximumVariableSize
17650d1ba665SWarner Losh                                        are undefined.
17660d1ba665SWarner Losh 
17670d1ba665SWarner Losh **/
17680d1ba665SWarner Losh typedef
17690d1ba665SWarner Losh EFI_STATUS
17700d1ba665SWarner Losh (EFIAPI *EFI_QUERY_VARIABLE_INFO)(
17710d1ba665SWarner Losh   IN  UINT32            Attributes,
17720d1ba665SWarner Losh   OUT UINT64            *MaximumVariableStorageSize,
17730d1ba665SWarner Losh   OUT UINT64            *RemainingVariableStorageSize,
17740d1ba665SWarner Losh   OUT UINT64            *MaximumVariableSize
17750d1ba665SWarner Losh   );
17760d1ba665SWarner Losh 
17770d1ba665SWarner Losh //
17780d1ba665SWarner Losh // Firmware should stop at a firmware user interface on next boot
17790d1ba665SWarner Losh //
17800d1ba665SWarner Losh #define EFI_OS_INDICATIONS_BOOT_TO_FW_UI                    0x0000000000000001
17810d1ba665SWarner Losh #define EFI_OS_INDICATIONS_TIMESTAMP_REVOCATION             0x0000000000000002
17820d1ba665SWarner Losh #define EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED  0x0000000000000004
17830d1ba665SWarner Losh #define EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED            0x0000000000000008
17840d1ba665SWarner Losh #define EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED     0x0000000000000010
17850d1ba665SWarner Losh #define EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY          0x0000000000000040
1786*3245fa21SMitchell Horne #define EFI_OS_INDICATIONS_JSON_CONFIG_DATA_REFRESH         0x0000000000000080
17870d1ba665SWarner Losh 
17880d1ba665SWarner Losh //
17890d1ba665SWarner Losh // EFI Runtime Services Table
17900d1ba665SWarner Losh //
17910d1ba665SWarner Losh #define EFI_SYSTEM_TABLE_SIGNATURE      SIGNATURE_64 ('I','B','I',' ','S','Y','S','T')
1792*3245fa21SMitchell Horne #define EFI_2_80_SYSTEM_TABLE_REVISION  ((2 << 16) | (80))
1793*3245fa21SMitchell Horne #define EFI_2_70_SYSTEM_TABLE_REVISION  ((2 << 16) | (70))
17940d1ba665SWarner Losh #define EFI_2_60_SYSTEM_TABLE_REVISION  ((2 << 16) | (60))
17950d1ba665SWarner Losh #define EFI_2_50_SYSTEM_TABLE_REVISION  ((2 << 16) | (50))
17960d1ba665SWarner Losh #define EFI_2_40_SYSTEM_TABLE_REVISION  ((2 << 16) | (40))
17970d1ba665SWarner Losh #define EFI_2_31_SYSTEM_TABLE_REVISION  ((2 << 16) | (31))
17980d1ba665SWarner Losh #define EFI_2_30_SYSTEM_TABLE_REVISION  ((2 << 16) | (30))
17990d1ba665SWarner Losh #define EFI_2_20_SYSTEM_TABLE_REVISION  ((2 << 16) | (20))
18000d1ba665SWarner Losh #define EFI_2_10_SYSTEM_TABLE_REVISION  ((2 << 16) | (10))
18010d1ba665SWarner Losh #define EFI_2_00_SYSTEM_TABLE_REVISION  ((2 << 16) | (00))
18020d1ba665SWarner Losh #define EFI_1_10_SYSTEM_TABLE_REVISION  ((1 << 16) | (10))
18030d1ba665SWarner Losh #define EFI_1_02_SYSTEM_TABLE_REVISION  ((1 << 16) | (02))
1804*3245fa21SMitchell Horne #define EFI_SYSTEM_TABLE_REVISION       EFI_2_70_SYSTEM_TABLE_REVISION
18050d1ba665SWarner Losh #define EFI_SPECIFICATION_VERSION       EFI_SYSTEM_TABLE_REVISION
18060d1ba665SWarner Losh 
18070d1ba665SWarner Losh #define EFI_RUNTIME_SERVICES_SIGNATURE  SIGNATURE_64 ('R','U','N','T','S','E','R','V')
18080d1ba665SWarner Losh #define EFI_RUNTIME_SERVICES_REVISION   EFI_SPECIFICATION_VERSION
18090d1ba665SWarner Losh 
18100d1ba665SWarner Losh ///
18110d1ba665SWarner Losh /// EFI Runtime Services Table.
18120d1ba665SWarner Losh ///
18130d1ba665SWarner Losh typedef struct {
18140d1ba665SWarner Losh   ///
18150d1ba665SWarner Losh   /// The table header for the EFI Runtime Services Table.
18160d1ba665SWarner Losh   ///
18170d1ba665SWarner Losh   EFI_TABLE_HEADER                Hdr;
18180d1ba665SWarner Losh 
18190d1ba665SWarner Losh   //
18200d1ba665SWarner Losh   // Time Services
18210d1ba665SWarner Losh   //
18220d1ba665SWarner Losh   EFI_GET_TIME                    GetTime;
18230d1ba665SWarner Losh   EFI_SET_TIME                    SetTime;
18240d1ba665SWarner Losh   EFI_GET_WAKEUP_TIME             GetWakeupTime;
18250d1ba665SWarner Losh   EFI_SET_WAKEUP_TIME             SetWakeupTime;
18260d1ba665SWarner Losh 
18270d1ba665SWarner Losh   //
18280d1ba665SWarner Losh   // Virtual Memory Services
18290d1ba665SWarner Losh   //
18300d1ba665SWarner Losh   EFI_SET_VIRTUAL_ADDRESS_MAP     SetVirtualAddressMap;
18310d1ba665SWarner Losh   EFI_CONVERT_POINTER             ConvertPointer;
18320d1ba665SWarner Losh 
18330d1ba665SWarner Losh   //
18340d1ba665SWarner Losh   // Variable Services
18350d1ba665SWarner Losh   //
18360d1ba665SWarner Losh   EFI_GET_VARIABLE                GetVariable;
18370d1ba665SWarner Losh   EFI_GET_NEXT_VARIABLE_NAME      GetNextVariableName;
18380d1ba665SWarner Losh   EFI_SET_VARIABLE                SetVariable;
18390d1ba665SWarner Losh 
18400d1ba665SWarner Losh   //
18410d1ba665SWarner Losh   // Miscellaneous Services
18420d1ba665SWarner Losh   //
18430d1ba665SWarner Losh   EFI_GET_NEXT_HIGH_MONO_COUNT    GetNextHighMonotonicCount;
18440d1ba665SWarner Losh   EFI_RESET_SYSTEM                ResetSystem;
18450d1ba665SWarner Losh 
18460d1ba665SWarner Losh   //
18470d1ba665SWarner Losh   // UEFI 2.0 Capsule Services
18480d1ba665SWarner Losh   //
18490d1ba665SWarner Losh   EFI_UPDATE_CAPSULE              UpdateCapsule;
18500d1ba665SWarner Losh   EFI_QUERY_CAPSULE_CAPABILITIES  QueryCapsuleCapabilities;
18510d1ba665SWarner Losh 
18520d1ba665SWarner Losh   //
18530d1ba665SWarner Losh   // Miscellaneous UEFI 2.0 Service
18540d1ba665SWarner Losh   //
18550d1ba665SWarner Losh   EFI_QUERY_VARIABLE_INFO         QueryVariableInfo;
18560d1ba665SWarner Losh } EFI_RUNTIME_SERVICES;
18570d1ba665SWarner Losh 
18580d1ba665SWarner Losh 
18590d1ba665SWarner Losh #define EFI_BOOT_SERVICES_SIGNATURE   SIGNATURE_64 ('B','O','O','T','S','E','R','V')
18600d1ba665SWarner Losh #define EFI_BOOT_SERVICES_REVISION    EFI_SPECIFICATION_VERSION
18610d1ba665SWarner Losh 
18620d1ba665SWarner Losh ///
18630d1ba665SWarner Losh /// EFI Boot Services Table.
18640d1ba665SWarner Losh ///
18650d1ba665SWarner Losh typedef struct {
18660d1ba665SWarner Losh   ///
18670d1ba665SWarner Losh   /// The table header for the EFI Boot Services Table.
18680d1ba665SWarner Losh   ///
18690d1ba665SWarner Losh   EFI_TABLE_HEADER                Hdr;
18700d1ba665SWarner Losh 
18710d1ba665SWarner Losh   //
18720d1ba665SWarner Losh   // Task Priority Services
18730d1ba665SWarner Losh   //
18740d1ba665SWarner Losh   EFI_RAISE_TPL                   RaiseTPL;
18750d1ba665SWarner Losh   EFI_RESTORE_TPL                 RestoreTPL;
18760d1ba665SWarner Losh 
18770d1ba665SWarner Losh   //
18780d1ba665SWarner Losh   // Memory Services
18790d1ba665SWarner Losh   //
18800d1ba665SWarner Losh   EFI_ALLOCATE_PAGES              AllocatePages;
18810d1ba665SWarner Losh   EFI_FREE_PAGES                  FreePages;
18820d1ba665SWarner Losh   EFI_GET_MEMORY_MAP              GetMemoryMap;
18830d1ba665SWarner Losh   EFI_ALLOCATE_POOL               AllocatePool;
18840d1ba665SWarner Losh   EFI_FREE_POOL                   FreePool;
18850d1ba665SWarner Losh 
18860d1ba665SWarner Losh   //
18870d1ba665SWarner Losh   // Event & Timer Services
18880d1ba665SWarner Losh   //
18890d1ba665SWarner Losh   EFI_CREATE_EVENT                  CreateEvent;
18900d1ba665SWarner Losh   EFI_SET_TIMER                     SetTimer;
18910d1ba665SWarner Losh   EFI_WAIT_FOR_EVENT                WaitForEvent;
18920d1ba665SWarner Losh   EFI_SIGNAL_EVENT                  SignalEvent;
18930d1ba665SWarner Losh   EFI_CLOSE_EVENT                   CloseEvent;
18940d1ba665SWarner Losh   EFI_CHECK_EVENT                   CheckEvent;
18950d1ba665SWarner Losh 
18960d1ba665SWarner Losh   //
18970d1ba665SWarner Losh   // Protocol Handler Services
18980d1ba665SWarner Losh   //
18990d1ba665SWarner Losh   EFI_INSTALL_PROTOCOL_INTERFACE    InstallProtocolInterface;
19000d1ba665SWarner Losh   EFI_REINSTALL_PROTOCOL_INTERFACE  ReinstallProtocolInterface;
19010d1ba665SWarner Losh   EFI_UNINSTALL_PROTOCOL_INTERFACE  UninstallProtocolInterface;
19020d1ba665SWarner Losh   EFI_HANDLE_PROTOCOL               HandleProtocol;
19030d1ba665SWarner Losh   VOID                              *Reserved;
19040d1ba665SWarner Losh   EFI_REGISTER_PROTOCOL_NOTIFY      RegisterProtocolNotify;
19050d1ba665SWarner Losh   EFI_LOCATE_HANDLE                 LocateHandle;
19060d1ba665SWarner Losh   EFI_LOCATE_DEVICE_PATH            LocateDevicePath;
19070d1ba665SWarner Losh   EFI_INSTALL_CONFIGURATION_TABLE   InstallConfigurationTable;
19080d1ba665SWarner Losh 
19090d1ba665SWarner Losh   //
19100d1ba665SWarner Losh   // Image Services
19110d1ba665SWarner Losh   //
19120d1ba665SWarner Losh   EFI_IMAGE_LOAD                    LoadImage;
19130d1ba665SWarner Losh   EFI_IMAGE_START                   StartImage;
19140d1ba665SWarner Losh   EFI_EXIT                          Exit;
19150d1ba665SWarner Losh   EFI_IMAGE_UNLOAD                  UnloadImage;
19160d1ba665SWarner Losh   EFI_EXIT_BOOT_SERVICES            ExitBootServices;
19170d1ba665SWarner Losh 
19180d1ba665SWarner Losh   //
19190d1ba665SWarner Losh   // Miscellaneous Services
19200d1ba665SWarner Losh   //
19210d1ba665SWarner Losh   EFI_GET_NEXT_MONOTONIC_COUNT      GetNextMonotonicCount;
19220d1ba665SWarner Losh   EFI_STALL                         Stall;
19230d1ba665SWarner Losh   EFI_SET_WATCHDOG_TIMER            SetWatchdogTimer;
19240d1ba665SWarner Losh 
19250d1ba665SWarner Losh   //
19260d1ba665SWarner Losh   // DriverSupport Services
19270d1ba665SWarner Losh   //
19280d1ba665SWarner Losh   EFI_CONNECT_CONTROLLER            ConnectController;
19290d1ba665SWarner Losh   EFI_DISCONNECT_CONTROLLER         DisconnectController;
19300d1ba665SWarner Losh 
19310d1ba665SWarner Losh   //
19320d1ba665SWarner Losh   // Open and Close Protocol Services
19330d1ba665SWarner Losh   //
19340d1ba665SWarner Losh   EFI_OPEN_PROTOCOL                 OpenProtocol;
19350d1ba665SWarner Losh   EFI_CLOSE_PROTOCOL                CloseProtocol;
19360d1ba665SWarner Losh   EFI_OPEN_PROTOCOL_INFORMATION     OpenProtocolInformation;
19370d1ba665SWarner Losh 
19380d1ba665SWarner Losh   //
19390d1ba665SWarner Losh   // Library Services
19400d1ba665SWarner Losh   //
19410d1ba665SWarner Losh   EFI_PROTOCOLS_PER_HANDLE          ProtocolsPerHandle;
19420d1ba665SWarner Losh   EFI_LOCATE_HANDLE_BUFFER          LocateHandleBuffer;
19430d1ba665SWarner Losh   EFI_LOCATE_PROTOCOL               LocateProtocol;
19440d1ba665SWarner Losh   EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES    InstallMultipleProtocolInterfaces;
19450d1ba665SWarner Losh   EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES  UninstallMultipleProtocolInterfaces;
19460d1ba665SWarner Losh 
19470d1ba665SWarner Losh   //
19480d1ba665SWarner Losh   // 32-bit CRC Services
19490d1ba665SWarner Losh   //
19500d1ba665SWarner Losh   EFI_CALCULATE_CRC32               CalculateCrc32;
19510d1ba665SWarner Losh 
19520d1ba665SWarner Losh   //
19530d1ba665SWarner Losh   // Miscellaneous Services
19540d1ba665SWarner Losh   //
19550d1ba665SWarner Losh   EFI_COPY_MEM                      CopyMem;
19560d1ba665SWarner Losh   EFI_SET_MEM                       SetMem;
19570d1ba665SWarner Losh   EFI_CREATE_EVENT_EX               CreateEventEx;
19580d1ba665SWarner Losh } EFI_BOOT_SERVICES;
19590d1ba665SWarner Losh 
19600d1ba665SWarner Losh ///
19610d1ba665SWarner Losh /// Contains a set of GUID/pointer pairs comprised of the ConfigurationTable field in the
19620d1ba665SWarner Losh /// EFI System Table.
19630d1ba665SWarner Losh ///
19640d1ba665SWarner Losh typedef struct {
19650d1ba665SWarner Losh   ///
19660d1ba665SWarner Losh   /// The 128-bit GUID value that uniquely identifies the system configuration table.
19670d1ba665SWarner Losh   ///
19680d1ba665SWarner Losh   EFI_GUID                          VendorGuid;
19690d1ba665SWarner Losh   ///
19700d1ba665SWarner Losh   /// A pointer to the table associated with VendorGuid.
19710d1ba665SWarner Losh   ///
19720d1ba665SWarner Losh   VOID                              *VendorTable;
19730d1ba665SWarner Losh } EFI_CONFIGURATION_TABLE;
19740d1ba665SWarner Losh 
19750d1ba665SWarner Losh ///
19760d1ba665SWarner Losh /// EFI System Table
19770d1ba665SWarner Losh ///
19780d1ba665SWarner Losh typedef struct {
19790d1ba665SWarner Losh   ///
19800d1ba665SWarner Losh   /// The table header for the EFI System Table.
19810d1ba665SWarner Losh   ///
19820d1ba665SWarner Losh   EFI_TABLE_HEADER                  Hdr;
19830d1ba665SWarner Losh   ///
19840d1ba665SWarner Losh   /// A pointer to a null terminated string that identifies the vendor
19850d1ba665SWarner Losh   /// that produces the system firmware for the platform.
19860d1ba665SWarner Losh   ///
19870d1ba665SWarner Losh   CHAR16                            *FirmwareVendor;
19880d1ba665SWarner Losh   ///
19890d1ba665SWarner Losh   /// A firmware vendor specific value that identifies the revision
19900d1ba665SWarner Losh   /// of the system firmware for the platform.
19910d1ba665SWarner Losh   ///
19920d1ba665SWarner Losh   UINT32                            FirmwareRevision;
19930d1ba665SWarner Losh   ///
19940d1ba665SWarner Losh   /// The handle for the active console input device. This handle must support
19950d1ba665SWarner Losh   /// EFI_SIMPLE_TEXT_INPUT_PROTOCOL and EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.
19960d1ba665SWarner Losh   ///
19970d1ba665SWarner Losh   EFI_HANDLE                        ConsoleInHandle;
19980d1ba665SWarner Losh   ///
19990d1ba665SWarner Losh   /// A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL interface that is
20000d1ba665SWarner Losh   /// associated with ConsoleInHandle.
20010d1ba665SWarner Losh   ///
20020d1ba665SWarner Losh   EFI_SIMPLE_TEXT_INPUT_PROTOCOL    *ConIn;
20030d1ba665SWarner Losh   ///
20040d1ba665SWarner Losh   /// The handle for the active console output device.
20050d1ba665SWarner Losh   ///
20060d1ba665SWarner Losh   EFI_HANDLE                        ConsoleOutHandle;
20070d1ba665SWarner Losh   ///
20080d1ba665SWarner Losh   /// A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface
20090d1ba665SWarner Losh   /// that is associated with ConsoleOutHandle.
20100d1ba665SWarner Losh   ///
20110d1ba665SWarner Losh   EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL   *ConOut;
20120d1ba665SWarner Losh   ///
20130d1ba665SWarner Losh   /// The handle for the active standard error console device.
20140d1ba665SWarner Losh   /// This handle must support the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.
20150d1ba665SWarner Losh   ///
20160d1ba665SWarner Losh   EFI_HANDLE                        StandardErrorHandle;
20170d1ba665SWarner Losh   ///
20180d1ba665SWarner Losh   /// A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface
20190d1ba665SWarner Losh   /// that is associated with StandardErrorHandle.
20200d1ba665SWarner Losh   ///
20210d1ba665SWarner Losh   EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL   *StdErr;
20220d1ba665SWarner Losh   ///
20230d1ba665SWarner Losh   /// A pointer to the EFI Runtime Services Table.
20240d1ba665SWarner Losh   ///
20250d1ba665SWarner Losh   EFI_RUNTIME_SERVICES              *RuntimeServices;
20260d1ba665SWarner Losh   ///
20270d1ba665SWarner Losh   /// A pointer to the EFI Boot Services Table.
20280d1ba665SWarner Losh   ///
20290d1ba665SWarner Losh   EFI_BOOT_SERVICES                 *BootServices;
20300d1ba665SWarner Losh   ///
20310d1ba665SWarner Losh   /// The number of system configuration tables in the buffer ConfigurationTable.
20320d1ba665SWarner Losh   ///
20330d1ba665SWarner Losh   UINTN                             NumberOfTableEntries;
20340d1ba665SWarner Losh   ///
20350d1ba665SWarner Losh   /// A pointer to the system configuration tables.
20360d1ba665SWarner Losh   /// The number of entries in the table is NumberOfTableEntries.
20370d1ba665SWarner Losh   ///
20380d1ba665SWarner Losh   EFI_CONFIGURATION_TABLE           *ConfigurationTable;
20390d1ba665SWarner Losh } EFI_SYSTEM_TABLE;
20400d1ba665SWarner Losh 
20410d1ba665SWarner Losh /**
20420d1ba665SWarner Losh   This is the declaration of an EFI image entry point. This entry point is
20430d1ba665SWarner Losh   the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including
20440d1ba665SWarner Losh   both device drivers and bus drivers.
20450d1ba665SWarner Losh 
20460d1ba665SWarner Losh   @param[in]  ImageHandle       The firmware allocated handle for the UEFI image.
20470d1ba665SWarner Losh   @param[in]  SystemTable       A pointer to the EFI System Table.
20480d1ba665SWarner Losh 
20490d1ba665SWarner Losh   @retval EFI_SUCCESS           The operation completed successfully.
20500d1ba665SWarner Losh   @retval Others                An unexpected error occurred.
20510d1ba665SWarner Losh **/
20520d1ba665SWarner Losh typedef
20530d1ba665SWarner Losh EFI_STATUS
20540d1ba665SWarner Losh (EFIAPI *EFI_IMAGE_ENTRY_POINT)(
20550d1ba665SWarner Losh   IN  EFI_HANDLE                   ImageHandle,
20560d1ba665SWarner Losh   IN  EFI_SYSTEM_TABLE             *SystemTable
20570d1ba665SWarner Losh   );
20580d1ba665SWarner Losh 
20590d1ba665SWarner Losh //
20600d1ba665SWarner Losh // EFI Load Option. This data structure describes format of UEFI boot option variables.
20610d1ba665SWarner Losh //
20620d1ba665SWarner Losh // NOTE: EFI Load Option is a byte packed buffer of variable length fields.
20630d1ba665SWarner Losh // The first two fields have fixed length. They are declared as members of the
20640d1ba665SWarner Losh // EFI_LOAD_OPTION structure. All the other fields are variable length fields.
20650d1ba665SWarner Losh // They are listed in the comment block below for reference purposes.
20660d1ba665SWarner Losh //
20670d1ba665SWarner Losh #pragma pack(1)
20680d1ba665SWarner Losh typedef struct _EFI_LOAD_OPTION {
20690d1ba665SWarner Losh   ///
20700d1ba665SWarner Losh   /// The attributes for this load option entry. All unused bits must be zero
20710d1ba665SWarner Losh   /// and are reserved by the UEFI specification for future growth.
20720d1ba665SWarner Losh   ///
20730d1ba665SWarner Losh   UINT32                           Attributes;
20740d1ba665SWarner Losh   ///
20750d1ba665SWarner Losh   /// Length in bytes of the FilePathList. OptionalData starts at offset
20760d1ba665SWarner Losh   /// sizeof(UINT32) + sizeof(UINT16) + StrSize(Description) + FilePathListLength
20770d1ba665SWarner Losh   /// of the EFI_LOAD_OPTION descriptor.
20780d1ba665SWarner Losh   ///
20790d1ba665SWarner Losh   UINT16                           FilePathListLength;
20800d1ba665SWarner Losh   ///
20810d1ba665SWarner Losh   /// The user readable description for the load option.
20820d1ba665SWarner Losh   /// This field ends with a Null character.
20830d1ba665SWarner Losh   ///
20840d1ba665SWarner Losh   // CHAR16                        Description[];
20850d1ba665SWarner Losh   ///
20860d1ba665SWarner Losh   /// A packed array of UEFI device paths. The first element of the array is a
20870d1ba665SWarner Losh   /// device path that describes the device and location of the Image for this
20880d1ba665SWarner Losh   /// load option. The FilePathList[0] is specific to the device type. Other
20890d1ba665SWarner Losh   /// device paths may optionally exist in the FilePathList, but their usage is
20900d1ba665SWarner Losh   /// OSV specific. Each element in the array is variable length, and ends at
20910d1ba665SWarner Losh   /// the device path end structure. Because the size of Description is
20920d1ba665SWarner Losh   /// arbitrary, this data structure is not guaranteed to be aligned on a
20930d1ba665SWarner Losh   /// natural boundary. This data structure may have to be copied to an aligned
20940d1ba665SWarner Losh   /// natural boundary before it is used.
20950d1ba665SWarner Losh   ///
20960d1ba665SWarner Losh   // EFI_DEVICE_PATH_PROTOCOL      FilePathList[];
20970d1ba665SWarner Losh   ///
20980d1ba665SWarner Losh   /// The remaining bytes in the load option descriptor are a binary data buffer
20990d1ba665SWarner Losh   /// that is passed to the loaded image. If the field is zero bytes long, a
21000d1ba665SWarner Losh   /// NULL pointer is passed to the loaded image. The number of bytes in
21010d1ba665SWarner Losh   /// OptionalData can be computed by subtracting the starting offset of
21020d1ba665SWarner Losh   /// OptionalData from total size in bytes of the EFI_LOAD_OPTION.
21030d1ba665SWarner Losh   ///
21040d1ba665SWarner Losh   // UINT8                         OptionalData[];
21050d1ba665SWarner Losh } EFI_LOAD_OPTION;
21060d1ba665SWarner Losh #pragma pack()
21070d1ba665SWarner Losh 
21080d1ba665SWarner Losh //
21090d1ba665SWarner Losh // EFI Load Options Attributes
21100d1ba665SWarner Losh //
21110d1ba665SWarner Losh #define LOAD_OPTION_ACTIVE              0x00000001
21120d1ba665SWarner Losh #define LOAD_OPTION_FORCE_RECONNECT     0x00000002
21130d1ba665SWarner Losh #define LOAD_OPTION_HIDDEN              0x00000008
21140d1ba665SWarner Losh #define LOAD_OPTION_CATEGORY            0x00001F00
21150d1ba665SWarner Losh 
21160d1ba665SWarner Losh #define LOAD_OPTION_CATEGORY_BOOT       0x00000000
21170d1ba665SWarner Losh #define LOAD_OPTION_CATEGORY_APP        0x00000100
21180d1ba665SWarner Losh 
21190d1ba665SWarner Losh #define EFI_BOOT_OPTION_SUPPORT_KEY     0x00000001
21200d1ba665SWarner Losh #define EFI_BOOT_OPTION_SUPPORT_APP     0x00000002
21210d1ba665SWarner Losh #define EFI_BOOT_OPTION_SUPPORT_SYSPREP 0x00000010
21220d1ba665SWarner Losh #define EFI_BOOT_OPTION_SUPPORT_COUNT   0x00000300
21230d1ba665SWarner Losh 
21240d1ba665SWarner Losh ///
21250d1ba665SWarner Losh /// EFI Boot Key Data
21260d1ba665SWarner Losh ///
21270d1ba665SWarner Losh typedef union {
21280d1ba665SWarner Losh   struct {
21290d1ba665SWarner Losh     ///
21300d1ba665SWarner Losh     /// Indicates the revision of the EFI_KEY_OPTION structure. This revision level should be 0.
21310d1ba665SWarner Losh     ///
21320d1ba665SWarner Losh     UINT32  Revision        : 8;
21330d1ba665SWarner Losh     ///
21340d1ba665SWarner Losh     /// Either the left or right Shift keys must be pressed (1) or must not be pressed (0).
21350d1ba665SWarner Losh     ///
21360d1ba665SWarner Losh     UINT32  ShiftPressed    : 1;
21370d1ba665SWarner Losh     ///
21380d1ba665SWarner Losh     /// Either the left or right Control keys must be pressed (1) or must not be pressed (0).
21390d1ba665SWarner Losh     ///
21400d1ba665SWarner Losh     UINT32  ControlPressed  : 1;
21410d1ba665SWarner Losh     ///
21420d1ba665SWarner Losh     /// Either the left or right Alt keys must be pressed (1) or must not be pressed (0).
21430d1ba665SWarner Losh     ///
21440d1ba665SWarner Losh     UINT32  AltPressed      : 1;
21450d1ba665SWarner Losh     ///
21460d1ba665SWarner Losh     /// Either the left or right Logo keys must be pressed (1) or must not be pressed (0).
21470d1ba665SWarner Losh     ///
21480d1ba665SWarner Losh     UINT32  LogoPressed     : 1;
21490d1ba665SWarner Losh     ///
21500d1ba665SWarner Losh     /// The Menu key must be pressed (1) or must not be pressed (0).
21510d1ba665SWarner Losh     ///
21520d1ba665SWarner Losh     UINT32  MenuPressed     : 1;
21530d1ba665SWarner Losh     ///
21540d1ba665SWarner Losh     /// The SysReq key must be pressed (1) or must not be pressed (0).
21550d1ba665SWarner Losh     ///
21560d1ba665SWarner Losh     UINT32  SysReqPressed    : 1;
21570d1ba665SWarner Losh     UINT32  Reserved        : 16;
21580d1ba665SWarner Losh     ///
21590d1ba665SWarner Losh     /// Specifies the actual number of entries in EFI_KEY_OPTION.Keys, from 0-3. If
21600d1ba665SWarner Losh     /// zero, then only the shift state is considered. If more than one, then the boot option will
21610d1ba665SWarner Losh     /// only be launched if all of the specified keys are pressed with the same shift state.
21620d1ba665SWarner Losh     ///
21630d1ba665SWarner Losh     UINT32  InputKeyCount   : 2;
21640d1ba665SWarner Losh   } Options;
21650d1ba665SWarner Losh   UINT32  PackedValue;
21660d1ba665SWarner Losh } EFI_BOOT_KEY_DATA;
21670d1ba665SWarner Losh 
21680d1ba665SWarner Losh ///
21690d1ba665SWarner Losh /// EFI Key Option.
21700d1ba665SWarner Losh ///
21710d1ba665SWarner Losh #pragma pack(1)
21720d1ba665SWarner Losh typedef struct {
21730d1ba665SWarner Losh   ///
21740d1ba665SWarner Losh   /// Specifies options about how the key will be processed.
21750d1ba665SWarner Losh   ///
21760d1ba665SWarner Losh   EFI_BOOT_KEY_DATA  KeyData;
21770d1ba665SWarner Losh   ///
21780d1ba665SWarner Losh   /// The CRC-32 which should match the CRC-32 of the entire EFI_LOAD_OPTION to
21790d1ba665SWarner Losh   /// which BootOption refers. If the CRC-32s do not match this value, then this key
21800d1ba665SWarner Losh   /// option is ignored.
21810d1ba665SWarner Losh   ///
21820d1ba665SWarner Losh   UINT32             BootOptionCrc;
21830d1ba665SWarner Losh   ///
21840d1ba665SWarner Losh   /// The Boot#### option which will be invoked if this key is pressed and the boot option
21850d1ba665SWarner Losh   /// is active (LOAD_OPTION_ACTIVE is set).
21860d1ba665SWarner Losh   ///
21870d1ba665SWarner Losh   UINT16             BootOption;
21880d1ba665SWarner Losh   ///
21890d1ba665SWarner Losh   /// The key codes to compare against those returned by the
21900d1ba665SWarner Losh   /// EFI_SIMPLE_TEXT_INPUT and EFI_SIMPLE_TEXT_INPUT_EX protocols.
21910d1ba665SWarner Losh   /// The number of key codes (0-3) is specified by the EFI_KEY_CODE_COUNT field in KeyOptions.
21920d1ba665SWarner Losh   ///
21930d1ba665SWarner Losh   //EFI_INPUT_KEY      Keys[];
21940d1ba665SWarner Losh } EFI_KEY_OPTION;
21950d1ba665SWarner Losh #pragma pack()
21960d1ba665SWarner Losh 
21970d1ba665SWarner Losh //
21980d1ba665SWarner Losh // EFI File location to boot from on removable media devices
21990d1ba665SWarner Losh //
22000d1ba665SWarner Losh #define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32    L"\\EFI\\BOOT\\BOOTIA32.EFI"
22010d1ba665SWarner Losh #define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64    L"\\EFI\\BOOT\\BOOTIA64.EFI"
22020d1ba665SWarner Losh #define EFI_REMOVABLE_MEDIA_FILE_NAME_X64     L"\\EFI\\BOOT\\BOOTX64.EFI"
22030d1ba665SWarner Losh #define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM     L"\\EFI\\BOOT\\BOOTARM.EFI"
22040d1ba665SWarner Losh #define EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64 L"\\EFI\\BOOT\\BOOTAA64.EFI"
2205*3245fa21SMitchell Horne #define EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64 L"\\EFI\\BOOT\\BOOTRISCV64.EFI"
22060d1ba665SWarner Losh 
22070d1ba665SWarner Losh #if   defined (MDE_CPU_IA32)
22080d1ba665SWarner Losh   #define EFI_REMOVABLE_MEDIA_FILE_NAME   EFI_REMOVABLE_MEDIA_FILE_NAME_IA32
22090d1ba665SWarner Losh #elif defined (MDE_CPU_X64)
22100d1ba665SWarner Losh   #define EFI_REMOVABLE_MEDIA_FILE_NAME   EFI_REMOVABLE_MEDIA_FILE_NAME_X64
22110d1ba665SWarner Losh #elif defined (MDE_CPU_EBC)
22120d1ba665SWarner Losh #elif defined (MDE_CPU_ARM)
22130d1ba665SWarner Losh   #define EFI_REMOVABLE_MEDIA_FILE_NAME   EFI_REMOVABLE_MEDIA_FILE_NAME_ARM
22140d1ba665SWarner Losh #elif defined (MDE_CPU_AARCH64)
22150d1ba665SWarner Losh   #define EFI_REMOVABLE_MEDIA_FILE_NAME   EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64
2216*3245fa21SMitchell Horne #elif defined (MDE_CPU_RISCV64)
2217*3245fa21SMitchell Horne   #define EFI_REMOVABLE_MEDIA_FILE_NAME   EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64
22180d1ba665SWarner Losh #else
22190d1ba665SWarner Losh   #error Unknown Processor Type
22200d1ba665SWarner Losh #endif
22210d1ba665SWarner Losh 
2222*3245fa21SMitchell Horne //
2223*3245fa21SMitchell Horne // The directory within the active EFI System Partition defined for delivery of capsule to firmware
2224*3245fa21SMitchell Horne //
2225*3245fa21SMitchell Horne #define EFI_CAPSULE_FILE_DIRECTORY            L"\\EFI\\UpdateCapsule\\"
2226*3245fa21SMitchell Horne 
22270d1ba665SWarner Losh #include <Uefi/UefiPxe.h>
22280d1ba665SWarner Losh #include <Uefi/UefiGpt.h>
22290d1ba665SWarner Losh #include <Uefi/UefiInternalFormRepresentation.h>
22300d1ba665SWarner Losh 
22310d1ba665SWarner Losh #endif
2232