aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / vendor / uefi-raw / src / protocol / disk.rs
| 1 | // SPDX-License-Identifier: MIT OR Apache-2.0 |
| 2 | |
| 3 | use crate::{Event, Guid, Status, guid}; |
| 4 | use core::ffi::c_void; |
| 5 | |
| 6 | #[derive(Debug)] |
| 7 | #[repr(C)] |
| 8 | pub struct DiskIoProtocol { |
| 9 | pub revision: u64, |
| 10 | pub read_disk: unsafe extern "efiapi" fn( |
| 11 | this: *const Self, |
| 12 | media_id: u32, |
| 13 | offset: u64, |
| 14 | buffer_size: usize, |
| 15 | buffer: *mut c_void, |
| 16 | ) -> Status, |
| 17 | pub write_disk: unsafe extern "efiapi" fn( |
| 18 | this: *mut Self, |
| 19 | media_id: u32, |
| 20 | offset: u64, |
| 21 | buffer_size: usize, |
| 22 | buffer: *const c_void, |
| 23 | ) -> Status, |
| 24 | } |
| 25 | |
| 26 | impl DiskIoProtocol { |
| 27 | pub const GUID: Guid = guid!("ce345171-ba0b-11d2-8e4f-00a0c969723b"); |
| 28 | pub const REVISION: u64 = 0x00010000; |
| 29 | } |
| 30 | |
| 31 | #[repr(C)] |
| 32 | #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd)] |
| 33 | pub struct DiskIo2Token { |
| 34 | pub event: Event, |
| 35 | pub transaction_status: Status, |
| 36 | } |
| 37 | |
| 38 | #[derive(Debug)] |
| 39 | #[repr(C)] |
| 40 | pub struct DiskIo2Protocol { |
| 41 | pub revision: u64, |
| 42 | pub cancel: unsafe extern "efiapi" fn(this: *mut Self) -> Status, |
| 43 | pub read_disk_ex: unsafe extern "efiapi" fn( |
| 44 | this: *const Self, |
| 45 | media_id: u32, |
| 46 | offset: u64, |
| 47 | token: *mut DiskIo2Token, |
| 48 | buffer_size: usize, |
| 49 | buffer: *mut c_void, |
| 50 | ) -> Status, |
| 51 | pub write_disk_ex: unsafe extern "efiapi" fn( |
| 52 | this: *mut Self, |
| 53 | media_id: u32, |
| 54 | offset: u64, |
| 55 | token: *mut DiskIo2Token, |
| 56 | buffer_size: usize, |
| 57 | buffer: *const c_void, |
| 58 | ) -> Status, |
| 59 | pub flush_disk_ex: |
| 60 | unsafe extern "efiapi" fn(this: *mut Self, token: *mut DiskIo2Token) -> Status, |
| 61 | } |
| 62 | |
| 63 | impl DiskIo2Protocol { |
| 64 | pub const GUID: Guid = guid!("151c8eae-7f2c-472c-9e54-9828194f6a88"); |
| 65 | pub const REVISION: u64 = 0x00020000; |
| 66 | } |
| 67 | |
| 68 | /// DiskInfo protocol (EFI_DISK_INFO_PROTOCOL) |
| 69 | /// |
| 70 | /// See: UEFI Platform Initialization Specification |
| 71 | #[derive(Debug)] |
| 72 | #[repr(C)] |
| 73 | pub struct DiskInfoProtocol { |
| 74 | pub interface: Guid, |
| 75 | pub inquiry: unsafe extern "efiapi" fn( |
| 76 | this: *const Self, |
| 77 | inquiry_data: *mut c_void, |
| 78 | inquiry_data_size: *mut u32, |
| 79 | ) -> Status, |
| 80 | pub identify: unsafe extern "efiapi" fn( |
| 81 | this: *const Self, |
| 82 | identify_data: *mut c_void, |
| 83 | identify_data_size: *mut u32, |
| 84 | ) -> Status, |
| 85 | pub sense_data: unsafe extern "efiapi" fn( |
| 86 | this: *const Self, |
| 87 | sense_data: *mut c_void, |
| 88 | sense_data_size: *mut u32, |
| 89 | sense_data_number: *mut u8, |
| 90 | ) -> Status, |
| 91 | pub which_ide: unsafe extern "efiapi" fn( |
| 92 | this: *const Self, |
| 93 | ide_channel: *mut u32, |
| 94 | ide_device: *mut u32, |
| 95 | ) -> Status, |
| 96 | } |
| 97 | |
| 98 | impl DiskInfoProtocol { |
| 99 | pub const GUID: Guid = guid!("d432a67f-14dc-484b-b3bb-3f0291849327"); |
| 100 | |
| 101 | pub const IDE_INTERFACE_GUID: Guid = guid!("5e948fe3-26d3-42b5-af17-610287188dec"); |
| 102 | pub const UFS_INTERFACE_GUID: Guid = guid!("4b3029cc-6b98-47fb-bc96-76dcb80441f0"); |
| 103 | pub const USB_INTERFACE_GUID: Guid = guid!("cb871572-c11a-47b5-b492-675eafa77727"); |
| 104 | pub const AHCI_INTERFACE_GUID: Guid = guid!("9e498932-4abc-45af-a34d-0247787be7c6"); |
| 105 | pub const NVME_INTERFACE_GUID: Guid = guid!("3ab14680-5d3f-4a4d-bcdc-cc380018c7f7"); |
| 106 | pub const SCSI_INTERFACE_GUID: Guid = guid!("08f74baa-ea36-41d9-9521-21a70f8780bc"); |
| 107 | pub const SD_MMC_INTERFACE_GUID: Guid = guid!("8deec992-d39c-4a5c-ab6b-986e14242b9d"); |
| 108 | } |