uefi_raw/protocol/
disk.rs

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
use crate::{guid, Event, Guid, Status};
use core::ffi::c_void;

#[derive(Debug)]
#[repr(C)]
pub struct DiskIoProtocol {
    pub revision: u64,
    pub read_disk: unsafe extern "efiapi" fn(
        this: *const Self,
        media_id: u32,
        offset: u64,
        buffer_size: usize,
        buffer: *mut c_void,
    ) -> Status,
    pub write_disk: unsafe extern "efiapi" fn(
        this: *mut Self,
        media_id: u32,
        offset: u64,
        buffer_size: usize,
        buffer: *const c_void,
    ) -> Status,
}

impl DiskIoProtocol {
    pub const GUID: Guid = guid!("ce345171-ba0b-11d2-8e4f-00a0c969723b");
    pub const REVISION: u64 = 0x00010000;
}

#[repr(C)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd)]
pub struct DiskIo2Token {
    pub event: Event,
    pub transaction_status: Status,
}

#[derive(Debug)]
#[repr(C)]
pub struct DiskIo2Protocol {
    pub revision: u64,
    pub cancel: unsafe extern "efiapi" fn(this: *mut Self) -> Status,
    pub read_disk_ex: unsafe extern "efiapi" fn(
        this: *const Self,
        media_id: u32,
        offset: u64,
        token: *mut DiskIo2Token,
        buffer_size: usize,
        buffer: *mut c_void,
    ) -> Status,
    pub write_disk_ex: unsafe extern "efiapi" fn(
        this: *mut Self,
        media_id: u32,
        offset: u64,
        token: *mut DiskIo2Token,
        buffer_size: usize,
        buffer: *const c_void,
    ) -> Status,
    pub flush_disk_ex:
        unsafe extern "efiapi" fn(this: *mut Self, token: *mut DiskIo2Token) -> Status,
}

impl DiskIo2Protocol {
    pub const GUID: Guid = guid!("151c8eae-7f2c-472c-9e54-9828194f6a88");
    pub const REVISION: u64 = 0x00020000;
}