uefi_raw/protocol/
block.rs1use crate::{guid, Guid, Status};
2use core::ffi::c_void;
3
4pub type Lba = u64;
6
7#[repr(C)]
9#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
10pub struct BlockIoMedia {
11 pub media_id: u32,
12 pub removable_media: bool,
13 pub media_present: bool,
14 pub logical_partition: bool,
15 pub read_only: bool,
16 pub write_caching: bool,
17 pub block_size: u32,
18 pub io_align: u32,
19 pub last_block: Lba,
20
21 pub lowest_aligned_lba: Lba,
23 pub logical_blocks_per_physical_block: u32,
24
25 pub optimal_transfer_length_granularity: u32,
27}
28
29#[derive(Debug)]
30#[repr(C)]
31pub struct BlockIoProtocol {
32 pub revision: u64,
33 pub media: *const BlockIoMedia,
34 pub reset: unsafe extern "efiapi" fn(this: *mut Self, extended_verification: bool) -> Status,
35 pub read_blocks: unsafe extern "efiapi" fn(
36 this: *const Self,
37 media_id: u32,
38 lba: Lba,
39 buffer_size: usize,
40 buffer: *mut c_void,
41 ) -> Status,
42 pub write_blocks: unsafe extern "efiapi" fn(
43 this: *mut Self,
44 media_id: u32,
45 lba: Lba,
46 buffer_size: usize,
47 buffer: *const c_void,
48 ) -> Status,
49 pub flush_blocks: unsafe extern "efiapi" fn(this: *mut Self) -> Status,
50}
51
52impl BlockIoProtocol {
53 pub const GUID: Guid = guid!("964e5b21-6459-11d2-8e39-00a0c969723b");
54}