authorgravatar for mail@linusgroh.deLinus Groh <mail@linusgroh.de> 2025-02-09 08:03:54+00:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2025-02-09 08:03:54+00:00
log0af492a2725d5be526dd2418f6526bd23877fd3c
tree75963b8a7756d4af1bbf6e9360270bbac25fb827
parent604ed5281c7eef6105a75bd8819399c73570b88a
parent0660f5b5213d90a22be0df3583945fb69d566615
signaturebadge-check Signed by PGP key B5690EEEBB952194

Merge pull request #22820 from linusg/uefi-tweaks


23 files changed, 324 insertions(+), 280 deletions(-)

lib/std/Target.zig+1-1
......@@ -597,7 +597,7 @@ pub const Os = struct {
597597 .uefi => .{
598598 .semver = .{
599599 .min = .{ .major = 2, .minor = 0, .patch = 0 },
600 .max = .{ .major = 2, .minor = 9, .patch = 0 },
600 .max = .{ .major = 2, .minor = 11, .patch = 0 },
601601 },
602602 },
603603
lib/std/debug.zig+1-1
......@@ -611,7 +611,7 @@ pub fn defaultPanic(
611611 // ExitData buffer must be allocated using boot_services.allocatePool (spec: page 220)
612612 const exit_data: []u16 = uefi.raw_pool_allocator.alloc(u16, exit_msg.len + 1) catch @trap();
613613 @memcpy(exit_data, exit_msg[0..exit_data.len]); // Includes null terminator.
614 _ = bs.exit(uefi.handle, .Aborted, exit_data.len, exit_data.ptr);
614 _ = bs.exit(uefi.handle, .aborted, exit_data.len, exit_data.ptr);
615615 }
616616 @trap();
617617 },
lib/std/os/uefi.zig+3-3
......@@ -9,10 +9,10 @@ pub const hii = @import("uefi/hii.zig");
99pub const Status = @import("uefi/status.zig").Status;
1010pub const tables = @import("uefi/tables.zig");
1111
12/// The memory type to allocate when using the pool
13/// Defaults to .LoaderData, the default data allocation type
12/// The memory type to allocate when using the pool.
13/// Defaults to `.loader_data`, the default data allocation type
1414/// used by UEFI applications to allocate pool memory.
15pub var efi_pool_memory_type: tables.MemoryType = .LoaderData;
15pub var efi_pool_memory_type: tables.MemoryType = .loader_data;
1616pub const pool_allocator = @import("uefi/pool_allocator.zig").pool_allocator;
1717pub const raw_pool_allocator = @import("uefi/pool_allocator.zig").raw_pool_allocator;
1818
lib/std/os/uefi/device_path.zig+86-86
......@@ -230,56 +230,56 @@ pub const DevicePath = union(Type) {
230230 };
231231
232232 pub const Messaging = union(Subtype) {
233 Atapi: *const AtapiDevicePath,
234 Scsi: *const ScsiDevicePath,
235 FibreChannel: *const FibreChannelDevicePath,
236 FibreChannelEx: *const FibreChannelExDevicePath,
233 atapi: *const AtapiDevicePath,
234 scsi: *const ScsiDevicePath,
235 fibre_channel: *const FibreChannelDevicePath,
236 fibre_channel_ex: *const FibreChannelExDevicePath,
237237 @"1394": *const F1394DevicePath,
238 Usb: *const UsbDevicePath,
239 Sata: *const SataDevicePath,
240 UsbWwid: *const UsbWwidDevicePath,
241 Lun: *const DeviceLogicalUnitDevicePath,
242 UsbClass: *const UsbClassDevicePath,
243 I2o: *const I2oDevicePath,
244 MacAddress: *const MacAddressDevicePath,
245 Ipv4: *const Ipv4DevicePath,
246 Ipv6: *const Ipv6DevicePath,
247 Vlan: *const VlanDevicePath,
248 InfiniBand: *const InfiniBandDevicePath,
249 Uart: *const UartDevicePath,
250 Vendor: *const VendorDefinedDevicePath,
238 usb: *const UsbDevicePath,
239 sata: *const SataDevicePath,
240 usb_wwid: *const UsbWwidDevicePath,
241 lun: *const DeviceLogicalUnitDevicePath,
242 usb_class: *const UsbClassDevicePath,
243 i2o: *const I2oDevicePath,
244 mac_address: *const MacAddressDevicePath,
245 ipv4: *const Ipv4DevicePath,
246 ipv6: *const Ipv6DevicePath,
247 vlan: *const VlanDevicePath,
248 infini_band: *const InfiniBandDevicePath,
249 uart: *const UartDevicePath,
250 vendor: *const VendorDefinedDevicePath,
251251
252252 pub const Subtype = enum(u8) {
253 Atapi = 1,
254 Scsi = 2,
255 FibreChannel = 3,
256 FibreChannelEx = 21,
253 atapi = 1,
254 scsi = 2,
255 fibre_channel = 3,
256 fibre_channel_ex = 21,
257257 @"1394" = 4,
258 Usb = 5,
259 Sata = 18,
260 UsbWwid = 16,
261 Lun = 17,
262 UsbClass = 15,
263 I2o = 6,
264 MacAddress = 11,
265 Ipv4 = 12,
266 Ipv6 = 13,
267 Vlan = 20,
268 InfiniBand = 9,
269 Uart = 14,
270 Vendor = 10,
258 usb = 5,
259 sata = 18,
260 usb_wwid = 16,
261 lun = 17,
262 usb_class = 15,
263 i2o = 6,
264 mac_address = 11,
265 ipv4 = 12,
266 ipv6 = 13,
267 vlan = 20,
268 infini_band = 9,
269 uart = 14,
270 vendor = 10,
271271 _,
272272 };
273273
274274 pub const AtapiDevicePath = extern struct {
275 const Role = enum(u8) {
276 Master = 0,
277 Slave = 1,
275 pub const Role = enum(u8) {
276 master = 0,
277 slave = 1,
278278 };
279279
280 const Rank = enum(u8) {
281 Primary = 0,
282 Secondary = 1,
280 pub const Rank = enum(u8) {
281 primary = 0,
282 secondary = 1,
283283 };
284284
285285 type: DevicePath.Type,
......@@ -528,8 +528,8 @@ pub const DevicePath = union(Type) {
528528
529529 pub const Ipv4DevicePath = extern struct {
530530 pub const IpType = enum(u8) {
531 Dhcp = 0,
532 Static = 1,
531 dhcp = 0,
532 static = 1,
533533 };
534534
535535 type: DevicePath.Type,
......@@ -564,9 +564,9 @@ pub const DevicePath = union(Type) {
564564
565565 pub const Ipv6DevicePath = extern struct {
566566 pub const Origin = enum(u8) {
567 Manual = 0,
568 AssignedStateless = 1,
569 AssignedStateful = 2,
567 manual = 0,
568 assigned_stateless = 1,
569 assigned_stateful = 2,
570570 };
571571
572572 type: DevicePath.Type,
......@@ -619,8 +619,8 @@ pub const DevicePath = union(Type) {
619619 pub const InfiniBandDevicePath = extern struct {
620620 pub const ResourceFlags = packed struct(u32) {
621621 pub const ControllerType = enum(u1) {
622 Ioc = 0,
623 Service = 1,
622 ioc = 0,
623 service = 1,
624624 };
625625
626626 ioc_or_service: ControllerType,
......@@ -659,20 +659,20 @@ pub const DevicePath = union(Type) {
659659
660660 pub const UartDevicePath = extern struct {
661661 pub const Parity = enum(u8) {
662 Default = 0,
663 None = 1,
664 Even = 2,
665 Odd = 3,
666 Mark = 4,
667 Space = 5,
662 default = 0,
663 none = 1,
664 even = 2,
665 odd = 3,
666 mark = 4,
667 space = 5,
668668 _,
669669 };
670670
671671 pub const StopBits = enum(u8) {
672 Default = 0,
673 One = 1,
674 OneAndAHalf = 2,
675 Two = 3,
672 default = 0,
673 one = 1,
674 one_and_a_half = 2,
675 two = 3,
676676 _,
677677 };
678678
......@@ -719,40 +719,40 @@ pub const DevicePath = union(Type) {
719719 };
720720
721721 pub const Media = union(Subtype) {
722 HardDrive: *const HardDriveDevicePath,
723 Cdrom: *const CdromDevicePath,
724 Vendor: *const VendorDevicePath,
725 FilePath: *const FilePathDevicePath,
726 MediaProtocol: *const MediaProtocolDevicePath,
727 PiwgFirmwareFile: *const PiwgFirmwareFileDevicePath,
728 PiwgFirmwareVolume: *const PiwgFirmwareVolumeDevicePath,
729 RelativeOffsetRange: *const RelativeOffsetRangeDevicePath,
730 RamDisk: *const RamDiskDevicePath,
722 hard_drive: *const HardDriveDevicePath,
723 cdrom: *const CdromDevicePath,
724 vendor: *const VendorDevicePath,
725 file_path: *const FilePathDevicePath,
726 media_protocol: *const MediaProtocolDevicePath,
727 piwg_firmware_file: *const PiwgFirmwareFileDevicePath,
728 piwg_firmware_volume: *const PiwgFirmwareVolumeDevicePath,
729 relative_offset_range: *const RelativeOffsetRangeDevicePath,
730 ram_disk: *const RamDiskDevicePath,
731731
732732 pub const Subtype = enum(u8) {
733 HardDrive = 1,
734 Cdrom = 2,
735 Vendor = 3,
736 FilePath = 4,
737 MediaProtocol = 5,
738 PiwgFirmwareFile = 6,
739 PiwgFirmwareVolume = 7,
740 RelativeOffsetRange = 8,
741 RamDisk = 9,
733 hard_drive = 1,
734 cdrom = 2,
735 vendor = 3,
736 file_path = 4,
737 media_protocol = 5,
738 piwg_firmware_file = 6,
739 piwg_firmware_volume = 7,
740 relative_offset_range = 8,
741 ram_disk = 9,
742742 _,
743743 };
744744
745745 pub const HardDriveDevicePath = extern struct {
746746 pub const Format = enum(u8) {
747 LegacyMbr = 0x01,
748 GuidPartitionTable = 0x02,
747 legacy_mbr = 0x01,
748 guid_partition_table = 0x02,
749749 };
750750
751751 pub const SignatureType = enum(u8) {
752 NoSignature = 0x00,
752 no_signature = 0x00,
753753 /// "32-bit signature from address 0x1b8 of the type 0x01 MBR"
754 MbrSignature = 0x01,
755 GuidSignature = 0x02,
754 mbr_signature = 0x01,
755 guid_signature = 0x02,
756756 };
757757
758758 type: DevicePath.Type,
......@@ -935,10 +935,10 @@ pub const DevicePath = union(Type) {
935935 };
936936
937937 pub const BiosBootSpecification = union(Subtype) {
938 BBS101: *const BBS101DevicePath,
938 bbs101: *const BBS101DevicePath,
939939
940940 pub const Subtype = enum(u8) {
941 BBS101 = 1,
941 bbs101 = 1,
942942 _,
943943 };
944944
......@@ -967,12 +967,12 @@ pub const DevicePath = union(Type) {
967967 };
968968
969969 pub const End = union(Subtype) {
970 EndEntire: *const EndEntireDevicePath,
971 EndThisInstance: *const EndThisInstanceDevicePath,
970 end_entire: *const EndEntireDevicePath,
971 end_this_instance: *const EndThisInstanceDevicePath,
972972
973973 pub const Subtype = enum(u8) {
974 EndEntire = 0xff,
975 EndThisInstance = 0x01,
974 end_entire = 0xff,
975 end_this_instance = 0x01,
976976 _,
977977 };
978978
lib/std/os/uefi/pool_allocator.zig+2-2
......@@ -29,7 +29,7 @@ const UefiPoolAllocator = struct {
2929 const full_len = metadata_len + len;
3030
3131 var unaligned_ptr: [*]align(8) u8 = undefined;
32 if (uefi.system_table.boot_services.?.allocatePool(uefi.efi_pool_memory_type, full_len, &unaligned_ptr) != .Success) return null;
32 if (uefi.system_table.boot_services.?.allocatePool(uefi.efi_pool_memory_type, full_len, &unaligned_ptr) != .success) return null;
3333
3434 const unaligned_addr = @intFromPtr(unaligned_ptr);
3535 const aligned_addr = mem.alignForward(usize, unaligned_addr + @sizeOf(usize), ptr_align);
......@@ -118,7 +118,7 @@ fn uefi_alloc(
118118 std.debug.assert(@intFromEnum(alignment) <= 3);
119119
120120 var ptr: [*]align(8) u8 = undefined;
121 if (uefi.system_table.boot_services.?.allocatePool(uefi.efi_pool_memory_type, len, &ptr) != .Success) return null;
121 if (uefi.system_table.boot_services.?.allocatePool(uefi.efi_pool_memory_type, len, &ptr) != .success) return null;
122122
123123 return ptr;
124124}
lib/std/os/uefi/protocol/block_io.zig+2-2
......@@ -7,7 +7,7 @@ pub const BlockIo = extern struct {
77 const Self = @This();
88
99 revision: u64,
10 media: *EfiBlockMedia,
10 media: *BlockMedia,
1111
1212 _reset: *const fn (*BlockIo, extended_verification: bool) callconv(cc) Status,
1313 _read_blocks: *const fn (*BlockIo, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) callconv(cc) Status,
......@@ -43,7 +43,7 @@ pub const BlockIo = extern struct {
4343 .node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b },
4444 };
4545
46 pub const EfiBlockMedia = extern struct {
46 pub const BlockMedia = extern struct {
4747 /// The current media ID. If the media changes, this value is changed.
4848 media_id: u32,
4949
lib/std/os/uefi/protocol/device_path.zig+7-7
......@@ -24,7 +24,7 @@ pub const DevicePath = extern struct {
2424
2525 /// Returns the next DevicePath node in the sequence, if any.
2626 pub fn next(self: *DevicePath) ?*DevicePath {
27 if (self.type == .End and @as(uefi.DevicePath.End.Subtype, @enumFromInt(self.subtype)) == .EndEntire)
27 if (self.type == .end and @as(uefi.DevicePath.End.Subtype, @enumFromInt(self.subtype)) == .end_entire)
2828 return null;
2929
3030 return @as(*DevicePath, @ptrCast(@as([*]u8, @ptrCast(self)) + self.length));
......@@ -55,8 +55,8 @@ pub const DevicePath = extern struct {
5555 // as the end node itself is 4 bytes (type: u8 + subtype: u8 + length: u16).
5656 var new = @as(*uefi.DevicePath.Media.FilePathDevicePath, @ptrCast(buf.ptr + path_size - 4));
5757
58 new.type = .Media;
59 new.subtype = .FilePath;
58 new.type = .media;
59 new.subtype = .file_path;
6060 new.length = @sizeOf(uefi.DevicePath.Media.FilePathDevicePath) + 2 * (@as(u16, @intCast(path.len)) + 1);
6161
6262 // The same as new.getPath(), but not const as we're filling it in.
......@@ -68,8 +68,8 @@ pub const DevicePath = extern struct {
6868 ptr[path.len] = 0;
6969
7070 var end = @as(*uefi.DevicePath.End.EndEntireDevicePath, @ptrCast(@as(*DevicePath, @ptrCast(new)).next().?));
71 end.type = .End;
72 end.subtype = .EndEntire;
71 end.type = .end;
72 end.subtype = .end_entire;
7373 end.length = @sizeOf(uefi.DevicePath.End.EndEntireDevicePath);
7474
7575 return @as(*DevicePath, @ptrCast(buf.ptr));
......@@ -84,7 +84,7 @@ pub const DevicePath = extern struct {
8484 if (self.type == enum_value) {
8585 const subtype = self.initSubtype(ufield.type);
8686 if (subtype) |sb| {
87 // e.g. return .{ .Hardware = .{ .Pci = @ptrCast(...) } }
87 // e.g. return .{ .hardware = .{ .pci = @ptrCast(...) } }
8888 return @unionInit(uefi.DevicePath, ufield.name, sb);
8989 }
9090 }
......@@ -102,7 +102,7 @@ pub const DevicePath = extern struct {
102102 const tag_val: u8 = @intFromEnum(@field(TTag, subtype.name));
103103
104104 if (self.subtype == tag_val) {
105 // e.g. expr = .{ .Pci = @ptrCast(...) }
105 // e.g. expr = .{ .pci = @ptrCast(...) }
106106 return @unionInit(TUnion, subtype.name, @as(subtype.type, @ptrCast(self)));
107107 }
108108 }
lib/std/os/uefi/protocol/file.zig+10-10
......@@ -58,7 +58,7 @@ pub const File = extern struct {
5858
5959 fn readFn(self: *const File, buffer: []u8) ReadError!usize {
6060 var size: usize = buffer.len;
61 if (.Success != self.read(&size, buffer.ptr)) return ReadError.ReadError;
61 if (.success != self.read(&size, buffer.ptr)) return ReadError.ReadError;
6262 return size;
6363 }
6464
......@@ -68,7 +68,7 @@ pub const File = extern struct {
6868
6969 fn writeFn(self: *const File, bytes: []const u8) WriteError!usize {
7070 var size: usize = bytes.len;
71 if (.Success != self.write(&size, bytes.ptr)) return WriteError.WriteError;
71 if (.success != self.write(&size, bytes.ptr)) return WriteError.WriteError;
7272 return size;
7373 }
7474
......@@ -78,7 +78,7 @@ pub const File = extern struct {
7878
7979 fn getPos(self: *const File) GetSeekPosError!u64 {
8080 var pos: u64 = undefined;
81 if (.Success != self.getPosition(&pos)) return GetSeekPosError.GetSeekPosError;
81 if (.success != self.getPosition(&pos)) return GetSeekPosError.GetSeekPosError;
8282 return pos;
8383 }
8484
......@@ -86,13 +86,13 @@ pub const File = extern struct {
8686 // preserve the old file position
8787 var pos: u64 = undefined;
8888 var end_pos: u64 = undefined;
89 if (.Success != self.getPosition(&pos)) return GetSeekPosError.GetSeekPosError;
89 if (.success != self.getPosition(&pos)) return GetSeekPosError.GetSeekPosError;
9090 // seek to end of file to get position = file size
91 if (.Success != self.setPosition(efi_file_position_end_of_file)) return GetSeekPosError.GetSeekPosError;
91 if (.success != self.setPosition(efi_file_position_end_of_file)) return GetSeekPosError.GetSeekPosError;
9292 // get the position
93 if (.Success != self.getPosition(&end_pos)) return GetSeekPosError.GetSeekPosError;
93 if (.success != self.getPosition(&end_pos)) return GetSeekPosError.GetSeekPosError;
9494 // restore the old position
95 if (.Success != self.setPosition(pos)) return GetSeekPosError.GetSeekPosError;
95 if (.success != self.setPosition(pos)) return GetSeekPosError.GetSeekPosError;
9696 // return the file size = position
9797 return end_pos;
9898 }
......@@ -102,13 +102,13 @@ pub const File = extern struct {
102102 }
103103
104104 fn seekTo(self: *const File, pos: u64) SeekError!void {
105 if (.Success != self.setPosition(pos)) return SeekError.SeekError;
105 if (.success != self.setPosition(pos)) return SeekError.SeekError;
106106 }
107107
108108 fn seekBy(self: *const File, offset: i64) SeekError!void {
109109 // save the old position and calculate the delta
110110 var pos: u64 = undefined;
111 if (.Success != self.getPosition(&pos)) return SeekError.SeekError;
111 if (.success != self.getPosition(&pos)) return SeekError.SeekError;
112112 const seek_back = offset < 0;
113113 const amt = @abs(offset);
114114 if (seek_back) {
......@@ -116,7 +116,7 @@ pub const File = extern struct {
116116 } else {
117117 pos -= amt;
118118 }
119 if (.Success != self.setPosition(pos)) return SeekError.SeekError;
119 if (.success != self.setPosition(pos)) return SeekError.SeekError;
120120 }
121121
122122 pub fn getInfo(self: *const File, information_type: *align(8) const Guid, buffer_size: *usize, buffer: [*]u8) Status {
lib/std/os/uefi/protocol/graphics_output.zig+9-9
......@@ -53,10 +53,10 @@ pub const GraphicsOutput = extern struct {
5353 };
5454
5555 pub const PixelFormat = enum(u32) {
56 RedGreenBlueReserved8BitPerColor,
57 BlueGreenRedReserved8BitPerColor,
58 BitMask,
59 BltOnly,
56 red_green_blue_reserved_8_bit_per_color,
57 blue_green_red_reserved_8_bit_per_color,
58 bit_mask,
59 blt_only,
6060 };
6161
6262 pub const PixelBitmask = extern struct {
......@@ -74,10 +74,10 @@ pub const GraphicsOutput = extern struct {
7474 };
7575
7676 pub const BltOperation = enum(u32) {
77 BltVideoFill,
78 BltVideoToBltBuffer,
79 BltBufferToVideo,
80 BltVideoToVideo,
81 GraphicsOutputBltOperationMax,
77 blt_video_fill,
78 blt_video_to_blt_buffer,
79 blt_buffer_to_video,
80 blt_video_to_video,
81 graphics_output_blt_operation_max,
8282 };
8383};
lib/std/os/uefi/protocol/hii_popup.zig+11-11
......@@ -25,22 +25,22 @@ pub const HiiPopup = extern struct {
2525 };
2626
2727 pub const PopupStyle = enum(u32) {
28 Info,
29 Warning,
30 Error,
28 info,
29 warning,
30 @"error",
3131 };
3232
3333 pub const PopupType = enum(u32) {
34 Ok,
35 Cancel,
36 YesNo,
37 YesNoCancel,
34 ok,
35 cancel,
36 yes_no,
37 yes_no_cancel,
3838 };
3939
4040 pub const PopupSelection = enum(u32) {
41 Ok,
42 Cancel,
43 Yes,
44 No,
41 ok,
42 cancel,
43 yes,
44 no,
4545 };
4646};
lib/std/os/uefi/protocol/ip6.zig+5-5
......@@ -120,11 +120,11 @@ pub const Ip6 = extern struct {
120120 };
121121
122122 pub const NeighborState = enum(u32) {
123 Incomplete,
124 Reachable,
125 Stale,
126 Delay,
127 Probe,
123 incomplete,
124 reachable,
125 stale,
126 delay,
127 probe,
128128 };
129129
130130 pub const NeighborCache = extern struct {
lib/std/os/uefi/protocol/ip6_config.zig+7-7
......@@ -37,12 +37,12 @@ pub const Ip6Config = extern struct {
3737 };
3838
3939 pub const DataType = enum(u32) {
40 InterfaceInfo,
41 AltInterfaceId,
42 Policy,
43 DupAddrDetectTransmits,
44 ManualAddress,
45 Gateway,
46 DnsServer,
40 interface_info,
41 alt_interface_id,
42 policy,
43 dup_addr_detect_transmits,
44 manual_address,
45 gateway,
46 dns_server,
4747 };
4848};
lib/std/os/uefi/protocol/managed_network.zig+2-2
......@@ -110,8 +110,8 @@ pub const ManagedNetwork = extern struct {
110110 event: Event,
111111 status: Status,
112112 packet: extern union {
113 RxData: *ReceiveData,
114 TxData: *TransmitData,
113 rx_data: *ReceiveData,
114 tx_data: *TransmitData,
115115 },
116116 };
117117
lib/std/os/uefi/protocol/serial_io.zig+16-16
......@@ -21,8 +21,8 @@ pub const SerialIo = extern struct {
2121 }
2222
2323 /// Sets the baud rate, receive FIFO depth, transmit/receive time out, parity, data bits, and stop bits on a serial device.
24 pub fn setAttribute(self: *const SerialIo, baudRate: u64, receiverFifoDepth: u32, timeout: u32, parity: ParityType, dataBits: u8, stopBits: StopBitsType) Status {
25 return self._set_attribute(self, baudRate, receiverFifoDepth, timeout, parity, dataBits, stopBits);
24 pub fn setAttribute(self: *const SerialIo, baud_rate: u64, receiver_fifo_depth: u32, timeout: u32, parity: ParityType, data_bits: u8, stop_bits: StopBitsType) Status {
25 return self._set_attribute(self, baud_rate, receiver_fifo_depth, timeout, parity, data_bits, stop_bits);
2626 }
2727
2828 /// Sets the control bits on a serial device.
......@@ -36,13 +36,13 @@ pub const SerialIo = extern struct {
3636 }
3737
3838 /// Writes data to a serial device.
39 pub fn write(self: *const SerialIo, bufferSize: *usize, buffer: *anyopaque) Status {
40 return self._write(self, bufferSize, buffer);
39 pub fn write(self: *const SerialIo, buffer_size: *usize, buffer: *anyopaque) Status {
40 return self._write(self, buffer_size, buffer);
4141 }
4242
4343 /// Reads data from a serial device.
44 pub fn read(self: *const SerialIo, bufferSize: *usize, buffer: *anyopaque) Status {
45 return self._read(self, bufferSize, buffer);
44 pub fn read(self: *const SerialIo, buffer_size: *usize, buffer: *anyopaque) Status {
45 return self._read(self, buffer_size, buffer);
4646 }
4747
4848 pub const guid align(8) = Guid{
......@@ -55,19 +55,19 @@ pub const SerialIo = extern struct {
5555 };
5656
5757 pub const ParityType = enum(u32) {
58 DefaultParity,
59 NoParity,
60 EvenParity,
61 OddParity,
62 MarkParity,
63 SpaceParity,
58 default_parity,
59 no_parity,
60 even_parity,
61 odd_parity,
62 mark_parity,
63 space_parity,
6464 };
6565
6666 pub const StopBitsType = enum(u32) {
67 DefaultStopBits,
68 OneStopBit,
69 OneFiveStopBits,
70 TwoStopBits,
67 default_stop_bits,
68 one_stop_bit,
69 one_five_stop_bits,
70 two_stop_bits,
7171 };
7272
7373 pub const Mode = extern struct {
lib/std/os/uefi/protocol/simple_network.zig+3-3
......@@ -131,9 +131,9 @@ pub const SimpleNetwork = extern struct {
131131 };
132132
133133 pub const State = enum(u32) {
134 Stopped,
135 Started,
136 Initialized,
134 stopped,
135 started,
136 initialized,
137137 };
138138
139139 pub const Statistics = extern struct {
lib/std/os/uefi/protocol/udp6.zig+3-3
......@@ -71,10 +71,10 @@ pub const Udp6 = extern struct {
7171
7272 pub const CompletionToken = extern struct {
7373 event: Event,
74 Status: usize,
74 status: usize,
7575 packet: extern union {
76 RxData: *ReceiveData,
77 TxData: *TransmitData,
76 rx_data: *ReceiveData,
77 tx_data: *TransmitData,
7878 },
7979 };
8080
lib/std/os/uefi/status.zig+98-57
......@@ -4,145 +4,145 @@ const high_bit = 1 << @typeInfo(usize).int.bits - 1;
44
55pub const Status = enum(usize) {
66 /// The operation completed successfully.
7 Success = 0,
7 success = 0,
88
99 /// The image failed to load.
10 LoadError = high_bit | 1,
10 load_error = high_bit | 1,
1111
1212 /// A parameter was incorrect.
13 InvalidParameter = high_bit | 2,
13 invalid_parameter = high_bit | 2,
1414
1515 /// The operation is not supported.
16 Unsupported = high_bit | 3,
16 unsupported = high_bit | 3,
1717
1818 /// The buffer was not the proper size for the request.
19 BadBufferSize = high_bit | 4,
19 bad_buffer_size = high_bit | 4,
2020
2121 /// 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.
22 BufferTooSmall = high_bit | 5,
22 buffer_too_small = high_bit | 5,
2323
2424 /// There is no data pending upon return.
25 NotReady = high_bit | 6,
25 not_ready = high_bit | 6,
2626
2727 /// The physical device reported an error while attempting the operation.
28 DeviceError = high_bit | 7,
28 device_error = high_bit | 7,
2929
3030 /// The device cannot be written to.
31 WriteProtected = high_bit | 8,
31 write_protected = high_bit | 8,
3232
3333 /// A resource has run out.
34 OutOfResources = high_bit | 9,
34 out_of_resources = high_bit | 9,
3535
3636 /// An inconstancy was detected on the file system causing the operating to fail.
37 VolumeCorrupted = high_bit | 10,
37 volume_corrupted = high_bit | 10,
3838
3939 /// There is no more space on the file system.
40 VolumeFull = high_bit | 11,
40 volume_full = high_bit | 11,
4141
4242 /// The device does not contain any medium to perform the operation.
43 NoMedia = high_bit | 12,
43 no_media = high_bit | 12,
4444
4545 /// The medium in the device has changed since the last access.
46 MediaChanged = high_bit | 13,
46 media_changed = high_bit | 13,
4747
4848 /// The item was not found.
49 NotFound = high_bit | 14,
49 not_found = high_bit | 14,
5050
5151 /// Access was denied.
52 AccessDenied = high_bit | 15,
52 access_denied = high_bit | 15,
5353
5454 /// The server was not found or did not respond to the request.
55 NoResponse = high_bit | 16,
55 no_response = high_bit | 16,
5656
5757 /// A mapping to a device does not exist.
58 NoMapping = high_bit | 17,
58 no_mapping = high_bit | 17,
5959
6060 /// The timeout time expired.
61 Timeout = high_bit | 18,
61 timeout = high_bit | 18,
6262
6363 /// The protocol has not been started.
64 NotStarted = high_bit | 19,
64 not_started = high_bit | 19,
6565
6666 /// The protocol has already been started.
67 AlreadyStarted = high_bit | 20,
67 already_started = high_bit | 20,
6868
6969 /// The operation was aborted.
70 Aborted = high_bit | 21,
70 aborted = high_bit | 21,
7171
7272 /// An ICMP error occurred during the network operation.
73 IcmpError = high_bit | 22,
73 icmp_error = high_bit | 22,
7474
7575 /// A TFTP error occurred during the network operation.
76 TftpError = high_bit | 23,
76 tftp_error = high_bit | 23,
7777
7878 /// A protocol error occurred during the network operation.
79 ProtocolError = high_bit | 24,
79 protocol_error = high_bit | 24,
8080
8181 /// The function encountered an internal version that was incompatible with a version requested by the caller.
82 IncompatibleVersion = high_bit | 25,
82 incompatible_version = high_bit | 25,
8383
8484 /// The function was not performed due to a security violation.
85 SecurityViolation = high_bit | 26,
85 security_violation = high_bit | 26,
8686
8787 /// A CRC error was detected.
88 CrcError = high_bit | 27,
88 crc_error = high_bit | 27,
8989
9090 /// Beginning or end of media was reached
91 EndOfMedia = high_bit | 28,
91 end_of_media = high_bit | 28,
9292
9393 /// The end of the file was reached.
94 EndOfFile = high_bit | 31,
94 end_of_file = high_bit | 31,
9595
9696 /// The language specified was invalid.
97 InvalidLanguage = high_bit | 32,
97 invalid_language = high_bit | 32,
9898
9999 /// The security status of the data is unknown or compromised and the data must be updated or replaced to restore a valid security status.
100 CompromisedData = high_bit | 33,
100 compromised_data = high_bit | 33,
101101
102102 /// There is an address conflict address allocation
103 IpAddressConflict = high_bit | 34,
103 ip_address_conflict = high_bit | 34,
104104
105105 /// A HTTP error occurred during the network operation.
106 HttpError = high_bit | 35,
106 http_error = high_bit | 35,
107107
108 NetworkUnreachable = high_bit | 100,
108 network_unreachable = high_bit | 100,
109109
110 HostUnreachable = high_bit | 101,
110 host_unreachable = high_bit | 101,
111111
112 ProtocolUnreachable = high_bit | 102,
112 protocol_unreachable = high_bit | 102,
113113
114 PortUnreachable = high_bit | 103,
114 port_unreachable = high_bit | 103,
115115
116 ConnectionFin = high_bit | 104,
116 connection_fin = high_bit | 104,
117117
118 ConnectionReset = high_bit | 105,
118 connection_reset = high_bit | 105,
119119
120 ConnectionRefused = high_bit | 106,
120 connection_refused = high_bit | 106,
121121
122122 /// The string contained one or more characters that the device could not render and were skipped.
123 WarnUnknownGlyph = 1,
123 warn_unknown_glyph = 1,
124124
125125 /// The handle was closed, but the file was not deleted.
126 WarnDeleteFailure = 2,
126 warn_delete_failure = 2,
127127
128128 /// The handle was closed, but the data to the file was not flushed properly.
129 WarnWriteFailure = 3,
129 warn_write_failure = 3,
130130
131131 /// The resulting buffer was too small, and the data was truncated to the buffer size.
132 WarnBufferTooSmall = 4,
132 warn_buffer_too_small = 4,
133133
134134 /// The data has not been updated within the timeframe set by localpolicy for this type of data.
135 WarnStaleData = 5,
135 warn_stale_data = 5,
136136
137137 /// The resulting buffer contains UEFI-compliant file system.
138 WarnFileSystem = 6,
138 warn_file_system = 6,
139139
140140 /// The operation will be processed across a system reset.
141 WarnResetRequired = 7,
141 warn_reset_required = 7,
142142
143143 _,
144144
145 pub const EfiError = error{
145 pub const Error = error{
146146 LoadError,
147147 InvalidParameter,
148148 Unsupported,
......@@ -185,20 +185,61 @@ pub const Status = enum(usize) {
185185 ConnectionRefused,
186186 };
187187
188 pub fn err(self: Status) EfiError!void {
189 inline for (@typeInfo(EfiError).error_set.?) |efi_err| {
190 if (self == @field(Status, efi_err.name)) {
191 return @field(EfiError, efi_err.name);
192 }
188 pub fn err(self: Status) Error!void {
189 switch (self) {
190 .load_error => return error.LoadError,
191 .invalid_parameter => return error.InvalidParameter,
192 .unsupported => return error.Unsupported,
193 .bad_buffer_size => return error.BadBufferSize,
194 .buffer_too_small => return error.BufferTooSmall,
195 .not_ready => return error.NotReady,
196 .device_error => return error.DeviceError,
197 .write_protected => return error.WriteProtected,
198 .out_of_resources => return error.OutOfResources,
199 .volume_corrupted => return error.VolumeCorrupted,
200 .volume_full => return error.VolumeFull,
201 .no_media => return error.NoMedia,
202 .media_changed => return error.MediaChanged,
203 .not_found => return error.NotFound,
204 .access_denied => return error.AccessDenied,
205 .no_response => return error.NoResponse,
206 .no_mapping => return error.NoMapping,
207 .timeout => return error.Timeout,
208 .not_started => return error.NotStarted,
209 .already_started => return error.AlreadyStarted,
210 .aborted => return error.Aborted,
211 .icmp_error => return error.IcmpError,
212 .tftp_error => return error.TftpError,
213 .protocol_error => return error.ProtocolError,
214 .incompatible_version => return error.IncompatibleVersion,
215 .security_violation => return error.SecurityViolation,
216 .crc_error => return error.CrcError,
217 .end_of_media => return error.EndOfMedia,
218 .end_of_file => return error.EndOfFile,
219 .invalid_language => return error.InvalidLanguage,
220 .compromised_data => return error.CompromisedData,
221 .ip_address_conflict => return error.IpAddressConflict,
222 .http_error => return error.HttpError,
223 .network_unreachable => return error.NetworkUnreachable,
224 .host_unreachable => return error.HostUnreachable,
225 .protocol_unreachable => return error.ProtocolUnreachable,
226 .port_unreachable => return error.PortUnreachable,
227 .connection_fin => return error.ConnectionFin,
228 .connection_reset => return error.ConnectionReset,
229 .connection_refused => return error.ConnectionRefused,
230 // success, warn_*, _
231 else => {},
193232 }
194 // self is .Success or Warning
195233 }
196234};
197235
198236test "status" {
199 var st: Status = .DeviceError;
237 var st: Status = .device_error;
200238 try testing.expectError(error.DeviceError, st.err());
201239
202 st = .Success;
240 st = .success;
241 try st.err();
242
243 st = .warn_unknown_glyph;
203244 try st.err();
204245}
lib/std/os/uefi/tables.zig+38-38
......@@ -4,31 +4,31 @@ pub const ConfigurationTable = @import("tables/configuration_table.zig").Configu
44pub const SystemTable = @import("tables/system_table.zig").SystemTable;
55pub const TableHeader = @import("tables/table_header.zig").TableHeader;
66
7pub const EfiEventNotify = *const fn (event: Event, ctx: *anyopaque) callconv(cc) void;
7pub const EventNotify = *const fn (event: Event, ctx: *anyopaque) callconv(cc) void;
88
99pub const TimerDelay = enum(u32) {
10 TimerCancel,
11 TimerPeriodic,
12 TimerRelative,
10 timer_cancel,
11 timer_periodic,
12 timer_relative,
1313};
1414
1515pub const MemoryType = enum(u32) {
16 ReservedMemoryType,
17 LoaderCode,
18 LoaderData,
19 BootServicesCode,
20 BootServicesData,
21 RuntimeServicesCode,
22 RuntimeServicesData,
23 ConventionalMemory,
24 UnusableMemory,
25 ACPIReclaimMemory,
26 ACPIMemoryNVS,
27 MemoryMappedIO,
28 MemoryMappedIOPortSpace,
29 PalCode,
30 PersistentMemory,
31 MaxMemoryType,
16 reserved_memory_type,
17 loader_code,
18 loader_data,
19 boot_services_code,
20 boot_services_data,
21 runtime_services_code,
22 runtime_services_data,
23 conventional_memory,
24 unusable_memory,
25 acpi_reclaim_memory,
26 acpi_memory_nvs,
27 memory_mapped_io,
28 memory_mapped_io_port_space,
29 pal_code,
30 persistent_memory,
31 max_memory_type,
3232 _,
3333};
3434
......@@ -60,9 +60,9 @@ pub const MemoryDescriptor = extern struct {
6060};
6161
6262pub const LocateSearchType = enum(u32) {
63 AllHandles,
64 ByRegisterNotify,
65 ByProtocol,
63 all_handles,
64 by_register_notify,
65 by_protocol,
6666};
6767
6868pub const OpenProtocolAttributes = packed struct(u32) {
......@@ -82,38 +82,38 @@ pub const ProtocolInformationEntry = extern struct {
8282 open_count: u32,
8383};
8484
85pub const EfiInterfaceType = enum(u32) {
86 EfiNativeInterface,
85pub const InterfaceType = enum(u32) {
86 efi_native_interface,
8787};
8888
8989pub const AllocateType = enum(u32) {
90 AllocateAnyPages,
91 AllocateMaxAddress,
92 AllocateAddress,
90 allocate_any_pages,
91 allocate_max_address,
92 allocate_address,
9393};
9494
95pub const EfiPhysicalAddress = u64;
95pub const PhysicalAddress = u64;
9696
9797pub const CapsuleHeader = extern struct {
98 capsuleGuid: Guid align(8),
99 headerSize: u32,
98 capsule_guid: Guid align(8),
99 header_size: u32,
100100 flags: u32,
101 capsuleImageSize: u32,
101 capsule_image_size: u32,
102102};
103103
104104pub const UefiCapsuleBlockDescriptor = extern struct {
105105 length: u64,
106106 address: extern union {
107 dataBlock: EfiPhysicalAddress,
108 continuationPointer: EfiPhysicalAddress,
107 data_block: PhysicalAddress,
108 continuation_pointer: PhysicalAddress,
109109 },
110110};
111111
112112pub const ResetType = enum(u32) {
113 ResetCold,
114 ResetWarm,
115 ResetShutdown,
116 ResetPlatformSpecific,
113 reset_cold,
114 reset_warm,
115 reset_shutdown,
116 reset_platform_specific,
117117};
118118
119119pub const global_variable align(8) = Guid{
lib/std/os/uefi/tables/boot_services.zig+11-11
......@@ -10,11 +10,11 @@ const AllocateType = uefi.tables.AllocateType;
1010const MemoryType = uefi.tables.MemoryType;
1111const MemoryDescriptor = uefi.tables.MemoryDescriptor;
1212const TimerDelay = uefi.tables.TimerDelay;
13const EfiInterfaceType = uefi.tables.EfiInterfaceType;
13const InterfaceType = uefi.tables.InterfaceType;
1414const LocateSearchType = uefi.tables.LocateSearchType;
1515const OpenProtocolAttributes = uefi.tables.OpenProtocolAttributes;
1616const ProtocolInformationEntry = uefi.tables.ProtocolInformationEntry;
17const EfiEventNotify = uefi.tables.EfiEventNotify;
17const EventNotify = uefi.tables.EventNotify;
1818const cc = uefi.cc;
1919
2020/// Boot services are services provided by the system's firmware until the operating system takes
......@@ -44,7 +44,7 @@ pub const BootServices = extern struct {
4444 freePages: *const fn (memory: [*]align(4096) u8, pages: usize) callconv(cc) Status,
4545
4646 /// Returns the current memory map.
47 getMemoryMap: *const fn (mmap_size: *usize, mmap: ?[*]MemoryDescriptor, mapKey: *usize, descriptor_size: *usize, descriptor_version: *u32) callconv(cc) Status,
47 getMemoryMap: *const fn (mmap_size: *usize, mmap: ?[*]MemoryDescriptor, map_key: *usize, descriptor_size: *usize, descriptor_version: *u32) callconv(cc) Status,
4848
4949 /// Allocates pool memory.
5050 allocatePool: *const fn (pool_type: MemoryType, size: usize, buffer: *[*]align(8) u8) callconv(cc) Status,
......@@ -53,10 +53,10 @@ pub const BootServices = extern struct {
5353 freePool: *const fn (buffer: [*]align(8) u8) callconv(cc) Status,
5454
5555 /// Creates an event.
56 createEvent: *const fn (type: u32, notify_tpl: usize, notify_func: ?*const fn (Event, ?*anyopaque) callconv(cc) void, notifyCtx: ?*const anyopaque, event: *Event) callconv(cc) Status,
56 createEvent: *const fn (type: u32, notify_tpl: usize, notify_func: ?*const fn (Event, ?*anyopaque) callconv(cc) void, notify_ctx: ?*const anyopaque, event: *Event) callconv(cc) Status,
5757
5858 /// Sets the type of timer and the trigger time for a timer event.
59 setTimer: *const fn (event: Event, type: TimerDelay, triggerTime: u64) callconv(cc) Status,
59 setTimer: *const fn (event: Event, type: TimerDelay, trigger_time: u64) callconv(cc) Status,
6060
6161 /// Stops execution until an event is signaled.
6262 waitForEvent: *const fn (event_len: usize, events: [*]const Event, index: *usize) callconv(cc) Status,
......@@ -73,7 +73,7 @@ pub const BootServices = extern struct {
7373 /// Installs a protocol interface on a device handle. If the handle does not exist, it is created
7474 /// and added to the list of handles in the system. installMultipleProtocolInterfaces()
7575 /// performs more error checking than installProtocolInterface(), so its use is recommended over this.
76 installProtocolInterface: *const fn (handle: Handle, protocol: *align(8) const Guid, interface_type: EfiInterfaceType, interface: *anyopaque) callconv(cc) Status,
76 installProtocolInterface: *const fn (handle: Handle, protocol: *align(8) const Guid, interface_type: InterfaceType, interface: *anyopaque) callconv(cc) Status,
7777
7878 /// Reinstalls a protocol interface on a device handle
7979 reinstallProtocolInterface: *const fn (handle: Handle, protocol: *align(8) const Guid, old_interface: *anyopaque, new_interface: *anyopaque) callconv(cc) Status,
......@@ -91,7 +91,7 @@ pub const BootServices = extern struct {
9191 registerProtocolNotify: *const fn (protocol: *align(8) const Guid, event: Event, registration: **anyopaque) callconv(cc) Status,
9292
9393 /// Returns an array of handles that support a specified protocol.
94 locateHandle: *const fn (search_type: LocateSearchType, protocol: ?*align(8) const Guid, search_key: ?*const anyopaque, bufferSize: *usize, buffer: [*]Handle) callconv(cc) Status,
94 locateHandle: *const fn (search_type: LocateSearchType, protocol: ?*align(8) const Guid, search_key: ?*const anyopaque, buffer_size: *usize, buffer: [*]Handle) callconv(cc) Status,
9595
9696 /// Locates the handle to a device on the device path that supports the specified protocol
9797 locateDevicePath: *const fn (protocols: *align(8) const Guid, device_path: **const DevicePathProtocol, device: *?Handle) callconv(cc) Status,
......@@ -100,7 +100,7 @@ pub const BootServices = extern struct {
100100 installConfigurationTable: *const fn (guid: *align(8) const Guid, table: ?*anyopaque) callconv(cc) Status,
101101
102102 /// Loads an EFI image into memory.
103 loadImage: *const fn (boot_policy: bool, parent_image_handle: Handle, device_path: ?*const DevicePathProtocol, source_buffer: ?[*]const u8, source_size: usize, imageHandle: *?Handle) callconv(cc) Status,
103 loadImage: *const fn (boot_policy: bool, parent_image_handle: Handle, device_path: ?*const DevicePathProtocol, source_buffer: ?[*]const u8, source_size: usize, image_handle: *?Handle) callconv(cc) Status,
104104
105105 /// Transfers control to a loaded image's entry point.
106106 startImage: *const fn (image_handle: Handle, exit_data_size: ?*usize, exit_data: ?*[*]u16) callconv(cc) Status,
......@@ -121,7 +121,7 @@ pub const BootServices = extern struct {
121121 stall: *const fn (microseconds: usize) callconv(cc) Status,
122122
123123 /// Sets the system's watchdog timer.
124 setWatchdogTimer: *const fn (timeout: usize, watchdogCode: u64, data_size: usize, watchdog_data: ?[*]const u16) callconv(cc) Status,
124 setWatchdogTimer: *const fn (timeout: usize, watchdog_code: u64, data_size: usize, watchdog_data: ?[*]const u16) callconv(cc) Status,
125125
126126 /// Connects one or more drives to a controller.
127127 connectController: *const fn (controller_handle: Handle, driver_image_handle: ?Handle, remaining_device_path: ?*DevicePathProtocol, recursive: bool) callconv(cc) Status,
......@@ -133,7 +133,7 @@ pub const BootServices = extern struct {
133133 openProtocol: *const fn (handle: Handle, protocol: *align(8) const Guid, interface: *?*anyopaque, agent_handle: ?Handle, controller_handle: ?Handle, attributes: OpenProtocolAttributes) callconv(cc) Status,
134134
135135 /// Closes a protocol on a handle that was opened using openProtocol().
136 closeProtocol: *const fn (handle: Handle, protocol: *align(8) const Guid, agentHandle: Handle, controller_handle: ?Handle) callconv(cc) Status,
136 closeProtocol: *const fn (handle: Handle, protocol: *align(8) const Guid, agent_handle: Handle, controller_handle: ?Handle) callconv(cc) Status,
137137
138138 /// Retrieves the list of agents that currently have a protocol interface opened.
139139 openProtocolInformation: *const fn (handle: Handle, protocol: *align(8) const Guid, entry_buffer: *[*]ProtocolInformationEntry, entry_count: *usize) callconv(cc) Status,
......@@ -165,7 +165,7 @@ pub const BootServices = extern struct {
165165 setMem: *const fn (buffer: [*]u8, size: usize, value: u8) callconv(cc) void,
166166
167167 /// Creates an event in a group.
168 createEventEx: *const fn (type: u32, notify_tpl: usize, notify_func: EfiEventNotify, notify_ctx: *const anyopaque, event_group: *align(8) const Guid, event: *Event) callconv(cc) Status,
168 createEventEx: *const fn (type: u32, notify_tpl: usize, notify_func: EventNotify, notify_ctx: *const anyopaque, event_group: *align(8) const Guid, event: *Event) callconv(cc) Status,
169169
170170 /// Opens a protocol with a structure as the loaded image for a UEFI application
171171 pub fn openProtocolSt(self: *BootServices, comptime protocol: type, handle: Handle) !*protocol {
lib/std/os/uefi/tables/runtime_services.zig+3-3
......@@ -8,7 +8,7 @@ const Status = uefi.Status;
88const MemoryDescriptor = uefi.tables.MemoryDescriptor;
99const ResetType = uefi.tables.ResetType;
1010const CapsuleHeader = uefi.tables.CapsuleHeader;
11const EfiPhysicalAddress = uefi.tables.EfiPhysicalAddress;
11const PhysicalAddress = uefi.tables.PhysicalAddress;
1212const cc = uefi.cc;
1313
1414/// Runtime services are provided by the firmware before and after exitBootServices has been called.
......@@ -60,10 +60,10 @@ pub const RuntimeServices = extern struct {
6060 /// If the payload should persist across a system reset, the reset value returned from
6161 /// `queryCapsuleCapabilities` must be passed into resetSystem and will cause the capsule
6262 /// to be processed by the firmware as part of the reset process.
63 updateCapsule: *const fn (capsule_header_array: **CapsuleHeader, capsule_count: usize, scatter_gather_list: EfiPhysicalAddress) callconv(cc) Status,
63 updateCapsule: *const fn (capsule_header_array: **CapsuleHeader, capsule_count: usize, scatter_gather_list: PhysicalAddress) callconv(cc) Status,
6464
6565 /// Returns if the capsule can be supported via `updateCapsule`
66 queryCapsuleCapabilities: *const fn (capsule_header_array: **CapsuleHeader, capsule_count: usize, maximum_capsule_size: *usize, resetType: ResetType) callconv(cc) Status,
66 queryCapsuleCapabilities: *const fn (capsule_header_array: **CapsuleHeader, capsule_count: usize, maximum_capsule_size: *usize, reset_type: ResetType) callconv(cc) Status,
6767
6868 /// Returns information about the EFI variables
6969 queryVariableInfo: *const fn (attributes: *u32, maximum_variable_storage_size: *u64, remaining_variable_storage_size: *u64, maximum_variable_size: *u64) callconv(cc) Status,
lib/std/os/uefi/tables/system_table.zig+3
......@@ -45,4 +45,7 @@ pub const SystemTable = extern struct {
4545 pub const revision_2_60: u32 = (2 << 16) | 60;
4646 pub const revision_2_70: u32 = (2 << 16) | 70;
4747 pub const revision_2_80: u32 = (2 << 16) | 80;
48 pub const revision_2_90: u32 = (2 << 16) | 90;
49 pub const revision_2_100: u32 = (2 << 16) | 100;
50 pub const revision_2_110: u32 = (2 << 16) | 110;
4851};
lib/std/posix.zig+1-1
......@@ -775,7 +775,7 @@ pub fn exit(status: u8) noreturn {
775775 _ = bs.exit(uefi.handle, @enumFromInt(status), 0, null);
776776 }
777777 // If we can't exit, reboot the system instead.
778 uefi.system_table.runtime_services.resetSystem(.ResetCold, @enumFromInt(status), 0, null);
778 uefi.system_table.runtime_services.resetSystem(.reset_cold, @enumFromInt(status), 0, null);
779779 }
780780 system.exit(status);
781781}
lib/std/time.zig+2-2
......@@ -64,7 +64,7 @@ pub fn nanoTimestamp() i128 {
6464 .uefi => {
6565 var value: std.os.uefi.Time = undefined;
6666 const status = std.os.uefi.system_table.runtime_services.getTime(&value, null);
67 assert(status == .Success);
67 assert(status == .success);
6868 return value.toEpoch();
6969 },
7070 else => {
......@@ -153,7 +153,7 @@ pub const Instant = struct {
153153 .uefi => {
154154 var value: std.os.uefi.Time = undefined;
155155 const status = std.os.uefi.system_table.runtime_services.getTime(&value, null);
156 if (status != .Success) return error.Unsupported;
156 if (status != .success) return error.Unsupported;
157157 return Instant{ .timestamp = value.toEpoch() };
158158 },
159159 // On darwin, use UPTIME_RAW instead of MONOTONIC as it ticks while