summaryrefslogtreecommitdiffstats
path: root/vendor/r-efi/src/protocols/device_path.rs
blob: 98fcc094e3b119b54edf5f175ef8ef19c65e73b7 (plain)
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
//! Device Path Protocol
//!
//! The device path protocol defines how to obtain generic path/location information
//! concerning the phisycal or logical device.

pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
    0x09576e91,
    0x6d3f,
    0x11d2,
    0x8e,
    0x39,
    &[0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b],
);

pub const TYPE_HARDWARE: u8 = 0x01;
pub const TYPE_ACPI: u8 = 0x02;
pub const TYPE_MESSAGING: u8 = 0x03;
pub const TYPE_MEDIA: u8 = 0x04;
pub const TYPE_BIOS: u8 = 0x05;
pub const TYPE_END: u8 = 0x7f;

#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct Protocol {
    pub r#type: u8,
    pub sub_type: u8,
    pub length: [u8; 2],
}

#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct End {
    pub header: Protocol,
}

impl End {
    pub const SUBTYPE_INSTANCE: u8 = 0x01;
    pub const SUBTYPE_ENTIRE: u8 = 0xff;
}

#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct Hardware {
    pub header: Protocol,
}

impl Hardware {
    pub const SUBTYPE_PCI: u8 = 0x01;
    pub const SUBTYPE_PCCARD: u8 = 0x02;
    pub const SUBTYPE_MMAP: u8 = 0x03;
    pub const SUBTYPE_VENDOR: u8 = 0x04;
    pub const SUBTYPE_CONTROLLER: u8 = 0x05;
    pub const SUBTYPE_BMC: u8 = 0x06;
}

#[repr(C, packed)]
#[derive(Clone, Copy, Debug)]
pub struct HardDriveMedia {
    pub header: Protocol,
    pub partition_number: u32,
    pub partition_start: u64,
    pub partition_size: u64,
    pub partition_signature: [u8; 16],
    pub partition_format: u8,
    pub signature_type: u8,
}