Skip to content

Commit 0bcde9a

Browse files
committed
uefi-raw: add BlockIo2 protocol
1 parent 585b4dd commit 0bcde9a

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

uefi-raw/src/protocol/block.rs

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: MIT OR Apache-2.0
22

3-
use crate::{Boolean, Guid, Status, guid};
3+
use crate::{Boolean, Event, Guid, Status, guid};
44
use core::ffi::c_void;
55

66
/// Logical block address.
@@ -54,3 +54,39 @@ pub struct BlockIoProtocol {
5454
impl BlockIoProtocol {
5555
pub const GUID: Guid = guid!("964e5b21-6459-11d2-8e39-00a0c969723b");
5656
}
57+
58+
#[repr(C)]
59+
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd)]
60+
pub struct BlockIo2Token {
61+
pub event: Event,
62+
pub transaction_status: Status,
63+
}
64+
65+
#[derive(Debug)]
66+
#[repr(C)]
67+
pub struct BlockIo2Protocol {
68+
pub media: *const BlockIoMedia,
69+
pub reset: unsafe extern "efiapi" fn(this: *mut Self, extended_verification: Boolean) -> Status,
70+
pub read_blocks_ex: unsafe extern "efiapi" fn(
71+
this: *const Self,
72+
media_id: u32,
73+
lba: Lba,
74+
token: *mut BlockIo2Token,
75+
buffer_size: usize,
76+
buffer: *mut c_void,
77+
) -> Status,
78+
pub write_blocks_ex: unsafe extern "efiapi" fn(
79+
this: *mut Self,
80+
media_id: u32,
81+
lba: Lba,
82+
token: *mut BlockIo2Token,
83+
buffer_size: usize,
84+
buffer: *const c_void,
85+
) -> Status,
86+
pub flush_blocks_ex:
87+
unsafe extern "efiapi" fn(this: *mut Self, token: *mut BlockIo2Token) -> Status,
88+
}
89+
90+
impl BlockIo2Protocol {
91+
pub const GUID: Guid = guid!("a77b2472-e282-4e9f-a245-c2c0e27bbcc1");
92+
}

0 commit comments

Comments
 (0)