1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
//! Messaging device path types and parsing
//!
//! This module contains all messaging device path sub-types defined in UEFI 2.11.
//! Messaging device paths describe communication interfaces and protocols.
pub mod atapi;
pub mod bt;
pub mod btle;
pub mod dlu;
pub mod dns;
pub mod emmc;
pub mod fc;
pub mod i2o;
pub mod ib;
pub mod ieee1394;
pub mod ipv4;
pub mod ipv6;
pub mod iscsi;
pub mod mac;
pub mod nvdimm;
pub mod nvme;
pub mod nvme_of;
pub mod rest;
pub mod sasex;
pub mod sata;
pub mod scsi;
pub mod sd;
pub mod uart;
pub mod ufs;
pub mod uri;
pub mod usb;
pub mod vendor;
pub mod vlan;
pub mod wifi;
use crate::{Error, Head, Type};
/// UEFI Messaging Device Path Types
///
/// This enum represents all messaging device path sub-types defined in UEFI 2.11 specification.
/// Each variant corresponds to a specific messaging protocol or device interface.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum Messaging {
/// ATAPI Device Path (0x01) - IDE/ATAPI controller device
Atapi(atapi::Atapi),
/// SCSI Device Path (0x02) - SCSI target device
Scsi(scsi::Scsi),
/// Fibre Channel Device Path (0x03) - Fibre Channel target device
FibreChannel(fc::FibreChannel),
/// IEEE 1394 Device Path (0x04) - FireWire device
Ieee1394(ieee1394::Ieee1394),
/// USB Device Path (0x05) - USB device on specific port/interface
Usb(usb::Usb),
/// I2O Device Path (0x06) - I2O Random Block Storage Class device
I2O(i2o::I2o),
/// InfiniBand Device Path (0x09) - InfiniBand fabric device
InfiniBand(ib::InfiniBand),
/// Vendor-Defined Messaging Device Path (0x0A) - Vendor-specific messaging protocol
Vendor(vendor::Vendor),
/// MAC Address Device Path (0x0B) - Network interface by MAC address
MacAddress(mac::MacAddress),
/// IPv4 Device Path (0x0C) - IPv4 network connection
Ipv4(ipv4::Ipv4),
/// IPv6 Device Path (0x0D) - IPv6 network connection
Ipv6(ipv6::Ipv6),
/// UART Device Path (0x0E) - Serial UART device
Uart(uart::Uart),
/// USB Class Device Path (0x0F) - USB device by class/vendor/product
UsbClass(usb::UsbClass),
/// USB WWID Device Path (0x10) - USB device by World Wide ID
UsbWwid(usb::UsbWwid),
/// Device Logical Unit (0x11) - Logical unit number for multi-LUN devices
DeviceLogicalUnit(dlu::DeviceLogicalUnit),
/// SATA Device Path (0x12) - Serial ATA device
Sata(sata::Sata),
/// iSCSI Device Path (0x13) - iSCSI target device
IScsi(iscsi::IScsi),
/// VLAN Device Path (0x14) - 802.1Q VLAN interface
Vlan(vlan::Vlan),
/// Fibre Channel Ex Device Path (0x15) - Extended Fibre Channel target (byte arrays)
FibreChannelEx(fc::FibreChannelEx),
/// SAS Extended Device Path (0x16) - Serial Attached SCSI Extended
SasExtended(sasex::SasExtended),
/// NVMe Namespace Device Path (0x17) - NVMe namespace
NvmeNamespace(nvme::NvmeNamespace),
/// URI Device Path (0x18) - URI Device Path
Uri(uri::Uri),
/// UFS Device Path (0x19) - Universal Flash Storage
Ufs(ufs::Ufs),
/// SD Device Path (0x1A) - Secure Digital
Sd(sd::SecureDigital),
/// Bluetooth Device Path (0x1B) - Bluetooth device
Bluetooth(bt::Bluetooth),
/// Wi-Fi Device Path (0x1C) - Wi-Fi device
Wifi(wifi::Wifi),
/// eMMC Device Path (0x1D) - Embedded MultiMediaCard
EMmc(emmc::EMmc),
/// BluetoothLE Device Path (0x1E) - Bluetooth Low Energy
BluetoothLe(btle::BluetoothLe),
/// DNS Device Path (0x1F) - DNS device
Dns(dns::Dns),
/// NVDIMM Namespace Device Path (0x20) - NVDIMM Namespace
NvdimmNamespace(nvdimm::NvdimmNamespace),
/// REST Service Device Path (0x21) - REST service endpoint
RestService(rest::Rest),
/// NVMe-oF Namespace Device Path (0x22) - NVMe over Fabric Namespace
NvmeOfNamespace(nvme_of::NvmeOfNamespace),
}
impl TryFrom<Head<'_>> for Messaging {
type Error = Error;
fn try_from(head: Head<'_>) -> Result<Self, Self::Error> {
match head.subkind {
0x01 => TryFrom::try_from(head).map(Messaging::Atapi),
0x02 => TryFrom::try_from(head).map(Messaging::Scsi),
0x03 => TryFrom::try_from(head).map(Messaging::FibreChannel),
0x04 => TryFrom::try_from(head).map(Messaging::Ieee1394),
0x05 => TryFrom::try_from(head).map(Messaging::Usb),
0x06 => TryFrom::try_from(head).map(Messaging::I2O),
0x09 => TryFrom::try_from(head).map(Messaging::InfiniBand),
0x0A => TryFrom::try_from(head).map(Messaging::Vendor),
0x0B => TryFrom::try_from(head).map(Messaging::MacAddress),
0x0C => TryFrom::try_from(head).map(Messaging::Ipv4),
0x0D => TryFrom::try_from(head).map(Messaging::Ipv6),
0x0E => TryFrom::try_from(head).map(Messaging::Uart),
0x0F => TryFrom::try_from(head).map(Messaging::UsbClass),
0x10 => TryFrom::try_from(head).map(Messaging::UsbWwid),
0x11 => TryFrom::try_from(head).map(Messaging::DeviceLogicalUnit),
0x12 => TryFrom::try_from(head).map(Messaging::Sata),
0x13 => TryFrom::try_from(head).map(Messaging::IScsi),
0x14 => TryFrom::try_from(head).map(Messaging::Vlan),
0x15 => TryFrom::try_from(head).map(Messaging::FibreChannelEx),
0x16 => TryFrom::try_from(head).map(Messaging::SasExtended),
0x17 => TryFrom::try_from(head).map(Messaging::NvmeNamespace),
0x18 => TryFrom::try_from(head).map(Messaging::Uri),
0x19 => TryFrom::try_from(head).map(Messaging::Ufs),
0x1A => TryFrom::try_from(head).map(Messaging::Sd),
0x1B => TryFrom::try_from(head).map(Messaging::Bluetooth),
0x1C => TryFrom::try_from(head).map(Messaging::Wifi),
0x1D => TryFrom::try_from(head).map(Messaging::EMmc),
0x1E => TryFrom::try_from(head).map(Messaging::BluetoothLe),
0x1F => TryFrom::try_from(head).map(Messaging::Dns),
0x20 => TryFrom::try_from(head).map(Messaging::NvdimmNamespace),
0x21 => TryFrom::try_from(head).map(Messaging::RestService),
0x22 => TryFrom::try_from(head).map(Messaging::NvmeOfNamespace),
n => Err(Error::UnknownSubType(Type::Messaging, n)),
}
}
}