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 / hii / database.rs
| 1 | // SPDX-License-Identifier: MIT OR Apache-2.0 |
| 2 | |
| 3 | //! Bindings for HII Database Protocol |
| 4 | |
| 5 | use super::{HiiHandle, HiiPackageHeader, HiiPackageListHeader, KeyDescriptor}; |
| 6 | use crate::{Guid, Handle, Status, guid, newtype_enum}; |
| 7 | use core::mem::offset_of; |
| 8 | |
| 9 | /// EFI_HII_KEYBOARD_LAYOUT |
| 10 | #[derive(Debug)] |
| 11 | #[repr(C, packed)] |
| 12 | pub struct HiiKeyboardLayout { |
| 13 | pub layout_length: u16, |
| 14 | pub guid: Guid, |
| 15 | pub layout_descriptor_string_offset: u32, |
| 16 | pub descriptor_count: u8, |
| 17 | pub descriptors: [KeyDescriptor; 0], |
| 18 | } |
| 19 | |
| 20 | // Compile-time ABI check. |
| 21 | const _: () = { |
| 22 | assert!(offset_of!(HiiKeyboardLayout, guid) == 2); |
| 23 | assert!(offset_of!(HiiKeyboardLayout, layout_descriptor_string_offset) == 18); |
| 24 | assert!(offset_of!(HiiKeyboardLayout, descriptor_count) == 22); |
| 25 | assert!(offset_of!(HiiKeyboardLayout, descriptors) == 23); |
| 26 | }; |
| 27 | |
| 28 | newtype_enum! { |
| 29 | /// EFI_HII_DATABASE_NOTIFY_TYPE |
| 30 | pub enum HiiDatabaseNotifyType: usize => { |
| 31 | NEW_PACK = 1 << 0, |
| 32 | REMOVE_PACK = 1 << 1, |
| 33 | EXPORT_PACK = 1 << 2, |
| 34 | ADD_PACK = 1 << 3, |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | /// EFI_HII_DATABASE_NOTIFY |
| 39 | pub type HiiDatabaseNotifyFn = unsafe extern "efiapi" fn( |
| 40 | package_type: u8, |
| 41 | package_guid: *const Guid, |
| 42 | package: *const HiiPackageHeader, |
| 43 | handle: HiiHandle, |
| 44 | notify_type: HiiDatabaseNotifyType, |
| 45 | ) -> Status; |
| 46 | |
| 47 | /// EFI_HII_DATABASE_PROTOCOL |
| 48 | #[derive(Debug)] |
| 49 | #[repr(C)] |
| 50 | pub struct HiiDatabaseProtocol { |
| 51 | pub new_package_list: unsafe extern "efiapi" fn( |
| 52 | this: *const Self, |
| 53 | package_list: *const HiiPackageListHeader, |
| 54 | driver_handle: Handle, |
| 55 | handle: *mut HiiHandle, |
| 56 | ) -> Status, |
| 57 | pub remove_package_list: |
| 58 | unsafe extern "efiapi" fn(this: *const Self, handle: HiiHandle) -> Status, |
| 59 | pub update_package_list: unsafe extern "efiapi" fn( |
| 60 | this: *const Self, |
| 61 | handle: HiiHandle, |
| 62 | package_list: *const HiiPackageListHeader, |
| 63 | ) -> Status, |
| 64 | pub list_package_lists: unsafe extern "efiapi" fn( |
| 65 | this: *const Self, |
| 66 | package_type: u8, |
| 67 | package_guid: *const Guid, |
| 68 | handle_buffer_length: *mut usize, |
| 69 | handle: *mut HiiHandle, |
| 70 | ) -> Status, |
| 71 | pub export_package_lists: unsafe extern "efiapi" fn( |
| 72 | this: *const Self, |
| 73 | handle: HiiHandle, |
| 74 | buffer_size: *mut usize, |
| 75 | buffer: *mut HiiPackageListHeader, |
| 76 | ) -> Status, |
| 77 | pub register_package_notify: unsafe extern "efiapi" fn( |
| 78 | this: *const Self, |
| 79 | package_type: u8, |
| 80 | package_guid: *const Guid, |
| 81 | package_notify_fn: HiiDatabaseNotifyFn, |
| 82 | notify_type: HiiDatabaseNotifyType, |
| 83 | notify_handle: *mut Handle, |
| 84 | ) -> Status, |
| 85 | pub unregister_package_notify: |
| 86 | unsafe extern "efiapi" fn(this: *const Self, notification_handle: Handle) -> Status, |
| 87 | pub find_keyboard_layouts: unsafe extern "efiapi" fn( |
| 88 | this: *const Self, |
| 89 | key_guid_buffer_length: *mut u16, |
| 90 | key_guid_buffer: *mut Guid, |
| 91 | ) -> Status, |
| 92 | pub get_keyboard_layout: unsafe extern "efiapi" fn( |
| 93 | this: *const Self, |
| 94 | key_guid: *const Guid, |
| 95 | keyboard_layout_length: *mut u16, |
| 96 | keyboard_layout: *mut HiiKeyboardLayout, |
| 97 | ) -> Status, |
| 98 | pub set_keyboard_layout: |
| 99 | unsafe extern "efiapi" fn(this: *const Self, key_guid: *const Guid) -> Status, |
| 100 | pub get_package_list_handle: unsafe extern "efiapi" fn( |
| 101 | this: *const Self, |
| 102 | package_list_handle: HiiHandle, |
| 103 | driver_handle: *mut Handle, |
| 104 | ) -> Status, |
| 105 | } |
| 106 | |
| 107 | impl HiiDatabaseProtocol { |
| 108 | pub const GUID: Guid = guid!("ef9fc172-a1b2-4693-b327-6d32fc416042"); |
| 109 | } |