| ... | ... | @@ -87,7 +87,10 @@ pub const DevicePathProtocol = packed struct { |
| 87 | 87 | }, |
| 88 | 88 | .Acpi => blk: { |
| 89 | 89 | const acpi: ?AcpiDevicePath = switch (@intToEnum(AcpiDevicePath.Subtype, self.subtype)) { |
| 90 | | else => null, // TODO |
| 90 | .Acpi => .{ .Acpi = @ptrCast(*const AcpiDevicePath.BaseAcpiDevicePath, self) }, |
| 91 | .ExpandedAcpi => .{ .ExpandedAcpi = @ptrCast(*const AcpiDevicePath.ExpandedAcpiDevicePath, self) }, |
| 92 | .Adr => .{ .Adr = @ptrCast(*const AcpiDevicePath.AdrDevicePath, self) }, |
| 93 | _ => null, |
| 91 | 94 | }; |
| 92 | 95 | break :blk if (acpi) |a| .{ .Acpi = a } else null; |
| 93 | 96 | }, |
| ... | ... | @@ -173,58 +176,92 @@ pub const HardwareDevicePath = union(Subtype) { |
| 173 | 176 | type: DevicePathType, |
| 174 | 177 | subtype: Subtype, |
| 175 | 178 | length: u16, |
| 176 | | // TODO |
| 179 | function: u8, |
| 180 | device: u8, |
| 177 | 181 | }; |
| 178 | 182 | |
| 179 | 183 | pub const PcCardDevicePath = packed struct { |
| 180 | 184 | type: DevicePathType, |
| 181 | 185 | subtype: Subtype, |
| 182 | 186 | length: u16, |
| 183 | | // TODO |
| 187 | function_number: u8, |
| 184 | 188 | }; |
| 185 | 189 | |
| 186 | 190 | pub const MemoryMappedDevicePath = packed struct { |
| 187 | 191 | type: DevicePathType, |
| 188 | 192 | subtype: Subtype, |
| 189 | 193 | length: u16, |
| 190 | | // TODO |
| 194 | memory_type: u32, |
| 195 | start_address: u64, |
| 196 | end_address: u64, |
| 191 | 197 | }; |
| 192 | 198 | |
| 193 | 199 | pub const VendorDevicePath = packed struct { |
| 194 | 200 | type: DevicePathType, |
| 195 | 201 | subtype: Subtype, |
| 196 | 202 | length: u16, |
| 197 | | // TODO |
| 203 | vendor_guid: Guid, |
| 198 | 204 | }; |
| 199 | 205 | |
| 200 | 206 | pub const ControllerDevicePath = packed struct { |
| 201 | 207 | type: DevicePathType, |
| 202 | 208 | subtype: Subtype, |
| 203 | 209 | length: u16, |
| 204 | | // TODO |
| 210 | controller_number: u32, |
| 205 | 211 | }; |
| 206 | 212 | |
| 207 | 213 | pub const BmcDevicePath = packed struct { |
| 208 | 214 | type: DevicePathType, |
| 209 | 215 | subtype: Subtype, |
| 210 | 216 | length: u16, |
| 211 | | // TODO |
| 217 | interface_type: u8, |
| 218 | base_address: usize, |
| 212 | 219 | }; |
| 213 | 220 | }; |
| 214 | 221 | |
| 215 | 222 | pub const AcpiDevicePath = union(Subtype) { |
| 216 | | Acpi: void, // TODO |
| 217 | | ExpandedAcpi: void, // TODO |
| 218 | | Adr: void, // TODO |
| 219 | | Nvdimm: void, // TODO |
| 223 | Acpi: *const BaseAcpiDevicePath, |
| 224 | ExpandedAcpi: *const ExpandedAcpiDevicePath, |
| 225 | Adr: *const AdrDevicePath, |
| 220 | 226 | |
| 221 | 227 | pub const Subtype = enum(u8) { |
| 222 | 228 | Acpi = 1, |
| 223 | 229 | ExpandedAcpi = 2, |
| 224 | 230 | Adr = 3, |
| 225 | | Nvdimm = 4, |
| 226 | 231 | _, |
| 227 | 232 | }; |
| 233 | |
| 234 | pub const BaseAcpiDevicePath = packed struct { |
| 235 | type: DevicePathType, |
| 236 | subtype: Subtype, |
| 237 | length: u16, |
| 238 | hid: u32, |
| 239 | uid: u32, |
| 240 | }; |
| 241 | |
| 242 | pub const ExpandedAcpiDevicePath = packed struct { |
| 243 | type: DevicePathType, |
| 244 | subtype: Subtype, |
| 245 | length: u16, |
| 246 | hid: u32, |
| 247 | uid: u32, |
| 248 | cid: u32, |
| 249 | // variable length u16[*:0] strings |
| 250 | // hid_str, uid_str, cid_str |
| 251 | }; |
| 252 | |
| 253 | pub const AdrDevicePath = packed struct { |
| 254 | type: DevicePathType, |
| 255 | subtype: Subtype, |
| 256 | length: u16, |
| 257 | adr: u32, |
| 258 | // multiple adr entries can optionally follow |
| 259 | pub fn adrs(self: *const AdrDevicePath) []const u32 { |
| 260 | // self.length is a minimum of 8 with one adr which is size 4. |
| 261 | var entries = (self.length - 4) / @sizeOf(u32); |
| 262 | return @ptrCast([*]const u32, &self.adr)[0..entries]; |
| 263 | } |
| 264 | }; |
| 228 | 265 | }; |
| 229 | 266 | |
| 230 | 267 | pub const MessagingDevicePath = union(Subtype) { |