uefi_raw/protocol/
device_path.rs

1use crate::{guid, Char16, 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#[derive(Debug)]
11#[repr(C)]
12pub struct DevicePathProtocol {
13    pub major_type: u8,
14    pub sub_type: u8,
15    pub length: [u8; 2],
16    // followed by payload (dynamically sized)
17}
18
19impl DevicePathProtocol {
20    pub const GUID: Guid = guid!("09576e91-6d3f-11d2-8e39-00a0c969723b");
21}
22
23#[derive(Debug)]
24#[repr(C)]
25pub struct DevicePathToTextProtocol {
26    pub convert_device_node_to_text: unsafe extern "efiapi" fn(
27        device_node: *const DevicePathProtocol,
28        display_only: bool,
29        allow_shortcuts: bool,
30    ) -> *const Char16,
31    pub convert_device_path_to_text: unsafe extern "efiapi" fn(
32        device_path: *const DevicePathProtocol,
33        display_only: bool,
34        allow_shortcuts: bool,
35    ) -> *const Char16,
36}
37
38impl DevicePathToTextProtocol {
39    pub const GUID: Guid = guid!("8b843e20-8132-4852-90cc-551a4e4a7f1c");
40}
41
42#[derive(Debug)]
43#[repr(C)]
44pub struct DevicePathFromTextProtocol {
45    pub convert_text_to_device_node:
46        unsafe extern "efiapi" fn(text_device_node: *const Char16) -> *const DevicePathProtocol,
47    pub convert_text_to_device_path:
48        unsafe extern "efiapi" fn(text_device_path: *const Char16) -> *const DevicePathProtocol,
49}
50
51impl DevicePathFromTextProtocol {
52    pub const GUID: Guid = guid!("05c99a21-c70f-4ad2-8a5f-35df3343f51e");
53}