#include <Protocol/SimpleTextOut.h>\r
\r
///\r
-/// Enumeration of memory allocation.\r
+/// Enumeration of EFI memory allocation types.\r
///\r
typedef enum {\r
+ ///\r
+ /// Allocate any available range of pages that satisfies the request\r
+ ///\r
AllocateAnyPages,\r
+ ///\r
+ /// Allocate any available range of pages whose uppermost address is less than \r
+ /// or equal to a specified maximum address\r
+ ///\r
AllocateMaxAddress,\r
+ ///\r
+ /// Allocate pages at a specified address\r
+ ///\r
AllocateAddress,\r
+ ///\r
+ /// Maximum enumeration value that may be used for bounds checking\r
+ ///\r
MaxAllocateType\r
} EFI_ALLOCATE_TYPE;\r
\r
#define EFI_MEMORY_DESCRIPTOR_VERSION 1\r
\r
///\r
-/// Definition of memory descriptor\r
+/// Definition of an EFI memory descriptor\r
///\r
typedef struct {\r
+ ///\r
+ /// Type of the memory region. See EFI_MEMORY_TYPE\r
+ ///\r
UINT32 Type;\r
+ ///\r
+ /// Physical address of the first byte of the memory region. Must aligned \r
+ /// on a 4 KB boundary.\r
+ ///\r
EFI_PHYSICAL_ADDRESS PhysicalStart;\r
+ ///\r
+ /// Virtual address of the first byte of the memory region. Must aligned \r
+ /// on a 4 KB boundary.\r
+ ///\r
EFI_VIRTUAL_ADDRESS VirtualStart;\r
+ ///\r
+ /// Number of 4KB pages in the memory region.\r
+ ///\r
UINT64 NumberOfPages;\r
+ ///\r
+ /// Attributes of the memory region that describe the bit mask of capabilities\r
+ /// for that memory region, and not necessarily the current settings for that \r
+ /// memory region.\r
+ ///\r
UINT64 Attribute;\r
} EFI_MEMORY_DESCRIPTOR;\r
\r
-///\r
-/// Build macros to find next EFI_MEMORY_DESCRIPTOR.\r
-///\r
-#define NEXT_MEMORY_DESCRIPTOR(_Ptr, _Size) ((EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) (_Ptr)) + (_Size)))\r
-\r
-///\r
-/// Declare forward referenced data structures\r
-///\r
-typedef struct _EFI_SYSTEM_TABLE EFI_SYSTEM_TABLE;\r
-\r
/**\r
Allocates memory pages from the system.\r
\r
// ConvertPointer DebugDisposition type.\r
//\r
#define EFI_OPTIONAL_PTR 0x00000001\r
-#define EFI_OPTIONAL_POINTER EFI_OPTIONAL_PTR\r
\r
/**\r
Determines the new virtual address that is to be used on subsequent memory accesses.\r
/// Timer delay types\r
///\r
typedef enum {\r
+ ///\r
+ /// An event's timer settings is to be cancelled and not trigger time is to be set\r
+ ///\r
TimerCancel,\r
+ ///\r
+ /// An event is to be signalled periodically at a specified interval from the current time.\r
+ ///\r
TimerPeriodic,\r
+ ///\r
+ /// An event is to be signalled once at a specified interval from the current time.\r
+ ///\r
TimerRelative\r
} EFI_TIMER_DELAY;\r
\r
/// real time clock device as exposed through the EFI interfaces.\r
///\r
typedef struct {\r
+ ///\r
+ /// Provides the reporting resolution of the real-time clock device in\r
+ /// counts per second. For a normal PC-AT CMOS RTC device, this\r
+ /// value would be 1 Hz, or 1, to indicate that the device only reports\r
+ /// the time to the resolution of 1 second.\r
+ ///\r
UINT32 Resolution;\r
+ ///\r
+ /// Provides the timekeeping accuracy of the real-time clock in an\r
+ /// error rate of 1E-6 parts per million. For a clock with an accuracy\r
+ /// of 50 parts per million, the value in this field would be\r
+ /// 50,000,000.\r
+ ///\r
UINT32 Accuracy;\r
+ ///\r
+ /// A TRUE indicates that a time set operation clears the device's\r
+ /// time below the Resolution reporting level. A FALSE\r
+ /// indicates that the state below the Resolution level of the\r
+ /// device is not cleared when the time is set. Normal PC-AT CMOS\r
+ /// RTC devices set this value to FALSE.\r
+ ///\r
BOOLEAN SetsToZero;\r
} EFI_TIME_CAPABILITIES;\r
\r
IN EFI_TIME *Time OPTIONAL\r
);\r
\r
-/**\r
- This is the declaration of an EFI image entry point. This entry point is\r
- the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including\r
- both device drivers and bus drivers.\r
-\r
- @param ImageHandle The firmware allocated handle for the UEFI image.\r
- @param SystemTable A pointer to the EFI System Table.\r
-\r
- @retval EFI_SUCCESS The operation completed successfully.\r
- @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
-\r
-**/\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_IMAGE_ENTRY_POINT)(\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
- );\r
-\r
/**\r
Loads an EFI image into memory.\r
\r
\r
@retval EFI_SUCCESS The image has been unloaded.\r
@retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle.\r
- @retval EFI_UNSUPPORTED The image has been started, and does not support unload.\r
- @return Exit code from the image's unload handler\r
\r
**/\r
typedef\r
/// Enumeration of reset types.\r
///\r
typedef enum {\r
+ ///\r
+ /// Used to induce a system-wide reset. This sets all circuitry within the \r
+ /// system to its initial state. This type of reset is asynchronous to system\r
+ /// operation and operates withgout regard to cycle boundaries. EfiColdReset \r
+ /// is tantamount to a system power cycle.\r
+ ///\r
EfiResetCold,\r
+ ///\r
+ /// Used to induce a system-wide initialization. The processors are set to their\r
+ /// initial state, and pending cycles are not corrupted. If the system does \r
+ /// not support this reset type, then an EfiResetCold must be performed.\r
+ ///\r
EfiResetWarm,\r
- EfiResetShutdown,\r
- EfiResetUpdate\r
+ ///\r
+ /// Used to induce en entry into power state equivalent to the ACPI G2/S5 or G3\r
+ /// state. If the system does not support this reset type, then when the system\r
+ /// is rebooted, it should exhibit the EfiResetCold attributes.\r
+ ///\r
+ EfiResetShutdown\r
} EFI_RESET_TYPE;\r
\r
/**\r
IN EFI_RESET_TYPE ResetType,\r
IN EFI_STATUS ResetStatus,\r
IN UINTN DataSize,\r
- IN CHAR16 *ResetData OPTIONAL\r
+ IN VOID *ResetData OPTIONAL\r
);\r
\r
/**\r
IN UINT8 Value\r
);\r
\r
-\r
-//\r
-// Protocol handler functions\r
-//\r
+///\r
+/// Enumeration of EFI Interface Types\r
+///\r
typedef enum {\r
+ ///\r
+ /// Indicates that the supplied protocol interface is supplied in native form.\r
+ ///\r
EFI_NATIVE_INTERFACE\r
} EFI_INTERFACE_TYPE;\r
\r
IN EFI_HANDLE ControllerHandle\r
);\r
\r
-\r
+///\r
+/// EFI Oprn Protocol Information Entry\r
+///\r
typedef struct {\r
EFI_HANDLE AgentHandle;\r
EFI_HANDLE ControllerHandle;\r
OUT VOID **Registration\r
);\r
\r
-\r
+///\r
+/// Enumeration of EFI Locate Search Types\r
+///\r
typedef enum {\r
+ ///\r
+ /// Retrieve all the handles in the handle database.\r
+ ///\r
AllHandles,\r
+ ///\r
+ /// Retrieve the next handle fron a RegisterProtocolNotify() event.\r
+ ///\r
ByRegisterNotify,\r
+ ///\r
+ /// Retrieve the set of handles from the handle database that support a \r
+ /// specified protocol.\r
+ ///\r
ByProtocol\r
} EFI_LOCATE_SEARCH_TYPE;\r
\r
IN VOID *Table\r
);\r
\r
-\r
/**\r
Returns an array of handles that support the requested protocol in a buffer allocated from pool.\r
\r
OUT VOID **Interface\r
);\r
\r
+///\r
+/// EFI Capsule Block Descriptor\r
+///\r
typedef struct {\r
- UINT64 Length;\r
+ ///\r
+ /// Length in bytes of the data pointed to by DataBlock/ContinuationPointer.\r
+ ///\r
+ UINT64 Length;\r
union {\r
+ ///\r
+ /// Physical address of the data block. This member of the union is\r
+ /// used if Length is not equal to zero.\r
+ ///\r
EFI_PHYSICAL_ADDRESS DataBlock;\r
+ ///\r
+ /// Physical address of another block of\r
+ /// EFI_CAPSULE_BLOCK_DESCRIPTOR structures. This\r
+ /// member of the union is used if Length is equal to zero. If\r
+ /// ContinuationPointer is zero this entry represents the end of the list.\r
+ ///\r
EFI_PHYSICAL_ADDRESS ContinuationPointer;\r
} Union;\r
} EFI_CAPSULE_BLOCK_DESCRIPTOR;\r
\r
+///\r
+/// EFI Capsule Header\r
+///\r
typedef struct {\r
+ ///\r
+ /// A GUID that defines the contents of a capsule.\r
+ ///\r
EFI_GUID CapsuleGuid;\r
+ ///\r
+ /// The size of the capsule header. This may be larger than the size of\r
+ /// the EFI_CAPSULE_HEADER since CapsuleGuid may imply\r
+ /// extended header entries\r
+ ///\r
UINT32 HeaderSize;\r
+ ///\r
+ /// Bit-mapped list describing the capsule attributes. The Flag values\r
+ /// of 0x0000 - 0xFFFF are defined by CapsuleGuid. Flag values\r
+ /// of 0x10000 - 0xFFFF0000 are defined by this specification\r
+ ///\r
UINT32 Flags;\r
+ ///\r
+ /// Size in bytes of the capsule.\r
+ ///\r
UINT32 CapsuleImageSize;\r
} EFI_CAPSULE_HEADER;\r
\r
-//\r
-// The EFI System Table entry must point to an array of capsules\r
-// that contain the same CapsuleGuid value. The array must be\r
-// prefixed by a UINT32 that represents the size of the array of capsules.\r
-//\r
+///\r
+/// The EFI System Table entry must point to an array of capsules\r
+/// that contain the same CapsuleGuid value. The array must be\r
+/// prefixed by a UINT32 that represents the size of the array of capsules.\r
+///\r
typedef struct {\r
+ ///\r
+ /// the size of the array of capsules.\r
+ ///\r
UINT32 CapsuleArrayNumber;\r
+ ///\r
+ /// Point to an array of capsules that contain the same CapsuleGuid value.\r
+ ///\r
VOID* CapsulePtr[1];\r
} EFI_CAPSULE_TABLE;\r
\r
//\r
// EFI Runtime Services Table\r
//\r
-#define EFI_SYSTEM_TABLE_SIGNATURE 0x5453595320494249ULL\r
-#define EFI_SYSTEM_TABLE_REVISION ((2<<16) | (10))\r
-#define EFI_2_10_SYSTEM_TABLE_REVISION ((2<<16) | (10))\r
-#define EFI_2_00_SYSTEM_TABLE_REVISION ((2<<16) | (00))\r
-#define EFI_1_10_SYSTEM_TABLE_REVISION ((1<<16) | (10))\r
-#define EFI_1_02_SYSTEM_TABLE_REVISION ((1<<16) | (02))\r
-\r
-#define EFI_RUNTIME_SERVICES_SIGNATURE 0x56524553544e5552ULL\r
+#define EFI_SYSTEM_TABLE_SIGNATURE SIGNATURE_64 ('I','B','I',' ','S','Y','S','T')\r
+#define EFI_SYSTEM_TABLE_REVISION ((2 << 16) | (10))\r
+#define EFI_2_10_SYSTEM_TABLE_REVISION ((2 << 16) | (10))\r
+#define EFI_2_00_SYSTEM_TABLE_REVISION ((2 << 16) | (00))\r
+#define EFI_1_10_SYSTEM_TABLE_REVISION ((1 << 16) | (10))\r
+#define EFI_1_02_SYSTEM_TABLE_REVISION ((1 << 16) | (02))\r
+\r
+#define EFI_RUNTIME_SERVICES_SIGNATURE SIGNATURE_64 ('R','U','N','T','S','E','R','V')\r
#define EFI_RUNTIME_SERVICES_REVISION EFI_2_10_SYSTEM_TABLE_REVISION\r
\r
///\r
} EFI_RUNTIME_SERVICES;\r
\r
\r
-#define EFI_BOOT_SERVICES_SIGNATURE 0x56524553544f4f42ULL\r
+#define EFI_BOOT_SERVICES_SIGNATURE SIGNATURE_64 ('B','O','O','T','S','E','R','V')\r
#define EFI_BOOT_SERVICES_REVISION EFI_2_10_SYSTEM_TABLE_REVISION\r
\r
///\r
/// Contains a set of GUID/pointer pairs comprised of the ConfigurationTable field in the\r
/// EFI System Table.\r
///\r
-typedef struct{\r
+typedef struct {\r
///\r
/// The 128-bit GUID value that uniquely identifies the system configuration table.\r
///\r
///\r
/// EFI System Table\r
///\r
-struct _EFI_SYSTEM_TABLE {\r
+typedef struct {\r
///\r
/// The table header for the EFI System Table.\r
///\r
/// The number of entries in the table is NumberOfTableEntries.\r
///\r
EFI_CONFIGURATION_TABLE *ConfigurationTable;\r
-};\r
+} EFI_SYSTEM_TABLE;\r
+\r
+/**\r
+ This is the declaration of an EFI image entry point. This entry point is\r
+ the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including\r
+ both device drivers and bus drivers.\r
+\r
+ @param ImageHandle The firmware allocated handle for the UEFI image.\r
+ @param SystemTable A pointer to the EFI System Table.\r
+\r
+ @retval EFI_SUCCESS The operation completed successfully.\r
+ @retval Others Some unexpected error happened.\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_IMAGE_ENTRY_POINT)(\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ );\r
\r
//\r
// EFI Load Options Attributes\r
#define EFI_BOOT_OPTION_SUPPORT_APP 0x00000002\r
#define EFI_BOOT_OPTION_SUPPORT_COUNT 0x00000300\r
\r
+///\r
+/// EFI Boot Key Data\r
+///\r
typedef union {\r
struct {\r
+ ///\r
+ /// Indicates the revision of the EFI_KEY_OPTION structure. This revision level should be 0.\r
+ ///\r
UINT32 Revision : 8;\r
+ ///\r
+ /// Either the left or right Shift keys must be pressed (1) or must not be pressed (0).\r
+ ///\r
UINT32 ShiftPressed : 1;\r
+ ///\r
+ /// Either the left or right Control keys must be pressed (1) or must not be pressed (0).\r
+ ///\r
UINT32 ControlPressed : 1;\r
+ ///\r
+ /// Either the left or right Alt keys must be pressed (1) or must not be pressed (0).\r
+ ///\r
UINT32 AltPressed : 1;\r
+ ///\r
+ /// Either the left or right Logo keys must be pressed (1) or must not be pressed (0).\r
+ ///\r
UINT32 LogoPressed : 1;\r
+ ///\r
+ /// The Menu key must be pressed (1) or must not be pressed (0).\r
+ ///\r
UINT32 MenuPressed : 1;\r
+ ///\r
+ /// The SysReq key must be pressed (1) or must not be pressed (0).\r
+ ///\r
UINT32 SysReqPessed : 1;\r
UINT32 Reserved : 16;\r
+ ///\r
+ /// Specifies the actual number of entries in EFI_KEY_OPTION.Keys, from 0-3. If\r
+ /// zero, then only the shift state is considered. If more than one, then the boot option will\r
+ /// only be launched if all of the specified keys are pressed with the same shift state.\r
+ ///\r
UINT32 InputKeyCount : 2;\r
} Options;\r
UINT32 PackedValue;\r
-} HOT_KEY_EFI_KEY_DATA;\r
+} EFI_BOOT_KEY_DATA;\r
\r
+///\r
+/// EFI Key Option\r
+///\r
typedef struct {\r
- HOT_KEY_EFI_KEY_DATA KeyOptions;\r
- UINT32 BootOptionCrc;\r
- UINT16 BootOption;\r
-//EFI_INPUT_KEY Keys[];\r
+ ///\r
+ /// Specifies options about how the key will be processed.\r
+ ///\r
+ EFI_BOOT_KEY_DATA KeyData;\r
+ ///\r
+ /// The CRC-32 which should match the CRC-32 of the entire EFI_LOAD_OPTION to\r
+ /// which BootOption refers. If the CRC-32s do not match this value, then this key\r
+ /// option is ignored.\r
+ ///\r
+ UINT32 BootOptionCrc;\r
+ ///\r
+ /// The Boot#### option which will be invoked if this key is pressed and the boot option\r
+ /// is active (LOAD_OPTION_ACTIVE is set).\r
+ ///\r
+ UINT16 BootOption;\r
+ ///\r
+ /// The key codes to compare against those returned by the\r
+ /// EFI_SIMPLE_TEXT_INPUT and EFI_SIMPLE_TEXT_INPUT_EX protocols.\r
+ /// The number of key codes (0-3) is specified by the EFI_KEY_CODE_COUNT field in KeyOptions.\r
+ ///\r
+ //EFI_INPUT_KEY Keys[];\r
} EFI_KEY_OPTION;\r
\r
#define EFI_KEY_OPTION_SHIFT 0x00000001\r
#define EFI_KEY_OPTION_SYSREQ 0x00000020\r
#define EFI_KEY_CODE_COUNT 0x00000300\r
\r
-\r
//\r
// EFI File location to boot from on removable media devices\r
//\r