| author | |
| committer | |
| log | 3ded862cdf4cec619aea95b595103b72dd23c401 |
| tree | b2ca039f85c4d255c3e42b0168ca44d2b33721b1 |
| parent | 895f67cc6dfe3ade4b635c4c2168843b022edee7 |
| parent | 58941927c426f61a6680348e4380f9f4eed3e8a8 |
| signature |
UEFI library improvements4 files changed, 115 insertions(+), 2 deletions(-)
lib/std/os/uefi/protocols.zig+4| ... | @@ -2,6 +2,10 @@ pub const LoadedImageProtocol = @import("protocols/loaded_image_protocol.zig").L | ... | @@ -2,6 +2,10 @@ pub const LoadedImageProtocol = @import("protocols/loaded_image_protocol.zig").L |
| 2 | 2 | ||
| 3 | pub const DevicePathProtocol = @import("protocols/device_path_protocol.zig").DevicePathProtocol; | 3 | pub const DevicePathProtocol = @import("protocols/device_path_protocol.zig").DevicePathProtocol; |
| 4 | 4 | ||
| 5 | pub const SimpleFileSystemProtocol = @import("protocols/simple_file_system_protocol.zig").SimpleFileSystemProtocol; | ||
| 6 | pub const FileProtocol = @import("protocols/file_protocol.zig").FileProtocol; | ||
| 7 | pub const FileInfo = @import("protocols/file_protocol.zig").FileInfo; | ||
| 8 | |||
| 5 | pub const InputKey = @import("protocols/simple_text_input_ex_protocol.zig").InputKey; | 9 | pub const InputKey = @import("protocols/simple_text_input_ex_protocol.zig").InputKey; |
| 6 | pub const KeyData = @import("protocols/simple_text_input_ex_protocol.zig").KeyData; | 10 | pub const KeyData = @import("protocols/simple_text_input_ex_protocol.zig").KeyData; |
| 7 | pub const KeyState = @import("protocols/simple_text_input_ex_protocol.zig").KeyState; | 11 | pub const KeyState = @import("protocols/simple_text_input_ex_protocol.zig").KeyState; |
lib/std/os/uefi/protocols/file_protocol.zig created+87| ... | @@ -0,0 +1,87 @@ | ||
| 1 | const uefi = @import("std").os.uefi; | ||
| 2 | const Guid = uefi.Guid; | ||
| 3 | const Time = uefi.Time; | ||
| 4 | |||
| 5 | const FileProtocol = extern struct { | ||
| 6 | 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, | ||
| 15 | |||
| 16 | pub fn open(self: *const FileProtocol, new_handle: **const FileProtocol, file_name: *u16, open_mode: u64, attributes: u64) usize { | ||
| 17 | return self._open(self, new_handle, file_name, open_mode, attributes); | ||
| 18 | } | ||
| 19 | |||
| 20 | pub fn close(self: *const FileProtocol) usize { | ||
| 21 | return self._close(self); | ||
| 22 | } | ||
| 23 | |||
| 24 | pub fn delete(self: *const FileProtocol) usize { | ||
| 25 | return self._delete(self); | ||
| 26 | } | ||
| 27 | |||
| 28 | pub fn read(self: *const FileProtocol, buffer_size: *usize, buffer: *c_void) usize { | ||
| 29 | return self._read(self, buffer_size, buffer); | ||
| 30 | } | ||
| 31 | |||
| 32 | pub fn write(self: *const FileProtocol, buffer_size: *usize, buffer: *c_void) usize { | ||
| 33 | return self._write(self, buffer_size, buffer); | ||
| 34 | } | ||
| 35 | |||
| 36 | pub fn get_info(self: *const FileProtocol, information_type: *Guid, buffer_size: *usize, buffer: *c_void) usize { | ||
| 37 | return self._get_info(self, information_type, buffer_size, buffer); | ||
| 38 | } | ||
| 39 | |||
| 40 | pub fn set_info(self: *const FileProtocol, information_type: *Guid, buffer_size: usize, buffer: *c_void) usize { | ||
| 41 | return self._set_info(self, information_type, buffer_size, buffer); | ||
| 42 | } | ||
| 43 | |||
| 44 | pub fn flush(self: *const FileProtocol) usize { | ||
| 45 | return self._flush(self); | ||
| 46 | } | ||
| 47 | |||
| 48 | pub const guid align(8) = Guid{ | ||
| 49 | .time_low = 0x09576e92, | ||
| 50 | .time_mid = 0x6d3f, | ||
| 51 | .time_high_and_version = 0x11d2, | ||
| 52 | .clock_seq_high_and_reserved = 0x8e, | ||
| 53 | .clock_seq_low = 0x39, | ||
| 54 | .node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b }, | ||
| 55 | }; | ||
| 56 | |||
| 57 | pub const efi_file_mode_read: u64 = 0x0000000000000001; | ||
| 58 | pub const efi_file_mode_write: u64 = 0x0000000000000002; | ||
| 59 | pub const efi_file_mode_create: u64 = 0x8000000000000000; | ||
| 60 | |||
| 61 | pub const efi_file_read_only: u64 = 0x0000000000000001; | ||
| 62 | pub const efi_file_hidden: u64 = 0x0000000000000002; | ||
| 63 | pub const efi_file_system: u64 = 0x0000000000000004; | ||
| 64 | pub const efi_file_reserved: u64 = 0x0000000000000008; | ||
| 65 | pub const efi_file_directory: u64 = 0x0000000000000010; | ||
| 66 | pub const efi_file_archive: u64 = 0x0000000000000020; | ||
| 67 | pub const efi_file_valid_attr: u64 = 0x0000000000000037; | ||
| 68 | }; | ||
| 69 | |||
| 70 | const FileInfo = extern struct { | ||
| 71 | size: u64, | ||
| 72 | file_size: u64, | ||
| 73 | physical_size: u64, | ||
| 74 | create_time: Time, | ||
| 75 | last_access_time: Time, | ||
| 76 | modification_time: Time, | ||
| 77 | attribute: u64, | ||
| 78 | file_name: [100:0]u16, | ||
| 79 | |||
| 80 | pub const efi_file_read_only: u64 = 0x0000000000000001; | ||
| 81 | pub const efi_file_hidden: u64 = 0x0000000000000002; | ||
| 82 | pub const efi_file_system: u64 = 0x0000000000000004; | ||
| 83 | pub const efi_file_reserved: u64 = 0x0000000000000008; | ||
| 84 | pub const efi_file_directory: u64 = 0x0000000000000010; | ||
| 85 | pub const efi_file_archive: u64 = 0x0000000000000020; | ||
| 86 | pub const efi_file_valid_attr: u64 = 0x0000000000000037; | ||
| 87 | }; | ||
lib/std/os/uefi/protocols/simple_file_system_protocol.zig created+21| ... | @@ -0,0 +1,21 @@ | ||
| 1 | const uefi = @import("std").os.uefi; | ||
| 2 | const Guid = uefi.Guid; | ||
| 3 | const FileProtocol = uefi.protocols.FileProtocol; | ||
| 4 | |||
| 5 | const SimpleFileSystemProtocol = extern struct { | ||
| 6 | revision: u64, | ||
| 7 | _open_volume: extern fn (*const SimpleFileSystemProtocol, **const FileProtocol) usize, | ||
| 8 | |||
| 9 | pub fn openVolume(self: *const SimpleFileSystemProtocol, root: **const FileProtocol) usize { | ||
| 10 | return self._open_volume(self, root); | ||
| 11 | } | ||
| 12 | |||
| 13 | pub const guid align(8) = Guid{ | ||
| 14 | .time_low = 0x0964e5b22, | ||
| 15 | .time_mid = 0x6459, | ||
| 16 | .time_high_and_version = 0x11d2, | ||
| 17 | .clock_seq_high_and_reserved = 0x8e, | ||
| 18 | .clock_seq_low = 0x39, | ||
| 19 | .node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b }, | ||
| 20 | }; | ||
| 21 | }; | ||
lib/std/os/uefi/protocols/simple_text_input_protocol.zig+3-2| ... | @@ -1,11 +1,12 @@ | ... | @@ -1,11 +1,12 @@ |
| 1 | const uefi = @import("std").os.uefi; | 1 | const uefi = @import("std").os.uefi; |
| 2 | const Event = uefi.Event; | 2 | const Event = uefi.Event; |
| 3 | const Guid = uefi.Guid; | 3 | const Guid = uefi.Guid; |
| 4 | const InputKey = uefi.protocols.InputKey; | ||
| 4 | 5 | ||
| 5 | /// Character input devices, e.g. Keyboard | 6 | /// Character input devices, e.g. Keyboard |
| 6 | pub const SimpleTextInputProtocol = extern struct { | 7 | pub const SimpleTextInputProtocol = extern struct { |
| 7 | _reset: extern fn (*const SimpleTextInputProtocol, bool) usize, | 8 | _reset: extern fn (*const SimpleTextInputProtocol, bool) usize, |
| 8 | _read_key_stroke: extern fn (*const SimpleTextInputProtocol, *uefi.protocols.InputKey) usize, | 9 | _read_key_stroke: extern fn (*const SimpleTextInputProtocol, *InputKey) usize, |
| 9 | wait_for_key: Event, | 10 | wait_for_key: Event, |
| 10 | 11 | ||
| 11 | /// Resets the input device hardware. | 12 | /// Resets the input device hardware. |
| ... | @@ -14,7 +15,7 @@ pub const SimpleTextInputProtocol = extern struct { | ... | @@ -14,7 +15,7 @@ pub const SimpleTextInputProtocol = extern struct { |
| 14 | } | 15 | } |
| 15 | 16 | ||
| 16 | /// Reads the next keystroke from the input device. | 17 | /// Reads the next keystroke from the input device. |
| 17 | pub fn readKeyStroke(self: *const SimpleTextInputProtocol, input_key: *uefi.protocols.InputKey) usize { | 18 | pub fn readKeyStroke(self: *const SimpleTextInputProtocol, input_key: *InputKey) usize { |
| 18 | return self._read_key_stroke(self, input_key); | 19 | return self._read_key_stroke(self, input_key); |
| 19 | } | 20 | } |
| 20 | 21 |