1 // DO NOT EDIT 2 // 3 // This file was automatically generated with: 4 // `cargo xtask gen-code` 5 // 6 // See `/xtask/src/device_path/README.md` for more details. 7 #![allow(clippy::missing_const_for_fn)] 8 #![allow(missing_debug_implementations)] 9 use crate::protocol::device_path; 10 use crate::table::boot::MemoryType; 11 use crate::{guid, Guid, IpAddress}; 12 use bitflags::bitflags; 13 use device_path::DevicePathProtocol as DevicePathHeader; 14 #[cfg(doc)] 15 use device_path::DeviceType; 16 /// Device path nodes for [`DeviceType::END`]. 17 pub mod end { 18 use super::*; 19 #[repr(C, packed)] 20 pub struct Instance { 21 pub header: DevicePathHeader, 22 } 23 24 #[repr(C, packed)] 25 pub struct Entire { 26 pub header: DevicePathHeader, 27 } 28 } 29 30 /// Device path nodes for [`DeviceType::HARDWARE`]. 31 pub mod hardware { 32 use super::*; 33 #[repr(C, packed)] 34 pub struct Pci { 35 pub header: DevicePathHeader, 36 pub function: u8, 37 pub device: u8, 38 } 39 40 #[repr(C, packed)] 41 pub struct Pccard { 42 pub header: DevicePathHeader, 43 pub function: u8, 44 } 45 46 #[repr(C, packed)] 47 pub struct MemoryMapped { 48 pub header: DevicePathHeader, 49 pub memory_type: MemoryType, 50 pub start_address: u64, 51 pub end_address: u64, 52 } 53 54 #[repr(C, packed)] 55 pub struct Vendor { 56 pub header: DevicePathHeader, 57 pub vendor_guid: Guid, 58 pub vendor_defined_data: [u8; 0usize], 59 } 60 61 #[repr(C, packed)] 62 pub struct Controller { 63 pub header: DevicePathHeader, 64 pub controller_number: u32, 65 } 66 67 #[repr(C, packed)] 68 pub struct Bmc { 69 pub header: DevicePathHeader, 70 pub interface_type: device_path::hardware::BmcInterfaceType, 71 pub base_address: u64, 72 } 73 74 newtype_enum! { # [doc = " Baseboard Management Controller (BMC) host interface type."] pub enum BmcInterfaceType : u8 => { # [doc = " Unknown."] UNKNOWN = 0x00 , # [doc = " Keyboard controller style."] KEYBOARD_CONTROLLER_STYLE = 0x01 , # [doc = " Server management interface chip."] SERVER_MANAGEMENT_INTERFACE_CHIP = 0x02 , # [doc = " Block transfer."] BLOCK_TRANSFER = 0x03 , } 75 76 } 77 } 78 79 /// Device path nodes for [`DeviceType::ACPI`]. 80 pub mod acpi { 81 use super::*; 82 #[repr(C, packed)] 83 pub struct Acpi { 84 pub header: DevicePathHeader, 85 pub hid: u32, 86 pub uid: u32, 87 } 88 89 #[repr(C, packed)] 90 pub struct Expanded { 91 pub header: DevicePathHeader, 92 pub hid: u32, 93 pub uid: u32, 94 pub cid: u32, 95 pub data: [u8; 0], 96 } 97 98 #[repr(C, packed)] 99 pub struct Adr { 100 pub header: DevicePathHeader, 101 pub adr: [u32; 0usize], 102 } 103 104 #[repr(C, packed)] 105 pub struct Nvdimm { 106 pub header: DevicePathHeader, 107 pub nfit_device_handle: u32, 108 } 109 } 110 111 /// Device path nodes for [`DeviceType::MESSAGING`]. 112 pub mod messaging { 113 use super::*; 114 #[repr(C, packed)] 115 pub struct Atapi { 116 pub header: DevicePathHeader, 117 pub primary_secondary: device_path::messaging::PrimarySecondary, 118 pub master_slave: device_path::messaging::MasterSlave, 119 pub logical_unit_number: u16, 120 } 121 122 #[repr(C, packed)] 123 pub struct Scsi { 124 pub header: DevicePathHeader, 125 pub target_id: u16, 126 pub logical_unit_number: u16, 127 } 128 129 #[repr(C, packed)] 130 pub struct FibreChannel { 131 pub header: DevicePathHeader, 132 pub _reserved: u32, 133 pub world_wide_name: u64, 134 pub logical_unit_number: u64, 135 } 136 137 #[repr(C, packed)] 138 pub struct FibreChannelEx { 139 pub header: DevicePathHeader, 140 pub _reserved: u32, 141 pub world_wide_name: [u8; 8usize], 142 pub logical_unit_number: [u8; 8usize], 143 } 144 145 #[repr(C, packed)] 146 pub struct Ieee1394 { 147 pub header: DevicePathHeader, 148 pub _reserved: u32, 149 pub guid: [u8; 8usize], 150 } 151 152 #[repr(C, packed)] 153 pub struct Usb { 154 pub header: DevicePathHeader, 155 pub parent_port_number: u8, 156 pub interface: u8, 157 } 158 159 #[repr(C, packed)] 160 pub struct Sata { 161 pub header: DevicePathHeader, 162 pub hba_port_number: u16, 163 pub port_multiplier_port_number: u16, 164 pub logical_unit_number: u16, 165 } 166 167 #[repr(C, packed)] 168 pub struct UsbWwid { 169 pub header: DevicePathHeader, 170 pub interface_number: u16, 171 pub device_vendor_id: u16, 172 pub device_product_id: u16, 173 pub serial_number: [u16; 0usize], 174 } 175 176 #[repr(C, packed)] 177 pub struct DeviceLogicalUnit { 178 pub header: DevicePathHeader, 179 pub logical_unit_number: u8, 180 } 181 182 #[repr(C, packed)] 183 pub struct UsbClass { 184 pub header: DevicePathHeader, 185 pub vendor_id: u16, 186 pub product_id: u16, 187 pub device_class: u8, 188 pub device_subclass: u8, 189 pub device_protocol: u8, 190 } 191 192 #[repr(C, packed)] 193 pub struct I2o { 194 pub header: DevicePathHeader, 195 pub target_id: u32, 196 } 197 198 #[repr(C, packed)] 199 pub struct MacAddress { 200 pub header: DevicePathHeader, 201 pub mac_address: [u8; 32usize], 202 pub interface_type: u8, 203 } 204 205 #[repr(C, packed)] 206 pub struct Ipv4 { 207 pub header: DevicePathHeader, 208 pub local_ip_address: [u8; 4usize], 209 pub remote_ip_address: [u8; 4usize], 210 pub local_port: u16, 211 pub remote_port: u16, 212 pub protocol: u16, 213 pub ip_address_origin: device_path::messaging::Ipv4AddressOrigin, 214 pub gateway_ip_address: [u8; 4usize], 215 pub subnet_mask: [u8; 4usize], 216 } 217 218 #[repr(C, packed)] 219 pub struct Ipv6 { 220 pub header: DevicePathHeader, 221 pub local_ip_address: [u8; 16usize], 222 pub remote_ip_address: [u8; 16usize], 223 pub local_port: u16, 224 pub remote_port: u16, 225 pub protocol: u16, 226 pub ip_address_origin: device_path::messaging::Ipv6AddressOrigin, 227 pub prefix_length: u8, 228 pub gateway_ip_address: [u8; 16usize], 229 } 230 231 #[repr(C, packed)] 232 pub struct Vlan { 233 pub header: DevicePathHeader, 234 pub vlan_id: u16, 235 } 236 237 #[repr(C, packed)] 238 pub struct Infiniband { 239 pub header: DevicePathHeader, 240 pub resource_flags: device_path::messaging::InfinibandResourceFlags, 241 pub port_gid: [u8; 16usize], 242 pub ioc_guid_or_service_id: u64, 243 pub target_port_id: u64, 244 pub device_id: u64, 245 } 246 247 #[repr(C, packed)] 248 pub struct Uart { 249 pub header: DevicePathHeader, 250 pub _reserved: u32, 251 pub baud_rate: u64, 252 pub data_bits: u8, 253 pub parity: device_path::messaging::Parity, 254 pub stop_bits: device_path::messaging::StopBits, 255 } 256 257 #[repr(C, packed)] 258 pub struct Vendor { 259 pub header: DevicePathHeader, 260 pub vendor_guid: Guid, 261 pub vendor_defined_data: [u8; 0usize], 262 } 263 264 #[repr(C, packed)] 265 pub struct SasEx { 266 pub header: DevicePathHeader, 267 pub sas_address: [u8; 8usize], 268 pub logical_unit_number: [u8; 8usize], 269 pub info: u16, 270 pub relative_target_port: u16, 271 } 272 273 #[repr(C, packed)] 274 pub struct Iscsi { 275 pub header: DevicePathHeader, 276 pub protocol: device_path::messaging::IscsiProtocol, 277 pub options: device_path::messaging::IscsiLoginOptions, 278 pub logical_unit_number: [u8; 8usize], 279 pub target_portal_group_tag: u16, 280 pub iscsi_target_name: [u8; 0usize], 281 } 282 283 #[repr(C, packed)] 284 pub struct NvmeNamespace { 285 pub header: DevicePathHeader, 286 pub namespace_identifier: u32, 287 pub ieee_extended_unique_identifier: u64, 288 } 289 290 #[repr(C, packed)] 291 pub struct Uri { 292 pub header: DevicePathHeader, 293 pub value: [u8; 0usize], 294 } 295 296 #[repr(C, packed)] 297 pub struct Ufs { 298 pub header: DevicePathHeader, 299 pub target_id: u8, 300 pub logical_unit_number: u8, 301 } 302 303 #[repr(C, packed)] 304 pub struct Sd { 305 pub header: DevicePathHeader, 306 pub slot_number: u8, 307 } 308 309 #[repr(C, packed)] 310 pub struct Bluetooth { 311 pub header: DevicePathHeader, 312 pub device_address: [u8; 6usize], 313 } 314 315 #[repr(C, packed)] 316 pub struct Wifi { 317 pub header: DevicePathHeader, 318 pub ssid: [u8; 32usize], 319 } 320 321 #[repr(C, packed)] 322 pub struct Emmc { 323 pub header: DevicePathHeader, 324 pub slot_number: u8, 325 } 326 327 #[repr(C, packed)] 328 pub struct BluetoothLe { 329 pub header: DevicePathHeader, 330 pub device_address: [u8; 6usize], 331 pub address_type: device_path::messaging::BluetoothLeAddressType, 332 } 333 334 #[repr(C, packed)] 335 pub struct Dns { 336 pub header: DevicePathHeader, 337 pub address_type: device_path::messaging::DnsAddressType, 338 pub addresses: [IpAddress; 0usize], 339 } 340 341 #[repr(C, packed)] 342 pub struct NvdimmNamespace { 343 pub header: DevicePathHeader, 344 pub uuid: [u8; 16usize], 345 } 346 347 #[repr(C, packed)] 348 pub struct RestService { 349 pub header: DevicePathHeader, 350 pub service_type: device_path::messaging::RestServiceType, 351 pub access_mode: device_path::messaging::RestServiceAccessMode, 352 pub vendor_guid_and_data: [u8; 0usize], 353 } 354 355 #[repr(C, packed)] 356 pub struct NvmeOfNamespace { 357 pub header: DevicePathHeader, 358 pub nidt: u8, 359 pub nid: [u8; 16usize], 360 pub subsystem_nqn: [u8; 0usize], 361 } 362 363 newtype_enum! { # [doc = " Whether the ATAPI device is primary or secondary."] pub enum PrimarySecondary : u8 => { # [doc = " Primary."] PRIMARY = 0x00 , # [doc = " Secondary."] SECONDARY = 0x01 , } 364 365 } 366 367 newtype_enum! { # [doc = " Whether the ATAPI device is master or slave."] pub enum MasterSlave : u8 => { # [doc = " Master mode."] MASTER = 0x00 , # [doc = " Slave mode."] SLAVE = 0x01 , } 368 369 } 370 371 newtype_enum! { # [doc = " Origin of the source IP address."] pub enum Ipv4AddressOrigin : u8 => { # [doc = " Source IP address was assigned through DHCP."] DHCP = 0x00 , # [doc = " Source IP address is statically bound."] STATIC = 0x01 , } 372 373 } 374 375 newtype_enum! { # [doc = " Origin of the local IP address."] pub enum Ipv6AddressOrigin : u8 => { # [doc = " Local IP address was manually configured."] MANUAL = 0x00 , # [doc = " Local IP address assigned through IPv6 stateless"] # [doc = " auto-configuration."] STATELESS_AUTO_CONFIGURATION = 0x01 , # [doc = " Local IP address assigned through IPv6 stateful"] # [doc = " configuration."] STATEFUL_CONFIGURATION = 0x02 , } 376 377 } 378 379 bitflags! { # [doc = " Flags to identify/manage InfiniBand elements."] # [derive (Clone , Copy , Debug , Default , PartialEq , Eq , PartialOrd , Ord)] # [repr (transparent)] pub struct InfinibandResourceFlags : u32 { # [doc = " Set = service, unset = IOC."] const SERVICE = 0x0000_0001 ; # [doc = " Extended boot environment."] const EXTENDED_BOOT_ENVIRONMENT = 0x0000_0002 ; # [doc = " Console protocol."] const CONSOLE_PROTOCOL = 0x0000_0004 ; # [doc = " Storage protocol."] const STORAGE_PROTOCOL = 0x0000_0008 ; # [doc = " Network protocol."] const NETWORK_PROTOCOL = 0x0000_0010 ; } 380 381 } 382 383 newtype_enum! { # [doc = " UART parity setting."] pub enum Parity : u8 => { # [doc = " Default parity."] DEFAULT = 0x00 , # [doc = " No parity."] NO = 0x01 , # [doc = " Even parity."] EVEN = 0x02 , # [doc = " Odd parity."] ODD = 0x03 , # [doc = " Mark parity."] MARK = 0x04 , # [doc = " Space parity."] SPACE = 0x05 , } 384 385 } 386 387 newtype_enum! { # [doc = " UART number of stop bits."] pub enum StopBits : u8 => { # [doc = " Default number of stop bits."] DEFAULT = 0x00 , # [doc = " 1 stop bit."] ONE = 0x01 , # [doc = " 1.5 stop bits."] ONE_POINT_FIVE = 0x02 , # [doc = " 2 stop bits."] TWO = 0x03 , } 388 389 } 390 391 newtype_enum! { # [doc = " iSCSI network protocol."] pub enum IscsiProtocol : u16 => { # [doc = " TCP."] TCP = 0x0000 , } 392 393 } 394 395 bitflags! { # [doc = " iSCSI login options."] # [derive (Clone , Copy , Debug , Default , PartialEq , Eq , PartialOrd , Ord)] # [repr (transparent)] pub struct IscsiLoginOptions : u16 { # [doc = " Header digest using CRC32. If not set, no header digest."] const HEADER_DIGEST_USING_CRC32 = 0x0002 ; # [doc = " Data digest using CRC32. If not set, no data digest."] const DATA_DIGEST_USING_CRC32 = 0x0008 ; # [doc = " Auth method none. If not set, auth method CHAP."] const AUTH_METHOD_NONE = 0x0800 ; # [doc = " CHAP UNI. If not set, CHAP BI."] const CHAP_UNI = 0x1000 ; } 396 397 } 398 399 newtype_enum! { # [doc = " BluetoothLE address type."] pub enum BluetoothLeAddressType : u8 => { # [doc = " Public device address."] PUBLIC = 0x00 , # [doc = " Random device address."] RANDOM = 0x01 , } 400 401 } 402 403 newtype_enum! { # [doc = " Whether the address is IPv4 or IPv6."] pub enum DnsAddressType : u8 => { # [doc = " DNS server address is IPv4."] IPV4 = 0x00 , # [doc = " DNS server address is IPv6."] IPV6 = 0x01 , } 404 405 } 406 407 newtype_enum! { # [doc = " Type of REST service."] pub enum RestServiceType : u8 => { # [doc = " Redfish REST service."] REDFISH = 0x01 , # [doc = " OData REST service."] ODATA = 0x02 , # [doc = " Vendor-specific REST service."] VENDOR = 0xff , } 408 409 } 410 411 newtype_enum! { # [doc = " Whether the service is in-band or out-of-band."] pub enum RestServiceAccessMode : u8 => { # [doc = " In-band REST service."] IN_BAND = 0x01 , # [doc = " Out-of-band REST service."] OUT_OF_BAND = 0x02 , } 412 413 } 414 } 415 416 /// Device path nodes for [`DeviceType::MEDIA`]. 417 pub mod media { 418 use super::*; 419 #[repr(C, packed)] 420 pub struct HardDrive { 421 pub header: DevicePathHeader, 422 pub partition_number: u32, 423 pub partition_start: u64, 424 pub partition_size: u64, 425 pub partition_signature: [u8; 16usize], 426 pub partition_format: device_path::media::PartitionFormat, 427 pub signature_type: u8, 428 } 429 430 #[repr(C, packed)] 431 pub struct CdRom { 432 pub header: DevicePathHeader, 433 pub boot_entry: u32, 434 pub partition_start: u64, 435 pub partition_size: u64, 436 } 437 438 #[repr(C, packed)] 439 pub struct Vendor { 440 pub header: DevicePathHeader, 441 pub vendor_guid: Guid, 442 pub vendor_defined_data: [u8; 0usize], 443 } 444 445 #[repr(C, packed)] 446 pub struct FilePath { 447 pub header: DevicePathHeader, 448 pub path_name: [u16; 0usize], 449 } 450 451 #[repr(C, packed)] 452 pub struct Protocol { 453 pub header: DevicePathHeader, 454 pub protocol_guid: Guid, 455 } 456 457 #[repr(C, packed)] 458 pub struct PiwgFirmwareFile { 459 pub header: DevicePathHeader, 460 pub data: [u8; 0usize], 461 } 462 463 #[repr(C, packed)] 464 pub struct PiwgFirmwareVolume { 465 pub header: DevicePathHeader, 466 pub data: [u8; 0usize], 467 } 468 469 #[repr(C, packed)] 470 pub struct RelativeOffsetRange { 471 pub header: DevicePathHeader, 472 pub _reserved: u32, 473 pub starting_offset: u64, 474 pub ending_offset: u64, 475 } 476 477 #[repr(C, packed)] 478 pub struct RamDisk { 479 pub header: DevicePathHeader, 480 pub starting_address: u64, 481 pub ending_address: u64, 482 pub disk_type: device_path::media::RamDiskType, 483 pub disk_instance: u16, 484 } 485 486 newtype_enum! { # [doc = " Hard drive partition format."] pub enum PartitionFormat : u8 => { # [doc = " MBR (PC-AT compatible Master Boot Record) format."] MBR = 0x01 , # [doc = " GPT (GUID Partition Table) format."] GPT = 0x02 , } 487 488 } 489 490 newtype_enum! { # [doc = " RAM disk type."] pub enum RamDiskType : Guid => { # [doc = " RAM disk with a raw disk format in volatile memory."] VIRTUAL_DISK = guid ! ("77ab535a-45fc-624b-5560-f7b281d1f96e") , # [doc = " RAM disk of an ISO image in volatile memory."] VIRTUAL_CD = guid ! ("3d5abd30-4175-87ce-6d64-d2ade523c4bb") , # [doc = " RAM disk with a raw disk format in persistent memory."] PERSISTENT_VIRTUAL_DISK = guid ! ("5cea02c9-4d07-69d3-269f-4496fbe096f9") , # [doc = " RAM disk of an ISO image in persistent memory."] PERSISTENT_VIRTUAL_CD = guid ! ("08018188-42cd-bb48-100f-5387d53ded3d") , } 491 492 } 493 } 494 495 /// Device path nodes for [`DeviceType::BIOS_BOOT_SPEC`]. 496 pub mod bios_boot_spec { 497 use super::*; 498 #[repr(C, packed)] 499 pub struct BootSpecification { 500 pub header: DevicePathHeader, 501 pub device_type: u16, 502 pub status_flag: u16, 503 pub description_string: [u8; 0usize], 504 } 505 } 506