Debian Codegraph @

.cargo/vendor/r-efi/src/protocols/block_io.rs

raw
1 //! Block I/O Protocol
2 //!
3 //! Used to abstract mass storage devices to allow code running in the EFI boot services environment
4 //! to access the storage devices without specific knowledge of the type of device or controller that
5 //! manages the device.
6
7 pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
8 0x964e5b21,
9 0x6459,
10 0x11d2,
11 0x8e,
12 0x39,
13 &[0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b],
14 );
15
16 pub const REVISION: u64 = 0x0000000000010000u64;
17 pub const REVISION2: u64 = 0x0000000000020001u64;
18 pub const REVISION3: u64 = 0x000000000002001fu64;
19
20 #[repr(C)]
21 #[derive(Clone, Copy, Debug)]
22 pub struct Media {
23 pub media_id: u32,
24 pub removable_media: bool,
25 pub media_present: bool,
26 pub logical_partition: bool,
27 pub read_only: bool,
28 pub write_caching: bool,
29 pub block_size: u32,
30 pub io_align: u32,
31 pub last_block: crate::base::Lba,
32 pub lowest_aligned_lba: crate::base::Lba,
33 pub logical_blocks_per_physical_block: u32,
34 pub optimal_transfer_length_granularity: u32,
35 }
36
37 pub type ProtocolReset = eficall! {fn(
38 *mut Protocol,
39 crate::base::Boolean,
40 ) -> crate::base::Status};
41
42 pub type ProtocolReadBlocks = eficall! {fn(
43 *mut Protocol,
44 u32,
45 crate::base::Lba,
46 usize,
47 *mut core::ffi::c_void,
48 ) -> crate::base::Status};
49
50 pub type ProtocolWriteBlocks = eficall! {fn(
51 *mut Protocol,
52 u32,
53 crate::base::Lba,
54 usize,
55 *mut core::ffi::c_void,
56 ) -> crate::base::Status};
57
58 pub type ProtocolFlushBlocks = eficall! {fn(
59 *mut Protocol,
60 ) -> crate::base::Status};
61
62 #[repr(C)]
63 pub struct Protocol {
64 pub revision: u64,
65 pub media: *const Media,
66 pub reset: ProtocolReset,
67 pub read_blocks: ProtocolReadBlocks,
68 pub write_blocks: ProtocolWriteBlocks,
69 pub flush_blocks: ProtocolFlushBlocks,
70 }