Skip to content

Commit 75430f0

Browse files
uefi-raw: Add DevicePathProtocol
1 parent c8886d5 commit 75430f0

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

uefi-raw/src/protocol/device_path.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
use crate::{guid, Guid};
2+
3+
/// Device path protocol.
4+
///
5+
/// A device path contains one or more device path instances made of up
6+
/// variable-length nodes.
7+
///
8+
/// Note that the fields in this struct define the header at the start of each
9+
/// node; a device path is typically larger than these four bytes.
10+
#[repr(C)]
11+
pub struct DevicePathProtocol {
12+
pub major_type: u8,
13+
pub sub_type: u8,
14+
pub length: [u8; 2],
15+
}
16+
17+
impl DevicePathProtocol {
18+
pub const GUID: Guid = guid!("09576e91-6d3f-11d2-8e39-00a0c969723b");
19+
}

uefi-raw/src/protocol/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
//! ID. They can be implemented by a UEFI driver or occasionally by a
55
//! UEFI application.
66
7+
pub mod device_path;
78
pub mod rng;

uefi/src/proto/device_path/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ impl ToOwned for DevicePathInstance {
288288
/// [module-level documentation]: crate::proto::device_path
289289
/// [`END_ENTIRE`]: DeviceSubType::END_ENTIRE
290290
#[repr(C, packed)]
291-
#[unsafe_protocol("09576e91-6d3f-11d2-8e39-00a0c969723b")]
291+
#[unsafe_protocol(uefi_raw::protocol::device_path::DevicePathProtocol::GUID)]
292292
#[derive(Eq, Pointee)]
293293
pub struct DevicePath {
294294
data: [u8],

0 commit comments

Comments
 (0)