summaryrefslogtreecommitdiff
path: root/lib/uefi.c3l/src/def.c3i
diff options
context:
space:
mode:
Diffstat (limited to 'lib/uefi.c3l/src/def.c3i')
-rw-r--r--lib/uefi.c3l/src/def.c3i221
1 files changed, 0 insertions, 221 deletions
diff --git a/lib/uefi.c3l/src/def.c3i b/lib/uefi.c3l/src/def.c3i
deleted file mode 100644
index 769f15e..0000000
--- a/lib/uefi.c3l/src/def.c3i
+++ /dev/null
@@ -1,221 +0,0 @@
-module uefi;
-
-
-/** EFI_HANDLE alias (sec x.x.x of the UEFI 2.11 specification). */
-typedef EfiHandle = void*;
-
-/** All UEFI strings are wchar_t strings (Wide-Char types). */
-alias EfiString = ushort[];
-alias EfiStringRaw = ushort*;
-
-/** ... But ASCII strings can also be used and dynamically converted to wide ones. */
-alias AsciiString = char[];
-alias AsciiStringRaw = char*;
-
-/** EFI_EVENT alias (sec 7.1.1 of the UEFI 2.11 specification). */
-typedef EfiEvent = void*;
-
-
-/** EFI_TABLE_HEADER structure (sec 4.2.1 of the UEFI 2.11 specification).
- * The same section contains the following constant expressions
- * as well as the EFI_SYSTEM_TABLE structure. */
-struct EfiTableHeader @packed
-{
- ulong signature;
- uint revision;
- uint header_size;
- uint crc32;
- uint _reserved;
-}
-
-const ulong EFI_SYSTEM_TABLE_SIGNATURE = 0x5453595320494249;
-const uint EFI_2_100_SYSTEM_TABLE_REVISION = ((2 << 16) | (100));
-const uint EFI_2_90_SYSTEM_TABLE_REVISION = ((2 << 16) | (90));
-const uint EFI_2_80_SYSTEM_TABLE_REVISION = ((2 << 16) | (80));
-const uint EFI_2_70_SYSTEM_TABLE_REVISION = ((2 << 16) | (70));
-const uint EFI_2_60_SYSTEM_TABLE_REVISION = ((2 << 16) | (60));
-const uint EFI_2_50_SYSTEM_TABLE_REVISION = ((2 << 16) | (50));
-const uint EFI_2_40_SYSTEM_TABLE_REVISION = ((2 << 16) | (40));
-const uint EFI_2_31_SYSTEM_TABLE_REVISION = ((2 << 16) | (31));
-const uint EFI_2_30_SYSTEM_TABLE_REVISION = ((2 << 16) | (30));
-const uint EFI_2_20_SYSTEM_TABLE_REVISION = ((2 << 16) | (20));
-const uint EFI_2_10_SYSTEM_TABLE_REVISION = ((2 << 16) | (10));
-const uint EFI_2_00_SYSTEM_TABLE_REVISION = ((2 << 16) | (00));
-const uint EFI_1_10_SYSTEM_TABLE_REVISION = ((1 << 16) | (10));
-const uint EFI_1_02_SYSTEM_TABLE_REVISION = ((1 << 16) | (02));
-const uint EFI_SYSTEM_TABLE_REVISION = EFI_2_100_SYSTEM_TABLE_REVISION;
-const uint EFI_SPECIFICATION_VERSION = EFI_SYSTEM_TABLE_REVISION;
-
-/* NOTE: Do NOT pack this struct: firmware_revision being 32-bit causes misalignment */
-struct SystemTable
-{
- EfiTableHeader header;
- EfiStringRaw firmware_vendor;
- uint firmware_revision;
- EfiHandle conin_handle;
- SimpleTextInputProtocol* conin;
- EfiHandle conout_handle;
- SimpleTextOutputProtocol* conout;
- EfiHandle conerr_handle;
- SimpleTextOutputProtocol* conerr;
- RuntimeServices* runtime_services;
- BootServices* boot_services;
- usz num_entries;
- ConfigurationTable* configuration_table;
-}
-
-
-/** EFI_CONFIGURATION_TABLE structure (sec 4.6.1 of the UEFI 2.11 specification). */
-struct ConfigurationTable @packed
-{
- EfiGuid vendor_guid;
- void* vendor_table;
-}
-
-
-/* EFI_BOOT_SERVICES structure (4.4.1) */
-const ulong EFI_BOOT_SERVICES_SIGNATURE = 0x56524553544f4f42; // 'BOOTSERV' <- EightCC
-const uint EFI_BOOT_SERVICES_REVISION = EFI_SPECIFICATION_VERSION;
-
-struct BootServices @packed
-{
- EfiTableHeader header;
-
- /* Task priority services (uefi::proto::evt) */
- FnRaiseTpl raise_tpl;
- FnRestoreTpl restore_tpl;
-
- /* Memory services (uefi::proto::mem) */
- FnAllocatePages allocate_pages;
- FnFreePages free_pages;
- FnGetMemoryMap get_memory_map;
- FnAllocatePool allocate_pool;
- FnFreePool free_pool;
-
- /* Event and Timer services (uefi::proto::evt) */
- FnCreateEvent create_event;
- FnSetTimer set_timer;
- FnWaitForEvent wait_for_event;
- FnSignalEvent signal_event;
- FnCloseEvent close_event;
- FnCheckEvent check_event;
-
- /* Protocol Handler services (uefi::proto::handler) */
- FnInstallProtocolInterface install_protocol_interface;
- FnReinstallProtocolInterface reinstall_protocol_interface;
- FnUninstallProtocolInterface uninstall_protocol_interface;
- FnHandleProtocol handle_protocol;
- void* _reserved; /* alright then */
- FnRegisterProtocolNotify register_protocol_notify;
- FnLocateHandle locate_handle;
- FnLocateDevicePath locate_device_path;
- FnInstallConfigurationTable install_configuration_table;
-
- /* Image services (uefi::proto::image) */
- FnLoadImage load_image;
- FnStartImage start_image;
- FnExitImage exit_image;
- FnUnloadImage unload_image;
- FnExitBootServices exit_boot_services;
-
- /* Misc services (uefi::proto::misc_bs) */
- FnGetNextMonotonicCount get_next_monotonic_count;
- FnStall stall;
- FnSetWatchdogTimer set_watchdog_timer;
-
- /* Driver Support services (uefi::proto::handler) */
- FnConnectController connect_controller;
- FnDisconnectController disconnect_controller;
-
- /* Open/Close Protocol services (uefi::proto::handler) */
- FnOpenProtocol open_protocol;
- FnCloseProtocol close_protocol;
- FnOpenProtocolInformation open_protocol_information;
-
- /* Library services (uefi::proto::handler) */
- FnProtocolsPerHandle protocols_per_handle;
- FnLocateHandleBuffer locate_handle_buffer;
- FnLocateProtocol locate_protocol;
- FnInstallMultipleProtocolInterfaces install_multiple_protocol_interfaces;
- FnUninstallMultipleProtocolInterfaces uninstall_multiple_protocol_interfaces;
-
- /* 32-bit CRC services (uefi::proto::misc_bs) */
- FnCalculateCrc32 calculate_crc32;
-
- /* More misc/trailing services */
- FnCopyMem copy_mem;
- FnSetMem set_mem;
- FnCreateEventEx create_event_ex;
-}
-
-
-struct RuntimeServices @packed
-{
- EfiTableHeader header;
-
- /* Time services (uefi::proto::time) */
- FnGetTime get_time;
- FnSetTime set_time;
- FnGetWakeupTime get_wakeup_time;
- FnSetWakeupTime set_wakeup_time;
-
- /* Virtual Memory services (uefi::proto::mem) */
- FnSetVirtualAddressMap set_virtual_address_map;
- FnConvertPointer convert_pointer;
-
- /* Variable services (uefi::proto::variable) */
- FnGetVariable get_variable;
- FnGetNextVariableName get_next_variable_name;
- FnSetVariable set_variable;
-
- /* Miscellaneous and Capsule services (uefi::proto::misc_rt) */
- FnGetNextHighMonotonicCount get_next_high_monotonic_count;
- FnResetSystem reset_system;
- FnUpdateCapsule update_capsule;
- FnQueryCapsuleCapabilities query_capsule_capabilities;
- FnQueryVariableInfo query_variable_info;
-}
-
-
-/** EFI_GUID structure (sec x.x.x of the UEFI 2.11 specification). */
-struct EfiGuid @packed
-{
- uint data1;
- ushort data2;
- ushort data3;
- char[8] data4;
-}
-
-
-/** EFI_TIME structure (sec 8.3.1 of the UEFI 2.11 specification). */
-struct EfiTime @packed
-{
- ushort year;
- char month;
- char day;
- char hour;
- char minute;
- char second;
- char _pad1;
- uint nanosecond;
- short timezone;
- EfiDaylightFlags daylight;
- char _pad2;
-}
-
-bitstruct EfiDaylightFlags : char
-{
- bool adjust : 0;
- bool in_daylight : 1;
- char reserved : 2..7;
-}
-
-const short EFI_UNSPECIFIED_TIMEZONE = 0x07FF;
-
-/** EFI_TIME_CAPABILITIES (sec 8.3.1 of the UEFI 2.11 specification). */
-struct EfiTimeCapabilities @packed
-{
- uint resolution;
- uint accuracy;
- bool sets_to_zero;
-} \ No newline at end of file