const std = @import("std");
const uefi = std.os.uefi;
const Status = uefi.Status;
const cc = uefi.cc;
pub const EfiBlockMedia = extern struct {
media_id: u32,
removable_media: bool,
media_present: bool,
logical_partition: bool,
read_only: bool,
write_caching: bool,
block_size: u32,
io_align: u32,
last_block: u64,
lowest_aligned_lba: u64,
logical_blocks_per_physical_block: u32,
optimal_transfer_length_granularity: u32,
};
pub const BlockIoProtocol = extern struct {
const Self = @This();
revision: u64,
media: *EfiBlockMedia,
_reset: *const fn (*BlockIoProtocol, extended_verification: bool) callconv(cc) Status,
_read_blocks: *const fn (*BlockIoProtocol, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) callconv(cc) Status,
_write_blocks: *const fn (*BlockIoProtocol, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) callconv(cc) Status,
_flush_blocks: *const fn (*BlockIoProtocol) callconv(cc) Status,
pub fn reset(self: *Self, extended_verification: bool) Status {
return self._reset(self, extended_verification);
}
pub fn readBlocks(self: *Self, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) Status {
return self._read_blocks(self, media_id, lba, buffer_size, buf);
}
pub fn writeBlocks(self: *Self, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) Status {
return self._write_blocks(self, media_id, lba, buffer_size, buf);
}
pub fn flushBlocks(self: *Self) Status {
return self._flush_blocks(self);
}
pub const guid align(8) = uefi.Guid{
.time_low = 0x964e5b21,
.time_mid = 0x6459,
.time_high_and_version = 0x11d2,
.clock_seq_high_and_reserved = 0x8e,
.clock_seq_low = 0x39,
.node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b },
};
};