summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSlendi <slendi@socopon.com>2023-09-27 15:57:16 +0300
committerSlendi <slendi@socopon.com>2023-09-27 15:58:30 +0300
commitb98d83ae9fd330d1138b8a0768e8fc30f55ebcce (patch)
treec94553e1fc46d9cac7056de8167d7d308dfea3e1
parent7b5135286b9a7cbd38a2eebbf832bf5d49b97346 (diff)
Add adapted documentation from specification.
Signed-off-by: Slendi <slendi@socopon.com>
-rw-r--r--efi.odin494
1 files changed, 416 insertions, 78 deletions
diff --git a/efi.odin b/efi.odin
index 84fb9f5..2a0fc62 100644
--- a/efi.odin
+++ b/efi.odin
@@ -2,8 +2,7 @@ package main
import "core:runtime"
-EfiTextReset :: proc "c" (this: ^EfiSimpleTextOutputProtocol, extended_verification: bool)
-EfiTextString :: proc "c" (this: ^EfiSimpleTextOutputProtocol, string: [^]u16)
+EfiHandle :: rawptr
EfiSimpleTextInputProtocol :: struct {}
EfiSimpleTextOutputProtocol :: struct {
@@ -11,6 +10,9 @@ EfiSimpleTextOutputProtocol :: struct {
output_string: EfiTextString,
}
+EfiTextReset :: proc "c" (this: ^EfiSimpleTextOutputProtocol, extended_verification: bool)
+EfiTextString :: proc "c" (this: ^EfiSimpleTextOutputProtocol, string: [^]u16)
+
EfiTableHeader :: struct {
signature: u64,
revision: u32,
@@ -20,60 +22,183 @@ EfiTableHeader :: struct {
}
EfiTime :: struct {
- year: u16,
- month: u8,
- day: u8,
- hour: u8,
- minute: u8,
- second: u8,
+ year: u16, // 1900 - 9999
+ month: u8, // 1 - 12
+ day: u8, // 1 - 31
+ hour: u8, // 0 - 23
+ minute: u8, // 0 - 59
+ second: u8, // 0 - 59
pad1: u8,
- nanosecond: u32,
- timeZone: i16,
+ nanosecond: u32, // 0 - 999,999,999
+ time_zone: i16, // —1440 to 1440 or 2047
daylight: u8,
pad2: u8,
}
+// This provides the capabilities of the real time clock device as exposed
+// through the EFI.
EfiTimeCapabilities :: struct {
+ // Provides the reporting resolution of the real-time clock device in counts
+ // per second. For a normal PC-AT CMOS RTC device, this value would be 1 Hz,
+ // or 1, to indicate that the device only reports the time to the resolution
+ // of 1 second.
resolution: u32,
+ // Provides the timekeeping accuracy of the real-time clock in an error rate
+ // of 1E-6 parts per million. For a clock with an accuracy of 50 parts per
+ // million, the value in this field would be 50,000,000.
accuracy: u32,
+ // A TRUE indicates that a time set operation clears the device's time below
+ // the Resolution reporting level. A FALSE indicates that the state below the
+ // Resolution level of the device is not cleared when the time is set. Normal
+ // PC-AT CMOS RTC devices set this value to FALSE.
sets_to_zero: bool,
}
-
EFI_TIME_ADJUST_DAYLIGHT :: 0x01
EFI_TIME_IN_DAYLIGHT :: 0x02
-
EFI_UNSPECIFIED_TIMEZONE :: 0x07FF
+// Memory Attribute Definitions
+// Can be ORed as needed.
+EFI_MEMORY_UC :: 0x0000000000000001
+EFI_MEMORY_WC :: 0x0000000000000002
+EFI_MEMORY_WT :: 0x0000000000000004
+EFI_MEMORY_WB :: 0x0000000000000008
+EFI_MEMORY_UCE :: 0x0000000000000010
+EFI_MEMORY_WP :: 0x0000000000001000
+EFI_MEMORY_RP :: 0x0000000000002000
+EFI_MEMORY_XP :: 0x0000000000004000
+EFI_MEMORY_NV :: 0x0000000000008000
+EFI_MEMORY_MORE_RELIABLE :: 0x0000000000010000
+EFI_MEMORY_RO :: 0x0000000000020000
+EFI_MEMORY_SP :: 0x0000000000040000
+EFI_MEMORY_CPU_CRYPTO :: 0x0000000000080000
+EFI_MEMORY_RUNTIME :: 0x8000000000000000
+EFI_MEMORY_ISA_VALID :: 0x4000000000000000
+EFI_MEMORY_ISA_MASK :: 0x0FFFF00000000000
EfiMemoryDescriptor :: struct {
+ // Type of the memory region.
type: u32,
+ // Physical address of the first byte in the memory region. PhysicalStart
+ // must be aligned on a 4 KiB boundary, and must not be above
+ // 0xfffffffffffff000.
physical_start: u64,
+ // Virtual address of the first byte in the memory region. VirtualStart must
+ // be aligned on a 4 KiB boundary, and must not be above 0xfffffffffffff000.
virtual_start: u64,
+ // Number of 4 KiB pages in the memory region. NumberOfPages must not be 0,
+ // and must not be any value that would represent a memory page with a start
+ // address, either physical or virtual, above 0xfffffffffffff000.
number_of_pages: u64,
+ // 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.
attributes: u64,
}
EFI_OPTIONAL_PTR :: 1
EfiResetType :: enum {
+ // Causes 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 without regard to cycle boundaries. EfiResetCold is
+ // tantamount to a system power cycle.
EfiResetCold,
+ // Causes 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,
+ // Causes the system to enter a power state equivalent to the ACPI G2/S5 or
+ // G3 states. If the system does not support this reset type, then when the
+ // system is rebooted, it should exhibit the EfiResetCold attributes.
EfiResetShutdown,
+ // Causes a system-wide reset. The exact type of the reset is defined by the
+ // EFI_GUID that follows the Null-terminated Unicode string passed into
+ // ResetData. If the platform does not recognize the EFI_GUID in ResetData
+ // the platform must pick a supported reset type to perform.The platform may
+ // optionally log the parameters from any non-normal reset that occurs.
EfiResetPlatformSpecific,
}
EfiStatus :: uint
-EfiGetTime :: proc "c" (efi_time: ^EfiTime, capabilities: ^EfiTimeCapabilities) -> EfiStatus
+// Returns the current time and date information, and the time-keeping
+// capabilities of the hardware platform.
+//
+// Outputs:
+// - time: A pointer to storage to receive a snapshot of the current time.
+// - capabilities: An optional pointer to a buffer to receive the real time
+// clock device's capabilities.
+EfiGetTime :: proc "c" (time: ^EfiTime, capabilities: ^EfiTimeCapabilities) -> EfiStatus
+
+// Sets the current local time and date information.
+//
+// Inputs:
+// - efi_time: A pointer to the current time. Full error checking is performed
+// on the different fields of the EFI_TIME structure, and
+// EFI_INVALID_PARAMETER is returned if any field is out of range.
EfiSetTime :: proc "c" (efi_time: ^EfiTime) -> EfiStatus
+
+// Returns the current wakeup alarm clock setting.
+//
+// Outputs:
+// - enabled: Indicates if the alarm is currently enabled or disabled.
+// - pending: Indicates if the alarm signal is pending and requires
+// acknowledgement.
+// - time: The current alarm setting.
EfiGetWakeupTime :: proc "c" (enabled, pending: bool, time: ^EfiTime) -> EfiStatus
+
+// Sets the system wakeup alarm clock time.
+//
+// Inputs:
+// - enable: Enable or disable the wakeup alarm.
+// - time: If Enable is TRUE, the time to set the wakeup alarm for. Type
+// EFI_TIME is defined in the GetTime() function description. If Enable is
+// FALSE, then this parameter is optional, and may be NULL.
EfiSetWakeupTime :: proc "c" (enable: bool, time: ^EfiTime) -> EfiStatus
+
+// Changes the runtime addressing mode of EFI firmware from physical to
+// virtual.
+//
+// Inputs:
+// - memory_map_size: The size in bytes of VirtualMap.
+// - descriptor_size: The size in bytes of an entry in the VirtualMap.
+// - descriptor_version: The version of the structure entries in VirtualMap.
+// - virtual_map: An array of memory descriptors which contain new virtual
+// address mapping information for all runtime ranges.
EfiSetVirtualAddressMap :: proc "c" (
memory_map_size, descriptor_size: uint,
descriptor_version: u32,
virtual_map: [^]EfiMemoryDescriptor,
) -> EfiStatus
+
+// Determines the new virtual address that is to be used on subsequent memory
+// accesses.
+//
+// Inputs:
+// - debug_disposition: Supplies type information for the pointer being
+// converted.
+// - address: A pointer to a pointer that is to be fixed to be the value needed
+// for the new virtual address mappings being applied.
EfiConvertPointer :: proc "c" (debug_disposition: uint, address: ^rawptr) -> EfiStatus
+// Resets the entire platform. If the platform supports
+// EFI_RESET_NOTIFICATION_PROTOCOL, then prior to completing the reset of the
+// platform, all of the pending notifications must be called.
+//
+// Inputs:
+// - reset_type: The type of reset to perform.
+// - reset_status: The status code for the reset. If the system reset is part
+// of a normal operation, the status code would be EFI_SUCCESS. If the system
+// reset is due to some type of failure the most appropriate EFI Status code
+// would be used.
+// - data_size: The size, in bytes, of ResetData.
+// - reset_data: For a ResetType of EfiResetCold, EfiResetWarm, or
+// EfiResetShutdown the data buffer starts with a Null-terminated string,
+// optionally followed by additional binary data. The string is a description
+// that the caller may use to further indicate the reason for the system
+// reset. For a ResetType of EfiResetPlatformSpecific the data buffer also
+// starts with a Null-terminated string that is followed by an EFI_GUID that
+// describes the specific type of reset to perform.
EfiResetSystem :: proc "c" (
reset_type: EfiResetType,
reset_status: EfiStatus,
@@ -83,6 +208,9 @@ EfiResetSystem :: proc "c" (
EfiUnimplementedFunction :: proc "c" ()
+EFI_RUNTIME_SERVICES_SIGNATURE :: 0x56524553544e5552
+EFI_RUNTIME_SERVICES_REVISION :: EFI_SPECIFICATION_VERSION
+// Contains a table header and pointers to all of the runtime services.
EfiRuntimeServices :: struct {
header: EfiTableHeader,
@@ -104,38 +232,83 @@ EfiRuntimeServices :: struct {
// Miscellaneous Services
get_next_high_monotonic_count: EfiUnimplementedFunction,
reset_system: EfiResetSystem,
+
+ // UEFI 2.0 Capsule Services
update_capsule: EfiUnimplementedFunction,
query_capsule_capabilities: EfiUnimplementedFunction,
+
+ // Miscellaneous UEFI 2.0 Services
query_variable_info: EfiUnimplementedFunction,
}
EfiAllocateType :: enum {
+ // Allocate any available range of pages that satisfies the request. On
+ // input, the address pointed to by Memory is ignored.
EfiAllocateAnyPages,
+ // Allocate any available range of pages whose uppermost address is less than
+ // or equal to the address pointed to by Memory on input.
EfiAllocateMaxAddress,
+ // Allocate pages at the address pointed to by Memory on input.
EfiAllocateAddress,
EfiMaxAllocateType,
}
EfiMemoryType :: enum {
+ // Not usable
EfiReservedMemoryType,
+ // The code portions of a loaded UEFI application.
EfiLoaderCode,
+ // The data portions of a loaded UEFI application and the default data
+ // allocation type used by a UEFI application to allocate pool memory.
EfiLoaderData,
+ // The code portions of a loaded UEFI Boot Service Driver.
EfiBootServicesCode,
+ // The data portions of a loaded UEFI Boot Serve Driver, and the default data
+ // allocation type used by a UEFI Boot Service Driver to allocate pool
+ // memory.
EfiBootServicesData,
+ // The code portions of a loaded UEFI Runtime Driver.
EfiRuntimeServicesCode,
+ // The data portions of a loaded UEFI Runtime Driver and the default data
+ // allocation type used by a UEFI Runtime Driver to allocate pool memory.
EfiRuntimeServicesData,
+ // Free (unallocated) memory.
EfiConventionalMemory,
+ // Memory in which errors have been detected.
EfiUnusableMemory,
+ // Memory that holds the ACPI tables.
EfiACPIReclaimMemory,
+ // Address space reserved for use by the firmware.
EfiACPIMemoryNVS,
+ // Used by system firmware to request that a memory-mapped IO region be
+ // mapped by the OS to a virtual address so it can be accessed by EFI runtime
+ // services.
EfiMemoryMappedIO,
+ // System memory-mapped IO region that is used to translate memory cycles to
+ // IO cycles by the processor.
EfiMemoryMappedIOPortSpace,
+ // Address space reserved by the firmware for code that is part of the
+ // processor.
EfiPalCode,
+ // A memory region that operates as EfiConventionalMemory. However, it
+ // happens to also support byte-addressable non-volatility.
EfiPersistentMemory,
+ // A memory region that represents unaccepted memory, that must be accepted
+ // by the boot target before it can be used. Unless otherwise noted, ll other
+ // EFI memory types are accepted. For platforms that support unaccepted
+ // memory, all unaccepted valid memory will be reported as unaccepted in the
+ // memory map. Unreported physical address ranges must be treated as
+ // not-present memory.
EfiUnacceptedMemoryType,
EfiMaxMemoryType,
}
+EFI_DEVICE_PATH_PROTOCOL_GUID: GUID : {
+ 0x09576e91,
+ 0x6d3f,
+ 0x11d2,
+ {0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b},
+}
EfiDevicePathProtocol :: struct {
type: u8,
subtype: u8,
@@ -143,109 +316,226 @@ EfiDevicePathProtocol :: struct {
}
EfiTPL :: uint
+TPL_APPLICATION :: 4
+TPL_CALLBACK :: 8
+TPL_NOTIFY :: 16
+
+TPL_HIGH_LEVEL :: 31 // FIXME: Issue with specification?
+
+// Raises a task's priority level and returns its previous level.
+// Inputs:
+// - new_tpl: The new task priority level. It must be greater than or equal to
+// the current task priority level.
+// Returns: Previous level.
EfiRaiseTPL :: proc "c" (new_tpl: EfiTPL) -> EfiTPL
+
+// Restores a task's priority level to its previous value.
+// Inputs:
+// - old_tpl: The previous task priority level to restore (the value from a
+// previous, matching call to EFI_BOOT_SERVICES.RaiseTPL() . Type EFI_TPL is
+// defined in the RaiseTPL() function description.
EfiRestoreTPL :: proc "c" (old_tpl: EfiTPL)
+
+// Allocates memory pages from the system.
+// Inputs:
+// - type: The type of allocation to perform. See “Related Definitions.”
+// - memory_type: The type of memory to allocate. Normal allocations (that is,
+// allocations by any UEFI application) are of type EfiLoaderData. MemoryType
+// values in the range 0x70000000..0x7FFFFFFF are reserved for OEM use.
+// MemoryType values in the range 0x80000000..0xFFFFFFFF are reserved for use
+// by UEFI OS loaders that are provided by operating system vendors.
+// - pages: The number of contiguous 4 KiB pages to allocate.
+//
+// Inputs/Outputs:
+// - memory: Pointer to a physical address. On input, the way in which the
+// address is used depends on the value of Type. On output the address is set
+// to the base of the page range that was allocated.
EfiAllocatePages :: proc "c" (
type: EfiAllocateType,
memory_type: EfiMemoryType,
pages: uint,
memory: ^u64,
) -> EfiStatus
+
+// Frees memory pages.
+// Inputs:
+// - memory: The base physical address of the pages to be freed.
+// - pages: The number of contiguous 4 KiB pages to free.
EfiFreePages :: proc "c" (memory: u64, pages: uint) -> EfiStatus
+
+// Returns the current memory map.
+//
+// Inputs:
+// - memory_map_size: 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.
+//
+// Output:
+// - memory_map: A pointer to the buffer in which firmware places the current
+// memory map. The map is an array of EFI_MEMORY_DESCRIPTORs.
+// - map_key: A pointer to the location in which firmware returns the key for
+// the current memory map.
+// - descriptor_size: A pointer to the location in which firmware returns the
+// size, in bytes, of an individual EFI_MEMORY_DESCRIPTOR.
+// - descriptor_version: A pointer to the location in which firmware returns
+// the version number associated with the EFI_MEMORY_DESCRIPTOR.
EfiGetMemoryMap :: proc "c" (
memory_map_size: uint,
memory_map: ^EfiMemoryDescriptor,
map_key, descriptor_size: ^uint,
descriptor_version: u32,
) -> EfiStatus
-
+// Loads an EFI image into memory.
+//
+// Inputs:
+// - boot_policy: If TRUE, indicates that the request originates from the boot
+// manager, and that the boot manager is attempting to load DevicePath as a
+// boot selection. Ignored if SourceBuffer is not NULL.
+// - parent_image_handle: The caller's image handle. Type EFI_HANDLE is defined
+// in the EFI_BOOT_SERVICES.InstallProtocolInterface() function description.
+// This field is used to initialize the ParentHandle field of the EFI Loaded
+// Image Protocol for the image that is being loaded.
+// - device_path: The DeviceHandle specific file path from which the image is
+// loaded.
+// - source_buffer: If not NULL, a pointer to the memory location containing a
+// copy of the image to be loaded.
+// - source_size: The size in bytes of SourceBuffer. Ignored if SourceBuffer is
+// NULL.
+//
+// Outputs:
+// - image_handle: Pointer to the returned image handle that is created when
+// the image is successfully loaded.
EfiLoadImage :: proc "c" (
boot_policy: bool,
- parent_image_handle: rawptr,
+ parent_image_handle: EfiHandle,
device_path: EfiDevicePathProtocol,
source_buffer: rawptr,
source_size: uint,
- image_handle: rawptr,
+ image_handle: EfiHandle,
) -> EfiStatus
+// Transfers control to a loaded image's entry point.
+//
+// Inputs:
+// - image_handle: Handle of image to be started.
+//
+// Outputs:
+// - exit_data_size: Pointer to the size, in bytes, of ExitData. If ExitData is
+// NULL, then this parameter is ignored and the contents of ExitDataSize are
+// not modified.
+// - exit_data: Pointer to a pointer to a data buffer that includes a
+// Null-terminated string, optionally followed by additional binary data. The
+// string is a description that the caller may use to further indicate the
+// reason for the image's exit.
EfiStartImage :: proc "c" (
- image_handle: rawptr,
+ image_handle: EfiHandle,
exit_data_size: ^uint,
exit_data: ^[^]u16,
) -> EfiStatus
-EfiUnloadImage :: proc "c" (image_handle: rawptr) -> EfiStatus
+// Unloads an image.
+//
+// Inputs:
+// - image_handle: Handle that identifies the image to be unloaded.
+EfiUnloadImage :: proc "c" (image_handle: EfiHandle) -> EfiStatus
+// Terminates a loaded EFI image and returns control to boot services.
+//
+// Inputs:
+// - image_handle: Handle that identifies the image. This parameter is passed
+// to the image on entry.
+// - exit_status: The image's exit code.
+// - exit_data_size: The size, in bytes, of ExitData. Ignored if ExitStatus is
+// EFI_SUCCESS.
+// - exit_data: Pointer to a data buffer that includes a Null-terminated
+// string, optionally followed by additional binary data. The string is a
+// description that the caller may use to further indicate the reason for the
+// image's exit. ExitData is only valid if ExitStatu is something other than
+// EFI_SUCCESS. The ExitData buffer must be allocated by calling
+// EFI_BOOT_SERVICES.AllocatePool().
EfiExit :: proc "c" (
image_handle: rawptr,
exit_status: EfiStatus,
exit_data_size: uint,
exit_data: [^]u16,
) -> EfiStatus
-EfiExitBootServices :: proc "c" (image_handle: rawptr, map_key: uint) -> EfiStatus
-
+// Terminates all boot services.
+//
+// Inputs:
+// - image_handle: Handle that identifies the exiting image.
+// - map_key: Key to the latest memory map.
+EfiExitBootServices :: proc "c" (image_handle: EfiHandle, map_key: uint) -> EfiStatus
+
+EFI_BOOT_SERVICES_SIGNATURE :: 0x56524553544f4f42
+EFI_BOOT_SERVICES_REVISION :: EFI_SPECIFICATION_VERSION
+// Contains a table header and pointers to all of the boot services.
EfiBootServices :: struct {
header: EfiTableHeader,
+
// Event, Timer, and Task Priority Services (1)
- raise_tpl: EfiRaiseTPL,
- restore_tpl: EfiRestoreTPL,
+ raise_tpl: EfiRaiseTPL, // EFI 1.0+
+ restore_tpl: EfiRestoreTPL, // EFI 1.0+
// Memory Allocation Services
- allocate_pages: EfiAllocatePages,
- free_pages: EfiAllocatePages,
- get_memory_map: EfiGetMemoryMap,
- allocate_pool: EfiUnimplementedFunction,
- free_pool: EfiUnimplementedFunction,
-
- // Event, Timer, and Task Priority Services (2)
- create_event: EfiUnimplementedFunction,
- set_timer: EfiUnimplementedFunction,
- wait_for_event: EfiUnimplementedFunction,
- signal_event: EfiUnimplementedFunction,
- close_event: EfiUnimplementedFunction,
- check_event: EfiUnimplementedFunction,
+ allocate_pages: EfiAllocatePages, // EFI 1.0+
+ free_pages: EfiAllocatePages, // EFI 1.0+
+ get_memory_map: EfiGetMemoryMap, // EFI 1.0+
+ allocate_pool: EfiUnimplementedFunction, // EFI 1.0+
+ free_pool: EfiUnimplementedFunction, // EFI 1.0+
+
+ // Event & Timer Services
+ create_event: EfiUnimplementedFunction, // EFI 1.0+
+ set_timer: EfiUnimplementedFunction, // EFI 1.0+
+ wait_for_event: EfiUnimplementedFunction, // EFI 1.0+
+ signal_event: EfiUnimplementedFunction, // EFI 1.0+
+ close_event: EfiUnimplementedFunction, // EFI 1.0+
+ check_event: EfiUnimplementedFunction, // EFI 1.0+
// Protocol Handler Services
- install_protocol_interface: EfiUnimplementedFunction,
- reinstall_protocol_interface: EfiUnimplementedFunction,
- uninstall_protocol_interface: EfiUnimplementedFunction,
- handle_protocol: EfiUnimplementedFunction,
- reserved: EfiUnimplementedFunction,
- register_protocol_notify: EfiUnimplementedFunction,
- locate_handle: EfiUnimplementedFunction,
- locate_device_path: EfiUnimplementedFunction,
-
- // Miscellaneous Services (1)
- install_configuration_table: EfiUnimplementedFunction,
+ install_protocol_interface: EfiUnimplementedFunction, // EFI 1.0+
+ reinstall_protocol_interface: EfiUnimplementedFunction, // EFI 1.0+
+ uninstall_protocol_interface: EfiUnimplementedFunction, // EFI 1.0+
+ handle_protocol: EfiUnimplementedFunction, // EFI 1.0+
+ reserved: EfiUnimplementedFunction, // EFI 1.0+
+ register_protocol_notify: EfiUnimplementedFunction, // EFI 1.0+
+ locate_handle: EfiUnimplementedFunction, // EFI 1.0+
+ locate_device_path: EfiUnimplementedFunction, // EFI 1.0+
+ install_configuration_table: EfiUnimplementedFunction, // EFI 1.0+
// Image Services
- load_image: EfiLoadImage,
- start_image: EfiStartImage,
- exit: EfiExit,
- unload_image: EfiUnloadImage,
- exit_boot_services: EfiExitBootServices,
+ load_image: EfiLoadImage, // EFI 1.0+
+ start_image: EfiStartImage, // EFI 1.0+
+ exit: EfiExit, // EFI 1.0+
+ unload_image: EfiUnloadImage, // EFI 1.0+
+ exit_boot_services: EfiExitBootServices, // EFI 1.0+
- // Miscellaneous Services (2)
- get_next_monotonic_count: EfiUnimplementedFunction,
- stall: EfiUnimplementedFunction,
- set_watchdog_timer: EfiUnimplementedFunction,
+ // Miscellaneous Services
+ get_next_monotonic_count: EfiUnimplementedFunction, // EFI 1.0+
+ stall: EfiUnimplementedFunction, // EFI 1.0+
+ set_watchdog_timer: EfiUnimplementedFunction, // EFI 1.0+
- // Protocol Handler Services
- connect_controller: EfiUnimplementedFunction,
- disconnect_controller: EfiUnimplementedFunction,
- open_protocol: EfiUnimplementedFunction,
- close_protocol: EfiUnimplementedFunction,
- open_protocol_information: EfiUnimplementedFunction,
- protocols_per_handle: EfiUnimplementedFunction,
- locate_handle_buffer: EfiUnimplementedFunction,
- locate_protocol: EfiUnimplementedFunction,
- install_multiple_protocol_interfaces: EfiUnimplementedFunction,
- uninstall_multiple_protocol_interfaces: EfiUnimplementedFunction,
-
- // Miscellaneous Services (3)
- calculate_crc32: EfiUnimplementedFunction,
- copy_mem: EfiUnimplementedFunction,
- set_mem: EfiUnimplementedFunction,
-
- // Event, Timer, and Task Priority Services (3)
- create_event_ex: EfiUnimplementedFunction,
+ // DriverSupport Services
+ connect_controller: EfiUnimplementedFunction, // EFI 1.1+
+ disconnect_controller: EfiUnimplementedFunction, // EFI 1.1+
+
+ // Open and Close Protocol Services
+ open_protocol: EfiUnimplementedFunction, // EFI 1.1+
+ close_protocol: EfiUnimplementedFunction, // EFI 1.1+
+ open_protocol_information: EfiUnimplementedFunction, // EFI 1.1+
+
+ // Library Services
+ protocols_per_handle: EfiUnimplementedFunction, // EFI 1.1+
+ locate_handle_buffer: EfiUnimplementedFunction, // EFI 1.1+
+ locate_protocol: EfiUnimplementedFunction, // EFI 1.1+
+ install_multiple_protocol_interfaces: EfiUnimplementedFunction, // EFI 1.1+
+ uninstall_multiple_protocol_interfaces: EfiUnimplementedFunction, // EFI 1.1+
+
+ // 32-bit CRC Services
+ calculate_crc32: EfiUnimplementedFunction, // EFI 1.1+
+
+ // Miscellaneous Services
+ copy_mem: EfiUnimplementedFunction, // EFI 1.1+
+ set_mem: EfiUnimplementedFunction, // EFI 1.1+
+ create_event_ex: EfiUnimplementedFunction, // EFI 1.1+
}
GUID :: struct {
@@ -260,19 +550,67 @@ EfiConfigurationTable :: struct {
vendor_table: rawptr,
}
+EFI_SYSTEM_TABLE_SIGNATURE :: 0x5453595320494249
+EFI_2_100_SYSTEM_TABLE_REVISION :: ((2 << 16) | (100))
+EFI_2_90_SYSTEM_TABLE_REVISION :: ((2 << 16) | (90))
+EFI_2_80_SYSTEM_TABLE_REVISION :: ((2 << 16) | (80))
+EFI_2_70_SYSTEM_TABLE_REVISION :: ((2 << 16) | (70))
+EFI_2_60_SYSTEM_TABLE_REVISION :: ((2 << 16) | (60))
+EFI_2_50_SYSTEM_TABLE_REVISION :: ((2 << 16) | (50))
+EFI_2_40_SYSTEM_TABLE_REVISION :: ((2 << 16) | (40))
+EFI_2_31_SYSTEM_TABLE_REVISION :: ((2 << 16) | (31))
+EFI_2_30_SYSTEM_TABLE_REVISION :: ((2 << 16) | (30))
+EFI_2_20_SYSTEM_TABLE_REVISION :: ((2 << 16) | (20))
+EFI_2_10_SYSTEM_TABLE_REVISION :: ((2 << 16) | (10))
+EFI_2_00_SYSTEM_TABLE_REVISION :: ((2 << 16) | (00))
+EFI_1_10_SYSTEM_TABLE_REVISION :: ((1 << 16) | (10))
+EFI_1_02_SYSTEM_TABLE_REVISION :: ((1 << 16) | (02))
+EFI_SPECIFICATION_VERSION :: EFI_SYSTEM_TABLE_REVISION
+EFI_SYSTEM_TABLE_REVISION :: EFI_2_100_SYSTEM_TABLE_REVISION
+
EfiSystemTable :: struct {
+ // The table header for the EFI System Table. This header contains the
+ // EFI_SYSTEM_TABLE_SIGNATURE and EFI_SYSTEM_TABLE_REVISION values along with
+ // the size of the EFI_SYSTEM_TABLE structure and a 32-bit CRC to verify that
+ // the contents of the EFI System Table are valid.
header: EfiTableHeader,
+ // A pointer to a null terminated string that identifies the vendor that
+ // produces the system firmware for the platform.
firmware_vendor: [^]u16,
- firmware_version: u32,
- console_in_handle: rawptr,
+ // A firmware vendor specific value that identifies the revision of the
+ // system firmware for the platform.
+ firmware_revision: u32,
+ // The handle for the active console input device. This handle must support
+ // EFI_SIMPLE_TEXT_INPUT_PROTOCOL and EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL. If
+ // there is no active console, these protocols must still be present.
+ console_in_handle: EfiHandle,
+ // A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL interface that is
+ // associated with ConsoleInHandle.
console_in: ^EfiSimpleTextInputProtocol,
- console_out_handle: rawptr,
+ // The handle for the active console output device. This handle must support
+ // the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.
+ //
+ // If there is no active console, this protocol must still be present.
+ console_out_handle: EfiHandle,
+ // A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface that is
+ // associated with ConsoleOutHandle.
console_out: ^EfiSimpleTextOutputProtocol,
- console_err_handle: rawptr,
+ // The handle for the active standard error console device. This handle must
+ // support the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL. If there is no active
+ // console, this protocol must still be present.
+ console_err_handle: EfiHandle,
+ // A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface that is
+ // associated with StandardErrorHandle.
console_err: ^EfiSimpleTextOutputProtocol,
+ // A pointer to the EFI Runtime Services Table.
runtime_services: ^EfiRuntimeServices,
+ // A pointer to the EFI Boot Services Table.
boot_services: ^EfiBootServices,
+ // The number of system configuration tables in the buffer
+ // ConfigurationTable.
number_of_table_entries: uint,
+ // A pointer to the system configuration tables. The number of entries in the
+ // table is NumberOfTableEntries.
configuration_table: ^EfiConfigurationTable,
}