| author | |
| committer | |
| log | e6eae25053581032f7b26cb86fa6c8c84465e1c8 |
| tree | b26defdac259f477593d2b10c68bc4b8da225abc |
| parent | 77104da43e7269791b9cb5d33a0f76f9a9f70e86 |
| signature |
19 files changed, 147 insertions(+), 30 deletions(-)
lib/std/os/uefi.zig+29-1| ... | ... | @@ -1,4 +1,6 @@ |
| 1 | /// A protocol is an interface identified by a GUID. | |
| 1 | 2 | pub const protocols = @import("uefi/protocols.zig"); |
| 3 | /// Status codes returned by EFI interfaces | |
| 2 | 4 | pub const status = @import("uefi/status.zig"); |
| 3 | 5 | pub const tables = @import("uefi/tables.zig"); |
| 4 | 6 | |
| ... | ... | @@ -7,11 +9,15 @@ const fmt = @import("std").fmt; |
| 7 | 9 | const builtin = @import("builtin"); |
| 8 | 10 | pub const is_the_target = builtin.os == .uefi; |
| 9 | 11 | |
| 12 | /// The EFI image's handle that is passed to its entry point. | |
| 10 | 13 | pub var handle: Handle = undefined; |
| 14 | /// A pointer to the EFI System Table that is passed to the EFI image's entry point. | |
| 11 | 15 | pub var system_table: *tables.SystemTable = undefined; |
| 12 | 16 | |
| 17 | /// A handle to an event structure. | |
| 13 | 18 | pub const Event = *@OpaqueType(); |
| 14 | // GUIDs must be align(8) | |
| 19 | ||
| 20 | /// GUIDs must be align(8) | |
| 15 | 21 | pub const Guid = extern struct { |
| 16 | 22 | time_low: u32, |
| 17 | 23 | time_mid: u16, |
| ... | ... | @@ -20,6 +26,7 @@ pub const Guid = extern struct { |
| 20 | 26 | clock_seq_low: u8, |
| 21 | 27 | node: [6]u8, |
| 22 | 28 | |
| 29 | /// Format GUID into hexadecimal lowercase xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format | |
| 23 | 30 | pub fn format( |
| 24 | 31 | self: @This(), |
| 25 | 32 | comptime f: []const u8, |
| ... | ... | @@ -35,28 +42,49 @@ pub const Guid = extern struct { |
| 35 | 42 | } |
| 36 | 43 | } |
| 37 | 44 | }; |
| 45 | ||
| 46 | /// An EFI Handle represents a collection of related interfaces. | |
| 38 | 47 | pub const Handle = *@OpaqueType(); |
| 48 | ||
| 49 | /// This structure represents time information. | |
| 39 | 50 | pub const Time = extern struct { |
| 51 | /// 1900 - 9999 | |
| 40 | 52 | year: u16, |
| 53 | /// 1 - 12 | |
| 41 | 54 | month: u8, |
| 55 | /// 1 - 31 | |
| 42 | 56 | day: u8, |
| 57 | /// 0 - 23 | |
| 43 | 58 | hour: u8, |
| 59 | /// 0 - 59 | |
| 44 | 60 | minute: u8, |
| 61 | /// 0 - 59 | |
| 45 | 62 | second: u8, |
| 46 | 63 | _pad1: u8, |
| 64 | /// 0 - 999999999 | |
| 47 | 65 | nanosecond: u32, |
| 66 | /// The time's offset in minutes from UTC. | |
| 67 | /// Allowed values are -1440 to 1440 or unspecified_timezone | |
| 48 | 68 | timezone: i16, |
| 49 | 69 | daylight: packed struct { |
| 50 | 70 | _pad1: u6, |
| 71 | /// If true, the time has been adjusted for daylight savings time. | |
| 51 | 72 | in_daylight: bool, |
| 73 | /// If true, the time is affected by daylight savings time. | |
| 52 | 74 | adjust_daylight: bool, |
| 53 | 75 | }, |
| 54 | 76 | _pad2: u8, |
| 55 | 77 | |
| 78 | /// Time is to be interpreted as local time | |
| 56 | 79 | pub const unspecified_timezone: i16 = 0x7ff; |
| 57 | 80 | }; |
| 81 | ||
| 82 | /// Capabilities of the clock device | |
| 58 | 83 | pub const TimeCapabilities = extern struct { |
| 84 | /// Resolution in Hz | |
| 59 | 85 | resolution: u32, |
| 86 | /// Accuracy in an error rate of 1e-6 parts per million. | |
| 60 | 87 | accuracy: u32, |
| 88 | /// If true, a time set operation clears the device's time below the resolution level. | |
| 61 | 89 | sets_to_zero: bool, |
| 62 | 90 | }; |
lib/std/os/uefi/protocols/absolute_pointer_protocol.zig+7-5| ... | ... | @@ -2,17 +2,19 @@ const uefi = @import("std").os.uefi; |
| 2 | 2 | const Event = uefi.Event; |
| 3 | 3 | const Guid = uefi.Guid; |
| 4 | 4 | |
| 5 | /// UEFI Specification, Version 2.8, 12.7 | |
| 5 | /// Protocol for touchscreens | |
| 6 | 6 | pub const AbsolutePointerProtocol = extern struct { |
| 7 | 7 | _reset: extern fn (*const AbsolutePointerProtocol, bool) usize, |
| 8 | 8 | _get_state: extern fn (*const AbsolutePointerProtocol, *AbsolutePointerState) usize, |
| 9 | 9 | wait_for_input: Event, |
| 10 | 10 | mode: *AbsolutePointerMode, |
| 11 | 11 | |
| 12 | /// Resets the pointer device hardware. | |
| 12 | 13 | pub fn reset(self: *const AbsolutePointerProtocol, verify: bool) usize { |
| 13 | 14 | return self._reset(self, verify); |
| 14 | 15 | } |
| 15 | 16 | |
| 17 | /// Retrieves the current state of a pointer device. | |
| 16 | 18 | pub fn getState(self: *const AbsolutePointerProtocol, state: *AbsolutePointerState) usize { |
| 17 | 19 | return self._get_state(self, state); |
| 18 | 20 | } |
| ... | ... | @@ -42,12 +44,12 @@ pub const AbsolutePointerMode = extern struct { |
| 42 | 44 | }; |
| 43 | 45 | |
| 44 | 46 | pub const AbsolutePointerState = extern struct { |
| 45 | current_x: u64 = undefined, | |
| 46 | current_y: u64 = undefined, | |
| 47 | current_z: u64 = undefined, | |
| 47 | current_x: u64, | |
| 48 | current_y: u64, | |
| 49 | current_z: u64, | |
| 48 | 50 | active_buttons: packed struct { |
| 49 | 51 | touch_active: bool, |
| 50 | 52 | alt_active: bool, |
| 51 | 53 | _pad1: u30, |
| 52 | } = undefined, | |
| 54 | }, | |
| 53 | 55 | }; |
lib/std/os/uefi/protocols/edid_active_protocol.zig+1-1| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | const uefi = @import("std").os.uefi; |
| 2 | 2 | const Guid = uefi.Guid; |
| 3 | 3 | |
| 4 | /// UEFI Specification, Version 2.8, 12.9 | |
| 4 | /// EDID information for an active video output device | |
| 5 | 5 | pub const EdidActiveProtocol = extern struct { |
| 6 | 6 | size_of_edid: u32, |
| 7 | 7 | edid: ?[*]u8, |
lib/std/os/uefi/protocols/edid_discovered_protocol.zig+1-1| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | const uefi = @import("std").os.uefi; |
| 2 | 2 | const Guid = uefi.Guid; |
| 3 | 3 | |
| 4 | /// UEFI Specification, Version 2.8, 12.9 | |
| 4 | /// EDID information for a video output device | |
| 5 | 5 | pub const EdidDiscoveredProtocol = extern struct { |
| 6 | 6 | size_of_edid: u32, |
| 7 | 7 | edid: ?[*]u8, |
lib/std/os/uefi/protocols/edid_override_protocol.zig+2-1| ... | ... | @@ -2,10 +2,11 @@ const uefi = @import("std").os.uefi; |
| 2 | 2 | const Guid = uefi.Guid; |
| 3 | 3 | const Handle = uefi.Handle; |
| 4 | 4 | |
| 5 | /// UEFI Specification, Version 2.8, 12.9 | |
| 5 | /// Override EDID information | |
| 6 | 6 | pub const EdidOverrideProtocol = extern struct { |
| 7 | 7 | _get_edid: extern fn (*const EdidOverrideProtocol, Handle, *u32, *usize, *?[*]u8) usize, |
| 8 | 8 | |
| 9 | /// Returns policy information and potentially a replacement EDID for the specified video output device. | |
| 9 | 10 | /// attributes must be align(4) |
| 10 | 11 | pub fn getEdid(self: *const EdidOverrideProtocol, handle: Handle, attributes: *EdidOverrideProtocolAttributes, edid_size: *usize, edid: *?[*]u8) usize { |
| 11 | 12 | return self._get_edid(self, handle, attributes, edid_size, edid); |
lib/std/os/uefi/protocols/graphics_output_protocol.zig+4-1| ... | ... | @@ -1,21 +1,24 @@ |
| 1 | 1 | const uefi = @import("std").os.uefi; |
| 2 | 2 | const Guid = uefi.Guid; |
| 3 | 3 | |
| 4 | /// UEFI Specification, Version 2.8, 12.9 | |
| 4 | /// Graphics output | |
| 5 | 5 | pub const GraphicsOutputProtocol = extern struct { |
| 6 | 6 | _query_mode: extern fn (*const GraphicsOutputProtocol, u32, *usize, **GraphicsOutputModeInformation) usize, |
| 7 | 7 | _set_mode: extern fn (*const GraphicsOutputProtocol, u32) usize, |
| 8 | 8 | _blt: extern fn (*const GraphicsOutputProtocol, ?[*]GraphicsOutputBltPixel, GraphicsOutputBltOperation, usize, usize, usize, usize, usize, usize, usize) usize, |
| 9 | 9 | mode: *GraphicsOutputProtocolMode, |
| 10 | 10 | |
| 11 | /// Returns information for an available graphics mode that the graphics device and the set of active video output devices supports. | |
| 11 | 12 | pub fn queryMode(self: *const GraphicsOutputProtocol, mode: u32, size_of_info: *usize, info: **GraphicsOutputModeInformation) usize { |
| 12 | 13 | return self._query_mode(self, mode, size_of_info, info); |
| 13 | 14 | } |
| 14 | 15 | |
| 16 | /// Set the video device into the specified mode and clears the visible portions of the output display to black. | |
| 15 | 17 | pub fn setMode(self: *const GraphicsOutputProtocol, mode: u32) usize { |
| 16 | 18 | return self._set_mode(self, mode); |
| 17 | 19 | } |
| 18 | 20 | |
| 21 | /// Blt a rectangle of pixels on the graphics screen. Blt stands for BLock Transfer. | |
| 19 | 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 { |
| 20 | 23 | return self._blt(self, blt_buffer, blt_operation, source_x, source_y, destination_x, destination_y, width, height, delta); |
| 21 | 24 | } |
lib/std/os/uefi/protocols/hii.zig+3| ... | ... | @@ -3,6 +3,7 @@ const Guid = uefi.Guid; |
| 3 | 3 | |
| 4 | 4 | pub const HIIHandle = *@OpaqueType(); |
| 5 | 5 | |
| 6 | /// The header found at the start of each package. | |
| 6 | 7 | pub const HIIPackageHeader = packed struct { |
| 7 | 8 | length: u24, |
| 8 | 9 | type: u8, |
| ... | ... | @@ -22,8 +23,10 @@ pub const HIIPackageHeader = packed struct { |
| 22 | 23 | pub const type_system_end: u8 = 0xff; |
| 23 | 24 | }; |
| 24 | 25 | |
| 26 | /// The header found at the start of each package list. | |
| 25 | 27 | pub const HIIPackageList = extern struct { |
| 26 | 28 | package_list_guid: Guid, |
| 29 | /// The size of the package list (in bytes), including the header. | |
| 27 | 30 | package_list_length: u32, |
| 28 | 31 | |
| 29 | 32 | // TODO implement iterator |
lib/std/os/uefi/protocols/hii_database_protocol.zig+5| ... | ... | @@ -2,6 +2,7 @@ const uefi = @import("std").os.uefi; |
| 2 | 2 | const Guid = uefi.Guid; |
| 3 | 3 | const hii = uefi.protocols.hii; |
| 4 | 4 | |
| 5 | /// Database manager for HII-related data structures. | |
| 5 | 6 | pub const HIIDatabaseProtocol = extern struct { |
| 6 | 7 | _new_package_list: usize, // TODO |
| 7 | 8 | _remove_package_list: extern fn (*const HIIDatabaseProtocol, hii.HIIHandle) usize, |
| ... | ... | @@ -15,18 +16,22 @@ pub const HIIDatabaseProtocol = extern struct { |
| 15 | 16 | _set_keyboard_layout: usize, // TODO |
| 16 | 17 | _get_package_list_handle: usize, // TODO |
| 17 | 18 | |
| 19 | /// Removes a package list from the HII database. | |
| 18 | 20 | pub fn removePackageList(self: *const HIIDatabaseProtocol, handle: hii.HIIHandle) usize { |
| 19 | 21 | return self._remove_package_list(self, handle); |
| 20 | 22 | } |
| 21 | 23 | |
| 24 | /// Update a package list in the HII database. | |
| 22 | 25 | pub fn updatePackageList(self: *const HIIDatabaseProtocol, handle: hii.HIIHandle, buffer: *const hii.HIIPackageList) usize { |
| 23 | 26 | return self._update_package_list(self, handle, buffer); |
| 24 | 27 | } |
| 25 | 28 | |
| 29 | /// Determines the handles that are currently active in the database. | |
| 26 | 30 | pub fn listPackageLists(self: *const HIIDatabaseProtocol, package_type: u8, package_guid: ?*const Guid, buffer_length: *usize, handles: [*]hii.HIIHandle) usize { |
| 27 | 31 | return self._list_package_lists(self, package_type, package_guid, buffer_length, handles); |
| 28 | 32 | } |
| 29 | 33 | |
| 34 | /// Exports the contents of one or all package lists in the HII database into a buffer. | |
| 30 | 35 | pub fn exportPackageLists(self: *const HIIDatabaseProtocol, handle: ?hii.HIIHandle, buffer_size: *usize, buffer: *hii.HIIPackageList) usize { |
| 31 | 36 | return self._export_package_lists(self, handle, buffer_size, buffer); |
| 32 | 37 | } |
lib/std/os/uefi/protocols/hii_popup_protocol.zig+2| ... | ... | @@ -2,10 +2,12 @@ const uefi = @import("std").os.uefi; |
| 2 | 2 | const Guid = uefi.Guid; |
| 3 | 3 | const hii = uefi.protocols.hii; |
| 4 | 4 | |
| 5 | /// Display a popup window | |
| 5 | 6 | pub const HIIPopupProtocol = extern struct { |
| 6 | 7 | revision: u64, |
| 7 | 8 | _create_popup: extern fn (*const HIIPopupProtocol, HIIPopupStyle, HIIPopupType, hii.HIIHandle, u16, ?*HIIPopupSelection) usize, |
| 8 | 9 | |
| 10 | /// Displays a popup window. | |
| 9 | 11 | pub fn createPopup(self: *const HIIPopupProtocol, style: HIIPopupStyle, popup_type: HIIPopupType, handle: hii.HIIHandle, msg: u16, user_selection: ?*HIIPopupSelection) usize { |
| 10 | 12 | return self._create_popup(self, style, popup_type, handle, msg, user_selection); |
| 11 | 13 | } |
lib/std/os/uefi/protocols/rng_protocol.zig+3-1| ... | ... | @@ -1,15 +1,17 @@ |
| 1 | 1 | const uefi = @import("std").os.uefi; |
| 2 | 2 | const Guid = uefi.Guid; |
| 3 | 3 | |
| 4 | /// UEFI Specification, Version 2.8, 37.5 | |
| 4 | /// Random Number Generator protocol | |
| 5 | 5 | pub const RNGProtocol = extern struct { |
| 6 | 6 | _get_info: extern fn (*const RNGProtocol, *usize, [*]align(8) Guid) usize, |
| 7 | 7 | _get_rng: extern fn (*const RNGProtocol, ?*align(8) const Guid, usize, [*]u8) usize, |
| 8 | 8 | |
| 9 | /// Returns information about the random number generation implementation. | |
| 9 | 10 | pub fn getInfo(self: *const RNGProtocol, list_size: *usize, list: [*]align(8) Guid) usize { |
| 10 | 11 | return self._get_info(self, list_size, list); |
| 11 | 12 | } |
| 12 | 13 | |
| 14 | /// Produces and returns an RNG value using either the default or specified RNG algorithm. | |
| 13 | 15 | pub fn getRNG(self: *const RNGProtocol, algo: ?*align(8) const Guid, value_length: usize, value: [*]u8) usize { |
| 14 | 16 | return self._get_rng(self, algo, value_length, value); |
| 15 | 17 | } |
lib/std/os/uefi/protocols/simple_pointer_protocol.zig+3-1| ... | ... | @@ -2,17 +2,19 @@ const uefi = @import("std").os.uefi; |
| 2 | 2 | const Event = uefi.Event; |
| 3 | 3 | const Guid = uefi.Guid; |
| 4 | 4 | |
| 5 | /// UEFI Specification, Version 2.8, 12.5 | |
| 5 | /// Protocol for mice | |
| 6 | 6 | pub const SimplePointerProtocol = struct { |
| 7 | 7 | _reset: extern fn (*const SimplePointerProtocol, bool) usize, |
| 8 | 8 | _get_state: extern fn (*const SimplePointerProtocol, *SimplePointerState) usize, |
| 9 | 9 | wait_for_input: Event, |
| 10 | 10 | mode: *SimplePointerMode, |
| 11 | 11 | |
| 12 | /// Resets the pointer device hardware. | |
| 12 | 13 | pub fn reset(self: *const SimplePointerProtocol, verify: bool) usize { |
| 13 | 14 | return self._reset(self, verify); |
| 14 | 15 | } |
| 15 | 16 | |
| 17 | /// Retrieves the current state of a pointer device. | |
| 16 | 18 | pub fn getState(self: *const SimplePointerProtocol, state: *SimplePointerState) usize { |
| 17 | 19 | return self._get_state(self, state); |
| 18 | 20 | } |
lib/std/os/uefi/protocols/simple_text_input_ex_protocol.zig+6-1| ... | ... | @@ -2,7 +2,7 @@ const uefi = @import("std").os.uefi; |
| 2 | 2 | const Event = uefi.Event; |
| 3 | 3 | const Guid = uefi.Guid; |
| 4 | 4 | |
| 5 | /// UEFI Specification, Version 2.8, 12.3 | |
| 5 | /// Character input devices, e.g. Keyboard | |
| 6 | 6 | pub const SimpleTextInputExProtocol = extern struct { |
| 7 | 7 | _reset: extern fn (*const SimpleTextInputExProtocol, bool) usize, |
| 8 | 8 | _read_key_stroke_ex: extern fn (*const SimpleTextInputExProtocol, *KeyData) usize, |
| ... | ... | @@ -11,22 +11,27 @@ pub const SimpleTextInputExProtocol = extern struct { |
| 11 | 11 | _register_key_notify: extern fn (*const SimpleTextInputExProtocol, *const KeyData, extern fn (*const KeyData) usize, **c_void) usize, |
| 12 | 12 | _unregister_key_notify: extern fn (*const SimpleTextInputExProtocol, *const c_void) usize, |
| 13 | 13 | |
| 14 | /// Resets the input device hardware. | |
| 14 | 15 | pub fn reset(self: *const SimpleTextInputExProtocol, verify: bool) usize { |
| 15 | 16 | return self._reset(self, verify); |
| 16 | 17 | } |
| 17 | 18 | |
| 19 | /// Reads the next keystroke from the input device. | |
| 18 | 20 | pub fn readKeyStrokeEx(self: *const SimpleTextInputExProtocol, key_data: *KeyData) usize { |
| 19 | 21 | return self._read_key_stroke_ex(self, key_data); |
| 20 | 22 | } |
| 21 | 23 | |
| 24 | /// Set certain state for the input device. | |
| 22 | 25 | pub fn setState(self: *const SimpleTextInputExProtocol, state: *const u8) usize { |
| 23 | 26 | return self._set_state(self, state); |
| 24 | 27 | } |
| 25 | 28 | |
| 29 | /// Register a notification function for a particular keystroke for the input device. | |
| 26 | 30 | pub fn registerKeyNotify(self: *const SimpleTextInputExProtocol, key_data: *const KeyData, notify: extern fn (*const KeyData) usize, handle: **c_void) usize { |
| 27 | 31 | return self._register_key_notify(self, key_data, notify, handle); |
| 28 | 32 | } |
| 29 | 33 | |
| 34 | /// Remove the notification that was previously registered. | |
| 30 | 35 | pub fn unregisterKeyNotify(self: *const SimpleTextInputExProtocol, handle: *const c_void) usize { |
| 31 | 36 | return self._unregister_key_notify(self, handle); |
| 32 | 37 | } |
lib/std/os/uefi/protocols/simple_text_output_protocol.zig+10-1| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | const uefi = @import("std").os.uefi; |
| 2 | 2 | const Guid = uefi.Guid; |
| 3 | 3 | |
| 4 | /// UEFI Specification, Version 2.8, 12.4 | |
| 4 | /// Character output devices | |
| 5 | 5 | pub const SimpleTextOutputProtocol = extern struct { |
| 6 | 6 | _reset: extern fn (*const SimpleTextOutputProtocol, bool) usize, |
| 7 | 7 | _output_string: extern fn (*const SimpleTextOutputProtocol, [*]const u16) usize, |
| ... | ... | @@ -14,38 +14,47 @@ pub const SimpleTextOutputProtocol = extern struct { |
| 14 | 14 | _enable_cursor: extern fn (*const SimpleTextOutputProtocol, bool) usize, |
| 15 | 15 | mode: *SimpleTextOutputMode, |
| 16 | 16 | |
| 17 | /// Resets the text output device hardware. | |
| 17 | 18 | pub fn reset(self: *const SimpleTextOutputProtocol, verify: bool) usize { |
| 18 | 19 | return self._reset(self, verify); |
| 19 | 20 | } |
| 20 | 21 | |
| 22 | /// Writes a string to the output device. | |
| 21 | 23 | pub fn outputString(self: *const SimpleTextOutputProtocol, msg: [*]const u16) usize { |
| 22 | 24 | return self._output_string(self, msg); |
| 23 | 25 | } |
| 24 | 26 | |
| 27 | /// Verifies that all characters in a string can be output to the target device. | |
| 25 | 28 | pub fn testString(self: *const SimpleTextOutputProtocol, msg: [*]const u16) usize { |
| 26 | 29 | return self._test_string(self, msg); |
| 27 | 30 | } |
| 28 | 31 | |
| 32 | /// Returns information for an available text mode that the output device(s) supports. | |
| 29 | 33 | pub fn queryMode(self: *const SimpleTextOutputProtocol, mode_number: usize, columns: *usize, rows: *usize) usize { |
| 30 | 34 | return self._query_mode(self, mode_number, columns, rows); |
| 31 | 35 | } |
| 32 | 36 | |
| 37 | /// Sets the output device(s) to a specified mode. | |
| 33 | 38 | pub fn setMode(self: *const SimpleTextOutputProtocol, mode_number: usize) usize { |
| 34 | 39 | return self._set_mode(self, mode_number); |
| 35 | 40 | } |
| 36 | 41 | |
| 42 | /// Sets the background and foreground colors for the outputString() and clearScreen() functions. | |
| 37 | 43 | pub fn setAttribute(self: *const SimpleTextOutputProtocol, attribute: usize) usize { |
| 38 | 44 | return self._set_attribute(self, attribute); |
| 39 | 45 | } |
| 40 | 46 | |
| 47 | /// Clears the output device(s) display to the currently selected background color. | |
| 41 | 48 | pub fn clearScreen(self: *const SimpleTextOutputProtocol) usize { |
| 42 | 49 | return self._clear_screen(self); |
| 43 | 50 | } |
| 44 | 51 | |
| 52 | /// Sets the current coordinates of the cursor position. | |
| 45 | 53 | pub fn setCursorPosition(self: *const SimpleTextOutputProtocol, column: usize, row: usize) usize { |
| 46 | 54 | return self._set_cursor_position(self, column, row); |
| 47 | 55 | } |
| 48 | 56 | |
| 57 | /// Makes the cursor visible or invisible. | |
| 49 | 58 | pub fn enableCursor(self: *const SimpleTextOutputProtocol, visible: bool) usize { |
| 50 | 59 | return self._enable_cursor(self, visible); |
| 51 | 60 | } |
lib/std/os/uefi/status.zig+41-1| ... | ... | @@ -1,46 +1,86 @@ |
| 1 | 1 | const high_bit = 1 << @typeInfo(usize).Int.bits - 1; |
| 2 | 2 | |
| 3 | /// UEFI Specification, Version 2.8, Appendix D | |
| 3 | /// The operation completed successfully. | |
| 4 | 4 | pub const success: usize = 0; |
| 5 | 5 | |
| 6 | /// The image failed to load. | |
| 6 | 7 | pub const load_error: usize = high_bit | 1; |
| 8 | /// A parameter was incorrect. | |
| 7 | 9 | pub const invalid_parameter: usize = high_bit | 2; |
| 10 | /// The operation is not supported. | |
| 8 | 11 | pub const unsupported: usize = high_bit | 3; |
| 12 | /// The buffer was not the proper size for the request. | |
| 9 | 13 | pub const bad_buffer_size: usize = high_bit | 4; |
| 14 | /// 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. | |
| 10 | 15 | pub const buffer_too_small: usize = high_bit | 5; |
| 16 | /// There is no data pending upon return. | |
| 11 | 17 | pub const not_ready: usize = high_bit | 6; |
| 18 | /// The physical device reported an error while attempting the operation. | |
| 12 | 19 | pub const device_error: usize = high_bit | 7; |
| 20 | /// The device cannot be written to. | |
| 13 | 21 | pub const write_protected: usize = high_bit | 8; |
| 22 | /// A resource has run out. | |
| 14 | 23 | pub const out_of_resources: usize = high_bit | 9; |
| 24 | /// An inconstancy was detected on the file system causing the operating to fail. | |
| 15 | 25 | pub const volume_corrupted: usize = high_bit | 10; |
| 26 | /// There is no more space on the file system. | |
| 16 | 27 | pub const volume_full: usize = high_bit | 11; |
| 28 | /// The device does not contain any medium to perform the operation. | |
| 17 | 29 | pub const no_media: usize = high_bit | 12; |
| 30 | /// The medium in the device has changed since the last access. | |
| 18 | 31 | pub const media_changed: usize = high_bit | 13; |
| 32 | /// The item was not found. | |
| 19 | 33 | pub const not_found: usize = high_bit | 14; |
| 34 | /// Access was denied. | |
| 20 | 35 | pub const access_denied: usize = high_bit | 15; |
| 36 | /// The server was not found or did not respond to the request. | |
| 21 | 37 | pub const no_response: usize = high_bit | 16; |
| 38 | /// A mapping to a device does not exist. | |
| 22 | 39 | pub const no_mapping: usize = high_bit | 17; |
| 40 | /// The timeout time expired. | |
| 23 | 41 | pub const timeout: usize = high_bit | 18; |
| 42 | /// The protocol has not been started. | |
| 24 | 43 | pub const not_started: usize = high_bit | 19; |
| 44 | /// The protocol has already been started. | |
| 25 | 45 | pub const already_started: usize = high_bit | 20; |
| 46 | /// The operation was aborted. | |
| 26 | 47 | pub const aborted: usize = high_bit | 21; |
| 48 | /// An ICMP error occurred during the network operation. | |
| 27 | 49 | pub const icmp_error: usize = high_bit | 22; |
| 50 | /// A TFTP error occurred during the network operation. | |
| 28 | 51 | pub const tftp_error: usize = high_bit | 23; |
| 52 | /// A protocol error occurred during the network operation. | |
| 29 | 53 | pub const protocol_error: usize = high_bit | 24; |
| 54 | /// The function encountered an internal version that was incompatible with a version requested by the caller. | |
| 30 | 55 | pub const incompatible_version: usize = high_bit | 25; |
| 56 | /// The function was not performed due to a security violation. | |
| 31 | 57 | pub const security_violation: usize = high_bit | 26; |
| 58 | /// A CRC error was detected. | |
| 32 | 59 | pub const crc_error: usize = high_bit | 27; |
| 60 | /// Beginning or end of media was reached | |
| 33 | 61 | pub const end_of_media: usize = high_bit | 28; |
| 62 | /// The end of the file was reached. | |
| 34 | 63 | pub const end_of_file: usize = high_bit | 31; |
| 64 | /// The language specified was invalid. | |
| 35 | 65 | pub const invalid_language: usize = high_bit | 32; |
| 66 | /// The security status of the data is unknown or compromised and the data must be updated or replaced to restore a valid security status. | |
| 36 | 67 | pub const compromised_data: usize = high_bit | 33; |
| 68 | /// There is an address conflict address allocation | |
| 37 | 69 | pub const ip_address_conflict: usize = high_bit | 34; |
| 70 | /// A HTTP error occurred during the network operation. | |
| 38 | 71 | pub const http_error: usize = high_bit | 35; |
| 39 | 72 | |
| 73 | /// The string contained one or more characters that the device could not render and were skipped. | |
| 40 | 74 | pub const warn_unknown_glyph: usize = 1; |
| 75 | /// The handle was closed, but the file was not deleted. | |
| 41 | 76 | pub const warn_delete_failure: usize = 2; |
| 77 | /// The handle was closed, but the data to the file was not flushed properly. | |
| 42 | 78 | pub const warn_write_failure: usize = 3; |
| 79 | /// The resulting buffer was too small, and the data was truncated to the buffer size. | |
| 43 | 80 | pub const warn_buffer_too_small: usize = 4; |
| 81 | /// The data has not been updated within the timeframe set by localpolicy for this type of data. | |
| 44 | 82 | pub const warn_stale_data: usize = 5; |
| 83 | /// The resulting buffer contains UEFI-compliant file system. | |
| 45 | 84 | pub const warn_file_system: usize = 6; |
| 85 | /// The operation will be processed across a system reset. | |
| 46 | 86 | pub const warn_reset_required: usize = 7; |
lib/std/os/uefi/tables/boot_services.zig+17-4| ... | ... | @@ -4,29 +4,37 @@ const Guid = uefi.Guid; |
| 4 | 4 | const Handle = uefi.Handle; |
| 5 | 5 | const TableHeader = uefi.tables.TableHeader; |
| 6 | 6 | |
| 7 | /// UEFI Specification, Version 2.8, 4.4 | |
| 8 | /// | |
| 9 | /// As the boot_services table may grow with new UEFI versions, it is important to check hdr.header_size. | |
| 7 | /// Boot services are services provided by the system's firmware until the operating system takes | |
| 8 | /// over control over the hardware by calling exitBootServices. | |
| 10 | 9 | /// |
| 11 | 10 | /// Boot Services must not be used after exitBootServices has been called. The only exception is |
| 12 | 11 | /// getMemoryMap, which may be used after the first unsuccessful call to exitBootServices. |
| 13 | 12 | /// After successfully calling exitBootServices, system_table.console_in_handle, system_table.con_in, |
| 14 | 13 | /// system_table.console_out_handle, system_table.con_out, system_table.standard_error_handle, |
| 15 | 14 | /// system_table.std_err, and system_table.boot_services should be set to null. After setting these |
| 16 | /// attributes to null, system_table.hdr.crc32 must be recomputed. See UEFI Specification, Version 2.8, 7.4. | |
| 15 | /// attributes to null, system_table.hdr.crc32 must be recomputed. | |
| 16 | /// | |
| 17 | /// As the boot_services table may grow with new UEFI versions, it is important to check hdr.header_size. | |
| 17 | 18 | pub const BootServices = extern struct { |
| 18 | 19 | hdr: TableHeader, |
| 19 | 20 | raiseTpl: usize, // TODO |
| 20 | 21 | restoreTpl: usize, // TODO |
| 21 | 22 | allocatePages: usize, // TODO |
| 22 | 23 | freePages: usize, // TODO |
| 24 | /// Returns the current memory map. | |
| 23 | 25 | getMemoryMap: extern fn (*usize, [*]MemoryDescriptor, *usize, *usize, *u32) usize, |
| 26 | /// Allocates pool memory. | |
| 24 | 27 | allocatePool: extern fn (MemoryType, usize, *align(8) [*]u8) usize, |
| 25 | 28 | freePool: usize, // TODO |
| 29 | /// Creates an event. | |
| 26 | 30 | createEvent: extern fn (u32, usize, ?extern fn (Event, ?*const c_void) void, ?*const c_void, *Event) usize, |
| 31 | /// Sets the type of timer and the trigger time for a timer event. | |
| 27 | 32 | setTimer: extern fn (Event, TimerDelay, u64) usize, |
| 33 | /// Stops execution until an event is signaled. | |
| 28 | 34 | waitForEvent: extern fn (usize, [*]const Event, *usize) usize, |
| 35 | /// Signals an event. | |
| 29 | 36 | signalEvent: extern fn (Event) usize, |
| 37 | /// Closes an event. | |
| 30 | 38 | closeEvent: extern fn (Event) usize, |
| 31 | 39 | checkEvent: usize, // TODO |
| 32 | 40 | installProtocolInterface: usize, // TODO |
| ... | ... | @@ -40,11 +48,15 @@ pub const BootServices = extern struct { |
| 40 | 48 | installConfigurationTable: usize, // TODO |
| 41 | 49 | imageLoad: usize, // TODO |
| 42 | 50 | imageStart: usize, // TODO |
| 51 | /// Terminates a loaded EFI image and returns control to boot services. | |
| 43 | 52 | exit: extern fn (Handle, usize, usize, ?*const c_void) usize, |
| 44 | 53 | imageUnload: usize, // TODO |
| 54 | /// Terminates all boot services. | |
| 45 | 55 | exitBootServices: extern fn (Handle, usize) usize, |
| 46 | 56 | getNextMonotonicCount: usize, // TODO |
| 57 | /// Induces a fine-grained stall. | |
| 47 | 58 | stall: extern fn (usize) usize, |
| 59 | /// Sets the system's watchdog timer. | |
| 48 | 60 | setWatchdogTimer: extern fn (usize, u64, usize, ?[*]const u16) usize, |
| 49 | 61 | connectController: usize, // TODO |
| 50 | 62 | disconnectController: usize, // TODO |
| ... | ... | @@ -53,6 +65,7 @@ pub const BootServices = extern struct { |
| 53 | 65 | openProtocolInformation: usize, // TODO |
| 54 | 66 | protocolsPerHandle: usize, // TODO |
| 55 | 67 | locateHandleBuffer: usize, // TODO |
| 68 | /// Returns the first protocol instance that matches the given protocol. | |
| 56 | 69 | locateProtocol: extern fn (*align(8) const Guid, ?*const c_void, *?*c_void) usize, |
| 57 | 70 | installMultipleProtocolInterfaces: usize, // TODO |
| 58 | 71 | uninstallMultipleProtocolInterfaces: usize, // TODO |
lib/std/os/uefi/tables/configuration_table.zig-2| ... | ... | @@ -1,8 +1,6 @@ |
| 1 | 1 | const uefi = @import("std").os.uefi; |
| 2 | 2 | const Guid = uefi.Guid; |
| 3 | 3 | |
| 4 | /// UEFI Specification, Version 2.8, 4.6 | |
| 5 | /// Because GUIDs must be align(8), structs of this type also must be align(8) | |
| 6 | 4 | pub const ConfigurationTable = extern struct { |
| 7 | 5 | vendor_guid: Guid, |
| 8 | 6 | vendor_table: *c_void, |
lib/std/os/uefi/tables/runtime_services.zig+8-5| ... | ... | @@ -4,26 +4,31 @@ const TableHeader = uefi.tables.TableHeader; |
| 4 | 4 | const Time = uefi.Time; |
| 5 | 5 | const TimeCapabilities = uefi.TimeCapabilities; |
| 6 | 6 | |
| 7 | /// UEFI Specification, Version 2.8, 4.5 | |
| 7 | /// Runtime services are provided by the firmware before and after exitBootServices has been called. | |
| 8 | 8 | /// |
| 9 | 9 | /// As the runtime_services table may grow with new UEFI versions, it is important to check hdr.header_size. |
| 10 | 10 | /// |
| 11 | 11 | /// Some functions may not be supported. Check the RuntimeServicesSupported variable using getVariable. |
| 12 | /// getVariable is one of the functions that may not be supported. See UEFI Specification, Version 2.8, 8.1. | |
| 12 | /// getVariable is one of the functions that may not be supported. | |
| 13 | 13 | /// |
| 14 | /// Some functions may not be called while other functions are running. See UEFI Specification, Version 2.8, 8.1. | |
| 14 | /// Some functions may not be called while other functions are running. | |
| 15 | 15 | pub const RuntimeServices = extern struct { |
| 16 | 16 | hdr: TableHeader, |
| 17 | /// Returns the current time and date information, and the time-keeping capabilities of the hardware platform. | |
| 17 | 18 | getTime: extern fn (*uefi.Time, ?*TimeCapabilities) usize, |
| 18 | 19 | setTime: usize, // TODO |
| 19 | 20 | getWakeupTime: usize, // TODO |
| 20 | 21 | setWakeupTime: usize, // TODO |
| 21 | 22 | setVirtualAddressMap: usize, // TODO |
| 22 | 23 | convertPointer: usize, // TODO |
| 24 | /// Returns the value of a variable. | |
| 23 | 25 | getVariable: extern fn ([*]const u16, *align(8) const Guid, ?*u32, *usize, ?*c_void) usize, |
| 26 | /// Enumerates the current variable names. | |
| 24 | 27 | getNextVariableName: extern fn (*usize, [*]u16, *align(8) Guid) usize, |
| 28 | /// Sets the value of a variable. | |
| 25 | 29 | setVariable: extern fn ([*]const u16, *align(8) const Guid, u32, usize, *c_void) usize, |
| 26 | 30 | getNextHighMonotonicCount: usize, // TODO |
| 31 | /// Resets the entire platform. | |
| 27 | 32 | resetSystem: extern fn (ResetType, usize, usize, ?*const c_void) noreturn, |
| 28 | 33 | updateCapsule: usize, // TODO |
| 29 | 34 | queryCapsuleCapabilities: usize, // TODO |
| ... | ... | @@ -32,7 +37,6 @@ pub const RuntimeServices = extern struct { |
| 32 | 37 | pub const signature: u64 = 0x56524553544e5552; |
| 33 | 38 | }; |
| 34 | 39 | |
| 35 | /// UEFI Specification, Version 2.8, 8.5.1 | |
| 36 | 40 | pub const ResetType = extern enum(u32) { |
| 37 | 41 | ResetCold, |
| 38 | 42 | ResetWarm, |
| ... | ... | @@ -40,7 +44,6 @@ pub const ResetType = extern enum(u32) { |
| 40 | 44 | ResetPlatformSpecific, |
| 41 | 45 | }; |
| 42 | 46 | |
| 43 | /// UEFI Specification, Version 2.8, 3.3 | |
| 44 | 47 | pub const global_variable align(8) = Guid{ |
| 45 | 48 | .time_low = 0x8be4df61, |
| 46 | 49 | .time_mid = 0x93ca, |
lib/std/os/uefi/tables/system_table.zig+4-3| ... | ... | @@ -7,17 +7,18 @@ const SimpleTextInputExProtocol = uefi.protocols.SimpleTextInputExProtocol; |
| 7 | 7 | const SimpleTextOutputProtocol = uefi.protocols.SimpleTextOutputProtocol; |
| 8 | 8 | const TableHeader = uefi.tables.TableHeader; |
| 9 | 9 | |
| 10 | /// UEFI Specification, Version 2.8, 4.3 | |
| 10 | /// The EFI System Table contains pointers to the runtime and boot services tables. | |
| 11 | 11 | /// |
| 12 | 12 | /// As the system_table may grow with new UEFI versions, it is important to check hdr.header_size. |
| 13 | 13 | /// |
| 14 | 14 | /// After successfully calling boot_services.exitBootServices, console_in_handle, |
| 15 | 15 | /// con_in, console_out_handle, con_out, standard_error_handle, std_err, and |
| 16 | 16 | /// boot_services should be set to null. After setting these attributes to null, |
| 17 | /// hdr.crc32 must be recomputed. See UEFI Specification, Version 2.8, 7.4. | |
| 17 | /// hdr.crc32 must be recomputed. | |
| 18 | 18 | pub const SystemTable = extern struct { |
| 19 | 19 | hdr: TableHeader, |
| 20 | firmware_vendor: *u16, | |
| 20 | /// A null-terminated string that identifies the vendor that produces the system firmware of the platform. | |
| 21 | firmware_vendor: [*]u16, | |
| 21 | 22 | firmware_revision: u32, |
| 22 | 23 | console_in_handle: ?Handle, |
| 23 | 24 | con_in: ?*SimpleTextInputExProtocol, |
lib/std/os/uefi/tables/table_header.zig+1-1| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | /// UEFI Specification, Version 2.8, 4.2 | |
| 2 | 1 | pub const TableHeader = extern struct { |
| 3 | 2 | signature: u64, |
| 4 | 3 | revision: u32, |
| 4 | /// The size, in bytes, of the entire table including the TableHeader | |
| 5 | 5 | header_size: u32, |
| 6 | 6 | crc32: u32, |
| 7 | 7 | reserved: u32, |