authorgravatar for n@nirf.deNick Erdmann <n@nirf.de> 2020-03-10 00:56:47+01:00
committergravatar for n@nirf.deNick Erdmann <n@nirf.de> 2020-03-12 23:23:12+01:00
log92beb13914a680f4b41fe459ab095684076daa07
treeffe72c388f6ab704d6f3660cae3b54325d10378d
parent6c368b9e7310af0b994e736e5bd5aee4a5723c95

std/os/uefi: status reform


27 files changed, 372 insertions(+), 332 deletions(-)

lib/std/os.zig+2-2
......@@ -273,10 +273,10 @@ pub fn exit(status: u8) noreturn {
273273 // exit() is only avaliable if exitBootServices() has not been called yet.
274274 // This call to exit should not fail, so we don't care about its return value.
275275 if (uefi.system_table.boot_services) |bs| {
276 _ = bs.exit(uefi.handle, status, 0, null);
276 _ = bs.exit(uefi.handle, @intToEnum(uefi.Status, status), 0, null);
277277 }
278278 // If we can't exit, reboot the system instead.
279 uefi.system_table.runtime_services.resetSystem(uefi.tables.ResetType.ResetCold, status, 0, null);
279 uefi.system_table.runtime_services.resetSystem(uefi.tables.ResetType.ResetCold, @intToEnum(uefi.Status, status), 0, null);
280280 }
281281 system.exit(status);
282282}
lib/std/os/uefi.zig+1-1
......@@ -2,7 +2,7 @@
22pub const protocols = @import("uefi/protocols.zig");
33
44/// Status codes returned by EFI interfaces
5pub const status = @import("uefi/status.zig");
5pub const Status = @import("uefi/status.zig").Status;
66pub const tables = @import("uefi/tables.zig");
77
88const fmt = @import("std").fmt;
lib/std/os/uefi/protocols/absolute_pointer_protocol.zig+5-4
......@@ -1,21 +1,22 @@
11const uefi = @import("std").os.uefi;
22const Event = uefi.Event;
33const Guid = uefi.Guid;
4const Status = uefi.Status;
45
56/// Protocol for touchscreens
67pub const AbsolutePointerProtocol = extern struct {
7 _reset: extern fn (*const AbsolutePointerProtocol, bool) usize,
8 _get_state: extern fn (*const AbsolutePointerProtocol, *AbsolutePointerState) usize,
8 _reset: extern fn (*const AbsolutePointerProtocol, bool) Status,
9 _get_state: extern fn (*const AbsolutePointerProtocol, *AbsolutePointerState) Status,
910 wait_for_input: Event,
1011 mode: *AbsolutePointerMode,
1112
1213 /// Resets the pointer device hardware.
13 pub fn reset(self: *const AbsolutePointerProtocol, verify: bool) usize {
14 pub fn reset(self: *const AbsolutePointerProtocol, verify: bool) Status {
1415 return self._reset(self, verify);
1516 }
1617
1718 /// Retrieves the current state of a pointer device.
18 pub fn getState(self: *const AbsolutePointerProtocol, state: *AbsolutePointerState) usize {
19 pub fn getState(self: *const AbsolutePointerProtocol, state: *AbsolutePointerState) Status {
1920 return self._get_state(self, state);
2021 }
2122
lib/std/os/uefi/protocols/edid_override_protocol.zig+3-2
......@@ -1,14 +1,15 @@
11const uefi = @import("std").os.uefi;
22const Guid = uefi.Guid;
33const Handle = uefi.Handle;
4const Status = uefi.Status;
45
56/// Override EDID information
67pub const EdidOverrideProtocol = extern struct {
7 _get_edid: extern fn (*const EdidOverrideProtocol, Handle, *u32, *usize, *?[*]u8) usize,
8 _get_edid: extern fn (*const EdidOverrideProtocol, Handle, *u32, *usize, *?[*]u8) Status,
89
910 /// Returns policy information and potentially a replacement EDID for the specified video output device.
1011 /// attributes must be align(4)
11 pub fn getEdid(self: *const EdidOverrideProtocol, handle: Handle, attributes: *EdidOverrideProtocolAttributes, edid_size: *usize, edid: *?[*]u8) usize {
12 pub fn getEdid(self: *const EdidOverrideProtocol, handle: Handle, attributes: *EdidOverrideProtocolAttributes, edid_size: *usize, edid: *?[*]u8) Status {
1213 return self._get_edid(self, handle, attributes, edid_size, edid);
1314 }
1415
lib/std/os/uefi/protocols/file_protocol.zig+17-16
......@@ -1,47 +1,48 @@
11const uefi = @import("std").os.uefi;
22const Guid = uefi.Guid;
33const Time = uefi.Time;
4const Status = uefi.Status;
45
56pub const FileProtocol = extern struct {
67 revision: u64,
7 _open: extern fn (*const FileProtocol, **const FileProtocol, *u16, u64, u64) usize,
8 _close: extern fn (*const FileProtocol) usize,
9 _delete: extern fn (*const FileProtocol) usize,
10 _read: extern fn (*const FileProtocol, *usize, *c_void) usize,
11 _write: extern fn (*const FileProtocol, *usize, *c_void) usize,
12 _get_info: extern fn (*const FileProtocol, *Guid, *usize, *c_void) usize,
13 _set_info: extern fn (*const FileProtocol, *Guid, usize, *c_void) usize,
14 _flush: extern fn (*const FileProtocol) usize,
8 _open: extern fn (*const FileProtocol, **const FileProtocol, *u16, u64, u64) Status,
9 _close: extern fn (*const FileProtocol) Status,
10 _delete: extern fn (*const FileProtocol) Status,
11 _read: extern fn (*const FileProtocol, *usize, *c_void) Status,
12 _write: extern fn (*const FileProtocol, *usize, *c_void) Status,
13 _get_info: extern fn (*const FileProtocol, *Guid, *usize, *c_void) Status,
14 _set_info: extern fn (*const FileProtocol, *Guid, usize, *c_void) Status,
15 _flush: extern fn (*const FileProtocol) Status,
1516
16 pub fn open(self: *const FileProtocol, new_handle: **const FileProtocol, file_name: *u16, open_mode: u64, attributes: u64) usize {
17 pub fn open(self: *const FileProtocol, new_handle: **const FileProtocol, file_name: *u16, open_mode: u64, attributes: u64) Status {
1718 return self._open(self, new_handle, file_name, open_mode, attributes);
1819 }
1920
20 pub fn close(self: *const FileProtocol) usize {
21 pub fn close(self: *const FileProtocol) Status {
2122 return self._close(self);
2223 }
2324
24 pub fn delete(self: *const FileProtocol) usize {
25 pub fn delete(self: *const FileProtocol) Status {
2526 return self._delete(self);
2627 }
2728
28 pub fn read(self: *const FileProtocol, buffer_size: *usize, buffer: *c_void) usize {
29 pub fn read(self: *const FileProtocol, buffer_size: *usize, buffer: *c_void) Status {
2930 return self._read(self, buffer_size, buffer);
3031 }
3132
32 pub fn write(self: *const FileProtocol, buffer_size: *usize, buffer: *c_void) usize {
33 pub fn write(self: *const FileProtocol, buffer_size: *usize, buffer: *c_void) Status {
3334 return self._write(self, buffer_size, buffer);
3435 }
3536
36 pub fn get_info(self: *const FileProtocol, information_type: *Guid, buffer_size: *usize, buffer: *c_void) usize {
37 pub fn get_info(self: *const FileProtocol, information_type: *Guid, buffer_size: *usize, buffer: *c_void) Status {
3738 return self._get_info(self, information_type, buffer_size, buffer);
3839 }
3940
40 pub fn set_info(self: *const FileProtocol, information_type: *Guid, buffer_size: usize, buffer: *c_void) usize {
41 pub fn set_info(self: *const FileProtocol, information_type: *Guid, buffer_size: usize, buffer: *c_void) Status {
4142 return self._set_info(self, information_type, buffer_size, buffer);
4243 }
4344
44 pub fn flush(self: *const FileProtocol) usize {
45 pub fn flush(self: *const FileProtocol) Status {
4546 return self._flush(self);
4647 }
4748
lib/std/os/uefi/protocols/graphics_output_protocol.zig+7-6
......@@ -1,25 +1,26 @@
11const uefi = @import("std").os.uefi;
22const Guid = uefi.Guid;
3const Status = uefi.Status;
34
45/// Graphics output
56pub const GraphicsOutputProtocol = extern struct {
6 _query_mode: extern fn (*const GraphicsOutputProtocol, u32, *usize, **GraphicsOutputModeInformation) usize,
7 _set_mode: extern fn (*const GraphicsOutputProtocol, u32) usize,
8 _blt: extern fn (*const GraphicsOutputProtocol, ?[*]GraphicsOutputBltPixel, GraphicsOutputBltOperation, usize, usize, usize, usize, usize, usize, usize) usize,
7 _query_mode: extern fn (*const GraphicsOutputProtocol, u32, *usize, **GraphicsOutputModeInformation) Status,
8 _set_mode: extern fn (*const GraphicsOutputProtocol, u32) Status,
9 _blt: extern fn (*const GraphicsOutputProtocol, ?[*]GraphicsOutputBltPixel, GraphicsOutputBltOperation, usize, usize, usize, usize, usize, usize, usize) Status,
910 mode: *GraphicsOutputProtocolMode,
1011
1112 /// Returns information for an available graphics mode that the graphics device and the set of active video output devices supports.
12 pub fn queryMode(self: *const GraphicsOutputProtocol, mode: u32, size_of_info: *usize, info: **GraphicsOutputModeInformation) usize {
13 pub fn queryMode(self: *const GraphicsOutputProtocol, mode: u32, size_of_info: *usize, info: **GraphicsOutputModeInformation) Status {
1314 return self._query_mode(self, mode, size_of_info, info);
1415 }
1516
1617 /// Set the video device into the specified mode and clears the visible portions of the output display to black.
17 pub fn setMode(self: *const GraphicsOutputProtocol, mode: u32) usize {
18 pub fn setMode(self: *const GraphicsOutputProtocol, mode: u32) Status {
1819 return self._set_mode(self, mode);
1920 }
2021
2122 /// Blt a rectangle of pixels on the graphics screen. Blt stands for BLock Transfer.
22 pub fn blt(self: *const GraphicsOutputProtocol, blt_buffer: ?[*]GraphicsOutputBltPixel, blt_operation: GraphicsOutputBltOperation, source_x: usize, source_y: usize, destination_x: usize, destination_y: usize, width: usize, height: usize, delta: usize) usize {
23 pub fn blt(self: *const GraphicsOutputProtocol, blt_buffer: ?[*]GraphicsOutputBltPixel, blt_operation: GraphicsOutputBltOperation, source_x: usize, source_y: usize, destination_x: usize, destination_y: usize, width: usize, height: usize, delta: usize) Status {
2324 return self._blt(self, blt_buffer, blt_operation, source_x, source_y, destination_x, destination_y, width, height, delta);
2425 }
2526
lib/std/os/uefi/protocols/hii_database_protocol.zig+16-15
......@@ -1,38 +1,39 @@
11const uefi = @import("std").os.uefi;
22const Guid = uefi.Guid;
3const Status = uefi.Status;
34const hii = uefi.protocols.hii;
45
56/// Database manager for HII-related data structures.
67pub const HIIDatabaseProtocol = extern struct {
7 _new_package_list: usize, // TODO
8 _remove_package_list: extern fn (*const HIIDatabaseProtocol, hii.HIIHandle) usize,
9 _update_package_list: extern fn (*const HIIDatabaseProtocol, hii.HIIHandle, *const hii.HIIPackageList) usize,
10 _list_package_lists: extern fn (*const HIIDatabaseProtocol, u8, ?*const Guid, *usize, [*]hii.HIIHandle) usize,
11 _export_package_lists: extern fn (*const HIIDatabaseProtocol, ?hii.HIIHandle, *usize, *hii.HIIPackageList) usize,
12 _register_package_notify: usize, // TODO
13 _unregister_package_notify: usize, // TODO
14 _find_keyboard_layouts: usize, // TODO
15 _get_keyboard_layout: usize, // TODO
16 _set_keyboard_layout: usize, // TODO
17 _get_package_list_handle: usize, // TODO
8 _new_package_list: Status, // TODO
9 _remove_package_list: extern fn (*const HIIDatabaseProtocol, hii.HIIHandle) Status,
10 _update_package_list: extern fn (*const HIIDatabaseProtocol, hii.HIIHandle, *const hii.HIIPackageList) Status,
11 _list_package_lists: extern fn (*const HIIDatabaseProtocol, u8, ?*const Guid, *usize, [*]hii.HIIHandle) Status,
12 _export_package_lists: extern fn (*const HIIDatabaseProtocol, ?hii.HIIHandle, *usize, *hii.HIIPackageList) Status,
13 _register_package_notify: Status, // TODO
14 _unregister_package_notify: Status, // TODO
15 _find_keyboard_layouts: Status, // TODO
16 _get_keyboard_layout: Status, // TODO
17 _set_keyboard_layout: Status, // TODO
18 _get_package_list_handle: Status, // TODO
1819
1920 /// Removes a package list from the HII database.
20 pub fn removePackageList(self: *const HIIDatabaseProtocol, handle: hii.HIIHandle) usize {
21 pub fn removePackageList(self: *const HIIDatabaseProtocol, handle: hii.HIIHandle) Status {
2122 return self._remove_package_list(self, handle);
2223 }
2324
2425 /// Update a package list in the HII database.
25 pub fn updatePackageList(self: *const HIIDatabaseProtocol, handle: hii.HIIHandle, buffer: *const hii.HIIPackageList) usize {
26 pub fn updatePackageList(self: *const HIIDatabaseProtocol, handle: hii.HIIHandle, buffer: *const hii.HIIPackageList) Status {
2627 return self._update_package_list(self, handle, buffer);
2728 }
2829
2930 /// Determines the handles that are currently active in the database.
30 pub fn listPackageLists(self: *const HIIDatabaseProtocol, package_type: u8, package_guid: ?*const Guid, buffer_length: *usize, handles: [*]hii.HIIHandle) usize {
31 pub fn listPackageLists(self: *const HIIDatabaseProtocol, package_type: u8, package_guid: ?*const Guid, buffer_length: *usize, handles: [*]hii.HIIHandle) Status {
3132 return self._list_package_lists(self, package_type, package_guid, buffer_length, handles);
3233 }
3334
3435 /// Exports the contents of one or all package lists in the HII database into a buffer.
35 pub fn exportPackageLists(self: *const HIIDatabaseProtocol, handle: ?hii.HIIHandle, buffer_size: *usize, buffer: *hii.HIIPackageList) usize {
36 pub fn exportPackageLists(self: *const HIIDatabaseProtocol, handle: ?hii.HIIHandle, buffer_size: *usize, buffer: *hii.HIIPackageList) Status {
3637 return self._export_package_lists(self, handle, buffer_size, buffer);
3738 }
3839
lib/std/os/uefi/protocols/hii_popup_protocol.zig+3-2
......@@ -1,14 +1,15 @@
11const uefi = @import("std").os.uefi;
22const Guid = uefi.Guid;
3const Status = uefi.Status;
34const hii = uefi.protocols.hii;
45
56/// Display a popup window
67pub const HIIPopupProtocol = extern struct {
78 revision: u64,
8 _create_popup: extern fn (*const HIIPopupProtocol, HIIPopupStyle, HIIPopupType, hii.HIIHandle, u16, ?*HIIPopupSelection) usize,
9 _create_popup: extern fn (*const HIIPopupProtocol, HIIPopupStyle, HIIPopupType, hii.HIIHandle, u16, ?*HIIPopupSelection) Status,
910
1011 /// Displays a popup window.
11 pub fn createPopup(self: *const HIIPopupProtocol, style: HIIPopupStyle, popup_type: HIIPopupType, handle: hii.HIIHandle, msg: u16, user_selection: ?*HIIPopupSelection) usize {
12 pub fn createPopup(self: *const HIIPopupProtocol, style: HIIPopupStyle, popup_type: HIIPopupType, handle: hii.HIIHandle, msg: u16, user_selection: ?*HIIPopupSelection) Status {
1213 return self._create_popup(self, style, popup_type, handle, msg, user_selection);
1314 }
1415
lib/std/os/uefi/protocols/ip6_config_protocol.zig+9-8
......@@ -1,26 +1,27 @@
11const uefi = @import("std").os.uefi;
22const Guid = uefi.Guid;
33const Event = uefi.Event;
4const Status = uefi.Status;
45
56pub const Ip6ConfigProtocol = extern struct {
6 _set_data: extern fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, usize, *const c_void) usize,
7 _get_data: extern fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, *usize, ?*const c_void) usize,
8 _register_data_notify: extern fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) usize,
9 _unregister_data_notify: extern fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) usize,
7 _set_data: extern fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, usize, *const c_void) Status,
8 _get_data: extern fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, *usize, ?*const c_void) Status,
9 _register_data_notify: extern fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) Status,
10 _unregister_data_notify: extern fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) Status,
1011
11 pub fn setData(self: *const Ip6ConfigProtocol, data_type: Ip6ConfigDataType, data_size: usize, data: *const c_void) usize {
12 pub fn setData(self: *const Ip6ConfigProtocol, data_type: Ip6ConfigDataType, data_size: usize, data: *const c_void) Status {
1213 return self._set_data(self, data_type, data_size, data);
1314 }
1415
15 pub fn getData(self: *const Ip6ConfigProtocol, data_type: Ip6ConfigDataType, data_size: *usize, data: ?*const c_void) usize {
16 pub fn getData(self: *const Ip6ConfigProtocol, data_type: Ip6ConfigDataType, data_size: *usize, data: ?*const c_void) Status {
1617 return self._get_data(self, data_type, data_size, data);
1718 }
1819
19 pub fn registerDataNotify(self: *const Ip6ConfigProtocol, data_type: Ip6ConfigDataType, event: Event) usize {
20 pub fn registerDataNotify(self: *const Ip6ConfigProtocol, data_type: Ip6ConfigDataType, event: Event) Status {
2021 return self._register_data_notify(self, data_type, event);
2122 }
2223
23 pub fn unregisterDataNotify(self: *const Ip6ConfigProtocol, data_type: Ip6ConfigDataType, event: Event) usize {
24 pub fn unregisterDataNotify(self: *const Ip6ConfigProtocol, data_type: Ip6ConfigDataType, event: Event) Status {
2425 return self._unregister_data_notify(self, data_type, event);
2526 }
2627
lib/std/os/uefi/protocols/ip6_protocol.zig+20-19
......@@ -1,63 +1,64 @@
11const uefi = @import("std").os.uefi;
22const Guid = uefi.Guid;
33const Event = uefi.Event;
4const Status = uefi.Status;
45const MacAddress = uefi.protocols.MacAddress;
56const ManagedNetworkConfigData = uefi.protocols.ManagedNetworkConfigData;
67const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode;
78
89pub const Ip6Protocol = extern struct {
9 _get_mode_data: extern fn (*const Ip6Protocol, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) usize,
10 _configure: extern fn (*const Ip6Protocol, ?*const Ip6ConfigData) usize,
11 _groups: extern fn (*const Ip6Protocol, bool, ?*const Ip6Address) usize,
12 _routes: extern fn (*const Ip6Protocol, bool, ?*const Ip6Address, u8, ?*const Ip6Address) usize,
13 _neighbors: extern fn (*const Ip6Protocol, bool, *const Ip6Address, ?*const MacAddress, u32, bool) usize,
14 _transmit: extern fn (*const Ip6Protocol, *Ip6CompletionToken) usize,
15 _receive: extern fn (*const Ip6Protocol, *Ip6CompletionToken) usize,
16 _cancel: extern fn (*const Ip6Protocol, ?*Ip6CompletionToken) usize,
17 _poll: extern fn (*const Ip6Protocol) usize,
10 _get_mode_data: extern fn (*const Ip6Protocol, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) Status,
11 _configure: extern fn (*const Ip6Protocol, ?*const Ip6ConfigData) Status,
12 _groups: extern fn (*const Ip6Protocol, bool, ?*const Ip6Address) Status,
13 _routes: extern fn (*const Ip6Protocol, bool, ?*const Ip6Address, u8, ?*const Ip6Address) Status,
14 _neighbors: extern fn (*const Ip6Protocol, bool, *const Ip6Address, ?*const MacAddress, u32, bool) Status,
15 _transmit: extern fn (*const Ip6Protocol, *Ip6CompletionToken) Status,
16 _receive: extern fn (*const Ip6Protocol, *Ip6CompletionToken) Status,
17 _cancel: extern fn (*const Ip6Protocol, ?*Ip6CompletionToken) Status,
18 _poll: extern fn (*const Ip6Protocol) Status,
1819
1920 /// Gets the current operational settings for this instance of the EFI IPv6 Protocol driver.
20 pub fn getModeData(self: *const Ip6Protocol, ip6_mode_data: ?*Ip6ModeData, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) usize {
21 pub fn getModeData(self: *const Ip6Protocol, ip6_mode_data: ?*Ip6ModeData, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) Status {
2122 return self._get_mode_data(self, ip6_mode_data, mnp_config_data, snp_mode_data);
2223 }
2324
2425 /// Assign IPv6 address and other configuration parameter to this EFI IPv6 Protocol driver instance.
25 pub fn configure(self: *const Ip6Protocol, ip6_config_data: ?*const Ip6ConfigData) usize {
26 pub fn configure(self: *const Ip6Protocol, ip6_config_data: ?*const Ip6ConfigData) Status {
2627 return self._configure(self, ip6_config_data);
2728 }
2829
2930 /// Joins and leaves multicast groups.
30 pub fn groups(self: *const Ip6Protocol, join_flag: bool, group_address: ?*const Ip6Address) usize {
31 pub fn groups(self: *const Ip6Protocol, join_flag: bool, group_address: ?*const Ip6Address) Status {
3132 return self._groups(self, join_flag, group_address);
3233 }
3334
3435 /// Adds and deletes routing table entries.
35 pub fn routes(self: *const Ip6Protocol, delete_route: bool, destination: ?*const Ip6Address, prefix_length: u8, gateway_address: ?*const Ip6Address) usize {
36 pub fn routes(self: *const Ip6Protocol, delete_route: bool, destination: ?*const Ip6Address, prefix_length: u8, gateway_address: ?*const Ip6Address) Status {
3637 return self._routes(self, delete_route, destination, prefix_length, gateway_address);
3738 }
3839
3940 /// Add or delete Neighbor cache entries.
40 pub fn neighbors(self: *const Ip6Protocol, delete_flag: bool, target_ip6_address: *const Ip6Address, target_link_address: ?*const MacAddress, timeout: u32, override: bool) usize {
41 pub fn neighbors(self: *const Ip6Protocol, delete_flag: bool, target_ip6_address: *const Ip6Address, target_link_address: ?*const MacAddress, timeout: u32, override: bool) Status {
4142 return self._neighbors(self, delete_flag, target_ip6_address, target_link_address, timeout, override);
4243 }
4344
4445 /// Places outgoing data packets into the transmit queue.
45 pub fn transmit(self: *const Ip6Protocol, token: *Ip6CompletionToken) usize {
46 pub fn transmit(self: *const Ip6Protocol, token: *Ip6CompletionToken) Status {
4647 return self._transmit(self, token);
4748 }
4849
4950 /// Places a receiving request into the receiving queue.
50 pub fn receive(self: *const Ip6Protocol, token: *Ip6CompletionToken) usize {
51 pub fn receive(self: *const Ip6Protocol, token: *Ip6CompletionToken) Status {
5152 return self._receive(self, token);
5253 }
5354
5455 /// Abort an asynchronous transmits or receive request.
55 pub fn cancel(self: *const Ip6Protocol, token: ?*Ip6CompletionToken) usize {
56 pub fn cancel(self: *const Ip6Protocol, token: ?*Ip6CompletionToken) Status {
5657 return self._cancel(self, token);
5758 }
5859
5960 /// Polls for incoming data packets and processes outgoing data packets.
60 pub fn poll(self: *const Ip6Protocol) usize {
61 pub fn poll(self: *const Ip6Protocol) Status {
6162 return self._poll(self);
6263 }
6364
......@@ -138,6 +139,6 @@ pub const Ip6IcmpType = extern struct {
138139
139140pub const Ip6CompletionToken = extern struct {
140141 event: Event,
141 status: usize,
142 status: Status,
142143 packet: *c_void, // union TODO
143144};
lib/std/os/uefi/protocols/ip6_service_binding_protocol.zig+5-4
......@@ -1,16 +1,17 @@
11const uefi = @import("std").os.uefi;
22const Handle = uefi.Handle;
33const Guid = uefi.Guid;
4const Status = uefi.Status;
45
56pub const Ip6ServiceBindingProtocol = extern struct {
6 _create_child: extern fn (*const Ip6ServiceBindingProtocol, *?Handle) usize,
7 _destroy_child: extern fn (*const Ip6ServiceBindingProtocol, Handle) usize,
7 _create_child: extern fn (*const Ip6ServiceBindingProtocol, *?Handle) Status,
8 _destroy_child: extern fn (*const Ip6ServiceBindingProtocol, Handle) Status,
89
9 pub fn createChild(self: *const Ip6ServiceBindingProtocol, handle: *?Handle) usize {
10 pub fn createChild(self: *const Ip6ServiceBindingProtocol, handle: *?Handle) Status {
1011 return self._create_child(self, handle);
1112 }
1213
13 pub fn destroyChild(self: *const Ip6ServiceBindingProtocol, handle: Handle) usize {
14 pub fn destroyChild(self: *const Ip6ServiceBindingProtocol, handle: Handle) Status {
1415 return self._destroy_child(self, handle);
1516 }
1617
lib/std/os/uefi/protocols/loaded_image_protocol.zig+3-2
......@@ -1,6 +1,7 @@
11const uefi = @import("std").os.uefi;
22const Guid = uefi.Guid;
33const Handle = uefi.Handle;
4const Status = uefi.Status;
45const SystemTable = uefi.tables.SystemTable;
56const MemoryType = uefi.tables.MemoryType;
67const DevicePathProtocol = uefi.protocols.DevicePathProtocol;
......@@ -18,10 +19,10 @@ pub const LoadedImageProtocol = extern struct {
1819 image_size: u64,
1920 image_code_type: MemoryType,
2021 image_data_type: MemoryType,
21 _unload: extern fn (*const LoadedImageProtocol, Handle) usize,
22 _unload: extern fn (*const LoadedImageProtocol, Handle) Status,
2223
2324 /// Unloads an image from memory.
24 pub fn unload(self: *const LoadedImageProtocol, handle: Handle) usize {
25 pub fn unload(self: *const LoadedImageProtocol, handle: Handle) Status {
2526 return self._unload(self, handle);
2627 }
2728
lib/std/os/uefi/protocols/managed_network_protocol.zig+17-16
......@@ -1,60 +1,61 @@
11const uefi = @import("std").os.uefi;
22const Guid = uefi.Guid;
33const Event = uefi.Event;
4const Status = uefi.Status;
45const Time = uefi.Time;
56const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode;
67const MacAddress = uefi.protocols.MacAddress;
78
89pub const ManagedNetworkProtocol = extern struct {
9 _get_mode_data: extern fn (*const ManagedNetworkProtocol, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) usize,
10 _configure: extern fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkConfigData) usize,
11 _mcast_ip_to_mac: extern fn (*const ManagedNetworkProtocol, bool, *const c_void, *MacAddress) usize,
12 _groups: extern fn (*const ManagedNetworkProtocol, bool, ?*const MacAddress) usize,
13 _transmit: extern fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) usize,
14 _receive: extern fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) usize,
15 _cancel: extern fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkCompletionToken) usize,
10 _get_mode_data: extern fn (*const ManagedNetworkProtocol, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) Status,
11 _configure: extern fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkConfigData) Status,
12 _mcast_ip_to_mac: extern fn (*const ManagedNetworkProtocol, bool, *const c_void, *MacAddress) Status,
13 _groups: extern fn (*const ManagedNetworkProtocol, bool, ?*const MacAddress) Status,
14 _transmit: extern fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) Status,
15 _receive: extern fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) Status,
16 _cancel: extern fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkCompletionToken) Status,
1617 _poll: extern fn (*const ManagedNetworkProtocol) usize,
1718
1819 /// Returns the operational parameters for the current MNP child driver.
1920 /// May also support returning the underlying SNP driver mode data.
20 pub fn getModeData(self: *const ManagedNetworkProtocol, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) usize {
21 pub fn getModeData(self: *const ManagedNetworkProtocol, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) Status {
2122 return self._get_mode_data(self, mnp_config_data, snp_mode_data);
2223 }
2324
2425 /// Sets or clears the operational parameters for the MNP child driver.
25 pub fn configure(self: *const ManagedNetworkProtocol, mnp_config_data: ?*const ManagedNetworkConfigData) usize {
26 pub fn configure(self: *const ManagedNetworkProtocol, mnp_config_data: ?*const ManagedNetworkConfigData) Status {
2627 return self._configure(self, mnp_config_data);
2728 }
2829
2930 /// Translates an IP multicast address to a hardware (MAC) multicast address.
3031 /// This function may be unsupported in some MNP implementations.
31 pub fn mcastIpToMac(self: *const ManagedNetworkProtocol, ipv6flag: bool, ipaddress: *const c_void, mac_address: *MacAddress) usize {
32 pub fn mcastIpToMac(self: *const ManagedNetworkProtocol, ipv6flag: bool, ipaddress: *const c_void, mac_address: *MacAddress) Status {
3233 return self._mcast_ip_to_mac(self, ipv6flag, ipaddress);
3334 }
3435
3536 /// Enables and disables receive filters for multicast address.
3637 /// This function may be unsupported in some MNP implementations.
37 pub fn groups(self: *const ManagedNetworkProtocol, join_flag: bool, mac_address: ?*const MacAddress) usiz {
38 pub fn groups(self: *const ManagedNetworkProtocol, join_flag: bool, mac_address: ?*const MacAddress) Status {
3839 return self._groups(self, join_flag, mac_address);
3940 }
4041
4142 /// Places asynchronous outgoing data packets into the transmit queue.
42 pub fn transmit(self: *const ManagedNetworkProtocol, token: *const ManagedNetworkCompletionToken) usize {
43 pub fn transmit(self: *const ManagedNetworkProtocol, token: *const ManagedNetworkCompletionToken) Status {
4344 return self._transmit(self, token);
4445 }
4546
4647 /// Places an asynchronous receiving request into the receiving queue.
47 pub fn receive(self: *const ManagedNetworkProtocol, token: *const ManagedNetworkCompletionToken) usize {
48 pub fn receive(self: *const ManagedNetworkProtocol, token: *const ManagedNetworkCompletionToken) Status {
4849 return self._receive(self, token);
4950 }
5051
5152 /// Aborts an asynchronous transmit or receive request.
52 pub fn cancel(self: *const ManagedNetworkProtocol, token: ?*const ManagedNetworkCompletionToken) usize {
53 pub fn cancel(self: *const ManagedNetworkProtocol, token: ?*const ManagedNetworkCompletionToken) Status {
5354 return self._cancel(self, token);
5455 }
5556
5657 /// Polls for incoming data packets and processes outgoing data packets.
57 pub fn poll(self: *const ManagedNetworkProtocol) usize {
58 pub fn poll(self: *const ManagedNetworkProtocol) Status {
5859 return self._poll(self);
5960 }
6061
......@@ -83,7 +84,7 @@ pub const ManagedNetworkConfigData = extern struct {
8384
8485pub const ManagedNetworkCompletionToken = extern struct {
8586 event: Event,
86 status: usize,
87 status: Status,
8788 packet: extern union {
8889 RxData: *ManagedNetworkReceiveData,
8990 TxData: *ManagedNetworkTransmitData,
lib/std/os/uefi/protocols/managed_network_service_binding_protocol.zig+5-4
......@@ -1,16 +1,17 @@
11const uefi = @import("std").os.uefi;
22const Handle = uefi.Handle;
33const Guid = uefi.Guid;
4const Status = uefi.Status;
45
56pub const ManagedNetworkServiceBindingProtocol = extern struct {
6 _create_child: extern fn (*const ManagedNetworkServiceBindingProtocol, *?Handle) usize,
7 _destroy_child: extern fn (*const ManagedNetworkServiceBindingProtocol, Handle) usize,
7 _create_child: extern fn (*const ManagedNetworkServiceBindingProtocol, *?Handle) Status,
8 _destroy_child: extern fn (*const ManagedNetworkServiceBindingProtocol, Handle) Status,
89
9 pub fn createChild(self: *const ManagedNetworkServiceBindingProtocol, handle: *?Handle) usize {
10 pub fn createChild(self: *const ManagedNetworkServiceBindingProtocol, handle: *?Handle) Status {
1011 return self._create_child(self, handle);
1112 }
1213
13 pub fn destroyChild(self: *const ManagedNetworkServiceBindingProtocol, handle: Handle) usize {
14 pub fn destroyChild(self: *const ManagedNetworkServiceBindingProtocol, handle: Handle) Status {
1415 return self._destroy_child(self, handle);
1516 }
1617
lib/std/os/uefi/protocols/rng_protocol.zig+5-4
......@@ -1,18 +1,19 @@
11const uefi = @import("std").os.uefi;
22const Guid = uefi.Guid;
3const Status = uefi.Status;
34
45/// Random Number Generator protocol
56pub const RNGProtocol = extern struct {
6 _get_info: extern fn (*const RNGProtocol, *usize, [*]align(8) Guid) usize,
7 _get_rng: extern fn (*const RNGProtocol, ?*align(8) const Guid, usize, [*]u8) usize,
7 _get_info: extern fn (*const RNGProtocol, *usize, [*]align(8) Guid) Status,
8 _get_rng: extern fn (*const RNGProtocol, ?*align(8) const Guid, usize, [*]u8) Status,
89
910 /// Returns information about the random number generation implementation.
10 pub fn getInfo(self: *const RNGProtocol, list_size: *usize, list: [*]align(8) Guid) usize {
11 pub fn getInfo(self: *const RNGProtocol, list_size: *usize, list: [*]align(8) Guid) Status {
1112 return self._get_info(self, list_size, list);
1213 }
1314
1415 /// Produces and returns an RNG value using either the default or specified RNG algorithm.
15 pub fn getRNG(self: *const RNGProtocol, algo: ?*align(8) const Guid, value_length: usize, value: [*]u8) usize {
16 pub fn getRNG(self: *const RNGProtocol, algo: ?*align(8) const Guid, value_length: usize, value: [*]u8) Status {
1617 return self._get_rng(self, algo, value_length, value);
1718 }
1819
lib/std/os/uefi/protocols/simple_file_system_protocol.zig+3-2
......@@ -1,12 +1,13 @@
11const uefi = @import("std").os.uefi;
22const Guid = uefi.Guid;
33const FileProtocol = uefi.protocols.FileProtocol;
4const Status = uefi.Status;
45
56const SimpleFileSystemProtocol = extern struct {
67 revision: u64,
7 _open_volume: extern fn (*const SimpleFileSystemProtocol, **const FileProtocol) usize,
8 _open_volume: extern fn (*const SimpleFileSystemProtocol, **const FileProtocol) Status,
89
9 pub fn openVolume(self: *const SimpleFileSystemProtocol, root: **const FileProtocol) usize {
10 pub fn openVolume(self: *const SimpleFileSystemProtocol, root: **const FileProtocol) Status {
1011 return self._open_volume(self, root);
1112 }
1213
lib/std/os/uefi/protocols/simple_network_protocol.zig+27-26
......@@ -1,87 +1,88 @@
11const uefi = @import("std").os.uefi;
22const Event = uefi.Event;
33const Guid = uefi.Guid;
4const Status = uefi.Status;
45
56pub const SimpleNetworkProtocol = extern struct {
67 revision: u64,
7 _start: extern fn (*const SimpleNetworkProtocol) usize,
8 _stop: extern fn (*const SimpleNetworkProtocol) usize,
9 _initialize: extern fn (*const SimpleNetworkProtocol, usize, usize) usize,
10 _reset: extern fn (*const SimpleNetworkProtocol, bool) usize,
11 _shutdown: extern fn (*const SimpleNetworkProtocol) usize,
12 _receive_filters: extern fn (*const SimpleNetworkProtocol, SimpleNetworkReceiveFilter, SimpleNetworkReceiveFilter, bool, usize, ?[*]const MacAddress) usize,
13 _station_address: extern fn (*const SimpleNetworkProtocol, bool, ?*const MacAddress) usize,
14 _statistics: extern fn (*const SimpleNetworkProtocol, bool, ?*usize, ?*NetworkStatistics) usize,
15 _mcast_ip_to_mac: extern fn (*const SimpleNetworkProtocol, bool, *const c_void, *MacAddress) usize,
16 _nvdata: extern fn (*const SimpleNetworkProtocol, bool, usize, usize, [*]u8) usize,
17 _get_status: extern fn (*const SimpleNetworkProtocol, *SimpleNetworkInterruptStatus, ?*?[*]u8) usize,
18 _transmit: extern fn (*const SimpleNetworkProtocol, usize, usize, [*]const u8, ?*const MacAddress, ?*const MacAddress, ?*const u16) usize,
19 _receive: extern fn (*const SimpleNetworkProtocol, ?*usize, *usize, [*]u8, ?*MacAddress, ?*MacAddress, ?*u16) usize,
8 _start: extern fn (*const SimpleNetworkProtocol) Status,
9 _stop: extern fn (*const SimpleNetworkProtocol) Status,
10 _initialize: extern fn (*const SimpleNetworkProtocol, usize, usize) Status,
11 _reset: extern fn (*const SimpleNetworkProtocol, bool) Status,
12 _shutdown: extern fn (*const SimpleNetworkProtocol) Status,
13 _receive_filters: extern fn (*const SimpleNetworkProtocol, SimpleNetworkReceiveFilter, SimpleNetworkReceiveFilter, bool, usize, ?[*]const MacAddress) Status,
14 _station_address: extern fn (*const SimpleNetworkProtocol, bool, ?*const MacAddress) Status,
15 _statistics: extern fn (*const SimpleNetworkProtocol, bool, ?*usize, ?*NetworkStatistics) Status,
16 _mcast_ip_to_mac: extern fn (*const SimpleNetworkProtocol, bool, *const c_void, *MacAddress) Status,
17 _nvdata: extern fn (*const SimpleNetworkProtocol, bool, usize, usize, [*]u8) Status,
18 _get_status: extern fn (*const SimpleNetworkProtocol, *SimpleNetworkInterruptStatus, ?*?[*]u8) Status,
19 _transmit: extern fn (*const SimpleNetworkProtocol, usize, usize, [*]const u8, ?*const MacAddress, ?*const MacAddress, ?*const u16) Status,
20 _receive: extern fn (*const SimpleNetworkProtocol, ?*usize, *usize, [*]u8, ?*MacAddress, ?*MacAddress, ?*u16) Status,
2021 wait_for_packet: Event,
2122 mode: *SimpleNetworkMode,
2223
2324 /// Changes the state of a network interface from "stopped" to "started".
24 pub fn start(self: *const SimpleNetworkProtocol) usize {
25 pub fn start(self: *const SimpleNetworkProtocol) Status {
2526 return self._start(self);
2627 }
2728
2829 /// Changes the state of a network interface from "started" to "stopped".
29 pub fn stop(self: *const SimpleNetworkProtocol) usize {
30 pub fn stop(self: *const SimpleNetworkProtocol) Status {
3031 return self._stop(self);
3132 }
3233
3334 /// Resets a network adapter and allocates the transmit and receive buffers required by the network interface.
34 pub fn initialize(self: *const SimpleNetworkProtocol, extra_rx_buffer_size: usize, extra_tx_buffer_size: usize) usize {
35 pub fn initialize(self: *const SimpleNetworkProtocol, extra_rx_buffer_size: usize, extra_tx_buffer_size: usize) Status {
3536 return self._initialize(self, extra_rx_buffer_size, extra_tx_buffer_size);
3637 }
3738
3839 /// Resets a network adapter and reinitializes it with the parameters that were provided in the previous call to initialize().
39 pub fn reset(self: *const SimpleNetworkProtocol, extended_verification: bool) usize {
40 pub fn reset(self: *const SimpleNetworkProtocol, extended_verification: bool) Status {
4041 return self._reset(self, extended_verification);
4142 }
4243
4344 /// Resets a network adapter and leaves it in a state that is safe for another driver to initialize.
44 pub fn shutdown(self: *const SimpleNetworkProtocol) usize {
45 pub fn shutdown(self: *const SimpleNetworkProtocol) Status {
4546 return self._shutdown(self);
4647 }
4748
4849 /// Manages the multicast receive filters of a network interface.
49 pub fn receiveFilters(self: *const SimpleNetworkProtocol, enable: SimpleNetworkReceiveFilter, disable: SimpleNetworkReceiveFilter, reset_mcast_filter: bool, mcast_filter_cnt: usize, mcast_filter: ?[*]const MacAddress) usize {
50 pub fn receiveFilters(self: *const SimpleNetworkProtocol, enable: SimpleNetworkReceiveFilter, disable: SimpleNetworkReceiveFilter, reset_mcast_filter: bool, mcast_filter_cnt: usize, mcast_filter: ?[*]const MacAddress) Status {
5051 return self._receive_filters(self, enable, disable, reset_mcast_filter, mcast_filter_cnt, mcast_filter);
5152 }
5253
5354 /// Modifies or resets the current station address, if supported.
54 pub fn stationAddress(self: *const SimpleNetworkProtocol, reset: bool, new: ?*const MacAddress) usize {
55 pub fn stationAddress(self: *const SimpleNetworkProtocol, reset: bool, new: ?*const MacAddress) Status {
5556 return self._station_address(self, reset, new);
5657 }
5758
5859 /// Resets or collects the statistics on a network interface.
59 pub fn statistics(self: *const SimpleNetworkProtocol, reset_: bool, statistics_size: ?*usize, statistics_table: ?*NetworkStatistics) usize {
60 pub fn statistics(self: *const SimpleNetworkProtocol, reset_: bool, statistics_size: ?*usize, statistics_table: ?*NetworkStatistics) Status {
6061 return self._statistics(self, reset_, statistics_size, statistics_table);
6162 }
6263
6364 /// Converts a multicast IP address to a multicast HW MAC address.
64 pub fn mcastIpToMac(self: *const SimpleNetworkProtocol, ipv6: bool, ip: *const c_void, mac: *MacAddress) usize {
65 pub fn mcastIpToMac(self: *const SimpleNetworkProtocol, ipv6: bool, ip: *const c_void, mac: *MacAddress) Status {
6566 return self._mcast_ip_to_mac(self, ipv6, ip, mac);
6667 }
6768
6869 /// Performs read and write operations on the NVRAM device attached to a network interface.
69 pub fn nvdata(self: *const SimpleNetworkProtocol, read_write: bool, offset: usize, buffer_size: usize, buffer: [*]u8) usize {
70 pub fn nvdata(self: *const SimpleNetworkProtocol, read_write: bool, offset: usize, buffer_size: usize, buffer: [*]u8) Status {
7071 return self._nvdata(self, read_write, offset, buffer_size, buffer);
7172 }
7273
7374 /// Reads the current interrupt status and recycled transmit buffer status from a network interface.
74 pub fn getStatus(self: *const SimpleNetworkProtocol, interrupt_status: *SimpleNetworkInterruptStatus, tx_buf: ?*?[*]u8) usize {
75 pub fn getStatus(self: *const SimpleNetworkProtocol, interrupt_status: *SimpleNetworkInterruptStatus, tx_buf: ?*?[*]u8) Status {
7576 return self._get_status(self, interrupt_status, tx_buf);
7677 }
7778
7879 /// Places a packet in the transmit queue of a network interface.
79 pub fn transmit(self: *const SimpleNetworkProtocol, header_size: usize, buffer_size: usize, buffer: [*]const u8, src_addr: ?*const MacAddress, dest_addr: ?*const MacAddress, protocol: ?*const u16) usize {
80 pub fn transmit(self: *const SimpleNetworkProtocol, header_size: usize, buffer_size: usize, buffer: [*]const u8, src_addr: ?*const MacAddress, dest_addr: ?*const MacAddress, protocol: ?*const u16) Status {
8081 return self._transmit(self, header_size, buffer_size, buffer, src_addr, dest_addr, protocol);
8182 }
8283
8384 /// Receives a packet from a network interface.
84 pub fn receive(self: *const SimpleNetworkProtocol, header_size: ?*usize, buffer_size: *usize, buffer: [*]u8, src_addr: ?*MacAddress, dest_addr: ?*MacAddress, protocol: ?*u16) usize {
85 pub fn receive(self: *const SimpleNetworkProtocol, header_size: ?*usize, buffer_size: *usize, buffer: [*]u8, src_addr: ?*MacAddress, dest_addr: ?*MacAddress, protocol: ?*u16) Status {
8586 return self._receive(self, header_size, buffer_size, buffer, src_addr, dest_addr, protocol);
8687 }
8788
lib/std/os/uefi/protocols/simple_pointer_protocol.zig+5-4
......@@ -1,21 +1,22 @@
11const uefi = @import("std").os.uefi;
22const Event = uefi.Event;
33const Guid = uefi.Guid;
4const Status = uefi.Status;
45
56/// Protocol for mice
67pub const SimplePointerProtocol = struct {
7 _reset: extern fn (*const SimplePointerProtocol, bool) usize,
8 _get_state: extern fn (*const SimplePointerProtocol, *SimplePointerState) usize,
8 _reset: extern fn (*const SimplePointerProtocol, bool) Status,
9 _get_state: extern fn (*const SimplePointerProtocol, *SimplePointerState) Status,
910 wait_for_input: Event,
1011 mode: *SimplePointerMode,
1112
1213 /// Resets the pointer device hardware.
13 pub fn reset(self: *const SimplePointerProtocol, verify: bool) usize {
14 pub fn reset(self: *const SimplePointerProtocol, verify: bool) Status {
1415 return self._reset(self, verify);
1516 }
1617
1718 /// Retrieves the current state of a pointer device.
18 pub fn getState(self: *const SimplePointerProtocol, state: *SimplePointerState) usize {
19 pub fn getState(self: *const SimplePointerProtocol, state: *SimplePointerState) Status {
1920 return self._get_state(self, state);
2021 }
2122
lib/std/os/uefi/protocols/simple_text_input_ex_protocol.zig+11-10
......@@ -1,38 +1,39 @@
11const uefi = @import("std").os.uefi;
22const Event = uefi.Event;
33const Guid = uefi.Guid;
4const Status = uefi.Status;
45
56/// Character input devices, e.g. Keyboard
67pub const SimpleTextInputExProtocol = extern struct {
7 _reset: extern fn (*const SimpleTextInputExProtocol, bool) usize,
8 _read_key_stroke_ex: extern fn (*const SimpleTextInputExProtocol, *KeyData) usize,
8 _reset: extern fn (*const SimpleTextInputExProtocol, bool) Status,
9 _read_key_stroke_ex: extern fn (*const SimpleTextInputExProtocol, *KeyData) Status,
910 wait_for_key_ex: Event,
10 _set_state: extern fn (*const SimpleTextInputExProtocol, *const u8) usize,
11 _register_key_notify: extern fn (*const SimpleTextInputExProtocol, *const KeyData, extern fn (*const KeyData) usize, **c_void) usize,
12 _unregister_key_notify: extern fn (*const SimpleTextInputExProtocol, *const c_void) usize,
11 _set_state: extern fn (*const SimpleTextInputExProtocol, *const u8) Status,
12 _register_key_notify: extern fn (*const SimpleTextInputExProtocol, *const KeyData, extern fn (*const KeyData) usize, **c_void) Status,
13 _unregister_key_notify: extern fn (*const SimpleTextInputExProtocol, *const c_void) Status,
1314
1415 /// Resets the input device hardware.
15 pub fn reset(self: *const SimpleTextInputExProtocol, verify: bool) usize {
16 pub fn reset(self: *const SimpleTextInputExProtocol, verify: bool) Status {
1617 return self._reset(self, verify);
1718 }
1819
1920 /// Reads the next keystroke from the input device.
20 pub fn readKeyStrokeEx(self: *const SimpleTextInputExProtocol, key_data: *KeyData) usize {
21 pub fn readKeyStrokeEx(self: *const SimpleTextInputExProtocol, key_data: *KeyData) Status {
2122 return self._read_key_stroke_ex(self, key_data);
2223 }
2324
2425 /// Set certain state for the input device.
25 pub fn setState(self: *const SimpleTextInputExProtocol, state: *const u8) usize {
26 pub fn setState(self: *const SimpleTextInputExProtocol, state: *const u8) Status {
2627 return self._set_state(self, state);
2728 }
2829
2930 /// Register a notification function for a particular keystroke for the input device.
30 pub fn registerKeyNotify(self: *const SimpleTextInputExProtocol, key_data: *const KeyData, notify: extern fn (*const KeyData) usize, handle: **c_void) usize {
31 pub fn registerKeyNotify(self: *const SimpleTextInputExProtocol, key_data: *const KeyData, notify: extern fn (*const KeyData) usize, handle: **c_void) Status {
3132 return self._register_key_notify(self, key_data, notify, handle);
3233 }
3334
3435 /// Remove the notification that was previously registered.
35 pub fn unregisterKeyNotify(self: *const SimpleTextInputExProtocol, handle: *const c_void) usize {
36 pub fn unregisterKeyNotify(self: *const SimpleTextInputExProtocol, handle: *const c_void) Status {
3637 return self._unregister_key_notify(self, handle);
3738 }
3839
lib/std/os/uefi/protocols/simple_text_input_protocol.zig+4-3
......@@ -2,20 +2,21 @@ const uefi = @import("std").os.uefi;
22const Event = uefi.Event;
33const Guid = uefi.Guid;
44const InputKey = uefi.protocols.InputKey;
5const Status = uefi.Status;
56
67/// Character input devices, e.g. Keyboard
78pub const SimpleTextInputProtocol = extern struct {
89 _reset: extern fn (*const SimpleTextInputProtocol, bool) usize,
9 _read_key_stroke: extern fn (*const SimpleTextInputProtocol, *InputKey) usize,
10 _read_key_stroke: extern fn (*const SimpleTextInputProtocol, *InputKey) Status,
1011 wait_for_key: Event,
1112
1213 /// Resets the input device hardware.
13 pub fn reset(self: *const SimpleTextInputProtocol, verify: bool) usize {
14 pub fn reset(self: *const SimpleTextInputProtocol, verify: bool) Status {
1415 return self._reset(self, verify);
1516 }
1617
1718 /// Reads the next keystroke from the input device.
18 pub fn readKeyStroke(self: *const SimpleTextInputProtocol, input_key: *InputKey) usize {
19 pub fn readKeyStroke(self: *const SimpleTextInputProtocol, input_key: *InputKey) Status {
1920 return self._read_key_stroke(self, input_key);
2021 }
2122
lib/std/os/uefi/protocols/simple_text_output_protocol.zig+19-18
......@@ -1,61 +1,62 @@
11const uefi = @import("std").os.uefi;
22const Guid = uefi.Guid;
3const Status = uefi.Status;
34
45/// Character output devices
56pub const SimpleTextOutputProtocol = extern struct {
6 _reset: extern fn (*const SimpleTextOutputProtocol, bool) usize,
7 _output_string: extern fn (*const SimpleTextOutputProtocol, [*:0]const u16) usize,
8 _test_string: extern fn (*const SimpleTextOutputProtocol, [*:0]const u16) usize,
9 _query_mode: extern fn (*const SimpleTextOutputProtocol, usize, *usize, *usize) usize,
10 _set_mode: extern fn (*const SimpleTextOutputProtocol, usize) usize,
11 _set_attribute: extern fn (*const SimpleTextOutputProtocol, usize) usize,
12 _clear_screen: extern fn (*const SimpleTextOutputProtocol) usize,
13 _set_cursor_position: extern fn (*const SimpleTextOutputProtocol, usize, usize) usize,
14 _enable_cursor: extern fn (*const SimpleTextOutputProtocol, bool) usize,
7 _reset: extern fn (*const SimpleTextOutputProtocol, bool) Status,
8 _output_string: extern fn (*const SimpleTextOutputProtocol, [*:0]const u16) Status,
9 _test_string: extern fn (*const SimpleTextOutputProtocol, [*:0]const u16) Status,
10 _query_mode: extern fn (*const SimpleTextOutputProtocol, usize, *usize, *usize) Status,
11 _set_mode: extern fn (*const SimpleTextOutputProtocol, usize) Status,
12 _set_attribute: extern fn (*const SimpleTextOutputProtocol, usize) Status,
13 _clear_screen: extern fn (*const SimpleTextOutputProtocol) Status,
14 _set_cursor_position: extern fn (*const SimpleTextOutputProtocol, usize, usize) Status,
15 _enable_cursor: extern fn (*const SimpleTextOutputProtocol, bool) Status,
1516 mode: *SimpleTextOutputMode,
1617
1718 /// Resets the text output device hardware.
18 pub fn reset(self: *const SimpleTextOutputProtocol, verify: bool) usize {
19 pub fn reset(self: *const SimpleTextOutputProtocol, verify: bool) Status {
1920 return self._reset(self, verify);
2021 }
2122
2223 /// Writes a string to the output device.
23 pub fn outputString(self: *const SimpleTextOutputProtocol, msg: [*:0]const u16) usize {
24 pub fn outputString(self: *const SimpleTextOutputProtocol, msg: [*:0]const u16) Status {
2425 return self._output_string(self, msg);
2526 }
2627
2728 /// Verifies that all characters in a string can be output to the target device.
28 pub fn testString(self: *const SimpleTextOutputProtocol, msg: [*:0]const u16) usize {
29 pub fn testString(self: *const SimpleTextOutputProtocol, msg: [*:0]const u16) Status {
2930 return self._test_string(self, msg);
3031 }
3132
3233 /// Returns information for an available text mode that the output device(s) supports.
33 pub fn queryMode(self: *const SimpleTextOutputProtocol, mode_number: usize, columns: *usize, rows: *usize) usize {
34 pub fn queryMode(self: *const SimpleTextOutputProtocol, mode_number: usize, columns: *usize, rows: *usize) Status {
3435 return self._query_mode(self, mode_number, columns, rows);
3536 }
3637
3738 /// Sets the output device(s) to a specified mode.
38 pub fn setMode(self: *const SimpleTextOutputProtocol, mode_number: usize) usize {
39 pub fn setMode(self: *const SimpleTextOutputProtocol, mode_number: usize) Status {
3940 return self._set_mode(self, mode_number);
4041 }
4142
4243 /// Sets the background and foreground colors for the outputString() and clearScreen() functions.
43 pub fn setAttribute(self: *const SimpleTextOutputProtocol, attribute: usize) usize {
44 pub fn setAttribute(self: *const SimpleTextOutputProtocol, attribute: usize) Status {
4445 return self._set_attribute(self, attribute);
4546 }
4647
4748 /// Clears the output device(s) display to the currently selected background color.
48 pub fn clearScreen(self: *const SimpleTextOutputProtocol) usize {
49 pub fn clearScreen(self: *const SimpleTextOutputProtocol) Status {
4950 return self._clear_screen(self);
5051 }
5152
5253 /// Sets the current coordinates of the cursor position.
53 pub fn setCursorPosition(self: *const SimpleTextOutputProtocol, column: usize, row: usize) usize {
54 pub fn setCursorPosition(self: *const SimpleTextOutputProtocol, column: usize, row: usize) Status {
5455 return self._set_cursor_position(self, column, row);
5556 }
5657
5758 /// Makes the cursor visible or invisible.
58 pub fn enableCursor(self: *const SimpleTextOutputProtocol, visible: bool) usize {
59 pub fn enableCursor(self: *const SimpleTextOutputProtocol, visible: bool) Status {
5960 return self._enable_cursor(self, visible);
6061 }
6162
lib/std/os/uefi/protocols/udp6_protocol.zig+17-16
......@@ -1,6 +1,7 @@
11const uefi = @import("std").os.uefi;
22const Guid = uefi.Guid;
33const Event = uefi.Event;
4const Status = uefi.Status;
45const Time = uefi.Time;
56const Ip6ModeData = uefi.protocols.Ip6ModeData;
67const Ip6Address = uefi.protocols.Ip6Address;
......@@ -8,39 +9,39 @@ const ManagedNetworkConfigData = uefi.protocols.ManagedNetworkConfigData;
89const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode;
910
1011pub const Udp6Protocol = extern struct {
11 _get_mode_data: extern fn (*const Udp6Protocol, ?*Udp6ConfigData, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) usize,
12 _configure: extern fn (*const Udp6Protocol, ?*const Udp6ConfigData) usize,
13 _groups: extern fn (*const Udp6Protocol, bool, ?*const Ip6Address) usize,
14 _transmit: extern fn (*const Udp6Protocol, *Udp6CompletionToken) usize,
15 _receive: extern fn (*const Udp6Protocol, *Udp6CompletionToken) usize,
16 _cancel: extern fn (*const Udp6Protocol, ?*Udp6CompletionToken) usize,
17 _poll: extern fn (*const Udp6Protocol) usize,
18
19 pub fn getModeData(self: *const Udp6Protocol, udp6_config_data: ?*Udp6ConfigData, ip6_mode_data: ?*Ip6ModeData, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) usize {
12 _get_mode_data: extern fn (*const Udp6Protocol, ?*Udp6ConfigData, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) Status,
13 _configure: extern fn (*const Udp6Protocol, ?*const Udp6ConfigData) Status,
14 _groups: extern fn (*const Udp6Protocol, bool, ?*const Ip6Address) Status,
15 _transmit: extern fn (*const Udp6Protocol, *Udp6CompletionToken) Status,
16 _receive: extern fn (*const Udp6Protocol, *Udp6CompletionToken) Status,
17 _cancel: extern fn (*const Udp6Protocol, ?*Udp6CompletionToken) Status,
18 _poll: extern fn (*const Udp6Protocol) Status,
19
20 pub fn getModeData(self: *const Udp6Protocol, udp6_config_data: ?*Udp6ConfigData, ip6_mode_data: ?*Ip6ModeData, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) Status {
2021 return self._get_mode_data(self, udp6_config_data, ip6_mode_data, mnp_config_data, snp_mode_data);
2122 }
2223
23 pub fn configure(self: *const Udp6Protocol, udp6_config_data: ?*const Udp6ConfigData) usize {
24 pub fn configure(self: *const Udp6Protocol, udp6_config_data: ?*const Udp6ConfigData) Status {
2425 return self._configure(self, udp6_config_data);
2526 }
2627
27 pub fn groups(self: *const Udp6Protocol, join_flag: bool, multicast_address: ?*const Ip6Address) usize {
28 pub fn groups(self: *const Udp6Protocol, join_flag: bool, multicast_address: ?*const Ip6Address) Status {
2829 return self._groups(self, join_flag, multicast_address);
2930 }
3031
31 pub fn transmit(self: *const Udp6Protocol, token: *Udp6CompletionToken) usize {
32 pub fn transmit(self: *const Udp6Protocol, token: *Udp6CompletionToken) Status {
3233 return self._transmit(self, token);
3334 }
3435
35 pub fn receive(self: *const Udp6Protocol, token: *Udp6CompletionToken) usize {
36 pub fn receive(self: *const Udp6Protocol, token: *Udp6CompletionToken) Status {
3637 return self._receive(self, token);
3738 }
3839
39 pub fn cancel(self: *const Udp6Protocol, token: ?*Udp6CompletionToken) usize {
40 pub fn cancel(self: *const Udp6Protocol, token: ?*Udp6CompletionToken) Status {
4041 return self._cancel(self, token);
4142 }
4243
43 pub fn poll(self: *const Udp6Protocol) usize {
44 pub fn poll(self: *const Udp6Protocol) Status {
4445 return self._poll(self);
4546 }
4647
......@@ -70,7 +71,7 @@ pub const Udp6ConfigData = extern struct {
7071
7172pub const Udp6CompletionToken = extern struct {
7273 event: Event,
73 status: usize,
74 Status: usize,
7475 packet: extern union {
7576 RxData: *Udp6ReceiveData,
7677 TxData: *Udp6TransmitData,
lib/std/os/uefi/protocols/udp6_service_binding_protocol.zig+5-4
......@@ -1,16 +1,17 @@
11const uefi = @import("std").os.uefi;
22const Handle = uefi.Handle;
33const Guid = uefi.Guid;
4const Status = uefi.Status;
45
56pub const Udp6ServiceBindingProtocol = extern struct {
6 _create_child: extern fn (*const Udp6ServiceBindingProtocol, *?Handle) usize,
7 _destroy_child: extern fn (*const Udp6ServiceBindingProtocol, Handle) usize,
7 _create_child: extern fn (*const Udp6ServiceBindingProtocol, *?Handle) Status,
8 _destroy_child: extern fn (*const Udp6ServiceBindingProtocol, Handle) Status,
89
9 pub fn createChild(self: *const Udp6ServiceBindingProtocol, handle: *?Handle) usize {
10 pub fn createChild(self: *const Udp6ServiceBindingProtocol, handle: *?Handle) Status {
1011 return self._create_child(self, handle);
1112 }
1213
13 pub fn destroyChild(self: *const Udp6ServiceBindingProtocol, handle: Handle) usize {
14 pub fn destroyChild(self: *const Udp6ServiceBindingProtocol, handle: Handle) Status {
1415 return self._destroy_child(self, handle);
1516 }
1617
lib/std/os/uefi/status.zig+100-82
......@@ -1,124 +1,142 @@
11const high_bit = 1 << @typeInfo(usize).Int.bits - 1;
22
3/// The operation completed successfully.
4pub const success: usize = 0;
3pub const Status = extern enum(usize) {
4 /// The operation completed successfully.
5 Success = 0,
56
6/// The image failed to load.
7pub const load_error: usize = high_bit | 1;
7 /// The image failed to load.
8 LoadError = high_bit | 1,
89
9/// A parameter was incorrect.
10pub const invalid_parameter: usize = high_bit | 2;
10 /// A parameter was incorrect.
11 InvalidParameter = high_bit | 2,
1112
12/// The operation is not supported.
13pub const unsupported: usize = high_bit | 3;
13 /// The operation is not supported.
14 Unsupported = high_bit | 3,
1415
15/// The buffer was not the proper size for the request.
16pub const bad_buffer_size: usize = high_bit | 4;
16 /// The buffer was not the proper size for the request.
17 BadBufferSize = high_bit | 4,
1718
18/// The buffer is not large enough to hold the requested data. The required buffer size is returned in the appropriate parameter when this error occurs.
19pub const buffer_too_small: usize = high_bit | 5;
19 /// The buffer is not large enough to hold the requested data. The required buffer size is returned in the appropriate parameter when this error occurs.
20 BufferTooSmall = high_bit | 5,
2021
21/// There is no data pending upon return.
22pub const not_ready: usize = high_bit | 6;
22 /// There is no data pending upon return.
23 NotReady = high_bit | 6,
2324
24/// The physical device reported an error while attempting the operation.
25pub const device_error: usize = high_bit | 7;
25 /// The physical device reported an error while attempting the operation.
26 DeviceError = high_bit | 7,
2627
27/// The device cannot be written to.
28pub const write_protected: usize = high_bit | 8;
28 /// The device cannot be written to.
29 WriteProtected = high_bit | 8,
2930
30/// A resource has run out.
31pub const out_of_resources: usize = high_bit | 9;
31 /// A resource has run out.
32 OutOfResources = high_bit | 9,
3233
33/// An inconstancy was detected on the file system causing the operating to fail.
34pub const volume_corrupted: usize = high_bit | 10;
34 /// An inconstancy was detected on the file system causing the operating to fail.
35 VolumeCorrupted = high_bit | 10,
3536
36/// There is no more space on the file system.
37pub const volume_full: usize = high_bit | 11;
37 /// There is no more space on the file system.
38 VolumeFull = high_bit | 11,
3839
39/// The device does not contain any medium to perform the operation.
40pub const no_media: usize = high_bit | 12;
40 /// The device does not contain any medium to perform the operation.
41 NoMedia = high_bit | 12,
4142
42/// The medium in the device has changed since the last access.
43pub const media_changed: usize = high_bit | 13;
43 /// The medium in the device has changed since the last access.
44 MediaChanged = high_bit | 13,
4445
45/// The item was not found.
46pub const not_found: usize = high_bit | 14;
46 /// The item was not found.
47 NotFound = high_bit | 14,
4748
48/// Access was denied.
49pub const access_denied: usize = high_bit | 15;
49 /// Access was denied.
50 AccessDenied = high_bit | 15,
5051
51/// The server was not found or did not respond to the request.
52pub const no_response: usize = high_bit | 16;
52 /// The server was not found or did not respond to the request.
53 NoResponse = high_bit | 16,
5354
54/// A mapping to a device does not exist.
55pub const no_mapping: usize = high_bit | 17;
55 /// A mapping to a device does not exist.
56 NoMapping = high_bit | 17,
5657
57/// The timeout time expired.
58pub const timeout: usize = high_bit | 18;
58 /// The timeout time expired.
59 Timeout = high_bit | 18,
5960
60/// The protocol has not been started.
61pub const not_started: usize = high_bit | 19;
61 /// The protocol has not been started.
62 NotStarted = high_bit | 19,
6263
63/// The protocol has already been started.
64pub const already_started: usize = high_bit | 20;
64 /// The protocol has already been started.
65 AlreadyStarted = high_bit | 20,
6566
66/// The operation was aborted.
67pub const aborted: usize = high_bit | 21;
67 /// The operation was aborted.
68 Aborted = high_bit | 21,
6869
69/// An ICMP error occurred during the network operation.
70pub const icmp_error: usize = high_bit | 22;
70 /// An ICMP error occurred during the network operation.
71 IcmpError = high_bit | 22,
7172
72/// A TFTP error occurred during the network operation.
73pub const tftp_error: usize = high_bit | 23;
73 /// A TFTP error occurred during the network operation.
74 TftpError = high_bit | 23,
7475
75/// A protocol error occurred during the network operation.
76pub const protocol_error: usize = high_bit | 24;
76 /// A protocol error occurred during the network operation.
77 ProtocolError = high_bit | 24,
7778
78/// The function encountered an internal version that was incompatible with a version requested by the caller.
79pub const incompatible_version: usize = high_bit | 25;
79 /// The function encountered an internal version that was incompatible with a version requested by the caller.
80 IncompatibleVersion = high_bit | 25,
8081
81/// The function was not performed due to a security violation.
82pub const security_violation: usize = high_bit | 26;
82 /// The function was not performed due to a security violation.
83 SecurityViolation = high_bit | 26,
8384
84/// A CRC error was detected.
85pub const crc_error: usize = high_bit | 27;
85 /// A CRC error was detected.
86 CrcError = high_bit | 27,
8687
87/// Beginning or end of media was reached
88pub const end_of_media: usize = high_bit | 28;
88 /// Beginning or end of media was reached
89 EndOfMedia = high_bit | 28,
8990
90/// The end of the file was reached.
91pub const end_of_file: usize = high_bit | 31;
91 /// The end of the file was reached.
92 EndOfFile = high_bit | 31,
9293
93/// The language specified was invalid.
94pub const invalid_language: usize = high_bit | 32;
94 /// The language specified was invalid.
95 InvalidLanguage = high_bit | 32,
9596
96/// The security status of the data is unknown or compromised and the data must be updated or replaced to restore a valid security status.
97pub const compromised_data: usize = high_bit | 33;
97 /// The security status of the data is unknown or compromised and the data must be updated or replaced to restore a valid security status.
98 CompromisedData = high_bit | 33,
9899
99/// There is an address conflict address allocation
100pub const ip_address_conflict: usize = high_bit | 34;
100 /// There is an address conflict address allocation
101 IpAddressConflict = high_bit | 34,
101102
102/// A HTTP error occurred during the network operation.
103pub const http_error: usize = high_bit | 35;
103 /// A HTTP error occurred during the network operation.
104 HttpError = high_bit | 35,
104105
105/// The string contained one or more characters that the device could not render and were skipped.
106pub const warn_unknown_glyph: usize = 1;
106 NetworkUnreachable = high_bit | 100,
107107
108/// The handle was closed, but the file was not deleted.
109pub const warn_delete_failure: usize = 2;
108 HostUnreachable = high_bit | 101,
110109
111/// The handle was closed, but the data to the file was not flushed properly.
112pub const warn_write_failure: usize = 3;
110 ProtocolUnreachable = high_bit | 102,
113111
114/// The resulting buffer was too small, and the data was truncated to the buffer size.
115pub const warn_buffer_too_small: usize = 4;
112 PortUnreachable = high_bit | 103,
116113
117/// The data has not been updated within the timeframe set by localpolicy for this type of data.
118pub const warn_stale_data: usize = 5;
114 ConnectionFin = high_bit | 104,
119115
120/// The resulting buffer contains UEFI-compliant file system.
121pub const warn_file_system: usize = 6;
116 ConnectionReset = high_bit | 105,
122117
123/// The operation will be processed across a system reset.
124pub const warn_reset_required: usize = 7;
118 ConnectionRefused = high_bit | 106,
119
120 /// The string contained one or more characters that the device could not render and were skipped.
121 WarnUnknownGlyph = 1,
122
123 /// The handle was closed, but the file was not deleted.
124 WarnDeleteFailure = 2,
125
126 /// The handle was closed, but the data to the file was not flushed properly.
127 WarnWriteFailure = 3,
128
129 /// The resulting buffer was too small, and the data was truncated to the buffer size.
130 WarnBufferTooSmall = 4,
131
132 /// The data has not been updated within the timeframe set by localpolicy for this type of data.
133 WarnStaleData = 5,
134
135 /// The resulting buffer contains UEFI-compliant file system.
136 WarnFileSystem = 6,
137
138 /// The operation will be processed across a system reset.
139 WarnResetRequired = 7,
140
141 _,
142};
lib/std/os/uefi/tables/boot_services.zig+40-39
......@@ -2,6 +2,7 @@ const uefi = @import("std").os.uefi;
22const Event = uefi.Event;
33const Guid = uefi.Guid;
44const Handle = uefi.Handle;
5const Status = uefi.Status;
56const TableHeader = uefi.tables.TableHeader;
67const DevicePathProtocol = uefi.protocols.DevicePathProtocol;
78
......@@ -26,105 +27,105 @@ pub const BootServices = extern struct {
2627 restoreTpl: extern fn (usize) void,
2728
2829 /// Allocates memory pages from the system.
29 allocatePages: extern fn (AllocateType, MemoryType, usize, *[*]align(4096) u8) usize,
30 allocatePages: extern fn (AllocateType, MemoryType, usize, *[*]align(4096) u8) Status,
3031
3132 /// Frees memory pages.
32 freePages: extern fn ([*]align(4096) u8, usize) usize,
33 freePages: extern fn ([*]align(4096) u8, usize) Status,
3334
3435 /// Returns the current memory map.
35 getMemoryMap: extern fn (*usize, [*]MemoryDescriptor, *usize, *usize, *u32) usize,
36 getMemoryMap: extern fn (*usize, [*]MemoryDescriptor, *usize, *usize, *u32) Status,
3637
3738 /// Allocates pool memory.
38 allocatePool: extern fn (MemoryType, usize, *[*]align(8) u8) usize,
39 allocatePool: extern fn (MemoryType, usize, *[*]align(8) u8) Status,
3940
4041 /// Returns pool memory to the system.
41 freePool: extern fn ([*]align(8) u8) usize,
42 freePool: extern fn ([*]align(8) u8) Status,
4243
4344 /// Creates an event.
44 createEvent: extern fn (u32, usize, ?extern fn (Event, ?*c_void) void, ?*const c_void, *Event) usize,
45 createEvent: extern fn (u32, usize, ?extern fn (Event, ?*c_void) void, ?*const c_void, *Event) Status,
4546
4647 /// Sets the type of timer and the trigger time for a timer event.
47 setTimer: extern fn (Event, TimerDelay, u64) usize,
48 setTimer: extern fn (Event, TimerDelay, u64) Status,
4849
4950 /// Stops execution until an event is signaled.
50 waitForEvent: extern fn (usize, [*]const Event, *usize) usize,
51 waitForEvent: extern fn (usize, [*]const Event, *usize) Status,
5152
5253 /// Signals an event.
53 signalEvent: extern fn (Event) usize,
54 signalEvent: extern fn (Event) Status,
5455
5556 /// Closes an event.
56 closeEvent: extern fn (Event) usize,
57 closeEvent: extern fn (Event) Status,
5758
5859 /// Checks whether an event is in the signaled state.
59 checkEvent: extern fn (Event) usize,
60 checkEvent: extern fn (Event) Status,
6061
61 installProtocolInterface: usize, // TODO
62 reinstallProtocolInterface: usize, // TODO
63 uninstallProtocolInterface: usize, // TODO
62 installProtocolInterface: Status, // TODO
63 reinstallProtocolInterface: Status, // TODO
64 uninstallProtocolInterface: Status, // TODO
6465
6566 /// Queries a handle to determine if it supports a specified protocol.
66 handleProtocol: extern fn (Handle, *align(8) const Guid, *?*c_void) usize,
67 handleProtocol: extern fn (Handle, *align(8) const Guid, *?*c_void) Status,
6768
6869 reserved: *c_void,
6970
70 registerProtocolNotify: usize, // TODO
71 registerProtocolNotify: Status, // TODO
7172
7273 /// Returns an array of handles that support a specified protocol.
73 locateHandle: extern fn (LocateSearchType, ?*align(8) const Guid, ?*const c_void, *usize, [*]Handle) usize,
74 locateHandle: extern fn (LocateSearchType, ?*align(8) const Guid, ?*const c_void, *usize, [*]Handle) Status,
7475
75 locateDevicePath: usize, // TODO
76 installConfigurationTable: usize, // TODO
76 locateDevicePath: Status, // TODO
77 installConfigurationTable: Status, // TODO
7778
7879 /// Loads an EFI image into memory.
79 loadImage: extern fn (bool, Handle, ?*const DevicePathProtocol, ?[*]const u8, usize, *?Handle) usize,
80 loadImage: extern fn (bool, Handle, ?*const DevicePathProtocol, ?[*]const u8, usize, *?Handle) Status,
8081
8182 /// Transfers control to a loaded image's entry point.
82 startImage: extern fn (Handle, ?*usize, ?*[*]u16) usize,
83 startImage: extern fn (Handle, ?*usize, ?*[*]u16) Status,
8384
8485 /// Terminates a loaded EFI image and returns control to boot services.
85 exit: extern fn (Handle, usize, usize, ?*const c_void) usize,
86 exit: extern fn (Handle, Status, usize, ?*const c_void) Status,
8687
8788 /// Unloads an image.
88 unloadImage: extern fn (Handle) usize,
89 unloadImage: extern fn (Handle) Status,
8990
9091 /// Terminates all boot services.
91 exitBootServices: extern fn (Handle, usize) usize,
92 exitBootServices: extern fn (Handle, usize) Status,
9293
9394 /// Returns a monotonically increasing count for the platform.
94 getNextMonotonicCount: extern fn (*u64) usize,
95 getNextMonotonicCount: extern fn (*u64) Status,
9596
9697 /// Induces a fine-grained stall.
97 stall: extern fn (usize) usize,
98 stall: extern fn (usize) Status,
9899
99100 /// Sets the system's watchdog timer.
100 setWatchdogTimer: extern fn (usize, u64, usize, ?[*]const u16) usize,
101 setWatchdogTimer: extern fn (usize, u64, usize, ?[*]const u16) Status,
101102
102 connectController: usize, // TODO
103 disconnectController: usize, // TODO
103 connectController: Status, // TODO
104 disconnectController: Status, // TODO
104105
105106 /// Queries a handle to determine if it supports a specified protocol.
106 openProtocol: extern fn (Handle, *align(8) const Guid, *?*c_void, ?Handle, ?Handle, OpenProtocolAttributes) usize,
107 openProtocol: extern fn (Handle, *align(8) const Guid, *?*c_void, ?Handle, ?Handle, OpenProtocolAttributes) Status,
107108
108109 /// Closes a protocol on a handle that was opened using openProtocol().
109 closeProtocol: extern fn (Handle, *align(8) const Guid, Handle, ?Handle) usize,
110 closeProtocol: extern fn (Handle, *align(8) const Guid, Handle, ?Handle) Status,
110111
111112 /// Retrieves the list of agents that currently have a protocol interface opened.
112 openProtocolInformation: extern fn (Handle, *align(8) const Guid, *[*]ProtocolInformationEntry, *usize) usize,
113 openProtocolInformation: extern fn (Handle, *align(8) const Guid, *[*]ProtocolInformationEntry, *usize) Status,
113114
114115 /// Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated from pool.
115 protocolsPerHandle: extern fn (Handle, *[*]*align(8) const Guid, *usize) usize,
116 protocolsPerHandle: extern fn (Handle, *[*]*align(8) const Guid, *usize) Status,
116117
117118 /// Returns an array of handles that support the requested protocol in a buffer allocated from pool.
118 locateHandleBuffer: extern fn (LocateSearchType, ?*align(8) const Guid, ?*const c_void, *usize, *[*]Handle) usize,
119 locateHandleBuffer: extern fn (LocateSearchType, ?*align(8) const Guid, ?*const c_void, *usize, *[*]Handle) Status,
119120
120121 /// Returns the first protocol instance that matches the given protocol.
121 locateProtocol: extern fn (*align(8) const Guid, ?*const c_void, *?*c_void) usize,
122 locateProtocol: extern fn (*align(8) const Guid, ?*const c_void, *?*c_void) Status,
122123
123 installMultipleProtocolInterfaces: usize, // TODO
124 uninstallMultipleProtocolInterfaces: usize, // TODO
124 installMultipleProtocolInterfaces: Status, // TODO
125 uninstallMultipleProtocolInterfaces: Status, // TODO
125126
126127 /// Computes and returns a 32-bit CRC for a data buffer.
127 calculateCrc32: extern fn ([*]const u8, usize, *u32) usize,
128 calculateCrc32: extern fn ([*]const u8, usize, *u32) Status,
128129
129130 /// Copies the contents of one buffer to another buffer
130131 copyMem: extern fn ([*]u8, [*]const u8, usize) void,
......@@ -132,7 +133,7 @@ pub const BootServices = extern struct {
132133 /// Fills a buffer with a specified value
133134 setMem: extern fn ([*]u8, usize, u8) void,
134135
135 createEventEx: usize, // TODO
136 createEventEx: Status, // TODO
136137
137138 pub const signature: u64 = 0x56524553544f4f42;
138139
lib/std/os/uefi/tables/runtime_services.zig+15-14
......@@ -3,6 +3,7 @@ const Guid = uefi.Guid;
33const TableHeader = uefi.tables.TableHeader;
44const Time = uefi.Time;
55const TimeCapabilities = uefi.TimeCapabilities;
6const Status = uefi.Status;
67
78/// Runtime services are provided by the firmware before and after exitBootServices has been called.
89///
......@@ -16,31 +17,31 @@ pub const RuntimeServices = extern struct {
1617 hdr: TableHeader,
1718
1819 /// Returns the current time and date information, and the time-keeping capabilities of the hardware platform.
19 getTime: extern fn (*uefi.Time, ?*TimeCapabilities) usize,
20 getTime: extern fn (*uefi.Time, ?*TimeCapabilities) Status,
2021
21 setTime: usize, // TODO
22 getWakeupTime: usize, // TODO
23 setWakeupTime: usize, // TODO
24 setVirtualAddressMap: usize, // TODO
25 convertPointer: usize, // TODO
22 setTime: Status, // TODO
23 getWakeupTime: Status, // TODO
24 setWakeupTime: Status, // TODO
25 setVirtualAddressMap: Status, // TODO
26 convertPointer: Status, // TODO
2627
2728 /// Returns the value of a variable.
28 getVariable: extern fn ([*:0]const u16, *align(8) const Guid, ?*u32, *usize, ?*c_void) usize,
29 getVariable: extern fn ([*:0]const u16, *align(8) const Guid, ?*u32, *usize, ?*c_void) Status,
2930
3031 /// Enumerates the current variable names.
31 getNextVariableName: extern fn (*usize, [*:0]u16, *align(8) Guid) usize,
32 getNextVariableName: extern fn (*usize, [*:0]u16, *align(8) Guid) Status,
3233
3334 /// Sets the value of a variable.
34 setVariable: extern fn ([*:0]const u16, *align(8) const Guid, u32, usize, *c_void) usize,
35 setVariable: extern fn ([*:0]const u16, *align(8) const Guid, u32, usize, *c_void) Status,
3536
36 getNextHighMonotonicCount: usize, // TODO
37 getNextHighMonotonicCount: Status, // TODO
3738
3839 /// Resets the entire platform.
39 resetSystem: extern fn (ResetType, usize, usize, ?*const c_void) noreturn,
40 resetSystem: extern fn (ResetType, Status, usize, ?*const c_void) noreturn,
4041
41 updateCapsule: usize, // TODO
42 queryCapsuleCapabilities: usize, // TODO
43 queryVariableInfo: usize, // TODO
42 updateCapsule: Status, // TODO
43 queryCapsuleCapabilities: Status, // TODO
44 queryVariableInfo: Status, // TODO
4445
4546 pub const signature: u64 = 0x56524553544e5552;
4647};
lib/std/start.zig+8-9
......@@ -55,25 +55,24 @@ fn wasm_freestanding_start() callconv(.C) void {
5555}
5656
5757fn EfiMain(handle: uefi.Handle, system_table: *uefi.tables.SystemTable) callconv(.C) usize {
58 const bad_efi_main_ret = "expected return type of main to be 'void', 'noreturn', or 'usize'";
5958 uefi.handle = handle;
6059 uefi.system_table = system_table;
6160
62 switch (@typeInfo(@TypeOf(root.main).ReturnType)) {
63 .NoReturn => {
61 switch (@TypeOf(root.main).ReturnType) {
62 noreturn => {
6463 root.main();
6564 },
66 .Void => {
65 void => {
6766 root.main();
6867 return 0;
6968 },
70 .Int => |info| {
71 if (info.bits != @typeInfo(usize).Int.bits) {
72 @compileError(bad_efi_main_ret);
73 }
69 usize => {
7470 return root.main();
7571 },
76 else => @compileError(bad_efi_main_ret),
72 uefi.Status => {
73 return @enumToInt(root.main());
74 },
75 else => @compileError("expected return type of main to be 'void', 'noreturn', 'usize', or 'std.os.uefi.Status'"),
7776 }
7877}
7978