uefi_raw/protocol/device_path/
device_path_gen.rs

1// SPDX-License-Identifier: MIT OR Apache-2.0
2
3// DO NOT EDIT
4//
5// This file was automatically generated with:
6// `cargo xtask gen-code`
7//
8// See `/xtask/src/device_path/README.md` for more details.
9#![allow(clippy::missing_const_for_fn)]
10#![allow(missing_debug_implementations)]
11use crate::protocol::device_path;
12use crate::table::boot::MemoryType;
13use crate::{guid, Guid, IpAddress};
14use bitflags::bitflags;
15use device_path::DevicePathProtocol as DevicePathHeader;
16#[cfg(doc)]
17use device_path::DeviceType;
18/// Device path nodes for [`DeviceType::END`].
19pub mod end {
20    use super::*;
21    #[repr(C, packed)]
22    pub struct Instance {
23        pub header: DevicePathHeader,
24    }
25
26    #[repr(C, packed)]
27    pub struct Entire {
28        pub header: DevicePathHeader,
29    }
30}
31
32/// Device path nodes for [`DeviceType::HARDWARE`].
33pub mod hardware {
34    use super::*;
35    #[repr(C, packed)]
36    pub struct Pci {
37        pub header: DevicePathHeader,
38        pub function: u8,
39        pub device: u8,
40    }
41
42    #[repr(C, packed)]
43    pub struct Pccard {
44        pub header: DevicePathHeader,
45        pub function: u8,
46    }
47
48    #[repr(C, packed)]
49    pub struct MemoryMapped {
50        pub header: DevicePathHeader,
51        pub memory_type: MemoryType,
52        pub start_address: u64,
53        pub end_address: u64,
54    }
55
56    #[repr(C, packed)]
57    pub struct Vendor {
58        pub header: DevicePathHeader,
59        pub vendor_guid: Guid,
60        pub vendor_defined_data: [u8; 0usize],
61    }
62
63    #[repr(C, packed)]
64    pub struct Controller {
65        pub header: DevicePathHeader,
66        pub controller_number: u32,
67    }
68
69    #[repr(C, packed)]
70    pub struct Bmc {
71        pub header: DevicePathHeader,
72        pub interface_type: device_path::hardware::BmcInterfaceType,
73        pub base_address: u64,
74    }
75
76    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 , }
77
78    }
79}
80
81/// Device path nodes for [`DeviceType::ACPI`].
82pub mod acpi {
83    use super::*;
84    #[repr(C, packed)]
85    pub struct Acpi {
86        pub header: DevicePathHeader,
87        pub hid: u32,
88        pub uid: u32,
89    }
90
91    #[repr(C, packed)]
92    pub struct Expanded {
93        pub header: DevicePathHeader,
94        pub hid: u32,
95        pub uid: u32,
96        pub cid: u32,
97        pub data: [u8; 0],
98    }
99
100    #[repr(C, packed)]
101    pub struct Adr {
102        pub header: DevicePathHeader,
103        pub adr: [u32; 0usize],
104    }
105
106    #[repr(C, packed)]
107    pub struct Nvdimm {
108        pub header: DevicePathHeader,
109        pub nfit_device_handle: u32,
110    }
111}
112
113/// Device path nodes for [`DeviceType::MESSAGING`].
114pub mod messaging {
115    use super::*;
116    #[repr(C, packed)]
117    pub struct Atapi {
118        pub header: DevicePathHeader,
119        pub primary_secondary: device_path::messaging::PrimarySecondary,
120        pub master_slave: device_path::messaging::MasterSlave,
121        pub logical_unit_number: u16,
122    }
123
124    #[repr(C, packed)]
125    pub struct Scsi {
126        pub header: DevicePathHeader,
127        pub target_id: u16,
128        pub logical_unit_number: u16,
129    }
130
131    #[repr(C, packed)]
132    pub struct FibreChannel {
133        pub header: DevicePathHeader,
134        pub _reserved: u32,
135        pub world_wide_name: u64,
136        pub logical_unit_number: u64,
137    }
138
139    #[repr(C, packed)]
140    pub struct FibreChannelEx {
141        pub header: DevicePathHeader,
142        pub _reserved: u32,
143        pub world_wide_name: [u8; 8usize],
144        pub logical_unit_number: [u8; 8usize],
145    }
146
147    #[repr(C, packed)]
148    pub struct Ieee1394 {
149        pub header: DevicePathHeader,
150        pub _reserved: u32,
151        pub guid: [u8; 8usize],
152    }
153
154    #[repr(C, packed)]
155    pub struct Usb {
156        pub header: DevicePathHeader,
157        pub parent_port_number: u8,
158        pub interface: u8,
159    }
160
161    #[repr(C, packed)]
162    pub struct Sata {
163        pub header: DevicePathHeader,
164        pub hba_port_number: u16,
165        pub port_multiplier_port_number: u16,
166        pub logical_unit_number: u16,
167    }
168
169    #[repr(C, packed)]
170    pub struct UsbWwid {
171        pub header: DevicePathHeader,
172        pub interface_number: u16,
173        pub device_vendor_id: u16,
174        pub device_product_id: u16,
175        pub serial_number: [u16; 0usize],
176    }
177
178    #[repr(C, packed)]
179    pub struct DeviceLogicalUnit {
180        pub header: DevicePathHeader,
181        pub logical_unit_number: u8,
182    }
183
184    #[repr(C, packed)]
185    pub struct UsbClass {
186        pub header: DevicePathHeader,
187        pub vendor_id: u16,
188        pub product_id: u16,
189        pub device_class: u8,
190        pub device_subclass: u8,
191        pub device_protocol: u8,
192    }
193
194    #[repr(C, packed)]
195    pub struct I2o {
196        pub header: DevicePathHeader,
197        pub target_id: u32,
198    }
199
200    #[repr(C, packed)]
201    pub struct MacAddress {
202        pub header: DevicePathHeader,
203        pub mac_address: [u8; 32usize],
204        pub interface_type: u8,
205    }
206
207    #[repr(C, packed)]
208    pub struct Ipv4 {
209        pub header: DevicePathHeader,
210        pub local_ip_address: [u8; 4usize],
211        pub remote_ip_address: [u8; 4usize],
212        pub local_port: u16,
213        pub remote_port: u16,
214        pub protocol: u16,
215        pub ip_address_origin: device_path::messaging::Ipv4AddressOrigin,
216        pub gateway_ip_address: [u8; 4usize],
217        pub subnet_mask: [u8; 4usize],
218    }
219
220    #[repr(C, packed)]
221    pub struct Ipv6 {
222        pub header: DevicePathHeader,
223        pub local_ip_address: [u8; 16usize],
224        pub remote_ip_address: [u8; 16usize],
225        pub local_port: u16,
226        pub remote_port: u16,
227        pub protocol: u16,
228        pub ip_address_origin: device_path::messaging::Ipv6AddressOrigin,
229        pub prefix_length: u8,
230        pub gateway_ip_address: [u8; 16usize],
231    }
232
233    #[repr(C, packed)]
234    pub struct Vlan {
235        pub header: DevicePathHeader,
236        pub vlan_id: u16,
237    }
238
239    #[repr(C, packed)]
240    pub struct Infiniband {
241        pub header: DevicePathHeader,
242        pub resource_flags: device_path::messaging::InfinibandResourceFlags,
243        pub port_gid: [u8; 16usize],
244        pub ioc_guid_or_service_id: u64,
245        pub target_port_id: u64,
246        pub device_id: u64,
247    }
248
249    #[repr(C, packed)]
250    pub struct Uart {
251        pub header: DevicePathHeader,
252        pub _reserved: u32,
253        pub baud_rate: u64,
254        pub data_bits: u8,
255        pub parity: device_path::messaging::Parity,
256        pub stop_bits: device_path::messaging::StopBits,
257    }
258
259    #[repr(C, packed)]
260    pub struct Vendor {
261        pub header: DevicePathHeader,
262        pub vendor_guid: Guid,
263        pub vendor_defined_data: [u8; 0usize],
264    }
265
266    #[repr(C, packed)]
267    pub struct SasEx {
268        pub header: DevicePathHeader,
269        pub sas_address: [u8; 8usize],
270        pub logical_unit_number: [u8; 8usize],
271        pub info: u16,
272        pub relative_target_port: u16,
273    }
274
275    #[repr(C, packed)]
276    pub struct Iscsi {
277        pub header: DevicePathHeader,
278        pub protocol: device_path::messaging::IscsiProtocol,
279        pub options: device_path::messaging::IscsiLoginOptions,
280        pub logical_unit_number: [u8; 8usize],
281        pub target_portal_group_tag: u16,
282        pub iscsi_target_name: [u8; 0usize],
283    }
284
285    #[repr(C, packed)]
286    pub struct NvmeNamespace {
287        pub header: DevicePathHeader,
288        pub namespace_identifier: u32,
289        pub ieee_extended_unique_identifier: u64,
290    }
291
292    #[repr(C, packed)]
293    pub struct Uri {
294        pub header: DevicePathHeader,
295        pub value: [u8; 0usize],
296    }
297
298    #[repr(C, packed)]
299    pub struct Ufs {
300        pub header: DevicePathHeader,
301        pub target_id: u8,
302        pub logical_unit_number: u8,
303    }
304
305    #[repr(C, packed)]
306    pub struct Sd {
307        pub header: DevicePathHeader,
308        pub slot_number: u8,
309    }
310
311    #[repr(C, packed)]
312    pub struct Bluetooth {
313        pub header: DevicePathHeader,
314        pub device_address: [u8; 6usize],
315    }
316
317    #[repr(C, packed)]
318    pub struct Wifi {
319        pub header: DevicePathHeader,
320        pub ssid: [u8; 32usize],
321    }
322
323    #[repr(C, packed)]
324    pub struct Emmc {
325        pub header: DevicePathHeader,
326        pub slot_number: u8,
327    }
328
329    #[repr(C, packed)]
330    pub struct BluetoothLe {
331        pub header: DevicePathHeader,
332        pub device_address: [u8; 6usize],
333        pub address_type: device_path::messaging::BluetoothLeAddressType,
334    }
335
336    #[repr(C, packed)]
337    pub struct Dns {
338        pub header: DevicePathHeader,
339        pub address_type: device_path::messaging::DnsAddressType,
340        pub addresses: [IpAddress; 0usize],
341    }
342
343    #[repr(C, packed)]
344    pub struct NvdimmNamespace {
345        pub header: DevicePathHeader,
346        pub uuid: [u8; 16usize],
347    }
348
349    #[repr(C, packed)]
350    pub struct RestService {
351        pub header: DevicePathHeader,
352        pub service_type: device_path::messaging::RestServiceType,
353        pub access_mode: device_path::messaging::RestServiceAccessMode,
354        pub vendor_guid_and_data: [u8; 0usize],
355    }
356
357    #[repr(C, packed)]
358    pub struct NvmeOfNamespace {
359        pub header: DevicePathHeader,
360        pub nidt: u8,
361        pub nid: [u8; 16usize],
362        pub subsystem_nqn: [u8; 0usize],
363    }
364
365    newtype_enum! { # [doc = " Whether the ATAPI device is primary or secondary."] pub enum PrimarySecondary : u8 => { # [doc = " Primary."] PRIMARY = 0x00 , # [doc = " Secondary."] SECONDARY = 0x01 , }
366
367    }
368
369    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 , }
370
371    }
372
373    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 , }
374
375    }
376
377    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 , }
378
379    }
380
381    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 ; }
382
383    }
384
385    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 , }
386
387    }
388
389    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 , }
390
391    }
392
393    newtype_enum! { # [doc = " iSCSI network protocol."] pub enum IscsiProtocol : u16 => { # [doc = " TCP."] TCP = 0x0000 , }
394
395    }
396
397    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 ; }
398
399    }
400
401    newtype_enum! { # [doc = " BluetoothLE address type."] pub enum BluetoothLeAddressType : u8 => { # [doc = " Public device address."] PUBLIC = 0x00 , # [doc = " Random device address."] RANDOM = 0x01 , }
402
403    }
404
405    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 , }
406
407    }
408
409    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 , }
410
411    }
412
413    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 , }
414
415    }
416}
417
418/// Device path nodes for [`DeviceType::MEDIA`].
419pub mod media {
420    use super::*;
421    #[repr(C, packed)]
422    pub struct HardDrive {
423        pub header: DevicePathHeader,
424        pub partition_number: u32,
425        pub partition_start: u64,
426        pub partition_size: u64,
427        pub partition_signature: [u8; 16usize],
428        pub partition_format: device_path::media::PartitionFormat,
429        pub signature_type: u8,
430    }
431
432    #[repr(C, packed)]
433    pub struct CdRom {
434        pub header: DevicePathHeader,
435        pub boot_entry: u32,
436        pub partition_start: u64,
437        pub partition_size: u64,
438    }
439
440    #[repr(C, packed)]
441    pub struct Vendor {
442        pub header: DevicePathHeader,
443        pub vendor_guid: Guid,
444        pub vendor_defined_data: [u8; 0usize],
445    }
446
447    #[repr(C, packed)]
448    pub struct FilePath {
449        pub header: DevicePathHeader,
450        pub path_name: [u16; 0usize],
451    }
452
453    #[repr(C, packed)]
454    pub struct Protocol {
455        pub header: DevicePathHeader,
456        pub protocol_guid: Guid,
457    }
458
459    #[repr(C, packed)]
460    pub struct PiwgFirmwareFile {
461        pub header: DevicePathHeader,
462        pub data: [u8; 0usize],
463    }
464
465    #[repr(C, packed)]
466    pub struct PiwgFirmwareVolume {
467        pub header: DevicePathHeader,
468        pub data: [u8; 0usize],
469    }
470
471    #[repr(C, packed)]
472    pub struct RelativeOffsetRange {
473        pub header: DevicePathHeader,
474        pub _reserved: u32,
475        pub starting_offset: u64,
476        pub ending_offset: u64,
477    }
478
479    #[repr(C, packed)]
480    pub struct RamDisk {
481        pub header: DevicePathHeader,
482        pub starting_address: u64,
483        pub ending_address: u64,
484        pub disk_type: device_path::media::RamDiskType,
485        pub disk_instance: u16,
486    }
487
488    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 , }
489
490    }
491
492    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") , }
493
494    }
495}
496
497/// Device path nodes for [`DeviceType::BIOS_BOOT_SPEC`].
498pub mod bios_boot_spec {
499    use super::*;
500    #[repr(C, packed)]
501    pub struct BootSpecification {
502        pub header: DevicePathHeader,
503        pub device_type: u16,
504        pub status_flag: u16,
505        pub description_string: [u8; 0usize],
506    }
507}