Path: blob/main/sys/contrib/edk2/Include/Uefi/UefiSpec.h
48383 views
/** @file1Include file that supports UEFI.23This include file must contain things defined in the UEFI 2.7 specification.4If a code construct is defined in the UEFI 2.7 specification it must be included5by this include file.67Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>8Portions Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>9Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>1011SPDX-License-Identifier: BSD-2-Clause-Patent1213**/1415#ifndef __UEFI_SPEC_H__16#define __UEFI_SPEC_H__1718#include <Uefi/UefiMultiPhase.h>1920#include <Protocol/DevicePath.h>21#include <Protocol/SimpleTextIn.h>22#include <Protocol/SimpleTextInEx.h>23#include <Protocol/SimpleTextOut.h>2425///26/// Enumeration of EFI memory allocation types.27///28typedef enum {29///30/// Allocate any available range of pages that satisfies the request.31///32AllocateAnyPages,33///34/// Allocate any available range of pages whose uppermost address is less than35/// or equal to a specified maximum address.36///37AllocateMaxAddress,38///39/// Allocate pages at a specified address.40///41AllocateAddress,42///43/// Maximum enumeration value that may be used for bounds checking.44///45MaxAllocateType46} EFI_ALLOCATE_TYPE;4748//49// Bit definitions for EFI_TIME.Daylight50//51#define EFI_TIME_ADJUST_DAYLIGHT 0x0152#define EFI_TIME_IN_DAYLIGHT 0x025354///55/// Value definition for EFI_TIME.TimeZone.56///57#define EFI_UNSPECIFIED_TIMEZONE 0x07FF5859//60// Memory cacheability attributes61//62#define EFI_MEMORY_UC 0x0000000000000001ULL63#define EFI_MEMORY_WC 0x0000000000000002ULL64#define EFI_MEMORY_WT 0x0000000000000004ULL65#define EFI_MEMORY_WB 0x0000000000000008ULL66#define EFI_MEMORY_UCE 0x0000000000000010ULL67//68// Physical memory protection attributes69//70// Note: UEFI spec 2.5 and following: use EFI_MEMORY_RO as write-protected physical memory71// protection attribute. Also, EFI_MEMORY_WP means cacheability attribute.72//73#define EFI_MEMORY_WP 0x0000000000001000ULL74#define EFI_MEMORY_RP 0x0000000000002000ULL75#define EFI_MEMORY_XP 0x0000000000004000ULL76#define EFI_MEMORY_RO 0x0000000000020000ULL77//78// Physical memory persistence attribute.79// The memory region supports byte-addressable non-volatility.80//81#define EFI_MEMORY_NV 0x0000000000008000ULL82//83// The memory region provides higher reliability relative to other memory in the system.84// If all memory has the same reliability, then this bit is not used.85//86#define EFI_MEMORY_MORE_RELIABLE 0x0000000000010000ULL8788//89// Note: UEFI spec 2.8 and following:90//91// Specific-purpose memory (SPM). The memory is earmarked for92// specific purposes such as for specific device drivers or applications.93// The SPM attribute serves as a hint to the OS to avoid allocating this94// memory for core OS data or code that can not be relocated.95//96#define EFI_MEMORY_SP 0x0000000000040000ULL97//98// If this flag is set, the memory region is capable of being99// protected with the CPU's memory cryptographic100// capabilities. If this flag is clear, the memory region is not101// capable of being protected with the CPU's memory102// cryptographic capabilities or the CPU does not support CPU103// memory cryptographic capabilities.104//105#define EFI_MEMORY_CPU_CRYPTO 0x0000000000080000ULL106107//108// If this flag is set, the memory region is present and capable of having109// memory dynamically removed from the platform. This attribute serves as110// a hint to the OS prior to its ACPI subsystem initialization to avoid111// allocating this memory for core OS data or code that cannot be dynamically112// relocated at runtime. If this flag is clear, the memory region is not113// capable of being dynamically removed from the platform at runtime.114//115#define EFI_MEMORY_HOT_PLUGGABLE 0x0000000000100000116117//118// Runtime memory attribute119//120#define EFI_MEMORY_RUNTIME 0x8000000000000000ULL121122//123// If this flag is set, the memory region is124// described with additional ISA-specific memory attributes125// as specified in EFI_MEMORY_ISA_MASK.126//127#define EFI_MEMORY_ISA_VALID 0x4000000000000000ULL128129//130// Defines the bits reserved for describing optional ISA-specific cacheability131// attributes that are not covered by the standard UEFI Memory Attributes cacheability132// bits (EFI_MEMORY_UC, EFI_MEMORY_WC, EFI_MEMORY_WT, EFI_MEMORY_WB and EFI_MEMORY_UCE).133// See Calling Conventions for further ISA-specific enumeration of these bits.134//135#define EFI_MEMORY_ISA_MASK 0x0FFFF00000000000ULL136137//138// Attributes bitmasks, grouped by type139//140#define EFI_CACHE_ATTRIBUTE_MASK (EFI_MEMORY_UC | EFI_MEMORY_WC | EFI_MEMORY_WT | EFI_MEMORY_WB | EFI_MEMORY_UCE | EFI_MEMORY_WP)141#define EFI_MEMORY_ACCESS_MASK (EFI_MEMORY_RP | EFI_MEMORY_XP | EFI_MEMORY_RO)142#define EFI_MEMORY_ATTRIBUTE_MASK (EFI_MEMORY_ACCESS_MASK | EFI_MEMORY_SP | EFI_MEMORY_CPU_CRYPTO)143144///145/// Memory descriptor version number.146///147#define EFI_MEMORY_DESCRIPTOR_VERSION 1148149///150/// Definition of an EFI memory descriptor.151///152typedef struct {153///154/// Type of the memory region.155/// Type EFI_MEMORY_TYPE is defined in the156/// AllocatePages() function description.157///158UINT32 Type;159///160/// Physical address of the first byte in the memory region. PhysicalStart must be161/// aligned on a 4 KiB boundary, and must not be above 0xfffffffffffff000. Type162/// EFI_PHYSICAL_ADDRESS is defined in the AllocatePages() function description163///164EFI_PHYSICAL_ADDRESS PhysicalStart;165///166/// Virtual address of the first byte in the memory region.167/// VirtualStart must be aligned on a 4 KiB boundary,168/// and must not be above 0xfffffffffffff000.169///170EFI_VIRTUAL_ADDRESS VirtualStart;171///172/// NumberOfPagesNumber of 4 KiB pages in the memory region.173/// NumberOfPages must not be 0, and must not be any value174/// that would represent a memory page with a start address,175/// either physical or virtual, above 0xfffffffffffff000.176///177UINT64 NumberOfPages;178///179/// Attributes of the memory region that describe the bit mask of capabilities180/// for that memory region, and not necessarily the current settings for that181/// memory region.182///183UINT64 Attribute;184} EFI_MEMORY_DESCRIPTOR;185186/**187Allocates memory pages from the system.188189@param[in] Type The type of allocation to perform.190@param[in] MemoryType The type of memory to allocate.191MemoryType values in the range 0x70000000..0x7FFFFFFF192are reserved for OEM use. MemoryType values in the range1930x80000000..0xFFFFFFFF are reserved for use by UEFI OS loaders194that are provided by operating system vendors.195@param[in] Pages The number of contiguous 4 KB pages to allocate.196@param[in, out] Memory The pointer to a physical address. On input, the way in which the address is197used depends on the value of Type.198199@retval EFI_SUCCESS The requested pages were allocated.200@retval EFI_INVALID_PARAMETER 1) Type is not AllocateAnyPages or201AllocateMaxAddress or AllocateAddress.2022) MemoryType is in the range203EfiMaxMemoryType..0x6FFFFFFF.2043) Memory is NULL.2054) MemoryType is EfiPersistentMemory.206@retval EFI_OUT_OF_RESOURCES The pages could not be allocated.207@retval EFI_NOT_FOUND The requested pages could not be found.208209**/210typedef211EFI_STATUS212(EFIAPI *EFI_ALLOCATE_PAGES)(213IN EFI_ALLOCATE_TYPE Type,214IN EFI_MEMORY_TYPE MemoryType,215IN UINTN Pages,216IN OUT EFI_PHYSICAL_ADDRESS *Memory217);218219/**220Frees memory pages.221222@param[in] Memory The base physical address of the pages to be freed.223@param[in] Pages The number of contiguous 4 KB pages to free.224225@retval EFI_SUCCESS The requested pages were freed.226@retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or Pages is invalid.227@retval EFI_NOT_FOUND The requested memory pages were not allocated with228AllocatePages().229230**/231typedef232EFI_STATUS233(EFIAPI *EFI_FREE_PAGES)(234IN EFI_PHYSICAL_ADDRESS Memory,235IN UINTN Pages236);237238/**239Returns the current memory map.240241@param[in, out] MemoryMapSize A pointer to the size, in bytes, of the MemoryMap buffer.242On input, this is the size of the buffer allocated by the caller.243On output, it is the size of the buffer returned by the firmware if244the buffer was large enough, or the size of the buffer needed to contain245the map if the buffer was too small.246@param[out] MemoryMap A pointer to the buffer in which firmware places the current memory247map.248@param[out] MapKey A pointer to the location in which firmware returns the key for the249current memory map.250@param[out] DescriptorSize A pointer to the location in which firmware returns the size, in bytes, of251an individual EFI_MEMORY_DESCRIPTOR.252@param[out] DescriptorVersion A pointer to the location in which firmware returns the version number253associated with the EFI_MEMORY_DESCRIPTOR.254255@retval EFI_SUCCESS The memory map was returned in the MemoryMap buffer.256@retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current buffer size257needed to hold the memory map is returned in MemoryMapSize.258@retval EFI_INVALID_PARAMETER 1) MemoryMapSize is NULL.2592) The MemoryMap buffer is not too small and MemoryMap is260NULL.261262**/263typedef264EFI_STATUS265(EFIAPI *EFI_GET_MEMORY_MAP)(266IN OUT UINTN *MemoryMapSize,267OUT EFI_MEMORY_DESCRIPTOR *MemoryMap,268OUT UINTN *MapKey,269OUT UINTN *DescriptorSize,270OUT UINT32 *DescriptorVersion271);272273/**274Allocates pool memory.275276@param[in] PoolType The type of pool to allocate.277MemoryType values in the range 0x70000000..0x7FFFFFFF278are reserved for OEM use. MemoryType values in the range2790x80000000..0xFFFFFFFF are reserved for use by UEFI OS loaders280that are provided by operating system vendors.281@param[in] Size The number of bytes to allocate from the pool.282@param[out] Buffer A pointer to a pointer to the allocated buffer if the call succeeds;283undefined otherwise.284285@retval EFI_SUCCESS The requested number of bytes was allocated.286@retval EFI_OUT_OF_RESOURCES The pool requested could not be allocated.287@retval EFI_INVALID_PARAMETER Buffer is NULL.288PoolType is in the range EfiMaxMemoryType..0x6FFFFFFF.289PoolType is EfiPersistentMemory.290291**/292typedef293EFI_STATUS294(EFIAPI *EFI_ALLOCATE_POOL)(295IN EFI_MEMORY_TYPE PoolType,296IN UINTN Size,297OUT VOID **Buffer298);299300/**301Returns pool memory to the system.302303@param[in] Buffer The pointer to the buffer to free.304305@retval EFI_SUCCESS The memory was returned to the system.306@retval EFI_INVALID_PARAMETER Buffer was invalid.307308**/309typedef310EFI_STATUS311(EFIAPI *EFI_FREE_POOL)(312IN VOID *Buffer313);314315/**316Changes the runtime addressing mode of EFI firmware from physical to virtual.317318@param[in] MemoryMapSize The size in bytes of VirtualMap.319@param[in] DescriptorSize The size in bytes of an entry in the VirtualMap.320@param[in] DescriptorVersion The version of the structure entries in VirtualMap.321@param[in] VirtualMap An array of memory descriptors which contain new virtual322address mapping information for all runtime ranges.323324@retval EFI_SUCCESS The virtual address map has been applied.325@retval EFI_UNSUPPORTED EFI firmware is not at runtime, or the EFI firmware is already in326virtual address mapped mode.327@retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is invalid.328@retval EFI_NO_MAPPING A virtual address was not supplied for a range in the memory329map that requires a mapping.330@retval EFI_NOT_FOUND A virtual address was supplied for an address that is not found331in the memory map.332@retval EFI_UNSUPPORTED This call is not supported by this platform at the time the call is made.333The platform should describe this runtime service as unsupported at runtime334via an EFI_RT_PROPERTIES_TABLE configuration table.335336**/337typedef338EFI_STATUS339(EFIAPI *EFI_SET_VIRTUAL_ADDRESS_MAP)(340IN UINTN MemoryMapSize,341IN UINTN DescriptorSize,342IN UINT32 DescriptorVersion,343IN EFI_MEMORY_DESCRIPTOR *VirtualMap344);345346/**347Connects one or more drivers to a controller.348349@param[in] ControllerHandle The handle of the controller to which driver(s) are to be connected.350@param[in] DriverImageHandle A pointer to an ordered list handles that support the351EFI_DRIVER_BINDING_PROTOCOL.352@param[in] RemainingDevicePath A pointer to the device path that specifies a child of the353controller specified by ControllerHandle.354@param[in] Recursive If TRUE, then ConnectController() is called recursively355until the entire tree of controllers below the controller specified356by ControllerHandle have been created. If FALSE, then357the tree of controllers is only expanded one level.358359@retval EFI_SUCCESS 1) One or more drivers were connected to ControllerHandle.3602) No drivers were connected to ControllerHandle, but361RemainingDevicePath is not NULL, and it is an End Device362Path Node.363@retval EFI_INVALID_PARAMETER ControllerHandle is NULL.364@retval EFI_NOT_FOUND 1) There are no EFI_DRIVER_BINDING_PROTOCOL instances365present in the system.3662) No drivers were connected to ControllerHandle.367@retval EFI_SECURITY_VIOLATION368The user has no permission to start UEFI device drivers on the device path369associated with the ControllerHandle or specified by the RemainingDevicePath.370**/371typedef372EFI_STATUS373(EFIAPI *EFI_CONNECT_CONTROLLER)(374IN EFI_HANDLE ControllerHandle,375IN EFI_HANDLE *DriverImageHandle OPTIONAL,376IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL,377IN BOOLEAN Recursive378);379380/**381Disconnects one or more drivers from a controller.382383@param[in] ControllerHandle The handle of the controller from which driver(s) are to be disconnected.384@param[in] DriverImageHandle The driver to disconnect from ControllerHandle.385If DriverImageHandle is NULL, then all the drivers currently managing386ControllerHandle are disconnected from ControllerHandle.387@param[in] ChildHandle The handle of the child to destroy.388If ChildHandle is NULL, then all the children of ControllerHandle are389destroyed before the drivers are disconnected from ControllerHandle.390391@retval EFI_SUCCESS 1) One or more drivers were disconnected from the controller.3922) On entry, no drivers are managing ControllerHandle.3933) DriverImageHandle is not NULL, and on entry394DriverImageHandle is not managing ControllerHandle.395@retval EFI_INVALID_PARAMETER 1) ControllerHandle is NULL.3962) DriverImageHandle is not NULL, and it is not a valid EFI_HANDLE.3973) ChildHandle is not NULL, and it is not a valid EFI_HANDLE.3984) DriverImageHandle does not support the EFI_DRIVER_BINDING_PROTOCOL.399@retval EFI_OUT_OF_RESOURCES There are not enough resources available to disconnect any drivers from400ControllerHandle.401@retval EFI_DEVICE_ERROR The controller could not be disconnected because of a device error.402403**/404typedef405EFI_STATUS406(EFIAPI *EFI_DISCONNECT_CONTROLLER)(407IN EFI_HANDLE ControllerHandle,408IN EFI_HANDLE DriverImageHandle OPTIONAL,409IN EFI_HANDLE ChildHandle OPTIONAL410);411412//413// ConvertPointer DebugDisposition type.414//415#define EFI_OPTIONAL_PTR 0x00000001416417/**418Determines the new virtual address that is to be used on subsequent memory accesses.419420@param[in] DebugDisposition Supplies type information for the pointer being converted.421@param[in, out] Address A pointer to a pointer that is to be fixed to be the value needed422for the new virtual address mappings being applied.423424@retval EFI_SUCCESS The pointer pointed to by Address was modified.425@retval EFI_NOT_FOUND The pointer pointed to by Address was not found to be part426of the current memory map. This is normally fatal.427@retval EFI_INVALID_PARAMETER Address is NULL.428@retval EFI_INVALID_PARAMETER *Address is NULL and DebugDisposition does429not have the EFI_OPTIONAL_PTR bit set.430@retval EFI_UNSUPPORTED This call is not supported by this platform at the time the call is made.431The platform should describe this runtime service as unsupported at runtime432via an EFI_RT_PROPERTIES_TABLE configuration table.433434**/435typedef436EFI_STATUS437(EFIAPI *EFI_CONVERT_POINTER)(438IN UINTN DebugDisposition,439IN OUT VOID **Address440);441442//443// These types can be ORed together as needed - for example,444// EVT_TIMER might be Ored with EVT_NOTIFY_WAIT or445// EVT_NOTIFY_SIGNAL.446//447#define EVT_TIMER 0x80000000448#define EVT_RUNTIME 0x40000000449#define EVT_NOTIFY_WAIT 0x00000100450#define EVT_NOTIFY_SIGNAL 0x00000200451452#define EVT_SIGNAL_EXIT_BOOT_SERVICES 0x00000201453#define EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE 0x60000202454455//456// The event's NotifyContext pointer points to a runtime memory457// address.458// The event is deprecated in UEFI2.0 and later specifications.459//460#define EVT_RUNTIME_CONTEXT 0x20000000461462/**463Invoke a notification event464465@param[in] Event Event whose notification function is being invoked.466@param[in] Context The pointer to the notification function's context,467which is implementation-dependent.468469**/470typedef471VOID472(EFIAPI *EFI_EVENT_NOTIFY)(473IN EFI_EVENT Event,474IN VOID *Context475);476477/**478Creates an event.479480@param[in] Type The type of event to create and its mode and attributes.481@param[in] NotifyTpl The task priority level of event notifications, if needed.482@param[in] NotifyFunction The pointer to the event's notification function, if any.483@param[in] NotifyContext The pointer to the notification function's context; corresponds to parameter484Context in the notification function.485@param[out] Event The pointer to the newly created event if the call succeeds; undefined486otherwise.487488@retval EFI_SUCCESS The event structure was created.489@retval EFI_INVALID_PARAMETER One or more parameters are invalid.490@retval EFI_OUT_OF_RESOURCES The event could not be allocated.491492**/493typedef494EFI_STATUS495(EFIAPI *EFI_CREATE_EVENT)(496IN UINT32 Type,497IN EFI_TPL NotifyTpl,498IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL,499IN VOID *NotifyContext OPTIONAL,500OUT EFI_EVENT *Event501);502503/**504Creates an event in a group.505506@param[in] Type The type of event to create and its mode and attributes.507@param[in] NotifyTpl The task priority level of event notifications,if needed.508@param[in] NotifyFunction The pointer to the event's notification function, if any.509@param[in] NotifyContext The pointer to the notification function's context; corresponds to parameter510Context in the notification function.511@param[in] EventGroup The pointer to the unique identifier of the group to which this event belongs.512If this is NULL, then the function behaves as if the parameters were passed513to CreateEvent.514@param[out] Event The pointer to the newly created event if the call succeeds; undefined515otherwise.516517@retval EFI_SUCCESS The event structure was created.518@retval EFI_INVALID_PARAMETER One or more parameters are invalid.519@retval EFI_OUT_OF_RESOURCES The event could not be allocated.520521**/522typedef523EFI_STATUS524(EFIAPI *EFI_CREATE_EVENT_EX)(525IN UINT32 Type,526IN EFI_TPL NotifyTpl,527IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL,528IN CONST VOID *NotifyContext OPTIONAL,529IN CONST EFI_GUID *EventGroup OPTIONAL,530OUT EFI_EVENT *Event531);532533///534/// Timer delay types535///536typedef enum {537///538/// An event's timer settings is to be cancelled and not trigger time is to be set/539///540TimerCancel,541///542/// An event is to be signaled periodically at a specified interval from the current time.543///544TimerPeriodic,545///546/// An event is to be signaled once at a specified interval from the current time.547///548TimerRelative549} EFI_TIMER_DELAY;550551/**552Sets the type of timer and the trigger time for a timer event.553554@param[in] Event The timer event that is to be signaled at the specified time.555@param[in] Type The type of time that is specified in TriggerTime.556@param[in] TriggerTime The number of 100ns units until the timer expires.557A TriggerTime of 0 is legal.558If Type is TimerRelative and TriggerTime is 0, then the timer559event will be signaled on the next timer tick.560If Type is TimerPeriodic and TriggerTime is 0, then the timer561event will be signaled on every timer tick.562563@retval EFI_SUCCESS The event has been set to be signaled at the requested time.564@retval EFI_INVALID_PARAMETER Event or Type is not valid.565566**/567typedef568EFI_STATUS569(EFIAPI *EFI_SET_TIMER)(570IN EFI_EVENT Event,571IN EFI_TIMER_DELAY Type,572IN UINT64 TriggerTime573);574575/**576Signals an event.577578@param[in] Event The event to signal.579580@retval EFI_SUCCESS The event has been signaled.581582**/583typedef584EFI_STATUS585(EFIAPI *EFI_SIGNAL_EVENT)(586IN EFI_EVENT Event587);588589/**590Stops execution until an event is signaled.591592@param[in] NumberOfEvents The number of events in the Event array.593@param[in] Event An array of EFI_EVENT.594@param[out] Index The pointer to the index of the event which satisfied the wait condition.595596@retval EFI_SUCCESS The event indicated by Index was signaled.597@retval EFI_INVALID_PARAMETER 1) NumberOfEvents is 0.5982) The event indicated by Index is of type599EVT_NOTIFY_SIGNAL.600@retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION.601602**/603typedef604EFI_STATUS605(EFIAPI *EFI_WAIT_FOR_EVENT)(606IN UINTN NumberOfEvents,607IN EFI_EVENT *Event,608OUT UINTN *Index609);610611/**612Closes an event.613614@param[in] Event The event to close.615616@retval EFI_SUCCESS The event has been closed.617618**/619typedef620EFI_STATUS621(EFIAPI *EFI_CLOSE_EVENT)(622IN EFI_EVENT Event623);624625/**626Checks whether an event is in the signaled state.627628@param[in] Event The event to check.629630@retval EFI_SUCCESS The event is in the signaled state.631@retval EFI_NOT_READY The event is not in the signaled state.632@retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL.633634**/635typedef636EFI_STATUS637(EFIAPI *EFI_CHECK_EVENT)(638IN EFI_EVENT Event639);640641//642// Task priority level643//644#define TPL_APPLICATION 4645#define TPL_CALLBACK 8646#define TPL_NOTIFY 16647#define TPL_HIGH_LEVEL 31648649/**650Raises a task's priority level and returns its previous level.651652@param[in] NewTpl The new task priority level.653654@return Previous task priority level655656**/657typedef658EFI_TPL659(EFIAPI *EFI_RAISE_TPL)(660IN EFI_TPL NewTpl661);662663/**664Restores a task's priority level to its previous value.665666@param[in] OldTpl The previous task priority level to restore.667668**/669typedef670VOID671(EFIAPI *EFI_RESTORE_TPL)(672IN EFI_TPL OldTpl673);674675/**676Returns the value of a variable.677678@param[in] VariableName A Null-terminated string that is the name of the vendor's679variable.680@param[in] VendorGuid A unique identifier for the vendor.681@param[out] Attributes If not NULL, a pointer to the memory location to return the682attributes bitmask for the variable.683@param[in, out] DataSize On input, the size in bytes of the return Data buffer.684On output the size of data returned in Data.685@param[out] Data The buffer to return the contents of the variable. May be NULL686with a zero DataSize in order to determine the size buffer needed.687688@retval EFI_SUCCESS The function completed successfully.689@retval EFI_NOT_FOUND The variable was not found.690@retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the result.691@retval EFI_INVALID_PARAMETER VariableName is NULL.692@retval EFI_INVALID_PARAMETER VendorGuid is NULL.693@retval EFI_INVALID_PARAMETER DataSize is NULL.694@retval EFI_INVALID_PARAMETER The DataSize is not too small and Data is NULL.695@retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error.696@retval EFI_SECURITY_VIOLATION The variable could not be retrieved due to an authentication failure.697@retval EFI_UNSUPPORTED After ExitBootServices() has been called, this return code may be returned698if no variable storage is supported. The platform should describe this699runtime service as unsupported at runtime via an EFI_RT_PROPERTIES_TABLE700configuration table.701702**/703typedef704EFI_STATUS705(EFIAPI *EFI_GET_VARIABLE)(706IN CHAR16 *VariableName,707IN EFI_GUID *VendorGuid,708OUT UINT32 *Attributes OPTIONAL,709IN OUT UINTN *DataSize,710OUT VOID *Data OPTIONAL711);712713/**714Enumerates the current variable names.715716@param[in, out] VariableNameSize The size of the VariableName buffer. The size must be large717enough to fit input string supplied in VariableName buffer.718@param[in, out] VariableName On input, supplies the last VariableName that was returned719by GetNextVariableName(). On output, returns the Nullterminated720string of the current variable.721@param[in, out] VendorGuid On input, supplies the last VendorGuid that was returned by722GetNextVariableName(). On output, returns the723VendorGuid of the current variable.724725@retval EFI_SUCCESS The function completed successfully.726@retval EFI_NOT_FOUND The next variable was not found.727@retval EFI_BUFFER_TOO_SMALL The VariableNameSize is too small for the result.728VariableNameSize has been updated with the size needed to complete the request.729@retval EFI_INVALID_PARAMETER VariableNameSize is NULL.730@retval EFI_INVALID_PARAMETER VariableName is NULL.731@retval EFI_INVALID_PARAMETER VendorGuid is NULL.732@retval EFI_INVALID_PARAMETER The input values of VariableName and VendorGuid are not a name and733GUID of an existing variable.734@retval EFI_INVALID_PARAMETER Null-terminator is not found in the first VariableNameSize bytes of735the input VariableName buffer.736@retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error.737@retval EFI_UNSUPPORTED After ExitBootServices() has been called, this return code may be returned738if no variable storage is supported. The platform should describe this739runtime service as unsupported at runtime via an EFI_RT_PROPERTIES_TABLE740configuration table.741742**/743typedef744EFI_STATUS745(EFIAPI *EFI_GET_NEXT_VARIABLE_NAME)(746IN OUT UINTN *VariableNameSize,747IN OUT CHAR16 *VariableName,748IN OUT EFI_GUID *VendorGuid749);750751/**752Sets the value of a variable.753754@param[in] VariableName A Null-terminated string that is the name of the vendor's variable.755Each VariableName is unique for each VendorGuid. VariableName must756contain 1 or more characters. If VariableName is an empty string,757then EFI_INVALID_PARAMETER is returned.758@param[in] VendorGuid A unique identifier for the vendor.759@param[in] Attributes Attributes bitmask to set for the variable.760@param[in] DataSize The size in bytes of the Data buffer. Unless the EFI_VARIABLE_APPEND_WRITE or761EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS attribute is set, a size of zero762causes the variable to be deleted. When the EFI_VARIABLE_APPEND_WRITE attribute is763set, then a SetVariable() call with a DataSize of zero will not cause any change to764the variable value (the timestamp associated with the variable may be updated however765even if no new data value is provided,see the description of the766EFI_VARIABLE_AUTHENTICATION_2 descriptor below. In this case the DataSize will not767be zero since the EFI_VARIABLE_AUTHENTICATION_2 descriptor will be populated).768@param[in] Data The contents for the variable.769770@retval EFI_SUCCESS The firmware has successfully stored the variable and its data as771defined by the Attributes.772@retval EFI_INVALID_PARAMETER An invalid combination of attribute bits, name, and GUID was supplied, or the773DataSize exceeds the maximum allowed.774@retval EFI_INVALID_PARAMETER VariableName is an empty string.775@retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.776@retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error.777@retval EFI_WRITE_PROTECTED The variable in question is read-only.778@retval EFI_WRITE_PROTECTED The variable in question cannot be deleted.779@retval EFI_SECURITY_VIOLATION The variable could not be written due to EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACESS being set,780but the AuthInfo does NOT pass the validation check carried out by the firmware.781782@retval EFI_NOT_FOUND The variable trying to be updated or deleted was not found.783@retval EFI_UNSUPPORTED This call is not supported by this platform at the time the call is made.784The platform should describe this runtime service as unsupported at runtime785via an EFI_RT_PROPERTIES_TABLE configuration table.786787**/788typedef789EFI_STATUS790(EFIAPI *EFI_SET_VARIABLE)(791IN CHAR16 *VariableName,792IN EFI_GUID *VendorGuid,793IN UINT32 Attributes,794IN UINTN DataSize,795IN VOID *Data796);797798///799/// This provides the capabilities of the800/// real time clock device as exposed through the EFI interfaces.801///802typedef struct {803///804/// Provides the reporting resolution of the real-time clock device in805/// counts per second. For a normal PC-AT CMOS RTC device, this806/// value would be 1 Hz, or 1, to indicate that the device only reports807/// the time to the resolution of 1 second.808///809UINT32 Resolution;810///811/// Provides the timekeeping accuracy of the real-time clock in an812/// error rate of 1E-6 parts per million. For a clock with an accuracy813/// of 50 parts per million, the value in this field would be814/// 50,000,000.815///816UINT32 Accuracy;817///818/// A TRUE indicates that a time set operation clears the device's819/// time below the Resolution reporting level. A FALSE820/// indicates that the state below the Resolution level of the821/// device is not cleared when the time is set. Normal PC-AT CMOS822/// RTC devices set this value to FALSE.823///824BOOLEAN SetsToZero;825} EFI_TIME_CAPABILITIES;826827/**828Returns the current time and date information, and the time-keeping capabilities829of the hardware platform.830831@param[out] Time A pointer to storage to receive a snapshot of the current time.832@param[out] Capabilities An optional pointer to a buffer to receive the real time clock833device's capabilities.834835@retval EFI_SUCCESS The operation completed successfully.836@retval EFI_INVALID_PARAMETER Time is NULL.837@retval EFI_DEVICE_ERROR The time could not be retrieved due to hardware error.838@retval EFI_UNSUPPORTED This call is not supported by this platform at the time the call is made.839The platform should describe this runtime service as unsupported at runtime840via an EFI_RT_PROPERTIES_TABLE configuration table.841842**/843typedef844EFI_STATUS845(EFIAPI *EFI_GET_TIME)(846OUT EFI_TIME *Time,847OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL848);849850/**851Sets the current local time and date information.852853@param[in] Time A pointer to the current time.854855@retval EFI_SUCCESS The operation completed successfully.856@retval EFI_INVALID_PARAMETER A time field is out of range.857@retval EFI_DEVICE_ERROR The time could not be set due due to hardware error.858@retval EFI_UNSUPPORTED This call is not supported by this platform at the time the call is made.859The platform should describe this runtime service as unsupported at runtime860via an EFI_RT_PROPERTIES_TABLE configuration table.861862**/863typedef864EFI_STATUS865(EFIAPI *EFI_SET_TIME)(866IN EFI_TIME *Time867);868869/**870Returns the current wakeup alarm clock setting.871872@param[out] Enabled Indicates if the alarm is currently enabled or disabled.873@param[out] Pending Indicates if the alarm signal is pending and requires acknowledgement.874@param[out] Time The current alarm setting.875876@retval EFI_SUCCESS The alarm settings were returned.877@retval EFI_INVALID_PARAMETER Enabled is NULL.878@retval EFI_INVALID_PARAMETER Pending is NULL.879@retval EFI_INVALID_PARAMETER Time is NULL.880@retval EFI_DEVICE_ERROR The wakeup time could not be retrieved due to a hardware error.881@retval EFI_UNSUPPORTED This call is not supported by this platform at the time the call is made.882The platform should describe this runtime service as unsupported at runtime883via an EFI_RT_PROPERTIES_TABLE configuration table.884885**/886typedef887EFI_STATUS888(EFIAPI *EFI_GET_WAKEUP_TIME)(889OUT BOOLEAN *Enabled,890OUT BOOLEAN *Pending,891OUT EFI_TIME *Time892);893894/**895Sets the system wakeup alarm clock time.896897@param[in] Enable Enable or disable the wakeup alarm.898@param[in] Time If Enable is TRUE, the time to set the wakeup alarm for.899If Enable is FALSE, then this parameter is optional, and may be NULL.900901@retval EFI_SUCCESS If Enable is TRUE, then the wakeup alarm was enabled. If902Enable is FALSE, then the wakeup alarm was disabled.903@retval EFI_INVALID_PARAMETER A time field is out of range.904@retval EFI_DEVICE_ERROR The wakeup time could not be set due to a hardware error.905@retval EFI_UNSUPPORTED This call is not supported by this platform at the time the call is made.906The platform should describe this runtime service as unsupported at runtime907via an EFI_RT_PROPERTIES_TABLE configuration table.908909**/910typedef911EFI_STATUS912(EFIAPI *EFI_SET_WAKEUP_TIME)(913IN BOOLEAN Enable,914IN EFI_TIME *Time OPTIONAL915);916917/**918Loads an EFI image into memory.919920@param[in] BootPolicy If TRUE, indicates that the request originates from the boot921manager, and that the boot manager is attempting to load922FilePath as a boot selection. Ignored if SourceBuffer is923not NULL.924@param[in] ParentImageHandle The caller's image handle.925@param[in] DevicePath The DeviceHandle specific file path from which the image is926loaded.927@param[in] SourceBuffer If not NULL, a pointer to the memory location containing a copy928of the image to be loaded.929@param[in] SourceSize The size in bytes of SourceBuffer. Ignored if SourceBuffer is NULL.930@param[out] ImageHandle The pointer to the returned image handle that is created when the931image is successfully loaded.932933@retval EFI_SUCCESS Image was loaded into memory correctly.934@retval EFI_NOT_FOUND Both SourceBuffer and DevicePath are NULL.935@retval EFI_INVALID_PARAMETER One or more parametes are invalid.936@retval EFI_UNSUPPORTED The image type is not supported.937@retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient resources.938@retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not939understood.940@retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error.941@retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the942image from being loaded. NULL is returned in *ImageHandle.943@retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a944valid EFI_LOADED_IMAGE_PROTOCOL. However, the current945platform policy specifies that the image should not be started.946**/947typedef948EFI_STATUS949(EFIAPI *EFI_IMAGE_LOAD)(950IN BOOLEAN BootPolicy,951IN EFI_HANDLE ParentImageHandle,952IN EFI_DEVICE_PATH_PROTOCOL *DevicePath OPTIONAL,953IN VOID *SourceBuffer OPTIONAL,954IN UINTN SourceSize,955OUT EFI_HANDLE *ImageHandle956);957958/**959Transfers control to a loaded image's entry point.960961@param[in] ImageHandle Handle of image to be started.962@param[out] ExitDataSize The pointer to the size, in bytes, of ExitData.963@param[out] ExitData The pointer to a pointer to a data buffer that includes a Null-terminated964string, optionally followed by additional binary data.965966@retval EFI_INVALID_PARAMETER ImageHandle is either an invalid image handle or the image967has already been initialized with StartImage.968@retval EFI_SECURITY_VIOLATION The current platform policy specifies that the image should not be started.969@return Exit code from image970971**/972typedef973EFI_STATUS974(EFIAPI *EFI_IMAGE_START)(975IN EFI_HANDLE ImageHandle,976OUT UINTN *ExitDataSize,977OUT CHAR16 **ExitData OPTIONAL978);979980/**981Terminates a loaded EFI image and returns control to boot services.982983@param[in] ImageHandle Handle that identifies the image. This parameter is passed to the984image on entry.985@param[in] ExitStatus The image's exit code.986@param[in] ExitDataSize The size, in bytes, of ExitData. Ignored if ExitStatus is EFI_SUCCESS.987@param[in] ExitData The pointer to a data buffer that includes a Null-terminated string,988optionally followed by additional binary data. The string is a989description that the caller may use to further indicate the reason990for the image's exit. ExitData is only valid if ExitStatus991is something other than EFI_SUCCESS. The ExitData buffer992must be allocated by calling AllocatePool().993994@retval EFI_SUCCESS The image specified by ImageHandle was unloaded.995@retval EFI_INVALID_PARAMETER The image specified by ImageHandle has been loaded and996started with LoadImage() and StartImage(), but the997image is not the currently executing image.998999**/1000typedef1001EFI_STATUS1002(EFIAPI *EFI_EXIT)(1003IN EFI_HANDLE ImageHandle,1004IN EFI_STATUS ExitStatus,1005IN UINTN ExitDataSize,1006IN CHAR16 *ExitData OPTIONAL1007);10081009/**1010Unloads an image.10111012@param[in] ImageHandle Handle that identifies the image to be unloaded.10131014@retval EFI_SUCCESS The image has been unloaded.1015@retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle.10161017**/1018typedef1019EFI_STATUS1020(EFIAPI *EFI_IMAGE_UNLOAD)(1021IN EFI_HANDLE ImageHandle1022);10231024/**1025Terminates all boot services.10261027@param[in] ImageHandle Handle that identifies the exiting image.1028@param[in] MapKey Key to the latest memory map.10291030@retval EFI_SUCCESS Boot services have been terminated.1031@retval EFI_INVALID_PARAMETER MapKey is incorrect.10321033**/1034typedef1035EFI_STATUS1036(EFIAPI *EFI_EXIT_BOOT_SERVICES)(1037IN EFI_HANDLE ImageHandle,1038IN UINTN MapKey1039);10401041/**1042Induces a fine-grained stall.10431044@param[in] Microseconds The number of microseconds to stall execution.10451046@retval EFI_SUCCESS Execution was stalled at least the requested number of1047Microseconds.10481049**/1050typedef1051EFI_STATUS1052(EFIAPI *EFI_STALL)(1053IN UINTN Microseconds1054);10551056/**1057Sets the system's watchdog timer.10581059@param[in] Timeout The number of seconds to set the watchdog timer to.1060@param[in] WatchdogCode The numeric code to log on a watchdog timer timeout event.1061@param[in] DataSize The size, in bytes, of WatchdogData.1062@param[in] WatchdogData A data buffer that includes a Null-terminated string, optionally1063followed by additional binary data.10641065@retval EFI_SUCCESS The timeout has been set.1066@retval EFI_INVALID_PARAMETER The supplied WatchdogCode is invalid.1067@retval EFI_UNSUPPORTED The system does not have a watchdog timer.1068@retval EFI_DEVICE_ERROR The watchdog timer could not be programmed due to a hardware1069error.10701071**/1072typedef1073EFI_STATUS1074(EFIAPI *EFI_SET_WATCHDOG_TIMER)(1075IN UINTN Timeout,1076IN UINT64 WatchdogCode,1077IN UINTN DataSize,1078IN CHAR16 *WatchdogData OPTIONAL1079);10801081/**1082Resets the entire platform.10831084@param[in] ResetType The type of reset to perform.1085@param[in] ResetStatus The status code for the reset.1086@param[in] DataSize The size, in bytes, of ResetData.1087@param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or1088EfiResetShutdown the data buffer starts with a Null-terminated1089string, optionally followed by additional binary data.1090The string is a description that the caller may use to further1091indicate the reason for the system reset.1092For a ResetType of EfiResetPlatformSpecific the data buffer1093also starts with a Null-terminated string that is followed1094by an EFI_GUID that describes the specific type of reset to perform.1095**/1096typedef1097VOID1098(EFIAPI *EFI_RESET_SYSTEM)(1099IN EFI_RESET_TYPE ResetType,1100IN EFI_STATUS ResetStatus,1101IN UINTN DataSize,1102IN VOID *ResetData OPTIONAL1103);11041105/**1106Returns a monotonically increasing count for the platform.11071108@param[out] Count The pointer to returned value.11091110@retval EFI_SUCCESS The next monotonic count was returned.1111@retval EFI_INVALID_PARAMETER Count is NULL.1112@retval EFI_DEVICE_ERROR The device is not functioning properly.11131114**/1115typedef1116EFI_STATUS1117(EFIAPI *EFI_GET_NEXT_MONOTONIC_COUNT)(1118OUT UINT64 *Count1119);11201121/**1122Returns the next high 32 bits of the platform's monotonic counter.11231124@param[out] HighCount The pointer to returned value.11251126@retval EFI_SUCCESS The next high monotonic count was returned.1127@retval EFI_INVALID_PARAMETER HighCount is NULL.1128@retval EFI_DEVICE_ERROR The device is not functioning properly.1129@retval EFI_UNSUPPORTED This call is not supported by this platform at the time the call is made.1130The platform should describe this runtime service as unsupported at runtime1131via an EFI_RT_PROPERTIES_TABLE configuration table.11321133**/1134typedef1135EFI_STATUS1136(EFIAPI *EFI_GET_NEXT_HIGH_MONO_COUNT)(1137OUT UINT32 *HighCount1138);11391140/**1141Computes and returns a 32-bit CRC for a data buffer.11421143@param[in] Data A pointer to the buffer on which the 32-bit CRC is to be computed.1144@param[in] DataSize The number of bytes in the buffer Data.1145@param[out] Crc32 The 32-bit CRC that was computed for the data buffer specified by Data1146and DataSize.11471148@retval EFI_SUCCESS The 32-bit CRC was computed for the data buffer and returned in1149Crc32.1150@retval EFI_INVALID_PARAMETER Data is NULL.1151@retval EFI_INVALID_PARAMETER Crc32 is NULL.1152@retval EFI_INVALID_PARAMETER DataSize is 0.11531154**/1155typedef1156EFI_STATUS1157(EFIAPI *EFI_CALCULATE_CRC32)(1158IN VOID *Data,1159IN UINTN DataSize,1160OUT UINT32 *Crc321161);11621163/**1164Copies the contents of one buffer to another buffer.11651166@param[in] Destination The pointer to the destination buffer of the memory copy.1167@param[in] Source The pointer to the source buffer of the memory copy.1168@param[in] Length Number of bytes to copy from Source to Destination.11691170**/1171typedef1172VOID1173(EFIAPI *EFI_COPY_MEM)(1174IN VOID *Destination,1175IN VOID *Source,1176IN UINTN Length1177);11781179/**1180The SetMem() function fills a buffer with a specified value.11811182@param[in] Buffer The pointer to the buffer to fill.1183@param[in] Size Number of bytes in Buffer to fill.1184@param[in] Value Value to fill Buffer with.11851186**/1187typedef1188VOID1189(EFIAPI *EFI_SET_MEM)(1190IN VOID *Buffer,1191IN UINTN Size,1192IN UINT8 Value1193);11941195///1196/// Enumeration of EFI Interface Types1197///1198typedef enum {1199///1200/// Indicates that the supplied protocol interface is supplied in native form.1201///1202EFI_NATIVE_INTERFACE1203} EFI_INTERFACE_TYPE;12041205/**1206Installs a protocol interface on a device handle. If the handle does not exist, it is created and added1207to the list of handles in the system. InstallMultipleProtocolInterfaces() performs1208more error checking than InstallProtocolInterface(), so it is recommended that1209InstallMultipleProtocolInterfaces() be used in place of1210InstallProtocolInterface()12111212@param[in, out] Handle A pointer to the EFI_HANDLE on which the interface is to be installed.1213@param[in] Protocol The numeric ID of the protocol interface.1214@param[in] InterfaceType Indicates whether Interface is supplied in native form.1215@param[in] Interface A pointer to the protocol interface.12161217@retval EFI_SUCCESS The protocol interface was installed.1218@retval EFI_OUT_OF_RESOURCES Space for a new handle could not be allocated.1219@retval EFI_INVALID_PARAMETER Handle is NULL.1220@retval EFI_INVALID_PARAMETER Protocol is NULL.1221@retval EFI_INVALID_PARAMETER InterfaceType is not EFI_NATIVE_INTERFACE.1222@retval EFI_INVALID_PARAMETER Protocol is already installed on the handle specified by Handle.12231224**/1225typedef1226EFI_STATUS1227(EFIAPI *EFI_INSTALL_PROTOCOL_INTERFACE)(1228IN OUT EFI_HANDLE *Handle,1229IN EFI_GUID *Protocol,1230IN EFI_INTERFACE_TYPE InterfaceType,1231IN VOID *Interface1232);12331234/**1235Installs one or more protocol interfaces into the boot services environment.12361237@param[in, out] Handle The pointer to a handle to install the new protocol interfaces on,1238or a pointer to NULL if a new handle is to be allocated.1239@param ... A variable argument list containing pairs of protocol GUIDs and protocol1240interfaces.12411242@retval EFI_SUCCESS All the protocol interface was installed.1243@retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.1244@retval EFI_ALREADY_STARTED A Device Path Protocol instance was passed in that is already present in1245the handle database.1246@retval EFI_INVALID_PARAMETER Handle is NULL.1247@retval EFI_INVALID_PARAMETER Protocol is already installed on the handle specified by Handle.12481249**/1250typedef1251EFI_STATUS1252(EFIAPI *EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES)(1253IN OUT EFI_HANDLE *Handle,1254...1255);12561257/**1258Reinstalls a protocol interface on a device handle.12591260@param[in] Handle Handle on which the interface is to be reinstalled.1261@param[in] Protocol The numeric ID of the interface.1262@param[in] OldInterface A pointer to the old interface. NULL can be used if a structure is not1263associated with Protocol.1264@param[in] NewInterface A pointer to the new interface.12651266@retval EFI_SUCCESS The protocol interface was reinstalled.1267@retval EFI_NOT_FOUND The OldInterface on the handle was not found.1268@retval EFI_ACCESS_DENIED The protocol interface could not be reinstalled,1269because OldInterface is still being used by a1270driver that will not release it.1271@retval EFI_INVALID_PARAMETER Handle is NULL.1272@retval EFI_INVALID_PARAMETER Protocol is NULL.12731274**/1275typedef1276EFI_STATUS1277(EFIAPI *EFI_REINSTALL_PROTOCOL_INTERFACE)(1278IN EFI_HANDLE Handle,1279IN EFI_GUID *Protocol,1280IN VOID *OldInterface,1281IN VOID *NewInterface1282);12831284/**1285Removes a protocol interface from a device handle. It is recommended that1286UninstallMultipleProtocolInterfaces() be used in place of1287UninstallProtocolInterface().12881289@param[in] Handle The handle on which the interface was installed.1290@param[in] Protocol The numeric ID of the interface.1291@param[in] Interface A pointer to the interface.12921293@retval EFI_SUCCESS The interface was removed.1294@retval EFI_NOT_FOUND The interface was not found.1295@retval EFI_ACCESS_DENIED The interface was not removed because the interface1296is still being used by a driver.1297@retval EFI_INVALID_PARAMETER Handle is NULL.1298@retval EFI_INVALID_PARAMETER Protocol is NULL.12991300**/1301typedef1302EFI_STATUS1303(EFIAPI *EFI_UNINSTALL_PROTOCOL_INTERFACE)(1304IN EFI_HANDLE Handle,1305IN EFI_GUID *Protocol,1306IN VOID *Interface1307);13081309/**1310Removes one or more protocol interfaces into the boot services environment.13111312@param[in] Handle The handle to remove the protocol interfaces from.1313@param ... A variable argument list containing pairs of protocol GUIDs and1314protocol interfaces.13151316@retval EFI_SUCCESS All the protocol interfaces were removed.1317@retval EFI_INVALID_PARAMETER One of the protocol interfaces was not previously installed on Handle.13181319**/1320typedef1321EFI_STATUS1322(EFIAPI *EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES)(1323IN EFI_HANDLE Handle,1324...1325);13261327/**1328Queries a handle to determine if it supports a specified protocol.13291330@param[in] Handle The handle being queried.1331@param[in] Protocol The published unique identifier of the protocol.1332@param[out] Interface Supplies the address where a pointer to the corresponding Protocol1333Interface is returned.13341335@retval EFI_SUCCESS The interface information for the specified protocol was returned.1336@retval EFI_UNSUPPORTED The device does not support the specified protocol.1337@retval EFI_INVALID_PARAMETER Handle is NULL.1338@retval EFI_INVALID_PARAMETER Protocol is NULL.1339@retval EFI_INVALID_PARAMETER Interface is NULL.13401341**/1342typedef1343EFI_STATUS1344(EFIAPI *EFI_HANDLE_PROTOCOL)(1345IN EFI_HANDLE Handle,1346IN EFI_GUID *Protocol,1347OUT VOID **Interface1348);13491350#define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL 0x000000011351#define EFI_OPEN_PROTOCOL_GET_PROTOCOL 0x000000021352#define EFI_OPEN_PROTOCOL_TEST_PROTOCOL 0x000000041353#define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x000000081354#define EFI_OPEN_PROTOCOL_BY_DRIVER 0x000000101355#define EFI_OPEN_PROTOCOL_EXCLUSIVE 0x0000002013561357/**1358Queries a handle to determine if it supports a specified protocol. If the protocol is supported by the1359handle, it opens the protocol on behalf of the calling agent.13601361@param[in] Handle The handle for the protocol interface that is being opened.1362@param[in] Protocol The published unique identifier of the protocol.1363@param[out] Interface Supplies the address where a pointer to the corresponding Protocol1364Interface is returned.1365@param[in] AgentHandle The handle of the agent that is opening the protocol interface1366specified by Protocol and Interface.1367@param[in] ControllerHandle If the agent that is opening a protocol is a driver that follows the1368UEFI Driver Model, then this parameter is the controller handle1369that requires the protocol interface. If the agent does not follow1370the UEFI Driver Model, then this parameter is optional and may1371be NULL.1372@param[in] Attributes The open mode of the protocol interface specified by Handle1373and Protocol.13741375@retval EFI_SUCCESS An item was added to the open list for the protocol interface, and the1376protocol interface was returned in Interface.1377@retval EFI_UNSUPPORTED Handle does not support Protocol.1378@retval EFI_INVALID_PARAMETER One or more parameters are invalid.1379@retval EFI_ACCESS_DENIED Required attributes can't be supported in current environment.1380@retval EFI_ALREADY_STARTED Item on the open list already has requierd attributes whose agent1381handle is the same as AgentHandle.13821383**/1384typedef1385EFI_STATUS1386(EFIAPI *EFI_OPEN_PROTOCOL)(1387IN EFI_HANDLE Handle,1388IN EFI_GUID *Protocol,1389OUT VOID **Interface OPTIONAL,1390IN EFI_HANDLE AgentHandle,1391IN EFI_HANDLE ControllerHandle,1392IN UINT32 Attributes1393);13941395/**1396Closes a protocol on a handle that was opened using OpenProtocol().13971398@param[in] Handle The handle for the protocol interface that was previously opened1399with OpenProtocol(), and is now being closed.1400@param[in] Protocol The published unique identifier of the protocol.1401@param[in] AgentHandle The handle of the agent that is closing the protocol interface.1402@param[in] ControllerHandle If the agent that opened a protocol is a driver that follows the1403UEFI Driver Model, then this parameter is the controller handle1404that required the protocol interface.14051406@retval EFI_SUCCESS The protocol instance was closed.1407@retval EFI_INVALID_PARAMETER 1) Handle is NULL.14082) AgentHandle is NULL.14093) ControllerHandle is not NULL and ControllerHandle is not a valid EFI_HANDLE.14104) Protocol is NULL.1411@retval EFI_NOT_FOUND 1) Handle does not support the protocol specified by Protocol.14122) The protocol interface specified by Handle and Protocol is not1413currently open by AgentHandle and ControllerHandle.14141415**/1416typedef1417EFI_STATUS1418(EFIAPI *EFI_CLOSE_PROTOCOL)(1419IN EFI_HANDLE Handle,1420IN EFI_GUID *Protocol,1421IN EFI_HANDLE AgentHandle,1422IN EFI_HANDLE ControllerHandle1423);14241425///1426/// EFI Oprn Protocol Information Entry1427///1428typedef struct {1429EFI_HANDLE AgentHandle;1430EFI_HANDLE ControllerHandle;1431UINT32 Attributes;1432UINT32 OpenCount;1433} EFI_OPEN_PROTOCOL_INFORMATION_ENTRY;14341435/**1436Retrieves the list of agents that currently have a protocol interface opened.14371438@param[in] Handle The handle for the protocol interface that is being queried.1439@param[in] Protocol The published unique identifier of the protocol.1440@param[out] EntryBuffer A pointer to a buffer of open protocol information in the form of1441EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.1442@param[out] EntryCount A pointer to the number of entries in EntryBuffer.14431444@retval EFI_SUCCESS The open protocol information was returned in EntryBuffer, and the1445number of entries was returned EntryCount.1446@retval EFI_OUT_OF_RESOURCES There are not enough resources available to allocate EntryBuffer.1447@retval EFI_NOT_FOUND Handle does not support the protocol specified by Protocol.14481449**/1450typedef1451EFI_STATUS1452(EFIAPI *EFI_OPEN_PROTOCOL_INFORMATION)(1453IN EFI_HANDLE Handle,1454IN EFI_GUID *Protocol,1455OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,1456OUT UINTN *EntryCount1457);14581459/**1460Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated1461from pool.14621463@param[in] Handle The handle from which to retrieve the list of protocol interface1464GUIDs.1465@param[out] ProtocolBuffer A pointer to the list of protocol interface GUID pointers that are1466installed on Handle.1467@param[out] ProtocolBufferCount A pointer to the number of GUID pointers present in1468ProtocolBuffer.14691470@retval EFI_SUCCESS The list of protocol interface GUIDs installed on Handle was returned in1471ProtocolBuffer. The number of protocol interface GUIDs was1472returned in ProtocolBufferCount.1473@retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the results.1474@retval EFI_INVALID_PARAMETER Handle is NULL.1475@retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.1476@retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.1477@retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.14781479**/1480typedef1481EFI_STATUS1482(EFIAPI *EFI_PROTOCOLS_PER_HANDLE)(1483IN EFI_HANDLE Handle,1484OUT EFI_GUID ***ProtocolBuffer,1485OUT UINTN *ProtocolBufferCount1486);14871488/**1489Creates an event that is to be signaled whenever an interface is installed for a specified protocol.14901491@param[in] Protocol The numeric ID of the protocol for which the event is to be registered.1492@param[in] Event Event that is to be signaled whenever a protocol interface is registered1493for Protocol.1494@param[out] Registration A pointer to a memory location to receive the registration value.14951496@retval EFI_SUCCESS The notification event has been registered.1497@retval EFI_OUT_OF_RESOURCES Space for the notification event could not be allocated.1498@retval EFI_INVALID_PARAMETER Protocol is NULL.1499@retval EFI_INVALID_PARAMETER Event is NULL.1500@retval EFI_INVALID_PARAMETER Registration is NULL.15011502**/1503typedef1504EFI_STATUS1505(EFIAPI *EFI_REGISTER_PROTOCOL_NOTIFY)(1506IN EFI_GUID *Protocol,1507IN EFI_EVENT Event,1508OUT VOID **Registration1509);15101511///1512/// Enumeration of EFI Locate Search Types1513///1514typedef enum {1515///1516/// Retrieve all the handles in the handle database.1517///1518AllHandles,1519///1520/// Retrieve the next handle fron a RegisterProtocolNotify() event.1521///1522ByRegisterNotify,1523///1524/// Retrieve the set of handles from the handle database that support a1525/// specified protocol.1526///1527ByProtocol1528} EFI_LOCATE_SEARCH_TYPE;15291530/**1531Returns an array of handles that support a specified protocol.15321533@param[in] SearchType Specifies which handle(s) are to be returned.1534@param[in] Protocol Specifies the protocol to search by.1535@param[in] SearchKey Specifies the search key.1536@param[in, out] BufferSize On input, the size in bytes of Buffer. On output, the size in bytes of1537the array returned in Buffer (if the buffer was large enough) or the1538size, in bytes, of the buffer needed to obtain the array (if the buffer was1539not large enough).1540@param[out] Buffer The buffer in which the array is returned.15411542@retval EFI_SUCCESS The array of handles was returned.1543@retval EFI_NOT_FOUND No handles match the search.1544@retval EFI_BUFFER_TOO_SMALL The BufferSize is too small for the result.1545@retval EFI_INVALID_PARAMETER SearchType is not a member of EFI_LOCATE_SEARCH_TYPE.1546@retval EFI_INVALID_PARAMETER SearchType is ByRegisterNotify and SearchKey is NULL.1547@retval EFI_INVALID_PARAMETER SearchType is ByProtocol and Protocol is NULL.1548@retval EFI_INVALID_PARAMETER One or more matches are found and BufferSize is NULL.1549@retval EFI_INVALID_PARAMETER BufferSize is large enough for the result and Buffer is NULL.15501551**/1552typedef1553EFI_STATUS1554(EFIAPI *EFI_LOCATE_HANDLE)(1555IN EFI_LOCATE_SEARCH_TYPE SearchType,1556IN EFI_GUID *Protocol OPTIONAL,1557IN VOID *SearchKey OPTIONAL,1558IN OUT UINTN *BufferSize,1559OUT EFI_HANDLE *Buffer1560);15611562/**1563Locates the handle to a device on the device path that supports the specified protocol.15641565@param[in] Protocol Specifies the protocol to search for.1566@param[in, out] DevicePath On input, a pointer to a pointer to the device path. On output, the device1567path pointer is modified to point to the remaining part of the device1568path.1569@param[out] Device A pointer to the returned device handle.15701571@retval EFI_SUCCESS The resulting handle was returned.1572@retval EFI_NOT_FOUND No handles match the search.1573@retval EFI_INVALID_PARAMETER Protocol is NULL.1574@retval EFI_INVALID_PARAMETER DevicePath is NULL.1575@retval EFI_INVALID_PARAMETER A handle matched the search and Device is NULL.15761577**/1578typedef1579EFI_STATUS1580(EFIAPI *EFI_LOCATE_DEVICE_PATH)(1581IN EFI_GUID *Protocol,1582IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,1583OUT EFI_HANDLE *Device1584);15851586/**1587Adds, updates, or removes a configuration table entry from the EFI System Table.15881589@param[in] Guid A pointer to the GUID for the entry to add, update, or remove.1590@param[in] Table A pointer to the configuration table for the entry to add, update, or1591remove. May be NULL.15921593@retval EFI_SUCCESS The (Guid, Table) pair was added, updated, or removed.1594@retval EFI_NOT_FOUND An attempt was made to delete a nonexistent entry.1595@retval EFI_INVALID_PARAMETER Guid is NULL.1596@retval EFI_OUT_OF_RESOURCES There is not enough memory available to complete the operation.15971598**/1599typedef1600EFI_STATUS1601(EFIAPI *EFI_INSTALL_CONFIGURATION_TABLE)(1602IN EFI_GUID *Guid,1603IN VOID *Table1604);16051606/**1607Returns an array of handles that support the requested protocol in a buffer allocated from pool.16081609@param[in] SearchType Specifies which handle(s) are to be returned.1610@param[in] Protocol Provides the protocol to search by.1611This parameter is only valid for a SearchType of ByProtocol.1612@param[in] SearchKey Supplies the search key depending on the SearchType.1613@param[out] NoHandles The number of handles returned in Buffer.1614@param[out] Buffer A pointer to the buffer to return the requested array of handles that1615support Protocol.16161617@retval EFI_SUCCESS The array of handles was returned in Buffer, and the number of1618handles in Buffer was returned in NoHandles.1619@retval EFI_NOT_FOUND No handles match the search.1620@retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the matching results.1621@retval EFI_INVALID_PARAMETER NoHandles is NULL.1622@retval EFI_INVALID_PARAMETER Buffer is NULL.16231624**/1625typedef1626EFI_STATUS1627(EFIAPI *EFI_LOCATE_HANDLE_BUFFER)(1628IN EFI_LOCATE_SEARCH_TYPE SearchType,1629IN EFI_GUID *Protocol OPTIONAL,1630IN VOID *SearchKey OPTIONAL,1631OUT UINTN *NoHandles,1632OUT EFI_HANDLE **Buffer1633);16341635/**1636Returns the first protocol instance that matches the given protocol.16371638@param[in] Protocol Provides the protocol to search for.1639@param[in] Registration Optional registration key returned from1640RegisterProtocolNotify().1641@param[out] Interface On return, a pointer to the first interface that matches Protocol and1642Registration.16431644@retval EFI_SUCCESS A protocol instance matching Protocol was found and returned in1645Interface.1646@retval EFI_NOT_FOUND No protocol instances were found that match Protocol and1647Registration.1648@retval EFI_INVALID_PARAMETER Interface is NULL.1649Protocol is NULL.16501651**/1652typedef1653EFI_STATUS1654(EFIAPI *EFI_LOCATE_PROTOCOL)(1655IN EFI_GUID *Protocol,1656IN VOID *Registration OPTIONAL,1657OUT VOID **Interface1658);16591660///1661/// EFI Capsule Block Descriptor1662///1663typedef struct {1664///1665/// Length in bytes of the data pointed to by DataBlock/ContinuationPointer.1666///1667UINT64 Length;1668union {1669///1670/// Physical address of the data block. This member of the union is1671/// used if Length is not equal to zero.1672///1673EFI_PHYSICAL_ADDRESS DataBlock;1674///1675/// Physical address of another block of1676/// EFI_CAPSULE_BLOCK_DESCRIPTOR structures. This1677/// member of the union is used if Length is equal to zero. If1678/// ContinuationPointer is zero this entry represents the end of the list.1679///1680EFI_PHYSICAL_ADDRESS ContinuationPointer;1681} Union;1682} EFI_CAPSULE_BLOCK_DESCRIPTOR;16831684///1685/// EFI Capsule Header.1686///1687typedef struct {1688///1689/// A GUID that defines the contents of a capsule.1690///1691EFI_GUID CapsuleGuid;1692///1693/// The size of the capsule header. This may be larger than the size of1694/// the EFI_CAPSULE_HEADER since CapsuleGuid may imply1695/// extended header entries1696///1697UINT32 HeaderSize;1698///1699/// Bit-mapped list describing the capsule attributes. The Flag values1700/// of 0x0000 - 0xFFFF are defined by CapsuleGuid. Flag values1701/// of 0x10000 - 0xFFFFFFFF are defined by this specification1702///1703UINT32 Flags;1704///1705/// Size in bytes of the capsule (including capsule header).1706///1707UINT32 CapsuleImageSize;1708} EFI_CAPSULE_HEADER;17091710///1711/// The EFI System Table entry must point to an array of capsules1712/// that contain the same CapsuleGuid value. The array must be1713/// prefixed by a UINT32 that represents the size of the array of capsules.1714///1715typedef struct {1716///1717/// the size of the array of capsules.1718///1719UINT32 CapsuleArrayNumber;1720///1721/// Point to an array of capsules that contain the same CapsuleGuid value.1722///1723VOID *CapsulePtr[1];1724} EFI_CAPSULE_TABLE;17251726#define CAPSULE_FLAGS_PERSIST_ACROSS_RESET 0x000100001727#define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE 0x000200001728#define CAPSULE_FLAGS_INITIATE_RESET 0x0004000017291730/**1731Passes capsules to the firmware with both virtual and physical mapping. Depending on the intended1732consumption, the firmware may process the capsule immediately. If the payload should persist1733across a system reset, the reset value returned from EFI_QueryCapsuleCapabilities must1734be passed into ResetSystem() and will cause the capsule to be processed by the firmware as1735part of the reset process.17361737@param[in] CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules1738being passed into update capsule.1739@param[in] CapsuleCount Number of pointers to EFI_CAPSULE_HEADER in1740CaspuleHeaderArray.1741@param[in] ScatterGatherList Physical pointer to a set of1742EFI_CAPSULE_BLOCK_DESCRIPTOR that describes the1743location in physical memory of a set of capsules.17441745@retval EFI_SUCCESS Valid capsule was passed. If1746CAPSULE_FLAGS_PERSIT_ACROSS_RESET is not set, the1747capsule has been successfully processed by the firmware.1748@retval EFI_INVALID_PARAMETER CapsuleSize is NULL, or an incompatible set of flags were1749set in the capsule header.1750@retval EFI_INVALID_PARAMETER CapsuleCount is 0.1751@retval EFI_DEVICE_ERROR The capsule update was started, but failed due to a device error.1752@retval EFI_UNSUPPORTED The capsule type is not supported on this platform.1753@retval EFI_OUT_OF_RESOURCES When ExitBootServices() has been previously called this error indicates the capsule1754is compatible with this platform but is not capable of being submitted or processed1755in runtime. The caller may resubmit the capsule prior to ExitBootServices().1756@retval EFI_OUT_OF_RESOURCES When ExitBootServices() has not been previously called then this error indicates1757the capsule is compatible with this platform but there are insufficient resources to process.1758@retval EFI_UNSUPPORTED This call is not supported by this platform at the time the call is made.1759The platform should describe this runtime service as unsupported at runtime1760via an EFI_RT_PROPERTIES_TABLE configuration table.17611762**/1763typedef1764EFI_STATUS1765(EFIAPI *EFI_UPDATE_CAPSULE)(1766IN EFI_CAPSULE_HEADER **CapsuleHeaderArray,1767IN UINTN CapsuleCount,1768IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL1769);17701771/**1772Returns if the capsule can be supported via UpdateCapsule().17731774@param[in] CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules1775being passed into update capsule.1776@param[in] CapsuleCount Number of pointers to EFI_CAPSULE_HEADER in1777CaspuleHeaderArray.1778@param[out] MaxiumCapsuleSize On output the maximum size that UpdateCapsule() can1779support as an argument to UpdateCapsule() via1780CapsuleHeaderArray and ScatterGatherList.1781@param[out] ResetType Returns the type of reset required for the capsule update.17821783@retval EFI_SUCCESS Valid answer returned.1784@retval EFI_UNSUPPORTED The capsule type is not supported on this platform, and1785MaximumCapsuleSize and ResetType are undefined.1786@retval EFI_INVALID_PARAMETER MaximumCapsuleSize is NULL.1787@retval EFI_OUT_OF_RESOURCES When ExitBootServices() has been previously called this error indicates the capsule1788is compatible with this platform but is not capable of being submitted or processed1789in runtime. The caller may resubmit the capsule prior to ExitBootServices().1790@retval EFI_OUT_OF_RESOURCES When ExitBootServices() has not been previously called then this error indicates1791the capsule is compatible with this platform but there are insufficient resources to process.1792@retval EFI_UNSUPPORTED This call is not supported by this platform at the time the call is made.1793The platform should describe this runtime service as unsupported at runtime1794via an EFI_RT_PROPERTIES_TABLE configuration table.17951796**/1797typedef1798EFI_STATUS1799(EFIAPI *EFI_QUERY_CAPSULE_CAPABILITIES)(1800IN EFI_CAPSULE_HEADER **CapsuleHeaderArray,1801IN UINTN CapsuleCount,1802OUT UINT64 *MaximumCapsuleSize,1803OUT EFI_RESET_TYPE *ResetType1804);18051806/**1807Returns information about the EFI variables.18081809@param[in] Attributes Attributes bitmask to specify the type of variables on1810which to return information.1811@param[out] MaximumVariableStorageSize On output the maximum size of the storage space1812available for the EFI variables associated with the1813attributes specified.1814@param[out] RemainingVariableStorageSize Returns the remaining size of the storage space1815available for the EFI variables associated with the1816attributes specified.1817@param[out] MaximumVariableSize Returns the maximum size of the individual EFI1818variables associated with the attributes specified.18191820@retval EFI_SUCCESS Valid answer returned.1821@retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied1822@retval EFI_UNSUPPORTED The attribute is not supported on this platform, and the1823MaximumVariableStorageSize,1824RemainingVariableStorageSize, MaximumVariableSize1825are undefined.18261827**/1828typedef1829EFI_STATUS1830(EFIAPI *EFI_QUERY_VARIABLE_INFO)(1831IN UINT32 Attributes,1832OUT UINT64 *MaximumVariableStorageSize,1833OUT UINT64 *RemainingVariableStorageSize,1834OUT UINT64 *MaximumVariableSize1835);18361837//1838// Firmware should stop at a firmware user interface on next boot1839//1840#define EFI_OS_INDICATIONS_BOOT_TO_FW_UI 0x00000000000000011841#define EFI_OS_INDICATIONS_TIMESTAMP_REVOCATION 0x00000000000000021842#define EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED 0x00000000000000041843#define EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED 0x00000000000000081844#define EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED 0x00000000000000101845#define EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY 0x00000000000000401846#define EFI_OS_INDICATIONS_JSON_CONFIG_DATA_REFRESH 0x000000000000008018471848//1849// EFI Runtime Services Table1850//1851#define EFI_SYSTEM_TABLE_SIGNATURE SIGNATURE_64 ('I','B','I',' ','S','Y','S','T')1852#define EFI_2_110_SYSTEM_TABLE_REVISION ((2 << 16) | (110))1853#define EFI_2_100_SYSTEM_TABLE_REVISION ((2 << 16) | (100))1854#define EFI_2_90_SYSTEM_TABLE_REVISION ((2 << 16) | (90))1855#define EFI_2_80_SYSTEM_TABLE_REVISION ((2 << 16) | (80))1856#define EFI_2_70_SYSTEM_TABLE_REVISION ((2 << 16) | (70))1857#define EFI_2_60_SYSTEM_TABLE_REVISION ((2 << 16) | (60))1858#define EFI_2_50_SYSTEM_TABLE_REVISION ((2 << 16) | (50))1859#define EFI_2_40_SYSTEM_TABLE_REVISION ((2 << 16) | (40))1860#define EFI_2_31_SYSTEM_TABLE_REVISION ((2 << 16) | (31))1861#define EFI_2_30_SYSTEM_TABLE_REVISION ((2 << 16) | (30))1862#define EFI_2_20_SYSTEM_TABLE_REVISION ((2 << 16) | (20))1863#define EFI_2_10_SYSTEM_TABLE_REVISION ((2 << 16) | (10))1864#define EFI_2_00_SYSTEM_TABLE_REVISION ((2 << 16) | (00))1865#define EFI_1_10_SYSTEM_TABLE_REVISION ((1 << 16) | (10))1866#define EFI_1_02_SYSTEM_TABLE_REVISION ((1 << 16) | (02))1867#define EFI_SYSTEM_TABLE_REVISION EFI_2_70_SYSTEM_TABLE_REVISION1868#define EFI_SPECIFICATION_VERSION EFI_SYSTEM_TABLE_REVISION18691870#define EFI_RUNTIME_SERVICES_SIGNATURE SIGNATURE_64 ('R','U','N','T','S','E','R','V')1871#define EFI_RUNTIME_SERVICES_REVISION EFI_SPECIFICATION_VERSION18721873///1874/// EFI Runtime Services Table.1875///1876typedef struct {1877///1878/// The table header for the EFI Runtime Services Table.1879///1880EFI_TABLE_HEADER Hdr;18811882//1883// Time Services1884//1885EFI_GET_TIME GetTime;1886EFI_SET_TIME SetTime;1887EFI_GET_WAKEUP_TIME GetWakeupTime;1888EFI_SET_WAKEUP_TIME SetWakeupTime;18891890//1891// Virtual Memory Services1892//1893EFI_SET_VIRTUAL_ADDRESS_MAP SetVirtualAddressMap;1894EFI_CONVERT_POINTER ConvertPointer;18951896//1897// Variable Services1898//1899EFI_GET_VARIABLE GetVariable;1900EFI_GET_NEXT_VARIABLE_NAME GetNextVariableName;1901EFI_SET_VARIABLE SetVariable;19021903//1904// Miscellaneous Services1905//1906EFI_GET_NEXT_HIGH_MONO_COUNT GetNextHighMonotonicCount;1907EFI_RESET_SYSTEM ResetSystem;19081909//1910// UEFI 2.0 Capsule Services1911//1912EFI_UPDATE_CAPSULE UpdateCapsule;1913EFI_QUERY_CAPSULE_CAPABILITIES QueryCapsuleCapabilities;19141915//1916// Miscellaneous UEFI 2.0 Service1917//1918EFI_QUERY_VARIABLE_INFO QueryVariableInfo;1919} EFI_RUNTIME_SERVICES;19201921#define EFI_BOOT_SERVICES_SIGNATURE SIGNATURE_64 ('B','O','O','T','S','E','R','V')1922#define EFI_BOOT_SERVICES_REVISION EFI_SPECIFICATION_VERSION19231924///1925/// EFI Boot Services Table.1926///1927typedef struct {1928///1929/// The table header for the EFI Boot Services Table.1930///1931EFI_TABLE_HEADER Hdr;19321933//1934// Task Priority Services1935//1936EFI_RAISE_TPL RaiseTPL;1937EFI_RESTORE_TPL RestoreTPL;19381939//1940// Memory Services1941//1942EFI_ALLOCATE_PAGES AllocatePages;1943EFI_FREE_PAGES FreePages;1944EFI_GET_MEMORY_MAP GetMemoryMap;1945EFI_ALLOCATE_POOL AllocatePool;1946EFI_FREE_POOL FreePool;19471948//1949// Event & Timer Services1950//1951EFI_CREATE_EVENT CreateEvent;1952EFI_SET_TIMER SetTimer;1953EFI_WAIT_FOR_EVENT WaitForEvent;1954EFI_SIGNAL_EVENT SignalEvent;1955EFI_CLOSE_EVENT CloseEvent;1956EFI_CHECK_EVENT CheckEvent;19571958//1959// Protocol Handler Services1960//1961EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface;1962EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface;1963EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface;1964EFI_HANDLE_PROTOCOL HandleProtocol;1965VOID *Reserved;1966EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify;1967EFI_LOCATE_HANDLE LocateHandle;1968EFI_LOCATE_DEVICE_PATH LocateDevicePath;1969EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable;19701971//1972// Image Services1973//1974EFI_IMAGE_LOAD LoadImage;1975EFI_IMAGE_START StartImage;1976EFI_EXIT Exit;1977EFI_IMAGE_UNLOAD UnloadImage;1978EFI_EXIT_BOOT_SERVICES ExitBootServices;19791980//1981// Miscellaneous Services1982//1983EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount;1984EFI_STALL Stall;1985EFI_SET_WATCHDOG_TIMER SetWatchdogTimer;19861987//1988// DriverSupport Services1989//1990EFI_CONNECT_CONTROLLER ConnectController;1991EFI_DISCONNECT_CONTROLLER DisconnectController;19921993//1994// Open and Close Protocol Services1995//1996EFI_OPEN_PROTOCOL OpenProtocol;1997EFI_CLOSE_PROTOCOL CloseProtocol;1998EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation;19992000//2001// Library Services2002//2003EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle;2004EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer;2005EFI_LOCATE_PROTOCOL LocateProtocol;2006EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces;2007EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces;20082009//2010// 32-bit CRC Services2011//2012EFI_CALCULATE_CRC32 CalculateCrc32;20132014//2015// Miscellaneous Services2016//2017EFI_COPY_MEM CopyMem;2018EFI_SET_MEM SetMem;2019EFI_CREATE_EVENT_EX CreateEventEx;2020} EFI_BOOT_SERVICES;20212022///2023/// Contains a set of GUID/pointer pairs comprised of the ConfigurationTable field in the2024/// EFI System Table.2025///2026typedef struct {2027///2028/// The 128-bit GUID value that uniquely identifies the system configuration table.2029///2030EFI_GUID VendorGuid;2031///2032/// A pointer to the table associated with VendorGuid.2033///2034VOID *VendorTable;2035} EFI_CONFIGURATION_TABLE;20362037///2038/// EFI System Table2039///2040typedef struct {2041///2042/// The table header for the EFI System Table.2043///2044EFI_TABLE_HEADER Hdr;2045///2046/// A pointer to a null terminated string that identifies the vendor2047/// that produces the system firmware for the platform.2048///2049CHAR16 *FirmwareVendor;2050///2051/// A firmware vendor specific value that identifies the revision2052/// of the system firmware for the platform.2053///2054UINT32 FirmwareRevision;2055///2056/// The handle for the active console input device. This handle must support2057/// EFI_SIMPLE_TEXT_INPUT_PROTOCOL and EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL. If2058/// there is no active console, these protocols must still be present.2059///2060EFI_HANDLE ConsoleInHandle;2061///2062/// A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL interface that is2063/// associated with ConsoleInHandle.2064///2065EFI_SIMPLE_TEXT_INPUT_PROTOCOL *ConIn;2066///2067/// The handle for the active console output device. This handle must support the2068/// EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL. If there is no active console, these protocols2069/// must still be present.2070///2071EFI_HANDLE ConsoleOutHandle;2072///2073/// A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface2074/// that is associated with ConsoleOutHandle.2075///2076EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut;2077///2078/// The handle for the active standard error console device.2079/// This handle must support the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL. If there2080/// is no active console, this protocol must still be present.2081///2082EFI_HANDLE StandardErrorHandle;2083///2084/// A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface2085/// that is associated with StandardErrorHandle.2086///2087EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *StdErr;2088///2089/// A pointer to the EFI Runtime Services Table.2090///2091EFI_RUNTIME_SERVICES *RuntimeServices;2092///2093/// A pointer to the EFI Boot Services Table.2094///2095EFI_BOOT_SERVICES *BootServices;2096///2097/// The number of system configuration tables in the buffer ConfigurationTable.2098///2099UINTN NumberOfTableEntries;2100///2101/// A pointer to the system configuration tables.2102/// The number of entries in the table is NumberOfTableEntries.2103///2104EFI_CONFIGURATION_TABLE *ConfigurationTable;2105} EFI_SYSTEM_TABLE;21062107/**2108This is the declaration of an EFI image entry point. This entry point is2109the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including2110both device drivers and bus drivers.21112112@param[in] ImageHandle The firmware allocated handle for the UEFI image.2113@param[in] SystemTable A pointer to the EFI System Table.21142115@retval EFI_SUCCESS The operation completed successfully.2116@retval Others An unexpected error occurred.2117**/2118typedef2119EFI_STATUS2120(EFIAPI *EFI_IMAGE_ENTRY_POINT)(2121IN EFI_HANDLE ImageHandle,2122IN EFI_SYSTEM_TABLE *SystemTable2123);21242125//2126// EFI Load Option. This data structure describes format of UEFI boot option variables.2127//2128// NOTE: EFI Load Option is a byte packed buffer of variable length fields.2129// The first two fields have fixed length. They are declared as members of the2130// EFI_LOAD_OPTION structure. All the other fields are variable length fields.2131// They are listed in the comment block below for reference purposes.2132//2133#pragma pack(1)2134typedef struct _EFI_LOAD_OPTION {2135///2136/// The attributes for this load option entry. All unused bits must be zero2137/// and are reserved by the UEFI specification for future growth.2138///2139UINT32 Attributes;2140///2141/// Length in bytes of the FilePathList. OptionalData starts at offset2142/// sizeof(UINT32) + sizeof(UINT16) + StrSize(Description) + FilePathListLength2143/// of the EFI_LOAD_OPTION descriptor.2144///2145UINT16 FilePathListLength;2146///2147/// The user readable description for the load option.2148/// This field ends with a Null character.2149///2150// CHAR16 Description[];2151///2152/// A packed array of UEFI device paths. The first element of the array is a2153/// device path that describes the device and location of the Image for this2154/// load option. The FilePathList[0] is specific to the device type. Other2155/// device paths may optionally exist in the FilePathList, but their usage is2156/// OSV specific. Each element in the array is variable length, and ends at2157/// the device path end structure. Because the size of Description is2158/// arbitrary, this data structure is not guaranteed to be aligned on a2159/// natural boundary. This data structure may have to be copied to an aligned2160/// natural boundary before it is used.2161///2162// EFI_DEVICE_PATH_PROTOCOL FilePathList[];2163///2164/// The remaining bytes in the load option descriptor are a binary data buffer2165/// that is passed to the loaded image. If the field is zero bytes long, a2166/// NULL pointer is passed to the loaded image. The number of bytes in2167/// OptionalData can be computed by subtracting the starting offset of2168/// OptionalData from total size in bytes of the EFI_LOAD_OPTION.2169///2170// UINT8 OptionalData[];2171} EFI_LOAD_OPTION;2172#pragma pack()21732174//2175// EFI Load Options Attributes2176//2177#define LOAD_OPTION_ACTIVE 0x000000012178#define LOAD_OPTION_FORCE_RECONNECT 0x000000022179#define LOAD_OPTION_HIDDEN 0x000000082180#define LOAD_OPTION_CATEGORY 0x00001F0021812182#define LOAD_OPTION_CATEGORY_BOOT 0x000000002183#define LOAD_OPTION_CATEGORY_APP 0x0000010021842185#define EFI_BOOT_OPTION_SUPPORT_KEY 0x000000012186#define EFI_BOOT_OPTION_SUPPORT_APP 0x000000022187#define EFI_BOOT_OPTION_SUPPORT_SYSPREP 0x000000102188#define EFI_BOOT_OPTION_SUPPORT_COUNT 0x0000030021892190///2191/// EFI Boot Key Data2192///2193typedef union {2194struct {2195///2196/// Indicates the revision of the EFI_KEY_OPTION structure. This revision level should be 0.2197///2198UINT32 Revision : 8;2199///2200/// Either the left or right Shift keys must be pressed (1) or must not be pressed (0).2201///2202UINT32 ShiftPressed : 1;2203///2204/// Either the left or right Control keys must be pressed (1) or must not be pressed (0).2205///2206UINT32 ControlPressed : 1;2207///2208/// Either the left or right Alt keys must be pressed (1) or must not be pressed (0).2209///2210UINT32 AltPressed : 1;2211///2212/// Either the left or right Logo keys must be pressed (1) or must not be pressed (0).2213///2214UINT32 LogoPressed : 1;2215///2216/// The Menu key must be pressed (1) or must not be pressed (0).2217///2218UINT32 MenuPressed : 1;2219///2220/// The SysReq key must be pressed (1) or must not be pressed (0).2221///2222UINT32 SysReqPressed : 1;2223UINT32 Reserved : 16;2224///2225/// Specifies the actual number of entries in EFI_KEY_OPTION.Keys, from 0-3. If2226/// zero, then only the shift state is considered. If more than one, then the boot option will2227/// only be launched if all of the specified keys are pressed with the same shift state.2228///2229UINT32 InputKeyCount : 2;2230} Options;2231UINT32 PackedValue;2232} EFI_BOOT_KEY_DATA;22332234///2235/// EFI Key Option.2236///2237#pragma pack(1)2238typedef struct {2239///2240/// Specifies options about how the key will be processed.2241///2242EFI_BOOT_KEY_DATA KeyData;2243///2244/// The CRC-32 which should match the CRC-32 of the entire EFI_LOAD_OPTION to2245/// which BootOption refers. If the CRC-32s do not match this value, then this key2246/// option is ignored.2247///2248UINT32 BootOptionCrc;2249///2250/// The Boot#### option which will be invoked if this key is pressed and the boot option2251/// is active (LOAD_OPTION_ACTIVE is set).2252///2253UINT16 BootOption;2254///2255/// The key codes to compare against those returned by the2256/// EFI_SIMPLE_TEXT_INPUT and EFI_SIMPLE_TEXT_INPUT_EX protocols.2257/// The number of key codes (0-3) is specified by the EFI_KEY_CODE_COUNT field in KeyOptions.2258///2259// EFI_INPUT_KEY Keys[];2260} EFI_KEY_OPTION;2261#pragma pack()22622263//2264// EFI File location to boot from on removable media devices2265//2266#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32 L"\\EFI\\BOOT\\BOOTIA32.EFI"2267#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64 L"\\EFI\\BOOT\\BOOTIA64.EFI"2268#define EFI_REMOVABLE_MEDIA_FILE_NAME_X64 L"\\EFI\\BOOT\\BOOTX64.EFI"2269#define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM L"\\EFI\\BOOT\\BOOTARM.EFI"2270#define EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64 L"\\EFI\\BOOT\\BOOTAA64.EFI"2271#define EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV64 L"\\EFI\\BOOT\\BOOTRISCV64.EFI"2272#define EFI_REMOVABLE_MEDIA_FILE_NAME_LOONGARCH64 L"\\EFI\\BOOT\\BOOTLOONGARCH64.EFI"22732274#if !defined (EFI_REMOVABLE_MEDIA_FILE_NAME)2275#if defined (MDE_CPU_IA32)2276#define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_IA322277#elif defined (MDE_CPU_X64)2278#define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_X642279#elif defined (MDE_CPU_EBC)2280#elif defined (MDE_CPU_ARM)2281#define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_ARM2282#elif defined (MDE_CPU_AARCH64)2283#define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH642284#elif defined (MDE_CPU_RISCV64)2285#define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_RISCV642286#elif defined (MDE_CPU_LOONGARCH64)2287#define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_LOONGARCH642288#else2289#error Unknown Processor Type2290#endif2291#endif22922293//2294// The directory within the active EFI System Partition defined for delivery of capsule to firmware2295//2296#define EFI_CAPSULE_FILE_DIRECTORY L"\\EFI\\UpdateCapsule\\"22972298#include <Uefi/UefiPxe.h>2299#include <Uefi/UefiGpt.h>2300#include <Uefi/UefiInternalFormRepresentation.h>23012302#endif230323042305