1 /** @file 2 This file defines the encoding for the VFR (Visual Form Representation) language. 3 Framework IFR is primarily consumed by the EFI presentation engine, and produced by EFI 4 internal application and drivers as well as all add-in card option-ROM drivers 5 6 Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR> 7 SPDX-License-Identifier: BSD-2-Clause-Patent 8 9 @par Revision Reference: 10 These definitions are from the Framework Specification HII 0.92. 11 12 **/ 13 14 #ifndef __FRAMEWORK_INTERNAL_FORMREPRESENTATION_H__ 15 #define __FRAMEWORK_INTERNAL_FORMREPRESENTATION_H__ 16 17 typedef UINT16 STRING_REF; 18 19 // 20 // IFR Op codes 21 // 22 #define FRAMEWORK_EFI_IFR_FORM_OP 0x01 23 #define FRAMEWORK_EFI_IFR_SUBTITLE_OP 0x02 24 #define FRAMEWORK_EFI_IFR_TEXT_OP 0x03 25 #define EFI_IFR_GRAPHIC_OP 0x04 26 #define FRAMEWORK_EFI_IFR_ONE_OF_OP 0x05 27 #define FRAMEWORK_EFI_IFR_CHECKBOX_OP 0x06 28 #define FRAMEWORK_EFI_IFR_NUMERIC_OP 0x07 29 #define FRAMEWORK_EFI_IFR_PASSWORD_OP 0x08 30 #define FRAMEWORK_EFI_IFR_ONE_OF_OPTION_OP 0x09 ///< ONEOF OPTION field. 31 #define FRAMEWORK_EFI_IFR_SUPPRESS_IF_OP 0x0A 32 #define EFI_IFR_END_FORM_OP 0x0B 33 #define EFI_IFR_HIDDEN_OP 0x0C 34 #define EFI_IFR_END_FORM_SET_OP 0x0D 35 #define FRAMEWORK_EFI_IFR_FORM_SET_OP 0x0E 36 #define FRAMEWORK_EFI_IFR_REF_OP 0x0F 37 #define EFI_IFR_END_ONE_OF_OP 0x10 38 #define FRAMEWORK_EFI_IFR_END_OP EFI_IFR_END_ONE_OF_OP 39 #define FRAMEWORK_EFI_IFR_INCONSISTENT_IF_OP 0x11 40 #define FRAMEWORK_EFI_IFR_EQ_ID_VAL_OP 0x12 41 #define FRAMEWORK_EFI_IFR_EQ_ID_ID_OP 0x13 42 #define FRAMEWORK_EFI_IFR_EQ_ID_LIST_OP 0x14 43 #define FRAMEWORK_EFI_IFR_AND_OP 0x15 44 #define FRAMEWORK_EFI_IFR_OR_OP 0x16 45 #define FRAMEWORK_EFI_IFR_NOT_OP 0x17 46 #define EFI_IFR_END_IF_OP 0x18 ///< For endif of inconsistentif, suppressif, grayoutif. 47 #define EFI_IFR_GRAYOUT_IF_OP 0x19 48 #define FRAMEWORK_EFI_IFR_DATE_OP 0x1A 49 #define FRAMEWORK_EFI_IFR_TIME_OP 0x1B 50 #define FRAMEWORK_EFI_IFR_STRING_OP 0x1C 51 #define EFI_IFR_LABEL_OP 0x1D 52 #define EFI_IFR_SAVE_DEFAULTS_OP 0x1E 53 #define EFI_IFR_RESTORE_DEFAULTS_OP 0x1F 54 #define EFI_IFR_BANNER_OP 0x20 55 #define EFI_IFR_INVENTORY_OP 0x21 56 #define EFI_IFR_EQ_VAR_VAL_OP 0x22 57 #define FRAMEWORK_EFI_IFR_ORDERED_LIST_OP 0x23 58 #define FRAMEWORK_EFI_IFR_VARSTORE_OP 0x24 59 #define EFI_IFR_VARSTORE_SELECT_OP 0x25 60 #define EFI_IFR_VARSTORE_SELECT_PAIR_OP 0x26 61 #define EFI_IFR_LAST_OPCODE EFI_IFR_VARSTORE_SELECT_PAIR_OP 62 #define EFI_IFR_OEM_OP 0xFE 63 #define EFI_IFR_NV_ACCESS_COMMAND 0xFF 64 65 // 66 // Define values for the flags fields in some VFR opcodes. These are 67 // bitmasks. 68 // 69 #define EFI_IFR_FLAG_DEFAULT 0x01 70 #define EFI_IFR_FLAG_MANUFACTURING 0x02 71 #define EFI_IFR_FLAG_INTERACTIVE 0x04 72 #define EFI_IFR_FLAG_NV_ACCESS 0x08 73 #define EFI_IFR_FLAG_RESET_REQUIRED 0x10 74 #define EFI_IFR_FLAG_LATE_CHECK 0x20 75 76 #define EFI_NON_DEVICE_CLASS 0x00 ///< Useful when you do not want something in the Device Manager. 77 #define EFI_DISK_DEVICE_CLASS 0x01 78 #define EFI_VIDEO_DEVICE_CLASS 0x02 79 #define EFI_NETWORK_DEVICE_CLASS 0x04 80 #define EFI_INPUT_DEVICE_CLASS 0x08 81 #define EFI_ON_BOARD_DEVICE_CLASS 0x10 82 #define EFI_OTHER_DEVICE_CLASS 0x20 83 84 #define EFI_SETUP_APPLICATION_SUBCLASS 0x00 85 #define EFI_GENERAL_APPLICATION_SUBCLASS 0x01 86 #define EFI_FRONT_PAGE_SUBCLASS 0x02 87 #define EFI_SINGLE_USE_SUBCLASS 0x03 ///< Used to display a single entity ,and then exit. 88 89 /// 90 /// Used to flag dynamically created op-codes. This is meaningful to the IFR Library set 91 /// and the browser because we need to distinguish between compiled NV map data and created data. 92 /// We do not allow new entries to be created in the NV map dynamically, but we do need 93 /// to display this information correctly. To dynamically create op-codes and assume that their 94 /// data will be saved, ensure that the NV starting location they refer to is pre-defined in the 95 /// NV map. 96 /// 97 #define EFI_IFR_FLAG_CREATED 128 98 99 100 #pragma pack(1) 101 // 102 // IFR Structure definitions 103 // 104 typedef struct { 105 UINT8 OpCode; 106 UINT8 Length; 107 } FRAMEWORK_EFI_IFR_OP_HEADER; 108 109 typedef struct { 110 FRAMEWORK_EFI_IFR_OP_HEADER Header; 111 EFI_GUID Guid; 112 STRING_REF FormSetTitle; 113 STRING_REF Help; 114 EFI_PHYSICAL_ADDRESS CallbackHandle; 115 UINT16 Class; 116 UINT16 SubClass; 117 UINT16 NvDataSize; ///< Set once; the size of the NV data as defined in the script. 118 } FRAMEWORK_EFI_IFR_FORM_SET; 119 120 typedef struct { 121 FRAMEWORK_EFI_IFR_OP_HEADER Header; 122 UINT16 FormId; 123 STRING_REF FormTitle; 124 } FRAMEWORK_EFI_IFR_FORM; 125 126 typedef struct { 127 FRAMEWORK_EFI_IFR_OP_HEADER Header; 128 UINT16 LabelId; 129 } EFI_IFR_LABEL; 130 131 typedef struct { 132 FRAMEWORK_EFI_IFR_OP_HEADER Header; 133 STRING_REF SubTitle; 134 } FRAMEWORK_EFI_IFR_SUBTITLE; 135 136 typedef struct { 137 FRAMEWORK_EFI_IFR_OP_HEADER Header; 138 STRING_REF Help; 139 STRING_REF Text; 140 STRING_REF TextTwo; 141 UINT8 Flags; ///< This is included solely for purposes of interactive/dynamic support. 142 UINT16 Key; ///< The value to be passed to the caller to identify this particular op-code. 143 } FRAMEWORK_EFI_IFR_TEXT; 144 145 // 146 // goto 147 // 148 typedef struct { 149 FRAMEWORK_EFI_IFR_OP_HEADER Header; 150 UINT16 FormId; 151 STRING_REF Prompt; 152 STRING_REF Help; ///< The string Token for the context-help. 153 UINT8 Flags; ///< This is included solely for purposes of interactive/dynamic support. 154 UINT16 Key; ///< The value to be passed to the caller to identify this particular op-code. 155 } FRAMEWORK_EFI_IFR_REF; 156 157 typedef struct { 158 FRAMEWORK_EFI_IFR_OP_HEADER Header; 159 } EFI_IFR_END_FORM; 160 161 typedef struct { 162 FRAMEWORK_EFI_IFR_OP_HEADER Header; 163 } EFI_IFR_END_FORM_SET; 164 165 // 166 // Also notice that the IFR_ONE_OF and IFR_CHECK_BOX are identical in structure...... 167 // code assumes this to be true, if this ever changes we need to revisit the InitializeTagStructures code 168 // 169 typedef struct { 170 FRAMEWORK_EFI_IFR_OP_HEADER Header; 171 UINT16 QuestionId; ///< The ID designating what the question is about... 172 UINT8 Width; ///< The Size of the Data being saved. 173 STRING_REF Prompt; ///< The String Token for the Prompt. 174 STRING_REF Help; ///< The string Token for the context-help. 175 } FRAMEWORK_EFI_IFR_ONE_OF; 176 177 typedef struct { 178 FRAMEWORK_EFI_IFR_OP_HEADER Header; 179 UINT16 QuestionId; ///< The offset in NV for storage of the data. 180 UINT8 MaxEntries; ///< The maximum number of options in the ordered list (=size of NVStore). 181 STRING_REF Prompt; ///< The string token for the prompt. 182 STRING_REF Help; ///< The string token for the context-help. 183 } FRAMEWORK_EFI_IFR_ORDERED_LIST; 184 185 typedef struct { 186 FRAMEWORK_EFI_IFR_OP_HEADER Header; 187 UINT16 QuestionId; ///< The ID designating what the question is about... 188 UINT8 Width; ///< The Size of the Data being saved. 189 STRING_REF Prompt; ///< The String Token for the Prompt. 190 STRING_REF Help; ///< The string Token for the context-help. 191 UINT8 Flags; ///< If non-zero, it means that it is the default option. 192 UINT16 Key; ///< Value to be passed to caller to identify this particular op-code. 193 } FRAMEWORK_EFI_IFR_CHECKBOX, EFI_IFR_CHECK_BOX; 194 195 typedef struct { 196 FRAMEWORK_EFI_IFR_OP_HEADER Header; 197 STRING_REF Option; ///< The string token describing the option. 198 UINT16 Value; ///< The value associated with this option that is stored in the NVRAM. 199 UINT8 Flags; ///< If non-zero, it means that it is the default option. 200 UINT16 Key; ///< Value to be passed to caller to identify this particular op-code. 201 } FRAMEWORK_EFI_IFR_ONE_OF_OPTION; 202 203 typedef struct { 204 FRAMEWORK_EFI_IFR_OP_HEADER Header; 205 UINT16 QuestionId; ///< The ID designating what the question is about... 206 UINT8 Width; ///< The Size of the Data being saved. 207 STRING_REF Prompt; ///< The String Token for the Prompt. 208 STRING_REF Help; ///< The string Token for the context-help. 209 UINT8 Flags; ///< This is included solely for purposes of interactive/dynamic support. 210 UINT16 Key; ///< The value to be passed to caller to identify this particular op-code. 211 UINT16 Minimum; 212 UINT16 Maximum; 213 UINT16 Step; ///< Zero means manual input. Otherwise, arrow selection is called for. 214 UINT16 Default; 215 } FRAMEWORK_EFI_IFR_NUMERIC; 216 217 // 218 // There is an interesting twist with regards to Time and Date. This is one of the few items which can accept input 219 // from a user, and may or may not need to use storage in the NVRAM space. The decided method for determining 220 // if NVRAM space will be used (only for a TimeOp or DateOp) is: If .QuestionId == 0 && .Width == 0 (normally an 221 // impossibility) then use system resources to store the data away and not NV resources. In other words, the setup 222 // engine will call gRT->SetTime, and gRT->SetDate for the saving of data, and the values displayed will be from the 223 // gRT->GetXXXX series of calls. 224 // 225 typedef struct { 226 FRAMEWORK_EFI_IFR_NUMERIC Hour; 227 FRAMEWORK_EFI_IFR_NUMERIC Minute; 228 FRAMEWORK_EFI_IFR_NUMERIC Second; 229 } FRAMEWORK_EFI_IFR_TIME; 230 231 typedef struct { 232 FRAMEWORK_EFI_IFR_NUMERIC Year; 233 FRAMEWORK_EFI_IFR_NUMERIC Month; 234 FRAMEWORK_EFI_IFR_NUMERIC Day; 235 } FRAMEWORK_EFI_IFR_DATE; 236 237 typedef struct { 238 FRAMEWORK_EFI_IFR_OP_HEADER Header; 239 UINT16 QuestionId;///< The ID designating what the question is about... 240 UINT8 Width; ///< The Size of the Data being saved. 241 STRING_REF Prompt; ///< The String Token for the Prompt. 242 STRING_REF Help; ///< The string Token for the context-help. 243 UINT8 Flags; ///< This is included solely for purposes of interactive/dynamic support. 244 UINT16 Key; ///< The value to be passed to caller to identify this particular op-code. 245 UINT8 MinSize; ///< Minimum allowable sized password. 246 UINT8 MaxSize; ///< Maximum allowable sized password. 247 UINT16 Encoding; 248 } FRAMEWORK_EFI_IFR_PASSWORD; 249 250 typedef struct { 251 FRAMEWORK_EFI_IFR_OP_HEADER Header; 252 UINT16 QuestionId; ///< The ID designating what the question is about... 253 UINT8 Width; ///< The Size of the Data being saved. 254 STRING_REF Prompt; ///< The String Token for the Prompt. 255 STRING_REF Help; ///< The string Token for the context-help. 256 UINT8 Flags; ///< This is included solely for purposes of interactive/dynamic support. 257 UINT16 Key; ///< The value to be passed to caller to identify this particular op-code. 258 UINT8 MinSize; ///< Minimum allowable sized password. 259 UINT8 MaxSize; ///< Maximum allowable sized password. 260 } FRAMEWORK_EFI_IFR_STRING; 261 262 typedef struct { 263 FRAMEWORK_EFI_IFR_OP_HEADER Header; 264 } EFI_IFR_END_ONE_OF; 265 266 typedef struct { 267 FRAMEWORK_EFI_IFR_OP_HEADER Header; 268 UINT16 Value; 269 UINT16 Key; 270 } EFI_IFR_HIDDEN; 271 272 /// 273 /// Inconsistent with specification here: 274 /// The following definition may not comply with Framework Specification HII 0.92. To 275 /// keep the inconsistant is for implementation needed. 276 ///@{ 277 typedef struct { 278 FRAMEWORK_EFI_IFR_OP_HEADER Header; 279 UINT8 Flags; 280 } EFI_IFR_SUPPRESS; 281 282 typedef struct { 283 FRAMEWORK_EFI_IFR_OP_HEADER Header; 284 UINT8 Flags; 285 } EFI_IFR_GRAY_OUT; 286 287 typedef struct { 288 FRAMEWORK_EFI_IFR_OP_HEADER Header; 289 STRING_REF Popup; 290 UINT8 Flags; 291 } EFI_IFR_INCONSISTENT; 292 293 typedef struct { 294 FRAMEWORK_EFI_IFR_OP_HEADER Header; 295 UINT16 QuestionId; ///< The offset into variable storage. 296 UINT8 Width; ///< The size of variable storage. 297 UINT16 Value; ///< The value to compare against. 298 } FRAMEWORK_EFI_IFR_EQ_ID_VAL; 299 300 typedef struct { 301 FRAMEWORK_EFI_IFR_OP_HEADER Header; 302 UINT16 QuestionId; ///< The offset into variable storage. 303 UINT8 Width; ///< The size of variable storage. 304 UINT16 ListLength; 305 UINT16 ValueList[1]; 306 } FRAMEWORK_EFI_IFR_EQ_ID_LIST; 307 308 typedef struct { 309 FRAMEWORK_EFI_IFR_OP_HEADER Header; 310 UINT16 QuestionId1; ///< The offset into variable storage for first value to compare. 311 UINT8 Width; ///< The size of variable storage (must be same for both). 312 UINT16 QuestionId2; ///< The offset into variable storage for second value to compare. 313 } FRAMEWORK_EFI_IFR_EQ_ID_ID; 314 315 typedef struct { 316 FRAMEWORK_EFI_IFR_OP_HEADER Header; 317 UINT16 VariableId; ///< The offset into variable storage. 318 UINT16 Value; ///< The value to compare against. 319 } EFI_IFR_EQ_VAR_VAL; 320 ///@} 321 322 typedef struct { 323 FRAMEWORK_EFI_IFR_OP_HEADER Header; 324 } FRAMEWORK_EFI_IFR_AND; 325 326 typedef struct { 327 FRAMEWORK_EFI_IFR_OP_HEADER Header; 328 } FRAMEWORK_EFI_IFR_OR; 329 330 typedef struct { 331 FRAMEWORK_EFI_IFR_OP_HEADER Header; 332 } FRAMEWORK_EFI_IFR_NOT; 333 334 typedef struct { 335 FRAMEWORK_EFI_IFR_OP_HEADER Header; 336 } EFI_IFR_END_EXPR, EFI_IFR_END_IF; 337 338 typedef struct { 339 FRAMEWORK_EFI_IFR_OP_HEADER Header; 340 UINT16 FormId; 341 STRING_REF Prompt; 342 STRING_REF Help; 343 UINT8 Flags; 344 UINT16 Key; 345 } EFI_IFR_SAVE_DEFAULTS; 346 347 typedef struct { 348 FRAMEWORK_EFI_IFR_OP_HEADER Header; 349 STRING_REF Help; 350 STRING_REF Text; 351 STRING_REF TextTwo; ///< Optional text. 352 } EFI_IFR_INVENTORY; 353 354 typedef struct { 355 FRAMEWORK_EFI_IFR_OP_HEADER Header; 356 EFI_GUID Guid; ///< GUID for the variable. 357 UINT16 VarId; ///< The variable store ID, as referenced elsewhere in the form. 358 UINT16 Size; ///< The size of the variable storage. 359 } FRAMEWORK_EFI_IFR_VARSTORE; 360 361 typedef struct { 362 FRAMEWORK_EFI_IFR_OP_HEADER Header; 363 UINT16 VarId; ///< The variable store ID, as referenced elsewhere in the form. 364 } EFI_IFR_VARSTORE_SELECT; 365 366 /// 367 /// Used for the ideqid VFR statement where two variable stores may be referenced in the 368 /// same VFR statement. 369 /// A browser should treat this as an FRAMEWORK_EFI_IFR_VARSTORE_SELECT statement and assume that all following 370 /// IFR opcodes use the VarId as defined here. 371 /// 372 typedef struct { 373 FRAMEWORK_EFI_IFR_OP_HEADER Header; 374 UINT16 VarId; ///< The variable store ID, as referenced elsewhere in the form. 375 UINT16 SecondaryVarId; ///< The variable store ID, as referenced elsewhere in the form. 376 } EFI_IFR_VARSTORE_SELECT_PAIR; 377 378 /// 379 /// Save defaults and restore defaults have same structure. 380 /// 381 #define EFI_IFR_RESTORE_DEFAULTS EFI_IFR_SAVE_DEFAULTS 382 383 typedef struct { 384 FRAMEWORK_EFI_IFR_OP_HEADER Header; 385 STRING_REF Title; ///< The string token for the banner title. 386 UINT16 LineNumber; ///< 1-based line number. 387 UINT8 Alignment; ///< Left, center, or right-aligned. 388 } EFI_IFR_BANNER; 389 390 #define EFI_IFR_BANNER_ALIGN_LEFT 0 391 #define EFI_IFR_BANNER_ALIGN_CENTER 1 392 #define EFI_IFR_BANNER_ALIGN_RIGHT 2 393 #define EFI_IFR_BANNER_TIMEOUT 0xFF 394 395 #pragma pack() 396 397 #endif 398