FrameworkInternalFormRepresentation.h 17 KB

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