authorgravatar for n@nirf.deNick Erdmann <n@nirf.de> 2019-08-10 00:32:43+02:00
committergravatar for n@nirf.deNick Erdmann <n@nirf.de> 2019-08-10 19:14:47+02:00
log47ce736abec2d97c70eed619b5a6a58edeb4816a
tree4cc918bfe2412ca8cea57bc32b026a2ba5ce5bed
parent9445b3f057bdeb57cdb02c86b94145ae9a345531
signature Commit is signed but in an unrecognized format.

std/os/uefi: add basic Event support


6 files changed, 27 insertions(+), 7 deletions(-)

std/os/uefi.zig+1-1
......@@ -8,7 +8,7 @@ pub const is_the_target = builtin.os == .uefi;
88pub var handle: Handle = undefined;
99pub var system_table: *tables.SystemTable = undefined;
1010
11pub const Event = @OpaqueType();
11pub const Event = *@OpaqueType();
1212// GUIDs must be align(8)
1313pub const Guid = extern struct {
1414 time_low: u32,
std/os/uefi/protocols/absolute_pointer_protocol.zig+1-1
......@@ -6,7 +6,7 @@ const Guid = uefi.Guid;
66pub const AbsolutePointerProtocol = extern struct {
77 _reset: extern fn (*const AbsolutePointerProtocol, bool) usize,
88 _get_state: extern fn (*const AbsolutePointerProtocol, *AbsolutePointerState) usize,
9 wait_for_input: *Event,
9 wait_for_input: Event,
1010 mode: *AbsolutePointerMode,
1111
1212 pub fn reset(self: *const AbsolutePointerProtocol, verify: bool) usize {
std/os/uefi/protocols/simple_pointer_protocol.zig+1-1
......@@ -6,7 +6,7 @@ const Guid = uefi.Guid;
66pub const SimplePointerProtocol = struct {
77 _reset: extern fn (*const SimplePointerProtocol, bool) usize,
88 _get_state: extern fn (*const SimplePointerProtocol, *SimplePointerState) usize,
9 wait_for_input: *Event,
9 wait_for_input: Event,
1010 mode: *SimplePointerMode,
1111
1212 pub fn reset(self: *const SimplePointerProtocol, verify: bool) usize {
std/os/uefi/protocols/simple_text_input_ex_protocol.zig+1-1
......@@ -6,7 +6,7 @@ const Guid = uefi.Guid;
66pub const SimpleTextInputExProtocol = extern struct {
77 _reset: extern fn (*const SimpleTextInputExProtocol, bool) usize,
88 _read_key_stroke_ex: extern fn (*const SimpleTextInputExProtocol, *KeyData) usize,
9 wait_for_key_ex: *Event,
9 wait_for_key_ex: Event,
1010 _set_state: extern fn (*const SimpleTextInputExProtocol, *const u8) usize,
1111 _register_key_notify: extern fn (*const SimpleTextInputExProtocol, *const KeyData, extern fn (*const KeyData) usize, **c_void) usize,
1212 _unregister_key_notify: extern fn (*const SimpleTextInputExProtocol, *const c_void) usize,
std/os/uefi/tables.zig+1
......@@ -4,3 +4,4 @@ pub const ResetType = @import("tables/runtime_services.zig").ResetType;
44pub const RuntimeServices = @import("tables/runtime_services.zig").RuntimeServices;
55pub const SystemTable = @import("tables/system_table.zig").SystemTable;
66pub const TableHeader = @import("tables/table_header.zig").TableHeader;
7pub const TimerDelay = @import("tables/boot_services.zig").TimerDelay;
std/os/uefi/tables/boot_services.zig+22-3
......@@ -1,4 +1,5 @@
11const uefi = @import("std").os.uefi;
2const Event = uefi.Event;
23const Guid = uefi.Guid;
34const Handle = uefi.Handle;
45const TableHeader = uefi.tables.TableHeader;
......@@ -22,10 +23,10 @@ pub const BootServices = extern struct {
2223 getMemoryMap: usize, // TODO
2324 allocatePool: usize, // TODO
2425 freePool: usize, // TODO
25 createEvent: usize, // TODO
26 setTimer: usize, // TODO
26 createEvent: extern fn (u32, usize, ?extern fn (Event, ?*const c_void) void, ?*const c_void, *Event) usize,
27 setTimer: extern fn (Event, TimerDelay, u64) usize,
2728 waitForEvent: usize, // TODO
28 signalEvent: usize, // TODO
29 signalEvent: extern fn (Event) usize,
2930 closeEvent: usize, // TODO
3031 checkEvent: usize, // TODO
3132 installProtocolInterface: usize, // TODO
......@@ -61,4 +62,22 @@ pub const BootServices = extern struct {
6162 createEventEx: usize, // TODO
6263
6364 pub const signature: u64 = 0x56524553544f4f42;
65
66 pub const event_timer: u32 = 0x80000000;
67 pub const event_runtime: u32 = 0x40000000;
68 pub const event_notify_wait: u32 = 0x00000100;
69 pub const event_notify_signal: u32 = 0x00000200;
70 pub const event_signal_exit_boot_services: u32 = 0x00000201;
71 pub const event_signal_virtual_address_change: u32 = 0x00000202;
72
73 pub const tpl_application: usize = 4;
74 pub const tpl_callback: usize = 8;
75 pub const tpl_notify: usize = 16;
76 pub const tpl_high_level: usize = 31;
77};
78
79pub const TimerDelay = extern enum(u32) {
80 TimerCancel,
81 TimerPeriodic,
82 TimerRelative,
6483};