| author | |
| committer | |
| log | 5dd3c8eed65c020a5c5672ee595b16120b3dc431 |
| tree | afd09d6bb434b41fc2f5838dbabe38ad77dea432 |
| parent | 2f06971a7e2f004b76c0ac4502c3e84cd63a1fba |
| parent | f44530302ecef3263cf39eff829d7c3e53e9f95d |
| signature |
std/os/uefi: various improvements and some refactoring31 files changed, 797 insertions(+), 349 deletions(-)
lib/std/os.zig+2-2| ... | @@ -273,10 +273,10 @@ pub fn exit(status: u8) noreturn { | ... | @@ -273,10 +273,10 @@ pub fn exit(status: u8) noreturn { |
| 273 | // exit() is only avaliable if exitBootServices() has not been called yet. | 273 | // exit() is only avaliable if exitBootServices() has not been called yet. |
| 274 | // This call to exit should not fail, so we don't care about its return value. | 274 | // This call to exit should not fail, so we don't care about its return value. |
| 275 | if (uefi.system_table.boot_services) |bs| { | 275 | 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); |
| 277 | } | 277 | } |
| 278 | // If we can't exit, reboot the system instead. | 278 | // 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); |
| 280 | } | 280 | } |
| 281 | system.exit(status); | 281 | system.exit(status); |
| 282 | } | 282 | } |
lib/std/os/uefi.zig+5-2| ... | @@ -2,7 +2,7 @@ | ... | @@ -2,7 +2,7 @@ |
| 2 | pub const protocols = @import("uefi/protocols.zig"); | 2 | pub const protocols = @import("uefi/protocols.zig"); |
| 3 | 3 | ||
| 4 | /// Status codes returned by EFI interfaces | 4 | /// Status codes returned by EFI interfaces |
| 5 | pub const status = @import("uefi/status.zig"); | 5 | pub const Status = @import("uefi/status.zig").Status; |
| 6 | pub const tables = @import("uefi/tables.zig"); | 6 | pub const tables = @import("uefi/tables.zig"); |
| 7 | 7 | ||
| 8 | const fmt = @import("std").fmt; | 8 | const fmt = @import("std").fmt; |
| ... | @@ -32,7 +32,7 @@ pub const Guid = extern struct { | ... | @@ -32,7 +32,7 @@ pub const Guid = extern struct { |
| 32 | options: fmt.FormatOptions, | 32 | options: fmt.FormatOptions, |
| 33 | context: var, | 33 | context: var, |
| 34 | comptime Errors: type, | 34 | comptime Errors: type, |
| 35 | output: fn (@TypeOf(context), []const u8) Errors!void, | 35 | comptime output: fn (@TypeOf(context), []const u8) Errors!void, |
| 36 | ) Errors!void { | 36 | ) Errors!void { |
| 37 | if (f.len == 0) { | 37 | if (f.len == 0) { |
| 38 | return fmt.format(context, Errors, output, "{x:0>8}-{x:0>4}-{x:0>4}-{x:0>2}{x:0>2}-{x:0>12}", .{ | 38 | return fmt.format(context, Errors, output, "{x:0>8}-{x:0>4}-{x:0>4}-{x:0>2}{x:0>2}-{x:0>12}", .{ |
| ... | @@ -105,3 +105,6 @@ pub const TimeCapabilities = extern struct { | ... | @@ -105,3 +105,6 @@ pub const TimeCapabilities = extern struct { |
| 105 | /// If true, a time set operation clears the device's time below the resolution level. | 105 | /// If true, a time set operation clears the device's time below the resolution level. |
| 106 | sets_to_zero: bool, | 106 | sets_to_zero: bool, |
| 107 | }; | 107 | }; |
| 108 | |||
| 109 | /// File Handle as specified in the EFI Shell Spec | ||
| 110 | pub const FileHandle = *@OpaqueType(); |
lib/std/os/uefi/protocols.zig+11| ... | @@ -1,6 +1,15 @@ | ... | @@ -1,6 +1,15 @@ |
| 1 | pub const LoadedImageProtocol = @import("protocols/loaded_image_protocol.zig").LoadedImageProtocol; | 1 | pub const LoadedImageProtocol = @import("protocols/loaded_image_protocol.zig").LoadedImageProtocol; |
| 2 | pub const loaded_image_device_path_protocol_guid = @import("protocols/loaded_image_protocol.zig").loaded_image_device_path_protocol_guid; | ||
| 2 | 3 | ||
| 4 | pub const AcpiDevicePath = @import("protocols/device_path_protocol.zig").AcpiDevicePath; | ||
| 5 | pub const BiosBootSpecificationDevicePath = @import("protocols/device_path_protocol.zig").BiosBootSpecificationDevicePath; | ||
| 6 | pub const DevicePath = @import("protocols/device_path_protocol.zig").DevicePath; | ||
| 3 | pub const DevicePathProtocol = @import("protocols/device_path_protocol.zig").DevicePathProtocol; | 7 | pub const DevicePathProtocol = @import("protocols/device_path_protocol.zig").DevicePathProtocol; |
| 8 | pub const DevicePathType = @import("protocols/device_path_protocol.zig").DevicePathType; | ||
| 9 | pub const EndDevicePath = @import("protocols/device_path_protocol.zig").EndDevicePath; | ||
| 10 | pub const HardwareDevicePath = @import("protocols/device_path_protocol.zig").HardwareDevicePath; | ||
| 11 | pub const MediaDevicePath = @import("protocols/device_path_protocol.zig").MediaDevicePath; | ||
| 12 | pub const MessagingDevicePath = @import("protocols/device_path_protocol.zig").MessagingDevicePath; | ||
| 4 | 13 | ||
| 5 | pub const SimpleFileSystemProtocol = @import("protocols/simple_file_system_protocol.zig").SimpleFileSystemProtocol; | 14 | pub const SimpleFileSystemProtocol = @import("protocols/simple_file_system_protocol.zig").SimpleFileSystemProtocol; |
| 6 | pub const FileProtocol = @import("protocols/file_protocol.zig").FileProtocol; | 15 | pub const FileProtocol = @import("protocols/file_protocol.zig").FileProtocol; |
| ... | @@ -86,3 +95,5 @@ pub const HIIPopupType = @import("protocols/hii_popup_protocol.zig").HIIPopupTyp | ... | @@ -86,3 +95,5 @@ pub const HIIPopupType = @import("protocols/hii_popup_protocol.zig").HIIPopupTyp |
| 86 | pub const HIIPopupSelection = @import("protocols/hii_popup_protocol.zig").HIIPopupSelection; | 95 | pub const HIIPopupSelection = @import("protocols/hii_popup_protocol.zig").HIIPopupSelection; |
| 87 | 96 | ||
| 88 | pub const RNGProtocol = @import("protocols/rng_protocol.zig").RNGProtocol; | 97 | pub const RNGProtocol = @import("protocols/rng_protocol.zig").RNGProtocol; |
| 98 | |||
| 99 | pub const ShellParametersProtocol = @import("protocols/shell_parameters_protocol.zig").ShellParametersProtocol; |
lib/std/os/uefi/protocols/absolute_pointer_protocol.zig+5-4| ... | @@ -1,21 +1,22 @@ | ... | @@ -1,21 +1,22 @@ |
| 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 Status = uefi.Status; | ||
| 4 | 5 | ||
| 5 | /// Protocol for touchscreens | 6 | /// Protocol for touchscreens |
| 6 | pub const AbsolutePointerProtocol = extern struct { | 7 | pub const AbsolutePointerProtocol = extern struct { |
| 7 | _reset: extern fn (*const AbsolutePointerProtocol, bool) usize, | 8 | _reset: extern fn (*const AbsolutePointerProtocol, bool) Status, |
| 8 | _get_state: extern fn (*const AbsolutePointerProtocol, *AbsolutePointerState) usize, | 9 | _get_state: extern fn (*const AbsolutePointerProtocol, *AbsolutePointerState) Status, |
| 9 | wait_for_input: Event, | 10 | wait_for_input: Event, |
| 10 | mode: *AbsolutePointerMode, | 11 | mode: *AbsolutePointerMode, |
| 11 | 12 | ||
| 12 | /// Resets the pointer device hardware. | 13 | /// 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 { |
| 14 | return self._reset(self, verify); | 15 | return self._reset(self, verify); |
| 15 | } | 16 | } |
| 16 | 17 | ||
| 17 | /// Retrieves the current state of a pointer device. | 18 | /// 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 { |
| 19 | return self._get_state(self, state); | 20 | return self._get_state(self, state); |
| 20 | } | 21 | } |
| 21 | 22 |
lib/std/os/uefi/protocols/device_path_protocol.zig+338-2| ... | @@ -1,8 +1,8 @@ | ... | @@ -1,8 +1,8 @@ |
| 1 | const uefi = @import("std").os.uefi; | 1 | const uefi = @import("std").os.uefi; |
| 2 | const Guid = uefi.Guid; | 2 | const Guid = uefi.Guid; |
| 3 | 3 | ||
| 4 | pub const DevicePathProtocol = extern struct { | 4 | pub const DevicePathProtocol = packed struct { |
| 5 | type: u8, | 5 | type: DevicePathType, |
| 6 | subtype: u8, | 6 | subtype: u8, |
| 7 | length: u16, | 7 | length: u16, |
| 8 | 8 | ||
| ... | @@ -14,4 +14,340 @@ pub const DevicePathProtocol = extern struct { | ... | @@ -14,4 +14,340 @@ pub const DevicePathProtocol = extern struct { |
| 14 | .clock_seq_low = 0x39, | 14 | .clock_seq_low = 0x39, |
| 15 | .node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b }, | 15 | .node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b }, |
| 16 | }; | 16 | }; |
| 17 | |||
| 18 | pub fn getDevicePath(self: *const DevicePathProtocol) ?DevicePath { | ||
| 19 | return switch (self.type) { | ||
| 20 | .Hardware => blk: { | ||
| 21 | const hardware: ?HardwareDevicePath = switch (@intToEnum(HardwareDevicePath.Subtype, self.subtype)) { | ||
| 22 | .Pci => .{ .Pci = @ptrCast(*const HardwareDevicePath.PciDevicePath, self) }, | ||
| 23 | .PcCard => .{ .PcCard = @ptrCast(*const HardwareDevicePath.PcCardDevicePath, self) }, | ||
| 24 | .MemoryMapped => .{ .MemoryMapped = @ptrCast(*const HardwareDevicePath.MemoryMappedDevicePath, self) }, | ||
| 25 | .Vendor => .{ .Vendor = @ptrCast(*const HardwareDevicePath.VendorDevicePath, self) }, | ||
| 26 | .Controller => .{ .Controller = @ptrCast(*const HardwareDevicePath.ControllerDevicePath, self) }, | ||
| 27 | .Bmc => .{ .Bmc = @ptrCast(*const HardwareDevicePath.BmcDevicePath, self) }, | ||
| 28 | _ => null, | ||
| 29 | }; | ||
| 30 | break :blk if (hardware) |h| .{ .Hardware = h } else null; | ||
| 31 | }, | ||
| 32 | .Acpi => blk: { | ||
| 33 | const acpi: ?AcpiDevicePath = switch (@intToEnum(AcpiDevicePath.Subtype, self.subtype)) { | ||
| 34 | else => null, // TODO | ||
| 35 | }; | ||
| 36 | break :blk if (acpi) |a| .{ .Acpi = a } else null; | ||
| 37 | }, | ||
| 38 | .Messaging => blk: { | ||
| 39 | const messaging: ?MessagingDevicePath = switch (@intToEnum(MessagingDevicePath.Subtype, self.subtype)) { | ||
| 40 | else => null, // TODO | ||
| 41 | }; | ||
| 42 | break :blk if (messaging) |m| .{ .Messaging = m } else null; | ||
| 43 | }, | ||
| 44 | .Media => blk: { | ||
| 45 | const media: ?MediaDevicePath = switch (@intToEnum(MediaDevicePath.Subtype, self.subtype)) { | ||
| 46 | .HardDrive => .{ .HardDrive = @ptrCast(*const MediaDevicePath.HardDriveDevicePath, self) }, | ||
| 47 | .Cdrom => .{ .Cdrom = @ptrCast(*const MediaDevicePath.CdromDevicePath, self) }, | ||
| 48 | .Vendor => .{ .Vendor = @ptrCast(*const MediaDevicePath.VendorDevicePath, self) }, | ||
| 49 | .FilePath => .{ .FilePath = @ptrCast(*const MediaDevicePath.FilePathDevicePath, self) }, | ||
| 50 | .MediaProtocol => .{ .MediaProtocol = @ptrCast(*const MediaDevicePath.MediaProtocolDevicePath, self) }, | ||
| 51 | .PiwgFirmwareFile => .{ .PiwgFirmwareFile = @ptrCast(*const MediaDevicePath.PiwgFirmwareFileDevicePath, self) }, | ||
| 52 | .PiwgFirmwareVolume => .{ .PiwgFirmwareVolume = @ptrCast(*const MediaDevicePath.PiwgFirmwareVolumeDevicePath, self) }, | ||
| 53 | .RelativeOffsetRange => .{ .RelativeOffsetRange = @ptrCast(*const MediaDevicePath.RelativeOffsetRangeDevicePath, self) }, | ||
| 54 | .RamDisk => .{ .RamDisk = @ptrCast(*const MediaDevicePath.RamDiskDevicePath, self) }, | ||
| 55 | _ => null, | ||
| 56 | }; | ||
| 57 | break :blk if (media) |m| .{ .Media = m } else null; | ||
| 58 | }, | ||
| 59 | .BiosBootSpecification => blk: { | ||
| 60 | const bbs: ?BiosBootSpecificationDevicePath = switch (@intToEnum(BiosBootSpecificationDevicePath.Subtype, self.subtype)) { | ||
| 61 | .BBS101 => .{ .BBS101 = @ptrCast(*const BiosBootSpecificationDevicePath.BBS101DevicePath, self) }, | ||
| 62 | _ => null, | ||
| 63 | }; | ||
| 64 | break :blk if (bbs) |b| .{ .BiosBootSpecification = b } else null; | ||
| 65 | }, | ||
| 66 | .End => blk: { | ||
| 67 | const end: ?EndDevicePath = switch (@intToEnum(EndDevicePath.Subtype, self.subtype)) { | ||
| 68 | .EndEntire => .{ .EndEntire = @ptrCast(*const EndDevicePath.EndEntireDevicePath, self) }, | ||
| 69 | .EndThisInstance => .{ .EndThisInstance = @ptrCast(*const EndDevicePath.EndThisInstanceDevicePath, self) }, | ||
| 70 | _ => null, | ||
| 71 | }; | ||
| 72 | break :blk if (end) |e| .{ .End = e } else null; | ||
| 73 | }, | ||
| 74 | _ => null, | ||
| 75 | }; | ||
| 76 | } | ||
| 77 | }; | ||
| 78 | |||
| 79 | pub const DevicePath = union(DevicePathType) { | ||
| 80 | Hardware: HardwareDevicePath, | ||
| 81 | Acpi: AcpiDevicePath, | ||
| 82 | Messaging: MessagingDevicePath, | ||
| 83 | Media: MediaDevicePath, | ||
| 84 | BiosBootSpecification: BiosBootSpecificationDevicePath, | ||
| 85 | End: EndDevicePath, | ||
| 86 | }; | ||
| 87 | |||
| 88 | pub const DevicePathType = extern enum(u8) { | ||
| 89 | Hardware = 0x01, | ||
| 90 | Acpi = 0x02, | ||
| 91 | Messaging = 0x03, | ||
| 92 | Media = 0x04, | ||
| 93 | BiosBootSpecification = 0x05, | ||
| 94 | End = 0x7f, | ||
| 95 | _, | ||
| 96 | }; | ||
| 97 | |||
| 98 | pub const HardwareDevicePath = union(Subtype) { | ||
| 99 | Pci: *const PciDevicePath, | ||
| 100 | PcCard: *const PcCardDevicePath, | ||
| 101 | MemoryMapped: *const MemoryMappedDevicePath, | ||
| 102 | Vendor: *const VendorDevicePath, | ||
| 103 | Controller: *const ControllerDevicePath, | ||
| 104 | Bmc: *const BmcDevicePath, | ||
| 105 | |||
| 106 | pub const Subtype = extern enum(u8) { | ||
| 107 | Pci = 1, | ||
| 108 | PcCard = 2, | ||
| 109 | MemoryMapped = 3, | ||
| 110 | Vendor = 4, | ||
| 111 | Controller = 5, | ||
| 112 | Bmc = 6, | ||
| 113 | _, | ||
| 114 | }; | ||
| 115 | |||
| 116 | pub const PciDevicePath = packed struct { | ||
| 117 | type: DevicePathType, | ||
| 118 | subtype: Subtype, | ||
| 119 | length: u16, | ||
| 120 | // TODO | ||
| 121 | }; | ||
| 122 | |||
| 123 | pub const PcCardDevicePath = packed struct { | ||
| 124 | type: DevicePathType, | ||
| 125 | subtype: Subtype, | ||
| 126 | length: u16, | ||
| 127 | // TODO | ||
| 128 | }; | ||
| 129 | |||
| 130 | pub const MemoryMappedDevicePath = packed struct { | ||
| 131 | type: DevicePathType, | ||
| 132 | subtype: Subtype, | ||
| 133 | length: u16, | ||
| 134 | // TODO | ||
| 135 | }; | ||
| 136 | |||
| 137 | pub const VendorDevicePath = packed struct { | ||
| 138 | type: DevicePathType, | ||
| 139 | subtype: Subtype, | ||
| 140 | length: u16, | ||
| 141 | // TODO | ||
| 142 | }; | ||
| 143 | |||
| 144 | pub const ControllerDevicePath = packed struct { | ||
| 145 | type: DevicePathType, | ||
| 146 | subtype: Subtype, | ||
| 147 | length: u16, | ||
| 148 | // TODO | ||
| 149 | }; | ||
| 150 | |||
| 151 | pub const BmcDevicePath = packed struct { | ||
| 152 | type: DevicePathType, | ||
| 153 | subtype: Subtype, | ||
| 154 | length: u16, | ||
| 155 | // TODO | ||
| 156 | }; | ||
| 157 | }; | ||
| 158 | |||
| 159 | pub const AcpiDevicePath = union(Subtype) { | ||
| 160 | Acpi: void, // TODO | ||
| 161 | ExpandedAcpi: void, // TODO | ||
| 162 | Adr: void, // TODO | ||
| 163 | Nvdimm: void, // TODO | ||
| 164 | |||
| 165 | pub const Subtype = extern enum(u8) { | ||
| 166 | Acpi = 1, | ||
| 167 | ExpandedAcpi = 2, | ||
| 168 | Adr = 3, | ||
| 169 | Nvdimm = 4, | ||
| 170 | _, | ||
| 171 | }; | ||
| 172 | }; | ||
| 173 | |||
| 174 | pub const MessagingDevicePath = union(Subtype) { | ||
| 175 | Atapi: void, // TODO | ||
| 176 | Scsi: void, // TODO | ||
| 177 | FibreChannel: void, // TODO | ||
| 178 | FibreChannelEx: void, // TODO | ||
| 179 | @"1394": void, // TODO | ||
| 180 | Usb: void, // TODO | ||
| 181 | Sata: void, // TODO | ||
| 182 | UsbWwid: void, // TODO | ||
| 183 | Lun: void, // TODO | ||
| 184 | UsbClass: void, // TODO | ||
| 185 | I2o: void, // TODO | ||
| 186 | MacAddress: void, // TODO | ||
| 187 | Ipv4: void, // TODO | ||
| 188 | Ipv6: void, // TODO | ||
| 189 | Vlan: void, // TODO | ||
| 190 | InfiniBand: void, // TODO | ||
| 191 | Uart: void, // TODO | ||
| 192 | Vendor: void, // TODO | ||
| 193 | |||
| 194 | pub const Subtype = extern enum(u8) { | ||
| 195 | Atapi = 1, | ||
| 196 | Scsi = 2, | ||
| 197 | FibreChannel = 3, | ||
| 198 | FibreChannelEx = 21, | ||
| 199 | @"1394" = 4, | ||
| 200 | Usb = 5, | ||
| 201 | Sata = 18, | ||
| 202 | UsbWwid = 16, | ||
| 203 | Lun = 17, | ||
| 204 | UsbClass = 15, | ||
| 205 | I2o = 6, | ||
| 206 | MacAddress = 11, | ||
| 207 | Ipv4 = 12, | ||
| 208 | Ipv6 = 13, | ||
| 209 | Vlan = 20, | ||
| 210 | InfiniBand = 9, | ||
| 211 | Uart = 14, | ||
| 212 | Vendor = 10, | ||
| 213 | _, | ||
| 214 | }; | ||
| 215 | }; | ||
| 216 | |||
| 217 | pub const MediaDevicePath = union(Subtype) { | ||
| 218 | HardDrive: *const HardDriveDevicePath, | ||
| 219 | Cdrom: *const CdromDevicePath, | ||
| 220 | Vendor: *const VendorDevicePath, | ||
| 221 | FilePath: *const FilePathDevicePath, | ||
| 222 | MediaProtocol: *const MediaProtocolDevicePath, | ||
| 223 | PiwgFirmwareFile: *const PiwgFirmwareFileDevicePath, | ||
| 224 | PiwgFirmwareVolume: *const PiwgFirmwareVolumeDevicePath, | ||
| 225 | RelativeOffsetRange: *const RelativeOffsetRangeDevicePath, | ||
| 226 | RamDisk: *const RamDiskDevicePath, | ||
| 227 | |||
| 228 | pub const Subtype = extern enum(u8) { | ||
| 229 | HardDrive = 1, | ||
| 230 | Cdrom = 2, | ||
| 231 | Vendor = 3, | ||
| 232 | FilePath = 4, | ||
| 233 | MediaProtocol = 5, | ||
| 234 | PiwgFirmwareFile = 6, | ||
| 235 | PiwgFirmwareVolume = 7, | ||
| 236 | RelativeOffsetRange = 8, | ||
| 237 | RamDisk = 9, | ||
| 238 | _, | ||
| 239 | }; | ||
| 240 | |||
| 241 | pub const HardDriveDevicePath = packed struct { | ||
| 242 | type: DevicePathType, | ||
| 243 | subtype: Subtype, | ||
| 244 | length: u16, | ||
| 245 | // TODO | ||
| 246 | }; | ||
| 247 | |||
| 248 | pub const CdromDevicePath = packed struct { | ||
| 249 | type: DevicePathType, | ||
| 250 | subtype: Subtype, | ||
| 251 | length: u16, | ||
| 252 | // TODO | ||
| 253 | }; | ||
| 254 | |||
| 255 | pub const VendorDevicePath = packed struct { | ||
| 256 | type: DevicePathType, | ||
| 257 | subtype: Subtype, | ||
| 258 | length: u16, | ||
| 259 | // TODO | ||
| 260 | }; | ||
| 261 | |||
| 262 | pub const FilePathDevicePath = packed struct { | ||
| 263 | type: DevicePathType, | ||
| 264 | subtype: Subtype, | ||
| 265 | length: u16, | ||
| 266 | |||
| 267 | pub fn getPath(self: *const FilePathDevicePath) [*:0]const u16 { | ||
| 268 | return @ptrCast([*:0]const u16, @alignCast(2, @ptrCast([*]const u8, self)) + @sizeOf(FilePathDevicePath)); | ||
| 269 | } | ||
| 270 | }; | ||
| 271 | |||
| 272 | pub const MediaProtocolDevicePath = packed struct { | ||
| 273 | type: DevicePathType, | ||
| 274 | subtype: Subtype, | ||
| 275 | length: u16, | ||
| 276 | // TODO | ||
| 277 | }; | ||
| 278 | |||
| 279 | pub const PiwgFirmwareFileDevicePath = packed struct { | ||
| 280 | type: DevicePathType, | ||
| 281 | subtype: Subtype, | ||
| 282 | length: u16, | ||
| 283 | }; | ||
| 284 | |||
| 285 | pub const PiwgFirmwareVolumeDevicePath = packed struct { | ||
| 286 | type: DevicePathType, | ||
| 287 | subtype: Subtype, | ||
| 288 | length: u16, | ||
| 289 | }; | ||
| 290 | |||
| 291 | pub const RelativeOffsetRangeDevicePath = packed struct { | ||
| 292 | type: DevicePathType, | ||
| 293 | subtype: Subtype, | ||
| 294 | length: u16, | ||
| 295 | reserved: u32, | ||
| 296 | start: u64, | ||
| 297 | end: u64, | ||
| 298 | }; | ||
| 299 | |||
| 300 | pub const RamDiskDevicePath = packed struct { | ||
| 301 | type: DevicePathType, | ||
| 302 | subtype: Subtype, | ||
| 303 | length: u16, | ||
| 304 | start: u64, | ||
| 305 | end: u64, | ||
| 306 | disk_type: uefi.Guid, | ||
| 307 | instance: u16, | ||
| 308 | }; | ||
| 309 | }; | ||
| 310 | |||
| 311 | pub const BiosBootSpecificationDevicePath = union(Subtype) { | ||
| 312 | BBS101: *const BBS101DevicePath, | ||
| 313 | |||
| 314 | pub const Subtype = extern enum(u8) { | ||
| 315 | BBS101 = 1, | ||
| 316 | _, | ||
| 317 | }; | ||
| 318 | |||
| 319 | pub const BBS101DevicePath = packed struct { | ||
| 320 | type: DevicePathType, | ||
| 321 | subtype: Subtype, | ||
| 322 | length: u16, | ||
| 323 | device_type: u16, | ||
| 324 | status_flag: u16, | ||
| 325 | |||
| 326 | pub fn getDescription(self: *const BBS101DevicePath) [*:0]const u8 { | ||
| 327 | return @ptrCast([*:0]const u8, self) + @sizeOf(BBS101DevicePath); | ||
| 328 | } | ||
| 329 | }; | ||
| 330 | }; | ||
| 331 | |||
| 332 | pub const EndDevicePath = union(Subtype) { | ||
| 333 | EndEntire: *const EndEntireDevicePath, | ||
| 334 | EndThisInstance: *const EndThisInstanceDevicePath, | ||
| 335 | |||
| 336 | pub const Subtype = extern enum(u8) { | ||
| 337 | EndEntire = 0xff, | ||
| 338 | EndThisInstance = 0x01, | ||
| 339 | _, | ||
| 340 | }; | ||
| 341 | |||
| 342 | pub const EndEntireDevicePath = packed struct { | ||
| 343 | type: DevicePathType, | ||
| 344 | subtype: Subtype, | ||
| 345 | length: u16, | ||
| 346 | }; | ||
| 347 | |||
| 348 | pub const EndThisInstanceDevicePath = packed struct { | ||
| 349 | type: DevicePathType, | ||
| 350 | subtype: Subtype, | ||
| 351 | length: u16, | ||
| 352 | }; | ||
| 17 | }; | 353 | }; |
lib/std/os/uefi/protocols/edid_override_protocol.zig+3-2| ... | @@ -1,14 +1,15 @@ | ... | @@ -1,14 +1,15 @@ |
| 1 | const uefi = @import("std").os.uefi; | 1 | const uefi = @import("std").os.uefi; |
| 2 | const Guid = uefi.Guid; | 2 | const Guid = uefi.Guid; |
| 3 | const Handle = uefi.Handle; | 3 | const Handle = uefi.Handle; |
| 4 | const Status = uefi.Status; | ||
| 4 | 5 | ||
| 5 | /// Override EDID information | 6 | /// Override EDID information |
| 6 | pub const EdidOverrideProtocol = extern struct { | 7 | pub 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, |
| 8 | 9 | ||
| 9 | /// Returns policy information and potentially a replacement EDID for the specified video output device. | 10 | /// Returns policy information and potentially a replacement EDID for the specified video output device. |
| 10 | /// attributes must be align(4) | 11 | /// 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 { |
| 12 | return self._get_edid(self, handle, attributes, edid_size, edid); | 13 | return self._get_edid(self, handle, attributes, edid_size, edid); |
| 13 | } | 14 | } |
| 14 | 15 |
lib/std/os/uefi/protocols/file_protocol.zig+21-17| ... | @@ -1,47 +1,48 @@ | ... | @@ -1,47 +1,48 @@ |
| 1 | const uefi = @import("std").os.uefi; | 1 | const uefi = @import("std").os.uefi; |
| 2 | const Guid = uefi.Guid; | 2 | const Guid = uefi.Guid; |
| 3 | const Time = uefi.Time; | 3 | const Time = uefi.Time; |
| 4 | const Status = uefi.Status; | ||
| 4 | 5 | ||
| 5 | pub const FileProtocol = extern struct { | 6 | pub const FileProtocol = extern struct { |
| 6 | revision: u64, | 7 | revision: u64, |
| 7 | _open: extern fn (*const FileProtocol, **const FileProtocol, *u16, u64, u64) usize, | 8 | _open: extern fn (*const FileProtocol, **const FileProtocol, [*:0]const u16, u64, u64) Status, |
| 8 | _close: extern fn (*const FileProtocol) usize, | 9 | _close: extern fn (*const FileProtocol) Status, |
| 9 | _delete: extern fn (*const FileProtocol) usize, | 10 | _delete: extern fn (*const FileProtocol) Status, |
| 10 | _read: extern fn (*const FileProtocol, *usize, *c_void) usize, | 11 | _read: extern fn (*const FileProtocol, *usize, [*]u8) Status, |
| 11 | _write: extern fn (*const FileProtocol, *usize, *c_void) usize, | 12 | _write: extern fn (*const FileProtocol, *usize, [*]const u8) Status, |
| 12 | _get_info: extern fn (*const FileProtocol, *Guid, *usize, *c_void) usize, | 13 | _get_info: extern fn (*const FileProtocol, *Guid, *usize, *c_void) Status, |
| 13 | _set_info: extern fn (*const FileProtocol, *Guid, usize, *c_void) usize, | 14 | _set_info: extern fn (*const FileProtocol, *Guid, usize, *const c_void) Status, |
| 14 | _flush: extern fn (*const FileProtocol) usize, | 15 | _flush: extern fn (*const FileProtocol) Status, |
| 15 | 16 | ||
| 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: [*:0]const u16, open_mode: u64, attributes: u64) Status { |
| 17 | return self._open(self, new_handle, file_name, open_mode, attributes); | 18 | return self._open(self, new_handle, file_name, open_mode, attributes); |
| 18 | } | 19 | } |
| 19 | 20 | ||
| 20 | pub fn close(self: *const FileProtocol) usize { | 21 | pub fn close(self: *const FileProtocol) Status { |
| 21 | return self._close(self); | 22 | return self._close(self); |
| 22 | } | 23 | } |
| 23 | 24 | ||
| 24 | pub fn delete(self: *const FileProtocol) usize { | 25 | pub fn delete(self: *const FileProtocol) Status { |
| 25 | return self._delete(self); | 26 | return self._delete(self); |
| 26 | } | 27 | } |
| 27 | 28 | ||
| 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: [*]u8) Status { |
| 29 | return self._read(self, buffer_size, buffer); | 30 | return self._read(self, buffer_size, buffer); |
| 30 | } | 31 | } |
| 31 | 32 | ||
| 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: [*]const u8) Status { |
| 33 | return self._write(self, buffer_size, buffer); | 34 | return self._write(self, buffer_size, buffer); |
| 34 | } | 35 | } |
| 35 | 36 | ||
| 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 { |
| 37 | return self._get_info(self, information_type, buffer_size, buffer); | 38 | return self._get_info(self, information_type, buffer_size, buffer); |
| 38 | } | 39 | } |
| 39 | 40 | ||
| 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: *const c_void) Status { |
| 41 | return self._set_info(self, information_type, buffer_size, buffer); | 42 | return self._set_info(self, information_type, buffer_size, buffer); |
| 42 | } | 43 | } |
| 43 | 44 | ||
| 44 | pub fn flush(self: *const FileProtocol) usize { | 45 | pub fn flush(self: *const FileProtocol) Status { |
| 45 | return self._flush(self); | 46 | return self._flush(self); |
| 46 | } | 47 | } |
| 47 | 48 | ||
| ... | @@ -75,7 +76,10 @@ pub const FileInfo = extern struct { | ... | @@ -75,7 +76,10 @@ pub const FileInfo = extern struct { |
| 75 | last_access_time: Time, | 76 | last_access_time: Time, |
| 76 | modification_time: Time, | 77 | modification_time: Time, |
| 77 | attribute: u64, | 78 | attribute: u64, |
| 78 | file_name: [100:0]u16, | 79 | |
| 80 | pub fn getFileName(self: *const FileInfo) [*:0]const u16 { | ||
| 81 | return @ptrCast([*:0]const u16, @ptrCast([*]const u8, self) + @sizeOf(FileInfo)); | ||
| 82 | } | ||
| 79 | 83 | ||
| 80 | pub const efi_file_read_only: u64 = 0x0000000000000001; | 84 | pub const efi_file_read_only: u64 = 0x0000000000000001; |
| 81 | pub const efi_file_hidden: u64 = 0x0000000000000002; | 85 | pub const efi_file_hidden: u64 = 0x0000000000000002; |
lib/std/os/uefi/protocols/graphics_output_protocol.zig+7-6| ... | @@ -1,25 +1,26 @@ | ... | @@ -1,25 +1,26 @@ |
| 1 | const uefi = @import("std").os.uefi; | 1 | const uefi = @import("std").os.uefi; |
| 2 | const Guid = uefi.Guid; | 2 | const Guid = uefi.Guid; |
| 3 | const Status = uefi.Status; | ||
| 3 | 4 | ||
| 4 | /// Graphics output | 5 | /// Graphics output |
| 5 | pub const GraphicsOutputProtocol = extern struct { | 6 | pub const GraphicsOutputProtocol = extern struct { |
| 6 | _query_mode: extern fn (*const GraphicsOutputProtocol, u32, *usize, **GraphicsOutputModeInformation) usize, | 7 | _query_mode: extern fn (*const GraphicsOutputProtocol, u32, *usize, **GraphicsOutputModeInformation) Status, |
| 7 | _set_mode: extern fn (*const GraphicsOutputProtocol, u32) usize, | 8 | _set_mode: extern fn (*const GraphicsOutputProtocol, u32) Status, |
| 8 | _blt: extern fn (*const GraphicsOutputProtocol, ?[*]GraphicsOutputBltPixel, GraphicsOutputBltOperation, usize, usize, usize, usize, usize, usize, usize) usize, | 9 | _blt: extern fn (*const GraphicsOutputProtocol, ?[*]GraphicsOutputBltPixel, GraphicsOutputBltOperation, usize, usize, usize, usize, usize, usize, usize) Status, |
| 9 | mode: *GraphicsOutputProtocolMode, | 10 | mode: *GraphicsOutputProtocolMode, |
| 10 | 11 | ||
| 11 | /// Returns information for an available graphics mode that the graphics device and the set of active video output devices supports. | 12 | /// 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 { |
| 13 | return self._query_mode(self, mode, size_of_info, info); | 14 | return self._query_mode(self, mode, size_of_info, info); |
| 14 | } | 15 | } |
| 15 | 16 | ||
| 16 | /// Set the video device into the specified mode and clears the visible portions of the output display to black. | 17 | /// 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 { |
| 18 | return self._set_mode(self, mode); | 19 | return self._set_mode(self, mode); |
| 19 | } | 20 | } |
| 20 | 21 | ||
| 21 | /// Blt a rectangle of pixels on the graphics screen. Blt stands for BLock Transfer. | 22 | /// 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 { |
| 23 | return self._blt(self, blt_buffer, blt_operation, source_x, source_y, destination_x, destination_y, width, height, delta); | 24 | return self._blt(self, blt_buffer, blt_operation, source_x, source_y, destination_x, destination_y, width, height, delta); |
| 24 | } | 25 | } |
| 25 | 26 |
lib/std/os/uefi/protocols/hii_database_protocol.zig+16-15| ... | @@ -1,38 +1,39 @@ | ... | @@ -1,38 +1,39 @@ |
| 1 | const uefi = @import("std").os.uefi; | 1 | const uefi = @import("std").os.uefi; |
| 2 | const Guid = uefi.Guid; | 2 | const Guid = uefi.Guid; |
| 3 | const Status = uefi.Status; | ||
| 3 | const hii = uefi.protocols.hii; | 4 | const hii = uefi.protocols.hii; |
| 4 | 5 | ||
| 5 | /// Database manager for HII-related data structures. | 6 | /// Database manager for HII-related data structures. |
| 6 | pub const HIIDatabaseProtocol = extern struct { | 7 | pub const HIIDatabaseProtocol = extern struct { |
| 7 | _new_package_list: usize, // TODO | 8 | _new_package_list: Status, // TODO |
| 8 | _remove_package_list: extern fn (*const HIIDatabaseProtocol, hii.HIIHandle) usize, | 9 | _remove_package_list: extern fn (*const HIIDatabaseProtocol, hii.HIIHandle) Status, |
| 9 | _update_package_list: extern fn (*const HIIDatabaseProtocol, hii.HIIHandle, *const hii.HIIPackageList) usize, | 10 | _update_package_list: extern fn (*const HIIDatabaseProtocol, hii.HIIHandle, *const hii.HIIPackageList) Status, |
| 10 | _list_package_lists: extern fn (*const HIIDatabaseProtocol, u8, ?*const Guid, *usize, [*]hii.HIIHandle) usize, | 11 | _list_package_lists: extern fn (*const HIIDatabaseProtocol, u8, ?*const Guid, *usize, [*]hii.HIIHandle) Status, |
| 11 | _export_package_lists: extern fn (*const HIIDatabaseProtocol, ?hii.HIIHandle, *usize, *hii.HIIPackageList) usize, | 12 | _export_package_lists: extern fn (*const HIIDatabaseProtocol, ?hii.HIIHandle, *usize, *hii.HIIPackageList) Status, |
| 12 | _register_package_notify: usize, // TODO | 13 | _register_package_notify: Status, // TODO |
| 13 | _unregister_package_notify: usize, // TODO | 14 | _unregister_package_notify: Status, // TODO |
| 14 | _find_keyboard_layouts: usize, // TODO | 15 | _find_keyboard_layouts: Status, // TODO |
| 15 | _get_keyboard_layout: usize, // TODO | 16 | _get_keyboard_layout: Status, // TODO |
| 16 | _set_keyboard_layout: usize, // TODO | 17 | _set_keyboard_layout: Status, // TODO |
| 17 | _get_package_list_handle: usize, // TODO | 18 | _get_package_list_handle: Status, // TODO |
| 18 | 19 | ||
| 19 | /// Removes a package list from the HII database. | 20 | /// 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 { |
| 21 | return self._remove_package_list(self, handle); | 22 | return self._remove_package_list(self, handle); |
| 22 | } | 23 | } |
| 23 | 24 | ||
| 24 | /// Update a package list in the HII database. | 25 | /// 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 { |
| 26 | return self._update_package_list(self, handle, buffer); | 27 | return self._update_package_list(self, handle, buffer); |
| 27 | } | 28 | } |
| 28 | 29 | ||
| 29 | /// Determines the handles that are currently active in the database. | 30 | /// 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 { |
| 31 | return self._list_package_lists(self, package_type, package_guid, buffer_length, handles); | 32 | return self._list_package_lists(self, package_type, package_guid, buffer_length, handles); |
| 32 | } | 33 | } |
| 33 | 34 | ||
| 34 | /// Exports the contents of one or all package lists in the HII database into a buffer. | 35 | /// 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 { |
| 36 | return self._export_package_lists(self, handle, buffer_size, buffer); | 37 | return self._export_package_lists(self, handle, buffer_size, buffer); |
| 37 | } | 38 | } |
| 38 | 39 |
lib/std/os/uefi/protocols/hii_popup_protocol.zig+3-2| ... | @@ -1,14 +1,15 @@ | ... | @@ -1,14 +1,15 @@ |
| 1 | const uefi = @import("std").os.uefi; | 1 | const uefi = @import("std").os.uefi; |
| 2 | const Guid = uefi.Guid; | 2 | const Guid = uefi.Guid; |
| 3 | const Status = uefi.Status; | ||
| 3 | const hii = uefi.protocols.hii; | 4 | const hii = uefi.protocols.hii; |
| 4 | 5 | ||
| 5 | /// Display a popup window | 6 | /// Display a popup window |
| 6 | pub const HIIPopupProtocol = extern struct { | 7 | pub const HIIPopupProtocol = extern struct { |
| 7 | revision: u64, | 8 | 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, |
| 9 | 10 | ||
| 10 | /// Displays a popup window. | 11 | /// 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 { |
| 12 | return self._create_popup(self, style, popup_type, handle, msg, user_selection); | 13 | return self._create_popup(self, style, popup_type, handle, msg, user_selection); |
| 13 | } | 14 | } |
| 14 | 15 |
lib/std/os/uefi/protocols/ip6_config_protocol.zig+9-8| ... | @@ -1,26 +1,27 @@ | ... | @@ -1,26 +1,27 @@ |
| 1 | const uefi = @import("std").os.uefi; | 1 | const uefi = @import("std").os.uefi; |
| 2 | const Guid = uefi.Guid; | 2 | const Guid = uefi.Guid; |
| 3 | const Event = uefi.Event; | 3 | const Event = uefi.Event; |
| 4 | const Status = uefi.Status; | ||
| 4 | 5 | ||
| 5 | pub const Ip6ConfigProtocol = extern struct { | 6 | pub const Ip6ConfigProtocol = extern struct { |
| 6 | _set_data: extern fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, usize, *const c_void) usize, | 7 | _set_data: extern fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, usize, *const c_void) Status, |
| 7 | _get_data: extern fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, *usize, ?*const c_void) usize, | 8 | _get_data: extern fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, *usize, ?*const c_void) Status, |
| 8 | _register_data_notify: extern fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) usize, | 9 | _register_data_notify: extern fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) Status, |
| 9 | _unregister_data_notify: extern fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) usize, | 10 | _unregister_data_notify: extern fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) Status, |
| 10 | 11 | ||
| 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 { |
| 12 | return self._set_data(self, data_type, data_size, data); | 13 | return self._set_data(self, data_type, data_size, data); |
| 13 | } | 14 | } |
| 14 | 15 | ||
| 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 { |
| 16 | return self._get_data(self, data_type, data_size, data); | 17 | return self._get_data(self, data_type, data_size, data); |
| 17 | } | 18 | } |
| 18 | 19 | ||
| 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 { |
| 20 | return self._register_data_notify(self, data_type, event); | 21 | return self._register_data_notify(self, data_type, event); |
| 21 | } | 22 | } |
| 22 | 23 | ||
| 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 { |
| 24 | return self._unregister_data_notify(self, data_type, event); | 25 | return self._unregister_data_notify(self, data_type, event); |
| 25 | } | 26 | } |
| 26 | 27 |
lib/std/os/uefi/protocols/ip6_protocol.zig+20-19| ... | @@ -1,63 +1,64 @@ | ... | @@ -1,63 +1,64 @@ |
| 1 | const uefi = @import("std").os.uefi; | 1 | const uefi = @import("std").os.uefi; |
| 2 | const Guid = uefi.Guid; | 2 | const Guid = uefi.Guid; |
| 3 | const Event = uefi.Event; | 3 | const Event = uefi.Event; |
| 4 | const Status = uefi.Status; | ||
| 4 | const MacAddress = uefi.protocols.MacAddress; | 5 | const MacAddress = uefi.protocols.MacAddress; |
| 5 | const ManagedNetworkConfigData = uefi.protocols.ManagedNetworkConfigData; | 6 | const ManagedNetworkConfigData = uefi.protocols.ManagedNetworkConfigData; |
| 6 | const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode; | 7 | const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode; |
| 7 | 8 | ||
| 8 | pub const Ip6Protocol = extern struct { | 9 | pub const Ip6Protocol = extern struct { |
| 9 | _get_mode_data: extern fn (*const Ip6Protocol, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) usize, | 10 | _get_mode_data: extern fn (*const Ip6Protocol, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) Status, |
| 10 | _configure: extern fn (*const Ip6Protocol, ?*const Ip6ConfigData) usize, | 11 | _configure: extern fn (*const Ip6Protocol, ?*const Ip6ConfigData) Status, |
| 11 | _groups: extern fn (*const Ip6Protocol, bool, ?*const Ip6Address) usize, | 12 | _groups: extern fn (*const Ip6Protocol, bool, ?*const Ip6Address) Status, |
| 12 | _routes: extern fn (*const Ip6Protocol, bool, ?*const Ip6Address, u8, ?*const Ip6Address) usize, | 13 | _routes: extern fn (*const Ip6Protocol, bool, ?*const Ip6Address, u8, ?*const Ip6Address) Status, |
| 13 | _neighbors: extern fn (*const Ip6Protocol, bool, *const Ip6Address, ?*const MacAddress, u32, bool) usize, | 14 | _neighbors: extern fn (*const Ip6Protocol, bool, *const Ip6Address, ?*const MacAddress, u32, bool) Status, |
| 14 | _transmit: extern fn (*const Ip6Protocol, *Ip6CompletionToken) usize, | 15 | _transmit: extern fn (*const Ip6Protocol, *Ip6CompletionToken) Status, |
| 15 | _receive: extern fn (*const Ip6Protocol, *Ip6CompletionToken) usize, | 16 | _receive: extern fn (*const Ip6Protocol, *Ip6CompletionToken) Status, |
| 16 | _cancel: extern fn (*const Ip6Protocol, ?*Ip6CompletionToken) usize, | 17 | _cancel: extern fn (*const Ip6Protocol, ?*Ip6CompletionToken) Status, |
| 17 | _poll: extern fn (*const Ip6Protocol) usize, | 18 | _poll: extern fn (*const Ip6Protocol) Status, |
| 18 | 19 | ||
| 19 | /// Gets the current operational settings for this instance of the EFI IPv6 Protocol driver. | 20 | /// 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 { |
| 21 | return self._get_mode_data(self, ip6_mode_data, mnp_config_data, snp_mode_data); | 22 | return self._get_mode_data(self, ip6_mode_data, mnp_config_data, snp_mode_data); |
| 22 | } | 23 | } |
| 23 | 24 | ||
| 24 | /// Assign IPv6 address and other configuration parameter to this EFI IPv6 Protocol driver instance. | 25 | /// 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 { |
| 26 | return self._configure(self, ip6_config_data); | 27 | return self._configure(self, ip6_config_data); |
| 27 | } | 28 | } |
| 28 | 29 | ||
| 29 | /// Joins and leaves multicast groups. | 30 | /// 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 { |
| 31 | return self._groups(self, join_flag, group_address); | 32 | return self._groups(self, join_flag, group_address); |
| 32 | } | 33 | } |
| 33 | 34 | ||
| 34 | /// Adds and deletes routing table entries. | 35 | /// 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 { |
| 36 | return self._routes(self, delete_route, destination, prefix_length, gateway_address); | 37 | return self._routes(self, delete_route, destination, prefix_length, gateway_address); |
| 37 | } | 38 | } |
| 38 | 39 | ||
| 39 | /// Add or delete Neighbor cache entries. | 40 | /// 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 { |
| 41 | return self._neighbors(self, delete_flag, target_ip6_address, target_link_address, timeout, override); | 42 | return self._neighbors(self, delete_flag, target_ip6_address, target_link_address, timeout, override); |
| 42 | } | 43 | } |
| 43 | 44 | ||
| 44 | /// Places outgoing data packets into the transmit queue. | 45 | /// 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 { |
| 46 | return self._transmit(self, token); | 47 | return self._transmit(self, token); |
| 47 | } | 48 | } |
| 48 | 49 | ||
| 49 | /// Places a receiving request into the receiving queue. | 50 | /// 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 { |
| 51 | return self._receive(self, token); | 52 | return self._receive(self, token); |
| 52 | } | 53 | } |
| 53 | 54 | ||
| 54 | /// Abort an asynchronous transmits or receive request. | 55 | /// 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 { |
| 56 | return self._cancel(self, token); | 57 | return self._cancel(self, token); |
| 57 | } | 58 | } |
| 58 | 59 | ||
| 59 | /// Polls for incoming data packets and processes outgoing data packets. | 60 | /// 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 { |
| 61 | return self._poll(self); | 62 | return self._poll(self); |
| 62 | } | 63 | } |
| 63 | 64 | ||
| ... | @@ -138,6 +139,6 @@ pub const Ip6IcmpType = extern struct { | ... | @@ -138,6 +139,6 @@ pub const Ip6IcmpType = extern struct { |
| 138 | 139 | ||
| 139 | pub const Ip6CompletionToken = extern struct { | 140 | pub const Ip6CompletionToken = extern struct { |
| 140 | event: Event, | 141 | event: Event, |
| 141 | status: usize, | 142 | status: Status, |
| 142 | packet: *c_void, // union TODO | 143 | packet: *c_void, // union TODO |
| 143 | }; | 144 | }; |
lib/std/os/uefi/protocols/ip6_service_binding_protocol.zig+5-4| ... | @@ -1,16 +1,17 @@ | ... | @@ -1,16 +1,17 @@ |
| 1 | const uefi = @import("std").os.uefi; | 1 | const uefi = @import("std").os.uefi; |
| 2 | const Handle = uefi.Handle; | 2 | const Handle = uefi.Handle; |
| 3 | const Guid = uefi.Guid; | 3 | const Guid = uefi.Guid; |
| 4 | const Status = uefi.Status; | ||
| 4 | 5 | ||
| 5 | pub const Ip6ServiceBindingProtocol = extern struct { | 6 | pub const Ip6ServiceBindingProtocol = extern struct { |
| 6 | _create_child: extern fn (*const Ip6ServiceBindingProtocol, *?Handle) usize, | 7 | _create_child: extern fn (*const Ip6ServiceBindingProtocol, *?Handle) Status, |
| 7 | _destroy_child: extern fn (*const Ip6ServiceBindingProtocol, Handle) usize, | 8 | _destroy_child: extern fn (*const Ip6ServiceBindingProtocol, Handle) Status, |
| 8 | 9 | ||
| 9 | pub fn createChild(self: *const Ip6ServiceBindingProtocol, handle: *?Handle) usize { | 10 | pub fn createChild(self: *const Ip6ServiceBindingProtocol, handle: *?Handle) Status { |
| 10 | return self._create_child(self, handle); | 11 | return self._create_child(self, handle); |
| 11 | } | 12 | } |
| 12 | 13 | ||
| 13 | pub fn destroyChild(self: *const Ip6ServiceBindingProtocol, handle: Handle) usize { | 14 | pub fn destroyChild(self: *const Ip6ServiceBindingProtocol, handle: Handle) Status { |
| 14 | return self._destroy_child(self, handle); | 15 | return self._destroy_child(self, handle); |
| 15 | } | 16 | } |
| 16 | 17 |
lib/std/os/uefi/protocols/loaded_image_protocol.zig+13-3| ... | @@ -1,6 +1,7 @@ | ... | @@ -1,6 +1,7 @@ |
| 1 | const uefi = @import("std").os.uefi; | 1 | const uefi = @import("std").os.uefi; |
| 2 | const Guid = uefi.Guid; | 2 | const Guid = uefi.Guid; |
| 3 | const Handle = uefi.Handle; | 3 | const Handle = uefi.Handle; |
| 4 | const Status = uefi.Status; | ||
| 4 | const SystemTable = uefi.tables.SystemTable; | 5 | const SystemTable = uefi.tables.SystemTable; |
| 5 | const MemoryType = uefi.tables.MemoryType; | 6 | const MemoryType = uefi.tables.MemoryType; |
| 6 | const DevicePathProtocol = uefi.protocols.DevicePathProtocol; | 7 | const DevicePathProtocol = uefi.protocols.DevicePathProtocol; |
| ... | @@ -13,15 +14,15 @@ pub const LoadedImageProtocol = extern struct { | ... | @@ -13,15 +14,15 @@ pub const LoadedImageProtocol = extern struct { |
| 13 | file_path: *DevicePathProtocol, | 14 | file_path: *DevicePathProtocol, |
| 14 | reserved: *c_void, | 15 | reserved: *c_void, |
| 15 | load_options_size: u32, | 16 | load_options_size: u32, |
| 16 | load_options: *c_void, | 17 | load_options: ?*c_void, |
| 17 | image_base: [*]u8, | 18 | image_base: [*]u8, |
| 18 | image_size: u64, | 19 | image_size: u64, |
| 19 | image_code_type: MemoryType, | 20 | image_code_type: MemoryType, |
| 20 | image_data_type: MemoryType, | 21 | image_data_type: MemoryType, |
| 21 | _unload: extern fn (*const LoadedImageProtocol, Handle) usize, | 22 | _unload: extern fn (*const LoadedImageProtocol, Handle) Status, |
| 22 | 23 | ||
| 23 | /// Unloads an image from memory. | 24 | /// 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 { |
| 25 | return self._unload(self, handle); | 26 | return self._unload(self, handle); |
| 26 | } | 27 | } |
| 27 | 28 | ||
| ... | @@ -34,3 +35,12 @@ pub const LoadedImageProtocol = extern struct { | ... | @@ -34,3 +35,12 @@ pub const LoadedImageProtocol = extern struct { |
| 34 | .node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b }, | 35 | .node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b }, |
| 35 | }; | 36 | }; |
| 36 | }; | 37 | }; |
| 38 | |||
| 39 | pub const loaded_image_device_path_protocol_guid align(8) = Guid{ | ||
| 40 | .time_low = 0xbc62157e, | ||
| 41 | .time_mid = 0x3e33, | ||
| 42 | .time_high_and_version = 0x4fec, | ||
| 43 | .clock_seq_high_and_reserved = 0x99, | ||
| 44 | .clock_seq_low = 0x20, | ||
| 45 | .node = [_]u8{ 0x2d, 0x3b, 0x36, 0xd7, 0x50, 0xdf }, | ||
| 46 | }; |
lib/std/os/uefi/protocols/managed_network_protocol.zig+17-16| ... | @@ -1,60 +1,61 @@ | ... | @@ -1,60 +1,61 @@ |
| 1 | const uefi = @import("std").os.uefi; | 1 | const uefi = @import("std").os.uefi; |
| 2 | const Guid = uefi.Guid; | 2 | const Guid = uefi.Guid; |
| 3 | const Event = uefi.Event; | 3 | const Event = uefi.Event; |
| 4 | const Status = uefi.Status; | ||
| 4 | const Time = uefi.Time; | 5 | const Time = uefi.Time; |
| 5 | const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode; | 6 | const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode; |
| 6 | const MacAddress = uefi.protocols.MacAddress; | 7 | const MacAddress = uefi.protocols.MacAddress; |
| 7 | 8 | ||
| 8 | pub const ManagedNetworkProtocol = extern struct { | 9 | pub const ManagedNetworkProtocol = extern struct { |
| 9 | _get_mode_data: extern fn (*const ManagedNetworkProtocol, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) usize, | 10 | _get_mode_data: extern fn (*const ManagedNetworkProtocol, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) Status, |
| 10 | _configure: extern fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkConfigData) usize, | 11 | _configure: extern fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkConfigData) Status, |
| 11 | _mcast_ip_to_mac: extern fn (*const ManagedNetworkProtocol, bool, *const c_void, *MacAddress) usize, | 12 | _mcast_ip_to_mac: extern fn (*const ManagedNetworkProtocol, bool, *const c_void, *MacAddress) Status, |
| 12 | _groups: extern fn (*const ManagedNetworkProtocol, bool, ?*const MacAddress) usize, | 13 | _groups: extern fn (*const ManagedNetworkProtocol, bool, ?*const MacAddress) Status, |
| 13 | _transmit: extern fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) usize, | 14 | _transmit: extern fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) Status, |
| 14 | _receive: extern fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) usize, | 15 | _receive: extern fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) Status, |
| 15 | _cancel: extern fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkCompletionToken) usize, | 16 | _cancel: extern fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkCompletionToken) Status, |
| 16 | _poll: extern fn (*const ManagedNetworkProtocol) usize, | 17 | _poll: extern fn (*const ManagedNetworkProtocol) usize, |
| 17 | 18 | ||
| 18 | /// Returns the operational parameters for the current MNP child driver. | 19 | /// Returns the operational parameters for the current MNP child driver. |
| 19 | /// May also support returning the underlying SNP driver mode data. | 20 | /// 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 { |
| 21 | return self._get_mode_data(self, mnp_config_data, snp_mode_data); | 22 | return self._get_mode_data(self, mnp_config_data, snp_mode_data); |
| 22 | } | 23 | } |
| 23 | 24 | ||
| 24 | /// Sets or clears the operational parameters for the MNP child driver. | 25 | /// 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 { |
| 26 | return self._configure(self, mnp_config_data); | 27 | return self._configure(self, mnp_config_data); |
| 27 | } | 28 | } |
| 28 | 29 | ||
| 29 | /// Translates an IP multicast address to a hardware (MAC) multicast address. | 30 | /// Translates an IP multicast address to a hardware (MAC) multicast address. |
| 30 | /// This function may be unsupported in some MNP implementations. | 31 | /// 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 { |
| 32 | return self._mcast_ip_to_mac(self, ipv6flag, ipaddress); | 33 | return self._mcast_ip_to_mac(self, ipv6flag, ipaddress); |
| 33 | } | 34 | } |
| 34 | 35 | ||
| 35 | /// Enables and disables receive filters for multicast address. | 36 | /// Enables and disables receive filters for multicast address. |
| 36 | /// This function may be unsupported in some MNP implementations. | 37 | /// 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 { |
| 38 | return self._groups(self, join_flag, mac_address); | 39 | return self._groups(self, join_flag, mac_address); |
| 39 | } | 40 | } |
| 40 | 41 | ||
| 41 | /// Places asynchronous outgoing data packets into the transmit queue. | 42 | /// 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 { |
| 43 | return self._transmit(self, token); | 44 | return self._transmit(self, token); |
| 44 | } | 45 | } |
| 45 | 46 | ||
| 46 | /// Places an asynchronous receiving request into the receiving queue. | 47 | /// 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 { |
| 48 | return self._receive(self, token); | 49 | return self._receive(self, token); |
| 49 | } | 50 | } |
| 50 | 51 | ||
| 51 | /// Aborts an asynchronous transmit or receive request. | 52 | /// 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 { |
| 53 | return self._cancel(self, token); | 54 | return self._cancel(self, token); |
| 54 | } | 55 | } |
| 55 | 56 | ||
| 56 | /// Polls for incoming data packets and processes outgoing data packets. | 57 | /// 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 { |
| 58 | return self._poll(self); | 59 | return self._poll(self); |
| 59 | } | 60 | } |
| 60 | 61 | ||
| ... | @@ -83,7 +84,7 @@ pub const ManagedNetworkConfigData = extern struct { | ... | @@ -83,7 +84,7 @@ pub const ManagedNetworkConfigData = extern struct { |
| 83 | 84 | ||
| 84 | pub const ManagedNetworkCompletionToken = extern struct { | 85 | pub const ManagedNetworkCompletionToken = extern struct { |
| 85 | event: Event, | 86 | event: Event, |
| 86 | status: usize, | 87 | status: Status, |
| 87 | packet: extern union { | 88 | packet: extern union { |
| 88 | RxData: *ManagedNetworkReceiveData, | 89 | RxData: *ManagedNetworkReceiveData, |
| 89 | TxData: *ManagedNetworkTransmitData, | 90 | TxData: *ManagedNetworkTransmitData, |
lib/std/os/uefi/protocols/managed_network_service_binding_protocol.zig+5-4| ... | @@ -1,16 +1,17 @@ | ... | @@ -1,16 +1,17 @@ |
| 1 | const uefi = @import("std").os.uefi; | 1 | const uefi = @import("std").os.uefi; |
| 2 | const Handle = uefi.Handle; | 2 | const Handle = uefi.Handle; |
| 3 | const Guid = uefi.Guid; | 3 | const Guid = uefi.Guid; |
| 4 | const Status = uefi.Status; | ||
| 4 | 5 | ||
| 5 | pub const ManagedNetworkServiceBindingProtocol = extern struct { | 6 | pub const ManagedNetworkServiceBindingProtocol = extern struct { |
| 6 | _create_child: extern fn (*const ManagedNetworkServiceBindingProtocol, *?Handle) usize, | 7 | _create_child: extern fn (*const ManagedNetworkServiceBindingProtocol, *?Handle) Status, |
| 7 | _destroy_child: extern fn (*const ManagedNetworkServiceBindingProtocol, Handle) usize, | 8 | _destroy_child: extern fn (*const ManagedNetworkServiceBindingProtocol, Handle) Status, |
| 8 | 9 | ||
| 9 | pub fn createChild(self: *const ManagedNetworkServiceBindingProtocol, handle: *?Handle) usize { | 10 | pub fn createChild(self: *const ManagedNetworkServiceBindingProtocol, handle: *?Handle) Status { |
| 10 | return self._create_child(self, handle); | 11 | return self._create_child(self, handle); |
| 11 | } | 12 | } |
| 12 | 13 | ||
| 13 | pub fn destroyChild(self: *const ManagedNetworkServiceBindingProtocol, handle: Handle) usize { | 14 | pub fn destroyChild(self: *const ManagedNetworkServiceBindingProtocol, handle: Handle) Status { |
| 14 | return self._destroy_child(self, handle); | 15 | return self._destroy_child(self, handle); |
| 15 | } | 16 | } |
| 16 | 17 |
lib/std/os/uefi/protocols/rng_protocol.zig+5-4| ... | @@ -1,18 +1,19 @@ | ... | @@ -1,18 +1,19 @@ |
| 1 | const uefi = @import("std").os.uefi; | 1 | const uefi = @import("std").os.uefi; |
| 2 | const Guid = uefi.Guid; | 2 | const Guid = uefi.Guid; |
| 3 | const Status = uefi.Status; | ||
| 3 | 4 | ||
| 4 | /// Random Number Generator protocol | 5 | /// Random Number Generator protocol |
| 5 | pub const RNGProtocol = extern struct { | 6 | pub const RNGProtocol = extern struct { |
| 6 | _get_info: extern fn (*const RNGProtocol, *usize, [*]align(8) Guid) usize, | 7 | _get_info: extern fn (*const RNGProtocol, *usize, [*]align(8) Guid) Status, |
| 7 | _get_rng: extern fn (*const RNGProtocol, ?*align(8) const Guid, usize, [*]u8) usize, | 8 | _get_rng: extern fn (*const RNGProtocol, ?*align(8) const Guid, usize, [*]u8) Status, |
| 8 | 9 | ||
| 9 | /// Returns information about the random number generation implementation. | 10 | /// 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 { |
| 11 | return self._get_info(self, list_size, list); | 12 | return self._get_info(self, list_size, list); |
| 12 | } | 13 | } |
| 13 | 14 | ||
| 14 | /// Produces and returns an RNG value using either the default or specified RNG algorithm. | 15 | /// 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 { |
| 16 | return self._get_rng(self, algo, value_length, value); | 17 | return self._get_rng(self, algo, value_length, value); |
| 17 | } | 18 | } |
| 18 | 19 |
lib/std/os/uefi/protocols/shell_parameters_protocol.zig created+20| ... | @@ -0,0 +1,20 @@ | ||
| 1 | const uefi = @import("std").os.uefi; | ||
| 2 | const Guid = uefi.Guid; | ||
| 3 | const FileHandle = uefi.FileHandle; | ||
| 4 | |||
| 5 | pub const ShellParametersProtocol = extern struct { | ||
| 6 | argv: [*][*:0]const u16, | ||
| 7 | argc: usize, | ||
| 8 | stdin: FileHandle, | ||
| 9 | stdout: FileHandle, | ||
| 10 | stderr: FileHandle, | ||
| 11 | |||
| 12 | pub const guid align(8) = Guid{ | ||
| 13 | .time_low = 0x752f3136, | ||
| 14 | .time_mid = 0x4e16, | ||
| 15 | .time_high_and_version = 0x4fdc, | ||
| 16 | .clock_seq_high_and_reserved = 0xa2, | ||
| 17 | .clock_seq_low = 0x2a, | ||
| 18 | .node = [_]u8{ 0xe5, 0xf4, 0x68, 0x12, 0xf4, 0xca }, | ||
| 19 | }; | ||
| 20 | }; | ||
lib/std/os/uefi/protocols/simple_file_system_protocol.zig+4-3| ... | @@ -1,12 +1,13 @@ | ... | @@ -1,12 +1,13 @@ |
| 1 | const uefi = @import("std").os.uefi; | 1 | const uefi = @import("std").os.uefi; |
| 2 | const Guid = uefi.Guid; | 2 | const Guid = uefi.Guid; |
| 3 | const FileProtocol = uefi.protocols.FileProtocol; | 3 | const FileProtocol = uefi.protocols.FileProtocol; |
| 4 | const Status = uefi.Status; | ||
| 4 | 5 | ||
| 5 | const SimpleFileSystemProtocol = extern struct { | 6 | pub const SimpleFileSystemProtocol = extern struct { |
| 6 | revision: u64, | 7 | revision: u64, |
| 7 | _open_volume: extern fn (*const SimpleFileSystemProtocol, **const FileProtocol) usize, | 8 | _open_volume: extern fn (*const SimpleFileSystemProtocol, **const FileProtocol) Status, |
| 8 | 9 | ||
| 9 | pub fn openVolume(self: *const SimpleFileSystemProtocol, root: **const FileProtocol) usize { | 10 | pub fn openVolume(self: *const SimpleFileSystemProtocol, root: **const FileProtocol) Status { |
| 10 | return self._open_volume(self, root); | 11 | return self._open_volume(self, root); |
| 11 | } | 12 | } |
| 12 | 13 |
lib/std/os/uefi/protocols/simple_network_protocol.zig+27-26| ... | @@ -1,87 +1,88 @@ | ... | @@ -1,87 +1,88 @@ |
| 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 Status = uefi.Status; | ||
| 4 | 5 | ||
| 5 | pub const SimpleNetworkProtocol = extern struct { | 6 | pub const SimpleNetworkProtocol = extern struct { |
| 6 | revision: u64, | 7 | revision: u64, |
| 7 | _start: extern fn (*const SimpleNetworkProtocol) usize, | 8 | _start: extern fn (*const SimpleNetworkProtocol) Status, |
| 8 | _stop: extern fn (*const SimpleNetworkProtocol) usize, | 9 | _stop: extern fn (*const SimpleNetworkProtocol) Status, |
| 9 | _initialize: extern fn (*const SimpleNetworkProtocol, usize, usize) usize, | 10 | _initialize: extern fn (*const SimpleNetworkProtocol, usize, usize) Status, |
| 10 | _reset: extern fn (*const SimpleNetworkProtocol, bool) usize, | 11 | _reset: extern fn (*const SimpleNetworkProtocol, bool) Status, |
| 11 | _shutdown: extern fn (*const SimpleNetworkProtocol) usize, | 12 | _shutdown: extern fn (*const SimpleNetworkProtocol) Status, |
| 12 | _receive_filters: extern fn (*const SimpleNetworkProtocol, SimpleNetworkReceiveFilter, SimpleNetworkReceiveFilter, bool, usize, ?[*]const MacAddress) usize, | 13 | _receive_filters: extern fn (*const SimpleNetworkProtocol, SimpleNetworkReceiveFilter, SimpleNetworkReceiveFilter, bool, usize, ?[*]const MacAddress) Status, |
| 13 | _station_address: extern fn (*const SimpleNetworkProtocol, bool, ?*const MacAddress) usize, | 14 | _station_address: extern fn (*const SimpleNetworkProtocol, bool, ?*const MacAddress) Status, |
| 14 | _statistics: extern fn (*const SimpleNetworkProtocol, bool, ?*usize, ?*NetworkStatistics) usize, | 15 | _statistics: extern fn (*const SimpleNetworkProtocol, bool, ?*usize, ?*NetworkStatistics) Status, |
| 15 | _mcast_ip_to_mac: extern fn (*const SimpleNetworkProtocol, bool, *const c_void, *MacAddress) usize, | 16 | _mcast_ip_to_mac: extern fn (*const SimpleNetworkProtocol, bool, *const c_void, *MacAddress) Status, |
| 16 | _nvdata: extern fn (*const SimpleNetworkProtocol, bool, usize, usize, [*]u8) usize, | 17 | _nvdata: extern fn (*const SimpleNetworkProtocol, bool, usize, usize, [*]u8) Status, |
| 17 | _get_status: extern fn (*const SimpleNetworkProtocol, *SimpleNetworkInterruptStatus, ?*?[*]u8) usize, | 18 | _get_status: extern fn (*const SimpleNetworkProtocol, *SimpleNetworkInterruptStatus, ?*?[*]u8) Status, |
| 18 | _transmit: extern fn (*const SimpleNetworkProtocol, usize, usize, [*]const u8, ?*const MacAddress, ?*const MacAddress, ?*const u16) usize, | 19 | _transmit: extern fn (*const SimpleNetworkProtocol, usize, usize, [*]const u8, ?*const MacAddress, ?*const MacAddress, ?*const u16) Status, |
| 19 | _receive: extern fn (*const SimpleNetworkProtocol, ?*usize, *usize, [*]u8, ?*MacAddress, ?*MacAddress, ?*u16) usize, | 20 | _receive: extern fn (*const SimpleNetworkProtocol, ?*usize, *usize, [*]u8, ?*MacAddress, ?*MacAddress, ?*u16) Status, |
| 20 | wait_for_packet: Event, | 21 | wait_for_packet: Event, |
| 21 | mode: *SimpleNetworkMode, | 22 | mode: *SimpleNetworkMode, |
| 22 | 23 | ||
| 23 | /// Changes the state of a network interface from "stopped" to "started". | 24 | /// 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 { |
| 25 | return self._start(self); | 26 | return self._start(self); |
| 26 | } | 27 | } |
| 27 | 28 | ||
| 28 | /// Changes the state of a network interface from "started" to "stopped". | 29 | /// 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 { |
| 30 | return self._stop(self); | 31 | return self._stop(self); |
| 31 | } | 32 | } |
| 32 | 33 | ||
| 33 | /// Resets a network adapter and allocates the transmit and receive buffers required by the network interface. | 34 | /// 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 { |
| 35 | return self._initialize(self, extra_rx_buffer_size, extra_tx_buffer_size); | 36 | return self._initialize(self, extra_rx_buffer_size, extra_tx_buffer_size); |
| 36 | } | 37 | } |
| 37 | 38 | ||
| 38 | /// Resets a network adapter and reinitializes it with the parameters that were provided in the previous call to initialize(). | 39 | /// 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 { |
| 40 | return self._reset(self, extended_verification); | 41 | return self._reset(self, extended_verification); |
| 41 | } | 42 | } |
| 42 | 43 | ||
| 43 | /// Resets a network adapter and leaves it in a state that is safe for another driver to initialize. | 44 | /// 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 { |
| 45 | return self._shutdown(self); | 46 | return self._shutdown(self); |
| 46 | } | 47 | } |
| 47 | 48 | ||
| 48 | /// Manages the multicast receive filters of a network interface. | 49 | /// 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 { |
| 50 | return self._receive_filters(self, enable, disable, reset_mcast_filter, mcast_filter_cnt, mcast_filter); | 51 | return self._receive_filters(self, enable, disable, reset_mcast_filter, mcast_filter_cnt, mcast_filter); |
| 51 | } | 52 | } |
| 52 | 53 | ||
| 53 | /// Modifies or resets the current station address, if supported. | 54 | /// 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 { |
| 55 | return self._station_address(self, reset, new); | 56 | return self._station_address(self, reset, new); |
| 56 | } | 57 | } |
| 57 | 58 | ||
| 58 | /// Resets or collects the statistics on a network interface. | 59 | /// 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 { |
| 60 | return self._statistics(self, reset_, statistics_size, statistics_table); | 61 | return self._statistics(self, reset_, statistics_size, statistics_table); |
| 61 | } | 62 | } |
| 62 | 63 | ||
| 63 | /// Converts a multicast IP address to a multicast HW MAC address. | 64 | /// 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 { |
| 65 | return self._mcast_ip_to_mac(self, ipv6, ip, mac); | 66 | return self._mcast_ip_to_mac(self, ipv6, ip, mac); |
| 66 | } | 67 | } |
| 67 | 68 | ||
| 68 | /// Performs read and write operations on the NVRAM device attached to a network interface. | 69 | /// 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 { |
| 70 | return self._nvdata(self, read_write, offset, buffer_size, buffer); | 71 | return self._nvdata(self, read_write, offset, buffer_size, buffer); |
| 71 | } | 72 | } |
| 72 | 73 | ||
| 73 | /// Reads the current interrupt status and recycled transmit buffer status from a network interface. | 74 | /// 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 { |
| 75 | return self._get_status(self, interrupt_status, tx_buf); | 76 | return self._get_status(self, interrupt_status, tx_buf); |
| 76 | } | 77 | } |
| 77 | 78 | ||
| 78 | /// Places a packet in the transmit queue of a network interface. | 79 | /// 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 { |
| 80 | return self._transmit(self, header_size, buffer_size, buffer, src_addr, dest_addr, protocol); | 81 | return self._transmit(self, header_size, buffer_size, buffer, src_addr, dest_addr, protocol); |
| 81 | } | 82 | } |
| 82 | 83 | ||
| 83 | /// Receives a packet from a network interface. | 84 | /// 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 { |
| 85 | return self._receive(self, header_size, buffer_size, buffer, src_addr, dest_addr, protocol); | 86 | return self._receive(self, header_size, buffer_size, buffer, src_addr, dest_addr, protocol); |
| 86 | } | 87 | } |
| 87 | 88 |
lib/std/os/uefi/protocols/simple_pointer_protocol.zig+5-4| ... | @@ -1,21 +1,22 @@ | ... | @@ -1,21 +1,22 @@ |
| 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 Status = uefi.Status; | ||
| 4 | 5 | ||
| 5 | /// Protocol for mice | 6 | /// Protocol for mice |
| 6 | pub const SimplePointerProtocol = struct { | 7 | pub const SimplePointerProtocol = struct { |
| 7 | _reset: extern fn (*const SimplePointerProtocol, bool) usize, | 8 | _reset: extern fn (*const SimplePointerProtocol, bool) Status, |
| 8 | _get_state: extern fn (*const SimplePointerProtocol, *SimplePointerState) usize, | 9 | _get_state: extern fn (*const SimplePointerProtocol, *SimplePointerState) Status, |
| 9 | wait_for_input: Event, | 10 | wait_for_input: Event, |
| 10 | mode: *SimplePointerMode, | 11 | mode: *SimplePointerMode, |
| 11 | 12 | ||
| 12 | /// Resets the pointer device hardware. | 13 | /// 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 { |
| 14 | return self._reset(self, verify); | 15 | return self._reset(self, verify); |
| 15 | } | 16 | } |
| 16 | 17 | ||
| 17 | /// Retrieves the current state of a pointer device. | 18 | /// 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 { |
| 19 | return self._get_state(self, state); | 20 | return self._get_state(self, state); |
| 20 | } | 21 | } |
| 21 | 22 |
lib/std/os/uefi/protocols/simple_text_input_ex_protocol.zig+11-10| ... | @@ -1,38 +1,39 @@ | ... | @@ -1,38 +1,39 @@ |
| 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 Status = uefi.Status; | ||
| 4 | 5 | ||
| 5 | /// Character input devices, e.g. Keyboard | 6 | /// Character input devices, e.g. Keyboard |
| 6 | pub const SimpleTextInputExProtocol = extern struct { | 7 | pub const SimpleTextInputExProtocol = extern struct { |
| 7 | _reset: extern fn (*const SimpleTextInputExProtocol, bool) usize, | 8 | _reset: extern fn (*const SimpleTextInputExProtocol, bool) Status, |
| 8 | _read_key_stroke_ex: extern fn (*const SimpleTextInputExProtocol, *KeyData) usize, | 9 | _read_key_stroke_ex: extern fn (*const SimpleTextInputExProtocol, *KeyData) Status, |
| 9 | wait_for_key_ex: Event, | 10 | wait_for_key_ex: Event, |
| 10 | _set_state: extern fn (*const SimpleTextInputExProtocol, *const u8) usize, | 11 | _set_state: extern fn (*const SimpleTextInputExProtocol, *const u8) Status, |
| 11 | _register_key_notify: extern fn (*const SimpleTextInputExProtocol, *const KeyData, extern fn (*const KeyData) usize, **c_void) usize, | 12 | _register_key_notify: extern fn (*const SimpleTextInputExProtocol, *const KeyData, extern fn (*const KeyData) usize, **c_void) Status, |
| 12 | _unregister_key_notify: extern fn (*const SimpleTextInputExProtocol, *const c_void) usize, | 13 | _unregister_key_notify: extern fn (*const SimpleTextInputExProtocol, *const c_void) Status, |
| 13 | 14 | ||
| 14 | /// Resets the input device hardware. | 15 | /// 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 { |
| 16 | return self._reset(self, verify); | 17 | return self._reset(self, verify); |
| 17 | } | 18 | } |
| 18 | 19 | ||
| 19 | /// Reads the next keystroke from the input device. | 20 | /// 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 { |
| 21 | return self._read_key_stroke_ex(self, key_data); | 22 | return self._read_key_stroke_ex(self, key_data); |
| 22 | } | 23 | } |
| 23 | 24 | ||
| 24 | /// Set certain state for the input device. | 25 | /// 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 { |
| 26 | return self._set_state(self, state); | 27 | return self._set_state(self, state); |
| 27 | } | 28 | } |
| 28 | 29 | ||
| 29 | /// Register a notification function for a particular keystroke for the input device. | 30 | /// 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 { |
| 31 | return self._register_key_notify(self, key_data, notify, handle); | 32 | return self._register_key_notify(self, key_data, notify, handle); |
| 32 | } | 33 | } |
| 33 | 34 | ||
| 34 | /// Remove the notification that was previously registered. | 35 | /// 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 { |
| 36 | return self._unregister_key_notify(self, handle); | 37 | return self._unregister_key_notify(self, handle); |
| 37 | } | 38 | } |
| 38 | 39 |
lib/std/os/uefi/protocols/simple_text_input_protocol.zig+4-3| ... | @@ -2,20 +2,21 @@ const uefi = @import("std").os.uefi; | ... | @@ -2,20 +2,21 @@ 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 | const InputKey = uefi.protocols.InputKey; |
| 5 | const Status = uefi.Status; | ||
| 5 | 6 | ||
| 6 | /// Character input devices, e.g. Keyboard | 7 | /// Character input devices, e.g. Keyboard |
| 7 | pub const SimpleTextInputProtocol = extern struct { | 8 | pub const SimpleTextInputProtocol = extern struct { |
| 8 | _reset: extern fn (*const SimpleTextInputProtocol, bool) usize, | 9 | _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, |
| 10 | wait_for_key: Event, | 11 | wait_for_key: Event, |
| 11 | 12 | ||
| 12 | /// Resets the input device hardware. | 13 | /// 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 { |
| 14 | return self._reset(self, verify); | 15 | return self._reset(self, verify); |
| 15 | } | 16 | } |
| 16 | 17 | ||
| 17 | /// Reads the next keystroke from the input device. | 18 | /// 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 { |
| 19 | return self._read_key_stroke(self, input_key); | 20 | return self._read_key_stroke(self, input_key); |
| 20 | } | 21 | } |
| 21 | 22 |
lib/std/os/uefi/protocols/simple_text_output_protocol.zig+19-18| ... | @@ -1,61 +1,62 @@ | ... | @@ -1,61 +1,62 @@ |
| 1 | const uefi = @import("std").os.uefi; | 1 | const uefi = @import("std").os.uefi; |
| 2 | const Guid = uefi.Guid; | 2 | const Guid = uefi.Guid; |
| 3 | const Status = uefi.Status; | ||
| 3 | 4 | ||
| 4 | /// Character output devices | 5 | /// Character output devices |
| 5 | pub const SimpleTextOutputProtocol = extern struct { | 6 | pub const SimpleTextOutputProtocol = extern struct { |
| 6 | _reset: extern fn (*const SimpleTextOutputProtocol, bool) usize, | 7 | _reset: extern fn (*const SimpleTextOutputProtocol, bool) Status, |
| 7 | _output_string: extern fn (*const SimpleTextOutputProtocol, [*:0]const u16) usize, | 8 | _output_string: extern fn (*const SimpleTextOutputProtocol, [*:0]const u16) Status, |
| 8 | _test_string: extern fn (*const SimpleTextOutputProtocol, [*:0]const u16) usize, | 9 | _test_string: extern fn (*const SimpleTextOutputProtocol, [*:0]const u16) Status, |
| 9 | _query_mode: extern fn (*const SimpleTextOutputProtocol, usize, *usize, *usize) usize, | 10 | _query_mode: extern fn (*const SimpleTextOutputProtocol, usize, *usize, *usize) Status, |
| 10 | _set_mode: extern fn (*const SimpleTextOutputProtocol, usize) usize, | 11 | _set_mode: extern fn (*const SimpleTextOutputProtocol, usize) Status, |
| 11 | _set_attribute: extern fn (*const SimpleTextOutputProtocol, usize) usize, | 12 | _set_attribute: extern fn (*const SimpleTextOutputProtocol, usize) Status, |
| 12 | _clear_screen: extern fn (*const SimpleTextOutputProtocol) usize, | 13 | _clear_screen: extern fn (*const SimpleTextOutputProtocol) Status, |
| 13 | _set_cursor_position: extern fn (*const SimpleTextOutputProtocol, usize, usize) usize, | 14 | _set_cursor_position: extern fn (*const SimpleTextOutputProtocol, usize, usize) Status, |
| 14 | _enable_cursor: extern fn (*const SimpleTextOutputProtocol, bool) usize, | 15 | _enable_cursor: extern fn (*const SimpleTextOutputProtocol, bool) Status, |
| 15 | mode: *SimpleTextOutputMode, | 16 | mode: *SimpleTextOutputMode, |
| 16 | 17 | ||
| 17 | /// Resets the text output device hardware. | 18 | /// 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 { |
| 19 | return self._reset(self, verify); | 20 | return self._reset(self, verify); |
| 20 | } | 21 | } |
| 21 | 22 | ||
| 22 | /// Writes a string to the output device. | 23 | /// 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 { |
| 24 | return self._output_string(self, msg); | 25 | return self._output_string(self, msg); |
| 25 | } | 26 | } |
| 26 | 27 | ||
| 27 | /// Verifies that all characters in a string can be output to the target device. | 28 | /// 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 { |
| 29 | return self._test_string(self, msg); | 30 | return self._test_string(self, msg); |
| 30 | } | 31 | } |
| 31 | 32 | ||
| 32 | /// Returns information for an available text mode that the output device(s) supports. | 33 | /// 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 { |
| 34 | return self._query_mode(self, mode_number, columns, rows); | 35 | return self._query_mode(self, mode_number, columns, rows); |
| 35 | } | 36 | } |
| 36 | 37 | ||
| 37 | /// Sets the output device(s) to a specified mode. | 38 | /// 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 { |
| 39 | return self._set_mode(self, mode_number); | 40 | return self._set_mode(self, mode_number); |
| 40 | } | 41 | } |
| 41 | 42 | ||
| 42 | /// Sets the background and foreground colors for the outputString() and clearScreen() functions. | 43 | /// 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 { |
| 44 | return self._set_attribute(self, attribute); | 45 | return self._set_attribute(self, attribute); |
| 45 | } | 46 | } |
| 46 | 47 | ||
| 47 | /// Clears the output device(s) display to the currently selected background color. | 48 | /// 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 { |
| 49 | return self._clear_screen(self); | 50 | return self._clear_screen(self); |
| 50 | } | 51 | } |
| 51 | 52 | ||
| 52 | /// Sets the current coordinates of the cursor position. | 53 | /// 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 { |
| 54 | return self._set_cursor_position(self, column, row); | 55 | return self._set_cursor_position(self, column, row); |
| 55 | } | 56 | } |
| 56 | 57 | ||
| 57 | /// Makes the cursor visible or invisible. | 58 | /// 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 { |
| 59 | return self._enable_cursor(self, visible); | 60 | return self._enable_cursor(self, visible); |
| 60 | } | 61 | } |
| 61 | 62 |
lib/std/os/uefi/protocols/udp6_protocol.zig+17-16| ... | @@ -1,6 +1,7 @@ | ... | @@ -1,6 +1,7 @@ |
| 1 | const uefi = @import("std").os.uefi; | 1 | const uefi = @import("std").os.uefi; |
| 2 | const Guid = uefi.Guid; | 2 | const Guid = uefi.Guid; |
| 3 | const Event = uefi.Event; | 3 | const Event = uefi.Event; |
| 4 | const Status = uefi.Status; | ||
| 4 | const Time = uefi.Time; | 5 | const Time = uefi.Time; |
| 5 | const Ip6ModeData = uefi.protocols.Ip6ModeData; | 6 | const Ip6ModeData = uefi.protocols.Ip6ModeData; |
| 6 | const Ip6Address = uefi.protocols.Ip6Address; | 7 | const Ip6Address = uefi.protocols.Ip6Address; |
| ... | @@ -8,39 +9,39 @@ const ManagedNetworkConfigData = uefi.protocols.ManagedNetworkConfigData; | ... | @@ -8,39 +9,39 @@ const ManagedNetworkConfigData = uefi.protocols.ManagedNetworkConfigData; |
| 8 | const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode; | 9 | const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode; |
| 9 | 10 | ||
| 10 | pub const Udp6Protocol = extern struct { | 11 | pub const Udp6Protocol = extern struct { |
| 11 | _get_mode_data: extern fn (*const Udp6Protocol, ?*Udp6ConfigData, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) usize, | 12 | _get_mode_data: extern fn (*const Udp6Protocol, ?*Udp6ConfigData, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) Status, |
| 12 | _configure: extern fn (*const Udp6Protocol, ?*const Udp6ConfigData) usize, | 13 | _configure: extern fn (*const Udp6Protocol, ?*const Udp6ConfigData) Status, |
| 13 | _groups: extern fn (*const Udp6Protocol, bool, ?*const Ip6Address) usize, | 14 | _groups: extern fn (*const Udp6Protocol, bool, ?*const Ip6Address) Status, |
| 14 | _transmit: extern fn (*const Udp6Protocol, *Udp6CompletionToken) usize, | 15 | _transmit: extern fn (*const Udp6Protocol, *Udp6CompletionToken) Status, |
| 15 | _receive: extern fn (*const Udp6Protocol, *Udp6CompletionToken) usize, | 16 | _receive: extern fn (*const Udp6Protocol, *Udp6CompletionToken) Status, |
| 16 | _cancel: extern fn (*const Udp6Protocol, ?*Udp6CompletionToken) usize, | 17 | _cancel: extern fn (*const Udp6Protocol, ?*Udp6CompletionToken) Status, |
| 17 | _poll: extern fn (*const Udp6Protocol) usize, | 18 | _poll: extern fn (*const Udp6Protocol) Status, |
| 18 | 19 | ||
| 19 | pub fn getModeData(self: *const Udp6Protocol, udp6_config_data: ?*Udp6ConfigData, ip6_mode_data: ?*Ip6ModeData, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) usize { | 20 | pub fn getModeData(self: *const Udp6Protocol, udp6_config_data: ?*Udp6ConfigData, ip6_mode_data: ?*Ip6ModeData, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) Status { |
| 20 | return self._get_mode_data(self, udp6_config_data, ip6_mode_data, mnp_config_data, snp_mode_data); | 21 | return self._get_mode_data(self, udp6_config_data, ip6_mode_data, mnp_config_data, snp_mode_data); |
| 21 | } | 22 | } |
| 22 | 23 | ||
| 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 { |
| 24 | return self._configure(self, udp6_config_data); | 25 | return self._configure(self, udp6_config_data); |
| 25 | } | 26 | } |
| 26 | 27 | ||
| 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 { |
| 28 | return self._groups(self, join_flag, multicast_address); | 29 | return self._groups(self, join_flag, multicast_address); |
| 29 | } | 30 | } |
| 30 | 31 | ||
| 31 | pub fn transmit(self: *const Udp6Protocol, token: *Udp6CompletionToken) usize { | 32 | pub fn transmit(self: *const Udp6Protocol, token: *Udp6CompletionToken) Status { |
| 32 | return self._transmit(self, token); | 33 | return self._transmit(self, token); |
| 33 | } | 34 | } |
| 34 | 35 | ||
| 35 | pub fn receive(self: *const Udp6Protocol, token: *Udp6CompletionToken) usize { | 36 | pub fn receive(self: *const Udp6Protocol, token: *Udp6CompletionToken) Status { |
| 36 | return self._receive(self, token); | 37 | return self._receive(self, token); |
| 37 | } | 38 | } |
| 38 | 39 | ||
| 39 | pub fn cancel(self: *const Udp6Protocol, token: ?*Udp6CompletionToken) usize { | 40 | pub fn cancel(self: *const Udp6Protocol, token: ?*Udp6CompletionToken) Status { |
| 40 | return self._cancel(self, token); | 41 | return self._cancel(self, token); |
| 41 | } | 42 | } |
| 42 | 43 | ||
| 43 | pub fn poll(self: *const Udp6Protocol) usize { | 44 | pub fn poll(self: *const Udp6Protocol) Status { |
| 44 | return self._poll(self); | 45 | return self._poll(self); |
| 45 | } | 46 | } |
| 46 | 47 | ||
| ... | @@ -70,7 +71,7 @@ pub const Udp6ConfigData = extern struct { | ... | @@ -70,7 +71,7 @@ pub const Udp6ConfigData = extern struct { |
| 70 | 71 | ||
| 71 | pub const Udp6CompletionToken = extern struct { | 72 | pub const Udp6CompletionToken = extern struct { |
| 72 | event: Event, | 73 | event: Event, |
| 73 | status: usize, | 74 | Status: usize, |
| 74 | packet: extern union { | 75 | packet: extern union { |
| 75 | RxData: *Udp6ReceiveData, | 76 | RxData: *Udp6ReceiveData, |
| 76 | TxData: *Udp6TransmitData, | 77 | TxData: *Udp6TransmitData, |
lib/std/os/uefi/protocols/udp6_service_binding_protocol.zig+5-4| ... | @@ -1,16 +1,17 @@ | ... | @@ -1,16 +1,17 @@ |
| 1 | const uefi = @import("std").os.uefi; | 1 | const uefi = @import("std").os.uefi; |
| 2 | const Handle = uefi.Handle; | 2 | const Handle = uefi.Handle; |
| 3 | const Guid = uefi.Guid; | 3 | const Guid = uefi.Guid; |
| 4 | const Status = uefi.Status; | ||
| 4 | 5 | ||
| 5 | pub const Udp6ServiceBindingProtocol = extern struct { | 6 | pub const Udp6ServiceBindingProtocol = extern struct { |
| 6 | _create_child: extern fn (*const Udp6ServiceBindingProtocol, *?Handle) usize, | 7 | _create_child: extern fn (*const Udp6ServiceBindingProtocol, *?Handle) Status, |
| 7 | _destroy_child: extern fn (*const Udp6ServiceBindingProtocol, Handle) usize, | 8 | _destroy_child: extern fn (*const Udp6ServiceBindingProtocol, Handle) Status, |
| 8 | 9 | ||
| 9 | pub fn createChild(self: *const Udp6ServiceBindingProtocol, handle: *?Handle) usize { | 10 | pub fn createChild(self: *const Udp6ServiceBindingProtocol, handle: *?Handle) Status { |
| 10 | return self._create_child(self, handle); | 11 | return self._create_child(self, handle); |
| 11 | } | 12 | } |
| 12 | 13 | ||
| 13 | pub fn destroyChild(self: *const Udp6ServiceBindingProtocol, handle: Handle) usize { | 14 | pub fn destroyChild(self: *const Udp6ServiceBindingProtocol, handle: Handle) Status { |
| 14 | return self._destroy_child(self, handle); | 15 | return self._destroy_child(self, handle); |
| 15 | } | 16 | } |
| 16 | 17 |
lib/std/os/uefi/status.zig+100-82| ... | @@ -1,124 +1,142 @@ | ... | @@ -1,124 +1,142 @@ |
| 1 | const high_bit = 1 << @typeInfo(usize).Int.bits - 1; | 1 | const high_bit = 1 << @typeInfo(usize).Int.bits - 1; |
| 2 | 2 | ||
| 3 | /// The operation completed successfully. | 3 | pub const Status = extern enum(usize) { |
| 4 | pub const success: usize = 0; | 4 | /// The operation completed successfully. |
| 5 | Success = 0, | ||
| 5 | 6 | ||
| 6 | /// The image failed to load. | 7 | /// The image failed to load. |
| 7 | pub const load_error: usize = high_bit | 1; | 8 | LoadError = high_bit | 1, |
| 8 | 9 | ||
| 9 | /// A parameter was incorrect. | 10 | /// A parameter was incorrect. |
| 10 | pub const invalid_parameter: usize = high_bit | 2; | 11 | InvalidParameter = high_bit | 2, |
| 11 | 12 | ||
| 12 | /// The operation is not supported. | 13 | /// The operation is not supported. |
| 13 | pub const unsupported: usize = high_bit | 3; | 14 | Unsupported = high_bit | 3, |
| 14 | 15 | ||
| 15 | /// The buffer was not the proper size for the request. | 16 | /// The buffer was not the proper size for the request. |
| 16 | pub const bad_buffer_size: usize = high_bit | 4; | 17 | BadBufferSize = high_bit | 4, |
| 17 | 18 | ||
| 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. | 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. |
| 19 | pub const buffer_too_small: usize = high_bit | 5; | 20 | BufferTooSmall = high_bit | 5, |
| 20 | 21 | ||
| 21 | /// There is no data pending upon return. | 22 | /// There is no data pending upon return. |
| 22 | pub const not_ready: usize = high_bit | 6; | 23 | NotReady = high_bit | 6, |
| 23 | 24 | ||
| 24 | /// The physical device reported an error while attempting the operation. | 25 | /// The physical device reported an error while attempting the operation. |
| 25 | pub const device_error: usize = high_bit | 7; | 26 | DeviceError = high_bit | 7, |
| 26 | 27 | ||
| 27 | /// The device cannot be written to. | 28 | /// The device cannot be written to. |
| 28 | pub const write_protected: usize = high_bit | 8; | 29 | WriteProtected = high_bit | 8, |
| 29 | 30 | ||
| 30 | /// A resource has run out. | 31 | /// A resource has run out. |
| 31 | pub const out_of_resources: usize = high_bit | 9; | 32 | OutOfResources = high_bit | 9, |
| 32 | 33 | ||
| 33 | /// An inconstancy was detected on the file system causing the operating to fail. | 34 | /// An inconstancy was detected on the file system causing the operating to fail. |
| 34 | pub const volume_corrupted: usize = high_bit | 10; | 35 | VolumeCorrupted = high_bit | 10, |
| 35 | 36 | ||
| 36 | /// There is no more space on the file system. | 37 | /// There is no more space on the file system. |
| 37 | pub const volume_full: usize = high_bit | 11; | 38 | VolumeFull = high_bit | 11, |
| 38 | 39 | ||
| 39 | /// The device does not contain any medium to perform the operation. | 40 | /// The device does not contain any medium to perform the operation. |
| 40 | pub const no_media: usize = high_bit | 12; | 41 | NoMedia = high_bit | 12, |
| 41 | 42 | ||
| 42 | /// The medium in the device has changed since the last access. | 43 | /// The medium in the device has changed since the last access. |
| 43 | pub const media_changed: usize = high_bit | 13; | 44 | MediaChanged = high_bit | 13, |
| 44 | 45 | ||
| 45 | /// The item was not found. | 46 | /// The item was not found. |
| 46 | pub const not_found: usize = high_bit | 14; | 47 | NotFound = high_bit | 14, |
| 47 | 48 | ||
| 48 | /// Access was denied. | 49 | /// Access was denied. |
| 49 | pub const access_denied: usize = high_bit | 15; | 50 | AccessDenied = high_bit | 15, |
| 50 | 51 | ||
| 51 | /// The server was not found or did not respond to the request. | 52 | /// The server was not found or did not respond to the request. |
| 52 | pub const no_response: usize = high_bit | 16; | 53 | NoResponse = high_bit | 16, |
| 53 | 54 | ||
| 54 | /// A mapping to a device does not exist. | 55 | /// A mapping to a device does not exist. |
| 55 | pub const no_mapping: usize = high_bit | 17; | 56 | NoMapping = high_bit | 17, |
| 56 | 57 | ||
| 57 | /// The timeout time expired. | 58 | /// The timeout time expired. |
| 58 | pub const timeout: usize = high_bit | 18; | 59 | Timeout = high_bit | 18, |
| 59 | 60 | ||
| 60 | /// The protocol has not been started. | 61 | /// The protocol has not been started. |
| 61 | pub const not_started: usize = high_bit | 19; | 62 | NotStarted = high_bit | 19, |
| 62 | 63 | ||
| 63 | /// The protocol has already been started. | 64 | /// The protocol has already been started. |
| 64 | pub const already_started: usize = high_bit | 20; | 65 | AlreadyStarted = high_bit | 20, |
| 65 | 66 | ||
| 66 | /// The operation was aborted. | 67 | /// The operation was aborted. |
| 67 | pub const aborted: usize = high_bit | 21; | 68 | Aborted = high_bit | 21, |
| 68 | 69 | ||
| 69 | /// An ICMP error occurred during the network operation. | 70 | /// An ICMP error occurred during the network operation. |
| 70 | pub const icmp_error: usize = high_bit | 22; | 71 | IcmpError = high_bit | 22, |
| 71 | 72 | ||
| 72 | /// A TFTP error occurred during the network operation. | 73 | /// A TFTP error occurred during the network operation. |
| 73 | pub const tftp_error: usize = high_bit | 23; | 74 | TftpError = high_bit | 23, |
| 74 | 75 | ||
| 75 | /// A protocol error occurred during the network operation. | 76 | /// A protocol error occurred during the network operation. |
| 76 | pub const protocol_error: usize = high_bit | 24; | 77 | ProtocolError = high_bit | 24, |
| 77 | 78 | ||
| 78 | /// The function encountered an internal version that was incompatible with a version requested by the caller. | 79 | /// The function encountered an internal version that was incompatible with a version requested by the caller. |
| 79 | pub const incompatible_version: usize = high_bit | 25; | 80 | IncompatibleVersion = high_bit | 25, |
| 80 | 81 | ||
| 81 | /// The function was not performed due to a security violation. | 82 | /// The function was not performed due to a security violation. |
| 82 | pub const security_violation: usize = high_bit | 26; | 83 | SecurityViolation = high_bit | 26, |
| 83 | 84 | ||
| 84 | /// A CRC error was detected. | 85 | /// A CRC error was detected. |
| 85 | pub const crc_error: usize = high_bit | 27; | 86 | CrcError = high_bit | 27, |
| 86 | 87 | ||
| 87 | /// Beginning or end of media was reached | 88 | /// Beginning or end of media was reached |
| 88 | pub const end_of_media: usize = high_bit | 28; | 89 | EndOfMedia = high_bit | 28, |
| 89 | 90 | ||
| 90 | /// The end of the file was reached. | 91 | /// The end of the file was reached. |
| 91 | pub const end_of_file: usize = high_bit | 31; | 92 | EndOfFile = high_bit | 31, |
| 92 | 93 | ||
| 93 | /// The language specified was invalid. | 94 | /// The language specified was invalid. |
| 94 | pub const invalid_language: usize = high_bit | 32; | 95 | InvalidLanguage = high_bit | 32, |
| 95 | 96 | ||
| 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. | 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. |
| 97 | pub const compromised_data: usize = high_bit | 33; | 98 | CompromisedData = high_bit | 33, |
| 98 | 99 | ||
| 99 | /// There is an address conflict address allocation | 100 | /// There is an address conflict address allocation |
| 100 | pub const ip_address_conflict: usize = high_bit | 34; | 101 | IpAddressConflict = high_bit | 34, |
| 101 | 102 | ||
| 102 | /// A HTTP error occurred during the network operation. | 103 | /// A HTTP error occurred during the network operation. |
| 103 | pub const http_error: usize = high_bit | 35; | 104 | HttpError = high_bit | 35, |
| 104 | 105 | ||
| 105 | /// The string contained one or more characters that the device could not render and were skipped. | 106 | NetworkUnreachable = high_bit | 100, |
| 106 | pub const warn_unknown_glyph: usize = 1; | ||
| 107 | 107 | ||
| 108 | /// The handle was closed, but the file was not deleted. | 108 | HostUnreachable = high_bit | 101, |
| 109 | pub const warn_delete_failure: usize = 2; | ||
| 110 | 109 | ||
| 111 | /// The handle was closed, but the data to the file was not flushed properly. | 110 | ProtocolUnreachable = high_bit | 102, |
| 112 | pub const warn_write_failure: usize = 3; | ||
| 113 | 111 | ||
| 114 | /// The resulting buffer was too small, and the data was truncated to the buffer size. | 112 | PortUnreachable = high_bit | 103, |
| 115 | pub const warn_buffer_too_small: usize = 4; | ||
| 116 | 113 | ||
| 117 | /// The data has not been updated within the timeframe set by localpolicy for this type of data. | 114 | ConnectionFin = high_bit | 104, |
| 118 | pub const warn_stale_data: usize = 5; | ||
| 119 | 115 | ||
| 120 | /// The resulting buffer contains UEFI-compliant file system. | 116 | ConnectionReset = high_bit | 105, |
| 121 | pub const warn_file_system: usize = 6; | ||
| 122 | 117 | ||
| 123 | /// The operation will be processed across a system reset. | 118 | ConnectionRefused = high_bit | 106, |
| 124 | pub const warn_reset_required: usize = 7; | 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.zig+1| ... | @@ -1,3 +1,4 @@ | ... | @@ -1,3 +1,4 @@ |
| 1 | pub const AllocateType = @import("tables/boot_services.zig").AllocateType; | ||
| 1 | pub const BootServices = @import("tables/boot_services.zig").BootServices; | 2 | pub const BootServices = @import("tables/boot_services.zig").BootServices; |
| 2 | pub const ConfigurationTable = @import("tables/configuration_table.zig").ConfigurationTable; | 3 | pub const ConfigurationTable = @import("tables/configuration_table.zig").ConfigurationTable; |
| 3 | pub const global_variable align(8) = @import("tables/runtime_services.zig").global_variable; | 4 | pub const global_variable align(8) = @import("tables/runtime_services.zig").global_variable; |
lib/std/os/uefi/tables/boot_services.zig+76-50| ... | @@ -2,6 +2,7 @@ const uefi = @import("std").os.uefi; | ... | @@ -2,6 +2,7 @@ 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 Handle = uefi.Handle; | 4 | const Handle = uefi.Handle; |
| 5 | const Status = uefi.Status; | ||
| 5 | const TableHeader = uefi.tables.TableHeader; | 6 | const TableHeader = uefi.tables.TableHeader; |
| 6 | const DevicePathProtocol = uefi.protocols.DevicePathProtocol; | 7 | const DevicePathProtocol = uefi.protocols.DevicePathProtocol; |
| 7 | 8 | ||
| ... | @@ -19,101 +20,120 @@ const DevicePathProtocol = uefi.protocols.DevicePathProtocol; | ... | @@ -19,101 +20,120 @@ const DevicePathProtocol = uefi.protocols.DevicePathProtocol; |
| 19 | pub const BootServices = extern struct { | 20 | pub const BootServices = extern struct { |
| 20 | hdr: TableHeader, | 21 | hdr: TableHeader, |
| 21 | 22 | ||
| 22 | raiseTpl: usize, // TODO | 23 | /// Raises a task's priority level and returns its previous level. |
| 23 | restoreTpl: usize, // TODO | 24 | raiseTpl: extern fn (usize) usize, |
| 24 | allocatePages: usize, // TODO | 25 | |
| 25 | freePages: usize, // TODO | 26 | /// Restores a task's priority level to its previous value. |
| 27 | restoreTpl: extern fn (usize) void, | ||
| 28 | |||
| 29 | /// Allocates memory pages from the system. | ||
| 30 | allocatePages: extern fn (AllocateType, MemoryType, usize, *[*]align(4096) u8) Status, | ||
| 31 | |||
| 32 | /// Frees memory pages. | ||
| 33 | freePages: extern fn ([*]align(4096) u8, usize) Status, | ||
| 26 | 34 | ||
| 27 | /// Returns the current memory map. | 35 | /// Returns the current memory map. |
| 28 | getMemoryMap: extern fn (*usize, [*]MemoryDescriptor, *usize, *usize, *u32) usize, | 36 | getMemoryMap: extern fn (*usize, [*]MemoryDescriptor, *usize, *usize, *u32) Status, |
| 29 | 37 | ||
| 30 | /// Allocates pool memory. | 38 | /// Allocates pool memory. |
| 31 | allocatePool: extern fn (MemoryType, usize, *align(8) [*]u8) usize, | 39 | allocatePool: extern fn (MemoryType, usize, *[*]align(8) u8) Status, |
| 32 | 40 | ||
| 33 | /// Returns pool memory to the system. | 41 | /// Returns pool memory to the system. |
| 34 | freePool: extern fn ([*]align(8) u8) usize, | 42 | freePool: extern fn ([*]align(8) u8) Status, |
| 35 | 43 | ||
| 36 | /// Creates an event. | 44 | /// Creates an event. |
| 37 | 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, |
| 38 | 46 | ||
| 39 | /// Sets the type of timer and the trigger time for a timer event. | 47 | /// Sets the type of timer and the trigger time for a timer event. |
| 40 | setTimer: extern fn (Event, TimerDelay, u64) usize, | 48 | setTimer: extern fn (Event, TimerDelay, u64) Status, |
| 41 | 49 | ||
| 42 | /// Stops execution until an event is signaled. | 50 | /// Stops execution until an event is signaled. |
| 43 | waitForEvent: extern fn (usize, [*]const Event, *usize) usize, | 51 | waitForEvent: extern fn (usize, [*]const Event, *usize) Status, |
| 44 | 52 | ||
| 45 | /// Signals an event. | 53 | /// Signals an event. |
| 46 | signalEvent: extern fn (Event) usize, | 54 | signalEvent: extern fn (Event) Status, |
| 47 | 55 | ||
| 48 | /// Closes an event. | 56 | /// Closes an event. |
| 49 | closeEvent: extern fn (Event) usize, | 57 | closeEvent: extern fn (Event) Status, |
| 50 | 58 | ||
| 51 | /// Checks whether an event is in the signaled state. | 59 | /// Checks whether an event is in the signaled state. |
| 52 | checkEvent: extern fn (Event) usize, | 60 | checkEvent: extern fn (Event) Status, |
| 53 | 61 | ||
| 54 | installProtocolInterface: usize, // TODO | 62 | installProtocolInterface: Status, // TODO |
| 55 | reinstallProtocolInterface: usize, // TODO | 63 | reinstallProtocolInterface: Status, // TODO |
| 56 | uninstallProtocolInterface: usize, // TODO | 64 | uninstallProtocolInterface: Status, // TODO |
| 57 | 65 | ||
| 58 | /// Queries a handle to determine if it supports a specified protocol. | 66 | /// Queries a handle to determine if it supports a specified protocol. |
| 59 | handleProtocol: extern fn (Handle, *align(8) const Guid, *?*c_void) usize, | 67 | handleProtocol: extern fn (Handle, *align(8) const Guid, *?*c_void) Status, |
| 60 | 68 | ||
| 61 | reserved: *c_void, | 69 | reserved: *c_void, |
| 62 | 70 | ||
| 63 | registerProtocolNotify: usize, // TODO | 71 | registerProtocolNotify: Status, // TODO |
| 64 | locateHandle: usize, // TODO | 72 | |
| 65 | locateDevicePath: usize, // TODO | 73 | /// Returns an array of handles that support a specified protocol. |
| 66 | installConfigurationTable: usize, // TODO | 74 | locateHandle: extern fn (LocateSearchType, ?*align(8) const Guid, ?*const c_void, *usize, [*]Handle) Status, |
| 75 | |||
| 76 | locateDevicePath: Status, // TODO | ||
| 77 | installConfigurationTable: Status, // TODO | ||
| 67 | 78 | ||
| 68 | /// Loads an EFI image into memory. | 79 | /// Loads an EFI image into memory. |
| 69 | 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, |
| 70 | 81 | ||
| 71 | /// Transfers control to a loaded image's entry point. | 82 | /// Transfers control to a loaded image's entry point. |
| 72 | startImage: extern fn (Handle, ?*usize, ?*[*]u16) usize, | 83 | startImage: extern fn (Handle, ?*usize, ?*[*]u16) Status, |
| 73 | 84 | ||
| 74 | /// Terminates a loaded EFI image and returns control to boot services. | 85 | /// Terminates a loaded EFI image and returns control to boot services. |
| 75 | exit: extern fn (Handle, usize, usize, ?*const c_void) usize, | 86 | exit: extern fn (Handle, Status, usize, ?*const c_void) Status, |
| 76 | 87 | ||
| 77 | /// Unloads an image. | 88 | /// Unloads an image. |
| 78 | unloadImage: extern fn (Handle) usize, | 89 | unloadImage: extern fn (Handle) Status, |
| 79 | 90 | ||
| 80 | /// Terminates all boot services. | 91 | /// Terminates all boot services. |
| 81 | exitBootServices: extern fn (Handle, usize) usize, | 92 | exitBootServices: extern fn (Handle, usize) Status, |
| 82 | 93 | ||
| 83 | getNextMonotonicCount: usize, // TODO | 94 | /// Returns a monotonically increasing count for the platform. |
| 95 | getNextMonotonicCount: extern fn (*u64) Status, | ||
| 84 | 96 | ||
| 85 | /// Induces a fine-grained stall. | 97 | /// Induces a fine-grained stall. |
| 86 | stall: extern fn (usize) usize, | 98 | stall: extern fn (usize) Status, |
| 87 | 99 | ||
| 88 | /// Sets the system's watchdog timer. | 100 | /// Sets the system's watchdog timer. |
| 89 | setWatchdogTimer: extern fn (usize, u64, usize, ?[*]const u16) usize, | 101 | setWatchdogTimer: extern fn (usize, u64, usize, ?[*]const u16) Status, |
| 90 | 102 | ||
| 91 | connectController: usize, // TODO | 103 | connectController: Status, // TODO |
| 92 | disconnectController: usize, // TODO | 104 | disconnectController: Status, // TODO |
| 93 | 105 | ||
| 94 | /// Queries a handle to determine if it supports a specified protocol. | 106 | /// Queries a handle to determine if it supports a specified protocol. |
| 95 | 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, |
| 96 | 108 | ||
| 97 | /// Closes a protocol on a handle that was opened using openProtocol(). | 109 | /// Closes a protocol on a handle that was opened using openProtocol(). |
| 98 | closeProtocol: extern fn (Handle, *align(8) const Guid, Handle, ?Handle) usize, | 110 | closeProtocol: extern fn (Handle, *align(8) const Guid, Handle, ?Handle) Status, |
| 99 | 111 | ||
| 100 | /// Retrieves the list of agents that currently have a protocol interface opened. | 112 | /// Retrieves the list of agents that currently have a protocol interface opened. |
| 101 | openProtocolInformation: extern fn (Handle, *align(8) const Guid, *[*]ProtocolInformationEntry, *usize) usize, | 113 | openProtocolInformation: extern fn (Handle, *align(8) const Guid, *[*]ProtocolInformationEntry, *usize) Status, |
| 102 | 114 | ||
| 103 | protocolsPerHandle: usize, // TODO | 115 | /// Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated from pool. |
| 116 | protocolsPerHandle: extern fn (Handle, *[*]*align(8) const Guid, *usize) Status, | ||
| 104 | 117 | ||
| 105 | /// Returns an array of handles that support the requested protocol in a buffer allocated from pool. | 118 | /// Returns an array of handles that support the requested protocol in a buffer allocated from pool. |
| 106 | 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, |
| 107 | 120 | ||
| 108 | /// Returns the first protocol instance that matches the given protocol. | 121 | /// Returns the first protocol instance that matches the given protocol. |
| 109 | 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, |
| 123 | |||
| 124 | installMultipleProtocolInterfaces: Status, // TODO | ||
| 125 | uninstallMultipleProtocolInterfaces: Status, // TODO | ||
| 110 | 126 | ||
| 111 | installMultipleProtocolInterfaces: usize, // TODO | 127 | /// Computes and returns a 32-bit CRC for a data buffer. |
| 112 | uninstallMultipleProtocolInterfaces: usize, // TODO | 128 | calculateCrc32: extern fn ([*]const u8, usize, *u32) Status, |
| 113 | calculateCrc32: usize, // TODO | 129 | |
| 114 | copyMem: usize, // TODO | 130 | /// Copies the contents of one buffer to another buffer |
| 115 | setMem: usize, // TODO | 131 | copyMem: extern fn ([*]u8, [*]const u8, usize) void, |
| 116 | createEventEx: usize, // TODO | 132 | |
| 133 | /// Fills a buffer with a specified value | ||
| 134 | setMem: extern fn ([*]u8, usize, u8) void, | ||
| 135 | |||
| 136 | createEventEx: Status, // TODO | ||
| 117 | 137 | ||
| 118 | pub const signature: u64 = 0x56524553544f4f42; | 138 | pub const signature: u64 = 0x56524553544f4f42; |
| 119 | 139 | ||
| ... | @@ -187,13 +207,13 @@ pub const LocateSearchType = extern enum(u32) { | ... | @@ -187,13 +207,13 @@ pub const LocateSearchType = extern enum(u32) { |
| 187 | }; | 207 | }; |
| 188 | 208 | ||
| 189 | pub const OpenProtocolAttributes = packed struct { | 209 | pub const OpenProtocolAttributes = packed struct { |
| 190 | by_handle_protocol: bool, | 210 | by_handle_protocol: bool = false, |
| 191 | get_protocol: bool, | 211 | get_protocol: bool = false, |
| 192 | test_protocol: bool, | 212 | test_protocol: bool = false, |
| 193 | by_child_controller: bool, | 213 | by_child_controller: bool = false, |
| 194 | by_driver: bool, | 214 | by_driver: bool = false, |
| 195 | exclusive: bool, | 215 | exclusive: bool = false, |
| 196 | _pad: u26, | 216 | _pad: u26 = undefined, |
| 197 | }; | 217 | }; |
| 198 | 218 | ||
| 199 | pub const ProtocolInformationEntry = extern struct { | 219 | pub const ProtocolInformationEntry = extern struct { |
| ... | @@ -202,3 +222,9 @@ pub const ProtocolInformationEntry = extern struct { | ... | @@ -202,3 +222,9 @@ pub const ProtocolInformationEntry = extern struct { |
| 202 | attributes: OpenProtocolAttributes, | 222 | attributes: OpenProtocolAttributes, |
| 203 | open_count: u32, | 223 | open_count: u32, |
| 204 | }; | 224 | }; |
| 225 | |||
| 226 | pub const AllocateType = extern enum(u32) { | ||
| 227 | AllocateAnyPages, | ||
| 228 | AllocateMaxAddress, | ||
| 229 | AllocateAddress, | ||
| 230 | }; |
lib/std/os/uefi/tables/runtime_services.zig+15-14| ... | @@ -3,6 +3,7 @@ const Guid = uefi.Guid; | ... | @@ -3,6 +3,7 @@ const Guid = uefi.Guid; |
| 3 | const TableHeader = uefi.tables.TableHeader; | 3 | const TableHeader = uefi.tables.TableHeader; |
| 4 | const Time = uefi.Time; | 4 | const Time = uefi.Time; |
| 5 | const TimeCapabilities = uefi.TimeCapabilities; | 5 | const TimeCapabilities = uefi.TimeCapabilities; |
| 6 | const Status = uefi.Status; | ||
| 6 | 7 | ||
| 7 | /// Runtime services are provided by the firmware before and after exitBootServices has been called. | 8 | /// Runtime services are provided by the firmware before and after exitBootServices has been called. |
| 8 | /// | 9 | /// |
| ... | @@ -16,31 +17,31 @@ pub const RuntimeServices = extern struct { | ... | @@ -16,31 +17,31 @@ pub const RuntimeServices = extern struct { |
| 16 | hdr: TableHeader, | 17 | hdr: TableHeader, |
| 17 | 18 | ||
| 18 | /// Returns the current time and date information, and the time-keeping capabilities of the hardware platform. | 19 | /// 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, |
| 20 | 21 | ||
| 21 | setTime: usize, // TODO | 22 | setTime: Status, // TODO |
| 22 | getWakeupTime: usize, // TODO | 23 | getWakeupTime: Status, // TODO |
| 23 | setWakeupTime: usize, // TODO | 24 | setWakeupTime: Status, // TODO |
| 24 | setVirtualAddressMap: usize, // TODO | 25 | setVirtualAddressMap: Status, // TODO |
| 25 | convertPointer: usize, // TODO | 26 | convertPointer: Status, // TODO |
| 26 | 27 | ||
| 27 | /// Returns the value of a variable. | 28 | /// 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, |
| 29 | 30 | ||
| 30 | /// Enumerates the current variable names. | 31 | /// Enumerates the current variable names. |
| 31 | getNextVariableName: extern fn (*usize, [*]u16, *align(8) Guid) usize, | 32 | getNextVariableName: extern fn (*usize, [*:0]u16, *align(8) Guid) Status, |
| 32 | 33 | ||
| 33 | /// Sets the value of a variable. | 34 | /// 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, |
| 35 | 36 | ||
| 36 | getNextHighMonotonicCount: usize, // TODO | 37 | getNextHighMonotonicCount: Status, // TODO |
| 37 | 38 | ||
| 38 | /// Resets the entire platform. | 39 | /// 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, |
| 40 | 41 | ||
| 41 | updateCapsule: usize, // TODO | 42 | updateCapsule: Status, // TODO |
| 42 | queryCapsuleCapabilities: usize, // TODO | 43 | queryCapsuleCapabilities: Status, // TODO |
| 43 | queryVariableInfo: usize, // TODO | 44 | queryVariableInfo: Status, // TODO |
| 44 | 45 | ||
| 45 | pub const signature: u64 = 0x56524553544e5552; | 46 | pub const signature: u64 = 0x56524553544e5552; |
| 46 | }; | 47 | }; |
lib/std/start.zig+8-9| ... | @@ -55,25 +55,24 @@ fn wasm_freestanding_start() callconv(.C) void { | ... | @@ -55,25 +55,24 @@ fn wasm_freestanding_start() callconv(.C) void { |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | fn EfiMain(handle: uefi.Handle, system_table: *uefi.tables.SystemTable) callconv(.C) usize { | 57 | fn 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'"; | ||
| 59 | uefi.handle = handle; | 58 | uefi.handle = handle; |
| 60 | uefi.system_table = system_table; | 59 | uefi.system_table = system_table; |
| 61 | 60 | ||
| 62 | switch (@typeInfo(@TypeOf(root.main).ReturnType)) { | 61 | switch (@TypeOf(root.main).ReturnType) { |
| 63 | .NoReturn => { | 62 | noreturn => { |
| 64 | root.main(); | 63 | root.main(); |
| 65 | }, | 64 | }, |
| 66 | .Void => { | 65 | void => { |
| 67 | root.main(); | 66 | root.main(); |
| 68 | return 0; | 67 | return 0; |
| 69 | }, | 68 | }, |
| 70 | .Int => |info| { | 69 | usize => { |
| 71 | if (info.bits != @typeInfo(usize).Int.bits) { | ||
| 72 | @compileError(bad_efi_main_ret); | ||
| 73 | } | ||
| 74 | return root.main(); | 70 | return root.main(); |
| 75 | }, | 71 | }, |
| 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'"), | ||
| 77 | } | 76 | } |
| 78 | } | 77 | } |
| 79 | 78 |