Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/vendor/uefi-raw/src/protocol/hii/mod.rs # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / vendor / uefi-raw / src / protocol / hii / mod.rs` 302 lines ยท 6450 bytes Raw Blame History 1 // SPDX-License-Identifier: MIT OR Apache-2.0 2 3 //! HII Protocols 4 5 pub mod config; 6 pub mod database; 7 pub mod font; 8 pub mod form_browser; 9 pub mod ifr; 10 pub mod image; 11 pub mod popup; 12 pub mod string; 13 14 use crate::{Char16, Guid, newtype_enum}; 15 use core::ffi; 16 17 pub type HiiHandle = *mut ffi::c_void; 18 19 pub type QuestionId = u16; 20 pub type ImageId = u16; 21 pub type StringId = u16; 22 pub type FormId = u16; 23 pub type VarstoreId = u16; 24 pub type AnimationId = u16; 25 pub type DefaultId = u16; 26 27 /// `EFI_HII_PACKAGE_HEADER` 28 #[derive(Debug, Clone, Copy)] 29 #[repr(C, packed)] 30 pub struct HiiPackageHeader { 31 pub length_and_type: u32, 32 pub data: [u8; 0], 33 } 34 35 // Compile-time ABI check. 36 const _: () = { 37 assert!(size_of::() == 4); 38 assert!(align_of::() == 1); 39 }; 40 41 /// `EFI_HII_PACKAGE_LIST_HEADER` 42 #[derive(Debug, Clone, Copy)] 43 #[repr(C, packed)] 44 pub struct HiiPackageListHeader { 45 pub package_list_guid: Guid, 46 pub package_length: u32, 47 } 48 49 // Compile-time ABI check. 50 const _: () = { 51 assert!(size_of::() == 20); 52 assert!(align_of::() == 1); 53 }; 54 55 newtype_enum! { 56 /// EFI_KEY: A physical key on a keyboard. 57 pub enum Key: u32 => { 58 LCTRL = 0, 59 A0 = 1, 60 LALT = 2, 61 SPACEBAR = 3, 62 A2 = 4, 63 A3 = 5, 64 A4 = 6, 65 RCTRL = 7, 66 LEFT_ARROW = 8, 67 DOWN_ARROW = 9, 68 RIGHT_ARROW = 10, 69 ZERO = 11, 70 PERIOD = 12, 71 ENTER = 13, 72 LSHIFT = 14, 73 B0 = 15, 74 B1 = 16, 75 B2 = 17, 76 B3 = 18, 77 B4 = 19, 78 B5 = 20, 79 B6 = 21, 80 B7 = 22, 81 B8 = 23, 82 B9 = 24, 83 B10 = 25, 84 RSHIFT = 26, 85 UP_ARROW = 27, 86 ONE = 28, 87 TWO = 29, 88 THREE = 30, 89 CAPS_LOCK = 31, 90 C1 = 32, 91 C2 = 33, 92 C3 = 34, 93 C4 = 35, 94 C5 = 36, 95 C6 = 37, 96 C7 = 38, 97 C8 = 39, 98 C9 = 40, 99 C10 = 41, 100 C11 = 42, 101 C12 = 43, 102 FOUR = 44, 103 FIVE = 45, 104 SIX = 46, 105 PLUS = 47, 106 TAB = 48, 107 D1 = 49, 108 D2 = 50, 109 D3 = 51, 110 D4 = 52, 111 D5 = 53, 112 D6 = 54, 113 D7 = 55, 114 D8 = 56, 115 D9 = 57, 116 D10 = 58, 117 D11 = 59, 118 D12 = 60, 119 D13 = 61, 120 DEL = 62, 121 END = 63, 122 PG_DN = 64, 123 SEVEN = 65, 124 EIGHT = 66, 125 NINE = 67, 126 E0 = 68, 127 E1 = 69, 128 E2 = 70, 129 E3 = 71, 130 E4 = 72, 131 E5 = 73, 132 E6 = 74, 133 E7 = 75, 134 E8 = 76, 135 E9 = 77, 136 E10 = 78, 137 E11 = 79, 138 E12 = 80, 139 BACK_SPACE = 81, 140 INS = 82, 141 HOME = 83, 142 PG_UP = 84, 143 NLCK = 85, 144 SLASH = 86, 145 ASTERISK = 87, 146 MINUS = 88, 147 ESC = 89, 148 F1 = 90, 149 F2 = 91, 150 F3 = 92, 151 F4 = 93, 152 F5 = 94, 153 F6 = 95, 154 F7 = 96, 155 F8 = 97, 156 F9 = 98, 157 F10 = 99, 158 F11 = 100, 159 F12 = 101, 160 PRINT = 102, 161 SLCK = 103, 162 PAUSE = 104, 163 INTL0 = 105, 164 INTL1 = 106, 165 INTL2 = 107, 166 INTL3 = 108, 167 INTL4 = 109, 168 INTL5 = 110, 169 INTL6 = 111, 170 INTL7 = 112, 171 INTL8 = 113, 172 INTL9 = 114, 173 } 174 } 175 176 // NOTE: This has no associated type in UEFI; They are all top-level defines. 177 newtype_enum! { 178 /// Key modifier values 179 pub enum Modifier: u16 => { 180 NULL = 0x0000, 181 LEFT_CONTROL = 0x0001, 182 RIGHT_CONTROL = 0x0002, 183 LEFT_ALT = 0x0003, 184 RIGHT_ALT = 0x0004, 185 ALT_GR = 0x0005, 186 INSERT = 0x0006, 187 DELETE = 0x0007, 188 PAGE_DOWN = 0x0008, 189 PAGE_UP = 0x0009, 190 HOME = 0x000A, 191 END = 0x000B, 192 LEFT_SHIFT = 0x000C, 193 RIGHT_SHIFT = 0x000D, 194 CAPS_LOCK = 0x000E, 195 NUM_LOCK = 0x000F, 196 LEFT_ARROW = 0x0010, 197 RIGHT_ARROW = 0x0011, 198 DOWN_ARROW = 0x0012, 199 UP_ARROW = 0x0013, 200 NS_KEY = 0x0014, 201 NS_KEY_DEPENDENCY = 0x0015, 202 FUNCTION_KEY_ONE = 0x0016, 203 FUNCTION_KEY_TWO = 0x0017, 204 FUNCTION_KEY_THREE = 0x0018, 205 FUNCTION_KEY_FOUR = 0x0019, 206 FUNCTION_KEY_FIVE = 0x001A, 207 FUNCTION_KEY_SIX = 0x001B, 208 FUNCTION_KEY_SEVEN = 0x001C, 209 FUNCTION_KEY_EIGHT = 0x001D, 210 FUNCTION_KEY_NINE = 0x001E, 211 FUNCTION_KEY_TEN = 0x001F, 212 FUNCTION_KEY_ELEVEN = 0x0020, 213 FUNCTION_KEY_TWELVE = 0x0021, 214 PRINT = 0x0022, 215 SYS_REQUEST = 0x0023, 216 SCROLL_LOCK = 0x0024, 217 PAUSE = 0x0025, 218 BREAK = 0x0026, 219 LEFT_LOGO = 0x0027, 220 RIGHT_LOGO = 0x0028, 221 MENU = 0x0029, 222 } 223 } 224 225 /// EFI_KEY_DESCRIPTOR 226 #[derive(Clone, Copy, Debug)] 227 #[repr(C, packed)] 228 pub struct KeyDescriptor { 229 pub key: Key, 230 pub unicode: Char16, 231 pub shifted_unicode: Char16, 232 pub alt_gr_unicode: Char16, 233 pub shifted_alt_gr_unicode: Char16, 234 pub modifier: u16, 235 pub affected_attribute: u16, 236 } 237 238 // Compile-time ABI check. 239 const _: () = { 240 assert!(size_of::() == 16); 241 assert!(align_of::() == 1); 242 }; 243 244 /// `EFI_HII_TIME` 245 #[repr(C, packed)] 246 #[derive(Debug, Copy, Clone)] 247 pub struct HiiTime { 248 pub hour: u8, 249 pub minute: u8, 250 pub second: u8, 251 } 252 253 // Compile-time ABI check. 254 const _: () = { 255 assert!(size_of::() == 3); 256 assert!(align_of::() == 1); 257 }; 258 259 /// `EFI_HII_DATE` 260 #[repr(C, packed)] 261 #[derive(Debug, Copy, Clone)] 262 pub struct HiiDate { 263 pub year: u16, 264 pub month: u8, 265 pub day: u8, 266 } 267 268 // Compile-time ABI check. 269 const _: () = { 270 assert!(size_of::() == 4); 271 assert!(align_of::() == 1); 272 }; 273 274 /// `EFI_HII_REF` 275 #[repr(C, packed)] 276 #[derive(Debug, Copy, Clone)] 277 pub struct HiiRef { 278 pub question_id: QuestionId, 279 pub form_id: FormId, 280 pub guid: Guid, 281 pub string_id: StringId, 282 } 283 284 // Compile-time ABI check. 285 const _: () = { 286 assert!(size_of::() == 22); 287 assert!(align_of::() == 1); 288 }; 289 290 /// `EFI_HII_FORM_PACKAGE_HDR` 291 #[derive(Clone, Copy, Debug)] 292 #[repr(C, packed)] 293 pub struct HiiFormPackageHdr { 294 // NOTE: UEFI spec incorrectly declares this a pointer. 295 pub header: HiiPackageHeader, 296 } 297 298 // Compile-time ABI check. 299 const _: () = { 300 assert!(size_of::() == 4); 301 assert!(align_of::() == 1); 302 };