Skip to content

Commit ee41a75

Browse files
committed
std.os.uefi.tables: ziggify boot and runtime services
1 parent fa86e09 commit ee41a75

File tree

3 files changed

+983
-66
lines changed

3 files changed

+983
-66
lines changed

lib/std/os/uefi.zig

+37
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,43 @@ pub var system_table: *tables.SystemTable = undefined;
2525
/// A handle to an event structure.
2626
pub const Event = *opaque {};
2727

28+
pub const EventType = packed struct(u32) {
29+
lo_context: u8 = 0,
30+
/// If an event of this type is not already in the signaled state, then
31+
/// the event’s NotificationFunction will be queued at the event’s NotifyTpl
32+
/// whenever the event is being waited on via EFI_BOOT_SERVICES.WaitForEvent()
33+
/// or EFI_BOOT_SERVICES.CheckEvent() .
34+
wait: bool = false,
35+
/// The event’s NotifyFunction is queued whenever the event is signaled.
36+
signal: bool = false,
37+
hi_context: u20 = 0,
38+
/// The event is allocated from runtime memory. If an event is to be signaled
39+
/// after the call to EFI_BOOT_SERVICES.ExitBootServices() the event’s data
40+
/// structure and notification function need to be allocated from runtime
41+
/// memory.
42+
runtime: bool = false,
43+
timer: bool = false,
44+
45+
/// This event should not be combined with any other event types. This event
46+
/// type is functionally equivalent to the EFI_EVENT_GROUP_EXIT_BOOT_SERVICES
47+
/// event group.
48+
pub const signal_exit_boot_services = Type{
49+
.signal = true,
50+
.lo_context = 1,
51+
};
52+
53+
/// The event is to be notified by the system when SetVirtualAddressMap()
54+
/// is performed. This event type is a composite of EVT_NOTIFY_SIGNAL,
55+
/// EVT_RUNTIME, and EVT_RUNTIME_CONTEXT and should not be combined with
56+
/// any other event types.
57+
pub const signal_virtual_address_change = Type{
58+
.runtime = true,
59+
.hi_context = 0x20000,
60+
.signal = true,
61+
.lo_context = 2,
62+
};
63+
};
64+
2865
/// The calling convention used for all external functions part of the UEFI API.
2966
pub const cc: std.builtin.CallingConvention = switch (@import("builtin").target.cpu.arch) {
3067
.x86_64 => .{ .x86_64_win = .{} },

lib/std/os/uefi/tables.zig

+9-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ pub const TableHeader = @import("tables/table_header.zig").TableHeader;
77
pub const EventNotify = *const fn (event: Event, ctx: *anyopaque) callconv(cc) void;
88

99
pub const TimerDelay = enum(u32) {
10-
timer_cancel,
11-
timer_periodic,
12-
timer_relative,
10+
cancel,
11+
periodic,
12+
relative,
1313
};
1414

1515
pub const MemoryType = enum(u32) {
@@ -65,6 +65,12 @@ pub const LocateSearchType = enum(u32) {
6565
by_protocol,
6666
};
6767

68+
pub const LocateSearch = union(LocateSearchType) {
69+
all_handles,
70+
by_register_notify: *anyopaque,
71+
by_protocol: *align(8) const Guid,
72+
};
73+
6874
pub const OpenProtocolAttributes = packed struct(u32) {
6975
by_handle_protocol: bool = false,
7076
get_protocol: bool = false,

0 commit comments

Comments
 (0)