X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdePkg%2FInclude%2FUefi%2FUefiSpec.h;h=df3b373278e976bdf6736fc67eeffb31ef39dc7d;hb=2a3f6a21d3fb87b66be48aa8be2c0380a0db0ae6;hp=c2f52d2769c33c2d22c2e5f4328356136d4dbca9;hpb=4bb89f14bd8d55989bdded7890a1a17613829396;p=mirror_edk2.git diff --git a/MdePkg/Include/Uefi/UefiSpec.h b/MdePkg/Include/Uefi/UefiSpec.h index c2f52d2769..df3b373278 100644 --- a/MdePkg/Include/Uefi/UefiSpec.h +++ b/MdePkg/Include/Uefi/UefiSpec.h @@ -1,11 +1,11 @@ /** @file - Include file that supportes UEFI. + Include file that supports UEFI. - This include file must only contain things defined in the UEFI 2.0 specification. - If a code construct is defined in the UEFI 2.0 specification it must be included + This include file must only contain things defined in the UEFI 2.1 specification. + If a code construct is defined in the UEFI 2.1 specification it must be included by this include file. - Copyright (c) 2006 - 2007, Intel Corporation + Copyright (c) 2006 - 2008, Intel Corporation All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -25,13 +25,26 @@ #include #include -// -// Enumeration of memory allocation. -// +/// +/// Enumeration of EFI memory allocation types. +/// typedef enum { + /// + /// Allocate any available range of pages that satisfies the request + /// AllocateAnyPages, + /// + /// Allocate any available range of pages whose uppermost address is less than + /// or equal to a specified maximum address + /// AllocateMaxAddress, + /// + /// Allocate pages at a specified address + /// AllocateAddress, + /// + /// Maximum enumeration value that may be used for bounds checking + /// MaxAllocateType } EFI_ALLOCATE_TYPE; @@ -41,52 +54,65 @@ typedef enum { #define EFI_TIME_ADJUST_DAYLIGHT 0x01 #define EFI_TIME_IN_DAYLIGHT 0x02 -// -// Value definition for EFI_TIME.TimeZone -// +/// +/// Value definition for EFI_TIME.TimeZone +/// #define EFI_UNSPECIFIED_TIMEZONE 0x07FF // -// possible caching types for the memory range +// Memory cacheability attributes // #define EFI_MEMORY_UC 0x0000000000000001ULL #define EFI_MEMORY_WC 0x0000000000000002ULL #define EFI_MEMORY_WT 0x0000000000000004ULL #define EFI_MEMORY_WB 0x0000000000000008ULL #define EFI_MEMORY_UCE 0x0000000000000010ULL - // -// physical memory protection on range +// Physical memory protection attributes // #define EFI_MEMORY_WP 0x0000000000001000ULL #define EFI_MEMORY_RP 0x0000000000002000ULL #define EFI_MEMORY_XP 0x0000000000004000ULL - // -// range requires a runtime mapping +// Runtime memory attribute // #define EFI_MEMORY_RUNTIME 0x8000000000000000ULL +/// +/// Memory descriptor version number +/// #define EFI_MEMORY_DESCRIPTOR_VERSION 1 + +/// +/// Definition of an EFI memory descriptor +/// typedef struct { + /// + /// Type of the memory region. See EFI_MEMORY_TYPE + /// UINT32 Type; + /// + /// Physical address of the first byte of the memory region. Must aligned + /// on a 4 KB boundary. + /// EFI_PHYSICAL_ADDRESS PhysicalStart; + /// + /// Virtual address of the first byte of the memory region. Must aligned + /// on a 4 KB boundary. + /// EFI_VIRTUAL_ADDRESS VirtualStart; + /// + /// Number of 4KB pages in the memory region. + /// UINT64 NumberOfPages; + /// + /// Attributes of the memory region that describe the bit mask of capabilities + /// for that memory region, and not necessarily the current settings for that + /// memory region. + /// UINT64 Attribute; } EFI_MEMORY_DESCRIPTOR; -// -// Build macros to find next EFI_MEMORY_DESCRIPTOR. -// -#define NextMemoryDescriptor(_Ptr, _Size) ((EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) (_Ptr)) + (_Size))) -#define NEXT_MEMORY_DESCRIPTOR(_Ptr, _Size) NextMemoryDescriptor (_Ptr, _Size) - -// -// Declare forward referenced data structures -// -typedef struct _EFI_SYSTEM_TABLE EFI_SYSTEM_TABLE; - /** Allocates memory pages from the system. @@ -107,7 +133,7 @@ typedef struct _EFI_SYSTEM_TABLE EFI_SYSTEM_TABLE; **/ typedef EFI_STATUS -(EFIAPI *EFI_ALLOCATE_PAGES) ( +(EFIAPI *EFI_ALLOCATE_PAGES)( IN EFI_ALLOCATE_TYPE Type, IN EFI_MEMORY_TYPE MemoryType, IN UINTN Pages, @@ -128,7 +154,7 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_FREE_PAGES) ( +(EFIAPI *EFI_FREE_PAGES)( IN EFI_PHYSICAL_ADDRESS Memory, IN UINTN Pages ); @@ -137,6 +163,10 @@ EFI_STATUS Returns the current memory map. @param MemoryMapSize A pointer to the size, in bytes, of the MemoryMap buffer. + On input, this is the size of the buffer allocated by the caller. + On output, it is the size of the buffer returned by the firmware if + the buffer was large enough, or the size of the buffer needed to contain + the map if the buffer was too small. @param MemoryMap A pointer to the buffer in which firmware places the current memory map. @param MapKey A pointer to the location in which firmware returns the key for the @@ -156,7 +186,7 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_GET_MEMORY_MAP) ( +(EFIAPI *EFI_GET_MEMORY_MAP)( IN OUT UINTN *MemoryMapSize, IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap, OUT UINTN *MapKey, @@ -179,7 +209,7 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_ALLOCATE_POOL) ( +(EFIAPI *EFI_ALLOCATE_POOL)( IN EFI_MEMORY_TYPE PoolType, IN UINTN Size, OUT VOID **Buffer @@ -196,7 +226,7 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_FREE_POOL) ( +(EFIAPI *EFI_FREE_POOL)( IN VOID *Buffer ); @@ -221,7 +251,7 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_SET_VIRTUAL_ADDRESS_MAP) ( +(EFIAPI *EFI_SET_VIRTUAL_ADDRESS_MAP)( IN UINTN MemoryMapSize, IN UINTN DescriptorSize, IN UINT32 DescriptorVersion, @@ -253,7 +283,7 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_CONNECT_CONTROLLER) ( +(EFIAPI *EFI_CONNECT_CONTROLLER)( IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE *DriverImageHandle, OPTIONAL IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath, OPTIONAL @@ -265,14 +295,20 @@ EFI_STATUS @param ControllerHandle The handle of the controller from which driver(s) are to be disconnected. @param DriverImageHandle The driver to disconnect from ControllerHandle. + If DriverImageHandle is NULL, then all the drivers currently managing + ControllerHandle are disconnected from ControllerHandle. @param ChildHandle The handle of the child to destroy. + If ChildHandle is NULL, then all the children of ControllerHandle are + destroyed before the drivers are disconnected from ControllerHandle. @retval EFI_SUCCESS 1) One or more drivers were disconnected from the controller. 2) On entry, no drivers are managing ControllerHandle. 3) DriverImageHandle is not NULL, and on entry DriverImageHandle is not managing ControllerHandle. - - @retval EFI_INVALID_PARAMETER One ore more parameters are invalid. + @retval EFI_INVALID_PARAMETER 1) ControllerHandle is not a valid EFI_HANDLE. + 2) DriverImageHandle is not NULL, and it is not a valid EFI_HANDLE. + 3) ChildHandle is not NULL, and it is not a valid EFI_HANDLE. + 4) DriverImageHandle does not support the EFI_DRIVER_BINDING_PROTOCOL. @retval EFI_OUT_OF_RESOURCES There are not enough resources available to disconnect any drivers from ControllerHandle. @retval EFI_DEVICE_ERROR The controller could not be disconnected because of a device error. @@ -280,7 +316,7 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_DISCONNECT_CONTROLLER) ( +(EFIAPI *EFI_DISCONNECT_CONTROLLER)( IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE DriverImageHandle, OPTIONAL IN EFI_HANDLE ChildHandle OPTIONAL @@ -311,40 +347,30 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_CONVERT_POINTER) ( +(EFIAPI *EFI_CONVERT_POINTER)( IN UINTN DebugDisposition, IN OUT VOID **Address ); // -// These types can be ORed together as needed ¨C for example, +// These types can be ORed together as needed - for example, // EVT_TIMER might be Ored with EVT_NOTIFY_WAIT or // EVT_NOTIFY_SIGNAL. // #define EVT_TIMER 0x80000000 -#define EFI_EVENT_TIMER EVT_TIMER - #define EVT_RUNTIME 0x40000000 -#define EFI_EVENT_RUNTIME EVT_RUNTIME - #define EVT_NOTIFY_WAIT 0x00000100 -#define EFI_EVENT_NOTIFY_WAIT EVT_NOTIFY_WAIT - #define EVT_NOTIFY_SIGNAL 0x00000200 -#define EFI_EVENT_NOTIFY_SIGNAL EVT_NOTIFY_SIGNAL #define EVT_SIGNAL_EXIT_BOOT_SERVICES 0x00000201 -#define EFI_EVENT_SIGNAL_EXIT_BOOT_SERVICES EVT_SIGNAL_EXIT_BOOT_SERVICES - #define EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE 0x60000202 -#define EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE // -// The event¡¯s NotifyContext pointer points to a runtime memory -// address. +// The event's NotifyContext pointer points to a runtime memory +// address. // The event is deprecated in UEFI2.0 and later specifications. -// +// #define EVT_RUNTIME_CONTEXT 0x20000000 @@ -358,7 +384,7 @@ EFI_STATUS **/ typedef VOID -(EFIAPI *EFI_EVENT_NOTIFY) ( +(EFIAPI *EFI_EVENT_NOTIFY)( IN EFI_EVENT Event, IN VOID *Context ); @@ -367,7 +393,7 @@ VOID Creates an event. @param Type The type of event to create and its mode and attributes. - @param NotifyTpl Pointer to the notification function's context. + @param NotifyTpl The task priority level of event notifications, if needed. @param NotifyFunction Pointer to the event's notification function, if any. @param NotifyContext Pointer to the notification function's context; corresponds to parameter Context in the notification function. @@ -381,7 +407,7 @@ VOID **/ typedef EFI_STATUS -(EFIAPI *EFI_CREATE_EVENT) ( +(EFIAPI *EFI_CREATE_EVENT)( IN UINT32 Type, IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction, @@ -393,11 +419,13 @@ EFI_STATUS Creates an event in a group. @param Type The type of event to create and its mode and attributes. - @param NotifyTpl Pointer to the notification function's context. + @param NotifyTpl The task priority level of event notifications,if needed. @param NotifyFunction Pointer to the event's notification function, if any. @param NotifyContext Pointer to the notification function's context; corresponds to parameter Context in the notification function. @param EventGroup Pointer to the unique identifier of the group to which this event belongs. + If this is NULL, then the function behaves as if the parameters were passed + to CreateEvent. @param Event Pointer to the newly created event if the call succeeds; undefined otherwise. @@ -408,18 +436,30 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_CREATE_EVENT_EX) ( +(EFIAPI *EFI_CREATE_EVENT_EX)( IN UINT32 Type, - IN EFI_TPL NotifyTpl OPTIONAL, + IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL, IN CONST VOID *NotifyContext OPTIONAL, IN CONST EFI_GUID *EventGroup OPTIONAL, OUT EFI_EVENT *Event ); +/// +/// Timer delay types +/// typedef enum { + /// + /// An event's timer settings is to be cancelled and not trigger time is to be set + /// TimerCancel, + /// + /// An event is to be signalled periodically at a specified interval from the current time. + /// TimerPeriodic, + /// + /// An event is to be signalled once at a specified interval from the current time. + /// TimerRelative } EFI_TIMER_DELAY; @@ -429,6 +469,11 @@ typedef enum { @param Event The timer event that is to be signaled at the specified time. @param Type The type of time that is specified in TriggerTime. @param TriggerTime The number of 100ns units until the timer expires. + A TriggerTime of 0 is legal. + If Type is TimerRelative and TriggerTime is 0, then the timer + event will be signaled on the next timer tick. + If Type is TimerPeriodic and TriggerTime is 0, then the timer + event will be signaled on every timer tick. @retval EFI_SUCCESS The event has been set to be signaled at the requested time. @retval EFI_INVALID_PARAMETER Event or Type is not valid. @@ -436,7 +481,7 @@ typedef enum { **/ typedef EFI_STATUS -(EFIAPI *EFI_SET_TIMER) ( +(EFIAPI *EFI_SET_TIMER)( IN EFI_EVENT Event, IN EFI_TIMER_DELAY Type, IN UINT64 TriggerTime @@ -452,7 +497,7 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_SIGNAL_EVENT) ( +(EFIAPI *EFI_SIGNAL_EVENT)( IN EFI_EVENT Event ); @@ -472,7 +517,7 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_WAIT_FOR_EVENT) ( +(EFIAPI *EFI_WAIT_FOR_EVENT)( IN UINTN NumberOfEvents, IN EFI_EVENT *Event, OUT UINTN *Index @@ -488,7 +533,7 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_CLOSE_EVENT) ( +(EFIAPI *EFI_CLOSE_EVENT)( IN EFI_EVENT Event ); @@ -504,13 +549,13 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_CHECK_EVENT) ( +(EFIAPI *EFI_CHECK_EVENT)( IN EFI_EVENT Event ); // -// Task priority level (name defined in spec). +// Task priority level // #define TPL_APPLICATION 4 #define TPL_CALLBACK 8 @@ -523,24 +568,24 @@ EFI_STATUS @param NewTpl The new task priority level. - @retval Previous task priority level + @return Previous task priority level **/ typedef EFI_TPL -(EFIAPI *EFI_RAISE_TPL) ( +(EFIAPI *EFI_RAISE_TPL)( IN EFI_TPL NewTpl ); /** Restores a task's priority level to its previous value. - @param OldTpl The previous task priority level to restore + @param OldTpl The previous task priority level to restore. **/ typedef VOID -(EFIAPI *EFI_RESTORE_TPL) ( +(EFIAPI *EFI_RESTORE_TPL)( IN EFI_TPL OldTpl ); @@ -556,16 +601,20 @@ VOID On output the size of data returned in Data. @param Data The buffer to return the contents of the variable. - @retval EFI_SUCCESS The function completed successfully. - @retval EFI_NOT_FOUND The variable was not found. - @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the result. - @retval EFI_INVALID_PARAMETER One or more parameters are invalid. - @retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error. + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_NOT_FOUND The variable was not found. + @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the result. + @retval EFI_INVALID_PARAMETER VariableName is NULL. + @retval EFI_INVALID_PARAMETER VendorGuid is NULL. + @retval EFI_INVALID_PARAMETER DataSize is NULL. + @retval EFI_INVALID_PARAMETER The DataSize is not too small and Data is NULL. + @retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error. + @retval EFI_SECURITY_VIOLATION The variable could not be retrieved due to an authentication failure. **/ typedef EFI_STATUS -(EFIAPI *EFI_GET_VARIABLE) ( +(EFIAPI *EFI_GET_VARIABLE)( IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, OUT UINT32 *Attributes, OPTIONAL @@ -587,13 +636,15 @@ EFI_STATUS @retval EFI_SUCCESS The function completed successfully. @retval EFI_NOT_FOUND The next variable was not found. @retval EFI_BUFFER_TOO_SMALL The VariableNameSize is too small for the result. - @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_INVALID_PARAMETER VariableNameSize is NULL. + @retval EFI_INVALID_PARAMETER VariableName is NULL. + @retval EFI_INVALID_PARAMETER VendorGuid is NULL. @retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error. **/ typedef EFI_STATUS -(EFIAPI *EFI_GET_NEXT_VARIABLE_NAME) ( +(EFIAPI *EFI_GET_NEXT_VARIABLE_NAME)( IN OUT UINTN *VariableNameSize, IN OUT CHAR16 *VariableName, IN OUT EFI_GUID *VendorGuid @@ -609,17 +660,22 @@ EFI_STATUS @param DataSize The size in bytes of the Data buffer. @param Data The contents for the variable. - @retval EFI_SUCCESS The firmware has successfully stored the variable and its data as - defined by the Attributes. - @retval EFI_WRITE_PROTECTED The variable in question is read-only. - @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data. - @retval EFI_INVALID_PARAMETER One or more parameters are invalid. - @retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error. + @retval EFI_SUCCESS The firmware has successfully stored the variable and its data as + defined by the Attributes. + @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied, or the + DataSize exceeds the maximum allowed. + @retval EFI_INVALID_PARAMETER VariableName is an empty Unicode string. + @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data. + @retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error. + @retval EFI_WRITE_PROTECTED The variable in question is read-only. + @retval EFI_WRITE_PROTECTED The variable in question cannot be deleted. + @retval EFI_SECURITY_VIOLATION The variable could not be retrieved due to an authentication failure. + @retval EFI_NOT_FOUND The variable trying to be updated or deleted was not found. **/ typedef EFI_STATUS -(EFIAPI *EFI_SET_VARIABLE) ( +(EFIAPI *EFI_SET_VARIABLE)( IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, IN UINT32 Attributes, @@ -628,10 +684,10 @@ EFI_STATUS ); -// -// This provides the capabilities of the -// real time clock device as exposed through the EFI interfaces. -// +/// +/// This provides the capabilities of the +/// real time clock device as exposed through the EFI interfaces. +/// typedef struct { UINT32 Resolution; UINT32 Accuracy; @@ -653,7 +709,7 @@ typedef struct { **/ typedef EFI_STATUS -(EFIAPI *EFI_GET_TIME) ( +(EFIAPI *EFI_GET_TIME)( OUT EFI_TIME *Time, OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL ); @@ -670,7 +726,7 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_SET_TIME) ( +(EFIAPI *EFI_SET_TIME)( IN EFI_TIME *Time ); @@ -682,13 +738,16 @@ EFI_STATUS @param Time The current alarm setting. @retval EFI_SUCCESS The alarm settings were returned. - @retval EFI_INVALID_PARAMETER Any parameter is NULL. + @retval EFI_INVALID_PARAMETER Enabled is NULL. + @retval EFI_INVALID_PARAMETER Pending is NULL. + @retval EFI_INVALID_PARAMETER Time is NULL. @retval EFI_DEVICE_ERROR The wakeup time could not be retrieved due to a hardware error. + @retval EFI_UNSUPPORTED A wakeup timer is not supported on this platform. **/ typedef EFI_STATUS -(EFIAPI *EFI_GET_WAKEUP_TIME) ( +(EFIAPI *EFI_GET_WAKEUP_TIME)( OUT BOOLEAN *Enabled, OUT BOOLEAN *Pending, OUT EFI_TIME *Time @@ -699,6 +758,7 @@ EFI_STATUS @param Enabled Enable or disable the wakeup alarm. @param Time If Enable is TRUE, the time to set the wakeup alarm for. + If Enable is FALSE, then this parameter is optional, and may be NULL. @retval EFI_SUCCESS If Enable is TRUE, then the wakeup alarm was enabled. If Enable is FALSE, then the wakeup alarm was disabled. @@ -709,28 +769,11 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_SET_WAKEUP_TIME) ( +(EFIAPI *EFI_SET_WAKEUP_TIME)( IN BOOLEAN Enable, IN EFI_TIME *Time OPTIONAL ); -/** - This is the declaration of an EFI image entry point. This can be the entry point to an application - written to this specification, an EFI boot service driver, or an EFI runtime driver. - - @param ImageHandle Handle that identifies the loaded image. - @param SystemTable System Table for this image. - - @retval EFI_SUCCESS The operation completed successfully. - -**/ -typedef -EFI_STATUS -(EFIAPI *EFI_IMAGE_ENTRY_POINT) ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - /** Loads an EFI image into memory. @@ -739,16 +782,16 @@ EFI_STATUS FilePath as a boot selection. Ignored if SourceBuffer is not NULL. @param ParentImageHandle The caller's image handle. - @param FilePath The DeviceHandle specific file path from which the image is + @param DevicePath The DeviceHandle specific file path from which the image is loaded. @param SourceBuffer If not NULL, a pointer to the memory location containing a copy of the image to be loaded. - @param SourceSize The size in bytes of SourceBuffer. + @param SourceSize The size in bytes of SourceBuffer. Ignored if SourceBuffer is NULL. @param ImageHandle Pointer to the returned image handle that is created when the image is successfully loaded. @retval EFI_SUCCESS Image was loaded into memory correctly. - @retval EFI_NOT_FOUND Both SourceBuffer and FilePath are NULL. + @retval EFI_NOT_FOUND Both SourceBuffer and DevicePath are NULL. @retval EFI_INVALID_PARAMETER One or more parametes are invalid. @retval EFI_UNSUPPORTED The image type is not supported. @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient resources. @@ -759,10 +802,10 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_IMAGE_LOAD) ( +(EFIAPI *EFI_IMAGE_LOAD)( IN BOOLEAN BootPolicy, IN EFI_HANDLE ParentImageHandle, - IN EFI_DEVICE_PATH_PROTOCOL *FilePath, + IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN VOID *SourceBuffer OPTIONAL, IN UINTN SourceSize, OUT EFI_HANDLE *ImageHandle @@ -778,12 +821,12 @@ EFI_STATUS @retval EFI_INVALID_PARAMETER ImageHandle is either an invalid image handle or the image has already been initialized with StartImage - @retval Exit code from image Exit code from image + @return Exit code from image **/ typedef EFI_STATUS -(EFIAPI *EFI_IMAGE_START) ( +(EFIAPI *EFI_IMAGE_START)( IN EFI_HANDLE ImageHandle, OUT UINTN *ExitDataSize, OUT CHAR16 **ExitData OPTIONAL @@ -806,7 +849,7 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_EXIT) ( +(EFIAPI *EFI_EXIT)( IN EFI_HANDLE ImageHandle, IN EFI_STATUS ExitStatus, IN UINTN ExitDataSize, @@ -820,13 +863,11 @@ EFI_STATUS @retval EFI_SUCCESS The image has been unloaded. @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle. - @retval EFI_UNSUPPORTED The image has been started, and does not support unload. - @retval Exit code from the image's unload handler **/ typedef EFI_STATUS -(EFIAPI *EFI_IMAGE_UNLOAD) ( +(EFIAPI *EFI_IMAGE_UNLOAD)( IN EFI_HANDLE ImageHandle ); @@ -842,7 +883,7 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_EXIT_BOOT_SERVICES) ( +(EFIAPI *EFI_EXIT_BOOT_SERVICES)( IN EFI_HANDLE ImageHandle, IN UINTN MapKey ); @@ -858,7 +899,7 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_STALL) ( +(EFIAPI *EFI_STALL)( IN UINTN Microseconds ); @@ -880,21 +921,36 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_SET_WATCHDOG_TIMER) ( +(EFIAPI *EFI_SET_WATCHDOG_TIMER)( IN UINTN Timeout, IN UINT64 WatchdogCode, IN UINTN DataSize, IN CHAR16 *WatchdogData OPTIONAL ); -// -// Enumeration of reset types. -// +/// +/// Enumeration of reset types. +/// typedef enum { + /// + /// Used to induce a system-wide reset. This sets all circuitry within the + /// system to its initial state. This type of reset is asynchronous to system + /// operation and operates withgout regard to cycle boundaries. EfiColdReset + /// is tantamount to a system power cycle. + /// EfiResetCold, + /// + /// Used to induce a system-wide initialization. The processors are set to their + /// initial state, and pending cycles are not corrupted. If the system does + /// not support this reset type, then an EfiResetCold must be performed. + /// EfiResetWarm, - EfiResetShutdown, - EfiResetUpdate + /// + /// Used to induce en entry into power state equivalent to the ACPI G2/S5 or G3 + /// state. If the system does not support this reset type, then when the system + /// is rebooted, it should exhibit the EfiResetCold attributes. + /// + EfiResetShutdown } EFI_RESET_TYPE; /** @@ -910,11 +966,11 @@ typedef enum { **/ typedef VOID -(EFIAPI *EFI_RESET_SYSTEM) ( +(EFIAPI *EFI_RESET_SYSTEM)( IN EFI_RESET_TYPE ResetType, IN EFI_STATUS ResetStatus, IN UINTN DataSize, - IN CHAR16 *ResetData OPTIONAL + IN VOID *ResetData OPTIONAL ); /** @@ -929,7 +985,7 @@ VOID **/ typedef EFI_STATUS -(EFIAPI *EFI_GET_NEXT_MONOTONIC_COUNT) ( +(EFIAPI *EFI_GET_NEXT_MONOTONIC_COUNT)( OUT UINT64 *Count ); @@ -945,7 +1001,7 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_GET_NEXT_HIGH_MONO_COUNT) ( +(EFIAPI *EFI_GET_NEXT_HIGH_MONO_COUNT)( OUT UINT32 *HighCount ); @@ -959,12 +1015,14 @@ EFI_STATUS @retval EFI_SUCCESS The 32-bit CRC was computed for the data buffer and returned in Crc32. - @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_INVALID_PARAMETER Data is NULL. + @retval EFI_INVALID_PARAMETER Crc32 is NULL. + @retval EFI_INVALID_PARAMETER DataSize is 0. **/ typedef EFI_STATUS -(EFIAPI *EFI_CALCULATE_CRC32) ( +(EFIAPI *EFI_CALCULATE_CRC32)( IN VOID *Data, IN UINTN DataSize, OUT UINT32 *Crc32 @@ -980,7 +1038,7 @@ EFI_STATUS **/ typedef VOID -(EFIAPI *EFI_COPY_MEM) ( +(EFIAPI *EFI_COPY_MEM)( IN VOID *Destination, IN VOID *Source, IN UINTN Length @@ -996,17 +1054,19 @@ VOID **/ typedef VOID -(EFIAPI *EFI_SET_MEM) ( +(EFIAPI *EFI_SET_MEM)( IN VOID *Buffer, IN UINTN Size, IN UINT8 Value ); - -// -// Protocol handler functions -// +/// +/// Enumeration of EFI Interface Types +/// typedef enum { + /// + /// Indicates that the supplied protocol interface is supplied in native form. + /// EFI_NATIVE_INTERFACE } EFI_INTERFACE_TYPE; @@ -1024,12 +1084,15 @@ typedef enum { @retval EFI_SUCCESS The protocol interface was installed. @retval EFI_OUT_OF_RESOURCES Space for a new handle could not be allocated. - @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_INVALID_PARAMETER Handle is NULL. + @retval EFI_INVALID_PARAMETER Protocol is NULL. + @retval EFI_INVALID_PARAMETER InterfaceType is not EFI_NATIVE_INTERFACE. + @retval EFI_INVALID_PARAMETER Protocol is already installed on the handle specified by Handle. **/ typedef EFI_STATUS -(EFIAPI *EFI_INSTALL_PROTOCOL_INTERFACE) ( +(EFIAPI *EFI_INSTALL_PROTOCOL_INTERFACE)( IN OUT EFI_HANDLE *Handle, IN EFI_GUID *Protocol, IN EFI_INTERFACE_TYPE InterfaceType, @@ -1052,7 +1115,7 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) ( +(EFIAPI *EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES)( IN OUT EFI_HANDLE *Handle, ... ); @@ -1071,12 +1134,13 @@ EFI_STATUS @retval EFI_ACCESS_DENIED The protocol interface could not be reinstalled, because OldInterface is still being used by a driver that will not release it. - @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE. + @retval EFI_INVALID_PARAMETER Protocol is NULL. **/ typedef EFI_STATUS -(EFIAPI *EFI_REINSTALL_PROTOCOL_INTERFACE) ( +(EFIAPI *EFI_REINSTALL_PROTOCOL_INTERFACE)( IN EFI_HANDLE Handle, IN EFI_GUID *Protocol, IN VOID *OldInterface, @@ -1096,12 +1160,13 @@ EFI_STATUS @retval EFI_NOT_FOUND The interface was not found. @retval EFI_ACCESS_DENIED The interface was not removed because the interface is still being used by a driver. - @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE. + @retval EFI_INVALID_PARAMETER Protocol is NULL. **/ typedef EFI_STATUS -(EFIAPI *EFI_UNINSTALL_PROTOCOL_INTERFACE) ( +(EFIAPI *EFI_UNINSTALL_PROTOCOL_INTERFACE)( IN EFI_HANDLE Handle, IN EFI_GUID *Protocol, IN VOID *Interface @@ -1120,7 +1185,7 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) ( +(EFIAPI *EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES)( IN EFI_HANDLE Handle, ... ); @@ -1132,14 +1197,17 @@ EFI_STATUS @param Protocol The published unique identifier of the protocol. @param Interface Supplies the address where a pointer to the corresponding Protocol Interface is returned. + @retval EFI_SUCCESS The interface information for the specified protocol was returned. @retval EFI_UNSUPPORTED The device does not support the specified protocol. - @retval EFI_INVALID_PARAMETER One of the protocol interfaces was not previously installed on Handle. + @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE. + @retval EFI_INVALID_PARAMETER Protocol is NULL. + @retval EFI_INVALID_PARAMETER Interface is NULL. **/ typedef EFI_STATUS -(EFIAPI *EFI_HANDLE_PROTOCOL) ( +(EFIAPI *EFI_HANDLE_PROTOCOL)( IN EFI_HANDLE Handle, IN EFI_GUID *Protocol, OUT VOID **Interface @@ -1181,12 +1249,12 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_OPEN_PROTOCOL) ( +(EFIAPI *EFI_OPEN_PROTOCOL)( IN EFI_HANDLE Handle, IN EFI_GUID *Protocol, - OUT VOID **Interface, + OUT VOID **Interface, OPTIONAL IN EFI_HANDLE AgentHandle, - IN EFI_HANDLE ControllerHandle, OPTIONAL + IN EFI_HANDLE ControllerHandle, IN UINT32 Attributes ); @@ -1197,15 +1265,16 @@ EFI_STATUS @param Handle The handle for the protocol interface that was previously opened with OpenProtocol(), and is now being closed. @param Protocol The published unique identifier of the protocol. - @param Interface Supplies the address where a pointer to the corresponding Protocol - Interface is returned. @param AgentHandle The handle of the agent that is closing the protocol interface. @param ControllerHandle If the agent that opened a protocol is a driver that follows the UEFI Driver Model, then this parameter is the controller handle that required the protocol interface. @retval EFI_SUCCESS The protocol instance was closed. - @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_INVALID_PARAMETER 1) Handle is not a valid EFI_HANDLE. + 2) AgentHandle is not a valid EFI_HANDLE. + 3) ControllerHandle is not NULL and ControllerHandle is not a valid EFI_HANDLE. + 4) Protocol is NULL. @retval EFI_NOT_FOUND 1) Handle does not support the protocol specified by Protocol. 2) The protocol interface specified by Handle and Protocol is not currently open by AgentHandle and ControllerHandle. @@ -1213,14 +1282,16 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_CLOSE_PROTOCOL) ( +(EFIAPI *EFI_CLOSE_PROTOCOL)( IN EFI_HANDLE Handle, IN EFI_GUID *Protocol, IN EFI_HANDLE AgentHandle, IN EFI_HANDLE ControllerHandle ); - +/// +/// EFI Oprn Protocol Information Entry +/// typedef struct { EFI_HANDLE AgentHandle; EFI_HANDLE ControllerHandle; @@ -1245,10 +1316,10 @@ typedef struct { **/ typedef EFI_STATUS -(EFIAPI *EFI_OPEN_PROTOCOL_INFORMATION) ( +(EFIAPI *EFI_OPEN_PROTOCOL_INFORMATION)( IN EFI_HANDLE Handle, IN EFI_GUID *Protocol, - IN EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer, + OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer, OUT UINTN *EntryCount ); @@ -1267,12 +1338,15 @@ EFI_STATUS ProtocolBuffer. The number of protocol interface GUIDs was returned in ProtocolBufferCount. @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the results. - @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_INVALID_PARAMETER Handle is NULL. + @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE. + @retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL. + @retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL. **/ typedef EFI_STATUS -(EFIAPI *EFI_PROTOCOLS_PER_HANDLE) ( +(EFIAPI *EFI_PROTOCOLS_PER_HANDLE)( IN EFI_HANDLE Handle, OUT EFI_GUID ***ProtocolBuffer, OUT UINTN *ProtocolBufferCount @@ -1288,21 +1362,35 @@ EFI_STATUS @retval EFI_SUCCESS The notification event has been registered. @retval EFI_OUT_OF_RESOURCES Space for the notification event could not be allocated. - @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_INVALID_PARAMETER Protocol is NULL. + @retval EFI_INVALID_PARAMETER Event is NULL. + @retval EFI_INVALID_PARAMETER Registration is NULL. **/ typedef EFI_STATUS -(EFIAPI *EFI_REGISTER_PROTOCOL_NOTIFY) ( +(EFIAPI *EFI_REGISTER_PROTOCOL_NOTIFY)( IN EFI_GUID *Protocol, IN EFI_EVENT Event, OUT VOID **Registration ); - +/// +/// Enumeration of EFI Locate Search Types +/// typedef enum { + /// + /// Retrieve all the handles in the handle database. + /// AllHandles, + /// + /// Retrieve the next handle fron a RegisterProtocolNotify() event. + /// ByRegisterNotify, + /// + /// Retrieve the set of handles from the handle database that support a + /// specified protocol. + /// ByProtocol } EFI_LOCATE_SEARCH_TYPE; @@ -1321,12 +1409,16 @@ typedef enum { @retval EFI_SUCCESS The array of handles was returned. @retval EFI_NOT_FOUND No handles match the search. @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small for the result. - @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_INVALID_PARAMETER SearchType is not a member of EFI_LOCATE_SEARCH_TYPE. + @retval EFI_INVALID_PARAMETER SearchType is ByRegisterNotify and SearchKey is NULL. + @retval EFI_INVALID_PARAMETER SearchType is ByProtocol and Protocol is NULL. + @retval EFI_INVALID_PARAMETER One or more matches are found and BufferSize is NULL. + @retval EFI_INVALID_PARAMETER BufferSize is large enough for the result and Buffer is NULL. **/ typedef EFI_STATUS -(EFIAPI *EFI_LOCATE_HANDLE) ( +(EFIAPI *EFI_LOCATE_HANDLE)( IN EFI_LOCATE_SEARCH_TYPE SearchType, IN EFI_GUID *Protocol, OPTIONAL IN VOID *SearchKey, OPTIONAL @@ -1345,12 +1437,14 @@ EFI_STATUS @retval EFI_SUCCESS The resulting handle was returned. @retval EFI_NOT_FOUND No handles match the search. - @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_INVALID_PARAMETER Protocol is NULL. + @retval EFI_INVALID_PARAMETER DevicePath is NULL. + @retval EFI_INVALID_PARAMETER A handle matched the search and Device is NULL. **/ typedef EFI_STATUS -(EFIAPI *EFI_LOCATE_DEVICE_PATH) ( +(EFIAPI *EFI_LOCATE_DEVICE_PATH)( IN EFI_GUID *Protocol, IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath, OUT EFI_HANDLE *Device @@ -1371,17 +1465,17 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_INSTALL_CONFIGURATION_TABLE) ( +(EFIAPI *EFI_INSTALL_CONFIGURATION_TABLE)( IN EFI_GUID *Guid, IN VOID *Table ); - /** Returns an array of handles that support the requested protocol in a buffer allocated from pool. @param SearchType Specifies which handle(s) are to be returned. - @param Protocol Specifies the protocol to search by. + @param Protocol Provides the protocol to search by. + This parameter is only valid for a SearchType of ByProtocol. @param SearchKey Supplies the search key depending on the SearchType. @param NoHandles The number of handles returned in Buffer. @param Buffer A pointer to the buffer to return the requested array of handles that @@ -1391,12 +1485,13 @@ EFI_STATUS handles in Buffer was returned in NoHandles. @retval EFI_NOT_FOUND No handles match the search. @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the matching results. - @retval EFI_INVALID_PARAMETER One or more parameters are invalid. + @retval EFI_INVALID_PARAMETER NoHandles is NULL. + @retval EFI_INVALID_PARAMETER Buffer is NULL. **/ typedef EFI_STATUS -(EFIAPI *EFI_LOCATE_HANDLE_BUFFER) ( +(EFIAPI *EFI_LOCATE_HANDLE_BUFFER)( IN EFI_LOCATE_SEARCH_TYPE SearchType, IN EFI_GUID *Protocol, OPTIONAL IN VOID *SearchKey, OPTIONAL @@ -1422,20 +1517,26 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_LOCATE_PROTOCOL) ( +(EFIAPI *EFI_LOCATE_PROTOCOL)( IN EFI_GUID *Protocol, IN VOID *Registration, OPTIONAL OUT VOID **Interface ); +/// +/// EFI Capsule Block Descriptor +/// typedef struct { - UINT64 Length; + UINT64 Length; union { EFI_PHYSICAL_ADDRESS DataBlock; EFI_PHYSICAL_ADDRESS ContinuationPointer; } Union; } EFI_CAPSULE_BLOCK_DESCRIPTOR; +/// +/// EFI Capsule Header +/// typedef struct { EFI_GUID CapsuleGuid; UINT32 HeaderSize; @@ -1443,6 +1544,16 @@ typedef struct { UINT32 CapsuleImageSize; } EFI_CAPSULE_HEADER; +// +// The EFI System Table entry must point to an array of capsules +// that contain the same CapsuleGuid value. The array must be +// prefixed by a UINT32 that represents the size of the array of capsules. +// +typedef struct { + UINT32 CapsuleArrayNumber; + VOID* CapsulePtr[1]; +} EFI_CAPSULE_TABLE; + #define CAPSULE_FLAGS_PERSIST_ACROSS_RESET 0x00010000 #define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE 0x00020000 @@ -1466,11 +1577,13 @@ typedef struct { capsule has been successfully processed by the firmware. @retval EFI_DEVICE_ERROR The capsule update was started, but failed due to a device error. @retval EFI_INVALID_PARAMETER CapsuleSize is NULL. + @retval EFI_UNSUPPORTED The capsule type is not supported on this platform. + @retval EFI_OUT_OF_RESOURCES There were insufficient resources to process the capsule. **/ typedef EFI_STATUS -(EFIAPI *EFI_UPDATE_CAPSULE) ( +(EFIAPI *EFI_UPDATE_CAPSULE)( IN EFI_CAPSULE_HEADER **CapsuleHeaderArray, IN UINTN CapsuleCount, IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL @@ -1492,11 +1605,12 @@ EFI_STATUS @retval EFI_UNSUPPORTED The capsule type is not supported on this platform, and MaximumCapsuleSize and ResetType are undefined. @retval EFI_INVALID_PARAMETER MaximumCapsuleSize is NULL. + @retval EFI_OUT_OF_RESOURCES There were insufficient resources to process the query request. **/ typedef EFI_STATUS -(EFIAPI *EFI_QUERY_CAPSULE_CAPABILITIES) ( +(EFIAPI *EFI_QUERY_CAPSULE_CAPABILITIES)( IN EFI_CAPSULE_HEADER **CapsuleHeaderArray, IN UINTN CapsuleCount, OUT UINT64 *MaximumCapsuleSize, @@ -1527,7 +1641,7 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_QUERY_VARIABLE_INFO) ( +(EFIAPI *EFI_QUERY_VARIABLE_INFO)( IN UINT32 Attributes, OUT UINT64 *MaximumVariableStorageSize, OUT UINT64 *RemainingVariableStorageSize, @@ -1538,18 +1652,24 @@ EFI_STATUS // // EFI Runtime Services Table // -#define EFI_SYSTEM_TABLE_SIGNATURE 0x5453595320494249 -#define EFI_SYSTEM_TABLE_REVISION ((2<<16) | (10)) -#define EFI_2_10_SYSTEM_TABLE_REVISION ((2<<16) | (10)) -#define EFI_2_00_SYSTEM_TABLE_REVISION ((2<<16) | (00)) -#define EFI_1_10_SYSTEM_TABLE_REVISION ((1<<16) | (10)) -#define EFI_1_02_SYSTEM_TABLE_REVISION ((1<<16) | (02)) - -#define EFI_RUNTIME_SERVICES_SIGNATURE 0x56524553544e5552 +#define EFI_SYSTEM_TABLE_SIGNATURE EFI_SIGNATURE_64 ('I','B','I',' ','S','Y','S','T') +#define EFI_SYSTEM_TABLE_REVISION ((2 << 16) | (10)) +#define EFI_2_10_SYSTEM_TABLE_REVISION ((2 << 16) | (10)) +#define EFI_2_00_SYSTEM_TABLE_REVISION ((2 << 16) | (00)) +#define EFI_1_10_SYSTEM_TABLE_REVISION ((1 << 16) | (10)) +#define EFI_1_02_SYSTEM_TABLE_REVISION ((1 << 16) | (02)) + +#define EFI_RUNTIME_SERVICES_SIGNATURE EFI_SIGNATURE_64 ('R','U','N','T','S','E','R','V') #define EFI_RUNTIME_SERVICES_REVISION EFI_2_10_SYSTEM_TABLE_REVISION +/// +/// EFI Runtime Services Table +/// typedef struct { - EFI_TABLE_HEADER Hdr; + /// + /// The table header for the EFI Runtime Services Table. + /// + EFI_TABLE_HEADER Hdr; // // Time Services @@ -1591,12 +1711,18 @@ typedef struct { } EFI_RUNTIME_SERVICES; -#define EFI_BOOT_SERVICES_SIGNATURE 0x56524553544f4f42 +#define EFI_BOOT_SERVICES_SIGNATURE EFI_SIGNATURE_64 ('B','O','O','T','S','E','R','V') #define EFI_BOOT_SERVICES_REVISION EFI_2_10_SYSTEM_TABLE_REVISION +/// +/// EFI Boot Services Table +/// typedef struct { - EFI_TABLE_HEADER Hdr; - + /// + /// The table header for the EFI Boot Services Table. + /// + EFI_TABLE_HEADER Hdr; + // // Task Priority Services // @@ -1683,34 +1809,105 @@ typedef struct { // EFI_COPY_MEM CopyMem; EFI_SET_MEM SetMem; - EFI_CREATE_EVENT_EX CreateEventEx; } EFI_BOOT_SERVICES; -// -// Contains a set of GUID/pointer pairs comprised of the ConfigurationTable field in the -// EFI System Table. -// -typedef struct{ +/// +/// Contains a set of GUID/pointer pairs comprised of the ConfigurationTable field in the +/// EFI System Table. +/// +typedef struct { + /// + /// The 128-bit GUID value that uniquely identifies the system configuration table. + /// EFI_GUID VendorGuid; + /// + /// A pointer to the table associated with VendorGuid. + /// VOID *VendorTable; } EFI_CONFIGURATION_TABLE; -struct _EFI_SYSTEM_TABLE { - EFI_TABLE_HEADER Hdr; +/// +/// EFI System Table +/// +typedef struct { + /// + /// The table header for the EFI System Table. + /// + EFI_TABLE_HEADER Hdr; + /// + /// A pointer to a null terminated Unicode string that identifies + /// the vendor that produces the system firmware for the platform. + /// CHAR16 *FirmwareVendor; + /// + /// A firmware vendor specific value that identifies the revision + /// of the system firmware for the platform. + /// UINT32 FirmwareRevision; + /// + /// The handle for the active console input device. + /// EFI_HANDLE ConsoleInHandle; + /// + /// A pointer to the SIMPLE_INPUT_PROTOCOL interface that is + /// associated with ConsoleInHandle. + /// EFI_SIMPLE_TEXT_INPUT_PROTOCOL *ConIn; + /// + /// The handle for the active console output device. + /// EFI_HANDLE ConsoleOutHandle; + /// + /// A pointer to the SIMPLE_TEXT_OUTPUT_PROTOCOL interface + /// that is associated with ConsoleOutHandle. + /// EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut; + /// + /// The handle for the active standard error console device. + /// EFI_HANDLE StandardErrorHandle; + /// + /// A pointer to the SIMPLE_TEXT_OUTPUT_PROTOCOL interface + /// that is associated with StandardErrorHandle. + /// EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *StdErr; + /// + /// A pointer to the EFI Runtime Services Table. + /// EFI_RUNTIME_SERVICES *RuntimeServices; + /// + /// A pointer to the EFI Boot Services Table. + /// EFI_BOOT_SERVICES *BootServices; + /// + /// The number of system configuration tables in the buffer ConfigurationTable. + /// UINTN NumberOfTableEntries; + /// + /// A pointer to the system configuration tables. + /// The number of entries in the table is NumberOfTableEntries. + /// EFI_CONFIGURATION_TABLE *ConfigurationTable; -}; +} EFI_SYSTEM_TABLE; + +/** + This is the declaration of an EFI image entry point. This entry point is + the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including + both device drivers and bus drivers. + + @param ImageHandle The firmware allocated handle for the UEFI image. + @param SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The operation completed successfully. + @retval Others Some unexpected error happened. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_IMAGE_ENTRY_POINT)( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); // // EFI Load Options Attributes @@ -1727,6 +1924,9 @@ struct _EFI_SYSTEM_TABLE { #define EFI_BOOT_OPTION_SUPPORT_APP 0x00000002 #define EFI_BOOT_OPTION_SUPPORT_COUNT 0x00000300 +/// +/// EFI Boot Key Data +/// typedef union { struct { UINT32 Revision : 8; @@ -1738,15 +1938,18 @@ typedef union { UINT32 SysReqPessed : 1; UINT32 Reserved : 16; UINT32 InputKeyCount : 2; - } Options; + } Options; UINT32 PackedValue; -} EFI_KEY_DATA; +} EFI_BOOT_KEY_DATA; +/// +/// EFI Key Option +/// typedef struct { - EFI_KEY_DATA KeyOptions; - UINT32 BootOptionCrc; - UINT16 BootOption; -//EFI_INPUT_KEY Keys[]; + EFI_BOOT_KEY_DATA KeyOptions; + UINT32 BootOptionCrc; + UINT16 BootOption; +//EFI_INPUT_KEY Keys[]; } EFI_KEY_OPTION; #define EFI_KEY_OPTION_SHIFT 0x00000001 @@ -1757,14 +1960,12 @@ typedef struct { #define EFI_KEY_OPTION_SYSREQ 0x00000020 #define EFI_KEY_CODE_COUNT 0x00000300 - // // EFI File location to boot from on removable media devices // #define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32 L"\\EFI\\BOOT\\BOOTIA32.EFI" #define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64 L"\\EFI\\BOOT\\BOOTIA64.EFI" #define EFI_REMOVABLE_MEDIA_FILE_NAME_X64 L"\\EFI\\BOOT\\BOOTX64.EFI" -#define EFI_REMOVABLE_MEDIA_FILE_NAME_EBC L"\\EFI\\BOOT\\BOOTEBC.EFI" #if defined (MDE_CPU_IA32) #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_IA32 @@ -1773,7 +1974,6 @@ typedef struct { #elif defined (MDE_CPU_X64) #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_X64 #elif defined (MDE_CPU_EBC) - #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_EBC #else #error Unknown Processor Type #endif