| author | |
| committer | |
| log | a31748b29e2e980ac4bf08cf10ee0d6ece1bd9e7 |
| tree | 243e0c9ab202d8aa83a88302af00da1881b41b0a |
| parent | dd6a9caeaf98b0f1c3c91291dab46e62b224c94f |
This is a breaking change.
This commit applies the following rules to std.os.uefi:
* avoid redundant names in the namespace such as "protocol.FooProtocol"
* don't initialize struct field to undefined. do that at the
initialization site if you want that, or create a named constant that
sets all the fields to undefined.
* avoid the word "data", "info", "context", "state", "details", or
"config" in the type name, especially if a word from that category is
already in the type name.
* embrace tree structure
After following these rules, `usingnamespace` disappeared naturally.
This commit eliminates 26/53 (49%) instances of `usingnamespace` in the
standard library. All these uses were due to not understanding how
to properly use namespaces.
I did not test this commit. The standard library UEFI code is
experimental and pull requests have been accepted with minimal vetting.
Users of std.os.uefi will need to submit follow-up pull requests to fix
up whatever regressions this commit introduces, this time without
abusing namespaces (pun intended).58 files changed, 3030 insertions(+), 3047 deletions(-)
lib/std/builtin.zig+2-2| ... | ... | @@ -794,9 +794,9 @@ pub fn default_panic(msg: []const u8, error_return_trace: ?*StackTrace, ret_addr |
| 794 | 794 | |
| 795 | 795 | if (exit_data) |data| { |
| 796 | 796 | if (uefi.system_table.std_err) |out| { |
| 797 | _ = out.setAttribute(uefi.protocols.SimpleTextOutputProtocol.red); | |
| 797 | _ = out.setAttribute(uefi.protocol.SimpleTextOutput.red); | |
| 798 | 798 | _ = out.outputString(data); |
| 799 | _ = out.setAttribute(uefi.protocols.SimpleTextOutputProtocol.white); | |
| 799 | _ = out.setAttribute(uefi.protocol.SimpleTextOutput.white); | |
| 800 | 800 | } |
| 801 | 801 | } |
| 802 | 802 |
lib/std/os/uefi.zig+57-2| ... | ... | @@ -1,7 +1,9 @@ |
| 1 | 1 | const std = @import("../std.zig"); |
| 2 | 2 | |
| 3 | 3 | /// A protocol is an interface identified by a GUID. |
| 4 | pub const protocols = @import("uefi/protocols.zig"); | |
| 4 | pub const protocol = @import("uefi/protocol.zig"); | |
| 5 | pub const DevicePath = @import("uefi/device_path.zig").DevicePath; | |
| 6 | pub const hii = @import("uefi/hii.zig"); | |
| 5 | 7 | |
| 6 | 8 | /// Status codes returned by EFI interfaces |
| 7 | 9 | pub const Status = @import("uefi/status.zig").Status; |
| ... | ... | @@ -157,7 +159,60 @@ test "GUID formatting" { |
| 157 | 159 | try std.testing.expect(std.mem.eql(u8, str, "32cb3c89-8080-427c-ba13-5049873bc287")); |
| 158 | 160 | } |
| 159 | 161 | |
| 162 | pub const FileInfo = extern struct { | |
| 163 | size: u64, | |
| 164 | file_size: u64, | |
| 165 | physical_size: u64, | |
| 166 | create_time: Time, | |
| 167 | last_access_time: Time, | |
| 168 | modification_time: Time, | |
| 169 | attribute: u64, | |
| 170 | ||
| 171 | pub fn getFileName(self: *const FileInfo) [*:0]const u16 { | |
| 172 | return @ptrCast(@alignCast(@as([*]const u8, @ptrCast(self)) + @sizeOf(FileInfo))); | |
| 173 | } | |
| 174 | ||
| 175 | pub const efi_file_read_only: u64 = 0x0000000000000001; | |
| 176 | pub const efi_file_hidden: u64 = 0x0000000000000002; | |
| 177 | pub const efi_file_system: u64 = 0x0000000000000004; | |
| 178 | pub const efi_file_reserved: u64 = 0x0000000000000008; | |
| 179 | pub const efi_file_directory: u64 = 0x0000000000000010; | |
| 180 | pub const efi_file_archive: u64 = 0x0000000000000020; | |
| 181 | pub const efi_file_valid_attr: u64 = 0x0000000000000037; | |
| 182 | ||
| 183 | pub const guid align(8) = Guid{ | |
| 184 | .time_low = 0x09576e92, | |
| 185 | .time_mid = 0x6d3f, | |
| 186 | .time_high_and_version = 0x11d2, | |
| 187 | .clock_seq_high_and_reserved = 0x8e, | |
| 188 | .clock_seq_low = 0x39, | |
| 189 | .node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b }, | |
| 190 | }; | |
| 191 | }; | |
| 192 | ||
| 193 | pub const FileSystemInfo = extern struct { | |
| 194 | size: u64, | |
| 195 | read_only: bool, | |
| 196 | volume_size: u64, | |
| 197 | free_space: u64, | |
| 198 | block_size: u32, | |
| 199 | _volume_label: u16, | |
| 200 | ||
| 201 | pub fn getVolumeLabel(self: *const FileSystemInfo) [*:0]const u16 { | |
| 202 | return @as([*:0]const u16, @ptrCast(&self._volume_label)); | |
| 203 | } | |
| 204 | ||
| 205 | pub const guid align(8) = Guid{ | |
| 206 | .time_low = 0x09576e93, | |
| 207 | .time_mid = 0x6d3f, | |
| 208 | .time_high_and_version = 0x11d2, | |
| 209 | .clock_seq_high_and_reserved = 0x8e, | |
| 210 | .clock_seq_low = 0x39, | |
| 211 | .node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b }, | |
| 212 | }; | |
| 213 | }; | |
| 214 | ||
| 160 | 215 | test { |
| 161 | 216 | _ = tables; |
| 162 | _ = protocols; | |
| 217 | _ = protocol; | |
| 163 | 218 | } |
lib/std/os/uefi/device_path.zig created+1009| ... | ... | @@ -0,0 +1,1009 @@ |
| 1 | const std = @import("../../std.zig"); | |
| 2 | const assert = std.debug.assert; | |
| 3 | const uefi = std.os.uefi; | |
| 4 | const Guid = uefi.Guid; | |
| 5 | ||
| 6 | pub const DevicePath = union(Type) { | |
| 7 | Hardware: Hardware, | |
| 8 | Acpi: Acpi, | |
| 9 | Messaging: Messaging, | |
| 10 | Media: Media, | |
| 11 | BiosBootSpecification: BiosBootSpecification, | |
| 12 | End: End, | |
| 13 | ||
| 14 | pub const Type = enum(u8) { | |
| 15 | Hardware = 0x01, | |
| 16 | Acpi = 0x02, | |
| 17 | Messaging = 0x03, | |
| 18 | Media = 0x04, | |
| 19 | BiosBootSpecification = 0x05, | |
| 20 | End = 0x7f, | |
| 21 | _, | |
| 22 | }; | |
| 23 | ||
| 24 | pub const Hardware = union(Subtype) { | |
| 25 | Pci: *const PciDevicePath, | |
| 26 | PcCard: *const PcCardDevicePath, | |
| 27 | MemoryMapped: *const MemoryMappedDevicePath, | |
| 28 | Vendor: *const VendorDevicePath, | |
| 29 | Controller: *const ControllerDevicePath, | |
| 30 | Bmc: *const BmcDevicePath, | |
| 31 | ||
| 32 | pub const Subtype = enum(u8) { | |
| 33 | Pci = 1, | |
| 34 | PcCard = 2, | |
| 35 | MemoryMapped = 3, | |
| 36 | Vendor = 4, | |
| 37 | Controller = 5, | |
| 38 | Bmc = 6, | |
| 39 | _, | |
| 40 | }; | |
| 41 | ||
| 42 | pub const PciDevicePath = extern struct { | |
| 43 | type: DevicePath.Type, | |
| 44 | subtype: Subtype, | |
| 45 | length: u16 align(1), | |
| 46 | function: u8, | |
| 47 | device: u8, | |
| 48 | }; | |
| 49 | ||
| 50 | comptime { | |
| 51 | assert(6 == @sizeOf(PciDevicePath)); | |
| 52 | assert(1 == @alignOf(PciDevicePath)); | |
| 53 | ||
| 54 | assert(0 == @offsetOf(PciDevicePath, "type")); | |
| 55 | assert(1 == @offsetOf(PciDevicePath, "subtype")); | |
| 56 | assert(2 == @offsetOf(PciDevicePath, "length")); | |
| 57 | assert(4 == @offsetOf(PciDevicePath, "function")); | |
| 58 | assert(5 == @offsetOf(PciDevicePath, "device")); | |
| 59 | } | |
| 60 | ||
| 61 | pub const PcCardDevicePath = extern struct { | |
| 62 | type: DevicePath.Type, | |
| 63 | subtype: Subtype, | |
| 64 | length: u16 align(1), | |
| 65 | function_number: u8, | |
| 66 | }; | |
| 67 | ||
| 68 | comptime { | |
| 69 | assert(5 == @sizeOf(PcCardDevicePath)); | |
| 70 | assert(1 == @alignOf(PcCardDevicePath)); | |
| 71 | ||
| 72 | assert(0 == @offsetOf(PcCardDevicePath, "type")); | |
| 73 | assert(1 == @offsetOf(PcCardDevicePath, "subtype")); | |
| 74 | assert(2 == @offsetOf(PcCardDevicePath, "length")); | |
| 75 | assert(4 == @offsetOf(PcCardDevicePath, "function_number")); | |
| 76 | } | |
| 77 | ||
| 78 | pub const MemoryMappedDevicePath = extern struct { | |
| 79 | type: DevicePath.Type, | |
| 80 | subtype: Subtype, | |
| 81 | length: u16 align(1), | |
| 82 | memory_type: u32 align(1), | |
| 83 | start_address: u64 align(1), | |
| 84 | end_address: u64 align(1), | |
| 85 | }; | |
| 86 | ||
| 87 | comptime { | |
| 88 | assert(24 == @sizeOf(MemoryMappedDevicePath)); | |
| 89 | assert(1 == @alignOf(MemoryMappedDevicePath)); | |
| 90 | ||
| 91 | assert(0 == @offsetOf(MemoryMappedDevicePath, "type")); | |
| 92 | assert(1 == @offsetOf(MemoryMappedDevicePath, "subtype")); | |
| 93 | assert(2 == @offsetOf(MemoryMappedDevicePath, "length")); | |
| 94 | assert(4 == @offsetOf(MemoryMappedDevicePath, "memory_type")); | |
| 95 | assert(8 == @offsetOf(MemoryMappedDevicePath, "start_address")); | |
| 96 | assert(16 == @offsetOf(MemoryMappedDevicePath, "end_address")); | |
| 97 | } | |
| 98 | ||
| 99 | pub const VendorDevicePath = extern struct { | |
| 100 | type: DevicePath.Type, | |
| 101 | subtype: Subtype, | |
| 102 | length: u16 align(1), | |
| 103 | vendor_guid: Guid align(1), | |
| 104 | }; | |
| 105 | ||
| 106 | comptime { | |
| 107 | assert(20 == @sizeOf(VendorDevicePath)); | |
| 108 | assert(1 == @alignOf(VendorDevicePath)); | |
| 109 | ||
| 110 | assert(0 == @offsetOf(VendorDevicePath, "type")); | |
| 111 | assert(1 == @offsetOf(VendorDevicePath, "subtype")); | |
| 112 | assert(2 == @offsetOf(VendorDevicePath, "length")); | |
| 113 | assert(4 == @offsetOf(VendorDevicePath, "vendor_guid")); | |
| 114 | } | |
| 115 | ||
| 116 | pub const ControllerDevicePath = extern struct { | |
| 117 | type: DevicePath.Type, | |
| 118 | subtype: Subtype, | |
| 119 | length: u16 align(1), | |
| 120 | controller_number: u32 align(1), | |
| 121 | }; | |
| 122 | ||
| 123 | comptime { | |
| 124 | assert(8 == @sizeOf(ControllerDevicePath)); | |
| 125 | assert(1 == @alignOf(ControllerDevicePath)); | |
| 126 | ||
| 127 | assert(0 == @offsetOf(ControllerDevicePath, "type")); | |
| 128 | assert(1 == @offsetOf(ControllerDevicePath, "subtype")); | |
| 129 | assert(2 == @offsetOf(ControllerDevicePath, "length")); | |
| 130 | assert(4 == @offsetOf(ControllerDevicePath, "controller_number")); | |
| 131 | } | |
| 132 | ||
| 133 | pub const BmcDevicePath = extern struct { | |
| 134 | type: DevicePath.Type, | |
| 135 | subtype: Subtype, | |
| 136 | length: u16 align(1), | |
| 137 | interface_type: u8, | |
| 138 | base_address: u64 align(1), | |
| 139 | }; | |
| 140 | ||
| 141 | comptime { | |
| 142 | assert(13 == @sizeOf(BmcDevicePath)); | |
| 143 | assert(1 == @alignOf(BmcDevicePath)); | |
| 144 | ||
| 145 | assert(0 == @offsetOf(BmcDevicePath, "type")); | |
| 146 | assert(1 == @offsetOf(BmcDevicePath, "subtype")); | |
| 147 | assert(2 == @offsetOf(BmcDevicePath, "length")); | |
| 148 | assert(4 == @offsetOf(BmcDevicePath, "interface_type")); | |
| 149 | assert(5 == @offsetOf(BmcDevicePath, "base_address")); | |
| 150 | } | |
| 151 | }; | |
| 152 | ||
| 153 | pub const Acpi = union(Subtype) { | |
| 154 | Acpi: *const BaseAcpiDevicePath, | |
| 155 | ExpandedAcpi: *const ExpandedAcpiDevicePath, | |
| 156 | Adr: *const AdrDevicePath, | |
| 157 | ||
| 158 | pub const Subtype = enum(u8) { | |
| 159 | Acpi = 1, | |
| 160 | ExpandedAcpi = 2, | |
| 161 | Adr = 3, | |
| 162 | _, | |
| 163 | }; | |
| 164 | ||
| 165 | pub const BaseAcpiDevicePath = extern struct { | |
| 166 | type: DevicePath.Type, | |
| 167 | subtype: Subtype, | |
| 168 | length: u16 align(1), | |
| 169 | hid: u32 align(1), | |
| 170 | uid: u32 align(1), | |
| 171 | }; | |
| 172 | ||
| 173 | comptime { | |
| 174 | assert(12 == @sizeOf(BaseAcpiDevicePath)); | |
| 175 | assert(1 == @alignOf(BaseAcpiDevicePath)); | |
| 176 | ||
| 177 | assert(0 == @offsetOf(BaseAcpiDevicePath, "type")); | |
| 178 | assert(1 == @offsetOf(BaseAcpiDevicePath, "subtype")); | |
| 179 | assert(2 == @offsetOf(BaseAcpiDevicePath, "length")); | |
| 180 | assert(4 == @offsetOf(BaseAcpiDevicePath, "hid")); | |
| 181 | assert(8 == @offsetOf(BaseAcpiDevicePath, "uid")); | |
| 182 | } | |
| 183 | ||
| 184 | pub const ExpandedAcpiDevicePath = extern struct { | |
| 185 | type: DevicePath.Type, | |
| 186 | subtype: Subtype, | |
| 187 | length: u16 align(1), | |
| 188 | hid: u32 align(1), | |
| 189 | uid: u32 align(1), | |
| 190 | cid: u32 align(1), | |
| 191 | // variable length u16[*:0] strings | |
| 192 | // hid_str, uid_str, cid_str | |
| 193 | }; | |
| 194 | ||
| 195 | comptime { | |
| 196 | assert(16 == @sizeOf(ExpandedAcpiDevicePath)); | |
| 197 | assert(1 == @alignOf(ExpandedAcpiDevicePath)); | |
| 198 | ||
| 199 | assert(0 == @offsetOf(ExpandedAcpiDevicePath, "type")); | |
| 200 | assert(1 == @offsetOf(ExpandedAcpiDevicePath, "subtype")); | |
| 201 | assert(2 == @offsetOf(ExpandedAcpiDevicePath, "length")); | |
| 202 | assert(4 == @offsetOf(ExpandedAcpiDevicePath, "hid")); | |
| 203 | assert(8 == @offsetOf(ExpandedAcpiDevicePath, "uid")); | |
| 204 | assert(12 == @offsetOf(ExpandedAcpiDevicePath, "cid")); | |
| 205 | } | |
| 206 | ||
| 207 | pub const AdrDevicePath = extern struct { | |
| 208 | type: DevicePath.Type, | |
| 209 | subtype: Subtype, | |
| 210 | length: u16 align(1), | |
| 211 | adr: u32 align(1), | |
| 212 | ||
| 213 | // multiple adr entries can optionally follow | |
| 214 | pub fn adrs(self: *const AdrDevicePath) []align(1) const u32 { | |
| 215 | // self.length is a minimum of 8 with one adr which is size 4. | |
| 216 | var entries = (self.length - 4) / @sizeOf(u32); | |
| 217 | return @as([*]align(1) const u32, @ptrCast(&self.adr))[0..entries]; | |
| 218 | } | |
| 219 | }; | |
| 220 | ||
| 221 | comptime { | |
| 222 | assert(8 == @sizeOf(AdrDevicePath)); | |
| 223 | assert(1 == @alignOf(AdrDevicePath)); | |
| 224 | ||
| 225 | assert(0 == @offsetOf(AdrDevicePath, "type")); | |
| 226 | assert(1 == @offsetOf(AdrDevicePath, "subtype")); | |
| 227 | assert(2 == @offsetOf(AdrDevicePath, "length")); | |
| 228 | assert(4 == @offsetOf(AdrDevicePath, "adr")); | |
| 229 | } | |
| 230 | }; | |
| 231 | ||
| 232 | pub const Messaging = union(Subtype) { | |
| 233 | Atapi: *const AtapiDevicePath, | |
| 234 | Scsi: *const ScsiDevicePath, | |
| 235 | FibreChannel: *const FibreChannelDevicePath, | |
| 236 | FibreChannelEx: *const FibreChannelExDevicePath, | |
| 237 | @"1394": *const F1394DevicePath, | |
| 238 | Usb: *const UsbDevicePath, | |
| 239 | Sata: *const SataDevicePath, | |
| 240 | UsbWwid: *const UsbWwidDevicePath, | |
| 241 | Lun: *const DeviceLogicalUnitDevicePath, | |
| 242 | UsbClass: *const UsbClassDevicePath, | |
| 243 | I2o: *const I2oDevicePath, | |
| 244 | MacAddress: *const MacAddressDevicePath, | |
| 245 | Ipv4: *const Ipv4DevicePath, | |
| 246 | Ipv6: *const Ipv6DevicePath, | |
| 247 | Vlan: *const VlanDevicePath, | |
| 248 | InfiniBand: *const InfiniBandDevicePath, | |
| 249 | Uart: *const UartDevicePath, | |
| 250 | Vendor: *const VendorDefinedDevicePath, | |
| 251 | ||
| 252 | pub const Subtype = enum(u8) { | |
| 253 | Atapi = 1, | |
| 254 | Scsi = 2, | |
| 255 | FibreChannel = 3, | |
| 256 | FibreChannelEx = 21, | |
| 257 | @"1394" = 4, | |
| 258 | Usb = 5, | |
| 259 | Sata = 18, | |
| 260 | UsbWwid = 16, | |
| 261 | Lun = 17, | |
| 262 | UsbClass = 15, | |
| 263 | I2o = 6, | |
| 264 | MacAddress = 11, | |
| 265 | Ipv4 = 12, | |
| 266 | Ipv6 = 13, | |
| 267 | Vlan = 20, | |
| 268 | InfiniBand = 9, | |
| 269 | Uart = 14, | |
| 270 | Vendor = 10, | |
| 271 | _, | |
| 272 | }; | |
| 273 | ||
| 274 | pub const AtapiDevicePath = extern struct { | |
| 275 | const Role = enum(u8) { | |
| 276 | Master = 0, | |
| 277 | Slave = 1, | |
| 278 | }; | |
| 279 | ||
| 280 | const Rank = enum(u8) { | |
| 281 | Primary = 0, | |
| 282 | Secondary = 1, | |
| 283 | }; | |
| 284 | ||
| 285 | type: DevicePath.Type, | |
| 286 | subtype: Subtype, | |
| 287 | length: u16 align(1), | |
| 288 | primary_secondary: Rank, | |
| 289 | slave_master: Role, | |
| 290 | logical_unit_number: u16 align(1), | |
| 291 | }; | |
| 292 | ||
| 293 | comptime { | |
| 294 | assert(8 == @sizeOf(AtapiDevicePath)); | |
| 295 | assert(1 == @alignOf(AtapiDevicePath)); | |
| 296 | ||
| 297 | assert(0 == @offsetOf(AtapiDevicePath, "type")); | |
| 298 | assert(1 == @offsetOf(AtapiDevicePath, "subtype")); | |
| 299 | assert(2 == @offsetOf(AtapiDevicePath, "length")); | |
| 300 | assert(4 == @offsetOf(AtapiDevicePath, "primary_secondary")); | |
| 301 | assert(5 == @offsetOf(AtapiDevicePath, "slave_master")); | |
| 302 | assert(6 == @offsetOf(AtapiDevicePath, "logical_unit_number")); | |
| 303 | } | |
| 304 | ||
| 305 | pub const ScsiDevicePath = extern struct { | |
| 306 | type: DevicePath.Type, | |
| 307 | subtype: Subtype, | |
| 308 | length: u16 align(1), | |
| 309 | target_id: u16 align(1), | |
| 310 | logical_unit_number: u16 align(1), | |
| 311 | }; | |
| 312 | ||
| 313 | comptime { | |
| 314 | assert(8 == @sizeOf(ScsiDevicePath)); | |
| 315 | assert(1 == @alignOf(ScsiDevicePath)); | |
| 316 | ||
| 317 | assert(0 == @offsetOf(ScsiDevicePath, "type")); | |
| 318 | assert(1 == @offsetOf(ScsiDevicePath, "subtype")); | |
| 319 | assert(2 == @offsetOf(ScsiDevicePath, "length")); | |
| 320 | assert(4 == @offsetOf(ScsiDevicePath, "target_id")); | |
| 321 | assert(6 == @offsetOf(ScsiDevicePath, "logical_unit_number")); | |
| 322 | } | |
| 323 | ||
| 324 | pub const FibreChannelDevicePath = extern struct { | |
| 325 | type: DevicePath.Type, | |
| 326 | subtype: Subtype, | |
| 327 | length: u16 align(1), | |
| 328 | reserved: u32 align(1), | |
| 329 | world_wide_name: u64 align(1), | |
| 330 | logical_unit_number: u64 align(1), | |
| 331 | }; | |
| 332 | ||
| 333 | comptime { | |
| 334 | assert(24 == @sizeOf(FibreChannelDevicePath)); | |
| 335 | assert(1 == @alignOf(FibreChannelDevicePath)); | |
| 336 | ||
| 337 | assert(0 == @offsetOf(FibreChannelDevicePath, "type")); | |
| 338 | assert(1 == @offsetOf(FibreChannelDevicePath, "subtype")); | |
| 339 | assert(2 == @offsetOf(FibreChannelDevicePath, "length")); | |
| 340 | assert(4 == @offsetOf(FibreChannelDevicePath, "reserved")); | |
| 341 | assert(8 == @offsetOf(FibreChannelDevicePath, "world_wide_name")); | |
| 342 | assert(16 == @offsetOf(FibreChannelDevicePath, "logical_unit_number")); | |
| 343 | } | |
| 344 | ||
| 345 | pub const FibreChannelExDevicePath = extern struct { | |
| 346 | type: DevicePath.Type, | |
| 347 | subtype: Subtype, | |
| 348 | length: u16 align(1), | |
| 349 | reserved: u32 align(1), | |
| 350 | world_wide_name: u64 align(1), | |
| 351 | logical_unit_number: u64 align(1), | |
| 352 | }; | |
| 353 | ||
| 354 | comptime { | |
| 355 | assert(24 == @sizeOf(FibreChannelExDevicePath)); | |
| 356 | assert(1 == @alignOf(FibreChannelExDevicePath)); | |
| 357 | ||
| 358 | assert(0 == @offsetOf(FibreChannelExDevicePath, "type")); | |
| 359 | assert(1 == @offsetOf(FibreChannelExDevicePath, "subtype")); | |
| 360 | assert(2 == @offsetOf(FibreChannelExDevicePath, "length")); | |
| 361 | assert(4 == @offsetOf(FibreChannelExDevicePath, "reserved")); | |
| 362 | assert(8 == @offsetOf(FibreChannelExDevicePath, "world_wide_name")); | |
| 363 | assert(16 == @offsetOf(FibreChannelExDevicePath, "logical_unit_number")); | |
| 364 | } | |
| 365 | ||
| 366 | pub const F1394DevicePath = extern struct { | |
| 367 | type: DevicePath.Type, | |
| 368 | subtype: Subtype, | |
| 369 | length: u16 align(1), | |
| 370 | reserved: u32 align(1), | |
| 371 | guid: u64 align(1), | |
| 372 | }; | |
| 373 | ||
| 374 | comptime { | |
| 375 | assert(16 == @sizeOf(F1394DevicePath)); | |
| 376 | assert(1 == @alignOf(F1394DevicePath)); | |
| 377 | ||
| 378 | assert(0 == @offsetOf(F1394DevicePath, "type")); | |
| 379 | assert(1 == @offsetOf(F1394DevicePath, "subtype")); | |
| 380 | assert(2 == @offsetOf(F1394DevicePath, "length")); | |
| 381 | assert(4 == @offsetOf(F1394DevicePath, "reserved")); | |
| 382 | assert(8 == @offsetOf(F1394DevicePath, "guid")); | |
| 383 | } | |
| 384 | ||
| 385 | pub const UsbDevicePath = extern struct { | |
| 386 | type: DevicePath.Type, | |
| 387 | subtype: Subtype, | |
| 388 | length: u16 align(1), | |
| 389 | parent_port_number: u8, | |
| 390 | interface_number: u8, | |
| 391 | }; | |
| 392 | ||
| 393 | comptime { | |
| 394 | assert(6 == @sizeOf(UsbDevicePath)); | |
| 395 | assert(1 == @alignOf(UsbDevicePath)); | |
| 396 | ||
| 397 | assert(0 == @offsetOf(UsbDevicePath, "type")); | |
| 398 | assert(1 == @offsetOf(UsbDevicePath, "subtype")); | |
| 399 | assert(2 == @offsetOf(UsbDevicePath, "length")); | |
| 400 | assert(4 == @offsetOf(UsbDevicePath, "parent_port_number")); | |
| 401 | assert(5 == @offsetOf(UsbDevicePath, "interface_number")); | |
| 402 | } | |
| 403 | ||
| 404 | pub const SataDevicePath = extern struct { | |
| 405 | type: DevicePath.Type, | |
| 406 | subtype: Subtype, | |
| 407 | length: u16 align(1), | |
| 408 | hba_port_number: u16 align(1), | |
| 409 | port_multiplier_port_number: u16 align(1), | |
| 410 | logical_unit_number: u16 align(1), | |
| 411 | }; | |
| 412 | ||
| 413 | comptime { | |
| 414 | assert(10 == @sizeOf(SataDevicePath)); | |
| 415 | assert(1 == @alignOf(SataDevicePath)); | |
| 416 | ||
| 417 | assert(0 == @offsetOf(SataDevicePath, "type")); | |
| 418 | assert(1 == @offsetOf(SataDevicePath, "subtype")); | |
| 419 | assert(2 == @offsetOf(SataDevicePath, "length")); | |
| 420 | assert(4 == @offsetOf(SataDevicePath, "hba_port_number")); | |
| 421 | assert(6 == @offsetOf(SataDevicePath, "port_multiplier_port_number")); | |
| 422 | assert(8 == @offsetOf(SataDevicePath, "logical_unit_number")); | |
| 423 | } | |
| 424 | ||
| 425 | pub const UsbWwidDevicePath = extern struct { | |
| 426 | type: DevicePath.Type, | |
| 427 | subtype: Subtype, | |
| 428 | length: u16 align(1), | |
| 429 | interface_number: u16 align(1), | |
| 430 | device_vendor_id: u16 align(1), | |
| 431 | device_product_id: u16 align(1), | |
| 432 | ||
| 433 | pub fn serial_number(self: *const UsbWwidDevicePath) []align(1) const u16 { | |
| 434 | var serial_len = (self.length - @sizeOf(UsbWwidDevicePath)) / @sizeOf(u16); | |
| 435 | return @as([*]align(1) const u16, @ptrCast(@as([*]const u8, @ptrCast(self)) + @sizeOf(UsbWwidDevicePath)))[0..serial_len]; | |
| 436 | } | |
| 437 | }; | |
| 438 | ||
| 439 | comptime { | |
| 440 | assert(10 == @sizeOf(UsbWwidDevicePath)); | |
| 441 | assert(1 == @alignOf(UsbWwidDevicePath)); | |
| 442 | ||
| 443 | assert(0 == @offsetOf(UsbWwidDevicePath, "type")); | |
| 444 | assert(1 == @offsetOf(UsbWwidDevicePath, "subtype")); | |
| 445 | assert(2 == @offsetOf(UsbWwidDevicePath, "length")); | |
| 446 | assert(4 == @offsetOf(UsbWwidDevicePath, "interface_number")); | |
| 447 | assert(6 == @offsetOf(UsbWwidDevicePath, "device_vendor_id")); | |
| 448 | assert(8 == @offsetOf(UsbWwidDevicePath, "device_product_id")); | |
| 449 | } | |
| 450 | ||
| 451 | pub const DeviceLogicalUnitDevicePath = extern struct { | |
| 452 | type: DevicePath.Type, | |
| 453 | subtype: Subtype, | |
| 454 | length: u16 align(1), | |
| 455 | lun: u8, | |
| 456 | }; | |
| 457 | ||
| 458 | comptime { | |
| 459 | assert(5 == @sizeOf(DeviceLogicalUnitDevicePath)); | |
| 460 | assert(1 == @alignOf(DeviceLogicalUnitDevicePath)); | |
| 461 | ||
| 462 | assert(0 == @offsetOf(DeviceLogicalUnitDevicePath, "type")); | |
| 463 | assert(1 == @offsetOf(DeviceLogicalUnitDevicePath, "subtype")); | |
| 464 | assert(2 == @offsetOf(DeviceLogicalUnitDevicePath, "length")); | |
| 465 | assert(4 == @offsetOf(DeviceLogicalUnitDevicePath, "lun")); | |
| 466 | } | |
| 467 | ||
| 468 | pub const UsbClassDevicePath = extern struct { | |
| 469 | type: DevicePath.Type, | |
| 470 | subtype: Subtype, | |
| 471 | length: u16 align(1), | |
| 472 | vendor_id: u16 align(1), | |
| 473 | product_id: u16 align(1), | |
| 474 | device_class: u8, | |
| 475 | device_subclass: u8, | |
| 476 | device_protocol: u8, | |
| 477 | }; | |
| 478 | ||
| 479 | comptime { | |
| 480 | assert(11 == @sizeOf(UsbClassDevicePath)); | |
| 481 | assert(1 == @alignOf(UsbClassDevicePath)); | |
| 482 | ||
| 483 | assert(0 == @offsetOf(UsbClassDevicePath, "type")); | |
| 484 | assert(1 == @offsetOf(UsbClassDevicePath, "subtype")); | |
| 485 | assert(2 == @offsetOf(UsbClassDevicePath, "length")); | |
| 486 | assert(4 == @offsetOf(UsbClassDevicePath, "vendor_id")); | |
| 487 | assert(6 == @offsetOf(UsbClassDevicePath, "product_id")); | |
| 488 | assert(8 == @offsetOf(UsbClassDevicePath, "device_class")); | |
| 489 | assert(9 == @offsetOf(UsbClassDevicePath, "device_subclass")); | |
| 490 | assert(10 == @offsetOf(UsbClassDevicePath, "device_protocol")); | |
| 491 | } | |
| 492 | ||
| 493 | pub const I2oDevicePath = extern struct { | |
| 494 | type: DevicePath.Type, | |
| 495 | subtype: Subtype, | |
| 496 | length: u16 align(1), | |
| 497 | tid: u32 align(1), | |
| 498 | }; | |
| 499 | ||
| 500 | comptime { | |
| 501 | assert(8 == @sizeOf(I2oDevicePath)); | |
| 502 | assert(1 == @alignOf(I2oDevicePath)); | |
| 503 | ||
| 504 | assert(0 == @offsetOf(I2oDevicePath, "type")); | |
| 505 | assert(1 == @offsetOf(I2oDevicePath, "subtype")); | |
| 506 | assert(2 == @offsetOf(I2oDevicePath, "length")); | |
| 507 | assert(4 == @offsetOf(I2oDevicePath, "tid")); | |
| 508 | } | |
| 509 | ||
| 510 | pub const MacAddressDevicePath = extern struct { | |
| 511 | type: DevicePath.Type, | |
| 512 | subtype: Subtype, | |
| 513 | length: u16 align(1), | |
| 514 | mac_address: uefi.MacAddress, | |
| 515 | if_type: u8, | |
| 516 | }; | |
| 517 | ||
| 518 | comptime { | |
| 519 | assert(37 == @sizeOf(MacAddressDevicePath)); | |
| 520 | assert(1 == @alignOf(MacAddressDevicePath)); | |
| 521 | ||
| 522 | assert(0 == @offsetOf(MacAddressDevicePath, "type")); | |
| 523 | assert(1 == @offsetOf(MacAddressDevicePath, "subtype")); | |
| 524 | assert(2 == @offsetOf(MacAddressDevicePath, "length")); | |
| 525 | assert(4 == @offsetOf(MacAddressDevicePath, "mac_address")); | |
| 526 | assert(36 == @offsetOf(MacAddressDevicePath, "if_type")); | |
| 527 | } | |
| 528 | ||
| 529 | pub const Ipv4DevicePath = extern struct { | |
| 530 | pub const IpType = enum(u8) { | |
| 531 | Dhcp = 0, | |
| 532 | Static = 1, | |
| 533 | }; | |
| 534 | ||
| 535 | type: DevicePath.Type, | |
| 536 | subtype: Subtype, | |
| 537 | length: u16 align(1), | |
| 538 | local_ip_address: uefi.Ipv4Address align(1), | |
| 539 | remote_ip_address: uefi.Ipv4Address align(1), | |
| 540 | local_port: u16 align(1), | |
| 541 | remote_port: u16 align(1), | |
| 542 | network_protocol: u16 align(1), | |
| 543 | static_ip_address: IpType, | |
| 544 | gateway_ip_address: u32 align(1), | |
| 545 | subnet_mask: u32 align(1), | |
| 546 | }; | |
| 547 | ||
| 548 | comptime { | |
| 549 | assert(27 == @sizeOf(Ipv4DevicePath)); | |
| 550 | assert(1 == @alignOf(Ipv4DevicePath)); | |
| 551 | ||
| 552 | assert(0 == @offsetOf(Ipv4DevicePath, "type")); | |
| 553 | assert(1 == @offsetOf(Ipv4DevicePath, "subtype")); | |
| 554 | assert(2 == @offsetOf(Ipv4DevicePath, "length")); | |
| 555 | assert(4 == @offsetOf(Ipv4DevicePath, "local_ip_address")); | |
| 556 | assert(8 == @offsetOf(Ipv4DevicePath, "remote_ip_address")); | |
| 557 | assert(12 == @offsetOf(Ipv4DevicePath, "local_port")); | |
| 558 | assert(14 == @offsetOf(Ipv4DevicePath, "remote_port")); | |
| 559 | assert(16 == @offsetOf(Ipv4DevicePath, "network_protocol")); | |
| 560 | assert(18 == @offsetOf(Ipv4DevicePath, "static_ip_address")); | |
| 561 | assert(19 == @offsetOf(Ipv4DevicePath, "gateway_ip_address")); | |
| 562 | assert(23 == @offsetOf(Ipv4DevicePath, "subnet_mask")); | |
| 563 | } | |
| 564 | ||
| 565 | pub const Ipv6DevicePath = extern struct { | |
| 566 | pub const Origin = enum(u8) { | |
| 567 | Manual = 0, | |
| 568 | AssignedStateless = 1, | |
| 569 | AssignedStateful = 2, | |
| 570 | }; | |
| 571 | ||
| 572 | type: DevicePath.Type, | |
| 573 | subtype: Subtype, | |
| 574 | length: u16 align(1), | |
| 575 | local_ip_address: uefi.Ipv6Address, | |
| 576 | remote_ip_address: uefi.Ipv6Address, | |
| 577 | local_port: u16 align(1), | |
| 578 | remote_port: u16 align(1), | |
| 579 | protocol: u16 align(1), | |
| 580 | ip_address_origin: Origin, | |
| 581 | prefix_length: u8, | |
| 582 | gateway_ip_address: uefi.Ipv6Address, | |
| 583 | }; | |
| 584 | ||
| 585 | comptime { | |
| 586 | assert(60 == @sizeOf(Ipv6DevicePath)); | |
| 587 | assert(1 == @alignOf(Ipv6DevicePath)); | |
| 588 | ||
| 589 | assert(0 == @offsetOf(Ipv6DevicePath, "type")); | |
| 590 | assert(1 == @offsetOf(Ipv6DevicePath, "subtype")); | |
| 591 | assert(2 == @offsetOf(Ipv6DevicePath, "length")); | |
| 592 | assert(4 == @offsetOf(Ipv6DevicePath, "local_ip_address")); | |
| 593 | assert(20 == @offsetOf(Ipv6DevicePath, "remote_ip_address")); | |
| 594 | assert(36 == @offsetOf(Ipv6DevicePath, "local_port")); | |
| 595 | assert(38 == @offsetOf(Ipv6DevicePath, "remote_port")); | |
| 596 | assert(40 == @offsetOf(Ipv6DevicePath, "protocol")); | |
| 597 | assert(42 == @offsetOf(Ipv6DevicePath, "ip_address_origin")); | |
| 598 | assert(43 == @offsetOf(Ipv6DevicePath, "prefix_length")); | |
| 599 | assert(44 == @offsetOf(Ipv6DevicePath, "gateway_ip_address")); | |
| 600 | } | |
| 601 | ||
| 602 | pub const VlanDevicePath = extern struct { | |
| 603 | type: DevicePath.Type, | |
| 604 | subtype: Subtype, | |
| 605 | length: u16 align(1), | |
| 606 | vlan_id: u16 align(1), | |
| 607 | }; | |
| 608 | ||
| 609 | comptime { | |
| 610 | assert(6 == @sizeOf(VlanDevicePath)); | |
| 611 | assert(1 == @alignOf(VlanDevicePath)); | |
| 612 | ||
| 613 | assert(0 == @offsetOf(VlanDevicePath, "type")); | |
| 614 | assert(1 == @offsetOf(VlanDevicePath, "subtype")); | |
| 615 | assert(2 == @offsetOf(VlanDevicePath, "length")); | |
| 616 | assert(4 == @offsetOf(VlanDevicePath, "vlan_id")); | |
| 617 | } | |
| 618 | ||
| 619 | pub const InfiniBandDevicePath = extern struct { | |
| 620 | pub const ResourceFlags = packed struct(u32) { | |
| 621 | pub const ControllerType = enum(u1) { | |
| 622 | Ioc = 0, | |
| 623 | Service = 1, | |
| 624 | }; | |
| 625 | ||
| 626 | ioc_or_service: ControllerType, | |
| 627 | extend_boot_environment: bool, | |
| 628 | console_protocol: bool, | |
| 629 | storage_protocol: bool, | |
| 630 | network_protocol: bool, | |
| 631 | ||
| 632 | // u1 + 4 * bool = 5 bits, we need a total of 32 bits | |
| 633 | reserved: u27, | |
| 634 | }; | |
| 635 | ||
| 636 | type: DevicePath.Type, | |
| 637 | subtype: Subtype, | |
| 638 | length: u16 align(1), | |
| 639 | resource_flags: ResourceFlags align(1), | |
| 640 | port_gid: [16]u8, | |
| 641 | service_id: u64 align(1), | |
| 642 | target_port_id: u64 align(1), | |
| 643 | device_id: u64 align(1), | |
| 644 | }; | |
| 645 | ||
| 646 | comptime { | |
| 647 | assert(48 == @sizeOf(InfiniBandDevicePath)); | |
| 648 | assert(1 == @alignOf(InfiniBandDevicePath)); | |
| 649 | ||
| 650 | assert(0 == @offsetOf(InfiniBandDevicePath, "type")); | |
| 651 | assert(1 == @offsetOf(InfiniBandDevicePath, "subtype")); | |
| 652 | assert(2 == @offsetOf(InfiniBandDevicePath, "length")); | |
| 653 | assert(4 == @offsetOf(InfiniBandDevicePath, "resource_flags")); | |
| 654 | assert(8 == @offsetOf(InfiniBandDevicePath, "port_gid")); | |
| 655 | assert(24 == @offsetOf(InfiniBandDevicePath, "service_id")); | |
| 656 | assert(32 == @offsetOf(InfiniBandDevicePath, "target_port_id")); | |
| 657 | assert(40 == @offsetOf(InfiniBandDevicePath, "device_id")); | |
| 658 | } | |
| 659 | ||
| 660 | pub const UartDevicePath = extern struct { | |
| 661 | pub const Parity = enum(u8) { | |
| 662 | Default = 0, | |
| 663 | None = 1, | |
| 664 | Even = 2, | |
| 665 | Odd = 3, | |
| 666 | Mark = 4, | |
| 667 | Space = 5, | |
| 668 | _, | |
| 669 | }; | |
| 670 | ||
| 671 | pub const StopBits = enum(u8) { | |
| 672 | Default = 0, | |
| 673 | One = 1, | |
| 674 | OneAndAHalf = 2, | |
| 675 | Two = 3, | |
| 676 | _, | |
| 677 | }; | |
| 678 | ||
| 679 | type: DevicePath.Type, | |
| 680 | subtype: Subtype, | |
| 681 | length: u16 align(1), | |
| 682 | reserved: u32 align(1), | |
| 683 | baud_rate: u64 align(1), | |
| 684 | data_bits: u8, | |
| 685 | parity: Parity, | |
| 686 | stop_bits: StopBits, | |
| 687 | }; | |
| 688 | ||
| 689 | comptime { | |
| 690 | assert(19 == @sizeOf(UartDevicePath)); | |
| 691 | assert(1 == @alignOf(UartDevicePath)); | |
| 692 | ||
| 693 | assert(0 == @offsetOf(UartDevicePath, "type")); | |
| 694 | assert(1 == @offsetOf(UartDevicePath, "subtype")); | |
| 695 | assert(2 == @offsetOf(UartDevicePath, "length")); | |
| 696 | assert(4 == @offsetOf(UartDevicePath, "reserved")); | |
| 697 | assert(8 == @offsetOf(UartDevicePath, "baud_rate")); | |
| 698 | assert(16 == @offsetOf(UartDevicePath, "data_bits")); | |
| 699 | assert(17 == @offsetOf(UartDevicePath, "parity")); | |
| 700 | assert(18 == @offsetOf(UartDevicePath, "stop_bits")); | |
| 701 | } | |
| 702 | ||
| 703 | pub const VendorDefinedDevicePath = extern struct { | |
| 704 | type: DevicePath.Type, | |
| 705 | subtype: Subtype, | |
| 706 | length: u16 align(1), | |
| 707 | vendor_guid: Guid align(1), | |
| 708 | }; | |
| 709 | ||
| 710 | comptime { | |
| 711 | assert(20 == @sizeOf(VendorDefinedDevicePath)); | |
| 712 | assert(1 == @alignOf(VendorDefinedDevicePath)); | |
| 713 | ||
| 714 | assert(0 == @offsetOf(VendorDefinedDevicePath, "type")); | |
| 715 | assert(1 == @offsetOf(VendorDefinedDevicePath, "subtype")); | |
| 716 | assert(2 == @offsetOf(VendorDefinedDevicePath, "length")); | |
| 717 | assert(4 == @offsetOf(VendorDefinedDevicePath, "vendor_guid")); | |
| 718 | } | |
| 719 | }; | |
| 720 | ||
| 721 | pub const Media = union(Subtype) { | |
| 722 | HardDrive: *const HardDriveDevicePath, | |
| 723 | Cdrom: *const CdromDevicePath, | |
| 724 | Vendor: *const VendorDevicePath, | |
| 725 | FilePath: *const FilePathDevicePath, | |
| 726 | MediaProtocol: *const MediaProtocolDevicePath, | |
| 727 | PiwgFirmwareFile: *const PiwgFirmwareFileDevicePath, | |
| 728 | PiwgFirmwareVolume: *const PiwgFirmwareVolumeDevicePath, | |
| 729 | RelativeOffsetRange: *const RelativeOffsetRangeDevicePath, | |
| 730 | RamDisk: *const RamDiskDevicePath, | |
| 731 | ||
| 732 | pub const Subtype = enum(u8) { | |
| 733 | HardDrive = 1, | |
| 734 | Cdrom = 2, | |
| 735 | Vendor = 3, | |
| 736 | FilePath = 4, | |
| 737 | MediaProtocol = 5, | |
| 738 | PiwgFirmwareFile = 6, | |
| 739 | PiwgFirmwareVolume = 7, | |
| 740 | RelativeOffsetRange = 8, | |
| 741 | RamDisk = 9, | |
| 742 | _, | |
| 743 | }; | |
| 744 | ||
| 745 | pub const HardDriveDevicePath = extern struct { | |
| 746 | pub const Format = enum(u8) { | |
| 747 | LegacyMbr = 0x01, | |
| 748 | GuidPartitionTable = 0x02, | |
| 749 | }; | |
| 750 | ||
| 751 | pub const SignatureType = enum(u8) { | |
| 752 | NoSignature = 0x00, | |
| 753 | /// "32-bit signature from address 0x1b8 of the type 0x01 MBR" | |
| 754 | MbrSignature = 0x01, | |
| 755 | GuidSignature = 0x02, | |
| 756 | }; | |
| 757 | ||
| 758 | type: DevicePath.Type, | |
| 759 | subtype: Subtype, | |
| 760 | length: u16 align(1), | |
| 761 | partition_number: u32 align(1), | |
| 762 | partition_start: u64 align(1), | |
| 763 | partition_size: u64 align(1), | |
| 764 | partition_signature: [16]u8, | |
| 765 | partition_format: Format, | |
| 766 | signature_type: SignatureType, | |
| 767 | }; | |
| 768 | ||
| 769 | comptime { | |
| 770 | assert(42 == @sizeOf(HardDriveDevicePath)); | |
| 771 | assert(1 == @alignOf(HardDriveDevicePath)); | |
| 772 | ||
| 773 | assert(0 == @offsetOf(HardDriveDevicePath, "type")); | |
| 774 | assert(1 == @offsetOf(HardDriveDevicePath, "subtype")); | |
| 775 | assert(2 == @offsetOf(HardDriveDevicePath, "length")); | |
| 776 | assert(4 == @offsetOf(HardDriveDevicePath, "partition_number")); | |
| 777 | assert(8 == @offsetOf(HardDriveDevicePath, "partition_start")); | |
| 778 | assert(16 == @offsetOf(HardDriveDevicePath, "partition_size")); | |
| 779 | assert(24 == @offsetOf(HardDriveDevicePath, "partition_signature")); | |
| 780 | assert(40 == @offsetOf(HardDriveDevicePath, "partition_format")); | |
| 781 | assert(41 == @offsetOf(HardDriveDevicePath, "signature_type")); | |
| 782 | } | |
| 783 | ||
| 784 | pub const CdromDevicePath = extern struct { | |
| 785 | type: DevicePath.Type, | |
| 786 | subtype: Subtype, | |
| 787 | length: u16 align(1), | |
| 788 | boot_entry: u32 align(1), | |
| 789 | partition_start: u64 align(1), | |
| 790 | partition_size: u64 align(1), | |
| 791 | }; | |
| 792 | ||
| 793 | comptime { | |
| 794 | assert(24 == @sizeOf(CdromDevicePath)); | |
| 795 | assert(1 == @alignOf(CdromDevicePath)); | |
| 796 | ||
| 797 | assert(0 == @offsetOf(CdromDevicePath, "type")); | |
| 798 | assert(1 == @offsetOf(CdromDevicePath, "subtype")); | |
| 799 | assert(2 == @offsetOf(CdromDevicePath, "length")); | |
| 800 | assert(4 == @offsetOf(CdromDevicePath, "boot_entry")); | |
| 801 | assert(8 == @offsetOf(CdromDevicePath, "partition_start")); | |
| 802 | assert(16 == @offsetOf(CdromDevicePath, "partition_size")); | |
| 803 | } | |
| 804 | ||
| 805 | pub const VendorDevicePath = extern struct { | |
| 806 | type: DevicePath.Type, | |
| 807 | subtype: Subtype, | |
| 808 | length: u16 align(1), | |
| 809 | guid: Guid align(1), | |
| 810 | }; | |
| 811 | ||
| 812 | comptime { | |
| 813 | assert(20 == @sizeOf(VendorDevicePath)); | |
| 814 | assert(1 == @alignOf(VendorDevicePath)); | |
| 815 | ||
| 816 | assert(0 == @offsetOf(VendorDevicePath, "type")); | |
| 817 | assert(1 == @offsetOf(VendorDevicePath, "subtype")); | |
| 818 | assert(2 == @offsetOf(VendorDevicePath, "length")); | |
| 819 | assert(4 == @offsetOf(VendorDevicePath, "guid")); | |
| 820 | } | |
| 821 | ||
| 822 | pub const FilePathDevicePath = extern struct { | |
| 823 | type: DevicePath.Type, | |
| 824 | subtype: Subtype, | |
| 825 | length: u16 align(1), | |
| 826 | ||
| 827 | pub fn getPath(self: *const FilePathDevicePath) [*:0]align(1) const u16 { | |
| 828 | return @as([*:0]align(1) const u16, @ptrCast(@as([*]const u8, @ptrCast(self)) + @sizeOf(FilePathDevicePath))); | |
| 829 | } | |
| 830 | }; | |
| 831 | ||
| 832 | comptime { | |
| 833 | assert(4 == @sizeOf(FilePathDevicePath)); | |
| 834 | assert(1 == @alignOf(FilePathDevicePath)); | |
| 835 | ||
| 836 | assert(0 == @offsetOf(FilePathDevicePath, "type")); | |
| 837 | assert(1 == @offsetOf(FilePathDevicePath, "subtype")); | |
| 838 | assert(2 == @offsetOf(FilePathDevicePath, "length")); | |
| 839 | } | |
| 840 | ||
| 841 | pub const MediaProtocolDevicePath = extern struct { | |
| 842 | type: DevicePath.Type, | |
| 843 | subtype: Subtype, | |
| 844 | length: u16 align(1), | |
| 845 | guid: Guid align(1), | |
| 846 | }; | |
| 847 | ||
| 848 | comptime { | |
| 849 | assert(20 == @sizeOf(MediaProtocolDevicePath)); | |
| 850 | assert(1 == @alignOf(MediaProtocolDevicePath)); | |
| 851 | ||
| 852 | assert(0 == @offsetOf(MediaProtocolDevicePath, "type")); | |
| 853 | assert(1 == @offsetOf(MediaProtocolDevicePath, "subtype")); | |
| 854 | assert(2 == @offsetOf(MediaProtocolDevicePath, "length")); | |
| 855 | assert(4 == @offsetOf(MediaProtocolDevicePath, "guid")); | |
| 856 | } | |
| 857 | ||
| 858 | pub const PiwgFirmwareFileDevicePath = extern struct { | |
| 859 | type: DevicePath.Type, | |
| 860 | subtype: Subtype, | |
| 861 | length: u16 align(1), | |
| 862 | fv_filename: Guid align(1), | |
| 863 | }; | |
| 864 | ||
| 865 | comptime { | |
| 866 | assert(20 == @sizeOf(PiwgFirmwareFileDevicePath)); | |
| 867 | assert(1 == @alignOf(PiwgFirmwareFileDevicePath)); | |
| 868 | ||
| 869 | assert(0 == @offsetOf(PiwgFirmwareFileDevicePath, "type")); | |
| 870 | assert(1 == @offsetOf(PiwgFirmwareFileDevicePath, "subtype")); | |
| 871 | assert(2 == @offsetOf(PiwgFirmwareFileDevicePath, "length")); | |
| 872 | assert(4 == @offsetOf(PiwgFirmwareFileDevicePath, "fv_filename")); | |
| 873 | } | |
| 874 | ||
| 875 | pub const PiwgFirmwareVolumeDevicePath = extern struct { | |
| 876 | type: DevicePath.Type, | |
| 877 | subtype: Subtype, | |
| 878 | length: u16 align(1), | |
| 879 | fv_name: Guid align(1), | |
| 880 | }; | |
| 881 | ||
| 882 | comptime { | |
| 883 | assert(20 == @sizeOf(PiwgFirmwareVolumeDevicePath)); | |
| 884 | assert(1 == @alignOf(PiwgFirmwareVolumeDevicePath)); | |
| 885 | ||
| 886 | assert(0 == @offsetOf(PiwgFirmwareVolumeDevicePath, "type")); | |
| 887 | assert(1 == @offsetOf(PiwgFirmwareVolumeDevicePath, "subtype")); | |
| 888 | assert(2 == @offsetOf(PiwgFirmwareVolumeDevicePath, "length")); | |
| 889 | assert(4 == @offsetOf(PiwgFirmwareVolumeDevicePath, "fv_name")); | |
| 890 | } | |
| 891 | ||
| 892 | pub const RelativeOffsetRangeDevicePath = extern struct { | |
| 893 | type: DevicePath.Type, | |
| 894 | subtype: Subtype, | |
| 895 | length: u16 align(1), | |
| 896 | reserved: u32 align(1), | |
| 897 | start: u64 align(1), | |
| 898 | end: u64 align(1), | |
| 899 | }; | |
| 900 | ||
| 901 | comptime { | |
| 902 | assert(24 == @sizeOf(RelativeOffsetRangeDevicePath)); | |
| 903 | assert(1 == @alignOf(RelativeOffsetRangeDevicePath)); | |
| 904 | ||
| 905 | assert(0 == @offsetOf(RelativeOffsetRangeDevicePath, "type")); | |
| 906 | assert(1 == @offsetOf(RelativeOffsetRangeDevicePath, "subtype")); | |
| 907 | assert(2 == @offsetOf(RelativeOffsetRangeDevicePath, "length")); | |
| 908 | assert(4 == @offsetOf(RelativeOffsetRangeDevicePath, "reserved")); | |
| 909 | assert(8 == @offsetOf(RelativeOffsetRangeDevicePath, "start")); | |
| 910 | assert(16 == @offsetOf(RelativeOffsetRangeDevicePath, "end")); | |
| 911 | } | |
| 912 | ||
| 913 | pub const RamDiskDevicePath = extern struct { | |
| 914 | type: DevicePath.Type, | |
| 915 | subtype: Subtype, | |
| 916 | length: u16 align(1), | |
| 917 | start: u64 align(1), | |
| 918 | end: u64 align(1), | |
| 919 | disk_type: Guid align(1), | |
| 920 | instance: u16 align(1), | |
| 921 | }; | |
| 922 | ||
| 923 | comptime { | |
| 924 | assert(38 == @sizeOf(RamDiskDevicePath)); | |
| 925 | assert(1 == @alignOf(RamDiskDevicePath)); | |
| 926 | ||
| 927 | assert(0 == @offsetOf(RamDiskDevicePath, "type")); | |
| 928 | assert(1 == @offsetOf(RamDiskDevicePath, "subtype")); | |
| 929 | assert(2 == @offsetOf(RamDiskDevicePath, "length")); | |
| 930 | assert(4 == @offsetOf(RamDiskDevicePath, "start")); | |
| 931 | assert(12 == @offsetOf(RamDiskDevicePath, "end")); | |
| 932 | assert(20 == @offsetOf(RamDiskDevicePath, "disk_type")); | |
| 933 | assert(36 == @offsetOf(RamDiskDevicePath, "instance")); | |
| 934 | } | |
| 935 | }; | |
| 936 | ||
| 937 | pub const BiosBootSpecification = union(Subtype) { | |
| 938 | BBS101: *const BBS101DevicePath, | |
| 939 | ||
| 940 | pub const Subtype = enum(u8) { | |
| 941 | BBS101 = 1, | |
| 942 | _, | |
| 943 | }; | |
| 944 | ||
| 945 | pub const BBS101DevicePath = extern struct { | |
| 946 | type: DevicePath.Type, | |
| 947 | subtype: Subtype, | |
| 948 | length: u16 align(1), | |
| 949 | device_type: u16 align(1), | |
| 950 | status_flag: u16 align(1), | |
| 951 | ||
| 952 | pub fn getDescription(self: *const BBS101DevicePath) [*:0]const u8 { | |
| 953 | return @as([*:0]const u8, @ptrCast(self)) + @sizeOf(BBS101DevicePath); | |
| 954 | } | |
| 955 | }; | |
| 956 | ||
| 957 | comptime { | |
| 958 | assert(8 == @sizeOf(BBS101DevicePath)); | |
| 959 | assert(1 == @alignOf(BBS101DevicePath)); | |
| 960 | ||
| 961 | assert(0 == @offsetOf(BBS101DevicePath, "type")); | |
| 962 | assert(1 == @offsetOf(BBS101DevicePath, "subtype")); | |
| 963 | assert(2 == @offsetOf(BBS101DevicePath, "length")); | |
| 964 | assert(4 == @offsetOf(BBS101DevicePath, "device_type")); | |
| 965 | assert(6 == @offsetOf(BBS101DevicePath, "status_flag")); | |
| 966 | } | |
| 967 | }; | |
| 968 | ||
| 969 | pub const End = union(Subtype) { | |
| 970 | EndEntire: *const EndEntireDevicePath, | |
| 971 | EndThisInstance: *const EndThisInstanceDevicePath, | |
| 972 | ||
| 973 | pub const Subtype = enum(u8) { | |
| 974 | EndEntire = 0xff, | |
| 975 | EndThisInstance = 0x01, | |
| 976 | _, | |
| 977 | }; | |
| 978 | ||
| 979 | pub const EndEntireDevicePath = extern struct { | |
| 980 | type: DevicePath.Type, | |
| 981 | subtype: Subtype, | |
| 982 | length: u16 align(1), | |
| 983 | }; | |
| 984 | ||
| 985 | comptime { | |
| 986 | assert(4 == @sizeOf(EndEntireDevicePath)); | |
| 987 | assert(1 == @alignOf(EndEntireDevicePath)); | |
| 988 | ||
| 989 | assert(0 == @offsetOf(EndEntireDevicePath, "type")); | |
| 990 | assert(1 == @offsetOf(EndEntireDevicePath, "subtype")); | |
| 991 | assert(2 == @offsetOf(EndEntireDevicePath, "length")); | |
| 992 | } | |
| 993 | ||
| 994 | pub const EndThisInstanceDevicePath = extern struct { | |
| 995 | type: DevicePath.Type, | |
| 996 | subtype: Subtype, | |
| 997 | length: u16 align(1), | |
| 998 | }; | |
| 999 | ||
| 1000 | comptime { | |
| 1001 | assert(4 == @sizeOf(EndEntireDevicePath)); | |
| 1002 | assert(1 == @alignOf(EndEntireDevicePath)); | |
| 1003 | ||
| 1004 | assert(0 == @offsetOf(EndEntireDevicePath, "type")); | |
| 1005 | assert(1 == @offsetOf(EndEntireDevicePath, "subtype")); | |
| 1006 | assert(2 == @offsetOf(EndEntireDevicePath, "length")); | |
| 1007 | } | |
| 1008 | }; | |
| 1009 | }; |
lib/std/os/uefi/hii.zig created+79| ... | ... | @@ -0,0 +1,79 @@ |
| 1 | const uefi = @import("std").os.uefi; | |
| 2 | const Guid = uefi.Guid; | |
| 3 | ||
| 4 | pub const Handle = *opaque {}; | |
| 5 | ||
| 6 | /// The header found at the start of each package. | |
| 7 | pub const PackageHeader = packed struct(u32) { | |
| 8 | length: u24, | |
| 9 | type: u8, | |
| 10 | ||
| 11 | pub const type_all: u8 = 0x0; | |
| 12 | pub const type_guid: u8 = 0x1; | |
| 13 | pub const forms: u8 = 0x2; | |
| 14 | pub const strings: u8 = 0x4; | |
| 15 | pub const fonts: u8 = 0x5; | |
| 16 | pub const images: u8 = 0x6; | |
| 17 | pub const simple_fonsts: u8 = 0x7; | |
| 18 | pub const device_path: u8 = 0x8; | |
| 19 | pub const keyboard_layout: u8 = 0x9; | |
| 20 | pub const animations: u8 = 0xa; | |
| 21 | pub const end: u8 = 0xdf; | |
| 22 | pub const type_system_begin: u8 = 0xe0; | |
| 23 | pub const type_system_end: u8 = 0xff; | |
| 24 | }; | |
| 25 | ||
| 26 | /// The header found at the start of each package list. | |
| 27 | pub const PackageList = extern struct { | |
| 28 | package_list_guid: Guid, | |
| 29 | ||
| 30 | /// The size of the package list (in bytes), including the header. | |
| 31 | package_list_length: u32, | |
| 32 | ||
| 33 | // TODO implement iterator | |
| 34 | }; | |
| 35 | ||
| 36 | pub const SimplifiedFontPackage = extern struct { | |
| 37 | header: PackageHeader, | |
| 38 | number_of_narrow_glyphs: u16, | |
| 39 | number_of_wide_glyphs: u16, | |
| 40 | ||
| 41 | pub fn getNarrowGlyphs(self: *SimplifiedFontPackage) []NarrowGlyph { | |
| 42 | return @as([*]NarrowGlyph, @ptrCast(@alignCast(@as([*]u8, @ptrCast(self)) + @sizeOf(SimplifiedFontPackage))))[0..self.number_of_narrow_glyphs]; | |
| 43 | } | |
| 44 | }; | |
| 45 | ||
| 46 | pub const NarrowGlyphAttributes = packed struct(u8) { | |
| 47 | non_spacing: bool, | |
| 48 | wide: bool, | |
| 49 | _pad: u6 = 0, | |
| 50 | }; | |
| 51 | ||
| 52 | pub const NarrowGlyph = extern struct { | |
| 53 | unicode_weight: u16, | |
| 54 | attributes: NarrowGlyphAttributes, | |
| 55 | glyph_col_1: [19]u8, | |
| 56 | }; | |
| 57 | ||
| 58 | pub const WideGlyphAttributes = packed struct(u8) { | |
| 59 | non_spacing: bool, | |
| 60 | wide: bool, | |
| 61 | _pad: u6 = 0, | |
| 62 | }; | |
| 63 | ||
| 64 | pub const WideGlyph = extern struct { | |
| 65 | unicode_weight: u16, | |
| 66 | attributes: WideGlyphAttributes, | |
| 67 | glyph_col_1: [19]u8, | |
| 68 | glyph_col_2: [19]u8, | |
| 69 | _pad: [3]u8 = [_]u8{0} ** 3, | |
| 70 | }; | |
| 71 | ||
| 72 | pub const StringPackage = extern struct { | |
| 73 | header: PackageHeader, | |
| 74 | hdr_size: u32, | |
| 75 | string_info_offset: u32, | |
| 76 | language_window: [16]u16, | |
| 77 | language_name: u16, | |
| 78 | language: [3]u8, | |
| 79 | }; |
lib/std/os/uefi/protocol.zig created+37| ... | ... | @@ -0,0 +1,37 @@ |
| 1 | pub const LoadedImage = @import("protocol/loaded_image.zig").LoadedImage; | |
| 2 | pub const DevicePath = @import("protocol/device_path.zig").DevicePath; | |
| 3 | pub const Rng = @import("protocol/rng.zig").Rng; | |
| 4 | pub const ShellParameters = @import("protocol/shell_parameters.zig").ShellParameters; | |
| 5 | ||
| 6 | pub const SimpleFileSystem = @import("protocol/simple_file_system.zig").SimpleFileSystem; | |
| 7 | pub const File = @import("protocol/file.zig").File; | |
| 8 | pub const BlockIo = @import("protocol/block_io.zig").BlockIo; | |
| 9 | ||
| 10 | pub const SimpleTextInput = @import("protocol/simple_text_input.zig").SimpleTextInput; | |
| 11 | pub const SimpleTextInputEx = @import("protocol/simple_text_input_ex.zig").SimpleTextInputEx; | |
| 12 | pub const SimpleTextOutput = @import("protocol/simple_text_output.zig").SimpleTextOutput; | |
| 13 | ||
| 14 | pub const SimplePointer = @import("protocol/simple_pointer.zig").SimplePointer; | |
| 15 | pub const AbsolutePointer = @import("protocol/absolute_pointer.zig").AbsolutePointer; | |
| 16 | ||
| 17 | pub const GraphicsOutput = @import("protocol/graphics_output.zig").GraphicsOutput; | |
| 18 | ||
| 19 | pub const edid = @import("protocol/edid.zig"); | |
| 20 | ||
| 21 | pub const SimpleNetwork = @import("protocol/simple_network.zig").SimpleNetwork; | |
| 22 | pub const ManagedNetwork = @import("protocol/managed_network.zig").ManagedNetwork; | |
| 23 | ||
| 24 | pub const Ip6ServiceBinding = @import("protocol/ip6_service_binding.zig").Ip6ServiceBinding; | |
| 25 | pub const Ip6 = @import("protocol/ip6.zig").Ip6; | |
| 26 | pub const Ip6Config = @import("protocol/ip6_config.zig").Ip6Config; | |
| 27 | ||
| 28 | pub const Udp6ServiceBinding = @import("protocol/udp6_service_binding.zig").Udp6ServiceBinding; | |
| 29 | pub const Udp6 = @import("protocol/udp6.zig").Udp6; | |
| 30 | ||
| 31 | pub const HiiDatabase = @import("protocol/hii_database.zig").HiiDatabase; | |
| 32 | pub const HiiPopup = @import("protocol/hii_popup.zig").HiiPopup; | |
| 33 | ||
| 34 | test { | |
| 35 | @setEvalBranchQuota(2000); | |
| 36 | @import("std").testing.refAllDeclsRecursive(@This()); | |
| 37 | } |
lib/std/os/uefi/protocol/absolute_pointer.zig created+62| ... | ... | @@ -0,0 +1,62 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Event = uefi.Event; | |
| 4 | const Guid = uefi.Guid; | |
| 5 | const Status = uefi.Status; | |
| 6 | const cc = uefi.cc; | |
| 7 | ||
| 8 | /// Protocol for touchscreens. | |
| 9 | pub const AbsolutePointer = extern struct { | |
| 10 | _reset: *const fn (*const AbsolutePointer, bool) callconv(cc) Status, | |
| 11 | _get_state: *const fn (*const AbsolutePointer, *State) callconv(cc) Status, | |
| 12 | wait_for_input: Event, | |
| 13 | mode: *Mode, | |
| 14 | ||
| 15 | /// Resets the pointer device hardware. | |
| 16 | pub fn reset(self: *const AbsolutePointer, verify: bool) Status { | |
| 17 | return self._reset(self, verify); | |
| 18 | } | |
| 19 | ||
| 20 | /// Retrieves the current state of a pointer device. | |
| 21 | pub fn getState(self: *const AbsolutePointer, state: *State) Status { | |
| 22 | return self._get_state(self, state); | |
| 23 | } | |
| 24 | ||
| 25 | pub const guid align(8) = Guid{ | |
| 26 | .time_low = 0x8d59d32b, | |
| 27 | .time_mid = 0xc655, | |
| 28 | .time_high_and_version = 0x4ae9, | |
| 29 | .clock_seq_high_and_reserved = 0x9b, | |
| 30 | .clock_seq_low = 0x15, | |
| 31 | .node = [_]u8{ 0xf2, 0x59, 0x04, 0x99, 0x2a, 0x43 }, | |
| 32 | }; | |
| 33 | ||
| 34 | pub const Mode = extern struct { | |
| 35 | absolute_min_x: u64, | |
| 36 | absolute_min_y: u64, | |
| 37 | absolute_min_z: u64, | |
| 38 | absolute_max_x: u64, | |
| 39 | absolute_max_y: u64, | |
| 40 | absolute_max_z: u64, | |
| 41 | attributes: Attributes, | |
| 42 | ||
| 43 | pub const Attributes = packed struct(u32) { | |
| 44 | supports_alt_active: bool, | |
| 45 | supports_pressure_as_z: bool, | |
| 46 | _pad: u30 = 0, | |
| 47 | }; | |
| 48 | }; | |
| 49 | ||
| 50 | pub const State = extern struct { | |
| 51 | current_x: u64, | |
| 52 | current_y: u64, | |
| 53 | current_z: u64, | |
| 54 | active_buttons: ActiveButtons, | |
| 55 | ||
| 56 | pub const ActiveButtons = packed struct(u32) { | |
| 57 | touch_active: bool, | |
| 58 | alt_active: bool, | |
| 59 | _pad: u30 = 0, | |
| 60 | }; | |
| 61 | }; | |
| 62 | }; |
lib/std/os/uefi/protocol/block_io.zig created+81| ... | ... | @@ -0,0 +1,81 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Status = uefi.Status; | |
| 4 | const cc = uefi.cc; | |
| 5 | ||
| 6 | pub const BlockIo = extern struct { | |
| 7 | const Self = @This(); | |
| 8 | ||
| 9 | revision: u64, | |
| 10 | media: *EfiBlockMedia, | |
| 11 | ||
| 12 | _reset: *const fn (*BlockIo, extended_verification: bool) callconv(cc) Status, | |
| 13 | _read_blocks: *const fn (*BlockIo, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) callconv(cc) Status, | |
| 14 | _write_blocks: *const fn (*BlockIo, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) callconv(cc) Status, | |
| 15 | _flush_blocks: *const fn (*BlockIo) callconv(cc) Status, | |
| 16 | ||
| 17 | /// Resets the block device hardware. | |
| 18 | pub fn reset(self: *Self, extended_verification: bool) Status { | |
| 19 | return self._reset(self, extended_verification); | |
| 20 | } | |
| 21 | ||
| 22 | /// Reads the number of requested blocks from the device. | |
| 23 | pub fn readBlocks(self: *Self, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) Status { | |
| 24 | return self._read_blocks(self, media_id, lba, buffer_size, buf); | |
| 25 | } | |
| 26 | ||
| 27 | /// Writes a specified number of blocks to the device. | |
| 28 | pub fn writeBlocks(self: *Self, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) Status { | |
| 29 | return self._write_blocks(self, media_id, lba, buffer_size, buf); | |
| 30 | } | |
| 31 | ||
| 32 | /// Flushes all modified data to a physical block device. | |
| 33 | pub fn flushBlocks(self: *Self) Status { | |
| 34 | return self._flush_blocks(self); | |
| 35 | } | |
| 36 | ||
| 37 | pub const guid align(8) = uefi.Guid{ | |
| 38 | .time_low = 0x964e5b21, | |
| 39 | .time_mid = 0x6459, | |
| 40 | .time_high_and_version = 0x11d2, | |
| 41 | .clock_seq_high_and_reserved = 0x8e, | |
| 42 | .clock_seq_low = 0x39, | |
| 43 | .node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b }, | |
| 44 | }; | |
| 45 | ||
| 46 | pub const EfiBlockMedia = extern struct { | |
| 47 | /// The current media ID. If the media changes, this value is changed. | |
| 48 | media_id: u32, | |
| 49 | ||
| 50 | /// `true` if the media is removable; otherwise, `false`. | |
| 51 | removable_media: bool, | |
| 52 | /// `true` if there is a media currently present in the device | |
| 53 | media_present: bool, | |
| 54 | /// `true` if the `BlockIo` was produced to abstract | |
| 55 | /// partition structures on the disk. `false` if the `BlockIo` was | |
| 56 | /// produced to abstract the logical blocks on a hardware device. | |
| 57 | logical_partition: bool, | |
| 58 | /// `true` if the media is marked read-only otherwise, `false`. This field | |
| 59 | /// shows the read-only status as of the most recent `WriteBlocks()` | |
| 60 | read_only: bool, | |
| 61 | /// `true` if the WriteBlocks() function caches write data. | |
| 62 | write_caching: bool, | |
| 63 | ||
| 64 | /// The intrinsic block size of the device. If the media changes, then this | |
| 65 | // field is updated. Returns the number of bytes per logical block. | |
| 66 | block_size: u32, | |
| 67 | /// Supplies the alignment requirement for any buffer used in a data | |
| 68 | /// transfer. IoAlign values of 0 and 1 mean that the buffer can be | |
| 69 | /// placed anywhere in memory. Otherwise, IoAlign must be a power of | |
| 70 | /// 2, and the requirement is that the start address of a buffer must be | |
| 71 | /// evenly divisible by IoAlign with no remainder. | |
| 72 | io_align: u32, | |
| 73 | /// The last LBA on the device. If the media changes, then this field is updated. | |
| 74 | last_block: u64, | |
| 75 | ||
| 76 | // Revision 2 | |
| 77 | lowest_aligned_lba: u64, | |
| 78 | logical_blocks_per_physical_block: u32, | |
| 79 | optimal_transfer_length_granularity: u32, | |
| 80 | }; | |
| 81 | }; |
lib/std/os/uefi/protocol/device_path.zig created+122| ... | ... | @@ -0,0 +1,122 @@ |
| 1 | const std = @import("../../../std.zig"); | |
| 2 | const mem = std.mem; | |
| 3 | const uefi = std.os.uefi; | |
| 4 | const Allocator = mem.Allocator; | |
| 5 | const Guid = uefi.Guid; | |
| 6 | const assert = std.debug.assert; | |
| 7 | ||
| 8 | // All Device Path Nodes are byte-packed and may appear on any byte boundary. | |
| 9 | // All code references to device path nodes must assume all fields are unaligned. | |
| 10 | ||
| 11 | pub const DevicePath = extern struct { | |
| 12 | type: uefi.DevicePath.Type, | |
| 13 | subtype: u8, | |
| 14 | length: u16 align(1), | |
| 15 | ||
| 16 | pub const guid align(8) = Guid{ | |
| 17 | .time_low = 0x09576e91, | |
| 18 | .time_mid = 0x6d3f, | |
| 19 | .time_high_and_version = 0x11d2, | |
| 20 | .clock_seq_high_and_reserved = 0x8e, | |
| 21 | .clock_seq_low = 0x39, | |
| 22 | .node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b }, | |
| 23 | }; | |
| 24 | ||
| 25 | /// Returns the next DevicePath node in the sequence, if any. | |
| 26 | pub fn next(self: *DevicePath) ?*DevicePath { | |
| 27 | if (self.type == .End and @as(uefi.DevicePath.End.Subtype, @enumFromInt(self.subtype)) == .EndEntire) | |
| 28 | return null; | |
| 29 | ||
| 30 | return @as(*DevicePath, @ptrCast(@as([*]u8, @ptrCast(self)) + self.length)); | |
| 31 | } | |
| 32 | ||
| 33 | /// Calculates the total length of the device path structure in bytes, including the end of device path node. | |
| 34 | pub fn size(self: *DevicePath) usize { | |
| 35 | var node = self; | |
| 36 | ||
| 37 | while (node.next()) |next_node| { | |
| 38 | node = next_node; | |
| 39 | } | |
| 40 | ||
| 41 | return (@intFromPtr(node) + node.length) - @intFromPtr(self); | |
| 42 | } | |
| 43 | ||
| 44 | /// Creates a file device path from the existing device path and a file path. | |
| 45 | pub fn create_file_device_path(self: *DevicePath, allocator: Allocator, path: [:0]align(1) const u16) !*DevicePath { | |
| 46 | var path_size = self.size(); | |
| 47 | ||
| 48 | // 2 * (path.len + 1) for the path and its null terminator, which are u16s | |
| 49 | // DevicePath for the extra node before the end | |
| 50 | var buf = try allocator.alloc(u8, path_size + 2 * (path.len + 1) + @sizeOf(DevicePath)); | |
| 51 | ||
| 52 | @memcpy(buf[0..path_size], @as([*]const u8, @ptrCast(self))[0..path_size]); | |
| 53 | ||
| 54 | // Pointer to the copy of the end node of the current chain, which is - 4 from the buffer | |
| 55 | // as the end node itself is 4 bytes (type: u8 + subtype: u8 + length: u16). | |
| 56 | var new = @as(*uefi.DevicePath.Media.FilePathDevicePath, @ptrCast(buf.ptr + path_size - 4)); | |
| 57 | ||
| 58 | new.type = .Media; | |
| 59 | new.subtype = .FilePath; | |
| 60 | new.length = @sizeOf(uefi.DevicePath.Media.FilePathDevicePath) + 2 * (@as(u16, @intCast(path.len)) + 1); | |
| 61 | ||
| 62 | // The same as new.getPath(), but not const as we're filling it in. | |
| 63 | var ptr = @as([*:0]align(1) u16, @ptrCast(@as([*]u8, @ptrCast(new)) + @sizeOf(uefi.DevicePath.Media.FilePathDevicePath))); | |
| 64 | ||
| 65 | for (path, 0..) |s, i| | |
| 66 | ptr[i] = s; | |
| 67 | ||
| 68 | ptr[path.len] = 0; | |
| 69 | ||
| 70 | var end = @as(*uefi.DevicePath.End.EndEntireDevicePath, @ptrCast(@as(*DevicePath, @ptrCast(new)).next().?)); | |
| 71 | end.type = .End; | |
| 72 | end.subtype = .EndEntire; | |
| 73 | end.length = @sizeOf(uefi.DevicePath.End.EndEntireDevicePath); | |
| 74 | ||
| 75 | return @as(*DevicePath, @ptrCast(buf.ptr)); | |
| 76 | } | |
| 77 | ||
| 78 | pub fn getDevicePath(self: *const DevicePath) ?uefi.DevicePath { | |
| 79 | inline for (@typeInfo(uefi.DevicePath).Union.fields) |ufield| { | |
| 80 | const enum_value = std.meta.stringToEnum(uefi.DevicePath.Type, ufield.name); | |
| 81 | ||
| 82 | // Got the associated union type for self.type, now | |
| 83 | // we need to initialize it and its subtype | |
| 84 | if (self.type == enum_value) { | |
| 85 | var subtype = self.initSubtype(ufield.type); | |
| 86 | ||
| 87 | if (subtype) |sb| { | |
| 88 | // e.g. return .{ .Hardware = .{ .Pci = @ptrCast(...) } } | |
| 89 | return @unionInit(uefi.DevicePath, ufield.name, sb); | |
| 90 | } | |
| 91 | } | |
| 92 | } | |
| 93 | ||
| 94 | return null; | |
| 95 | } | |
| 96 | ||
| 97 | pub fn initSubtype(self: *const DevicePath, comptime TUnion: type) ?TUnion { | |
| 98 | const type_info = @typeInfo(TUnion).Union; | |
| 99 | const TTag = type_info.tag_type.?; | |
| 100 | ||
| 101 | inline for (type_info.fields) |subtype| { | |
| 102 | // The tag names match the union names, so just grab that off the enum | |
| 103 | const tag_val: u8 = @intFromEnum(@field(TTag, subtype.name)); | |
| 104 | ||
| 105 | if (self.subtype == tag_val) { | |
| 106 | // e.g. expr = .{ .Pci = @ptrCast(...) } | |
| 107 | return @unionInit(TUnion, subtype.name, @as(subtype.type, @ptrCast(self))); | |
| 108 | } | |
| 109 | } | |
| 110 | ||
| 111 | return null; | |
| 112 | } | |
| 113 | }; | |
| 114 | ||
| 115 | comptime { | |
| 116 | assert(4 == @sizeOf(DevicePath)); | |
| 117 | assert(1 == @alignOf(DevicePath)); | |
| 118 | ||
| 119 | assert(0 == @offsetOf(DevicePath, "type")); | |
| 120 | assert(1 == @offsetOf(DevicePath, "subtype")); | |
| 121 | assert(2 == @offsetOf(DevicePath, "length")); | |
| 122 | } |
lib/std/os/uefi/protocol/edid.zig created+67| ... | ... | @@ -0,0 +1,67 @@ |
| 1 | const std = @import("../../../std.zig"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Guid = uefi.Guid; | |
| 4 | const Handle = uefi.Handle; | |
| 5 | const Status = uefi.Status; | |
| 6 | const cc = uefi.cc; | |
| 7 | ||
| 8 | /// EDID information for an active video output device | |
| 9 | pub const Active = extern struct { | |
| 10 | size_of_edid: u32, | |
| 11 | edid: ?[*]u8, | |
| 12 | ||
| 13 | pub const guid align(8) = Guid{ | |
| 14 | .time_low = 0xbd8c1056, | |
| 15 | .time_mid = 0x9f36, | |
| 16 | .time_high_and_version = 0x44ec, | |
| 17 | .clock_seq_high_and_reserved = 0x92, | |
| 18 | .clock_seq_low = 0xa8, | |
| 19 | .node = [_]u8{ 0xa6, 0x33, 0x7f, 0x81, 0x79, 0x86 }, | |
| 20 | }; | |
| 21 | }; | |
| 22 | ||
| 23 | /// EDID information for a video output device | |
| 24 | pub const Discovered = extern struct { | |
| 25 | size_of_edid: u32, | |
| 26 | edid: ?[*]u8, | |
| 27 | ||
| 28 | pub const guid align(8) = Guid{ | |
| 29 | .time_low = 0x1c0c34f6, | |
| 30 | .time_mid = 0xd380, | |
| 31 | .time_high_and_version = 0x41fa, | |
| 32 | .clock_seq_high_and_reserved = 0xa0, | |
| 33 | .clock_seq_low = 0x49, | |
| 34 | .node = [_]u8{ 0x8a, 0xd0, 0x6c, 0x1a, 0x66, 0xaa }, | |
| 35 | }; | |
| 36 | }; | |
| 37 | ||
| 38 | /// Override EDID information | |
| 39 | pub const Override = extern struct { | |
| 40 | _get_edid: *const fn (*const Override, Handle, *Attributes, *usize, *?[*]u8) callconv(cc) Status, | |
| 41 | ||
| 42 | /// Returns policy information and potentially a replacement EDID for the specified video output device. | |
| 43 | pub fn getEdid( | |
| 44 | self: *const Override, | |
| 45 | handle: Handle, | |
| 46 | attributes: *Attributes, | |
| 47 | edid_size: *usize, | |
| 48 | edid: *?[*]u8, | |
| 49 | ) Status { | |
| 50 | return self._get_edid(self, handle, attributes, edid_size, edid); | |
| 51 | } | |
| 52 | ||
| 53 | pub const guid align(8) = Guid{ | |
| 54 | .time_low = 0x48ecb431, | |
| 55 | .time_mid = 0xfb72, | |
| 56 | .time_high_and_version = 0x45c0, | |
| 57 | .clock_seq_high_and_reserved = 0xa9, | |
| 58 | .clock_seq_low = 0x22, | |
| 59 | .node = [_]u8{ 0xf4, 0x58, 0xfe, 0x04, 0x0b, 0xd5 }, | |
| 60 | }; | |
| 61 | ||
| 62 | pub const Attributes = packed struct(u32) { | |
| 63 | dont_override: bool, | |
| 64 | enable_hot_plug: bool, | |
| 65 | _pad: u30 = 0, | |
| 66 | }; | |
| 67 | }; |
lib/std/os/uefi/protocol/file.zig created+144| ... | ... | @@ -0,0 +1,144 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const io = std.io; | |
| 4 | const Guid = uefi.Guid; | |
| 5 | const Time = uefi.Time; | |
| 6 | const Status = uefi.Status; | |
| 7 | const cc = uefi.cc; | |
| 8 | ||
| 9 | pub const File = extern struct { | |
| 10 | revision: u64, | |
| 11 | _open: *const fn (*const File, **const File, [*:0]const u16, u64, u64) callconv(cc) Status, | |
| 12 | _close: *const fn (*const File) callconv(cc) Status, | |
| 13 | _delete: *const fn (*const File) callconv(cc) Status, | |
| 14 | _read: *const fn (*const File, *usize, [*]u8) callconv(cc) Status, | |
| 15 | _write: *const fn (*const File, *usize, [*]const u8) callconv(cc) Status, | |
| 16 | _get_position: *const fn (*const File, *u64) callconv(cc) Status, | |
| 17 | _set_position: *const fn (*const File, u64) callconv(cc) Status, | |
| 18 | _get_info: *const fn (*const File, *align(8) const Guid, *const usize, [*]u8) callconv(cc) Status, | |
| 19 | _set_info: *const fn (*const File, *align(8) const Guid, usize, [*]const u8) callconv(cc) Status, | |
| 20 | _flush: *const fn (*const File) callconv(cc) Status, | |
| 21 | ||
| 22 | pub const SeekError = error{SeekError}; | |
| 23 | pub const GetSeekPosError = error{GetSeekPosError}; | |
| 24 | pub const ReadError = error{ReadError}; | |
| 25 | pub const WriteError = error{WriteError}; | |
| 26 | ||
| 27 | pub const SeekableStream = io.SeekableStream(*const File, SeekError, GetSeekPosError, seekTo, seekBy, getPos, getEndPos); | |
| 28 | pub const Reader = io.Reader(*const File, ReadError, readFn); | |
| 29 | pub const Writer = io.Writer(*const File, WriteError, writeFn); | |
| 30 | ||
| 31 | pub fn seekableStream(self: *File) SeekableStream { | |
| 32 | return .{ .context = self }; | |
| 33 | } | |
| 34 | ||
| 35 | pub fn reader(self: *File) Reader { | |
| 36 | return .{ .context = self }; | |
| 37 | } | |
| 38 | ||
| 39 | pub fn writer(self: *File) Writer { | |
| 40 | return .{ .context = self }; | |
| 41 | } | |
| 42 | ||
| 43 | pub fn open(self: *const File, new_handle: **const File, file_name: [*:0]const u16, open_mode: u64, attributes: u64) Status { | |
| 44 | return self._open(self, new_handle, file_name, open_mode, attributes); | |
| 45 | } | |
| 46 | ||
| 47 | pub fn close(self: *const File) Status { | |
| 48 | return self._close(self); | |
| 49 | } | |
| 50 | ||
| 51 | pub fn delete(self: *const File) Status { | |
| 52 | return self._delete(self); | |
| 53 | } | |
| 54 | ||
| 55 | pub fn read(self: *const File, buffer_size: *usize, buffer: [*]u8) Status { | |
| 56 | return self._read(self, buffer_size, buffer); | |
| 57 | } | |
| 58 | ||
| 59 | fn readFn(self: *const File, buffer: []u8) ReadError!usize { | |
| 60 | var size: usize = buffer.len; | |
| 61 | if (.Success != self.read(&size, buffer.ptr)) return ReadError.ReadError; | |
| 62 | return size; | |
| 63 | } | |
| 64 | ||
| 65 | pub fn write(self: *const File, buffer_size: *usize, buffer: [*]const u8) Status { | |
| 66 | return self._write(self, buffer_size, buffer); | |
| 67 | } | |
| 68 | ||
| 69 | fn writeFn(self: *const File, bytes: []const u8) WriteError!usize { | |
| 70 | var size: usize = bytes.len; | |
| 71 | if (.Success != self.write(&size, bytes.ptr)) return WriteError.WriteError; | |
| 72 | return size; | |
| 73 | } | |
| 74 | ||
| 75 | pub fn getPosition(self: *const File, position: *u64) Status { | |
| 76 | return self._get_position(self, position); | |
| 77 | } | |
| 78 | ||
| 79 | fn getPos(self: *const File) GetSeekPosError!u64 { | |
| 80 | var pos: u64 = undefined; | |
| 81 | if (.Success != self.getPosition(&pos)) return GetSeekPosError.GetSeekPosError; | |
| 82 | return pos; | |
| 83 | } | |
| 84 | ||
| 85 | fn getEndPos(self: *const File) GetSeekPosError!u64 { | |
| 86 | // preserve the old file position | |
| 87 | var pos: u64 = undefined; | |
| 88 | if (.Success != self.getPosition(&pos)) return GetSeekPosError.GetSeekPosError; | |
| 89 | // seek to end of file to get position = file size | |
| 90 | if (.Success != self.setPosition(efi_file_position_end_of_file)) return GetSeekPosError.GetSeekPosError; | |
| 91 | // restore the old position | |
| 92 | if (.Success != self.setPosition(pos)) return GetSeekPosError.GetSeekPosError; | |
| 93 | // return the file size = position | |
| 94 | return pos; | |
| 95 | } | |
| 96 | ||
| 97 | pub fn setPosition(self: *const File, position: u64) Status { | |
| 98 | return self._set_position(self, position); | |
| 99 | } | |
| 100 | ||
| 101 | fn seekTo(self: *const File, pos: u64) SeekError!void { | |
| 102 | if (.Success != self.setPosition(pos)) return SeekError.SeekError; | |
| 103 | } | |
| 104 | ||
| 105 | fn seekBy(self: *const File, offset: i64) SeekError!void { | |
| 106 | // save the old position and calculate the delta | |
| 107 | var pos: u64 = undefined; | |
| 108 | if (.Success != self.getPosition(&pos)) return SeekError.SeekError; | |
| 109 | const seek_back = offset < 0; | |
| 110 | const amt = std.math.absCast(offset); | |
| 111 | if (seek_back) { | |
| 112 | pos += amt; | |
| 113 | } else { | |
| 114 | pos -= amt; | |
| 115 | } | |
| 116 | if (.Success != self.setPosition(pos)) return SeekError.SeekError; | |
| 117 | } | |
| 118 | ||
| 119 | pub fn getInfo(self: *const File, information_type: *align(8) const Guid, buffer_size: *usize, buffer: [*]u8) Status { | |
| 120 | return self._get_info(self, information_type, buffer_size, buffer); | |
| 121 | } | |
| 122 | ||
| 123 | pub fn setInfo(self: *const File, information_type: *align(8) const Guid, buffer_size: usize, buffer: [*]const u8) Status { | |
| 124 | return self._set_info(self, information_type, buffer_size, buffer); | |
| 125 | } | |
| 126 | ||
| 127 | pub fn flush(self: *const File) Status { | |
| 128 | return self._flush(self); | |
| 129 | } | |
| 130 | ||
| 131 | pub const efi_file_mode_read: u64 = 0x0000000000000001; | |
| 132 | pub const efi_file_mode_write: u64 = 0x0000000000000002; | |
| 133 | pub const efi_file_mode_create: u64 = 0x8000000000000000; | |
| 134 | ||
| 135 | pub const efi_file_read_only: u64 = 0x0000000000000001; | |
| 136 | pub const efi_file_hidden: u64 = 0x0000000000000002; | |
| 137 | pub const efi_file_system: u64 = 0x0000000000000004; | |
| 138 | pub const efi_file_reserved: u64 = 0x0000000000000008; | |
| 139 | pub const efi_file_directory: u64 = 0x0000000000000010; | |
| 140 | pub const efi_file_archive: u64 = 0x0000000000000020; | |
| 141 | pub const efi_file_valid_attr: u64 = 0x0000000000000037; | |
| 142 | ||
| 143 | pub const efi_file_position_end_of_file: u64 = 0xffffffffffffffff; | |
| 144 | }; |
lib/std/os/uefi/protocol/graphics_output.zig created+83| ... | ... | @@ -0,0 +1,83 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Guid = uefi.Guid; | |
| 4 | const Status = uefi.Status; | |
| 5 | const cc = uefi.cc; | |
| 6 | ||
| 7 | pub const GraphicsOutput = extern struct { | |
| 8 | _query_mode: *const fn (*const GraphicsOutput, u32, *usize, **Mode.Info) callconv(cc) Status, | |
| 9 | _set_mode: *const fn (*const GraphicsOutput, u32) callconv(cc) Status, | |
| 10 | _blt: *const fn (*const GraphicsOutput, ?[*]BltPixel, BltOperation, usize, usize, usize, usize, usize, usize, usize) callconv(cc) Status, | |
| 11 | mode: *Mode, | |
| 12 | ||
| 13 | /// Returns information for an available graphics mode that the graphics device and the set of active video output devices supports. | |
| 14 | pub fn queryMode(self: *const GraphicsOutput, mode: u32, size_of_info: *usize, info: **Mode.Info) Status { | |
| 15 | return self._query_mode(self, mode, size_of_info, info); | |
| 16 | } | |
| 17 | ||
| 18 | /// Set the video device into the specified mode and clears the visible portions of the output display to black. | |
| 19 | pub fn setMode(self: *const GraphicsOutput, mode: u32) Status { | |
| 20 | return self._set_mode(self, mode); | |
| 21 | } | |
| 22 | ||
| 23 | /// Blt a rectangle of pixels on the graphics screen. Blt stands for BLock Transfer. | |
| 24 | pub fn blt(self: *const GraphicsOutput, blt_buffer: ?[*]BltPixel, blt_operation: BltOperation, source_x: usize, source_y: usize, destination_x: usize, destination_y: usize, width: usize, height: usize, delta: usize) Status { | |
| 25 | return self._blt(self, blt_buffer, blt_operation, source_x, source_y, destination_x, destination_y, width, height, delta); | |
| 26 | } | |
| 27 | ||
| 28 | pub const guid align(8) = Guid{ | |
| 29 | .time_low = 0x9042a9de, | |
| 30 | .time_mid = 0x23dc, | |
| 31 | .time_high_and_version = 0x4a38, | |
| 32 | .clock_seq_high_and_reserved = 0x96, | |
| 33 | .clock_seq_low = 0xfb, | |
| 34 | .node = [_]u8{ 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a }, | |
| 35 | }; | |
| 36 | ||
| 37 | pub const Mode = extern struct { | |
| 38 | max_mode: u32, | |
| 39 | mode: u32, | |
| 40 | info: *Info, | |
| 41 | size_of_info: usize, | |
| 42 | frame_buffer_base: u64, | |
| 43 | frame_buffer_size: usize, | |
| 44 | ||
| 45 | pub const Info = extern struct { | |
| 46 | version: u32, | |
| 47 | horizontal_resolution: u32, | |
| 48 | vertical_resolution: u32, | |
| 49 | pixel_format: PixelFormat, | |
| 50 | pixel_information: PixelBitmask, | |
| 51 | pixels_per_scan_line: u32, | |
| 52 | }; | |
| 53 | }; | |
| 54 | ||
| 55 | pub const PixelFormat = enum(u32) { | |
| 56 | RedGreenBlueReserved8BitPerColor, | |
| 57 | BlueGreenRedReserved8BitPerColor, | |
| 58 | BitMask, | |
| 59 | BltOnly, | |
| 60 | }; | |
| 61 | ||
| 62 | pub const PixelBitmask = extern struct { | |
| 63 | red_mask: u32, | |
| 64 | green_mask: u32, | |
| 65 | blue_mask: u32, | |
| 66 | reserved_mask: u32, | |
| 67 | }; | |
| 68 | ||
| 69 | pub const BltPixel = extern struct { | |
| 70 | blue: u8, | |
| 71 | green: u8, | |
| 72 | red: u8, | |
| 73 | reserved: u8 = undefined, | |
| 74 | }; | |
| 75 | ||
| 76 | pub const BltOperation = enum(u32) { | |
| 77 | BltVideoFill, | |
| 78 | BltVideoToBltBuffer, | |
| 79 | BltBufferToVideo, | |
| 80 | BltVideoToVideo, | |
| 81 | GraphicsOutputBltOperationMax, | |
| 82 | }; | |
| 83 | }; |
lib/std/os/uefi/protocol/hii_database.zig created+50| ... | ... | @@ -0,0 +1,50 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Guid = uefi.Guid; | |
| 4 | const Status = uefi.Status; | |
| 5 | const hii = uefi.hii; | |
| 6 | const cc = uefi.cc; | |
| 7 | ||
| 8 | /// Database manager for HII-related data structures. | |
| 9 | pub const HIIDatabase = extern struct { | |
| 10 | _new_package_list: Status, // TODO | |
| 11 | _remove_package_list: *const fn (*const HIIDatabase, hii.Handle) callconv(cc) Status, | |
| 12 | _update_package_list: *const fn (*const HIIDatabase, hii.Handle, *const hii.PackageList) callconv(cc) Status, | |
| 13 | _list_package_lists: *const fn (*const HIIDatabase, u8, ?*const Guid, *usize, [*]hii.Handle) callconv(cc) Status, | |
| 14 | _export_package_lists: *const fn (*const HIIDatabase, ?hii.Handle, *usize, *hii.PackageList) callconv(cc) Status, | |
| 15 | _register_package_notify: Status, // TODO | |
| 16 | _unregister_package_notify: Status, // TODO | |
| 17 | _find_keyboard_layouts: Status, // TODO | |
| 18 | _get_keyboard_layout: Status, // TODO | |
| 19 | _set_keyboard_layout: Status, // TODO | |
| 20 | _get_package_list_handle: Status, // TODO | |
| 21 | ||
| 22 | /// Removes a package list from the HII database. | |
| 23 | pub fn removePackageList(self: *const HIIDatabase, handle: hii.Handle) Status { | |
| 24 | return self._remove_package_list(self, handle); | |
| 25 | } | |
| 26 | ||
| 27 | /// Update a package list in the HII database. | |
| 28 | pub fn updatePackageList(self: *const HIIDatabase, handle: hii.Handle, buffer: *const hii.PackageList) Status { | |
| 29 | return self._update_package_list(self, handle, buffer); | |
| 30 | } | |
| 31 | ||
| 32 | /// Determines the handles that are currently active in the database. | |
| 33 | pub fn listPackageLists(self: *const HIIDatabase, package_type: u8, package_guid: ?*const Guid, buffer_length: *usize, handles: [*]hii.Handle) Status { | |
| 34 | return self._list_package_lists(self, package_type, package_guid, buffer_length, handles); | |
| 35 | } | |
| 36 | ||
| 37 | /// Exports the contents of one or all package lists in the HII database into a buffer. | |
| 38 | pub fn exportPackageLists(self: *const HIIDatabase, handle: ?hii.Handle, buffer_size: *usize, buffer: *hii.PackageList) Status { | |
| 39 | return self._export_package_lists(self, handle, buffer_size, buffer); | |
| 40 | } | |
| 41 | ||
| 42 | pub const guid align(8) = Guid{ | |
| 43 | .time_low = 0xef9fc172, | |
| 44 | .time_mid = 0xa1b2, | |
| 45 | .time_high_and_version = 0x4693, | |
| 46 | .clock_seq_high_and_reserved = 0xb3, | |
| 47 | .clock_seq_low = 0x27, | |
| 48 | .node = [_]u8{ 0x6d, 0x32, 0xfc, 0x41, 0x60, 0x42 }, | |
| 49 | }; | |
| 50 | }; |
lib/std/os/uefi/protocol/hii_popup.zig created+46| ... | ... | @@ -0,0 +1,46 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Guid = uefi.Guid; | |
| 4 | const Status = uefi.Status; | |
| 5 | const hii = uefi.hii; | |
| 6 | const cc = uefi.cc; | |
| 7 | ||
| 8 | /// Display a popup window | |
| 9 | pub const HIIPopup = extern struct { | |
| 10 | revision: u64, | |
| 11 | _create_popup: *const fn (*const HIIPopup, PopupStyle, PopupType, hii.HIIHandle, u16, ?*PopupSelection) callconv(cc) Status, | |
| 12 | ||
| 13 | /// Displays a popup window. | |
| 14 | pub fn createPopup(self: *const HIIPopup, style: PopupStyle, popup_type: PopupType, handle: hii.HIIHandle, msg: u16, user_selection: ?*PopupSelection) Status { | |
| 15 | return self._create_popup(self, style, popup_type, handle, msg, user_selection); | |
| 16 | } | |
| 17 | ||
| 18 | pub const guid align(8) = Guid{ | |
| 19 | .time_low = 0x4311edc0, | |
| 20 | .time_mid = 0x6054, | |
| 21 | .time_high_and_version = 0x46d4, | |
| 22 | .clock_seq_high_and_reserved = 0x9e, | |
| 23 | .clock_seq_low = 0x40, | |
| 24 | .node = [_]u8{ 0x89, 0x3e, 0xa9, 0x52, 0xfc, 0xcc }, | |
| 25 | }; | |
| 26 | ||
| 27 | pub const PopupStyle = enum(u32) { | |
| 28 | Info, | |
| 29 | Warning, | |
| 30 | Error, | |
| 31 | }; | |
| 32 | ||
| 33 | pub const PopupType = enum(u32) { | |
| 34 | Ok, | |
| 35 | Cancel, | |
| 36 | YesNo, | |
| 37 | YesNoCancel, | |
| 38 | }; | |
| 39 | ||
| 40 | pub const PopupSelection = enum(u32) { | |
| 41 | Ok, | |
| 42 | Cancel, | |
| 43 | Yes, | |
| 44 | No, | |
| 45 | }; | |
| 46 | }; |
lib/std/os/uefi/protocol/ip6.zig created+146| ... | ... | @@ -0,0 +1,146 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Guid = uefi.Guid; | |
| 4 | const Event = uefi.Event; | |
| 5 | const Status = uefi.Status; | |
| 6 | const MacAddress = uefi.protocol.MacAddress; | |
| 7 | const ManagedNetworkConfigData = uefi.protocol.ManagedNetworkConfigData; | |
| 8 | const SimpleNetworkMode = uefi.protocol.SimpleNetworkMode; | |
| 9 | const cc = uefi.cc; | |
| 10 | ||
| 11 | pub const Ip6 = extern struct { | |
| 12 | _get_mode_data: *const fn (*const Ip6, ?*Mode, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(cc) Status, | |
| 13 | _configure: *const fn (*const Ip6, ?*const Config) callconv(cc) Status, | |
| 14 | _groups: *const fn (*const Ip6, bool, ?*const Address) callconv(cc) Status, | |
| 15 | _routes: *const fn (*const Ip6, bool, ?*const Address, u8, ?*const Address) callconv(cc) Status, | |
| 16 | _neighbors: *const fn (*const Ip6, bool, *const Address, ?*const MacAddress, u32, bool) callconv(cc) Status, | |
| 17 | _transmit: *const fn (*const Ip6, *CompletionToken) callconv(cc) Status, | |
| 18 | _receive: *const fn (*const Ip6, *CompletionToken) callconv(cc) Status, | |
| 19 | _cancel: *const fn (*const Ip6, ?*CompletionToken) callconv(cc) Status, | |
| 20 | _poll: *const fn (*const Ip6) callconv(cc) Status, | |
| 21 | ||
| 22 | /// Gets the current operational settings for this instance of the EFI IPv6 Protocol driver. | |
| 23 | pub fn getModeData(self: *const Ip6, ip6_mode_data: ?*Mode, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) Status { | |
| 24 | return self._get_mode_data(self, ip6_mode_data, mnp_config_data, snp_mode_data); | |
| 25 | } | |
| 26 | ||
| 27 | /// Assign IPv6 address and other configuration parameter to this EFI IPv6 Protocol driver instance. | |
| 28 | pub fn configure(self: *const Ip6, ip6_config_data: ?*const Config) Status { | |
| 29 | return self._configure(self, ip6_config_data); | |
| 30 | } | |
| 31 | ||
| 32 | /// Joins and leaves multicast groups. | |
| 33 | pub fn groups(self: *const Ip6, join_flag: bool, group_address: ?*const Address) Status { | |
| 34 | return self._groups(self, join_flag, group_address); | |
| 35 | } | |
| 36 | ||
| 37 | /// Adds and deletes routing table entries. | |
| 38 | pub fn routes(self: *const Ip6, delete_route: bool, destination: ?*const Address, prefix_length: u8, gateway_address: ?*const Address) Status { | |
| 39 | return self._routes(self, delete_route, destination, prefix_length, gateway_address); | |
| 40 | } | |
| 41 | ||
| 42 | /// Add or delete Neighbor cache entries. | |
| 43 | pub fn neighbors(self: *const Ip6, delete_flag: bool, target_ip6_address: *const Address, target_link_address: ?*const MacAddress, timeout: u32, override: bool) Status { | |
| 44 | return self._neighbors(self, delete_flag, target_ip6_address, target_link_address, timeout, override); | |
| 45 | } | |
| 46 | ||
| 47 | /// Places outgoing data packets into the transmit queue. | |
| 48 | pub fn transmit(self: *const Ip6, token: *CompletionToken) Status { | |
| 49 | return self._transmit(self, token); | |
| 50 | } | |
| 51 | ||
| 52 | /// Places a receiving request into the receiving queue. | |
| 53 | pub fn receive(self: *const Ip6, token: *CompletionToken) Status { | |
| 54 | return self._receive(self, token); | |
| 55 | } | |
| 56 | ||
| 57 | /// Abort an asynchronous transmits or receive request. | |
| 58 | pub fn cancel(self: *const Ip6, token: ?*CompletionToken) Status { | |
| 59 | return self._cancel(self, token); | |
| 60 | } | |
| 61 | ||
| 62 | /// Polls for incoming data packets and processes outgoing data packets. | |
| 63 | pub fn poll(self: *const Ip6) Status { | |
| 64 | return self._poll(self); | |
| 65 | } | |
| 66 | ||
| 67 | pub const guid align(8) = Guid{ | |
| 68 | .time_low = 0x2c8759d5, | |
| 69 | .time_mid = 0x5c2d, | |
| 70 | .time_high_and_version = 0x66ef, | |
| 71 | .clock_seq_high_and_reserved = 0x92, | |
| 72 | .clock_seq_low = 0x5f, | |
| 73 | .node = [_]u8{ 0xb6, 0x6c, 0x10, 0x19, 0x57, 0xe2 }, | |
| 74 | }; | |
| 75 | ||
| 76 | pub const Mode = extern struct { | |
| 77 | is_started: bool, | |
| 78 | max_packet_size: u32, | |
| 79 | config_data: Config, | |
| 80 | is_configured: bool, | |
| 81 | address_count: u32, | |
| 82 | address_list: [*]AddressInfo, | |
| 83 | group_count: u32, | |
| 84 | group_table: [*]Address, | |
| 85 | route_count: u32, | |
| 86 | route_table: [*]RouteTable, | |
| 87 | neighbor_count: u32, | |
| 88 | neighbor_cache: [*]NeighborCache, | |
| 89 | prefix_count: u32, | |
| 90 | prefix_table: [*]AddressInfo, | |
| 91 | icmp_type_count: u32, | |
| 92 | icmp_type_list: [*]IcmpType, | |
| 93 | }; | |
| 94 | ||
| 95 | pub const Config = extern struct { | |
| 96 | default_protocol: u8, | |
| 97 | accept_any_protocol: bool, | |
| 98 | accept_icmp_errors: bool, | |
| 99 | accept_promiscuous: bool, | |
| 100 | destination_address: Address, | |
| 101 | station_address: Address, | |
| 102 | traffic_class: u8, | |
| 103 | hop_limit: u8, | |
| 104 | flow_label: u32, | |
| 105 | receive_timeout: u32, | |
| 106 | transmit_timeout: u32, | |
| 107 | }; | |
| 108 | ||
| 109 | pub const Address = [16]u8; | |
| 110 | ||
| 111 | pub const AddressInfo = extern struct { | |
| 112 | address: Address, | |
| 113 | prefix_length: u8, | |
| 114 | }; | |
| 115 | ||
| 116 | pub const RouteTable = extern struct { | |
| 117 | gateway: Address, | |
| 118 | destination: Address, | |
| 119 | prefix_length: u8, | |
| 120 | }; | |
| 121 | ||
| 122 | pub const NeighborState = enum(u32) { | |
| 123 | Incomplete, | |
| 124 | Reachable, | |
| 125 | Stale, | |
| 126 | Delay, | |
| 127 | Probe, | |
| 128 | }; | |
| 129 | ||
| 130 | pub const NeighborCache = extern struct { | |
| 131 | neighbor: Address, | |
| 132 | link_address: MacAddress, | |
| 133 | state: NeighborState, | |
| 134 | }; | |
| 135 | ||
| 136 | pub const IcmpType = extern struct { | |
| 137 | type: u8, | |
| 138 | code: u8, | |
| 139 | }; | |
| 140 | ||
| 141 | pub const CompletionToken = extern struct { | |
| 142 | event: Event, | |
| 143 | status: Status, | |
| 144 | packet: *anyopaque, // union TODO | |
| 145 | }; | |
| 146 | }; |
lib/std/os/uefi/protocol/ip6_config.zig created+48| ... | ... | @@ -0,0 +1,48 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Guid = uefi.Guid; | |
| 4 | const Event = uefi.Event; | |
| 5 | const Status = uefi.Status; | |
| 6 | const cc = uefi.cc; | |
| 7 | ||
| 8 | pub const Ip6Config = extern struct { | |
| 9 | _set_data: *const fn (*const Ip6Config, DataType, usize, *const anyopaque) callconv(cc) Status, | |
| 10 | _get_data: *const fn (*const Ip6Config, DataType, *usize, ?*const anyopaque) callconv(cc) Status, | |
| 11 | _register_data_notify: *const fn (*const Ip6Config, DataType, Event) callconv(cc) Status, | |
| 12 | _unregister_data_notify: *const fn (*const Ip6Config, DataType, Event) callconv(cc) Status, | |
| 13 | ||
| 14 | pub fn setData(self: *const Ip6Config, data_type: DataType, data_size: usize, data: *const anyopaque) Status { | |
| 15 | return self._set_data(self, data_type, data_size, data); | |
| 16 | } | |
| 17 | ||
| 18 | pub fn getData(self: *const Ip6Config, data_type: DataType, data_size: *usize, data: ?*const anyopaque) Status { | |
| 19 | return self._get_data(self, data_type, data_size, data); | |
| 20 | } | |
| 21 | ||
| 22 | pub fn registerDataNotify(self: *const Ip6Config, data_type: DataType, event: Event) Status { | |
| 23 | return self._register_data_notify(self, data_type, event); | |
| 24 | } | |
| 25 | ||
| 26 | pub fn unregisterDataNotify(self: *const Ip6Config, data_type: DataType, event: Event) Status { | |
| 27 | return self._unregister_data_notify(self, data_type, event); | |
| 28 | } | |
| 29 | ||
| 30 | pub const guid align(8) = Guid{ | |
| 31 | .time_low = 0x937fe521, | |
| 32 | .time_mid = 0x95ae, | |
| 33 | .time_high_and_version = 0x4d1a, | |
| 34 | .clock_seq_high_and_reserved = 0x89, | |
| 35 | .clock_seq_low = 0x29, | |
| 36 | .node = [_]u8{ 0x48, 0xbc, 0xd9, 0x0a, 0xd3, 0x1a }, | |
| 37 | }; | |
| 38 | ||
| 39 | pub const DataType = enum(u32) { | |
| 40 | InterfaceInfo, | |
| 41 | AltInterfaceId, | |
| 42 | Policy, | |
| 43 | DupAddrDetectTransmits, | |
| 44 | ManualAddress, | |
| 45 | Gateway, | |
| 46 | DnsServer, | |
| 47 | }; | |
| 48 | }; |
lib/std/os/uefi/protocol/ip6_service_binding.zig created+28| ... | ... | @@ -0,0 +1,28 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Handle = uefi.Handle; | |
| 4 | const Guid = uefi.Guid; | |
| 5 | const Status = uefi.Status; | |
| 6 | const cc = uefi.cc; | |
| 7 | ||
| 8 | pub const Ip6ServiceBinding = extern struct { | |
| 9 | _create_child: *const fn (*const Ip6ServiceBinding, *?Handle) callconv(cc) Status, | |
| 10 | _destroy_child: *const fn (*const Ip6ServiceBinding, Handle) callconv(cc) Status, | |
| 11 | ||
| 12 | pub fn createChild(self: *const Ip6ServiceBinding, handle: *?Handle) Status { | |
| 13 | return self._create_child(self, handle); | |
| 14 | } | |
| 15 | ||
| 16 | pub fn destroyChild(self: *const Ip6ServiceBinding, handle: Handle) Status { | |
| 17 | return self._destroy_child(self, handle); | |
| 18 | } | |
| 19 | ||
| 20 | pub const guid align(8) = Guid{ | |
| 21 | .time_low = 0xec835dd3, | |
| 22 | .time_mid = 0xfe0f, | |
| 23 | .time_high_and_version = 0x617b, | |
| 24 | .clock_seq_high_and_reserved = 0xa6, | |
| 25 | .clock_seq_low = 0x21, | |
| 26 | .node = [_]u8{ 0xb3, 0x50, 0xc3, 0xe1, 0x33, 0x88 }, | |
| 27 | }; | |
| 28 | }; |
lib/std/os/uefi/protocol/loaded_image.zig created+48| ... | ... | @@ -0,0 +1,48 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Guid = uefi.Guid; | |
| 4 | const Handle = uefi.Handle; | |
| 5 | const Status = uefi.Status; | |
| 6 | const SystemTable = uefi.tables.SystemTable; | |
| 7 | const MemoryType = uefi.tables.MemoryType; | |
| 8 | const DevicePath = uefi.protocol.DevicePath; | |
| 9 | const cc = uefi.cc; | |
| 10 | ||
| 11 | pub const LoadedImage = extern struct { | |
| 12 | revision: u32, | |
| 13 | parent_handle: Handle, | |
| 14 | system_table: *SystemTable, | |
| 15 | device_handle: ?Handle, | |
| 16 | file_path: *DevicePath, | |
| 17 | reserved: *anyopaque, | |
| 18 | load_options_size: u32, | |
| 19 | load_options: ?*anyopaque, | |
| 20 | image_base: [*]u8, | |
| 21 | image_size: u64, | |
| 22 | image_code_type: MemoryType, | |
| 23 | image_data_type: MemoryType, | |
| 24 | _unload: *const fn (*const LoadedImage, Handle) callconv(cc) Status, | |
| 25 | ||
| 26 | /// Unloads an image from memory. | |
| 27 | pub fn unload(self: *const LoadedImage, handle: Handle) Status { | |
| 28 | return self._unload(self, handle); | |
| 29 | } | |
| 30 | ||
| 31 | pub const guid align(8) = Guid{ | |
| 32 | .time_low = 0x5b1b31a1, | |
| 33 | .time_mid = 0x9562, | |
| 34 | .time_high_and_version = 0x11d2, | |
| 35 | .clock_seq_high_and_reserved = 0x8e, | |
| 36 | .clock_seq_low = 0x3f, | |
| 37 | .node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b }, | |
| 38 | }; | |
| 39 | ||
| 40 | pub const device_path_guid align(8) = Guid{ | |
| 41 | .time_low = 0xbc62157e, | |
| 42 | .time_mid = 0x3e33, | |
| 43 | .time_high_and_version = 0x4fec, | |
| 44 | .clock_seq_high_and_reserved = 0x99, | |
| 45 | .clock_seq_low = 0x20, | |
| 46 | .node = [_]u8{ 0x2d, 0x3b, 0x36, 0xd7, 0x50, 0xdf }, | |
| 47 | }; | |
| 48 | }; |
lib/std/os/uefi/protocol/managed_network.zig created+152| ... | ... | @@ -0,0 +1,152 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Guid = uefi.Guid; | |
| 4 | const Event = uefi.Event; | |
| 5 | const Handle = uefi.Handle; | |
| 6 | const Status = uefi.Status; | |
| 7 | const Time = uefi.Time; | |
| 8 | const SimpleNetworkMode = uefi.protocol.SimpleNetworkMode; | |
| 9 | const MacAddress = uefi.protocol.MacAddress; | |
| 10 | const cc = uefi.cc; | |
| 11 | ||
| 12 | pub const ManagedNetwork = extern struct { | |
| 13 | _get_mode_data: *const fn (*const ManagedNetwork, ?*Config, ?*SimpleNetworkMode) callconv(cc) Status, | |
| 14 | _configure: *const fn (*const ManagedNetwork, ?*const Config) callconv(cc) Status, | |
| 15 | _mcast_ip_to_mac: *const fn (*const ManagedNetwork, bool, *const anyopaque, *MacAddress) callconv(cc) Status, | |
| 16 | _groups: *const fn (*const ManagedNetwork, bool, ?*const MacAddress) callconv(cc) Status, | |
| 17 | _transmit: *const fn (*const ManagedNetwork, *const CompletionToken) callconv(cc) Status, | |
| 18 | _receive: *const fn (*const ManagedNetwork, *const CompletionToken) callconv(cc) Status, | |
| 19 | _cancel: *const fn (*const ManagedNetwork, ?*const CompletionToken) callconv(cc) Status, | |
| 20 | _poll: *const fn (*const ManagedNetwork) callconv(cc) Status, | |
| 21 | ||
| 22 | /// Returns the operational parameters for the current MNP child driver. | |
| 23 | /// May also support returning the underlying SNP driver mode data. | |
| 24 | pub fn getModeData(self: *const ManagedNetwork, mnp_config_data: ?*Config, snp_mode_data: ?*SimpleNetworkMode) Status { | |
| 25 | return self._get_mode_data(self, mnp_config_data, snp_mode_data); | |
| 26 | } | |
| 27 | ||
| 28 | /// Sets or clears the operational parameters for the MNP child driver. | |
| 29 | pub fn configure(self: *const ManagedNetwork, mnp_config_data: ?*const Config) Status { | |
| 30 | return self._configure(self, mnp_config_data); | |
| 31 | } | |
| 32 | ||
| 33 | /// Translates an IP multicast address to a hardware (MAC) multicast address. | |
| 34 | /// This function may be unsupported in some MNP implementations. | |
| 35 | pub fn mcastIpToMac(self: *const ManagedNetwork, ipv6flag: bool, ipaddress: *const anyopaque, mac_address: *MacAddress) Status { | |
| 36 | return self._mcast_ip_to_mac(self, ipv6flag, ipaddress, mac_address); | |
| 37 | } | |
| 38 | ||
| 39 | /// Enables and disables receive filters for multicast address. | |
| 40 | /// This function may be unsupported in some MNP implementations. | |
| 41 | pub fn groups(self: *const ManagedNetwork, join_flag: bool, mac_address: ?*const MacAddress) Status { | |
| 42 | return self._groups(self, join_flag, mac_address); | |
| 43 | } | |
| 44 | ||
| 45 | /// Places asynchronous outgoing data packets into the transmit queue. | |
| 46 | pub fn transmit(self: *const ManagedNetwork, token: *const CompletionToken) Status { | |
| 47 | return self._transmit(self, token); | |
| 48 | } | |
| 49 | ||
| 50 | /// Places an asynchronous receiving request into the receiving queue. | |
| 51 | pub fn receive(self: *const ManagedNetwork, token: *const CompletionToken) Status { | |
| 52 | return self._receive(self, token); | |
| 53 | } | |
| 54 | ||
| 55 | /// Aborts an asynchronous transmit or receive request. | |
| 56 | pub fn cancel(self: *const ManagedNetwork, token: ?*const CompletionToken) Status { | |
| 57 | return self._cancel(self, token); | |
| 58 | } | |
| 59 | ||
| 60 | /// Polls for incoming data packets and processes outgoing data packets. | |
| 61 | pub fn poll(self: *const ManagedNetwork) Status { | |
| 62 | return self._poll(self); | |
| 63 | } | |
| 64 | ||
| 65 | pub const guid align(8) = Guid{ | |
| 66 | .time_low = 0x7ab33a91, | |
| 67 | .time_mid = 0xace5, | |
| 68 | .time_high_and_version = 0x4326, | |
| 69 | .clock_seq_high_and_reserved = 0xb5, | |
| 70 | .clock_seq_low = 0x72, | |
| 71 | .node = [_]u8{ 0xe7, 0xee, 0x33, 0xd3, 0x9f, 0x16 }, | |
| 72 | }; | |
| 73 | ||
| 74 | pub const ServiceBinding = extern struct { | |
| 75 | _create_child: *const fn (*const ServiceBinding, *?Handle) callconv(cc) Status, | |
| 76 | _destroy_child: *const fn (*const ServiceBinding, Handle) callconv(cc) Status, | |
| 77 | ||
| 78 | pub fn createChild(self: *const ServiceBinding, handle: *?Handle) Status { | |
| 79 | return self._create_child(self, handle); | |
| 80 | } | |
| 81 | ||
| 82 | pub fn destroyChild(self: *const ServiceBinding, handle: Handle) Status { | |
| 83 | return self._destroy_child(self, handle); | |
| 84 | } | |
| 85 | ||
| 86 | pub const guid align(8) = Guid{ | |
| 87 | .time_low = 0xf36ff770, | |
| 88 | .time_mid = 0xa7e1, | |
| 89 | .time_high_and_version = 0x42cf, | |
| 90 | .clock_seq_high_and_reserved = 0x9e, | |
| 91 | .clock_seq_low = 0xd2, | |
| 92 | .node = [_]u8{ 0x56, 0xf0, 0xf2, 0x71, 0xf4, 0x4c }, | |
| 93 | }; | |
| 94 | }; | |
| 95 | ||
| 96 | pub const Config = extern struct { | |
| 97 | received_queue_timeout_value: u32, | |
| 98 | transmit_queue_timeout_value: u32, | |
| 99 | protocol_type_filter: u16, | |
| 100 | enable_unicast_receive: bool, | |
| 101 | enable_multicast_receive: bool, | |
| 102 | enable_broadcast_receive: bool, | |
| 103 | enable_promiscuous_receive: bool, | |
| 104 | flush_queues_on_reset: bool, | |
| 105 | enable_receive_timestamps: bool, | |
| 106 | disable_background_polling: bool, | |
| 107 | }; | |
| 108 | ||
| 109 | pub const CompletionToken = extern struct { | |
| 110 | event: Event, | |
| 111 | status: Status, | |
| 112 | packet: extern union { | |
| 113 | RxData: *ReceiveData, | |
| 114 | TxData: *TransmitData, | |
| 115 | }, | |
| 116 | }; | |
| 117 | ||
| 118 | pub const ReceiveData = extern struct { | |
| 119 | timestamp: Time, | |
| 120 | recycle_event: Event, | |
| 121 | packet_length: u32, | |
| 122 | header_length: u32, | |
| 123 | address_length: u32, | |
| 124 | data_length: u32, | |
| 125 | broadcast_flag: bool, | |
| 126 | multicast_flag: bool, | |
| 127 | promiscuous_flag: bool, | |
| 128 | protocol_type: u16, | |
| 129 | destination_address: [*]u8, | |
| 130 | source_address: [*]u8, | |
| 131 | media_header: [*]u8, | |
| 132 | packet_data: [*]u8, | |
| 133 | }; | |
| 134 | ||
| 135 | pub const TransmitData = extern struct { | |
| 136 | destination_address: ?*MacAddress, | |
| 137 | source_address: ?*MacAddress, | |
| 138 | protocol_type: u16, | |
| 139 | data_length: u32, | |
| 140 | header_length: u16, | |
| 141 | fragment_count: u16, | |
| 142 | ||
| 143 | pub fn getFragments(self: *TransmitData) []Fragment { | |
| 144 | return @as([*]Fragment, @ptrCast(@alignCast(@as([*]u8, @ptrCast(self)) + @sizeOf(TransmitData))))[0..self.fragment_count]; | |
| 145 | } | |
| 146 | }; | |
| 147 | ||
| 148 | pub const Fragment = extern struct { | |
| 149 | fragment_length: u32, | |
| 150 | fragment_buffer: [*]u8, | |
| 151 | }; | |
| 152 | }; |
lib/std/os/uefi/protocol/rng.zig created+78| ... | ... | @@ -0,0 +1,78 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Guid = uefi.Guid; | |
| 4 | const Status = uefi.Status; | |
| 5 | const cc = uefi.cc; | |
| 6 | ||
| 7 | /// Random Number Generator protocol | |
| 8 | pub const Rng = extern struct { | |
| 9 | _get_info: *const fn (*const Rng, *usize, [*]align(8) Guid) callconv(cc) Status, | |
| 10 | _get_rng: *const fn (*const Rng, ?*align(8) const Guid, usize, [*]u8) callconv(cc) Status, | |
| 11 | ||
| 12 | /// Returns information about the random number generation implementation. | |
| 13 | pub fn getInfo(self: *const Rng, list_size: *usize, list: [*]align(8) Guid) Status { | |
| 14 | return self._get_info(self, list_size, list); | |
| 15 | } | |
| 16 | ||
| 17 | /// Produces and returns an RNG value using either the default or specified RNG algorithm. | |
| 18 | pub fn getRNG(self: *const Rng, algo: ?*align(8) const Guid, value_length: usize, value: [*]u8) Status { | |
| 19 | return self._get_rng(self, algo, value_length, value); | |
| 20 | } | |
| 21 | ||
| 22 | pub const guid align(8) = Guid{ | |
| 23 | .time_low = 0x3152bca5, | |
| 24 | .time_mid = 0xeade, | |
| 25 | .time_high_and_version = 0x433d, | |
| 26 | .clock_seq_high_and_reserved = 0x86, | |
| 27 | .clock_seq_low = 0x2e, | |
| 28 | .node = [_]u8{ 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44 }, | |
| 29 | }; | |
| 30 | pub const algorithm_sp800_90_hash_256 align(8) = Guid{ | |
| 31 | .time_low = 0xa7af67cb, | |
| 32 | .time_mid = 0x603b, | |
| 33 | .time_high_and_version = 0x4d42, | |
| 34 | .clock_seq_high_and_reserved = 0xba, | |
| 35 | .clock_seq_low = 0x21, | |
| 36 | .node = [_]u8{ 0x70, 0xbf, 0xb6, 0x29, 0x3f, 0x96 }, | |
| 37 | }; | |
| 38 | pub const algorithm_sp800_90_hmac_256 align(8) = Guid{ | |
| 39 | .time_low = 0xc5149b43, | |
| 40 | .time_mid = 0xae85, | |
| 41 | .time_high_and_version = 0x4f53, | |
| 42 | .clock_seq_high_and_reserved = 0x99, | |
| 43 | .clock_seq_low = 0x82, | |
| 44 | .node = [_]u8{ 0xb9, 0x43, 0x35, 0xd3, 0xa9, 0xe7 }, | |
| 45 | }; | |
| 46 | pub const algorithm_sp800_90_ctr_256 align(8) = Guid{ | |
| 47 | .time_low = 0x44f0de6e, | |
| 48 | .time_mid = 0x4d8c, | |
| 49 | .time_high_and_version = 0x4045, | |
| 50 | .clock_seq_high_and_reserved = 0xa8, | |
| 51 | .clock_seq_low = 0xc7, | |
| 52 | .node = [_]u8{ 0x4d, 0xd1, 0x68, 0x85, 0x6b, 0x9e }, | |
| 53 | }; | |
| 54 | pub const algorithm_x9_31_3des align(8) = Guid{ | |
| 55 | .time_low = 0x63c4785a, | |
| 56 | .time_mid = 0xca34, | |
| 57 | .time_high_and_version = 0x4012, | |
| 58 | .clock_seq_high_and_reserved = 0xa3, | |
| 59 | .clock_seq_low = 0xc8, | |
| 60 | .node = [_]u8{ 0x0b, 0x6a, 0x32, 0x4f, 0x55, 0x46 }, | |
| 61 | }; | |
| 62 | pub const algorithm_x9_31_aes align(8) = Guid{ | |
| 63 | .time_low = 0xacd03321, | |
| 64 | .time_mid = 0x777e, | |
| 65 | .time_high_and_version = 0x4d3d, | |
| 66 | .clock_seq_high_and_reserved = 0xb1, | |
| 67 | .clock_seq_low = 0xc8, | |
| 68 | .node = [_]u8{ 0x20, 0xcf, 0xd8, 0x88, 0x20, 0xc9 }, | |
| 69 | }; | |
| 70 | pub const algorithm_raw align(8) = Guid{ | |
| 71 | .time_low = 0xe43176d7, | |
| 72 | .time_mid = 0xb6e8, | |
| 73 | .time_high_and_version = 0x4827, | |
| 74 | .clock_seq_high_and_reserved = 0xb7, | |
| 75 | .clock_seq_low = 0x84, | |
| 76 | .node = [_]u8{ 0x7f, 0xfd, 0xc4, 0xb6, 0x85, 0x61 }, | |
| 77 | }; | |
| 78 | }; |
lib/std/os/uefi/protocol/shell_parameters.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 ShellParameters = 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/protocol/simple_file_system.zig created+24| ... | ... | @@ -0,0 +1,24 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Guid = uefi.Guid; | |
| 4 | const FileProtocol = uefi.protocol.File; | |
| 5 | const Status = uefi.Status; | |
| 6 | const cc = uefi.cc; | |
| 7 | ||
| 8 | pub const SimpleFileSystem = extern struct { | |
| 9 | revision: u64, | |
| 10 | _open_volume: *const fn (*const SimpleFileSystem, **const FileProtocol) callconv(cc) Status, | |
| 11 | ||
| 12 | pub fn openVolume(self: *const SimpleFileSystem, root: **const FileProtocol) Status { | |
| 13 | return self._open_volume(self, root); | |
| 14 | } | |
| 15 | ||
| 16 | pub const guid align(8) = Guid{ | |
| 17 | .time_low = 0x0964e5b22, | |
| 18 | .time_mid = 0x6459, | |
| 19 | .time_high_and_version = 0x11d2, | |
| 20 | .clock_seq_high_and_reserved = 0x8e, | |
| 21 | .clock_seq_low = 0x39, | |
| 22 | .node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b }, | |
| 23 | }; | |
| 24 | }; |
lib/std/os/uefi/protocol/simple_network.zig created+175| ... | ... | @@ -0,0 +1,175 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Event = uefi.Event; | |
| 4 | const Guid = uefi.Guid; | |
| 5 | const Status = uefi.Status; | |
| 6 | const cc = uefi.cc; | |
| 7 | ||
| 8 | pub const SimpleNetwork = extern struct { | |
| 9 | revision: u64, | |
| 10 | _start: *const fn (*const SimpleNetwork) callconv(cc) Status, | |
| 11 | _stop: *const fn (*const SimpleNetwork) callconv(cc) Status, | |
| 12 | _initialize: *const fn (*const SimpleNetwork, usize, usize) callconv(cc) Status, | |
| 13 | _reset: *const fn (*const SimpleNetwork, bool) callconv(cc) Status, | |
| 14 | _shutdown: *const fn (*const SimpleNetwork) callconv(cc) Status, | |
| 15 | _receive_filters: *const fn (*const SimpleNetwork, ReceiveFilter, ReceiveFilter, bool, usize, ?[*]const MacAddress) callconv(cc) Status, | |
| 16 | _station_address: *const fn (*const SimpleNetwork, bool, ?*const MacAddress) callconv(cc) Status, | |
| 17 | _statistics: *const fn (*const SimpleNetwork, bool, ?*usize, ?*Statistics) callconv(cc) Status, | |
| 18 | _mcast_ip_to_mac: *const fn (*const SimpleNetwork, bool, *const anyopaque, *MacAddress) callconv(cc) Status, | |
| 19 | _nvdata: *const fn (*const SimpleNetwork, bool, usize, usize, [*]u8) callconv(cc) Status, | |
| 20 | _get_status: *const fn (*const SimpleNetwork, *InterruptStatus, ?*?[*]u8) callconv(cc) Status, | |
| 21 | _transmit: *const fn (*const SimpleNetwork, usize, usize, [*]const u8, ?*const MacAddress, ?*const MacAddress, ?*const u16) callconv(cc) Status, | |
| 22 | _receive: *const fn (*const SimpleNetwork, ?*usize, *usize, [*]u8, ?*MacAddress, ?*MacAddress, ?*u16) callconv(cc) Status, | |
| 23 | wait_for_packet: Event, | |
| 24 | mode: *Mode, | |
| 25 | ||
| 26 | /// Changes the state of a network interface from "stopped" to "started". | |
| 27 | pub fn start(self: *const SimpleNetwork) Status { | |
| 28 | return self._start(self); | |
| 29 | } | |
| 30 | ||
| 31 | /// Changes the state of a network interface from "started" to "stopped". | |
| 32 | pub fn stop(self: *const SimpleNetwork) Status { | |
| 33 | return self._stop(self); | |
| 34 | } | |
| 35 | ||
| 36 | /// Resets a network adapter and allocates the transmit and receive buffers required by the network interface. | |
| 37 | pub fn initialize(self: *const SimpleNetwork, extra_rx_buffer_size: usize, extra_tx_buffer_size: usize) Status { | |
| 38 | return self._initialize(self, extra_rx_buffer_size, extra_tx_buffer_size); | |
| 39 | } | |
| 40 | ||
| 41 | /// Resets a network adapter and reinitializes it with the parameters that were provided in the previous call to initialize(). | |
| 42 | pub fn reset(self: *const SimpleNetwork, extended_verification: bool) Status { | |
| 43 | return self._reset(self, extended_verification); | |
| 44 | } | |
| 45 | ||
| 46 | /// Resets a network adapter and leaves it in a state that is safe for another driver to initialize. | |
| 47 | pub fn shutdown(self: *const SimpleNetwork) Status { | |
| 48 | return self._shutdown(self); | |
| 49 | } | |
| 50 | ||
| 51 | /// Manages the multicast receive filters of a network interface. | |
| 52 | pub fn receiveFilters(self: *const SimpleNetwork, enable: ReceiveFilter, disable: ReceiveFilter, reset_mcast_filter: bool, mcast_filter_cnt: usize, mcast_filter: ?[*]const MacAddress) Status { | |
| 53 | return self._receive_filters(self, enable, disable, reset_mcast_filter, mcast_filter_cnt, mcast_filter); | |
| 54 | } | |
| 55 | ||
| 56 | /// Modifies or resets the current station address, if supported. | |
| 57 | pub fn stationAddress(self: *const SimpleNetwork, reset_flag: bool, new: ?*const MacAddress) Status { | |
| 58 | return self._station_address(self, reset_flag, new); | |
| 59 | } | |
| 60 | ||
| 61 | /// Resets or collects the statistics on a network interface. | |
| 62 | pub fn statistics(self: *const SimpleNetwork, reset_flag: bool, statistics_size: ?*usize, statistics_table: ?*Statistics) Status { | |
| 63 | return self._statistics(self, reset_flag, statistics_size, statistics_table); | |
| 64 | } | |
| 65 | ||
| 66 | /// Converts a multicast IP address to a multicast HW MAC address. | |
| 67 | pub fn mcastIpToMac(self: *const SimpleNetwork, ipv6: bool, ip: *const anyopaque, mac: *MacAddress) Status { | |
| 68 | return self._mcast_ip_to_mac(self, ipv6, ip, mac); | |
| 69 | } | |
| 70 | ||
| 71 | /// Performs read and write operations on the NVRAM device attached to a network interface. | |
| 72 | pub fn nvdata(self: *const SimpleNetwork, read_write: bool, offset: usize, buffer_size: usize, buffer: [*]u8) Status { | |
| 73 | return self._nvdata(self, read_write, offset, buffer_size, buffer); | |
| 74 | } | |
| 75 | ||
| 76 | /// Reads the current interrupt status and recycled transmit buffer status from a network interface. | |
| 77 | pub fn getStatus(self: *const SimpleNetwork, interrupt_status: *InterruptStatus, tx_buf: ?*?[*]u8) Status { | |
| 78 | return self._get_status(self, interrupt_status, tx_buf); | |
| 79 | } | |
| 80 | ||
| 81 | /// Places a packet in the transmit queue of a network interface. | |
| 82 | pub fn transmit(self: *const SimpleNetwork, header_size: usize, buffer_size: usize, buffer: [*]const u8, src_addr: ?*const MacAddress, dest_addr: ?*const MacAddress, protocol: ?*const u16) Status { | |
| 83 | return self._transmit(self, header_size, buffer_size, buffer, src_addr, dest_addr, protocol); | |
| 84 | } | |
| 85 | ||
| 86 | /// Receives a packet from a network interface. | |
| 87 | pub fn receive(self: *const SimpleNetwork, header_size: ?*usize, buffer_size: *usize, buffer: [*]u8, src_addr: ?*MacAddress, dest_addr: ?*MacAddress, protocol: ?*u16) Status { | |
| 88 | return self._receive(self, header_size, buffer_size, buffer, src_addr, dest_addr, protocol); | |
| 89 | } | |
| 90 | ||
| 91 | pub const guid align(8) = Guid{ | |
| 92 | .time_low = 0xa19832b9, | |
| 93 | .time_mid = 0xac25, | |
| 94 | .time_high_and_version = 0x11d3, | |
| 95 | .clock_seq_high_and_reserved = 0x9a, | |
| 96 | .clock_seq_low = 0x2d, | |
| 97 | .node = [_]u8{ 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d }, | |
| 98 | }; | |
| 99 | ||
| 100 | pub const MacAddress = [32]u8; | |
| 101 | ||
| 102 | pub const Mode = extern struct { | |
| 103 | state: State, | |
| 104 | hw_address_size: u32, | |
| 105 | media_header_size: u32, | |
| 106 | max_packet_size: u32, | |
| 107 | nvram_size: u32, | |
| 108 | nvram_access_size: u32, | |
| 109 | receive_filter_mask: ReceiveFilter, | |
| 110 | receive_filter_setting: ReceiveFilter, | |
| 111 | max_mcast_filter_count: u32, | |
| 112 | mcast_filter_count: u32, | |
| 113 | mcast_filter: [16]MacAddress, | |
| 114 | current_address: MacAddress, | |
| 115 | broadcast_address: MacAddress, | |
| 116 | permanent_address: MacAddress, | |
| 117 | if_type: u8, | |
| 118 | mac_address_changeable: bool, | |
| 119 | multiple_tx_supported: bool, | |
| 120 | media_present_supported: bool, | |
| 121 | media_present: bool, | |
| 122 | }; | |
| 123 | ||
| 124 | pub const ReceiveFilter = packed struct(u32) { | |
| 125 | receive_unicast: bool, | |
| 126 | receive_multicast: bool, | |
| 127 | receive_broadcast: bool, | |
| 128 | receive_promiscuous: bool, | |
| 129 | receive_promiscuous_multicast: bool, | |
| 130 | _pad: u27 = 0, | |
| 131 | }; | |
| 132 | ||
| 133 | pub const State = enum(u32) { | |
| 134 | Stopped, | |
| 135 | Started, | |
| 136 | Initialized, | |
| 137 | }; | |
| 138 | ||
| 139 | pub const Statistics = extern struct { | |
| 140 | rx_total_frames: u64, | |
| 141 | rx_good_frames: u64, | |
| 142 | rx_undersize_frames: u64, | |
| 143 | rx_oversize_frames: u64, | |
| 144 | rx_dropped_frames: u64, | |
| 145 | rx_unicast_frames: u64, | |
| 146 | rx_broadcast_frames: u64, | |
| 147 | rx_multicast_frames: u64, | |
| 148 | rx_crc_error_frames: u64, | |
| 149 | rx_total_bytes: u64, | |
| 150 | tx_total_frames: u64, | |
| 151 | tx_good_frames: u64, | |
| 152 | tx_undersize_frames: u64, | |
| 153 | tx_oversize_frames: u64, | |
| 154 | tx_dropped_frames: u64, | |
| 155 | tx_unicast_frames: u64, | |
| 156 | tx_broadcast_frames: u64, | |
| 157 | tx_multicast_frames: u64, | |
| 158 | tx_crc_error_frames: u64, | |
| 159 | tx_total_bytes: u64, | |
| 160 | collisions: u64, | |
| 161 | unsupported_protocol: u64, | |
| 162 | rx_duplicated_frames: u64, | |
| 163 | rx_decryptError_frames: u64, | |
| 164 | tx_error_frames: u64, | |
| 165 | tx_retry_frames: u64, | |
| 166 | }; | |
| 167 | ||
| 168 | pub const InterruptStatus = packed struct(u32) { | |
| 169 | receive_interrupt: bool, | |
| 170 | transmit_interrupt: bool, | |
| 171 | command_interrupt: bool, | |
| 172 | software_interrupt: bool, | |
| 173 | _pad: u28 = 0, | |
| 174 | }; | |
| 175 | }; |
lib/std/os/uefi/protocol/simple_pointer.zig created+49| ... | ... | @@ -0,0 +1,49 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Event = uefi.Event; | |
| 4 | const Guid = uefi.Guid; | |
| 5 | const Status = uefi.Status; | |
| 6 | const cc = uefi.cc; | |
| 7 | ||
| 8 | /// Protocol for mice. | |
| 9 | pub const SimplePointer = struct { | |
| 10 | _reset: *const fn (*const SimplePointer, bool) callconv(cc) Status, | |
| 11 | _get_state: *const fn (*const SimplePointer, *State) callconv(cc) Status, | |
| 12 | wait_for_input: Event, | |
| 13 | mode: *Mode, | |
| 14 | ||
| 15 | /// Resets the pointer device hardware. | |
| 16 | pub fn reset(self: *const SimplePointer, verify: bool) Status { | |
| 17 | return self._reset(self, verify); | |
| 18 | } | |
| 19 | ||
| 20 | /// Retrieves the current state of a pointer device. | |
| 21 | pub fn getState(self: *const SimplePointer, state: *State) Status { | |
| 22 | return self._get_state(self, state); | |
| 23 | } | |
| 24 | ||
| 25 | pub const guid align(8) = Guid{ | |
| 26 | .time_low = 0x31878c87, | |
| 27 | .time_mid = 0x0b75, | |
| 28 | .time_high_and_version = 0x11d5, | |
| 29 | .clock_seq_high_and_reserved = 0x9a, | |
| 30 | .clock_seq_low = 0x4f, | |
| 31 | .node = [_]u8{ 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d }, | |
| 32 | }; | |
| 33 | ||
| 34 | pub const Mode = struct { | |
| 35 | resolution_x: u64, | |
| 36 | resolution_y: u64, | |
| 37 | resolution_z: u64, | |
| 38 | left_button: bool, | |
| 39 | right_button: bool, | |
| 40 | }; | |
| 41 | ||
| 42 | pub const State = struct { | |
| 43 | relative_movement_x: i32, | |
| 44 | relative_movement_y: i32, | |
| 45 | relative_movement_z: i32, | |
| 46 | left_button: bool, | |
| 47 | right_button: bool, | |
| 48 | }; | |
| 49 | }; |
lib/std/os/uefi/protocol/simple_text_input.zig created+34| ... | ... | @@ -0,0 +1,34 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Event = uefi.Event; | |
| 4 | const Guid = uefi.Guid; | |
| 5 | const Status = uefi.Status; | |
| 6 | const cc = uefi.cc; | |
| 7 | ||
| 8 | /// Character input devices, e.g. Keyboard | |
| 9 | pub const SimpleTextInput = extern struct { | |
| 10 | _reset: *const fn (*const SimpleTextInput, bool) callconv(cc) Status, | |
| 11 | _read_key_stroke: *const fn (*const SimpleTextInput, *Key.Input) callconv(cc) Status, | |
| 12 | wait_for_key: Event, | |
| 13 | ||
| 14 | /// Resets the input device hardware. | |
| 15 | pub fn reset(self: *const SimpleTextInput, verify: bool) Status { | |
| 16 | return self._reset(self, verify); | |
| 17 | } | |
| 18 | ||
| 19 | /// Reads the next keystroke from the input device. | |
| 20 | pub fn readKeyStroke(self: *const SimpleTextInput, input_key: *Key.Input) Status { | |
| 21 | return self._read_key_stroke(self, input_key); | |
| 22 | } | |
| 23 | ||
| 24 | pub const guid align(8) = Guid{ | |
| 25 | .time_low = 0x387477c1, | |
| 26 | .time_mid = 0x69c7, | |
| 27 | .time_high_and_version = 0x11d2, | |
| 28 | .clock_seq_high_and_reserved = 0x8e, | |
| 29 | .clock_seq_low = 0x39, | |
| 30 | .node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b }, | |
| 31 | }; | |
| 32 | ||
| 33 | pub const Key = uefi.protocol.SimpleTextInputEx.Key; | |
| 34 | }; |
lib/std/os/uefi/protocol/simple_text_input_ex.zig created+89| ... | ... | @@ -0,0 +1,89 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Event = uefi.Event; | |
| 4 | const Guid = uefi.Guid; | |
| 5 | const Status = uefi.Status; | |
| 6 | const cc = uefi.cc; | |
| 7 | ||
| 8 | /// Character input devices, e.g. Keyboard | |
| 9 | pub const SimpleTextInputEx = extern struct { | |
| 10 | _reset: *const fn (*const SimpleTextInputEx, bool) callconv(cc) Status, | |
| 11 | _read_key_stroke_ex: *const fn (*const SimpleTextInputEx, *Key) callconv(cc) Status, | |
| 12 | wait_for_key_ex: Event, | |
| 13 | _set_state: *const fn (*const SimpleTextInputEx, *const u8) callconv(cc) Status, | |
| 14 | _register_key_notify: *const fn (*const SimpleTextInputEx, *const Key, *const fn (*const Key) callconv(cc) usize, **anyopaque) callconv(cc) Status, | |
| 15 | _unregister_key_notify: *const fn (*const SimpleTextInputEx, *const anyopaque) callconv(cc) Status, | |
| 16 | ||
| 17 | /// Resets the input device hardware. | |
| 18 | pub fn reset(self: *const SimpleTextInputEx, verify: bool) Status { | |
| 19 | return self._reset(self, verify); | |
| 20 | } | |
| 21 | ||
| 22 | /// Reads the next keystroke from the input device. | |
| 23 | pub fn readKeyStrokeEx(self: *const SimpleTextInputEx, key_data: *Key) Status { | |
| 24 | return self._read_key_stroke_ex(self, key_data); | |
| 25 | } | |
| 26 | ||
| 27 | /// Set certain state for the input device. | |
| 28 | pub fn setState(self: *const SimpleTextInputEx, state: *const u8) Status { | |
| 29 | return self._set_state(self, state); | |
| 30 | } | |
| 31 | ||
| 32 | /// Register a notification function for a particular keystroke for the input device. | |
| 33 | pub fn registerKeyNotify(self: *const SimpleTextInputEx, key_data: *const Key, notify: *const fn (*const Key) callconv(cc) usize, handle: **anyopaque) Status { | |
| 34 | return self._register_key_notify(self, key_data, notify, handle); | |
| 35 | } | |
| 36 | ||
| 37 | /// Remove the notification that was previously registered. | |
| 38 | pub fn unregisterKeyNotify(self: *const SimpleTextInputEx, handle: *const anyopaque) Status { | |
| 39 | return self._unregister_key_notify(self, handle); | |
| 40 | } | |
| 41 | ||
| 42 | pub const guid align(8) = Guid{ | |
| 43 | .time_low = 0xdd9e7534, | |
| 44 | .time_mid = 0x7762, | |
| 45 | .time_high_and_version = 0x4698, | |
| 46 | .clock_seq_high_and_reserved = 0x8c, | |
| 47 | .clock_seq_low = 0x14, | |
| 48 | .node = [_]u8{ 0xf5, 0x85, 0x17, 0xa6, 0x25, 0xaa }, | |
| 49 | }; | |
| 50 | ||
| 51 | pub const Key = extern struct { | |
| 52 | input: Input, | |
| 53 | state: State, | |
| 54 | ||
| 55 | pub const State = extern struct { | |
| 56 | shift: Shift, | |
| 57 | toggle: Toggle, | |
| 58 | ||
| 59 | pub const Shift = packed struct(u32) { | |
| 60 | right_shift_pressed: bool, | |
| 61 | left_shift_pressed: bool, | |
| 62 | right_control_pressed: bool, | |
| 63 | left_control_pressed: bool, | |
| 64 | right_alt_pressed: bool, | |
| 65 | left_alt_pressed: bool, | |
| 66 | right_logo_pressed: bool, | |
| 67 | left_logo_pressed: bool, | |
| 68 | menu_key_pressed: bool, | |
| 69 | sys_req_pressed: bool, | |
| 70 | _pad: u21 = 0, | |
| 71 | shift_state_valid: bool, | |
| 72 | }; | |
| 73 | ||
| 74 | pub const Toggle = packed struct(u8) { | |
| 75 | scroll_lock_active: bool, | |
| 76 | num_lock_active: bool, | |
| 77 | caps_lock_active: bool, | |
| 78 | _pad: u3 = 0, | |
| 79 | key_state_exposed: bool, | |
| 80 | toggle_state_valid: bool, | |
| 81 | }; | |
| 82 | }; | |
| 83 | ||
| 84 | pub const Input = extern struct { | |
| 85 | scan_code: u16, | |
| 86 | unicode_char: u16, | |
| 87 | }; | |
| 88 | }; | |
| 89 | }; |
lib/std/os/uefi/protocol/simple_text_output.zig created+155| ... | ... | @@ -0,0 +1,155 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Guid = uefi.Guid; | |
| 4 | const Status = uefi.Status; | |
| 5 | const cc = uefi.cc; | |
| 6 | ||
| 7 | /// Character output devices | |
| 8 | pub const SimpleTextOutput = extern struct { | |
| 9 | _reset: *const fn (*const SimpleTextOutput, bool) callconv(cc) Status, | |
| 10 | _output_string: *const fn (*const SimpleTextOutput, [*:0]const u16) callconv(cc) Status, | |
| 11 | _test_string: *const fn (*const SimpleTextOutput, [*:0]const u16) callconv(cc) Status, | |
| 12 | _query_mode: *const fn (*const SimpleTextOutput, usize, *usize, *usize) callconv(cc) Status, | |
| 13 | _set_mode: *const fn (*const SimpleTextOutput, usize) callconv(cc) Status, | |
| 14 | _set_attribute: *const fn (*const SimpleTextOutput, usize) callconv(cc) Status, | |
| 15 | _clear_screen: *const fn (*const SimpleTextOutput) callconv(cc) Status, | |
| 16 | _set_cursor_position: *const fn (*const SimpleTextOutput, usize, usize) callconv(cc) Status, | |
| 17 | _enable_cursor: *const fn (*const SimpleTextOutput, bool) callconv(cc) Status, | |
| 18 | mode: *Mode, | |
| 19 | ||
| 20 | /// Resets the text output device hardware. | |
| 21 | pub fn reset(self: *const SimpleTextOutput, verify: bool) Status { | |
| 22 | return self._reset(self, verify); | |
| 23 | } | |
| 24 | ||
| 25 | /// Writes a string to the output device. | |
| 26 | pub fn outputString(self: *const SimpleTextOutput, msg: [*:0]const u16) Status { | |
| 27 | return self._output_string(self, msg); | |
| 28 | } | |
| 29 | ||
| 30 | /// Verifies that all characters in a string can be output to the target device. | |
| 31 | pub fn testString(self: *const SimpleTextOutput, msg: [*:0]const u16) Status { | |
| 32 | return self._test_string(self, msg); | |
| 33 | } | |
| 34 | ||
| 35 | /// Returns information for an available text mode that the output device(s) supports. | |
| 36 | pub fn queryMode(self: *const SimpleTextOutput, mode_number: usize, columns: *usize, rows: *usize) Status { | |
| 37 | return self._query_mode(self, mode_number, columns, rows); | |
| 38 | } | |
| 39 | ||
| 40 | /// Sets the output device(s) to a specified mode. | |
| 41 | pub fn setMode(self: *const SimpleTextOutput, mode_number: usize) Status { | |
| 42 | return self._set_mode(self, mode_number); | |
| 43 | } | |
| 44 | ||
| 45 | /// Sets the background and foreground colors for the outputString() and clearScreen() functions. | |
| 46 | pub fn setAttribute(self: *const SimpleTextOutput, attribute: usize) Status { | |
| 47 | return self._set_attribute(self, attribute); | |
| 48 | } | |
| 49 | ||
| 50 | /// Clears the output device(s) display to the currently selected background color. | |
| 51 | pub fn clearScreen(self: *const SimpleTextOutput) Status { | |
| 52 | return self._clear_screen(self); | |
| 53 | } | |
| 54 | ||
| 55 | /// Sets the current coordinates of the cursor position. | |
| 56 | pub fn setCursorPosition(self: *const SimpleTextOutput, column: usize, row: usize) Status { | |
| 57 | return self._set_cursor_position(self, column, row); | |
| 58 | } | |
| 59 | ||
| 60 | /// Makes the cursor visible or invisible. | |
| 61 | pub fn enableCursor(self: *const SimpleTextOutput, visible: bool) Status { | |
| 62 | return self._enable_cursor(self, visible); | |
| 63 | } | |
| 64 | ||
| 65 | pub const guid align(8) = Guid{ | |
| 66 | .time_low = 0x387477c2, | |
| 67 | .time_mid = 0x69c7, | |
| 68 | .time_high_and_version = 0x11d2, | |
| 69 | .clock_seq_high_and_reserved = 0x8e, | |
| 70 | .clock_seq_low = 0x39, | |
| 71 | .node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b }, | |
| 72 | }; | |
| 73 | pub const boxdraw_horizontal: u16 = 0x2500; | |
| 74 | pub const boxdraw_vertical: u16 = 0x2502; | |
| 75 | pub const boxdraw_down_right: u16 = 0x250c; | |
| 76 | pub const boxdraw_down_left: u16 = 0x2510; | |
| 77 | pub const boxdraw_up_right: u16 = 0x2514; | |
| 78 | pub const boxdraw_up_left: u16 = 0x2518; | |
| 79 | pub const boxdraw_vertical_right: u16 = 0x251c; | |
| 80 | pub const boxdraw_vertical_left: u16 = 0x2524; | |
| 81 | pub const boxdraw_down_horizontal: u16 = 0x252c; | |
| 82 | pub const boxdraw_up_horizontal: u16 = 0x2534; | |
| 83 | pub const boxdraw_vertical_horizontal: u16 = 0x253c; | |
| 84 | pub const boxdraw_double_horizontal: u16 = 0x2550; | |
| 85 | pub const boxdraw_double_vertical: u16 = 0x2551; | |
| 86 | pub const boxdraw_down_right_double: u16 = 0x2552; | |
| 87 | pub const boxdraw_down_double_right: u16 = 0x2553; | |
| 88 | pub const boxdraw_double_down_right: u16 = 0x2554; | |
| 89 | pub const boxdraw_down_left_double: u16 = 0x2555; | |
| 90 | pub const boxdraw_down_double_left: u16 = 0x2556; | |
| 91 | pub const boxdraw_double_down_left: u16 = 0x2557; | |
| 92 | pub const boxdraw_up_right_double: u16 = 0x2558; | |
| 93 | pub const boxdraw_up_double_right: u16 = 0x2559; | |
| 94 | pub const boxdraw_double_up_right: u16 = 0x255a; | |
| 95 | pub const boxdraw_up_left_double: u16 = 0x255b; | |
| 96 | pub const boxdraw_up_double_left: u16 = 0x255c; | |
| 97 | pub const boxdraw_double_up_left: u16 = 0x255d; | |
| 98 | pub const boxdraw_vertical_right_double: u16 = 0x255e; | |
| 99 | pub const boxdraw_vertical_double_right: u16 = 0x255f; | |
| 100 | pub const boxdraw_double_vertical_right: u16 = 0x2560; | |
| 101 | pub const boxdraw_vertical_left_double: u16 = 0x2561; | |
| 102 | pub const boxdraw_vertical_double_left: u16 = 0x2562; | |
| 103 | pub const boxdraw_double_vertical_left: u16 = 0x2563; | |
| 104 | pub const boxdraw_down_horizontal_double: u16 = 0x2564; | |
| 105 | pub const boxdraw_down_double_horizontal: u16 = 0x2565; | |
| 106 | pub const boxdraw_double_down_horizontal: u16 = 0x2566; | |
| 107 | pub const boxdraw_up_horizontal_double: u16 = 0x2567; | |
| 108 | pub const boxdraw_up_double_horizontal: u16 = 0x2568; | |
| 109 | pub const boxdraw_double_up_horizontal: u16 = 0x2569; | |
| 110 | pub const boxdraw_vertical_horizontal_double: u16 = 0x256a; | |
| 111 | pub const boxdraw_vertical_double_horizontal: u16 = 0x256b; | |
| 112 | pub const boxdraw_double_vertical_horizontal: u16 = 0x256c; | |
| 113 | pub const blockelement_full_block: u16 = 0x2588; | |
| 114 | pub const blockelement_light_shade: u16 = 0x2591; | |
| 115 | pub const geometricshape_up_triangle: u16 = 0x25b2; | |
| 116 | pub const geometricshape_right_triangle: u16 = 0x25ba; | |
| 117 | pub const geometricshape_down_triangle: u16 = 0x25bc; | |
| 118 | pub const geometricshape_left_triangle: u16 = 0x25c4; | |
| 119 | pub const arrow_up: u16 = 0x2591; | |
| 120 | pub const arrow_down: u16 = 0x2593; | |
| 121 | pub const black: u8 = 0x00; | |
| 122 | pub const blue: u8 = 0x01; | |
| 123 | pub const green: u8 = 0x02; | |
| 124 | pub const cyan: u8 = 0x03; | |
| 125 | pub const red: u8 = 0x04; | |
| 126 | pub const magenta: u8 = 0x05; | |
| 127 | pub const brown: u8 = 0x06; | |
| 128 | pub const lightgray: u8 = 0x07; | |
| 129 | pub const bright: u8 = 0x08; | |
| 130 | pub const darkgray: u8 = 0x08; | |
| 131 | pub const lightblue: u8 = 0x09; | |
| 132 | pub const lightgreen: u8 = 0x0a; | |
| 133 | pub const lightcyan: u8 = 0x0b; | |
| 134 | pub const lightred: u8 = 0x0c; | |
| 135 | pub const lightmagenta: u8 = 0x0d; | |
| 136 | pub const yellow: u8 = 0x0e; | |
| 137 | pub const white: u8 = 0x0f; | |
| 138 | pub const background_black: u8 = 0x00; | |
| 139 | pub const background_blue: u8 = 0x10; | |
| 140 | pub const background_green: u8 = 0x20; | |
| 141 | pub const background_cyan: u8 = 0x30; | |
| 142 | pub const background_red: u8 = 0x40; | |
| 143 | pub const background_magenta: u8 = 0x50; | |
| 144 | pub const background_brown: u8 = 0x60; | |
| 145 | pub const background_lightgray: u8 = 0x70; | |
| 146 | ||
| 147 | pub const Mode = extern struct { | |
| 148 | max_mode: u32, // specified as signed | |
| 149 | mode: u32, // specified as signed | |
| 150 | attribute: i32, | |
| 151 | cursor_column: i32, | |
| 152 | cursor_row: i32, | |
| 153 | cursor_visible: bool, | |
| 154 | }; | |
| 155 | }; |
lib/std/os/uefi/protocol/udp6.zig created+114| ... | ... | @@ -0,0 +1,114 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Guid = uefi.Guid; | |
| 4 | const Event = uefi.Event; | |
| 5 | const Status = uefi.Status; | |
| 6 | const Time = uefi.Time; | |
| 7 | const Ip6 = uefi.protocol.Ip6; | |
| 8 | const ManagedNetworkConfigData = uefi.protocol.ManagedNetworkConfigData; | |
| 9 | const SimpleNetworkMode = uefi.protocol.SimpleNetworkMode; | |
| 10 | const cc = uefi.cc; | |
| 11 | ||
| 12 | pub const Udp6 = extern struct { | |
| 13 | _get_mode_data: *const fn (*const Udp6, ?*Config, ?*Ip6.ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(cc) Status, | |
| 14 | _configure: *const fn (*const Udp6, ?*const Config) callconv(cc) Status, | |
| 15 | _groups: *const fn (*const Udp6, bool, ?*const Ip6.Address) callconv(cc) Status, | |
| 16 | _transmit: *const fn (*const Udp6, *CompletionToken) callconv(cc) Status, | |
| 17 | _receive: *const fn (*const Udp6, *CompletionToken) callconv(cc) Status, | |
| 18 | _cancel: *const fn (*const Udp6, ?*CompletionToken) callconv(cc) Status, | |
| 19 | _poll: *const fn (*const Udp6) callconv(cc) Status, | |
| 20 | ||
| 21 | pub fn getModeData(self: *const Udp6, udp6_config_data: ?*Config, ip6_mode_data: ?*Ip6.ModeData, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) Status { | |
| 22 | return self._get_mode_data(self, udp6_config_data, ip6_mode_data, mnp_config_data, snp_mode_data); | |
| 23 | } | |
| 24 | ||
| 25 | pub fn configure(self: *const Udp6, udp6_config_data: ?*const Config) Status { | |
| 26 | return self._configure(self, udp6_config_data); | |
| 27 | } | |
| 28 | ||
| 29 | pub fn groups(self: *const Udp6, join_flag: bool, multicast_address: ?*const Ip6.Address) Status { | |
| 30 | return self._groups(self, join_flag, multicast_address); | |
| 31 | } | |
| 32 | ||
| 33 | pub fn transmit(self: *const Udp6, token: *CompletionToken) Status { | |
| 34 | return self._transmit(self, token); | |
| 35 | } | |
| 36 | ||
| 37 | pub fn receive(self: *const Udp6, token: *CompletionToken) Status { | |
| 38 | return self._receive(self, token); | |
| 39 | } | |
| 40 | ||
| 41 | pub fn cancel(self: *const Udp6, token: ?*CompletionToken) Status { | |
| 42 | return self._cancel(self, token); | |
| 43 | } | |
| 44 | ||
| 45 | pub fn poll(self: *const Udp6) Status { | |
| 46 | return self._poll(self); | |
| 47 | } | |
| 48 | ||
| 49 | pub const guid align(8) = uefi.Guid{ | |
| 50 | .time_low = 0x4f948815, | |
| 51 | .time_mid = 0xb4b9, | |
| 52 | .time_high_and_version = 0x43cb, | |
| 53 | .clock_seq_high_and_reserved = 0x8a, | |
| 54 | .clock_seq_low = 0x33, | |
| 55 | .node = [_]u8{ 0x90, 0xe0, 0x60, 0xb3, 0x49, 0x55 }, | |
| 56 | }; | |
| 57 | ||
| 58 | pub const Config = extern struct { | |
| 59 | accept_promiscuous: bool, | |
| 60 | accept_any_port: bool, | |
| 61 | allow_duplicate_port: bool, | |
| 62 | traffic_class: u8, | |
| 63 | hop_limit: u8, | |
| 64 | receive_timeout: u32, | |
| 65 | transmit_timeout: u32, | |
| 66 | station_address: Ip6.Address, | |
| 67 | station_port: u16, | |
| 68 | remote_address: Ip6.Address, | |
| 69 | remote_port: u16, | |
| 70 | }; | |
| 71 | ||
| 72 | pub const CompletionToken = extern struct { | |
| 73 | event: Event, | |
| 74 | Status: usize, | |
| 75 | packet: extern union { | |
| 76 | RxData: *ReceiveData, | |
| 77 | TxData: *TransmitData, | |
| 78 | }, | |
| 79 | }; | |
| 80 | ||
| 81 | pub const ReceiveData = extern struct { | |
| 82 | timestamp: Time, | |
| 83 | recycle_signal: Event, | |
| 84 | udp6_session: SessionData, | |
| 85 | data_length: u32, | |
| 86 | fragment_count: u32, | |
| 87 | ||
| 88 | pub fn getFragments(self: *ReceiveData) []Fragment { | |
| 89 | return @as([*]Fragment, @ptrCast(@alignCast(@as([*]u8, @ptrCast(self)) + @sizeOf(ReceiveData))))[0..self.fragment_count]; | |
| 90 | } | |
| 91 | }; | |
| 92 | ||
| 93 | pub const TransmitData = extern struct { | |
| 94 | udp6_session_data: ?*SessionData, | |
| 95 | data_length: u32, | |
| 96 | fragment_count: u32, | |
| 97 | ||
| 98 | pub fn getFragments(self: *TransmitData) []Fragment { | |
| 99 | return @as([*]Fragment, @ptrCast(@alignCast(@as([*]u8, @ptrCast(self)) + @sizeOf(TransmitData))))[0..self.fragment_count]; | |
| 100 | } | |
| 101 | }; | |
| 102 | ||
| 103 | pub const SessionData = extern struct { | |
| 104 | source_address: Ip6.Address, | |
| 105 | source_port: u16, | |
| 106 | destination_address: Ip6.Address, | |
| 107 | destination_port: u16, | |
| 108 | }; | |
| 109 | ||
| 110 | pub const Fragment = extern struct { | |
| 111 | fragment_length: u32, | |
| 112 | fragment_buffer: [*]u8, | |
| 113 | }; | |
| 114 | }; |
lib/std/os/uefi/protocol/udp6_service_binding.zig created+28| ... | ... | @@ -0,0 +1,28 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Handle = uefi.Handle; | |
| 4 | const Guid = uefi.Guid; | |
| 5 | const Status = uefi.Status; | |
| 6 | const cc = uefi.cc; | |
| 7 | ||
| 8 | pub const Udp6ServiceBinding = extern struct { | |
| 9 | _create_child: *const fn (*const Udp6ServiceBinding, *?Handle) callconv(cc) Status, | |
| 10 | _destroy_child: *const fn (*const Udp6ServiceBinding, Handle) callconv(cc) Status, | |
| 11 | ||
| 12 | pub fn createChild(self: *const Udp6ServiceBinding, handle: *?Handle) Status { | |
| 13 | return self._create_child(self, handle); | |
| 14 | } | |
| 15 | ||
| 16 | pub fn destroyChild(self: *const Udp6ServiceBinding, handle: Handle) Status { | |
| 17 | return self._destroy_child(self, handle); | |
| 18 | } | |
| 19 | ||
| 20 | pub const guid align(8) = Guid{ | |
| 21 | .time_low = 0x66ed4721, | |
| 22 | .time_mid = 0x3c98, | |
| 23 | .time_high_and_version = 0x4d3e, | |
| 24 | .clock_seq_high_and_reserved = 0x81, | |
| 25 | .clock_seq_low = 0xe3, | |
| 26 | .node = [_]u8{ 0xd0, 0x3d, 0xd3, 0x9a, 0x72, 0x54 }, | |
| 27 | }; | |
| 28 | }; |
lib/std/os/uefi/protocols.zig deleted-50| ... | ... | @@ -1,50 +0,0 @@ |
| 1 | // Misc | |
| 2 | pub usingnamespace @import("protocols/loaded_image_protocol.zig"); | |
| 3 | pub usingnamespace @import("protocols/device_path_protocol.zig"); | |
| 4 | pub usingnamespace @import("protocols/rng_protocol.zig"); | |
| 5 | pub usingnamespace @import("protocols/shell_parameters_protocol.zig"); | |
| 6 | ||
| 7 | // Files / IO | |
| 8 | pub usingnamespace @import("protocols/simple_file_system_protocol.zig"); | |
| 9 | pub usingnamespace @import("protocols/file_protocol.zig"); | |
| 10 | pub usingnamespace @import("protocols/block_io_protocol.zig"); | |
| 11 | ||
| 12 | // Text | |
| 13 | pub usingnamespace @import("protocols/simple_text_input_protocol.zig"); | |
| 14 | pub usingnamespace @import("protocols/simple_text_input_ex_protocol.zig"); | |
| 15 | pub usingnamespace @import("protocols/simple_text_output_protocol.zig"); | |
| 16 | ||
| 17 | // Pointer | |
| 18 | pub usingnamespace @import("protocols/simple_pointer_protocol.zig"); | |
| 19 | pub usingnamespace @import("protocols/absolute_pointer_protocol.zig"); | |
| 20 | ||
| 21 | pub usingnamespace @import("protocols/graphics_output_protocol.zig"); | |
| 22 | ||
| 23 | // edid | |
| 24 | pub usingnamespace @import("protocols/edid_discovered_protocol.zig"); | |
| 25 | pub usingnamespace @import("protocols/edid_active_protocol.zig"); | |
| 26 | pub usingnamespace @import("protocols/edid_override_protocol.zig"); | |
| 27 | ||
| 28 | // Network | |
| 29 | pub usingnamespace @import("protocols/simple_network_protocol.zig"); | |
| 30 | pub usingnamespace @import("protocols/managed_network_service_binding_protocol.zig"); | |
| 31 | pub usingnamespace @import("protocols/managed_network_protocol.zig"); | |
| 32 | ||
| 33 | // ip6 | |
| 34 | pub usingnamespace @import("protocols/ip6_service_binding_protocol.zig"); | |
| 35 | pub usingnamespace @import("protocols/ip6_protocol.zig"); | |
| 36 | pub usingnamespace @import("protocols/ip6_config_protocol.zig"); | |
| 37 | ||
| 38 | // udp6 | |
| 39 | pub usingnamespace @import("protocols/udp6_service_binding_protocol.zig"); | |
| 40 | pub usingnamespace @import("protocols/udp6_protocol.zig"); | |
| 41 | ||
| 42 | // hii | |
| 43 | pub const hii = @import("protocols/hii.zig"); | |
| 44 | pub usingnamespace @import("protocols/hii_database_protocol.zig"); | |
| 45 | pub usingnamespace @import("protocols/hii_popup_protocol.zig"); | |
| 46 | ||
| 47 | test { | |
| 48 | @setEvalBranchQuota(2000); | |
| 49 | @import("std").testing.refAllDeclsRecursive(@This()); | |
| 50 | } |
lib/std/os/uefi/protocols/absolute_pointer_protocol.zig deleted-62| ... | ... | @@ -1,62 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Event = uefi.Event; | |
| 4 | const Guid = uefi.Guid; | |
| 5 | const Status = uefi.Status; | |
| 6 | const cc = uefi.cc; | |
| 7 | ||
| 8 | /// Protocol for touchscreens | |
| 9 | pub const AbsolutePointerProtocol = extern struct { | |
| 10 | _reset: *const fn (*const AbsolutePointerProtocol, bool) callconv(cc) Status, | |
| 11 | _get_state: *const fn (*const AbsolutePointerProtocol, *AbsolutePointerState) callconv(cc) Status, | |
| 12 | wait_for_input: Event, | |
| 13 | mode: *AbsolutePointerMode, | |
| 14 | ||
| 15 | /// Resets the pointer device hardware. | |
| 16 | pub fn reset(self: *const AbsolutePointerProtocol, verify: bool) Status { | |
| 17 | return self._reset(self, verify); | |
| 18 | } | |
| 19 | ||
| 20 | /// Retrieves the current state of a pointer device. | |
| 21 | pub fn getState(self: *const AbsolutePointerProtocol, state: *AbsolutePointerState) Status { | |
| 22 | return self._get_state(self, state); | |
| 23 | } | |
| 24 | ||
| 25 | pub const guid align(8) = Guid{ | |
| 26 | .time_low = 0x8d59d32b, | |
| 27 | .time_mid = 0xc655, | |
| 28 | .time_high_and_version = 0x4ae9, | |
| 29 | .clock_seq_high_and_reserved = 0x9b, | |
| 30 | .clock_seq_low = 0x15, | |
| 31 | .node = [_]u8{ 0xf2, 0x59, 0x04, 0x99, 0x2a, 0x43 }, | |
| 32 | }; | |
| 33 | }; | |
| 34 | ||
| 35 | pub const AbsolutePointerModeAttributes = packed struct(u32) { | |
| 36 | supports_alt_active: bool, | |
| 37 | supports_pressure_as_z: bool, | |
| 38 | _pad: u30 = 0, | |
| 39 | }; | |
| 40 | ||
| 41 | pub const AbsolutePointerMode = extern struct { | |
| 42 | absolute_min_x: u64, | |
| 43 | absolute_min_y: u64, | |
| 44 | absolute_min_z: u64, | |
| 45 | absolute_max_x: u64, | |
| 46 | absolute_max_y: u64, | |
| 47 | absolute_max_z: u64, | |
| 48 | attributes: AbsolutePointerModeAttributes, | |
| 49 | }; | |
| 50 | ||
| 51 | pub const AbsolutePointerStateActiveButtons = packed struct(u32) { | |
| 52 | touch_active: bool, | |
| 53 | alt_active: bool, | |
| 54 | _pad: u30 = 0, | |
| 55 | }; | |
| 56 | ||
| 57 | pub const AbsolutePointerState = extern struct { | |
| 58 | current_x: u64, | |
| 59 | current_y: u64, | |
| 60 | current_z: u64, | |
| 61 | active_buttons: AbsolutePointerStateActiveButtons, | |
| 62 | }; |
lib/std/os/uefi/protocols/block_io_protocol.zig deleted-81| ... | ... | @@ -1,81 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Status = uefi.Status; | |
| 4 | const cc = uefi.cc; | |
| 5 | ||
| 6 | pub const EfiBlockMedia = extern struct { | |
| 7 | /// The current media ID. If the media changes, this value is changed. | |
| 8 | media_id: u32, | |
| 9 | ||
| 10 | /// `true` if the media is removable; otherwise, `false`. | |
| 11 | removable_media: bool, | |
| 12 | /// `true` if there is a media currently present in the device | |
| 13 | media_present: bool, | |
| 14 | /// `true` if the `BlockIoProtocol` was produced to abstract | |
| 15 | /// partition structures on the disk. `false` if the `BlockIoProtocol` was | |
| 16 | /// produced to abstract the logical blocks on a hardware device. | |
| 17 | logical_partition: bool, | |
| 18 | /// `true` if the media is marked read-only otherwise, `false`. This field | |
| 19 | /// shows the read-only status as of the most recent `WriteBlocks()` | |
| 20 | read_only: bool, | |
| 21 | /// `true` if the WriteBlocks() function caches write data. | |
| 22 | write_caching: bool, | |
| 23 | ||
| 24 | /// The intrinsic block size of the device. If the media changes, then this | |
| 25 | // field is updated. Returns the number of bytes per logical block. | |
| 26 | block_size: u32, | |
| 27 | /// Supplies the alignment requirement for any buffer used in a data | |
| 28 | /// transfer. IoAlign values of 0 and 1 mean that the buffer can be | |
| 29 | /// placed anywhere in memory. Otherwise, IoAlign must be a power of | |
| 30 | /// 2, and the requirement is that the start address of a buffer must be | |
| 31 | /// evenly divisible by IoAlign with no remainder. | |
| 32 | io_align: u32, | |
| 33 | /// The last LBA on the device. If the media changes, then this field is updated. | |
| 34 | last_block: u64, | |
| 35 | ||
| 36 | // Revision 2 | |
| 37 | lowest_aligned_lba: u64, | |
| 38 | logical_blocks_per_physical_block: u32, | |
| 39 | optimal_transfer_length_granularity: u32, | |
| 40 | }; | |
| 41 | ||
| 42 | pub const BlockIoProtocol = extern struct { | |
| 43 | const Self = @This(); | |
| 44 | ||
| 45 | revision: u64, | |
| 46 | media: *EfiBlockMedia, | |
| 47 | ||
| 48 | _reset: *const fn (*BlockIoProtocol, extended_verification: bool) callconv(cc) Status, | |
| 49 | _read_blocks: *const fn (*BlockIoProtocol, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) callconv(cc) Status, | |
| 50 | _write_blocks: *const fn (*BlockIoProtocol, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) callconv(cc) Status, | |
| 51 | _flush_blocks: *const fn (*BlockIoProtocol) callconv(cc) Status, | |
| 52 | ||
| 53 | /// Resets the block device hardware. | |
| 54 | pub fn reset(self: *Self, extended_verification: bool) Status { | |
| 55 | return self._reset(self, extended_verification); | |
| 56 | } | |
| 57 | ||
| 58 | /// Reads the number of requested blocks from the device. | |
| 59 | pub fn readBlocks(self: *Self, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) Status { | |
| 60 | return self._read_blocks(self, media_id, lba, buffer_size, buf); | |
| 61 | } | |
| 62 | ||
| 63 | /// Writes a specified number of blocks to the device. | |
| 64 | pub fn writeBlocks(self: *Self, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) Status { | |
| 65 | return self._write_blocks(self, media_id, lba, buffer_size, buf); | |
| 66 | } | |
| 67 | ||
| 68 | /// Flushes all modified data to a physical block device. | |
| 69 | pub fn flushBlocks(self: *Self) Status { | |
| 70 | return self._flush_blocks(self); | |
| 71 | } | |
| 72 | ||
| 73 | pub const guid align(8) = uefi.Guid{ | |
| 74 | .time_low = 0x964e5b21, | |
| 75 | .time_mid = 0x6459, | |
| 76 | .time_high_and_version = 0x11d2, | |
| 77 | .clock_seq_high_and_reserved = 0x8e, | |
| 78 | .clock_seq_low = 0x39, | |
| 79 | .node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b }, | |
| 80 | }; | |
| 81 | }; |
lib/std/os/uefi/protocols/device_path_protocol.zig deleted-1126| ... | ... | @@ -1,1126 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | const mem = std.mem; | |
| 3 | const uefi = std.os.uefi; | |
| 4 | const Allocator = mem.Allocator; | |
| 5 | const Guid = uefi.Guid; | |
| 6 | ||
| 7 | // All Device Path Nodes are byte-packed and may appear on any byte boundary. | |
| 8 | // All code references to device path nodes must assume all fields are unaligned. | |
| 9 | ||
| 10 | pub const DevicePathProtocol = extern struct { | |
| 11 | type: DevicePathType, | |
| 12 | subtype: u8, | |
| 13 | length: u16 align(1), | |
| 14 | ||
| 15 | pub const guid align(8) = Guid{ | |
| 16 | .time_low = 0x09576e91, | |
| 17 | .time_mid = 0x6d3f, | |
| 18 | .time_high_and_version = 0x11d2, | |
| 19 | .clock_seq_high_and_reserved = 0x8e, | |
| 20 | .clock_seq_low = 0x39, | |
| 21 | .node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b }, | |
| 22 | }; | |
| 23 | ||
| 24 | /// Returns the next DevicePathProtocol node in the sequence, if any. | |
| 25 | pub fn next(self: *DevicePathProtocol) ?*DevicePathProtocol { | |
| 26 | if (self.type == .End and @as(EndDevicePath.Subtype, @enumFromInt(self.subtype)) == .EndEntire) | |
| 27 | return null; | |
| 28 | ||
| 29 | return @as(*DevicePathProtocol, @ptrCast(@as([*]u8, @ptrCast(self)) + self.length)); | |
| 30 | } | |
| 31 | ||
| 32 | /// Calculates the total length of the device path structure in bytes, including the end of device path node. | |
| 33 | pub fn size(self: *DevicePathProtocol) usize { | |
| 34 | var node = self; | |
| 35 | ||
| 36 | while (node.next()) |next_node| { | |
| 37 | node = next_node; | |
| 38 | } | |
| 39 | ||
| 40 | return (@intFromPtr(node) + node.length) - @intFromPtr(self); | |
| 41 | } | |
| 42 | ||
| 43 | /// Creates a file device path from the existing device path and a file path. | |
| 44 | pub fn create_file_device_path(self: *DevicePathProtocol, allocator: Allocator, path: [:0]align(1) const u16) !*DevicePathProtocol { | |
| 45 | var path_size = self.size(); | |
| 46 | ||
| 47 | // 2 * (path.len + 1) for the path and its null terminator, which are u16s | |
| 48 | // DevicePathProtocol for the extra node before the end | |
| 49 | var buf = try allocator.alloc(u8, path_size + 2 * (path.len + 1) + @sizeOf(DevicePathProtocol)); | |
| 50 | ||
| 51 | @memcpy(buf[0..path_size], @as([*]const u8, @ptrCast(self))[0..path_size]); | |
| 52 | ||
| 53 | // Pointer to the copy of the end node of the current chain, which is - 4 from the buffer | |
| 54 | // as the end node itself is 4 bytes (type: u8 + subtype: u8 + length: u16). | |
| 55 | var new = @as(*MediaDevicePath.FilePathDevicePath, @ptrCast(buf.ptr + path_size - 4)); | |
| 56 | ||
| 57 | new.type = .Media; | |
| 58 | new.subtype = .FilePath; | |
| 59 | new.length = @sizeOf(MediaDevicePath.FilePathDevicePath) + 2 * (@as(u16, @intCast(path.len)) + 1); | |
| 60 | ||
| 61 | // The same as new.getPath(), but not const as we're filling it in. | |
| 62 | var ptr = @as([*:0]align(1) u16, @ptrCast(@as([*]u8, @ptrCast(new)) + @sizeOf(MediaDevicePath.FilePathDevicePath))); | |
| 63 | ||
| 64 | for (path, 0..) |s, i| | |
| 65 | ptr[i] = s; | |
| 66 | ||
| 67 | ptr[path.len] = 0; | |
| 68 | ||
| 69 | var end = @as(*EndDevicePath.EndEntireDevicePath, @ptrCast(@as(*DevicePathProtocol, @ptrCast(new)).next().?)); | |
| 70 | end.type = .End; | |
| 71 | end.subtype = .EndEntire; | |
| 72 | end.length = @sizeOf(EndDevicePath.EndEntireDevicePath); | |
| 73 | ||
| 74 | return @as(*DevicePathProtocol, @ptrCast(buf.ptr)); | |
| 75 | } | |
| 76 | ||
| 77 | pub fn getDevicePath(self: *const DevicePathProtocol) ?DevicePath { | |
| 78 | inline for (@typeInfo(DevicePath).Union.fields) |ufield| { | |
| 79 | const enum_value = std.meta.stringToEnum(DevicePathType, ufield.name); | |
| 80 | ||
| 81 | // Got the associated union type for self.type, now | |
| 82 | // we need to initialize it and its subtype | |
| 83 | if (self.type == enum_value) { | |
| 84 | var subtype = self.initSubtype(ufield.type); | |
| 85 | ||
| 86 | if (subtype) |sb| { | |
| 87 | // e.g. return .{ .Hardware = .{ .Pci = @ptrCast(...) } } | |
| 88 | return @unionInit(DevicePath, ufield.name, sb); | |
| 89 | } | |
| 90 | } | |
| 91 | } | |
| 92 | ||
| 93 | return null; | |
| 94 | } | |
| 95 | ||
| 96 | pub fn initSubtype(self: *const DevicePathProtocol, comptime TUnion: type) ?TUnion { | |
| 97 | const type_info = @typeInfo(TUnion).Union; | |
| 98 | const TTag = type_info.tag_type.?; | |
| 99 | ||
| 100 | inline for (type_info.fields) |subtype| { | |
| 101 | // The tag names match the union names, so just grab that off the enum | |
| 102 | const tag_val: u8 = @intFromEnum(@field(TTag, subtype.name)); | |
| 103 | ||
| 104 | if (self.subtype == tag_val) { | |
| 105 | // e.g. expr = .{ .Pci = @ptrCast(...) } | |
| 106 | return @unionInit(TUnion, subtype.name, @as(subtype.type, @ptrCast(self))); | |
| 107 | } | |
| 108 | } | |
| 109 | ||
| 110 | return null; | |
| 111 | } | |
| 112 | }; | |
| 113 | ||
| 114 | comptime { | |
| 115 | std.debug.assert(4 == @sizeOf(DevicePathProtocol)); | |
| 116 | std.debug.assert(1 == @alignOf(DevicePathProtocol)); | |
| 117 | ||
| 118 | std.debug.assert(0 == @offsetOf(DevicePathProtocol, "type")); | |
| 119 | std.debug.assert(1 == @offsetOf(DevicePathProtocol, "subtype")); | |
| 120 | std.debug.assert(2 == @offsetOf(DevicePathProtocol, "length")); | |
| 121 | } | |
| 122 | ||
| 123 | pub const DevicePath = union(DevicePathType) { | |
| 124 | Hardware: HardwareDevicePath, | |
| 125 | Acpi: AcpiDevicePath, | |
| 126 | Messaging: MessagingDevicePath, | |
| 127 | Media: MediaDevicePath, | |
| 128 | BiosBootSpecification: BiosBootSpecificationDevicePath, | |
| 129 | End: EndDevicePath, | |
| 130 | }; | |
| 131 | ||
| 132 | pub const DevicePathType = enum(u8) { | |
| 133 | Hardware = 0x01, | |
| 134 | Acpi = 0x02, | |
| 135 | Messaging = 0x03, | |
| 136 | Media = 0x04, | |
| 137 | BiosBootSpecification = 0x05, | |
| 138 | End = 0x7f, | |
| 139 | _, | |
| 140 | }; | |
| 141 | ||
| 142 | pub const HardwareDevicePath = union(Subtype) { | |
| 143 | Pci: *const PciDevicePath, | |
| 144 | PcCard: *const PcCardDevicePath, | |
| 145 | MemoryMapped: *const MemoryMappedDevicePath, | |
| 146 | Vendor: *const VendorDevicePath, | |
| 147 | Controller: *const ControllerDevicePath, | |
| 148 | Bmc: *const BmcDevicePath, | |
| 149 | ||
| 150 | pub const Subtype = enum(u8) { | |
| 151 | Pci = 1, | |
| 152 | PcCard = 2, | |
| 153 | MemoryMapped = 3, | |
| 154 | Vendor = 4, | |
| 155 | Controller = 5, | |
| 156 | Bmc = 6, | |
| 157 | _, | |
| 158 | }; | |
| 159 | ||
| 160 | pub const PciDevicePath = extern struct { | |
| 161 | type: DevicePathType, | |
| 162 | subtype: Subtype, | |
| 163 | length: u16 align(1), | |
| 164 | function: u8, | |
| 165 | device: u8, | |
| 166 | }; | |
| 167 | ||
| 168 | comptime { | |
| 169 | std.debug.assert(6 == @sizeOf(PciDevicePath)); | |
| 170 | std.debug.assert(1 == @alignOf(PciDevicePath)); | |
| 171 | ||
| 172 | std.debug.assert(0 == @offsetOf(PciDevicePath, "type")); | |
| 173 | std.debug.assert(1 == @offsetOf(PciDevicePath, "subtype")); | |
| 174 | std.debug.assert(2 == @offsetOf(PciDevicePath, "length")); | |
| 175 | std.debug.assert(4 == @offsetOf(PciDevicePath, "function")); | |
| 176 | std.debug.assert(5 == @offsetOf(PciDevicePath, "device")); | |
| 177 | } | |
| 178 | ||
| 179 | pub const PcCardDevicePath = extern struct { | |
| 180 | type: DevicePathType, | |
| 181 | subtype: Subtype, | |
| 182 | length: u16 align(1), | |
| 183 | function_number: u8, | |
| 184 | }; | |
| 185 | ||
| 186 | comptime { | |
| 187 | std.debug.assert(5 == @sizeOf(PcCardDevicePath)); | |
| 188 | std.debug.assert(1 == @alignOf(PcCardDevicePath)); | |
| 189 | ||
| 190 | std.debug.assert(0 == @offsetOf(PcCardDevicePath, "type")); | |
| 191 | std.debug.assert(1 == @offsetOf(PcCardDevicePath, "subtype")); | |
| 192 | std.debug.assert(2 == @offsetOf(PcCardDevicePath, "length")); | |
| 193 | std.debug.assert(4 == @offsetOf(PcCardDevicePath, "function_number")); | |
| 194 | } | |
| 195 | ||
| 196 | pub const MemoryMappedDevicePath = extern struct { | |
| 197 | type: DevicePathType, | |
| 198 | subtype: Subtype, | |
| 199 | length: u16 align(1), | |
| 200 | memory_type: u32 align(1), | |
| 201 | start_address: u64 align(1), | |
| 202 | end_address: u64 align(1), | |
| 203 | }; | |
| 204 | ||
| 205 | comptime { | |
| 206 | std.debug.assert(24 == @sizeOf(MemoryMappedDevicePath)); | |
| 207 | std.debug.assert(1 == @alignOf(MemoryMappedDevicePath)); | |
| 208 | ||
| 209 | std.debug.assert(0 == @offsetOf(MemoryMappedDevicePath, "type")); | |
| 210 | std.debug.assert(1 == @offsetOf(MemoryMappedDevicePath, "subtype")); | |
| 211 | std.debug.assert(2 == @offsetOf(MemoryMappedDevicePath, "length")); | |
| 212 | std.debug.assert(4 == @offsetOf(MemoryMappedDevicePath, "memory_type")); | |
| 213 | std.debug.assert(8 == @offsetOf(MemoryMappedDevicePath, "start_address")); | |
| 214 | std.debug.assert(16 == @offsetOf(MemoryMappedDevicePath, "end_address")); | |
| 215 | } | |
| 216 | ||
| 217 | pub const VendorDevicePath = extern struct { | |
| 218 | type: DevicePathType, | |
| 219 | subtype: Subtype, | |
| 220 | length: u16 align(1), | |
| 221 | vendor_guid: Guid align(1), | |
| 222 | }; | |
| 223 | ||
| 224 | comptime { | |
| 225 | std.debug.assert(20 == @sizeOf(VendorDevicePath)); | |
| 226 | std.debug.assert(1 == @alignOf(VendorDevicePath)); | |
| 227 | ||
| 228 | std.debug.assert(0 == @offsetOf(VendorDevicePath, "type")); | |
| 229 | std.debug.assert(1 == @offsetOf(VendorDevicePath, "subtype")); | |
| 230 | std.debug.assert(2 == @offsetOf(VendorDevicePath, "length")); | |
| 231 | std.debug.assert(4 == @offsetOf(VendorDevicePath, "vendor_guid")); | |
| 232 | } | |
| 233 | ||
| 234 | pub const ControllerDevicePath = extern struct { | |
| 235 | type: DevicePathType, | |
| 236 | subtype: Subtype, | |
| 237 | length: u16 align(1), | |
| 238 | controller_number: u32 align(1), | |
| 239 | }; | |
| 240 | ||
| 241 | comptime { | |
| 242 | std.debug.assert(8 == @sizeOf(ControllerDevicePath)); | |
| 243 | std.debug.assert(1 == @alignOf(ControllerDevicePath)); | |
| 244 | ||
| 245 | std.debug.assert(0 == @offsetOf(ControllerDevicePath, "type")); | |
| 246 | std.debug.assert(1 == @offsetOf(ControllerDevicePath, "subtype")); | |
| 247 | std.debug.assert(2 == @offsetOf(ControllerDevicePath, "length")); | |
| 248 | std.debug.assert(4 == @offsetOf(ControllerDevicePath, "controller_number")); | |
| 249 | } | |
| 250 | ||
| 251 | pub const BmcDevicePath = extern struct { | |
| 252 | type: DevicePathType, | |
| 253 | subtype: Subtype, | |
| 254 | length: u16 align(1), | |
| 255 | interface_type: u8, | |
| 256 | base_address: u64 align(1), | |
| 257 | }; | |
| 258 | ||
| 259 | comptime { | |
| 260 | std.debug.assert(13 == @sizeOf(BmcDevicePath)); | |
| 261 | std.debug.assert(1 == @alignOf(BmcDevicePath)); | |
| 262 | ||
| 263 | std.debug.assert(0 == @offsetOf(BmcDevicePath, "type")); | |
| 264 | std.debug.assert(1 == @offsetOf(BmcDevicePath, "subtype")); | |
| 265 | std.debug.assert(2 == @offsetOf(BmcDevicePath, "length")); | |
| 266 | std.debug.assert(4 == @offsetOf(BmcDevicePath, "interface_type")); | |
| 267 | std.debug.assert(5 == @offsetOf(BmcDevicePath, "base_address")); | |
| 268 | } | |
| 269 | }; | |
| 270 | ||
| 271 | pub const AcpiDevicePath = union(Subtype) { | |
| 272 | Acpi: *const BaseAcpiDevicePath, | |
| 273 | ExpandedAcpi: *const ExpandedAcpiDevicePath, | |
| 274 | Adr: *const AdrDevicePath, | |
| 275 | ||
| 276 | pub const Subtype = enum(u8) { | |
| 277 | Acpi = 1, | |
| 278 | ExpandedAcpi = 2, | |
| 279 | Adr = 3, | |
| 280 | _, | |
| 281 | }; | |
| 282 | ||
| 283 | pub const BaseAcpiDevicePath = extern struct { | |
| 284 | type: DevicePathType, | |
| 285 | subtype: Subtype, | |
| 286 | length: u16 align(1), | |
| 287 | hid: u32 align(1), | |
| 288 | uid: u32 align(1), | |
| 289 | }; | |
| 290 | ||
| 291 | comptime { | |
| 292 | std.debug.assert(12 == @sizeOf(BaseAcpiDevicePath)); | |
| 293 | std.debug.assert(1 == @alignOf(BaseAcpiDevicePath)); | |
| 294 | ||
| 295 | std.debug.assert(0 == @offsetOf(BaseAcpiDevicePath, "type")); | |
| 296 | std.debug.assert(1 == @offsetOf(BaseAcpiDevicePath, "subtype")); | |
| 297 | std.debug.assert(2 == @offsetOf(BaseAcpiDevicePath, "length")); | |
| 298 | std.debug.assert(4 == @offsetOf(BaseAcpiDevicePath, "hid")); | |
| 299 | std.debug.assert(8 == @offsetOf(BaseAcpiDevicePath, "uid")); | |
| 300 | } | |
| 301 | ||
| 302 | pub const ExpandedAcpiDevicePath = extern struct { | |
| 303 | type: DevicePathType, | |
| 304 | subtype: Subtype, | |
| 305 | length: u16 align(1), | |
| 306 | hid: u32 align(1), | |
| 307 | uid: u32 align(1), | |
| 308 | cid: u32 align(1), | |
| 309 | // variable length u16[*:0] strings | |
| 310 | // hid_str, uid_str, cid_str | |
| 311 | }; | |
| 312 | ||
| 313 | comptime { | |
| 314 | std.debug.assert(16 == @sizeOf(ExpandedAcpiDevicePath)); | |
| 315 | std.debug.assert(1 == @alignOf(ExpandedAcpiDevicePath)); | |
| 316 | ||
| 317 | std.debug.assert(0 == @offsetOf(ExpandedAcpiDevicePath, "type")); | |
| 318 | std.debug.assert(1 == @offsetOf(ExpandedAcpiDevicePath, "subtype")); | |
| 319 | std.debug.assert(2 == @offsetOf(ExpandedAcpiDevicePath, "length")); | |
| 320 | std.debug.assert(4 == @offsetOf(ExpandedAcpiDevicePath, "hid")); | |
| 321 | std.debug.assert(8 == @offsetOf(ExpandedAcpiDevicePath, "uid")); | |
| 322 | std.debug.assert(12 == @offsetOf(ExpandedAcpiDevicePath, "cid")); | |
| 323 | } | |
| 324 | ||
| 325 | pub const AdrDevicePath = extern struct { | |
| 326 | type: DevicePathType, | |
| 327 | subtype: Subtype, | |
| 328 | length: u16 align(1), | |
| 329 | adr: u32 align(1), | |
| 330 | ||
| 331 | // multiple adr entries can optionally follow | |
| 332 | pub fn adrs(self: *const AdrDevicePath) []align(1) const u32 { | |
| 333 | // self.length is a minimum of 8 with one adr which is size 4. | |
| 334 | var entries = (self.length - 4) / @sizeOf(u32); | |
| 335 | return @as([*]align(1) const u32, @ptrCast(&self.adr))[0..entries]; | |
| 336 | } | |
| 337 | }; | |
| 338 | ||
| 339 | comptime { | |
| 340 | std.debug.assert(8 == @sizeOf(AdrDevicePath)); | |
| 341 | std.debug.assert(1 == @alignOf(AdrDevicePath)); | |
| 342 | ||
| 343 | std.debug.assert(0 == @offsetOf(AdrDevicePath, "type")); | |
| 344 | std.debug.assert(1 == @offsetOf(AdrDevicePath, "subtype")); | |
| 345 | std.debug.assert(2 == @offsetOf(AdrDevicePath, "length")); | |
| 346 | std.debug.assert(4 == @offsetOf(AdrDevicePath, "adr")); | |
| 347 | } | |
| 348 | }; | |
| 349 | ||
| 350 | pub const MessagingDevicePath = union(Subtype) { | |
| 351 | Atapi: *const AtapiDevicePath, | |
| 352 | Scsi: *const ScsiDevicePath, | |
| 353 | FibreChannel: *const FibreChannelDevicePath, | |
| 354 | FibreChannelEx: *const FibreChannelExDevicePath, | |
| 355 | @"1394": *const F1394DevicePath, | |
| 356 | Usb: *const UsbDevicePath, | |
| 357 | Sata: *const SataDevicePath, | |
| 358 | UsbWwid: *const UsbWwidDevicePath, | |
| 359 | Lun: *const DeviceLogicalUnitDevicePath, | |
| 360 | UsbClass: *const UsbClassDevicePath, | |
| 361 | I2o: *const I2oDevicePath, | |
| 362 | MacAddress: *const MacAddressDevicePath, | |
| 363 | Ipv4: *const Ipv4DevicePath, | |
| 364 | Ipv6: *const Ipv6DevicePath, | |
| 365 | Vlan: *const VlanDevicePath, | |
| 366 | InfiniBand: *const InfiniBandDevicePath, | |
| 367 | Uart: *const UartDevicePath, | |
| 368 | Vendor: *const VendorDefinedDevicePath, | |
| 369 | ||
| 370 | pub const Subtype = enum(u8) { | |
| 371 | Atapi = 1, | |
| 372 | Scsi = 2, | |
| 373 | FibreChannel = 3, | |
| 374 | FibreChannelEx = 21, | |
| 375 | @"1394" = 4, | |
| 376 | Usb = 5, | |
| 377 | Sata = 18, | |
| 378 | UsbWwid = 16, | |
| 379 | Lun = 17, | |
| 380 | UsbClass = 15, | |
| 381 | I2o = 6, | |
| 382 | MacAddress = 11, | |
| 383 | Ipv4 = 12, | |
| 384 | Ipv6 = 13, | |
| 385 | Vlan = 20, | |
| 386 | InfiniBand = 9, | |
| 387 | Uart = 14, | |
| 388 | Vendor = 10, | |
| 389 | _, | |
| 390 | }; | |
| 391 | ||
| 392 | pub const AtapiDevicePath = extern struct { | |
| 393 | const Role = enum(u8) { | |
| 394 | Master = 0, | |
| 395 | Slave = 1, | |
| 396 | }; | |
| 397 | ||
| 398 | const Rank = enum(u8) { | |
| 399 | Primary = 0, | |
| 400 | Secondary = 1, | |
| 401 | }; | |
| 402 | ||
| 403 | type: DevicePathType, | |
| 404 | subtype: Subtype, | |
| 405 | length: u16 align(1), | |
| 406 | primary_secondary: Rank, | |
| 407 | slave_master: Role, | |
| 408 | logical_unit_number: u16 align(1), | |
| 409 | }; | |
| 410 | ||
| 411 | comptime { | |
| 412 | std.debug.assert(8 == @sizeOf(AtapiDevicePath)); | |
| 413 | std.debug.assert(1 == @alignOf(AtapiDevicePath)); | |
| 414 | ||
| 415 | std.debug.assert(0 == @offsetOf(AtapiDevicePath, "type")); | |
| 416 | std.debug.assert(1 == @offsetOf(AtapiDevicePath, "subtype")); | |
| 417 | std.debug.assert(2 == @offsetOf(AtapiDevicePath, "length")); | |
| 418 | std.debug.assert(4 == @offsetOf(AtapiDevicePath, "primary_secondary")); | |
| 419 | std.debug.assert(5 == @offsetOf(AtapiDevicePath, "slave_master")); | |
| 420 | std.debug.assert(6 == @offsetOf(AtapiDevicePath, "logical_unit_number")); | |
| 421 | } | |
| 422 | ||
| 423 | pub const ScsiDevicePath = extern struct { | |
| 424 | type: DevicePathType, | |
| 425 | subtype: Subtype, | |
| 426 | length: u16 align(1), | |
| 427 | target_id: u16 align(1), | |
| 428 | logical_unit_number: u16 align(1), | |
| 429 | }; | |
| 430 | ||
| 431 | comptime { | |
| 432 | std.debug.assert(8 == @sizeOf(ScsiDevicePath)); | |
| 433 | std.debug.assert(1 == @alignOf(ScsiDevicePath)); | |
| 434 | ||
| 435 | std.debug.assert(0 == @offsetOf(ScsiDevicePath, "type")); | |
| 436 | std.debug.assert(1 == @offsetOf(ScsiDevicePath, "subtype")); | |
| 437 | std.debug.assert(2 == @offsetOf(ScsiDevicePath, "length")); | |
| 438 | std.debug.assert(4 == @offsetOf(ScsiDevicePath, "target_id")); | |
| 439 | std.debug.assert(6 == @offsetOf(ScsiDevicePath, "logical_unit_number")); | |
| 440 | } | |
| 441 | ||
| 442 | pub const FibreChannelDevicePath = extern struct { | |
| 443 | type: DevicePathType, | |
| 444 | subtype: Subtype, | |
| 445 | length: u16 align(1), | |
| 446 | reserved: u32 align(1), | |
| 447 | world_wide_name: u64 align(1), | |
| 448 | logical_unit_number: u64 align(1), | |
| 449 | }; | |
| 450 | ||
| 451 | comptime { | |
| 452 | std.debug.assert(24 == @sizeOf(FibreChannelDevicePath)); | |
| 453 | std.debug.assert(1 == @alignOf(FibreChannelDevicePath)); | |
| 454 | ||
| 455 | std.debug.assert(0 == @offsetOf(FibreChannelDevicePath, "type")); | |
| 456 | std.debug.assert(1 == @offsetOf(FibreChannelDevicePath, "subtype")); | |
| 457 | std.debug.assert(2 == @offsetOf(FibreChannelDevicePath, "length")); | |
| 458 | std.debug.assert(4 == @offsetOf(FibreChannelDevicePath, "reserved")); | |
| 459 | std.debug.assert(8 == @offsetOf(FibreChannelDevicePath, "world_wide_name")); | |
| 460 | std.debug.assert(16 == @offsetOf(FibreChannelDevicePath, "logical_unit_number")); | |
| 461 | } | |
| 462 | ||
| 463 | pub const FibreChannelExDevicePath = extern struct { | |
| 464 | type: DevicePathType, | |
| 465 | subtype: Subtype, | |
| 466 | length: u16 align(1), | |
| 467 | reserved: u32 align(1), | |
| 468 | world_wide_name: u64 align(1), | |
| 469 | logical_unit_number: u64 align(1), | |
| 470 | }; | |
| 471 | ||
| 472 | comptime { | |
| 473 | std.debug.assert(24 == @sizeOf(FibreChannelExDevicePath)); | |
| 474 | std.debug.assert(1 == @alignOf(FibreChannelExDevicePath)); | |
| 475 | ||
| 476 | std.debug.assert(0 == @offsetOf(FibreChannelExDevicePath, "type")); | |
| 477 | std.debug.assert(1 == @offsetOf(FibreChannelExDevicePath, "subtype")); | |
| 478 | std.debug.assert(2 == @offsetOf(FibreChannelExDevicePath, "length")); | |
| 479 | std.debug.assert(4 == @offsetOf(FibreChannelExDevicePath, "reserved")); | |
| 480 | std.debug.assert(8 == @offsetOf(FibreChannelExDevicePath, "world_wide_name")); | |
| 481 | std.debug.assert(16 == @offsetOf(FibreChannelExDevicePath, "logical_unit_number")); | |
| 482 | } | |
| 483 | ||
| 484 | pub const F1394DevicePath = extern struct { | |
| 485 | type: DevicePathType, | |
| 486 | subtype: Subtype, | |
| 487 | length: u16 align(1), | |
| 488 | reserved: u32 align(1), | |
| 489 | guid: u64 align(1), | |
| 490 | }; | |
| 491 | ||
| 492 | comptime { | |
| 493 | std.debug.assert(16 == @sizeOf(F1394DevicePath)); | |
| 494 | std.debug.assert(1 == @alignOf(F1394DevicePath)); | |
| 495 | ||
| 496 | std.debug.assert(0 == @offsetOf(F1394DevicePath, "type")); | |
| 497 | std.debug.assert(1 == @offsetOf(F1394DevicePath, "subtype")); | |
| 498 | std.debug.assert(2 == @offsetOf(F1394DevicePath, "length")); | |
| 499 | std.debug.assert(4 == @offsetOf(F1394DevicePath, "reserved")); | |
| 500 | std.debug.assert(8 == @offsetOf(F1394DevicePath, "guid")); | |
| 501 | } | |
| 502 | ||
| 503 | pub const UsbDevicePath = extern struct { | |
| 504 | type: DevicePathType, | |
| 505 | subtype: Subtype, | |
| 506 | length: u16 align(1), | |
| 507 | parent_port_number: u8, | |
| 508 | interface_number: u8, | |
| 509 | }; | |
| 510 | ||
| 511 | comptime { | |
| 512 | std.debug.assert(6 == @sizeOf(UsbDevicePath)); | |
| 513 | std.debug.assert(1 == @alignOf(UsbDevicePath)); | |
| 514 | ||
| 515 | std.debug.assert(0 == @offsetOf(UsbDevicePath, "type")); | |
| 516 | std.debug.assert(1 == @offsetOf(UsbDevicePath, "subtype")); | |
| 517 | std.debug.assert(2 == @offsetOf(UsbDevicePath, "length")); | |
| 518 | std.debug.assert(4 == @offsetOf(UsbDevicePath, "parent_port_number")); | |
| 519 | std.debug.assert(5 == @offsetOf(UsbDevicePath, "interface_number")); | |
| 520 | } | |
| 521 | ||
| 522 | pub const SataDevicePath = extern struct { | |
| 523 | type: DevicePathType, | |
| 524 | subtype: Subtype, | |
| 525 | length: u16 align(1), | |
| 526 | hba_port_number: u16 align(1), | |
| 527 | port_multiplier_port_number: u16 align(1), | |
| 528 | logical_unit_number: u16 align(1), | |
| 529 | }; | |
| 530 | ||
| 531 | comptime { | |
| 532 | std.debug.assert(10 == @sizeOf(SataDevicePath)); | |
| 533 | std.debug.assert(1 == @alignOf(SataDevicePath)); | |
| 534 | ||
| 535 | std.debug.assert(0 == @offsetOf(SataDevicePath, "type")); | |
| 536 | std.debug.assert(1 == @offsetOf(SataDevicePath, "subtype")); | |
| 537 | std.debug.assert(2 == @offsetOf(SataDevicePath, "length")); | |
| 538 | std.debug.assert(4 == @offsetOf(SataDevicePath, "hba_port_number")); | |
| 539 | std.debug.assert(6 == @offsetOf(SataDevicePath, "port_multiplier_port_number")); | |
| 540 | std.debug.assert(8 == @offsetOf(SataDevicePath, "logical_unit_number")); | |
| 541 | } | |
| 542 | ||
| 543 | pub const UsbWwidDevicePath = extern struct { | |
| 544 | type: DevicePathType, | |
| 545 | subtype: Subtype, | |
| 546 | length: u16 align(1), | |
| 547 | interface_number: u16 align(1), | |
| 548 | device_vendor_id: u16 align(1), | |
| 549 | device_product_id: u16 align(1), | |
| 550 | ||
| 551 | pub fn serial_number(self: *const UsbWwidDevicePath) []align(1) const u16 { | |
| 552 | var serial_len = (self.length - @sizeOf(UsbWwidDevicePath)) / @sizeOf(u16); | |
| 553 | return @as([*]align(1) const u16, @ptrCast(@as([*]const u8, @ptrCast(self)) + @sizeOf(UsbWwidDevicePath)))[0..serial_len]; | |
| 554 | } | |
| 555 | }; | |
| 556 | ||
| 557 | comptime { | |
| 558 | std.debug.assert(10 == @sizeOf(UsbWwidDevicePath)); | |
| 559 | std.debug.assert(1 == @alignOf(UsbWwidDevicePath)); | |
| 560 | ||
| 561 | std.debug.assert(0 == @offsetOf(UsbWwidDevicePath, "type")); | |
| 562 | std.debug.assert(1 == @offsetOf(UsbWwidDevicePath, "subtype")); | |
| 563 | std.debug.assert(2 == @offsetOf(UsbWwidDevicePath, "length")); | |
| 564 | std.debug.assert(4 == @offsetOf(UsbWwidDevicePath, "interface_number")); | |
| 565 | std.debug.assert(6 == @offsetOf(UsbWwidDevicePath, "device_vendor_id")); | |
| 566 | std.debug.assert(8 == @offsetOf(UsbWwidDevicePath, "device_product_id")); | |
| 567 | } | |
| 568 | ||
| 569 | pub const DeviceLogicalUnitDevicePath = extern struct { | |
| 570 | type: DevicePathType, | |
| 571 | subtype: Subtype, | |
| 572 | length: u16 align(1), | |
| 573 | lun: u8, | |
| 574 | }; | |
| 575 | ||
| 576 | comptime { | |
| 577 | std.debug.assert(5 == @sizeOf(DeviceLogicalUnitDevicePath)); | |
| 578 | std.debug.assert(1 == @alignOf(DeviceLogicalUnitDevicePath)); | |
| 579 | ||
| 580 | std.debug.assert(0 == @offsetOf(DeviceLogicalUnitDevicePath, "type")); | |
| 581 | std.debug.assert(1 == @offsetOf(DeviceLogicalUnitDevicePath, "subtype")); | |
| 582 | std.debug.assert(2 == @offsetOf(DeviceLogicalUnitDevicePath, "length")); | |
| 583 | std.debug.assert(4 == @offsetOf(DeviceLogicalUnitDevicePath, "lun")); | |
| 584 | } | |
| 585 | ||
| 586 | pub const UsbClassDevicePath = extern struct { | |
| 587 | type: DevicePathType, | |
| 588 | subtype: Subtype, | |
| 589 | length: u16 align(1), | |
| 590 | vendor_id: u16 align(1), | |
| 591 | product_id: u16 align(1), | |
| 592 | device_class: u8, | |
| 593 | device_subclass: u8, | |
| 594 | device_protocol: u8, | |
| 595 | }; | |
| 596 | ||
| 597 | comptime { | |
| 598 | std.debug.assert(11 == @sizeOf(UsbClassDevicePath)); | |
| 599 | std.debug.assert(1 == @alignOf(UsbClassDevicePath)); | |
| 600 | ||
| 601 | std.debug.assert(0 == @offsetOf(UsbClassDevicePath, "type")); | |
| 602 | std.debug.assert(1 == @offsetOf(UsbClassDevicePath, "subtype")); | |
| 603 | std.debug.assert(2 == @offsetOf(UsbClassDevicePath, "length")); | |
| 604 | std.debug.assert(4 == @offsetOf(UsbClassDevicePath, "vendor_id")); | |
| 605 | std.debug.assert(6 == @offsetOf(UsbClassDevicePath, "product_id")); | |
| 606 | std.debug.assert(8 == @offsetOf(UsbClassDevicePath, "device_class")); | |
| 607 | std.debug.assert(9 == @offsetOf(UsbClassDevicePath, "device_subclass")); | |
| 608 | std.debug.assert(10 == @offsetOf(UsbClassDevicePath, "device_protocol")); | |
| 609 | } | |
| 610 | ||
| 611 | pub const I2oDevicePath = extern struct { | |
| 612 | type: DevicePathType, | |
| 613 | subtype: Subtype, | |
| 614 | length: u16 align(1), | |
| 615 | tid: u32 align(1), | |
| 616 | }; | |
| 617 | ||
| 618 | comptime { | |
| 619 | std.debug.assert(8 == @sizeOf(I2oDevicePath)); | |
| 620 | std.debug.assert(1 == @alignOf(I2oDevicePath)); | |
| 621 | ||
| 622 | std.debug.assert(0 == @offsetOf(I2oDevicePath, "type")); | |
| 623 | std.debug.assert(1 == @offsetOf(I2oDevicePath, "subtype")); | |
| 624 | std.debug.assert(2 == @offsetOf(I2oDevicePath, "length")); | |
| 625 | std.debug.assert(4 == @offsetOf(I2oDevicePath, "tid")); | |
| 626 | } | |
| 627 | ||
| 628 | pub const MacAddressDevicePath = extern struct { | |
| 629 | type: DevicePathType, | |
| 630 | subtype: Subtype, | |
| 631 | length: u16 align(1), | |
| 632 | mac_address: uefi.MacAddress, | |
| 633 | if_type: u8, | |
| 634 | }; | |
| 635 | ||
| 636 | comptime { | |
| 637 | std.debug.assert(37 == @sizeOf(MacAddressDevicePath)); | |
| 638 | std.debug.assert(1 == @alignOf(MacAddressDevicePath)); | |
| 639 | ||
| 640 | std.debug.assert(0 == @offsetOf(MacAddressDevicePath, "type")); | |
| 641 | std.debug.assert(1 == @offsetOf(MacAddressDevicePath, "subtype")); | |
| 642 | std.debug.assert(2 == @offsetOf(MacAddressDevicePath, "length")); | |
| 643 | std.debug.assert(4 == @offsetOf(MacAddressDevicePath, "mac_address")); | |
| 644 | std.debug.assert(36 == @offsetOf(MacAddressDevicePath, "if_type")); | |
| 645 | } | |
| 646 | ||
| 647 | pub const Ipv4DevicePath = extern struct { | |
| 648 | pub const IpType = enum(u8) { | |
| 649 | Dhcp = 0, | |
| 650 | Static = 1, | |
| 651 | }; | |
| 652 | ||
| 653 | type: DevicePathType, | |
| 654 | subtype: Subtype, | |
| 655 | length: u16 align(1), | |
| 656 | local_ip_address: uefi.Ipv4Address align(1), | |
| 657 | remote_ip_address: uefi.Ipv4Address align(1), | |
| 658 | local_port: u16 align(1), | |
| 659 | remote_port: u16 align(1), | |
| 660 | network_protocol: u16 align(1), | |
| 661 | static_ip_address: IpType, | |
| 662 | gateway_ip_address: u32 align(1), | |
| 663 | subnet_mask: u32 align(1), | |
| 664 | }; | |
| 665 | ||
| 666 | comptime { | |
| 667 | std.debug.assert(27 == @sizeOf(Ipv4DevicePath)); | |
| 668 | std.debug.assert(1 == @alignOf(Ipv4DevicePath)); | |
| 669 | ||
| 670 | std.debug.assert(0 == @offsetOf(Ipv4DevicePath, "type")); | |
| 671 | std.debug.assert(1 == @offsetOf(Ipv4DevicePath, "subtype")); | |
| 672 | std.debug.assert(2 == @offsetOf(Ipv4DevicePath, "length")); | |
| 673 | std.debug.assert(4 == @offsetOf(Ipv4DevicePath, "local_ip_address")); | |
| 674 | std.debug.assert(8 == @offsetOf(Ipv4DevicePath, "remote_ip_address")); | |
| 675 | std.debug.assert(12 == @offsetOf(Ipv4DevicePath, "local_port")); | |
| 676 | std.debug.assert(14 == @offsetOf(Ipv4DevicePath, "remote_port")); | |
| 677 | std.debug.assert(16 == @offsetOf(Ipv4DevicePath, "network_protocol")); | |
| 678 | std.debug.assert(18 == @offsetOf(Ipv4DevicePath, "static_ip_address")); | |
| 679 | std.debug.assert(19 == @offsetOf(Ipv4DevicePath, "gateway_ip_address")); | |
| 680 | std.debug.assert(23 == @offsetOf(Ipv4DevicePath, "subnet_mask")); | |
| 681 | } | |
| 682 | ||
| 683 | pub const Ipv6DevicePath = extern struct { | |
| 684 | pub const Origin = enum(u8) { | |
| 685 | Manual = 0, | |
| 686 | AssignedStateless = 1, | |
| 687 | AssignedStateful = 2, | |
| 688 | }; | |
| 689 | ||
| 690 | type: DevicePathType, | |
| 691 | subtype: Subtype, | |
| 692 | length: u16 align(1), | |
| 693 | local_ip_address: uefi.Ipv6Address, | |
| 694 | remote_ip_address: uefi.Ipv6Address, | |
| 695 | local_port: u16 align(1), | |
| 696 | remote_port: u16 align(1), | |
| 697 | protocol: u16 align(1), | |
| 698 | ip_address_origin: Origin, | |
| 699 | prefix_length: u8, | |
| 700 | gateway_ip_address: uefi.Ipv6Address, | |
| 701 | }; | |
| 702 | ||
| 703 | comptime { | |
| 704 | std.debug.assert(60 == @sizeOf(Ipv6DevicePath)); | |
| 705 | std.debug.assert(1 == @alignOf(Ipv6DevicePath)); | |
| 706 | ||
| 707 | std.debug.assert(0 == @offsetOf(Ipv6DevicePath, "type")); | |
| 708 | std.debug.assert(1 == @offsetOf(Ipv6DevicePath, "subtype")); | |
| 709 | std.debug.assert(2 == @offsetOf(Ipv6DevicePath, "length")); | |
| 710 | std.debug.assert(4 == @offsetOf(Ipv6DevicePath, "local_ip_address")); | |
| 711 | std.debug.assert(20 == @offsetOf(Ipv6DevicePath, "remote_ip_address")); | |
| 712 | std.debug.assert(36 == @offsetOf(Ipv6DevicePath, "local_port")); | |
| 713 | std.debug.assert(38 == @offsetOf(Ipv6DevicePath, "remote_port")); | |
| 714 | std.debug.assert(40 == @offsetOf(Ipv6DevicePath, "protocol")); | |
| 715 | std.debug.assert(42 == @offsetOf(Ipv6DevicePath, "ip_address_origin")); | |
| 716 | std.debug.assert(43 == @offsetOf(Ipv6DevicePath, "prefix_length")); | |
| 717 | std.debug.assert(44 == @offsetOf(Ipv6DevicePath, "gateway_ip_address")); | |
| 718 | } | |
| 719 | ||
| 720 | pub const VlanDevicePath = extern struct { | |
| 721 | type: DevicePathType, | |
| 722 | subtype: Subtype, | |
| 723 | length: u16 align(1), | |
| 724 | vlan_id: u16 align(1), | |
| 725 | }; | |
| 726 | ||
| 727 | comptime { | |
| 728 | std.debug.assert(6 == @sizeOf(VlanDevicePath)); | |
| 729 | std.debug.assert(1 == @alignOf(VlanDevicePath)); | |
| 730 | ||
| 731 | std.debug.assert(0 == @offsetOf(VlanDevicePath, "type")); | |
| 732 | std.debug.assert(1 == @offsetOf(VlanDevicePath, "subtype")); | |
| 733 | std.debug.assert(2 == @offsetOf(VlanDevicePath, "length")); | |
| 734 | std.debug.assert(4 == @offsetOf(VlanDevicePath, "vlan_id")); | |
| 735 | } | |
| 736 | ||
| 737 | pub const InfiniBandDevicePath = extern struct { | |
| 738 | pub const ResourceFlags = packed struct(u32) { | |
| 739 | pub const ControllerType = enum(u1) { | |
| 740 | Ioc = 0, | |
| 741 | Service = 1, | |
| 742 | }; | |
| 743 | ||
| 744 | ioc_or_service: ControllerType, | |
| 745 | extend_boot_environment: bool, | |
| 746 | console_protocol: bool, | |
| 747 | storage_protocol: bool, | |
| 748 | network_protocol: bool, | |
| 749 | ||
| 750 | // u1 + 4 * bool = 5 bits, we need a total of 32 bits | |
| 751 | reserved: u27, | |
| 752 | }; | |
| 753 | ||
| 754 | type: DevicePathType, | |
| 755 | subtype: Subtype, | |
| 756 | length: u16 align(1), | |
| 757 | resource_flags: ResourceFlags align(1), | |
| 758 | port_gid: [16]u8, | |
| 759 | service_id: u64 align(1), | |
| 760 | target_port_id: u64 align(1), | |
| 761 | device_id: u64 align(1), | |
| 762 | }; | |
| 763 | ||
| 764 | comptime { | |
| 765 | std.debug.assert(48 == @sizeOf(InfiniBandDevicePath)); | |
| 766 | std.debug.assert(1 == @alignOf(InfiniBandDevicePath)); | |
| 767 | ||
| 768 | std.debug.assert(0 == @offsetOf(InfiniBandDevicePath, "type")); | |
| 769 | std.debug.assert(1 == @offsetOf(InfiniBandDevicePath, "subtype")); | |
| 770 | std.debug.assert(2 == @offsetOf(InfiniBandDevicePath, "length")); | |
| 771 | std.debug.assert(4 == @offsetOf(InfiniBandDevicePath, "resource_flags")); | |
| 772 | std.debug.assert(8 == @offsetOf(InfiniBandDevicePath, "port_gid")); | |
| 773 | std.debug.assert(24 == @offsetOf(InfiniBandDevicePath, "service_id")); | |
| 774 | std.debug.assert(32 == @offsetOf(InfiniBandDevicePath, "target_port_id")); | |
| 775 | std.debug.assert(40 == @offsetOf(InfiniBandDevicePath, "device_id")); | |
| 776 | } | |
| 777 | ||
| 778 | pub const UartDevicePath = extern struct { | |
| 779 | pub const Parity = enum(u8) { | |
| 780 | Default = 0, | |
| 781 | None = 1, | |
| 782 | Even = 2, | |
| 783 | Odd = 3, | |
| 784 | Mark = 4, | |
| 785 | Space = 5, | |
| 786 | _, | |
| 787 | }; | |
| 788 | ||
| 789 | pub const StopBits = enum(u8) { | |
| 790 | Default = 0, | |
| 791 | One = 1, | |
| 792 | OneAndAHalf = 2, | |
| 793 | Two = 3, | |
| 794 | _, | |
| 795 | }; | |
| 796 | ||
| 797 | type: DevicePathType, | |
| 798 | subtype: Subtype, | |
| 799 | length: u16 align(1), | |
| 800 | reserved: u32 align(1), | |
| 801 | baud_rate: u64 align(1), | |
| 802 | data_bits: u8, | |
| 803 | parity: Parity, | |
| 804 | stop_bits: StopBits, | |
| 805 | }; | |
| 806 | ||
| 807 | comptime { | |
| 808 | std.debug.assert(19 == @sizeOf(UartDevicePath)); | |
| 809 | std.debug.assert(1 == @alignOf(UartDevicePath)); | |
| 810 | ||
| 811 | std.debug.assert(0 == @offsetOf(UartDevicePath, "type")); | |
| 812 | std.debug.assert(1 == @offsetOf(UartDevicePath, "subtype")); | |
| 813 | std.debug.assert(2 == @offsetOf(UartDevicePath, "length")); | |
| 814 | std.debug.assert(4 == @offsetOf(UartDevicePath, "reserved")); | |
| 815 | std.debug.assert(8 == @offsetOf(UartDevicePath, "baud_rate")); | |
| 816 | std.debug.assert(16 == @offsetOf(UartDevicePath, "data_bits")); | |
| 817 | std.debug.assert(17 == @offsetOf(UartDevicePath, "parity")); | |
| 818 | std.debug.assert(18 == @offsetOf(UartDevicePath, "stop_bits")); | |
| 819 | } | |
| 820 | ||
| 821 | pub const VendorDefinedDevicePath = extern struct { | |
| 822 | type: DevicePathType, | |
| 823 | subtype: Subtype, | |
| 824 | length: u16 align(1), | |
| 825 | vendor_guid: Guid align(1), | |
| 826 | }; | |
| 827 | ||
| 828 | comptime { | |
| 829 | std.debug.assert(20 == @sizeOf(VendorDefinedDevicePath)); | |
| 830 | std.debug.assert(1 == @alignOf(VendorDefinedDevicePath)); | |
| 831 | ||
| 832 | std.debug.assert(0 == @offsetOf(VendorDefinedDevicePath, "type")); | |
| 833 | std.debug.assert(1 == @offsetOf(VendorDefinedDevicePath, "subtype")); | |
| 834 | std.debug.assert(2 == @offsetOf(VendorDefinedDevicePath, "length")); | |
| 835 | std.debug.assert(4 == @offsetOf(VendorDefinedDevicePath, "vendor_guid")); | |
| 836 | } | |
| 837 | }; | |
| 838 | ||
| 839 | pub const MediaDevicePath = union(Subtype) { | |
| 840 | HardDrive: *const HardDriveDevicePath, | |
| 841 | Cdrom: *const CdromDevicePath, | |
| 842 | Vendor: *const VendorDevicePath, | |
| 843 | FilePath: *const FilePathDevicePath, | |
| 844 | MediaProtocol: *const MediaProtocolDevicePath, | |
| 845 | PiwgFirmwareFile: *const PiwgFirmwareFileDevicePath, | |
| 846 | PiwgFirmwareVolume: *const PiwgFirmwareVolumeDevicePath, | |
| 847 | RelativeOffsetRange: *const RelativeOffsetRangeDevicePath, | |
| 848 | RamDisk: *const RamDiskDevicePath, | |
| 849 | ||
| 850 | pub const Subtype = enum(u8) { | |
| 851 | HardDrive = 1, | |
| 852 | Cdrom = 2, | |
| 853 | Vendor = 3, | |
| 854 | FilePath = 4, | |
| 855 | MediaProtocol = 5, | |
| 856 | PiwgFirmwareFile = 6, | |
| 857 | PiwgFirmwareVolume = 7, | |
| 858 | RelativeOffsetRange = 8, | |
| 859 | RamDisk = 9, | |
| 860 | _, | |
| 861 | }; | |
| 862 | ||
| 863 | pub const HardDriveDevicePath = extern struct { | |
| 864 | pub const Format = enum(u8) { | |
| 865 | LegacyMbr = 0x01, | |
| 866 | GuidPartitionTable = 0x02, | |
| 867 | }; | |
| 868 | ||
| 869 | pub const SignatureType = enum(u8) { | |
| 870 | NoSignature = 0x00, | |
| 871 | /// "32-bit signature from address 0x1b8 of the type 0x01 MBR" | |
| 872 | MbrSignature = 0x01, | |
| 873 | GuidSignature = 0x02, | |
| 874 | }; | |
| 875 | ||
| 876 | type: DevicePathType, | |
| 877 | subtype: Subtype, | |
| 878 | length: u16 align(1), | |
| 879 | partition_number: u32 align(1), | |
| 880 | partition_start: u64 align(1), | |
| 881 | partition_size: u64 align(1), | |
| 882 | partition_signature: [16]u8, | |
| 883 | partition_format: Format, | |
| 884 | signature_type: SignatureType, | |
| 885 | }; | |
| 886 | ||
| 887 | comptime { | |
| 888 | std.debug.assert(42 == @sizeOf(HardDriveDevicePath)); | |
| 889 | std.debug.assert(1 == @alignOf(HardDriveDevicePath)); | |
| 890 | ||
| 891 | std.debug.assert(0 == @offsetOf(HardDriveDevicePath, "type")); | |
| 892 | std.debug.assert(1 == @offsetOf(HardDriveDevicePath, "subtype")); | |
| 893 | std.debug.assert(2 == @offsetOf(HardDriveDevicePath, "length")); | |
| 894 | std.debug.assert(4 == @offsetOf(HardDriveDevicePath, "partition_number")); | |
| 895 | std.debug.assert(8 == @offsetOf(HardDriveDevicePath, "partition_start")); | |
| 896 | std.debug.assert(16 == @offsetOf(HardDriveDevicePath, "partition_size")); | |
| 897 | std.debug.assert(24 == @offsetOf(HardDriveDevicePath, "partition_signature")); | |
| 898 | std.debug.assert(40 == @offsetOf(HardDriveDevicePath, "partition_format")); | |
| 899 | std.debug.assert(41 == @offsetOf(HardDriveDevicePath, "signature_type")); | |
| 900 | } | |
| 901 | ||
| 902 | pub const CdromDevicePath = extern struct { | |
| 903 | type: DevicePathType, | |
| 904 | subtype: Subtype, | |
| 905 | length: u16 align(1), | |
| 906 | boot_entry: u32 align(1), | |
| 907 | partition_start: u64 align(1), | |
| 908 | partition_size: u64 align(1), | |
| 909 | }; | |
| 910 | ||
| 911 | comptime { | |
| 912 | std.debug.assert(24 == @sizeOf(CdromDevicePath)); | |
| 913 | std.debug.assert(1 == @alignOf(CdromDevicePath)); | |
| 914 | ||
| 915 | std.debug.assert(0 == @offsetOf(CdromDevicePath, "type")); | |
| 916 | std.debug.assert(1 == @offsetOf(CdromDevicePath, "subtype")); | |
| 917 | std.debug.assert(2 == @offsetOf(CdromDevicePath, "length")); | |
| 918 | std.debug.assert(4 == @offsetOf(CdromDevicePath, "boot_entry")); | |
| 919 | std.debug.assert(8 == @offsetOf(CdromDevicePath, "partition_start")); | |
| 920 | std.debug.assert(16 == @offsetOf(CdromDevicePath, "partition_size")); | |
| 921 | } | |
| 922 | ||
| 923 | pub const VendorDevicePath = extern struct { | |
| 924 | type: DevicePathType, | |
| 925 | subtype: Subtype, | |
| 926 | length: u16 align(1), | |
| 927 | guid: Guid align(1), | |
| 928 | }; | |
| 929 | ||
| 930 | comptime { | |
| 931 | std.debug.assert(20 == @sizeOf(VendorDevicePath)); | |
| 932 | std.debug.assert(1 == @alignOf(VendorDevicePath)); | |
| 933 | ||
| 934 | std.debug.assert(0 == @offsetOf(VendorDevicePath, "type")); | |
| 935 | std.debug.assert(1 == @offsetOf(VendorDevicePath, "subtype")); | |
| 936 | std.debug.assert(2 == @offsetOf(VendorDevicePath, "length")); | |
| 937 | std.debug.assert(4 == @offsetOf(VendorDevicePath, "guid")); | |
| 938 | } | |
| 939 | ||
| 940 | pub const FilePathDevicePath = extern struct { | |
| 941 | type: DevicePathType, | |
| 942 | subtype: Subtype, | |
| 943 | length: u16 align(1), | |
| 944 | ||
| 945 | pub fn getPath(self: *const FilePathDevicePath) [*:0]align(1) const u16 { | |
| 946 | return @as([*:0]align(1) const u16, @ptrCast(@as([*]const u8, @ptrCast(self)) + @sizeOf(FilePathDevicePath))); | |
| 947 | } | |
| 948 | }; | |
| 949 | ||
| 950 | comptime { | |
| 951 | std.debug.assert(4 == @sizeOf(FilePathDevicePath)); | |
| 952 | std.debug.assert(1 == @alignOf(FilePathDevicePath)); | |
| 953 | ||
| 954 | std.debug.assert(0 == @offsetOf(FilePathDevicePath, "type")); | |
| 955 | std.debug.assert(1 == @offsetOf(FilePathDevicePath, "subtype")); | |
| 956 | std.debug.assert(2 == @offsetOf(FilePathDevicePath, "length")); | |
| 957 | } | |
| 958 | ||
| 959 | pub const MediaProtocolDevicePath = extern struct { | |
| 960 | type: DevicePathType, | |
| 961 | subtype: Subtype, | |
| 962 | length: u16 align(1), | |
| 963 | guid: Guid align(1), | |
| 964 | }; | |
| 965 | ||
| 966 | comptime { | |
| 967 | std.debug.assert(20 == @sizeOf(MediaProtocolDevicePath)); | |
| 968 | std.debug.assert(1 == @alignOf(MediaProtocolDevicePath)); | |
| 969 | ||
| 970 | std.debug.assert(0 == @offsetOf(MediaProtocolDevicePath, "type")); | |
| 971 | std.debug.assert(1 == @offsetOf(MediaProtocolDevicePath, "subtype")); | |
| 972 | std.debug.assert(2 == @offsetOf(MediaProtocolDevicePath, "length")); | |
| 973 | std.debug.assert(4 == @offsetOf(MediaProtocolDevicePath, "guid")); | |
| 974 | } | |
| 975 | ||
| 976 | pub const PiwgFirmwareFileDevicePath = extern struct { | |
| 977 | type: DevicePathType, | |
| 978 | subtype: Subtype, | |
| 979 | length: u16 align(1), | |
| 980 | fv_filename: Guid align(1), | |
| 981 | }; | |
| 982 | ||
| 983 | comptime { | |
| 984 | std.debug.assert(20 == @sizeOf(PiwgFirmwareFileDevicePath)); | |
| 985 | std.debug.assert(1 == @alignOf(PiwgFirmwareFileDevicePath)); | |
| 986 | ||
| 987 | std.debug.assert(0 == @offsetOf(PiwgFirmwareFileDevicePath, "type")); | |
| 988 | std.debug.assert(1 == @offsetOf(PiwgFirmwareFileDevicePath, "subtype")); | |
| 989 | std.debug.assert(2 == @offsetOf(PiwgFirmwareFileDevicePath, "length")); | |
| 990 | std.debug.assert(4 == @offsetOf(PiwgFirmwareFileDevicePath, "fv_filename")); | |
| 991 | } | |
| 992 | ||
| 993 | pub const PiwgFirmwareVolumeDevicePath = extern struct { | |
| 994 | type: DevicePathType, | |
| 995 | subtype: Subtype, | |
| 996 | length: u16 align(1), | |
| 997 | fv_name: Guid align(1), | |
| 998 | }; | |
| 999 | ||
| 1000 | comptime { | |
| 1001 | std.debug.assert(20 == @sizeOf(PiwgFirmwareVolumeDevicePath)); | |
| 1002 | std.debug.assert(1 == @alignOf(PiwgFirmwareVolumeDevicePath)); | |
| 1003 | ||
| 1004 | std.debug.assert(0 == @offsetOf(PiwgFirmwareVolumeDevicePath, "type")); | |
| 1005 | std.debug.assert(1 == @offsetOf(PiwgFirmwareVolumeDevicePath, "subtype")); | |
| 1006 | std.debug.assert(2 == @offsetOf(PiwgFirmwareVolumeDevicePath, "length")); | |
| 1007 | std.debug.assert(4 == @offsetOf(PiwgFirmwareVolumeDevicePath, "fv_name")); | |
| 1008 | } | |
| 1009 | ||
| 1010 | pub const RelativeOffsetRangeDevicePath = extern struct { | |
| 1011 | type: DevicePathType, | |
| 1012 | subtype: Subtype, | |
| 1013 | length: u16 align(1), | |
| 1014 | reserved: u32 align(1), | |
| 1015 | start: u64 align(1), | |
| 1016 | end: u64 align(1), | |
| 1017 | }; | |
| 1018 | ||
| 1019 | comptime { | |
| 1020 | std.debug.assert(24 == @sizeOf(RelativeOffsetRangeDevicePath)); | |
| 1021 | std.debug.assert(1 == @alignOf(RelativeOffsetRangeDevicePath)); | |
| 1022 | ||
| 1023 | std.debug.assert(0 == @offsetOf(RelativeOffsetRangeDevicePath, "type")); | |
| 1024 | std.debug.assert(1 == @offsetOf(RelativeOffsetRangeDevicePath, "subtype")); | |
| 1025 | std.debug.assert(2 == @offsetOf(RelativeOffsetRangeDevicePath, "length")); | |
| 1026 | std.debug.assert(4 == @offsetOf(RelativeOffsetRangeDevicePath, "reserved")); | |
| 1027 | std.debug.assert(8 == @offsetOf(RelativeOffsetRangeDevicePath, "start")); | |
| 1028 | std.debug.assert(16 == @offsetOf(RelativeOffsetRangeDevicePath, "end")); | |
| 1029 | } | |
| 1030 | ||
| 1031 | pub const RamDiskDevicePath = extern struct { | |
| 1032 | type: DevicePathType, | |
| 1033 | subtype: Subtype, | |
| 1034 | length: u16 align(1), | |
| 1035 | start: u64 align(1), | |
| 1036 | end: u64 align(1), | |
| 1037 | disk_type: Guid align(1), | |
| 1038 | instance: u16 align(1), | |
| 1039 | }; | |
| 1040 | ||
| 1041 | comptime { | |
| 1042 | std.debug.assert(38 == @sizeOf(RamDiskDevicePath)); | |
| 1043 | std.debug.assert(1 == @alignOf(RamDiskDevicePath)); | |
| 1044 | ||
| 1045 | std.debug.assert(0 == @offsetOf(RamDiskDevicePath, "type")); | |
| 1046 | std.debug.assert(1 == @offsetOf(RamDiskDevicePath, "subtype")); | |
| 1047 | std.debug.assert(2 == @offsetOf(RamDiskDevicePath, "length")); | |
| 1048 | std.debug.assert(4 == @offsetOf(RamDiskDevicePath, "start")); | |
| 1049 | std.debug.assert(12 == @offsetOf(RamDiskDevicePath, "end")); | |
| 1050 | std.debug.assert(20 == @offsetOf(RamDiskDevicePath, "disk_type")); | |
| 1051 | std.debug.assert(36 == @offsetOf(RamDiskDevicePath, "instance")); | |
| 1052 | } | |
| 1053 | }; | |
| 1054 | ||
| 1055 | pub const BiosBootSpecificationDevicePath = union(Subtype) { | |
| 1056 | BBS101: *const BBS101DevicePath, | |
| 1057 | ||
| 1058 | pub const Subtype = enum(u8) { | |
| 1059 | BBS101 = 1, | |
| 1060 | _, | |
| 1061 | }; | |
| 1062 | ||
| 1063 | pub const BBS101DevicePath = extern struct { | |
| 1064 | type: DevicePathType, | |
| 1065 | subtype: Subtype, | |
| 1066 | length: u16 align(1), | |
| 1067 | device_type: u16 align(1), | |
| 1068 | status_flag: u16 align(1), | |
| 1069 | ||
| 1070 | pub fn getDescription(self: *const BBS101DevicePath) [*:0]const u8 { | |
| 1071 | return @as([*:0]const u8, @ptrCast(self)) + @sizeOf(BBS101DevicePath); | |
| 1072 | } | |
| 1073 | }; | |
| 1074 | ||
| 1075 | comptime { | |
| 1076 | std.debug.assert(8 == @sizeOf(BBS101DevicePath)); | |
| 1077 | std.debug.assert(1 == @alignOf(BBS101DevicePath)); | |
| 1078 | ||
| 1079 | std.debug.assert(0 == @offsetOf(BBS101DevicePath, "type")); | |
| 1080 | std.debug.assert(1 == @offsetOf(BBS101DevicePath, "subtype")); | |
| 1081 | std.debug.assert(2 == @offsetOf(BBS101DevicePath, "length")); | |
| 1082 | std.debug.assert(4 == @offsetOf(BBS101DevicePath, "device_type")); | |
| 1083 | std.debug.assert(6 == @offsetOf(BBS101DevicePath, "status_flag")); | |
| 1084 | } | |
| 1085 | }; | |
| 1086 | ||
| 1087 | pub const EndDevicePath = union(Subtype) { | |
| 1088 | EndEntire: *const EndEntireDevicePath, | |
| 1089 | EndThisInstance: *const EndThisInstanceDevicePath, | |
| 1090 | ||
| 1091 | pub const Subtype = enum(u8) { | |
| 1092 | EndEntire = 0xff, | |
| 1093 | EndThisInstance = 0x01, | |
| 1094 | _, | |
| 1095 | }; | |
| 1096 | ||
| 1097 | pub const EndEntireDevicePath = extern struct { | |
| 1098 | type: DevicePathType, | |
| 1099 | subtype: Subtype, | |
| 1100 | length: u16 align(1), | |
| 1101 | }; | |
| 1102 | ||
| 1103 | comptime { | |
| 1104 | std.debug.assert(4 == @sizeOf(EndEntireDevicePath)); | |
| 1105 | std.debug.assert(1 == @alignOf(EndEntireDevicePath)); | |
| 1106 | ||
| 1107 | std.debug.assert(0 == @offsetOf(EndEntireDevicePath, "type")); | |
| 1108 | std.debug.assert(1 == @offsetOf(EndEntireDevicePath, "subtype")); | |
| 1109 | std.debug.assert(2 == @offsetOf(EndEntireDevicePath, "length")); | |
| 1110 | } | |
| 1111 | ||
| 1112 | pub const EndThisInstanceDevicePath = extern struct { | |
| 1113 | type: DevicePathType, | |
| 1114 | subtype: Subtype, | |
| 1115 | length: u16 align(1), | |
| 1116 | }; | |
| 1117 | ||
| 1118 | comptime { | |
| 1119 | std.debug.assert(4 == @sizeOf(EndEntireDevicePath)); | |
| 1120 | std.debug.assert(1 == @alignOf(EndEntireDevicePath)); | |
| 1121 | ||
| 1122 | std.debug.assert(0 == @offsetOf(EndEntireDevicePath, "type")); | |
| 1123 | std.debug.assert(1 == @offsetOf(EndEntireDevicePath, "subtype")); | |
| 1124 | std.debug.assert(2 == @offsetOf(EndEntireDevicePath, "length")); | |
| 1125 | } | |
| 1126 | }; |
lib/std/os/uefi/protocols/edid_active_protocol.zig deleted-17| ... | ... | @@ -1,17 +0,0 @@ |
| 1 | const uefi = @import("std").os.uefi; | |
| 2 | const Guid = uefi.Guid; | |
| 3 | ||
| 4 | /// EDID information for an active video output device | |
| 5 | pub const EdidActiveProtocol = extern struct { | |
| 6 | size_of_edid: u32, | |
| 7 | edid: ?[*]u8, | |
| 8 | ||
| 9 | pub const guid align(8) = Guid{ | |
| 10 | .time_low = 0xbd8c1056, | |
| 11 | .time_mid = 0x9f36, | |
| 12 | .time_high_and_version = 0x44ec, | |
| 13 | .clock_seq_high_and_reserved = 0x92, | |
| 14 | .clock_seq_low = 0xa8, | |
| 15 | .node = [_]u8{ 0xa6, 0x33, 0x7f, 0x81, 0x79, 0x86 }, | |
| 16 | }; | |
| 17 | }; |
lib/std/os/uefi/protocols/edid_discovered_protocol.zig deleted-17| ... | ... | @@ -1,17 +0,0 @@ |
| 1 | const uefi = @import("std").os.uefi; | |
| 2 | const Guid = uefi.Guid; | |
| 3 | ||
| 4 | /// EDID information for a video output device | |
| 5 | pub const EdidDiscoveredProtocol = extern struct { | |
| 6 | size_of_edid: u32, | |
| 7 | edid: ?[*]u8, | |
| 8 | ||
| 9 | pub const guid align(8) = Guid{ | |
| 10 | .time_low = 0x1c0c34f6, | |
| 11 | .time_mid = 0xd380, | |
| 12 | .time_high_and_version = 0x41fa, | |
| 13 | .clock_seq_high_and_reserved = 0xa0, | |
| 14 | .clock_seq_low = 0x49, | |
| 15 | .node = [_]u8{ 0x8a, 0xd0, 0x6c, 0x1a, 0x66, 0xaa }, | |
| 16 | }; | |
| 17 | }; |
lib/std/os/uefi/protocols/edid_override_protocol.zig deleted-37| ... | ... | @@ -1,37 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Guid = uefi.Guid; | |
| 4 | const Handle = uefi.Handle; | |
| 5 | const Status = uefi.Status; | |
| 6 | const cc = uefi.cc; | |
| 7 | ||
| 8 | /// Override EDID information | |
| 9 | pub const EdidOverrideProtocol = extern struct { | |
| 10 | _get_edid: *const fn (*const EdidOverrideProtocol, Handle, *EdidOverrideProtocolAttributes, *usize, *?[*]u8) callconv(cc) Status, | |
| 11 | ||
| 12 | /// Returns policy information and potentially a replacement EDID for the specified video output device. | |
| 13 | pub fn getEdid( | |
| 14 | self: *const EdidOverrideProtocol, | |
| 15 | handle: Handle, | |
| 16 | attributes: *EdidOverrideProtocolAttributes, | |
| 17 | edid_size: *usize, | |
| 18 | edid: *?[*]u8, | |
| 19 | ) Status { | |
| 20 | return self._get_edid(self, handle, attributes, edid_size, edid); | |
| 21 | } | |
| 22 | ||
| 23 | pub const guid align(8) = Guid{ | |
| 24 | .time_low = 0x48ecb431, | |
| 25 | .time_mid = 0xfb72, | |
| 26 | .time_high_and_version = 0x45c0, | |
| 27 | .clock_seq_high_and_reserved = 0xa9, | |
| 28 | .clock_seq_low = 0x22, | |
| 29 | .node = [_]u8{ 0xf4, 0x58, 0xfe, 0x04, 0x0b, 0xd5 }, | |
| 30 | }; | |
| 31 | }; | |
| 32 | ||
| 33 | pub const EdidOverrideProtocolAttributes = packed struct(u32) { | |
| 34 | dont_override: bool, | |
| 35 | enable_hot_plug: bool, | |
| 36 | _pad: u30 = 0, | |
| 37 | }; |
lib/std/os/uefi/protocols/file_protocol.zig deleted-197| ... | ... | @@ -1,197 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const io = std.io; | |
| 4 | const Guid = uefi.Guid; | |
| 5 | const Time = uefi.Time; | |
| 6 | const Status = uefi.Status; | |
| 7 | const cc = uefi.cc; | |
| 8 | ||
| 9 | pub const FileProtocol = extern struct { | |
| 10 | revision: u64, | |
| 11 | _open: *const fn (*const FileProtocol, **const FileProtocol, [*:0]const u16, u64, u64) callconv(cc) Status, | |
| 12 | _close: *const fn (*const FileProtocol) callconv(cc) Status, | |
| 13 | _delete: *const fn (*const FileProtocol) callconv(cc) Status, | |
| 14 | _read: *const fn (*const FileProtocol, *usize, [*]u8) callconv(cc) Status, | |
| 15 | _write: *const fn (*const FileProtocol, *usize, [*]const u8) callconv(cc) Status, | |
| 16 | _get_position: *const fn (*const FileProtocol, *u64) callconv(cc) Status, | |
| 17 | _set_position: *const fn (*const FileProtocol, u64) callconv(cc) Status, | |
| 18 | _get_info: *const fn (*const FileProtocol, *align(8) const Guid, *const usize, [*]u8) callconv(cc) Status, | |
| 19 | _set_info: *const fn (*const FileProtocol, *align(8) const Guid, usize, [*]const u8) callconv(cc) Status, | |
| 20 | _flush: *const fn (*const FileProtocol) callconv(cc) Status, | |
| 21 | ||
| 22 | pub const SeekError = error{SeekError}; | |
| 23 | pub const GetSeekPosError = error{GetSeekPosError}; | |
| 24 | pub const ReadError = error{ReadError}; | |
| 25 | pub const WriteError = error{WriteError}; | |
| 26 | ||
| 27 | pub const SeekableStream = io.SeekableStream(*const FileProtocol, SeekError, GetSeekPosError, seekTo, seekBy, getPos, getEndPos); | |
| 28 | pub const Reader = io.Reader(*const FileProtocol, ReadError, readFn); | |
| 29 | pub const Writer = io.Writer(*const FileProtocol, WriteError, writeFn); | |
| 30 | ||
| 31 | pub fn seekableStream(self: *FileProtocol) SeekableStream { | |
| 32 | return .{ .context = self }; | |
| 33 | } | |
| 34 | ||
| 35 | pub fn reader(self: *FileProtocol) Reader { | |
| 36 | return .{ .context = self }; | |
| 37 | } | |
| 38 | ||
| 39 | pub fn writer(self: *FileProtocol) Writer { | |
| 40 | return .{ .context = self }; | |
| 41 | } | |
| 42 | ||
| 43 | pub fn open(self: *const FileProtocol, new_handle: **const FileProtocol, file_name: [*:0]const u16, open_mode: u64, attributes: u64) Status { | |
| 44 | return self._open(self, new_handle, file_name, open_mode, attributes); | |
| 45 | } | |
| 46 | ||
| 47 | pub fn close(self: *const FileProtocol) Status { | |
| 48 | return self._close(self); | |
| 49 | } | |
| 50 | ||
| 51 | pub fn delete(self: *const FileProtocol) Status { | |
| 52 | return self._delete(self); | |
| 53 | } | |
| 54 | ||
| 55 | pub fn read(self: *const FileProtocol, buffer_size: *usize, buffer: [*]u8) Status { | |
| 56 | return self._read(self, buffer_size, buffer); | |
| 57 | } | |
| 58 | ||
| 59 | fn readFn(self: *const FileProtocol, buffer: []u8) ReadError!usize { | |
| 60 | var size: usize = buffer.len; | |
| 61 | if (.Success != self.read(&size, buffer.ptr)) return ReadError.ReadError; | |
| 62 | return size; | |
| 63 | } | |
| 64 | ||
| 65 | pub fn write(self: *const FileProtocol, buffer_size: *usize, buffer: [*]const u8) Status { | |
| 66 | return self._write(self, buffer_size, buffer); | |
| 67 | } | |
| 68 | ||
| 69 | fn writeFn(self: *const FileProtocol, bytes: []const u8) WriteError!usize { | |
| 70 | var size: usize = bytes.len; | |
| 71 | if (.Success != self.write(&size, bytes.ptr)) return WriteError.WriteError; | |
| 72 | return size; | |
| 73 | } | |
| 74 | ||
| 75 | pub fn getPosition(self: *const FileProtocol, position: *u64) Status { | |
| 76 | return self._get_position(self, position); | |
| 77 | } | |
| 78 | ||
| 79 | fn getPos(self: *const FileProtocol) GetSeekPosError!u64 { | |
| 80 | var pos: u64 = undefined; | |
| 81 | if (.Success != self.getPosition(&pos)) return GetSeekPosError.GetSeekPosError; | |
| 82 | return pos; | |
| 83 | } | |
| 84 | ||
| 85 | fn getEndPos(self: *const FileProtocol) GetSeekPosError!u64 { | |
| 86 | // preserve the old file position | |
| 87 | var pos: u64 = undefined; | |
| 88 | if (.Success != self.getPosition(&pos)) return GetSeekPosError.GetSeekPosError; | |
| 89 | // seek to end of file to get position = file size | |
| 90 | if (.Success != self.setPosition(efi_file_position_end_of_file)) return GetSeekPosError.GetSeekPosError; | |
| 91 | // restore the old position | |
| 92 | if (.Success != self.setPosition(pos)) return GetSeekPosError.GetSeekPosError; | |
| 93 | // return the file size = position | |
| 94 | return pos; | |
| 95 | } | |
| 96 | ||
| 97 | pub fn setPosition(self: *const FileProtocol, position: u64) Status { | |
| 98 | return self._set_position(self, position); | |
| 99 | } | |
| 100 | ||
| 101 | fn seekTo(self: *const FileProtocol, pos: u64) SeekError!void { | |
| 102 | if (.Success != self.setPosition(pos)) return SeekError.SeekError; | |
| 103 | } | |
| 104 | ||
| 105 | fn seekBy(self: *const FileProtocol, offset: i64) SeekError!void { | |
| 106 | // save the old position and calculate the delta | |
| 107 | var pos: u64 = undefined; | |
| 108 | if (.Success != self.getPosition(&pos)) return SeekError.SeekError; | |
| 109 | const seek_back = offset < 0; | |
| 110 | const amt = std.math.absCast(offset); | |
| 111 | if (seek_back) { | |
| 112 | pos += amt; | |
| 113 | } else { | |
| 114 | pos -= amt; | |
| 115 | } | |
| 116 | if (.Success != self.setPosition(pos)) return SeekError.SeekError; | |
| 117 | } | |
| 118 | ||
| 119 | pub fn getInfo(self: *const FileProtocol, information_type: *align(8) const Guid, buffer_size: *usize, buffer: [*]u8) Status { | |
| 120 | return self._get_info(self, information_type, buffer_size, buffer); | |
| 121 | } | |
| 122 | ||
| 123 | pub fn setInfo(self: *const FileProtocol, information_type: *align(8) const Guid, buffer_size: usize, buffer: [*]const u8) Status { | |
| 124 | return self._set_info(self, information_type, buffer_size, buffer); | |
| 125 | } | |
| 126 | ||
| 127 | pub fn flush(self: *const FileProtocol) Status { | |
| 128 | return self._flush(self); | |
| 129 | } | |
| 130 | ||
| 131 | pub const efi_file_mode_read: u64 = 0x0000000000000001; | |
| 132 | pub const efi_file_mode_write: u64 = 0x0000000000000002; | |
| 133 | pub const efi_file_mode_create: u64 = 0x8000000000000000; | |
| 134 | ||
| 135 | pub const efi_file_read_only: u64 = 0x0000000000000001; | |
| 136 | pub const efi_file_hidden: u64 = 0x0000000000000002; | |
| 137 | pub const efi_file_system: u64 = 0x0000000000000004; | |
| 138 | pub const efi_file_reserved: u64 = 0x0000000000000008; | |
| 139 | pub const efi_file_directory: u64 = 0x0000000000000010; | |
| 140 | pub const efi_file_archive: u64 = 0x0000000000000020; | |
| 141 | pub const efi_file_valid_attr: u64 = 0x0000000000000037; | |
| 142 | ||
| 143 | pub const efi_file_position_end_of_file: u64 = 0xffffffffffffffff; | |
| 144 | }; | |
| 145 | ||
| 146 | pub const FileInfo = extern struct { | |
| 147 | size: u64, | |
| 148 | file_size: u64, | |
| 149 | physical_size: u64, | |
| 150 | create_time: Time, | |
| 151 | last_access_time: Time, | |
| 152 | modification_time: Time, | |
| 153 | attribute: u64, | |
| 154 | ||
| 155 | pub fn getFileName(self: *const FileInfo) [*:0]const u16 { | |
| 156 | return @ptrCast(@alignCast(@as([*]const u8, @ptrCast(self)) + @sizeOf(FileInfo))); | |
| 157 | } | |
| 158 | ||
| 159 | pub const efi_file_read_only: u64 = 0x0000000000000001; | |
| 160 | pub const efi_file_hidden: u64 = 0x0000000000000002; | |
| 161 | pub const efi_file_system: u64 = 0x0000000000000004; | |
| 162 | pub const efi_file_reserved: u64 = 0x0000000000000008; | |
| 163 | pub const efi_file_directory: u64 = 0x0000000000000010; | |
| 164 | pub const efi_file_archive: u64 = 0x0000000000000020; | |
| 165 | pub const efi_file_valid_attr: u64 = 0x0000000000000037; | |
| 166 | ||
| 167 | pub const guid align(8) = Guid{ | |
| 168 | .time_low = 0x09576e92, | |
| 169 | .time_mid = 0x6d3f, | |
| 170 | .time_high_and_version = 0x11d2, | |
| 171 | .clock_seq_high_and_reserved = 0x8e, | |
| 172 | .clock_seq_low = 0x39, | |
| 173 | .node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b }, | |
| 174 | }; | |
| 175 | }; | |
| 176 | ||
| 177 | pub const FileSystemInfo = extern struct { | |
| 178 | size: u64, | |
| 179 | read_only: bool, | |
| 180 | volume_size: u64, | |
| 181 | free_space: u64, | |
| 182 | block_size: u32, | |
| 183 | _volume_label: u16, | |
| 184 | ||
| 185 | pub fn getVolumeLabel(self: *const FileSystemInfo) [*:0]const u16 { | |
| 186 | return @as([*:0]const u16, @ptrCast(&self._volume_label)); | |
| 187 | } | |
| 188 | ||
| 189 | pub const guid align(8) = Guid{ | |
| 190 | .time_low = 0x09576e93, | |
| 191 | .time_mid = 0x6d3f, | |
| 192 | .time_high_and_version = 0x11d2, | |
| 193 | .clock_seq_high_and_reserved = 0x8e, | |
| 194 | .clock_seq_low = 0x39, | |
| 195 | .node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b }, | |
| 196 | }; | |
| 197 | }; |
lib/std/os/uefi/protocols/graphics_output_protocol.zig deleted-85| ... | ... | @@ -1,85 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Guid = uefi.Guid; | |
| 4 | const Status = uefi.Status; | |
| 5 | const cc = uefi.cc; | |
| 6 | ||
| 7 | /// Graphics output | |
| 8 | pub const GraphicsOutputProtocol = extern struct { | |
| 9 | _query_mode: *const fn (*const GraphicsOutputProtocol, u32, *usize, **GraphicsOutputModeInformation) callconv(cc) Status, | |
| 10 | _set_mode: *const fn (*const GraphicsOutputProtocol, u32) callconv(cc) Status, | |
| 11 | _blt: *const fn (*const GraphicsOutputProtocol, ?[*]GraphicsOutputBltPixel, GraphicsOutputBltOperation, usize, usize, usize, usize, usize, usize, usize) callconv(cc) Status, | |
| 12 | mode: *GraphicsOutputProtocolMode, | |
| 13 | ||
| 14 | /// Returns information for an available graphics mode that the graphics device and the set of active video output devices supports. | |
| 15 | pub fn queryMode(self: *const GraphicsOutputProtocol, mode: u32, size_of_info: *usize, info: **GraphicsOutputModeInformation) Status { | |
| 16 | return self._query_mode(self, mode, size_of_info, info); | |
| 17 | } | |
| 18 | ||
| 19 | /// Set the video device into the specified mode and clears the visible portions of the output display to black. | |
| 20 | pub fn setMode(self: *const GraphicsOutputProtocol, mode: u32) Status { | |
| 21 | return self._set_mode(self, mode); | |
| 22 | } | |
| 23 | ||
| 24 | /// Blt a rectangle of pixels on the graphics screen. Blt stands for BLock Transfer. | |
| 25 | 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 { | |
| 26 | return self._blt(self, blt_buffer, blt_operation, source_x, source_y, destination_x, destination_y, width, height, delta); | |
| 27 | } | |
| 28 | ||
| 29 | pub const guid align(8) = Guid{ | |
| 30 | .time_low = 0x9042a9de, | |
| 31 | .time_mid = 0x23dc, | |
| 32 | .time_high_and_version = 0x4a38, | |
| 33 | .clock_seq_high_and_reserved = 0x96, | |
| 34 | .clock_seq_low = 0xfb, | |
| 35 | .node = [_]u8{ 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a }, | |
| 36 | }; | |
| 37 | }; | |
| 38 | ||
| 39 | pub const GraphicsOutputProtocolMode = extern struct { | |
| 40 | max_mode: u32, | |
| 41 | mode: u32, | |
| 42 | info: *GraphicsOutputModeInformation, | |
| 43 | size_of_info: usize, | |
| 44 | frame_buffer_base: u64, | |
| 45 | frame_buffer_size: usize, | |
| 46 | }; | |
| 47 | ||
| 48 | pub const GraphicsOutputModeInformation = extern struct { | |
| 49 | version: u32 = undefined, | |
| 50 | horizontal_resolution: u32 = undefined, | |
| 51 | vertical_resolution: u32 = undefined, | |
| 52 | pixel_format: GraphicsPixelFormat = undefined, | |
| 53 | pixel_information: PixelBitmask = undefined, | |
| 54 | pixels_per_scan_line: u32 = undefined, | |
| 55 | }; | |
| 56 | ||
| 57 | pub const GraphicsPixelFormat = enum(u32) { | |
| 58 | PixelRedGreenBlueReserved8BitPerColor, | |
| 59 | PixelBlueGreenRedReserved8BitPerColor, | |
| 60 | PixelBitMask, | |
| 61 | PixelBltOnly, | |
| 62 | PixelFormatMax, | |
| 63 | }; | |
| 64 | ||
| 65 | pub const PixelBitmask = extern struct { | |
| 66 | red_mask: u32, | |
| 67 | green_mask: u32, | |
| 68 | blue_mask: u32, | |
| 69 | reserved_mask: u32, | |
| 70 | }; | |
| 71 | ||
| 72 | pub const GraphicsOutputBltPixel = extern struct { | |
| 73 | blue: u8, | |
| 74 | green: u8, | |
| 75 | red: u8, | |
| 76 | reserved: u8 = undefined, | |
| 77 | }; | |
| 78 | ||
| 79 | pub const GraphicsOutputBltOperation = enum(u32) { | |
| 80 | BltVideoFill, | |
| 81 | BltVideoToBltBuffer, | |
| 82 | BltBufferToVideo, | |
| 83 | BltVideoToVideo, | |
| 84 | GraphicsOutputBltOperationMax, | |
| 85 | }; |
lib/std/os/uefi/protocols/hii.zig deleted-79| ... | ... | @@ -1,79 +0,0 @@ |
| 1 | const uefi = @import("std").os.uefi; | |
| 2 | const Guid = uefi.Guid; | |
| 3 | ||
| 4 | pub const HIIHandle = *opaque {}; | |
| 5 | ||
| 6 | /// The header found at the start of each package. | |
| 7 | pub const HIIPackageHeader = packed struct(u32) { | |
| 8 | length: u24, | |
| 9 | type: u8, | |
| 10 | ||
| 11 | pub const type_all: u8 = 0x0; | |
| 12 | pub const type_guid: u8 = 0x1; | |
| 13 | pub const forms: u8 = 0x2; | |
| 14 | pub const strings: u8 = 0x4; | |
| 15 | pub const fonts: u8 = 0x5; | |
| 16 | pub const images: u8 = 0x6; | |
| 17 | pub const simple_fonsts: u8 = 0x7; | |
| 18 | pub const device_path: u8 = 0x8; | |
| 19 | pub const keyboard_layout: u8 = 0x9; | |
| 20 | pub const animations: u8 = 0xa; | |
| 21 | pub const end: u8 = 0xdf; | |
| 22 | pub const type_system_begin: u8 = 0xe0; | |
| 23 | pub const type_system_end: u8 = 0xff; | |
| 24 | }; | |
| 25 | ||
| 26 | /// The header found at the start of each package list. | |
| 27 | pub const HIIPackageList = extern struct { | |
| 28 | package_list_guid: Guid, | |
| 29 | ||
| 30 | /// The size of the package list (in bytes), including the header. | |
| 31 | package_list_length: u32, | |
| 32 | ||
| 33 | // TODO implement iterator | |
| 34 | }; | |
| 35 | ||
| 36 | pub const HIISimplifiedFontPackage = extern struct { | |
| 37 | header: HIIPackageHeader, | |
| 38 | number_of_narrow_glyphs: u16, | |
| 39 | number_of_wide_glyphs: u16, | |
| 40 | ||
| 41 | pub fn getNarrowGlyphs(self: *HIISimplifiedFontPackage) []NarrowGlyph { | |
| 42 | return @as([*]NarrowGlyph, @ptrCast(@alignCast(@as([*]u8, @ptrCast(self)) + @sizeOf(HIISimplifiedFontPackage))))[0..self.number_of_narrow_glyphs]; | |
| 43 | } | |
| 44 | }; | |
| 45 | ||
| 46 | pub const NarrowGlyphAttributes = packed struct(u8) { | |
| 47 | non_spacing: bool, | |
| 48 | wide: bool, | |
| 49 | _pad: u6 = 0, | |
| 50 | }; | |
| 51 | ||
| 52 | pub const NarrowGlyph = extern struct { | |
| 53 | unicode_weight: u16, | |
| 54 | attributes: NarrowGlyphAttributes, | |
| 55 | glyph_col_1: [19]u8, | |
| 56 | }; | |
| 57 | ||
| 58 | pub const WideGlyphAttributes = packed struct(u8) { | |
| 59 | non_spacing: bool, | |
| 60 | wide: bool, | |
| 61 | _pad: u6 = 0, | |
| 62 | }; | |
| 63 | ||
| 64 | pub const WideGlyph = extern struct { | |
| 65 | unicode_weight: u16, | |
| 66 | attributes: WideGlyphAttributes, | |
| 67 | glyph_col_1: [19]u8, | |
| 68 | glyph_col_2: [19]u8, | |
| 69 | _pad: [3]u8 = [_]u8{0} ** 3, | |
| 70 | }; | |
| 71 | ||
| 72 | pub const HIIStringPackage = extern struct { | |
| 73 | header: HIIPackageHeader, | |
| 74 | hdr_size: u32, | |
| 75 | string_info_offset: u32, | |
| 76 | language_window: [16]u16, | |
| 77 | language_name: u16, | |
| 78 | language: [3]u8, | |
| 79 | }; |
lib/std/os/uefi/protocols/hii_database_protocol.zig deleted-50| ... | ... | @@ -1,50 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Guid = uefi.Guid; | |
| 4 | const Status = uefi.Status; | |
| 5 | const hii = uefi.protocols.hii; | |
| 6 | const cc = uefi.cc; | |
| 7 | ||
| 8 | /// Database manager for HII-related data structures. | |
| 9 | pub const HIIDatabaseProtocol = extern struct { | |
| 10 | _new_package_list: Status, // TODO | |
| 11 | _remove_package_list: *const fn (*const HIIDatabaseProtocol, hii.HIIHandle) callconv(cc) Status, | |
| 12 | _update_package_list: *const fn (*const HIIDatabaseProtocol, hii.HIIHandle, *const hii.HIIPackageList) callconv(cc) Status, | |
| 13 | _list_package_lists: *const fn (*const HIIDatabaseProtocol, u8, ?*const Guid, *usize, [*]hii.HIIHandle) callconv(cc) Status, | |
| 14 | _export_package_lists: *const fn (*const HIIDatabaseProtocol, ?hii.HIIHandle, *usize, *hii.HIIPackageList) callconv(cc) Status, | |
| 15 | _register_package_notify: Status, // TODO | |
| 16 | _unregister_package_notify: Status, // TODO | |
| 17 | _find_keyboard_layouts: Status, // TODO | |
| 18 | _get_keyboard_layout: Status, // TODO | |
| 19 | _set_keyboard_layout: Status, // TODO | |
| 20 | _get_package_list_handle: Status, // TODO | |
| 21 | ||
| 22 | /// Removes a package list from the HII database. | |
| 23 | pub fn removePackageList(self: *const HIIDatabaseProtocol, handle: hii.HIIHandle) Status { | |
| 24 | return self._remove_package_list(self, handle); | |
| 25 | } | |
| 26 | ||
| 27 | /// Update a package list in the HII database. | |
| 28 | pub fn updatePackageList(self: *const HIIDatabaseProtocol, handle: hii.HIIHandle, buffer: *const hii.HIIPackageList) Status { | |
| 29 | return self._update_package_list(self, handle, buffer); | |
| 30 | } | |
| 31 | ||
| 32 | /// Determines the handles that are currently active in the database. | |
| 33 | pub fn listPackageLists(self: *const HIIDatabaseProtocol, package_type: u8, package_guid: ?*const Guid, buffer_length: *usize, handles: [*]hii.HIIHandle) Status { | |
| 34 | return self._list_package_lists(self, package_type, package_guid, buffer_length, handles); | |
| 35 | } | |
| 36 | ||
| 37 | /// Exports the contents of one or all package lists in the HII database into a buffer. | |
| 38 | pub fn exportPackageLists(self: *const HIIDatabaseProtocol, handle: ?hii.HIIHandle, buffer_size: *usize, buffer: *hii.HIIPackageList) Status { | |
| 39 | return self._export_package_lists(self, handle, buffer_size, buffer); | |
| 40 | } | |
| 41 | ||
| 42 | pub const guid align(8) = Guid{ | |
| 43 | .time_low = 0xef9fc172, | |
| 44 | .time_mid = 0xa1b2, | |
| 45 | .time_high_and_version = 0x4693, | |
| 46 | .clock_seq_high_and_reserved = 0xb3, | |
| 47 | .clock_seq_low = 0x27, | |
| 48 | .node = [_]u8{ 0x6d, 0x32, 0xfc, 0x41, 0x60, 0x42 }, | |
| 49 | }; | |
| 50 | }; |
lib/std/os/uefi/protocols/hii_popup_protocol.zig deleted-46| ... | ... | @@ -1,46 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Guid = uefi.Guid; | |
| 4 | const Status = uefi.Status; | |
| 5 | const hii = uefi.protocols.hii; | |
| 6 | const cc = uefi.cc; | |
| 7 | ||
| 8 | /// Display a popup window | |
| 9 | pub const HIIPopupProtocol = extern struct { | |
| 10 | revision: u64, | |
| 11 | _create_popup: *const fn (*const HIIPopupProtocol, HIIPopupStyle, HIIPopupType, hii.HIIHandle, u16, ?*HIIPopupSelection) callconv(cc) Status, | |
| 12 | ||
| 13 | /// Displays a popup window. | |
| 14 | pub fn createPopup(self: *const HIIPopupProtocol, style: HIIPopupStyle, popup_type: HIIPopupType, handle: hii.HIIHandle, msg: u16, user_selection: ?*HIIPopupSelection) Status { | |
| 15 | return self._create_popup(self, style, popup_type, handle, msg, user_selection); | |
| 16 | } | |
| 17 | ||
| 18 | pub const guid align(8) = Guid{ | |
| 19 | .time_low = 0x4311edc0, | |
| 20 | .time_mid = 0x6054, | |
| 21 | .time_high_and_version = 0x46d4, | |
| 22 | .clock_seq_high_and_reserved = 0x9e, | |
| 23 | .clock_seq_low = 0x40, | |
| 24 | .node = [_]u8{ 0x89, 0x3e, 0xa9, 0x52, 0xfc, 0xcc }, | |
| 25 | }; | |
| 26 | }; | |
| 27 | ||
| 28 | pub const HIIPopupStyle = enum(u32) { | |
| 29 | Info, | |
| 30 | Warning, | |
| 31 | Error, | |
| 32 | }; | |
| 33 | ||
| 34 | pub const HIIPopupType = enum(u32) { | |
| 35 | Ok, | |
| 36 | Cancel, | |
| 37 | YesNo, | |
| 38 | YesNoCancel, | |
| 39 | }; | |
| 40 | ||
| 41 | pub const HIIPopupSelection = enum(u32) { | |
| 42 | Ok, | |
| 43 | Cancel, | |
| 44 | Yes, | |
| 45 | No, | |
| 46 | }; |
lib/std/os/uefi/protocols/ip6_config_protocol.zig deleted-48| ... | ... | @@ -1,48 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Guid = uefi.Guid; | |
| 4 | const Event = uefi.Event; | |
| 5 | const Status = uefi.Status; | |
| 6 | const cc = uefi.cc; | |
| 7 | ||
| 8 | pub const Ip6ConfigProtocol = extern struct { | |
| 9 | _set_data: *const fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, usize, *const anyopaque) callconv(cc) Status, | |
| 10 | _get_data: *const fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, *usize, ?*const anyopaque) callconv(cc) Status, | |
| 11 | _register_data_notify: *const fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) callconv(cc) Status, | |
| 12 | _unregister_data_notify: *const fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) callconv(cc) Status, | |
| 13 | ||
| 14 | pub fn setData(self: *const Ip6ConfigProtocol, data_type: Ip6ConfigDataType, data_size: usize, data: *const anyopaque) Status { | |
| 15 | return self._set_data(self, data_type, data_size, data); | |
| 16 | } | |
| 17 | ||
| 18 | pub fn getData(self: *const Ip6ConfigProtocol, data_type: Ip6ConfigDataType, data_size: *usize, data: ?*const anyopaque) Status { | |
| 19 | return self._get_data(self, data_type, data_size, data); | |
| 20 | } | |
| 21 | ||
| 22 | pub fn registerDataNotify(self: *const Ip6ConfigProtocol, data_type: Ip6ConfigDataType, event: Event) Status { | |
| 23 | return self._register_data_notify(self, data_type, event); | |
| 24 | } | |
| 25 | ||
| 26 | pub fn unregisterDataNotify(self: *const Ip6ConfigProtocol, data_type: Ip6ConfigDataType, event: Event) Status { | |
| 27 | return self._unregister_data_notify(self, data_type, event); | |
| 28 | } | |
| 29 | ||
| 30 | pub const guid align(8) = Guid{ | |
| 31 | .time_low = 0x937fe521, | |
| 32 | .time_mid = 0x95ae, | |
| 33 | .time_high_and_version = 0x4d1a, | |
| 34 | .clock_seq_high_and_reserved = 0x89, | |
| 35 | .clock_seq_low = 0x29, | |
| 36 | .node = [_]u8{ 0x48, 0xbc, 0xd9, 0x0a, 0xd3, 0x1a }, | |
| 37 | }; | |
| 38 | }; | |
| 39 | ||
| 40 | pub const Ip6ConfigDataType = enum(u32) { | |
| 41 | InterfaceInfo, | |
| 42 | AltInterfaceId, | |
| 43 | Policy, | |
| 44 | DupAddrDetectTransmits, | |
| 45 | ManualAddress, | |
| 46 | Gateway, | |
| 47 | DnsServer, | |
| 48 | }; |
lib/std/os/uefi/protocols/ip6_protocol.zig deleted-146| ... | ... | @@ -1,146 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Guid = uefi.Guid; | |
| 4 | const Event = uefi.Event; | |
| 5 | const Status = uefi.Status; | |
| 6 | const MacAddress = uefi.protocols.MacAddress; | |
| 7 | const ManagedNetworkConfigData = uefi.protocols.ManagedNetworkConfigData; | |
| 8 | const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode; | |
| 9 | const cc = uefi.cc; | |
| 10 | ||
| 11 | pub const Ip6Protocol = extern struct { | |
| 12 | _get_mode_data: *const fn (*const Ip6Protocol, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(cc) Status, | |
| 13 | _configure: *const fn (*const Ip6Protocol, ?*const Ip6ConfigData) callconv(cc) Status, | |
| 14 | _groups: *const fn (*const Ip6Protocol, bool, ?*const Ip6Address) callconv(cc) Status, | |
| 15 | _routes: *const fn (*const Ip6Protocol, bool, ?*const Ip6Address, u8, ?*const Ip6Address) callconv(cc) Status, | |
| 16 | _neighbors: *const fn (*const Ip6Protocol, bool, *const Ip6Address, ?*const MacAddress, u32, bool) callconv(cc) Status, | |
| 17 | _transmit: *const fn (*const Ip6Protocol, *Ip6CompletionToken) callconv(cc) Status, | |
| 18 | _receive: *const fn (*const Ip6Protocol, *Ip6CompletionToken) callconv(cc) Status, | |
| 19 | _cancel: *const fn (*const Ip6Protocol, ?*Ip6CompletionToken) callconv(cc) Status, | |
| 20 | _poll: *const fn (*const Ip6Protocol) callconv(cc) Status, | |
| 21 | ||
| 22 | /// Gets the current operational settings for this instance of the EFI IPv6 Protocol driver. | |
| 23 | pub fn getModeData(self: *const Ip6Protocol, ip6_mode_data: ?*Ip6ModeData, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) Status { | |
| 24 | return self._get_mode_data(self, ip6_mode_data, mnp_config_data, snp_mode_data); | |
| 25 | } | |
| 26 | ||
| 27 | /// Assign IPv6 address and other configuration parameter to this EFI IPv6 Protocol driver instance. | |
| 28 | pub fn configure(self: *const Ip6Protocol, ip6_config_data: ?*const Ip6ConfigData) Status { | |
| 29 | return self._configure(self, ip6_config_data); | |
| 30 | } | |
| 31 | ||
| 32 | /// Joins and leaves multicast groups. | |
| 33 | pub fn groups(self: *const Ip6Protocol, join_flag: bool, group_address: ?*const Ip6Address) Status { | |
| 34 | return self._groups(self, join_flag, group_address); | |
| 35 | } | |
| 36 | ||
| 37 | /// Adds and deletes routing table entries. | |
| 38 | pub fn routes(self: *const Ip6Protocol, delete_route: bool, destination: ?*const Ip6Address, prefix_length: u8, gateway_address: ?*const Ip6Address) Status { | |
| 39 | return self._routes(self, delete_route, destination, prefix_length, gateway_address); | |
| 40 | } | |
| 41 | ||
| 42 | /// Add or delete Neighbor cache entries. | |
| 43 | pub fn neighbors(self: *const Ip6Protocol, delete_flag: bool, target_ip6_address: *const Ip6Address, target_link_address: ?*const MacAddress, timeout: u32, override: bool) Status { | |
| 44 | return self._neighbors(self, delete_flag, target_ip6_address, target_link_address, timeout, override); | |
| 45 | } | |
| 46 | ||
| 47 | /// Places outgoing data packets into the transmit queue. | |
| 48 | pub fn transmit(self: *const Ip6Protocol, token: *Ip6CompletionToken) Status { | |
| 49 | return self._transmit(self, token); | |
| 50 | } | |
| 51 | ||
| 52 | /// Places a receiving request into the receiving queue. | |
| 53 | pub fn receive(self: *const Ip6Protocol, token: *Ip6CompletionToken) Status { | |
| 54 | return self._receive(self, token); | |
| 55 | } | |
| 56 | ||
| 57 | /// Abort an asynchronous transmits or receive request. | |
| 58 | pub fn cancel(self: *const Ip6Protocol, token: ?*Ip6CompletionToken) Status { | |
| 59 | return self._cancel(self, token); | |
| 60 | } | |
| 61 | ||
| 62 | /// Polls for incoming data packets and processes outgoing data packets. | |
| 63 | pub fn poll(self: *const Ip6Protocol) Status { | |
| 64 | return self._poll(self); | |
| 65 | } | |
| 66 | ||
| 67 | pub const guid align(8) = Guid{ | |
| 68 | .time_low = 0x2c8759d5, | |
| 69 | .time_mid = 0x5c2d, | |
| 70 | .time_high_and_version = 0x66ef, | |
| 71 | .clock_seq_high_and_reserved = 0x92, | |
| 72 | .clock_seq_low = 0x5f, | |
| 73 | .node = [_]u8{ 0xb6, 0x6c, 0x10, 0x19, 0x57, 0xe2 }, | |
| 74 | }; | |
| 75 | }; | |
| 76 | ||
| 77 | pub const Ip6ModeData = extern struct { | |
| 78 | is_started: bool, | |
| 79 | max_packet_size: u32, | |
| 80 | config_data: Ip6ConfigData, | |
| 81 | is_configured: bool, | |
| 82 | address_count: u32, | |
| 83 | address_list: [*]Ip6AddressInfo, | |
| 84 | group_count: u32, | |
| 85 | group_table: [*]Ip6Address, | |
| 86 | route_count: u32, | |
| 87 | route_table: [*]Ip6RouteTable, | |
| 88 | neighbor_count: u32, | |
| 89 | neighbor_cache: [*]Ip6NeighborCache, | |
| 90 | prefix_count: u32, | |
| 91 | prefix_table: [*]Ip6AddressInfo, | |
| 92 | icmp_type_count: u32, | |
| 93 | icmp_type_list: [*]Ip6IcmpType, | |
| 94 | }; | |
| 95 | ||
| 96 | pub const Ip6ConfigData = extern struct { | |
| 97 | default_protocol: u8, | |
| 98 | accept_any_protocol: bool, | |
| 99 | accept_icmp_errors: bool, | |
| 100 | accept_promiscuous: bool, | |
| 101 | destination_address: Ip6Address, | |
| 102 | station_address: Ip6Address, | |
| 103 | traffic_class: u8, | |
| 104 | hop_limit: u8, | |
| 105 | flow_label: u32, | |
| 106 | receive_timeout: u32, | |
| 107 | transmit_timeout: u32, | |
| 108 | }; | |
| 109 | ||
| 110 | pub const Ip6Address = [16]u8; | |
| 111 | ||
| 112 | pub const Ip6AddressInfo = extern struct { | |
| 113 | address: Ip6Address, | |
| 114 | prefix_length: u8, | |
| 115 | }; | |
| 116 | ||
| 117 | pub const Ip6RouteTable = extern struct { | |
| 118 | gateway: Ip6Address, | |
| 119 | destination: Ip6Address, | |
| 120 | prefix_length: u8, | |
| 121 | }; | |
| 122 | ||
| 123 | pub const Ip6NeighborState = enum(u32) { | |
| 124 | Incomplete, | |
| 125 | Reachable, | |
| 126 | Stale, | |
| 127 | Delay, | |
| 128 | Probe, | |
| 129 | }; | |
| 130 | ||
| 131 | pub const Ip6NeighborCache = extern struct { | |
| 132 | neighbor: Ip6Address, | |
| 133 | link_address: MacAddress, | |
| 134 | state: Ip6NeighborState, | |
| 135 | }; | |
| 136 | ||
| 137 | pub const Ip6IcmpType = extern struct { | |
| 138 | type: u8, | |
| 139 | code: u8, | |
| 140 | }; | |
| 141 | ||
| 142 | pub const Ip6CompletionToken = extern struct { | |
| 143 | event: Event, | |
| 144 | status: Status, | |
| 145 | packet: *anyopaque, // union TODO | |
| 146 | }; |
lib/std/os/uefi/protocols/ip6_service_binding_protocol.zig deleted-28| ... | ... | @@ -1,28 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Handle = uefi.Handle; | |
| 4 | const Guid = uefi.Guid; | |
| 5 | const Status = uefi.Status; | |
| 6 | const cc = uefi.cc; | |
| 7 | ||
| 8 | pub const Ip6ServiceBindingProtocol = extern struct { | |
| 9 | _create_child: *const fn (*const Ip6ServiceBindingProtocol, *?Handle) callconv(cc) Status, | |
| 10 | _destroy_child: *const fn (*const Ip6ServiceBindingProtocol, Handle) callconv(cc) Status, | |
| 11 | ||
| 12 | pub fn createChild(self: *const Ip6ServiceBindingProtocol, handle: *?Handle) Status { | |
| 13 | return self._create_child(self, handle); | |
| 14 | } | |
| 15 | ||
| 16 | pub fn destroyChild(self: *const Ip6ServiceBindingProtocol, handle: Handle) Status { | |
| 17 | return self._destroy_child(self, handle); | |
| 18 | } | |
| 19 | ||
| 20 | pub const guid align(8) = Guid{ | |
| 21 | .time_low = 0xec835dd3, | |
| 22 | .time_mid = 0xfe0f, | |
| 23 | .time_high_and_version = 0x617b, | |
| 24 | .clock_seq_high_and_reserved = 0xa6, | |
| 25 | .clock_seq_low = 0x21, | |
| 26 | .node = [_]u8{ 0xb3, 0x50, 0xc3, 0xe1, 0x33, 0x88 }, | |
| 27 | }; | |
| 28 | }; |
lib/std/os/uefi/protocols/loaded_image_protocol.zig deleted-48| ... | ... | @@ -1,48 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Guid = uefi.Guid; | |
| 4 | const Handle = uefi.Handle; | |
| 5 | const Status = uefi.Status; | |
| 6 | const SystemTable = uefi.tables.SystemTable; | |
| 7 | const MemoryType = uefi.tables.MemoryType; | |
| 8 | const DevicePathProtocol = uefi.protocols.DevicePathProtocol; | |
| 9 | const cc = uefi.cc; | |
| 10 | ||
| 11 | pub const LoadedImageProtocol = extern struct { | |
| 12 | revision: u32, | |
| 13 | parent_handle: Handle, | |
| 14 | system_table: *SystemTable, | |
| 15 | device_handle: ?Handle, | |
| 16 | file_path: *DevicePathProtocol, | |
| 17 | reserved: *anyopaque, | |
| 18 | load_options_size: u32, | |
| 19 | load_options: ?*anyopaque, | |
| 20 | image_base: [*]u8, | |
| 21 | image_size: u64, | |
| 22 | image_code_type: MemoryType, | |
| 23 | image_data_type: MemoryType, | |
| 24 | _unload: *const fn (*const LoadedImageProtocol, Handle) callconv(cc) Status, | |
| 25 | ||
| 26 | /// Unloads an image from memory. | |
| 27 | pub fn unload(self: *const LoadedImageProtocol, handle: Handle) Status { | |
| 28 | return self._unload(self, handle); | |
| 29 | } | |
| 30 | ||
| 31 | pub const guid align(8) = Guid{ | |
| 32 | .time_low = 0x5b1b31a1, | |
| 33 | .time_mid = 0x9562, | |
| 34 | .time_high_and_version = 0x11d2, | |
| 35 | .clock_seq_high_and_reserved = 0x8e, | |
| 36 | .clock_seq_low = 0x3f, | |
| 37 | .node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b }, | |
| 38 | }; | |
| 39 | }; | |
| 40 | ||
| 41 | pub const loaded_image_device_path_protocol_guid align(8) = Guid{ | |
| 42 | .time_low = 0xbc62157e, | |
| 43 | .time_mid = 0x3e33, | |
| 44 | .time_high_and_version = 0x4fec, | |
| 45 | .clock_seq_high_and_reserved = 0x99, | |
| 46 | .clock_seq_low = 0x20, | |
| 47 | .node = [_]u8{ 0x2d, 0x3b, 0x36, 0xd7, 0x50, 0xdf }, | |
| 48 | }; |
lib/std/os/uefi/protocols/managed_network_protocol.zig deleted-129| ... | ... | @@ -1,129 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Guid = uefi.Guid; | |
| 4 | const Event = uefi.Event; | |
| 5 | const Status = uefi.Status; | |
| 6 | const Time = uefi.Time; | |
| 7 | const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode; | |
| 8 | const MacAddress = uefi.protocols.MacAddress; | |
| 9 | const cc = uefi.cc; | |
| 10 | ||
| 11 | pub const ManagedNetworkProtocol = extern struct { | |
| 12 | _get_mode_data: *const fn (*const ManagedNetworkProtocol, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(cc) Status, | |
| 13 | _configure: *const fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkConfigData) callconv(cc) Status, | |
| 14 | _mcast_ip_to_mac: *const fn (*const ManagedNetworkProtocol, bool, *const anyopaque, *MacAddress) callconv(cc) Status, | |
| 15 | _groups: *const fn (*const ManagedNetworkProtocol, bool, ?*const MacAddress) callconv(cc) Status, | |
| 16 | _transmit: *const fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) callconv(cc) Status, | |
| 17 | _receive: *const fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) callconv(cc) Status, | |
| 18 | _cancel: *const fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkCompletionToken) callconv(cc) Status, | |
| 19 | _poll: *const fn (*const ManagedNetworkProtocol) callconv(cc) Status, | |
| 20 | ||
| 21 | /// Returns the operational parameters for the current MNP child driver. | |
| 22 | /// May also support returning the underlying SNP driver mode data. | |
| 23 | pub fn getModeData(self: *const ManagedNetworkProtocol, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) Status { | |
| 24 | return self._get_mode_data(self, mnp_config_data, snp_mode_data); | |
| 25 | } | |
| 26 | ||
| 27 | /// Sets or clears the operational parameters for the MNP child driver. | |
| 28 | pub fn configure(self: *const ManagedNetworkProtocol, mnp_config_data: ?*const ManagedNetworkConfigData) Status { | |
| 29 | return self._configure(self, mnp_config_data); | |
| 30 | } | |
| 31 | ||
| 32 | /// Translates an IP multicast address to a hardware (MAC) multicast address. | |
| 33 | /// This function may be unsupported in some MNP implementations. | |
| 34 | pub fn mcastIpToMac(self: *const ManagedNetworkProtocol, ipv6flag: bool, ipaddress: *const anyopaque, mac_address: *MacAddress) Status { | |
| 35 | return self._mcast_ip_to_mac(self, ipv6flag, ipaddress, mac_address); | |
| 36 | } | |
| 37 | ||
| 38 | /// Enables and disables receive filters for multicast address. | |
| 39 | /// This function may be unsupported in some MNP implementations. | |
| 40 | pub fn groups(self: *const ManagedNetworkProtocol, join_flag: bool, mac_address: ?*const MacAddress) Status { | |
| 41 | return self._groups(self, join_flag, mac_address); | |
| 42 | } | |
| 43 | ||
| 44 | /// Places asynchronous outgoing data packets into the transmit queue. | |
| 45 | pub fn transmit(self: *const ManagedNetworkProtocol, token: *const ManagedNetworkCompletionToken) Status { | |
| 46 | return self._transmit(self, token); | |
| 47 | } | |
| 48 | ||
| 49 | /// Places an asynchronous receiving request into the receiving queue. | |
| 50 | pub fn receive(self: *const ManagedNetworkProtocol, token: *const ManagedNetworkCompletionToken) Status { | |
| 51 | return self._receive(self, token); | |
| 52 | } | |
| 53 | ||
| 54 | /// Aborts an asynchronous transmit or receive request. | |
| 55 | pub fn cancel(self: *const ManagedNetworkProtocol, token: ?*const ManagedNetworkCompletionToken) Status { | |
| 56 | return self._cancel(self, token); | |
| 57 | } | |
| 58 | ||
| 59 | /// Polls for incoming data packets and processes outgoing data packets. | |
| 60 | pub fn poll(self: *const ManagedNetworkProtocol) Status { | |
| 61 | return self._poll(self); | |
| 62 | } | |
| 63 | ||
| 64 | pub const guid align(8) = Guid{ | |
| 65 | .time_low = 0x7ab33a91, | |
| 66 | .time_mid = 0xace5, | |
| 67 | .time_high_and_version = 0x4326, | |
| 68 | .clock_seq_high_and_reserved = 0xb5, | |
| 69 | .clock_seq_low = 0x72, | |
| 70 | .node = [_]u8{ 0xe7, 0xee, 0x33, 0xd3, 0x9f, 0x16 }, | |
| 71 | }; | |
| 72 | }; | |
| 73 | ||
| 74 | pub const ManagedNetworkConfigData = extern struct { | |
| 75 | received_queue_timeout_value: u32, | |
| 76 | transmit_queue_timeout_value: u32, | |
| 77 | protocol_type_filter: u16, | |
| 78 | enable_unicast_receive: bool, | |
| 79 | enable_multicast_receive: bool, | |
| 80 | enable_broadcast_receive: bool, | |
| 81 | enable_promiscuous_receive: bool, | |
| 82 | flush_queues_on_reset: bool, | |
| 83 | enable_receive_timestamps: bool, | |
| 84 | disable_background_polling: bool, | |
| 85 | }; | |
| 86 | ||
| 87 | pub const ManagedNetworkCompletionToken = extern struct { | |
| 88 | event: Event, | |
| 89 | status: Status, | |
| 90 | packet: extern union { | |
| 91 | RxData: *ManagedNetworkReceiveData, | |
| 92 | TxData: *ManagedNetworkTransmitData, | |
| 93 | }, | |
| 94 | }; | |
| 95 | ||
| 96 | pub const ManagedNetworkReceiveData = extern struct { | |
| 97 | timestamp: Time, | |
| 98 | recycle_event: Event, | |
| 99 | packet_length: u32, | |
| 100 | header_length: u32, | |
| 101 | address_length: u32, | |
| 102 | data_length: u32, | |
| 103 | broadcast_flag: bool, | |
| 104 | multicast_flag: bool, | |
| 105 | promiscuous_flag: bool, | |
| 106 | protocol_type: u16, | |
| 107 | destination_address: [*]u8, | |
| 108 | source_address: [*]u8, | |
| 109 | media_header: [*]u8, | |
| 110 | packet_data: [*]u8, | |
| 111 | }; | |
| 112 | ||
| 113 | pub const ManagedNetworkTransmitData = extern struct { | |
| 114 | destination_address: ?*MacAddress, | |
| 115 | source_address: ?*MacAddress, | |
| 116 | protocol_type: u16, | |
| 117 | data_length: u32, | |
| 118 | header_length: u16, | |
| 119 | fragment_count: u16, | |
| 120 | ||
| 121 | pub fn getFragments(self: *ManagedNetworkTransmitData) []ManagedNetworkFragmentData { | |
| 122 | return @as([*]ManagedNetworkFragmentData, @ptrCast(@alignCast(@as([*]u8, @ptrCast(self)) + @sizeOf(ManagedNetworkTransmitData))))[0..self.fragment_count]; | |
| 123 | } | |
| 124 | }; | |
| 125 | ||
| 126 | pub const ManagedNetworkFragmentData = extern struct { | |
| 127 | fragment_length: u32, | |
| 128 | fragment_buffer: [*]u8, | |
| 129 | }; |
lib/std/os/uefi/protocols/managed_network_service_binding_protocol.zig deleted-28| ... | ... | @@ -1,28 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Handle = uefi.Handle; | |
| 4 | const Guid = uefi.Guid; | |
| 5 | const Status = uefi.Status; | |
| 6 | const cc = uefi.cc; | |
| 7 | ||
| 8 | pub const ManagedNetworkServiceBindingProtocol = extern struct { | |
| 9 | _create_child: *const fn (*const ManagedNetworkServiceBindingProtocol, *?Handle) callconv(cc) Status, | |
| 10 | _destroy_child: *const fn (*const ManagedNetworkServiceBindingProtocol, Handle) callconv(cc) Status, | |
| 11 | ||
| 12 | pub fn createChild(self: *const ManagedNetworkServiceBindingProtocol, handle: *?Handle) Status { | |
| 13 | return self._create_child(self, handle); | |
| 14 | } | |
| 15 | ||
| 16 | pub fn destroyChild(self: *const ManagedNetworkServiceBindingProtocol, handle: Handle) Status { | |
| 17 | return self._destroy_child(self, handle); | |
| 18 | } | |
| 19 | ||
| 20 | pub const guid align(8) = Guid{ | |
| 21 | .time_low = 0xf36ff770, | |
| 22 | .time_mid = 0xa7e1, | |
| 23 | .time_high_and_version = 0x42cf, | |
| 24 | .clock_seq_high_and_reserved = 0x9e, | |
| 25 | .clock_seq_low = 0xd2, | |
| 26 | .node = [_]u8{ 0x56, 0xf0, 0xf2, 0x71, 0xf4, 0x4c }, | |
| 27 | }; | |
| 28 | }; |
lib/std/os/uefi/protocols/rng_protocol.zig deleted-78| ... | ... | @@ -1,78 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Guid = uefi.Guid; | |
| 4 | const Status = uefi.Status; | |
| 5 | const cc = uefi.cc; | |
| 6 | ||
| 7 | /// Random Number Generator protocol | |
| 8 | pub const RNGProtocol = extern struct { | |
| 9 | _get_info: *const fn (*const RNGProtocol, *usize, [*]align(8) Guid) callconv(cc) Status, | |
| 10 | _get_rng: *const fn (*const RNGProtocol, ?*align(8) const Guid, usize, [*]u8) callconv(cc) Status, | |
| 11 | ||
| 12 | /// Returns information about the random number generation implementation. | |
| 13 | pub fn getInfo(self: *const RNGProtocol, list_size: *usize, list: [*]align(8) Guid) Status { | |
| 14 | return self._get_info(self, list_size, list); | |
| 15 | } | |
| 16 | ||
| 17 | /// Produces and returns an RNG value using either the default or specified RNG algorithm. | |
| 18 | pub fn getRNG(self: *const RNGProtocol, algo: ?*align(8) const Guid, value_length: usize, value: [*]u8) Status { | |
| 19 | return self._get_rng(self, algo, value_length, value); | |
| 20 | } | |
| 21 | ||
| 22 | pub const guid align(8) = Guid{ | |
| 23 | .time_low = 0x3152bca5, | |
| 24 | .time_mid = 0xeade, | |
| 25 | .time_high_and_version = 0x433d, | |
| 26 | .clock_seq_high_and_reserved = 0x86, | |
| 27 | .clock_seq_low = 0x2e, | |
| 28 | .node = [_]u8{ 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44 }, | |
| 29 | }; | |
| 30 | pub const algorithm_sp800_90_hash_256 align(8) = Guid{ | |
| 31 | .time_low = 0xa7af67cb, | |
| 32 | .time_mid = 0x603b, | |
| 33 | .time_high_and_version = 0x4d42, | |
| 34 | .clock_seq_high_and_reserved = 0xba, | |
| 35 | .clock_seq_low = 0x21, | |
| 36 | .node = [_]u8{ 0x70, 0xbf, 0xb6, 0x29, 0x3f, 0x96 }, | |
| 37 | }; | |
| 38 | pub const algorithm_sp800_90_hmac_256 align(8) = Guid{ | |
| 39 | .time_low = 0xc5149b43, | |
| 40 | .time_mid = 0xae85, | |
| 41 | .time_high_and_version = 0x4f53, | |
| 42 | .clock_seq_high_and_reserved = 0x99, | |
| 43 | .clock_seq_low = 0x82, | |
| 44 | .node = [_]u8{ 0xb9, 0x43, 0x35, 0xd3, 0xa9, 0xe7 }, | |
| 45 | }; | |
| 46 | pub const algorithm_sp800_90_ctr_256 align(8) = Guid{ | |
| 47 | .time_low = 0x44f0de6e, | |
| 48 | .time_mid = 0x4d8c, | |
| 49 | .time_high_and_version = 0x4045, | |
| 50 | .clock_seq_high_and_reserved = 0xa8, | |
| 51 | .clock_seq_low = 0xc7, | |
| 52 | .node = [_]u8{ 0x4d, 0xd1, 0x68, 0x85, 0x6b, 0x9e }, | |
| 53 | }; | |
| 54 | pub const algorithm_x9_31_3des align(8) = Guid{ | |
| 55 | .time_low = 0x63c4785a, | |
| 56 | .time_mid = 0xca34, | |
| 57 | .time_high_and_version = 0x4012, | |
| 58 | .clock_seq_high_and_reserved = 0xa3, | |
| 59 | .clock_seq_low = 0xc8, | |
| 60 | .node = [_]u8{ 0x0b, 0x6a, 0x32, 0x4f, 0x55, 0x46 }, | |
| 61 | }; | |
| 62 | pub const algorithm_x9_31_aes align(8) = Guid{ | |
| 63 | .time_low = 0xacd03321, | |
| 64 | .time_mid = 0x777e, | |
| 65 | .time_high_and_version = 0x4d3d, | |
| 66 | .clock_seq_high_and_reserved = 0xb1, | |
| 67 | .clock_seq_low = 0xc8, | |
| 68 | .node = [_]u8{ 0x20, 0xcf, 0xd8, 0x88, 0x20, 0xc9 }, | |
| 69 | }; | |
| 70 | pub const algorithm_raw align(8) = Guid{ | |
| 71 | .time_low = 0xe43176d7, | |
| 72 | .time_mid = 0xb6e8, | |
| 73 | .time_high_and_version = 0x4827, | |
| 74 | .clock_seq_high_and_reserved = 0xb7, | |
| 75 | .clock_seq_low = 0x84, | |
| 76 | .node = [_]u8{ 0x7f, 0xfd, 0xc4, 0xb6, 0x85, 0x61 }, | |
| 77 | }; | |
| 78 | }; |
lib/std/os/uefi/protocols/shell_parameters_protocol.zig deleted-20| ... | ... | @@ -1,20 +0,0 @@ |
| 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 deleted-24| ... | ... | @@ -1,24 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Guid = uefi.Guid; | |
| 4 | const FileProtocol = uefi.protocols.FileProtocol; | |
| 5 | const Status = uefi.Status; | |
| 6 | const cc = uefi.cc; | |
| 7 | ||
| 8 | pub const SimpleFileSystemProtocol = extern struct { | |
| 9 | revision: u64, | |
| 10 | _open_volume: *const fn (*const SimpleFileSystemProtocol, **const FileProtocol) callconv(cc) Status, | |
| 11 | ||
| 12 | pub fn openVolume(self: *const SimpleFileSystemProtocol, root: **const FileProtocol) Status { | |
| 13 | return self._open_volume(self, root); | |
| 14 | } | |
| 15 | ||
| 16 | pub const guid align(8) = Guid{ | |
| 17 | .time_low = 0x0964e5b22, | |
| 18 | .time_mid = 0x6459, | |
| 19 | .time_high_and_version = 0x11d2, | |
| 20 | .clock_seq_high_and_reserved = 0x8e, | |
| 21 | .clock_seq_low = 0x39, | |
| 22 | .node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b }, | |
| 23 | }; | |
| 24 | }; |
lib/std/os/uefi/protocols/simple_network_protocol.zig deleted-175| ... | ... | @@ -1,175 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Event = uefi.Event; | |
| 4 | const Guid = uefi.Guid; | |
| 5 | const Status = uefi.Status; | |
| 6 | const cc = uefi.cc; | |
| 7 | ||
| 8 | pub const SimpleNetworkProtocol = extern struct { | |
| 9 | revision: u64, | |
| 10 | _start: *const fn (*const SimpleNetworkProtocol) callconv(cc) Status, | |
| 11 | _stop: *const fn (*const SimpleNetworkProtocol) callconv(cc) Status, | |
| 12 | _initialize: *const fn (*const SimpleNetworkProtocol, usize, usize) callconv(cc) Status, | |
| 13 | _reset: *const fn (*const SimpleNetworkProtocol, bool) callconv(cc) Status, | |
| 14 | _shutdown: *const fn (*const SimpleNetworkProtocol) callconv(cc) Status, | |
| 15 | _receive_filters: *const fn (*const SimpleNetworkProtocol, SimpleNetworkReceiveFilter, SimpleNetworkReceiveFilter, bool, usize, ?[*]const MacAddress) callconv(cc) Status, | |
| 16 | _station_address: *const fn (*const SimpleNetworkProtocol, bool, ?*const MacAddress) callconv(cc) Status, | |
| 17 | _statistics: *const fn (*const SimpleNetworkProtocol, bool, ?*usize, ?*NetworkStatistics) callconv(cc) Status, | |
| 18 | _mcast_ip_to_mac: *const fn (*const SimpleNetworkProtocol, bool, *const anyopaque, *MacAddress) callconv(cc) Status, | |
| 19 | _nvdata: *const fn (*const SimpleNetworkProtocol, bool, usize, usize, [*]u8) callconv(cc) Status, | |
| 20 | _get_status: *const fn (*const SimpleNetworkProtocol, *SimpleNetworkInterruptStatus, ?*?[*]u8) callconv(cc) Status, | |
| 21 | _transmit: *const fn (*const SimpleNetworkProtocol, usize, usize, [*]const u8, ?*const MacAddress, ?*const MacAddress, ?*const u16) callconv(cc) Status, | |
| 22 | _receive: *const fn (*const SimpleNetworkProtocol, ?*usize, *usize, [*]u8, ?*MacAddress, ?*MacAddress, ?*u16) callconv(cc) Status, | |
| 23 | wait_for_packet: Event, | |
| 24 | mode: *SimpleNetworkMode, | |
| 25 | ||
| 26 | /// Changes the state of a network interface from "stopped" to "started". | |
| 27 | pub fn start(self: *const SimpleNetworkProtocol) Status { | |
| 28 | return self._start(self); | |
| 29 | } | |
| 30 | ||
| 31 | /// Changes the state of a network interface from "started" to "stopped". | |
| 32 | pub fn stop(self: *const SimpleNetworkProtocol) Status { | |
| 33 | return self._stop(self); | |
| 34 | } | |
| 35 | ||
| 36 | /// Resets a network adapter and allocates the transmit and receive buffers required by the network interface. | |
| 37 | pub fn initialize(self: *const SimpleNetworkProtocol, extra_rx_buffer_size: usize, extra_tx_buffer_size: usize) Status { | |
| 38 | return self._initialize(self, extra_rx_buffer_size, extra_tx_buffer_size); | |
| 39 | } | |
| 40 | ||
| 41 | /// Resets a network adapter and reinitializes it with the parameters that were provided in the previous call to initialize(). | |
| 42 | pub fn reset(self: *const SimpleNetworkProtocol, extended_verification: bool) Status { | |
| 43 | return self._reset(self, extended_verification); | |
| 44 | } | |
| 45 | ||
| 46 | /// Resets a network adapter and leaves it in a state that is safe for another driver to initialize. | |
| 47 | pub fn shutdown(self: *const SimpleNetworkProtocol) Status { | |
| 48 | return self._shutdown(self); | |
| 49 | } | |
| 50 | ||
| 51 | /// Manages the multicast receive filters of a network interface. | |
| 52 | pub fn receiveFilters(self: *const SimpleNetworkProtocol, enable: SimpleNetworkReceiveFilter, disable: SimpleNetworkReceiveFilter, reset_mcast_filter: bool, mcast_filter_cnt: usize, mcast_filter: ?[*]const MacAddress) Status { | |
| 53 | return self._receive_filters(self, enable, disable, reset_mcast_filter, mcast_filter_cnt, mcast_filter); | |
| 54 | } | |
| 55 | ||
| 56 | /// Modifies or resets the current station address, if supported. | |
| 57 | pub fn stationAddress(self: *const SimpleNetworkProtocol, reset_flag: bool, new: ?*const MacAddress) Status { | |
| 58 | return self._station_address(self, reset_flag, new); | |
| 59 | } | |
| 60 | ||
| 61 | /// Resets or collects the statistics on a network interface. | |
| 62 | pub fn statistics(self: *const SimpleNetworkProtocol, reset_flag: bool, statistics_size: ?*usize, statistics_table: ?*NetworkStatistics) Status { | |
| 63 | return self._statistics(self, reset_flag, statistics_size, statistics_table); | |
| 64 | } | |
| 65 | ||
| 66 | /// Converts a multicast IP address to a multicast HW MAC address. | |
| 67 | pub fn mcastIpToMac(self: *const SimpleNetworkProtocol, ipv6: bool, ip: *const anyopaque, mac: *MacAddress) Status { | |
| 68 | return self._mcast_ip_to_mac(self, ipv6, ip, mac); | |
| 69 | } | |
| 70 | ||
| 71 | /// Performs read and write operations on the NVRAM device attached to a network interface. | |
| 72 | pub fn nvdata(self: *const SimpleNetworkProtocol, read_write: bool, offset: usize, buffer_size: usize, buffer: [*]u8) Status { | |
| 73 | return self._nvdata(self, read_write, offset, buffer_size, buffer); | |
| 74 | } | |
| 75 | ||
| 76 | /// Reads the current interrupt status and recycled transmit buffer status from a network interface. | |
| 77 | pub fn getStatus(self: *const SimpleNetworkProtocol, interrupt_status: *SimpleNetworkInterruptStatus, tx_buf: ?*?[*]u8) Status { | |
| 78 | return self._get_status(self, interrupt_status, tx_buf); | |
| 79 | } | |
| 80 | ||
| 81 | /// Places a packet in the transmit queue of a network interface. | |
| 82 | 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 { | |
| 83 | return self._transmit(self, header_size, buffer_size, buffer, src_addr, dest_addr, protocol); | |
| 84 | } | |
| 85 | ||
| 86 | /// Receives a packet from a network interface. | |
| 87 | pub fn receive(self: *const SimpleNetworkProtocol, header_size: ?*usize, buffer_size: *usize, buffer: [*]u8, src_addr: ?*MacAddress, dest_addr: ?*MacAddress, protocol: ?*u16) Status { | |
| 88 | return self._receive(self, header_size, buffer_size, buffer, src_addr, dest_addr, protocol); | |
| 89 | } | |
| 90 | ||
| 91 | pub const guid align(8) = Guid{ | |
| 92 | .time_low = 0xa19832b9, | |
| 93 | .time_mid = 0xac25, | |
| 94 | .time_high_and_version = 0x11d3, | |
| 95 | .clock_seq_high_and_reserved = 0x9a, | |
| 96 | .clock_seq_low = 0x2d, | |
| 97 | .node = [_]u8{ 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d }, | |
| 98 | }; | |
| 99 | }; | |
| 100 | ||
| 101 | pub const MacAddress = [32]u8; | |
| 102 | ||
| 103 | pub const SimpleNetworkMode = extern struct { | |
| 104 | state: SimpleNetworkState, | |
| 105 | hw_address_size: u32, | |
| 106 | media_header_size: u32, | |
| 107 | max_packet_size: u32, | |
| 108 | nvram_size: u32, | |
| 109 | nvram_access_size: u32, | |
| 110 | receive_filter_mask: SimpleNetworkReceiveFilter, | |
| 111 | receive_filter_setting: SimpleNetworkReceiveFilter, | |
| 112 | max_mcast_filter_count: u32, | |
| 113 | mcast_filter_count: u32, | |
| 114 | mcast_filter: [16]MacAddress, | |
| 115 | current_address: MacAddress, | |
| 116 | broadcast_address: MacAddress, | |
| 117 | permanent_address: MacAddress, | |
| 118 | if_type: u8, | |
| 119 | mac_address_changeable: bool, | |
| 120 | multiple_tx_supported: bool, | |
| 121 | media_present_supported: bool, | |
| 122 | media_present: bool, | |
| 123 | }; | |
| 124 | ||
| 125 | pub const SimpleNetworkReceiveFilter = packed struct(u32) { | |
| 126 | receive_unicast: bool, | |
| 127 | receive_multicast: bool, | |
| 128 | receive_broadcast: bool, | |
| 129 | receive_promiscuous: bool, | |
| 130 | receive_promiscuous_multicast: bool, | |
| 131 | _pad: u27 = 0, | |
| 132 | }; | |
| 133 | ||
| 134 | pub const SimpleNetworkState = enum(u32) { | |
| 135 | Stopped, | |
| 136 | Started, | |
| 137 | Initialized, | |
| 138 | }; | |
| 139 | ||
| 140 | pub const NetworkStatistics = extern struct { | |
| 141 | rx_total_frames: u64, | |
| 142 | rx_good_frames: u64, | |
| 143 | rx_undersize_frames: u64, | |
| 144 | rx_oversize_frames: u64, | |
| 145 | rx_dropped_frames: u64, | |
| 146 | rx_unicast_frames: u64, | |
| 147 | rx_broadcast_frames: u64, | |
| 148 | rx_multicast_frames: u64, | |
| 149 | rx_crc_error_frames: u64, | |
| 150 | rx_total_bytes: u64, | |
| 151 | tx_total_frames: u64, | |
| 152 | tx_good_frames: u64, | |
| 153 | tx_undersize_frames: u64, | |
| 154 | tx_oversize_frames: u64, | |
| 155 | tx_dropped_frames: u64, | |
| 156 | tx_unicast_frames: u64, | |
| 157 | tx_broadcast_frames: u64, | |
| 158 | tx_multicast_frames: u64, | |
| 159 | tx_crc_error_frames: u64, | |
| 160 | tx_total_bytes: u64, | |
| 161 | collisions: u64, | |
| 162 | unsupported_protocol: u64, | |
| 163 | rx_duplicated_frames: u64, | |
| 164 | rx_decryptError_frames: u64, | |
| 165 | tx_error_frames: u64, | |
| 166 | tx_retry_frames: u64, | |
| 167 | }; | |
| 168 | ||
| 169 | pub const SimpleNetworkInterruptStatus = packed struct(u32) { | |
| 170 | receive_interrupt: bool, | |
| 171 | transmit_interrupt: bool, | |
| 172 | command_interrupt: bool, | |
| 173 | software_interrupt: bool, | |
| 174 | _pad: u28 = 0, | |
| 175 | }; |
lib/std/os/uefi/protocols/simple_pointer_protocol.zig deleted-49| ... | ... | @@ -1,49 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Event = uefi.Event; | |
| 4 | const Guid = uefi.Guid; | |
| 5 | const Status = uefi.Status; | |
| 6 | const cc = uefi.cc; | |
| 7 | ||
| 8 | /// Protocol for mice | |
| 9 | pub const SimplePointerProtocol = struct { | |
| 10 | _reset: *const fn (*const SimplePointerProtocol, bool) callconv(cc) Status, | |
| 11 | _get_state: *const fn (*const SimplePointerProtocol, *SimplePointerState) callconv(cc) Status, | |
| 12 | wait_for_input: Event, | |
| 13 | mode: *SimplePointerMode, | |
| 14 | ||
| 15 | /// Resets the pointer device hardware. | |
| 16 | pub fn reset(self: *const SimplePointerProtocol, verify: bool) Status { | |
| 17 | return self._reset(self, verify); | |
| 18 | } | |
| 19 | ||
| 20 | /// Retrieves the current state of a pointer device. | |
| 21 | pub fn getState(self: *const SimplePointerProtocol, state: *SimplePointerState) Status { | |
| 22 | return self._get_state(self, state); | |
| 23 | } | |
| 24 | ||
| 25 | pub const guid align(8) = Guid{ | |
| 26 | .time_low = 0x31878c87, | |
| 27 | .time_mid = 0x0b75, | |
| 28 | .time_high_and_version = 0x11d5, | |
| 29 | .clock_seq_high_and_reserved = 0x9a, | |
| 30 | .clock_seq_low = 0x4f, | |
| 31 | .node = [_]u8{ 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d }, | |
| 32 | }; | |
| 33 | }; | |
| 34 | ||
| 35 | pub const SimplePointerMode = struct { | |
| 36 | resolution_x: u64, | |
| 37 | resolution_y: u64, | |
| 38 | resolution_z: u64, | |
| 39 | left_button: bool, | |
| 40 | right_button: bool, | |
| 41 | }; | |
| 42 | ||
| 43 | pub const SimplePointerState = struct { | |
| 44 | relative_movement_x: i32 = undefined, | |
| 45 | relative_movement_y: i32 = undefined, | |
| 46 | relative_movement_z: i32 = undefined, | |
| 47 | left_button: bool = undefined, | |
| 48 | right_button: bool = undefined, | |
| 49 | }; |
lib/std/os/uefi/protocols/simple_text_input_ex_protocol.zig deleted-89| ... | ... | @@ -1,89 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Event = uefi.Event; | |
| 4 | const Guid = uefi.Guid; | |
| 5 | const Status = uefi.Status; | |
| 6 | const cc = uefi.cc; | |
| 7 | ||
| 8 | /// Character input devices, e.g. Keyboard | |
| 9 | pub const SimpleTextInputExProtocol = extern struct { | |
| 10 | _reset: *const fn (*const SimpleTextInputExProtocol, bool) callconv(cc) Status, | |
| 11 | _read_key_stroke_ex: *const fn (*const SimpleTextInputExProtocol, *KeyData) callconv(cc) Status, | |
| 12 | wait_for_key_ex: Event, | |
| 13 | _set_state: *const fn (*const SimpleTextInputExProtocol, *const u8) callconv(cc) Status, | |
| 14 | _register_key_notify: *const fn (*const SimpleTextInputExProtocol, *const KeyData, *const fn (*const KeyData) callconv(cc) usize, **anyopaque) callconv(cc) Status, | |
| 15 | _unregister_key_notify: *const fn (*const SimpleTextInputExProtocol, *const anyopaque) callconv(cc) Status, | |
| 16 | ||
| 17 | /// Resets the input device hardware. | |
| 18 | pub fn reset(self: *const SimpleTextInputExProtocol, verify: bool) Status { | |
| 19 | return self._reset(self, verify); | |
| 20 | } | |
| 21 | ||
| 22 | /// Reads the next keystroke from the input device. | |
| 23 | pub fn readKeyStrokeEx(self: *const SimpleTextInputExProtocol, key_data: *KeyData) Status { | |
| 24 | return self._read_key_stroke_ex(self, key_data); | |
| 25 | } | |
| 26 | ||
| 27 | /// Set certain state for the input device. | |
| 28 | pub fn setState(self: *const SimpleTextInputExProtocol, state: *const u8) Status { | |
| 29 | return self._set_state(self, state); | |
| 30 | } | |
| 31 | ||
| 32 | /// Register a notification function for a particular keystroke for the input device. | |
| 33 | pub fn registerKeyNotify(self: *const SimpleTextInputExProtocol, key_data: *const KeyData, notify: *const fn (*const KeyData) callconv(cc) usize, handle: **anyopaque) Status { | |
| 34 | return self._register_key_notify(self, key_data, notify, handle); | |
| 35 | } | |
| 36 | ||
| 37 | /// Remove the notification that was previously registered. | |
| 38 | pub fn unregisterKeyNotify(self: *const SimpleTextInputExProtocol, handle: *const anyopaque) Status { | |
| 39 | return self._unregister_key_notify(self, handle); | |
| 40 | } | |
| 41 | ||
| 42 | pub const guid align(8) = Guid{ | |
| 43 | .time_low = 0xdd9e7534, | |
| 44 | .time_mid = 0x7762, | |
| 45 | .time_high_and_version = 0x4698, | |
| 46 | .clock_seq_high_and_reserved = 0x8c, | |
| 47 | .clock_seq_low = 0x14, | |
| 48 | .node = [_]u8{ 0xf5, 0x85, 0x17, 0xa6, 0x25, 0xaa }, | |
| 49 | }; | |
| 50 | }; | |
| 51 | ||
| 52 | pub const KeyData = extern struct { | |
| 53 | key: InputKey = undefined, | |
| 54 | key_state: KeyState = undefined, | |
| 55 | }; | |
| 56 | ||
| 57 | pub const KeyShiftState = packed struct(u32) { | |
| 58 | right_shift_pressed: bool, | |
| 59 | left_shift_pressed: bool, | |
| 60 | right_control_pressed: bool, | |
| 61 | left_control_pressed: bool, | |
| 62 | right_alt_pressed: bool, | |
| 63 | left_alt_pressed: bool, | |
| 64 | right_logo_pressed: bool, | |
| 65 | left_logo_pressed: bool, | |
| 66 | menu_key_pressed: bool, | |
| 67 | sys_req_pressed: bool, | |
| 68 | _pad: u21 = 0, | |
| 69 | shift_state_valid: bool, | |
| 70 | }; | |
| 71 | ||
| 72 | pub const KeyToggleState = packed struct(u8) { | |
| 73 | scroll_lock_active: bool, | |
| 74 | num_lock_active: bool, | |
| 75 | caps_lock_active: bool, | |
| 76 | _pad: u3 = 0, | |
| 77 | key_state_exposed: bool, | |
| 78 | toggle_state_valid: bool, | |
| 79 | }; | |
| 80 | ||
| 81 | pub const KeyState = extern struct { | |
| 82 | key_shift_state: KeyShiftState, | |
| 83 | key_toggle_state: KeyToggleState, | |
| 84 | }; | |
| 85 | ||
| 86 | pub const InputKey = extern struct { | |
| 87 | scan_code: u16, | |
| 88 | unicode_char: u16, | |
| 89 | }; |
lib/std/os/uefi/protocols/simple_text_input_protocol.zig deleted-33| ... | ... | @@ -1,33 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Event = uefi.Event; | |
| 4 | const Guid = uefi.Guid; | |
| 5 | const InputKey = uefi.protocols.InputKey; | |
| 6 | const Status = uefi.Status; | |
| 7 | const cc = uefi.cc; | |
| 8 | ||
| 9 | /// Character input devices, e.g. Keyboard | |
| 10 | pub const SimpleTextInputProtocol = extern struct { | |
| 11 | _reset: *const fn (*const SimpleTextInputProtocol, bool) callconv(cc) Status, | |
| 12 | _read_key_stroke: *const fn (*const SimpleTextInputProtocol, *InputKey) callconv(cc) Status, | |
| 13 | wait_for_key: Event, | |
| 14 | ||
| 15 | /// Resets the input device hardware. | |
| 16 | pub fn reset(self: *const SimpleTextInputProtocol, verify: bool) Status { | |
| 17 | return self._reset(self, verify); | |
| 18 | } | |
| 19 | ||
| 20 | /// Reads the next keystroke from the input device. | |
| 21 | pub fn readKeyStroke(self: *const SimpleTextInputProtocol, input_key: *InputKey) Status { | |
| 22 | return self._read_key_stroke(self, input_key); | |
| 23 | } | |
| 24 | ||
| 25 | pub const guid align(8) = Guid{ | |
| 26 | .time_low = 0x387477c1, | |
| 27 | .time_mid = 0x69c7, | |
| 28 | .time_high_and_version = 0x11d2, | |
| 29 | .clock_seq_high_and_reserved = 0x8e, | |
| 30 | .clock_seq_low = 0x39, | |
| 31 | .node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b }, | |
| 32 | }; | |
| 33 | }; |
lib/std/os/uefi/protocols/simple_text_output_protocol.zig deleted-155| ... | ... | @@ -1,155 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Guid = uefi.Guid; | |
| 4 | const Status = uefi.Status; | |
| 5 | const cc = uefi.cc; | |
| 6 | ||
| 7 | /// Character output devices | |
| 8 | pub const SimpleTextOutputProtocol = extern struct { | |
| 9 | _reset: *const fn (*const SimpleTextOutputProtocol, bool) callconv(cc) Status, | |
| 10 | _output_string: *const fn (*const SimpleTextOutputProtocol, [*:0]const u16) callconv(cc) Status, | |
| 11 | _test_string: *const fn (*const SimpleTextOutputProtocol, [*:0]const u16) callconv(cc) Status, | |
| 12 | _query_mode: *const fn (*const SimpleTextOutputProtocol, usize, *usize, *usize) callconv(cc) Status, | |
| 13 | _set_mode: *const fn (*const SimpleTextOutputProtocol, usize) callconv(cc) Status, | |
| 14 | _set_attribute: *const fn (*const SimpleTextOutputProtocol, usize) callconv(cc) Status, | |
| 15 | _clear_screen: *const fn (*const SimpleTextOutputProtocol) callconv(cc) Status, | |
| 16 | _set_cursor_position: *const fn (*const SimpleTextOutputProtocol, usize, usize) callconv(cc) Status, | |
| 17 | _enable_cursor: *const fn (*const SimpleTextOutputProtocol, bool) callconv(cc) Status, | |
| 18 | mode: *SimpleTextOutputMode, | |
| 19 | ||
| 20 | /// Resets the text output device hardware. | |
| 21 | pub fn reset(self: *const SimpleTextOutputProtocol, verify: bool) Status { | |
| 22 | return self._reset(self, verify); | |
| 23 | } | |
| 24 | ||
| 25 | /// Writes a string to the output device. | |
| 26 | pub fn outputString(self: *const SimpleTextOutputProtocol, msg: [*:0]const u16) Status { | |
| 27 | return self._output_string(self, msg); | |
| 28 | } | |
| 29 | ||
| 30 | /// Verifies that all characters in a string can be output to the target device. | |
| 31 | pub fn testString(self: *const SimpleTextOutputProtocol, msg: [*:0]const u16) Status { | |
| 32 | return self._test_string(self, msg); | |
| 33 | } | |
| 34 | ||
| 35 | /// Returns information for an available text mode that the output device(s) supports. | |
| 36 | pub fn queryMode(self: *const SimpleTextOutputProtocol, mode_number: usize, columns: *usize, rows: *usize) Status { | |
| 37 | return self._query_mode(self, mode_number, columns, rows); | |
| 38 | } | |
| 39 | ||
| 40 | /// Sets the output device(s) to a specified mode. | |
| 41 | pub fn setMode(self: *const SimpleTextOutputProtocol, mode_number: usize) Status { | |
| 42 | return self._set_mode(self, mode_number); | |
| 43 | } | |
| 44 | ||
| 45 | /// Sets the background and foreground colors for the outputString() and clearScreen() functions. | |
| 46 | pub fn setAttribute(self: *const SimpleTextOutputProtocol, attribute: usize) Status { | |
| 47 | return self._set_attribute(self, attribute); | |
| 48 | } | |
| 49 | ||
| 50 | /// Clears the output device(s) display to the currently selected background color. | |
| 51 | pub fn clearScreen(self: *const SimpleTextOutputProtocol) Status { | |
| 52 | return self._clear_screen(self); | |
| 53 | } | |
| 54 | ||
| 55 | /// Sets the current coordinates of the cursor position. | |
| 56 | pub fn setCursorPosition(self: *const SimpleTextOutputProtocol, column: usize, row: usize) Status { | |
| 57 | return self._set_cursor_position(self, column, row); | |
| 58 | } | |
| 59 | ||
| 60 | /// Makes the cursor visible or invisible. | |
| 61 | pub fn enableCursor(self: *const SimpleTextOutputProtocol, visible: bool) Status { | |
| 62 | return self._enable_cursor(self, visible); | |
| 63 | } | |
| 64 | ||
| 65 | pub const guid align(8) = Guid{ | |
| 66 | .time_low = 0x387477c2, | |
| 67 | .time_mid = 0x69c7, | |
| 68 | .time_high_and_version = 0x11d2, | |
| 69 | .clock_seq_high_and_reserved = 0x8e, | |
| 70 | .clock_seq_low = 0x39, | |
| 71 | .node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b }, | |
| 72 | }; | |
| 73 | pub const boxdraw_horizontal: u16 = 0x2500; | |
| 74 | pub const boxdraw_vertical: u16 = 0x2502; | |
| 75 | pub const boxdraw_down_right: u16 = 0x250c; | |
| 76 | pub const boxdraw_down_left: u16 = 0x2510; | |
| 77 | pub const boxdraw_up_right: u16 = 0x2514; | |
| 78 | pub const boxdraw_up_left: u16 = 0x2518; | |
| 79 | pub const boxdraw_vertical_right: u16 = 0x251c; | |
| 80 | pub const boxdraw_vertical_left: u16 = 0x2524; | |
| 81 | pub const boxdraw_down_horizontal: u16 = 0x252c; | |
| 82 | pub const boxdraw_up_horizontal: u16 = 0x2534; | |
| 83 | pub const boxdraw_vertical_horizontal: u16 = 0x253c; | |
| 84 | pub const boxdraw_double_horizontal: u16 = 0x2550; | |
| 85 | pub const boxdraw_double_vertical: u16 = 0x2551; | |
| 86 | pub const boxdraw_down_right_double: u16 = 0x2552; | |
| 87 | pub const boxdraw_down_double_right: u16 = 0x2553; | |
| 88 | pub const boxdraw_double_down_right: u16 = 0x2554; | |
| 89 | pub const boxdraw_down_left_double: u16 = 0x2555; | |
| 90 | pub const boxdraw_down_double_left: u16 = 0x2556; | |
| 91 | pub const boxdraw_double_down_left: u16 = 0x2557; | |
| 92 | pub const boxdraw_up_right_double: u16 = 0x2558; | |
| 93 | pub const boxdraw_up_double_right: u16 = 0x2559; | |
| 94 | pub const boxdraw_double_up_right: u16 = 0x255a; | |
| 95 | pub const boxdraw_up_left_double: u16 = 0x255b; | |
| 96 | pub const boxdraw_up_double_left: u16 = 0x255c; | |
| 97 | pub const boxdraw_double_up_left: u16 = 0x255d; | |
| 98 | pub const boxdraw_vertical_right_double: u16 = 0x255e; | |
| 99 | pub const boxdraw_vertical_double_right: u16 = 0x255f; | |
| 100 | pub const boxdraw_double_vertical_right: u16 = 0x2560; | |
| 101 | pub const boxdraw_vertical_left_double: u16 = 0x2561; | |
| 102 | pub const boxdraw_vertical_double_left: u16 = 0x2562; | |
| 103 | pub const boxdraw_double_vertical_left: u16 = 0x2563; | |
| 104 | pub const boxdraw_down_horizontal_double: u16 = 0x2564; | |
| 105 | pub const boxdraw_down_double_horizontal: u16 = 0x2565; | |
| 106 | pub const boxdraw_double_down_horizontal: u16 = 0x2566; | |
| 107 | pub const boxdraw_up_horizontal_double: u16 = 0x2567; | |
| 108 | pub const boxdraw_up_double_horizontal: u16 = 0x2568; | |
| 109 | pub const boxdraw_double_up_horizontal: u16 = 0x2569; | |
| 110 | pub const boxdraw_vertical_horizontal_double: u16 = 0x256a; | |
| 111 | pub const boxdraw_vertical_double_horizontal: u16 = 0x256b; | |
| 112 | pub const boxdraw_double_vertical_horizontal: u16 = 0x256c; | |
| 113 | pub const blockelement_full_block: u16 = 0x2588; | |
| 114 | pub const blockelement_light_shade: u16 = 0x2591; | |
| 115 | pub const geometricshape_up_triangle: u16 = 0x25b2; | |
| 116 | pub const geometricshape_right_triangle: u16 = 0x25ba; | |
| 117 | pub const geometricshape_down_triangle: u16 = 0x25bc; | |
| 118 | pub const geometricshape_left_triangle: u16 = 0x25c4; | |
| 119 | pub const arrow_up: u16 = 0x2591; | |
| 120 | pub const arrow_down: u16 = 0x2593; | |
| 121 | pub const black: u8 = 0x00; | |
| 122 | pub const blue: u8 = 0x01; | |
| 123 | pub const green: u8 = 0x02; | |
| 124 | pub const cyan: u8 = 0x03; | |
| 125 | pub const red: u8 = 0x04; | |
| 126 | pub const magenta: u8 = 0x05; | |
| 127 | pub const brown: u8 = 0x06; | |
| 128 | pub const lightgray: u8 = 0x07; | |
| 129 | pub const bright: u8 = 0x08; | |
| 130 | pub const darkgray: u8 = 0x08; | |
| 131 | pub const lightblue: u8 = 0x09; | |
| 132 | pub const lightgreen: u8 = 0x0a; | |
| 133 | pub const lightcyan: u8 = 0x0b; | |
| 134 | pub const lightred: u8 = 0x0c; | |
| 135 | pub const lightmagenta: u8 = 0x0d; | |
| 136 | pub const yellow: u8 = 0x0e; | |
| 137 | pub const white: u8 = 0x0f; | |
| 138 | pub const background_black: u8 = 0x00; | |
| 139 | pub const background_blue: u8 = 0x10; | |
| 140 | pub const background_green: u8 = 0x20; | |
| 141 | pub const background_cyan: u8 = 0x30; | |
| 142 | pub const background_red: u8 = 0x40; | |
| 143 | pub const background_magenta: u8 = 0x50; | |
| 144 | pub const background_brown: u8 = 0x60; | |
| 145 | pub const background_lightgray: u8 = 0x70; | |
| 146 | }; | |
| 147 | ||
| 148 | pub const SimpleTextOutputMode = extern struct { | |
| 149 | max_mode: u32, // specified as signed | |
| 150 | mode: u32, // specified as signed | |
| 151 | attribute: i32, | |
| 152 | cursor_column: i32, | |
| 153 | cursor_row: i32, | |
| 154 | cursor_visible: bool, | |
| 155 | }; |
lib/std/os/uefi/protocols/udp6_protocol.zig deleted-115| ... | ... | @@ -1,115 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Guid = uefi.Guid; | |
| 4 | const Event = uefi.Event; | |
| 5 | const Status = uefi.Status; | |
| 6 | const Time = uefi.Time; | |
| 7 | const Ip6ModeData = uefi.protocols.Ip6ModeData; | |
| 8 | const Ip6Address = uefi.protocols.Ip6Address; | |
| 9 | const ManagedNetworkConfigData = uefi.protocols.ManagedNetworkConfigData; | |
| 10 | const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode; | |
| 11 | const cc = uefi.cc; | |
| 12 | ||
| 13 | pub const Udp6Protocol = extern struct { | |
| 14 | _get_mode_data: *const fn (*const Udp6Protocol, ?*Udp6ConfigData, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(cc) Status, | |
| 15 | _configure: *const fn (*const Udp6Protocol, ?*const Udp6ConfigData) callconv(cc) Status, | |
| 16 | _groups: *const fn (*const Udp6Protocol, bool, ?*const Ip6Address) callconv(cc) Status, | |
| 17 | _transmit: *const fn (*const Udp6Protocol, *Udp6CompletionToken) callconv(cc) Status, | |
| 18 | _receive: *const fn (*const Udp6Protocol, *Udp6CompletionToken) callconv(cc) Status, | |
| 19 | _cancel: *const fn (*const Udp6Protocol, ?*Udp6CompletionToken) callconv(cc) Status, | |
| 20 | _poll: *const fn (*const Udp6Protocol) callconv(cc) Status, | |
| 21 | ||
| 22 | pub fn getModeData(self: *const Udp6Protocol, udp6_config_data: ?*Udp6ConfigData, ip6_mode_data: ?*Ip6ModeData, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) Status { | |
| 23 | return self._get_mode_data(self, udp6_config_data, ip6_mode_data, mnp_config_data, snp_mode_data); | |
| 24 | } | |
| 25 | ||
| 26 | pub fn configure(self: *const Udp6Protocol, udp6_config_data: ?*const Udp6ConfigData) Status { | |
| 27 | return self._configure(self, udp6_config_data); | |
| 28 | } | |
| 29 | ||
| 30 | pub fn groups(self: *const Udp6Protocol, join_flag: bool, multicast_address: ?*const Ip6Address) Status { | |
| 31 | return self._groups(self, join_flag, multicast_address); | |
| 32 | } | |
| 33 | ||
| 34 | pub fn transmit(self: *const Udp6Protocol, token: *Udp6CompletionToken) Status { | |
| 35 | return self._transmit(self, token); | |
| 36 | } | |
| 37 | ||
| 38 | pub fn receive(self: *const Udp6Protocol, token: *Udp6CompletionToken) Status { | |
| 39 | return self._receive(self, token); | |
| 40 | } | |
| 41 | ||
| 42 | pub fn cancel(self: *const Udp6Protocol, token: ?*Udp6CompletionToken) Status { | |
| 43 | return self._cancel(self, token); | |
| 44 | } | |
| 45 | ||
| 46 | pub fn poll(self: *const Udp6Protocol) Status { | |
| 47 | return self._poll(self); | |
| 48 | } | |
| 49 | ||
| 50 | pub const guid align(8) = uefi.Guid{ | |
| 51 | .time_low = 0x4f948815, | |
| 52 | .time_mid = 0xb4b9, | |
| 53 | .time_high_and_version = 0x43cb, | |
| 54 | .clock_seq_high_and_reserved = 0x8a, | |
| 55 | .clock_seq_low = 0x33, | |
| 56 | .node = [_]u8{ 0x90, 0xe0, 0x60, 0xb3, 0x49, 0x55 }, | |
| 57 | }; | |
| 58 | }; | |
| 59 | ||
| 60 | pub const Udp6ConfigData = extern struct { | |
| 61 | accept_promiscuous: bool, | |
| 62 | accept_any_port: bool, | |
| 63 | allow_duplicate_port: bool, | |
| 64 | traffic_class: u8, | |
| 65 | hop_limit: u8, | |
| 66 | receive_timeout: u32, | |
| 67 | transmit_timeout: u32, | |
| 68 | station_address: Ip6Address, | |
| 69 | station_port: u16, | |
| 70 | remote_address: Ip6Address, | |
| 71 | remote_port: u16, | |
| 72 | }; | |
| 73 | ||
| 74 | pub const Udp6CompletionToken = extern struct { | |
| 75 | event: Event, | |
| 76 | Status: usize, | |
| 77 | packet: extern union { | |
| 78 | RxData: *Udp6ReceiveData, | |
| 79 | TxData: *Udp6TransmitData, | |
| 80 | }, | |
| 81 | }; | |
| 82 | ||
| 83 | pub const Udp6ReceiveData = extern struct { | |
| 84 | timestamp: Time, | |
| 85 | recycle_signal: Event, | |
| 86 | udp6_session: Udp6SessionData, | |
| 87 | data_length: u32, | |
| 88 | fragment_count: u32, | |
| 89 | ||
| 90 | pub fn getFragments(self: *Udp6ReceiveData) []Udp6FragmentData { | |
| 91 | return @as([*]Udp6FragmentData, @ptrCast(@alignCast(@as([*]u8, @ptrCast(self)) + @sizeOf(Udp6ReceiveData))))[0..self.fragment_count]; | |
| 92 | } | |
| 93 | }; | |
| 94 | ||
| 95 | pub const Udp6TransmitData = extern struct { | |
| 96 | udp6_session_data: ?*Udp6SessionData, | |
| 97 | data_length: u32, | |
| 98 | fragment_count: u32, | |
| 99 | ||
| 100 | pub fn getFragments(self: *Udp6TransmitData) []Udp6FragmentData { | |
| 101 | return @as([*]Udp6FragmentData, @ptrCast(@alignCast(@as([*]u8, @ptrCast(self)) + @sizeOf(Udp6TransmitData))))[0..self.fragment_count]; | |
| 102 | } | |
| 103 | }; | |
| 104 | ||
| 105 | pub const Udp6SessionData = extern struct { | |
| 106 | source_address: Ip6Address, | |
| 107 | source_port: u16, | |
| 108 | destination_address: Ip6Address, | |
| 109 | destination_port: u16, | |
| 110 | }; | |
| 111 | ||
| 112 | pub const Udp6FragmentData = extern struct { | |
| 113 | fragment_length: u32, | |
| 114 | fragment_buffer: [*]u8, | |
| 115 | }; |
lib/std/os/uefi/protocols/udp6_service_binding_protocol.zig deleted-28| ... | ... | @@ -1,28 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | const uefi = std.os.uefi; | |
| 3 | const Handle = uefi.Handle; | |
| 4 | const Guid = uefi.Guid; | |
| 5 | const Status = uefi.Status; | |
| 6 | const cc = uefi.cc; | |
| 7 | ||
| 8 | pub const Udp6ServiceBindingProtocol = extern struct { | |
| 9 | _create_child: *const fn (*const Udp6ServiceBindingProtocol, *?Handle) callconv(cc) Status, | |
| 10 | _destroy_child: *const fn (*const Udp6ServiceBindingProtocol, Handle) callconv(cc) Status, | |
| 11 | ||
| 12 | pub fn createChild(self: *const Udp6ServiceBindingProtocol, handle: *?Handle) Status { | |
| 13 | return self._create_child(self, handle); | |
| 14 | } | |
| 15 | ||
| 16 | pub fn destroyChild(self: *const Udp6ServiceBindingProtocol, handle: Handle) Status { | |
| 17 | return self._destroy_child(self, handle); | |
| 18 | } | |
| 19 | ||
| 20 | pub const guid align(8) = Guid{ | |
| 21 | .time_low = 0x66ed4721, | |
| 22 | .time_mid = 0x3c98, | |
| 23 | .time_high_and_version = 0x4d3e, | |
| 24 | .clock_seq_high_and_reserved = 0x81, | |
| 25 | .clock_seq_low = 0xe3, | |
| 26 | .node = [_]u8{ 0xd0, 0x3d, 0xd3, 0x9a, 0x72, 0x54 }, | |
| 27 | }; | |
| 28 | }; |
lib/std/os/uefi/tables/boot_services.zig+1-1| ... | ... | @@ -5,7 +5,7 @@ const Guid = uefi.Guid; |
| 5 | 5 | const Handle = uefi.Handle; |
| 6 | 6 | const Status = uefi.Status; |
| 7 | 7 | const TableHeader = uefi.tables.TableHeader; |
| 8 | const DevicePathProtocol = uefi.protocols.DevicePathProtocol; | |
| 8 | const DevicePathProtocol = uefi.protocol.DevicePath; | |
| 9 | 9 | const cc = uefi.cc; |
| 10 | 10 | |
| 11 | 11 | /// Boot services are services provided by the system's firmware until the operating system takes |
lib/std/os/uefi/tables/system_table.zig+2-2| ... | ... | @@ -3,8 +3,8 @@ const BootServices = uefi.tables.BootServices; |
| 3 | 3 | const ConfigurationTable = uefi.tables.ConfigurationTable; |
| 4 | 4 | const Handle = uefi.Handle; |
| 5 | 5 | const RuntimeServices = uefi.tables.RuntimeServices; |
| 6 | const SimpleTextInputProtocol = uefi.protocols.SimpleTextInputProtocol; | |
| 7 | const SimpleTextOutputProtocol = uefi.protocols.SimpleTextOutputProtocol; | |
| 6 | const SimpleTextInputProtocol = uefi.protocol.SimpleTextInput; | |
| 7 | const SimpleTextOutputProtocol = uefi.protocol.SimpleTextOutput; | |
| 8 | 8 | const TableHeader = uefi.tables.TableHeader; |
| 9 | 9 | |
| 10 | 10 | /// The EFI System Table contains pointers to the runtime and boot services tables. |