Add more comments for IntelFramework's header files.
[mirror_edk2.git] / IntelFrameworkPkg / Include / Framework / FrameworkInternalFormRepresentation.h
1
2 /** @file
3 This file defines the encoding for the VFR (Visual Form Representation) language.
4 Framework IFR is primarily consumed by the EFI presentation engine, and produced by EFI
5 internal application and drivers as well as all add-in card option-ROM drivers
6
7 Copyright (c) 2007, Intel Corporation
8 All rights reserved. This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
12
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15
16 @par Revision Reference:
17 These definitions are from Framework Specification HII 0.92.
18
19 **/
20
21 #ifndef __FRAMEWORK_INTERNAL_FORMREPRESENTATION_H__
22 #define __FRAMEWORK_INTERNAL_FORMREPRESENTATION_H__
23
24 //
25 // IFR Op codes
26 //
27 #define FRAMEWORK_EFI_IFR_FORM_OP 0x01
28 #define FRAMEWORK_EFI_IFR_SUBTITLE_OP 0x02
29 #define FRAMEWORK_EFI_IFR_TEXT_OP 0x03
30 #define FRAMEWORK_EFI_IFR_GRAPHIC_OP 0x04
31 #define FRAMEWORK_EFI_IFR_ONE_OF_OP 0x05
32 #define FRAMEWORK_EFI_IFR_CHECKBOX_OP 0x06
33 #define FRAMEWORK_EFI_IFR_NUMERIC_OP 0x07
34 #define FRAMEWORK_EFI_IFR_PASSWORD_OP 0x08
35 #define FRAMEWORK_EFI_IFR_ONE_OF_OPTION_OP 0x09 // ONEOF OPTION field
36 #define FRAMEWORK_EFI_IFR_SUPPRESS_IF_OP 0x0A
37 #define FRAMEWORK_EFI_IFR_END_FORM_OP 0x0B
38 #define FRAMEWORK_EFI_IFR_HIDDEN_OP 0x0C
39 #define FRAMEWORK_EFI_IFR_END_FORM_SET_OP 0x0D
40 #define FRAMEWORK_EFI_IFR_FORM_SET_OP 0x0E
41 #define FRAMEWORK_EFI_IFR_REF_OP 0x0F
42 #define FRAMEWORK_EFI_IFR_END_ONE_OF_OP 0x10
43 #define FRAMEWORK_EFI_IFR_END_OP FRAMEWORK_EFI_IFR_END_ONE_OF_OP
44 #define FRAMEWORK_EFI_IFR_INCONSISTENT_IF_OP 0x11
45 #define FRAMEWORK_EFI_IFR_EQ_ID_VAL_OP 0x12
46 #define FRAMEWORK_EFI_IFR_EQ_ID_ID_OP 0x13
47 #define FRAMEWORK_EFI_IFR_EQ_ID_LIST_OP 0x14
48 #define FRAMEWORK_EFI_IFR_AND_OP 0x15
49 #define FRAMEWORK_EFI_IFR_OR_OP 0x16
50 #define FRAMEWORK_EFI_IFR_NOT_OP 0x17
51 #define FRAMEWORK_EFI_IFR_END_IF_OP 0x18 // for endif of inconsistentif, suppressif, grayoutif
52 #define FRAMEWORK_EFI_IFR_GRAYOUT_IF_OP 0x19
53 #define FRAMEWORK_EFI_IFR_DATE_OP 0x1A
54 #define FRAMEWORK_EFI_IFR_TIME_OP 0x1B
55 #define FRAMEWORK_EFI_IFR_STRING_OP 0x1C
56 #define FRAMEWORK_EFI_IFR_LABEL_OP 0x1D
57 #define FRAMEWORK_EFI_IFR_SAVE_DEFAULTS_OP 0x1E
58 #define FRAMEWORK_EFI_IFR_RESTORE_DEFAULTS_OP 0x1F
59 #define FRAMEWORK_EFI_IFR_BANNER_OP 0x20
60 #define FRAMEWORK_EFI_IFR_INVENTORY_OP 0x21
61 #define FRAMEWORK_EFI_IFR_EQ_VAR_VAL_OP 0x22
62 #define FRAMEWORK_EFI_IFR_ORDERED_LIST_OP 0x23
63 #define FRAMEWORK_EFI_IFR_VARSTORE_OP 0x24
64 #define FRAMEWORK_EFI_IFR_VARSTORE_SELECT_OP 0x25
65 #define FRAMEWORK_EFI_IFR_VARSTORE_SELECT_PAIR_OP 0x26
66 #define FRAMEWORK_EFI_IFR_TRUE_OP 0x27
67 #define FRAMEWORK_EFI_IFR_FALSE_OP 0x28
68 #define FRAMEWORK_EFI_IFR_GT_OP 0x29
69 #define FRAMEWORK_EFI_IFR_GE_OP 0x2A
70 #define FRAMEWORK_EFI_IFR_OEM_DEFINED_OP 0x2B
71 #define FRAMEWORK_EFI_IFR_LAST_OPCODE FRAMEWORK_EFI_IFR_OEM_DEFINED_OP
72 #define FRAMEWORK_EFI_IFR_OEM_OP 0xFE
73 #define FRAMEWORK_EFI_IFR_NV_ACCESS_COMMAND 0xFF
74
75 //
76 // Define values for the flags fields in some VFR opcodes. These are
77 // bitmasks.
78 //
79 #define FRAMEWORK_EFI_IFR_FLAG_DEFAULT 0x01
80 #define FRAMEWORK_EFI_IFR_FLAG_MANUFACTURING 0x02
81 #define FRAMEWORK_EFI_IFR_FLAG_INTERACTIVE 0x04
82 #define FRAMEWORK_EFI_IFR_FLAG_NV_ACCESS 0x08
83 #define FRAMEWORK_EFI_IFR_FLAG_RESET_REQUIRED 0x10
84 #define FRAMEWORK_EFI_IFR_FLAG_LATE_CHECK 0x20
85
86 #define EFI_NON_DEVICE_CLASS 0x00 // Useful when you do not want something in the Device Manager
87 #define EFI_DISK_DEVICE_CLASS 0x01
88 #define EFI_VIDEO_DEVICE_CLASS 0x02
89 #define EFI_NETWORK_DEVICE_CLASS 0x04
90 #define EFI_INPUT_DEVICE_CLASS 0x08
91 #define EFI_ON_BOARD_DEVICE_CLASS 0x10
92 #define EFI_OTHER_DEVICE_CLASS 0x20
93
94 #define EFI_SETUP_APPLICATION_SUBCLASS 0x00
95 #define EFI_GENERAL_APPLICATION_SUBCLASS 0x01
96 #define EFI_FRONT_PAGE_SUBCLASS 0x02
97 #define EFI_SINGLE_USE_SUBCLASS 0x03 // Used to display a single entity and then exit
98
99 //
100 // Used to flag dynamically created op-codes. This is meaningful to the IFR Library set
101 // and the browser since we need to distinguish between compiled NV map data and created data.
102 // We do not allow new entries to be created in the NV map dynamically however we still need
103 // to display this information correctly. To dynamically create op-codes and assume that their
104 // data will be saved, ensure that the NV starting location they refer to is pre-defined in the
105 // NV map.
106 //
107 #define FRAMEWORK_EFI_IFR_FLAG_CREATED 128
108
109
110 #pragma pack(1)
111 //
112 // IFR Structure definitions
113 //
114 typedef struct {
115 UINT8 OpCode;
116 UINT8 Length;
117 } FRAMEWORK_EFI_IFR_OP_HEADER;
118
119 typedef struct {
120 FRAMEWORK_EFI_IFR_OP_HEADER Header;
121 EFI_GUID Guid;
122 STRING_REF FormSetTitle;
123 STRING_REF Help;
124 EFI_PHYSICAL_ADDRESS CallbackHandle;
125 UINT16 Class;
126 UINT16 SubClass;
127 UINT16 NvDataSize; // set once, size of the NV data as defined in the script
128 } FRAMEWORK_EFI_IFR_FORM_SET;
129
130 typedef struct {
131 FRAMEWORK_EFI_IFR_OP_HEADER Header;
132 UINT16 FormId;
133 STRING_REF FormTitle;
134 } FRAMEWORK_EFI_IFR_FORM;
135
136 typedef struct {
137 FRAMEWORK_EFI_IFR_OP_HEADER Header;
138 UINT16 LabelId;
139 } FRAMEWORK_EFI_IFR_LABEL;
140
141 typedef struct {
142 FRAMEWORK_EFI_IFR_OP_HEADER Header;
143 STRING_REF SubTitle;
144 } FRAMEWORK_EFI_IFR_SUBTITLE;
145
146 typedef struct {
147 FRAMEWORK_EFI_IFR_OP_HEADER Header;
148 STRING_REF Help;
149 STRING_REF Text;
150 STRING_REF TextTwo;
151 UINT8 Flags; // This is included solely for purposes of interactive/dynamic support.
152 UINT16 Key; // Value to be passed to caller to identify this particular op-code
153 } FRAMEWORK_EFI_IFR_TEXT;
154
155 //
156 // goto
157 //
158 typedef struct {
159 FRAMEWORK_EFI_IFR_OP_HEADER Header;
160 UINT16 FormId;
161 STRING_REF Prompt;
162 STRING_REF Help; // The string Token for the context-help
163 UINT8 Flags; // This is included solely for purposes of interactive/dynamic support.
164 UINT16 Key; // Value to be passed to caller to identify this particular op-code
165 } FRAMEWORK_EFI_IFR_REF;
166
167 typedef struct {
168 FRAMEWORK_EFI_IFR_OP_HEADER Header;
169 } FRAMEWORK_EFI_IFR_END_FORM;
170
171 typedef struct {
172 FRAMEWORK_EFI_IFR_OP_HEADER Header;
173 } FRAMEWORK_EFI_IFR_END_FORM_SET;
174
175 //
176 // Also notice that the IFR_ONE_OF and IFR_CHECK_BOX are identical in structure......code assumes this to be true, if this ever
177 // changes we need to revisit the InitializeTagStructures code
178 //
179 typedef struct {
180 FRAMEWORK_EFI_IFR_OP_HEADER Header;
181 UINT16 QuestionId; // The ID designating what the question is about...sucked in from a #define, likely in the form of a variable name
182 UINT8 Width; // The Size of the Data being saved
183 STRING_REF Prompt; // The String Token for the Prompt
184 STRING_REF Help; // The string Token for the context-help
185 } FRAMEWORK_EFI_IFR_ONE_OF;
186
187 typedef struct {
188 FRAMEWORK_EFI_IFR_OP_HEADER Header;
189 UINT16 QuestionId; // The offset in NV for storage of the data
190 UINT8 MaxEntries; // The maximum number of options in the ordered list (=size of NVStore)
191 STRING_REF Prompt; // The string token for the prompt
192 STRING_REF Help; // The string token for the context-help
193 } FRAMEWORK_EFI_IFR_ORDERED_LIST;
194
195 typedef struct {
196 FRAMEWORK_EFI_IFR_OP_HEADER Header;
197 UINT16 QuestionId; // The ID designating what the question is about...sucked in from a #define, likely in the form of a variable name
198 UINT8 Width; // The Size of the Data being saved
199 STRING_REF Prompt; // The String Token for the Prompt
200 STRING_REF Help; // The string Token for the context-help
201 UINT8 Flags; // For now, if non-zero, means that it is the default option, - further definition likely
202 UINT16 Key; // Value to be passed to caller to identify this particular op-code
203 } FRAMEWORK_EFI_IFR_CHECKBOX, FRAMEWORK_EFI_IFR_CHECK_BOX;
204
205 typedef struct {
206 FRAMEWORK_EFI_IFR_OP_HEADER Header;
207 STRING_REF Option; // The string token describing the option
208 UINT16 Value; // The value associated with this option that is stored in the NVRAM if chosen
209 UINT8 Flags; // For now, if non-zero, means that it is the default option, - further definition likely above
210 UINT16 Key; // Value to be passed to caller to identify this particular op-code
211 } FRAMEWORK_EFI_IFR_ONE_OF_OPTION;
212
213 typedef struct {
214 FRAMEWORK_EFI_IFR_OP_HEADER Header;
215 UINT16 QuestionId; // The ID designating what the question is about...sucked in from a #define, likely in the form of a variable name
216 UINT8 Width; // The Size of the Data being saved
217 STRING_REF Prompt; // The String Token for the Prompt
218 STRING_REF Help; // The string Token for the context-help
219 UINT8 Flags; // This is included solely for purposes of interactive/dynamic support.
220 UINT16 Key; // Value to be passed to caller to identify this particular op-code
221 UINT16 Minimum;
222 UINT16 Maximum;
223 UINT16 Step; // If step is 0, then manual input is specified, otherwise, left/right arrow selection is called for
224 UINT16 Default;
225 } FRAMEWORK_EFI_IFR_NUMERIC;
226
227 //
228 // There is an interesting twist with regards to Time and Date. This is one of the few items which can accept input from
229 // a user, however may or may not need to use storage in the NVRAM space. The decided method for determining if NVRAM space
230 // will be used (only for a TimeOp or DateOp) is: If .QuestionId == 0 && .Width == 0 (normally an impossibility) then use system
231 // resources to store the data away and not NV resources. In other words, the setup engine will call gRT->SetTime, and gRT->SetDate
232 // for the saving of data, and the values displayed will be from the gRT->GetXXXX series of calls.
233 //
234 typedef struct {
235 FRAMEWORK_EFI_IFR_NUMERIC Hour;
236 FRAMEWORK_EFI_IFR_NUMERIC Minute;
237 FRAMEWORK_EFI_IFR_NUMERIC Second;
238 } FRAMEWORK_EFI_IFR_TIME;
239
240 typedef struct {
241 FRAMEWORK_EFI_IFR_NUMERIC Year;
242 FRAMEWORK_EFI_IFR_NUMERIC Month;
243 FRAMEWORK_EFI_IFR_NUMERIC Day;
244 } FRAMEWORK_EFI_IFR_DATE;
245
246 typedef struct {
247 FRAMEWORK_EFI_IFR_OP_HEADER Header;
248 UINT16 QuestionId; // The ID designating what the question is about...sucked in from a #define, likely in the form of a variable name
249 UINT8 Width; // The Size of the Data being saved -- BUGBUG -- remove someday
250 STRING_REF Prompt; // The String Token for the Prompt
251 STRING_REF Help; // The string Token for the context-help
252 UINT8 Flags; // This is included solely for purposes of interactive/dynamic support.
253 UINT16 Key; // Value to be passed to caller to identify this particular op-code
254 UINT8 MinSize; // Minimum allowable sized password
255 UINT8 MaxSize; // Maximum allowable sized password
256 UINT16 Encoding;
257 } FRAMEWORK_EFI_IFR_PASSWORD;
258
259 typedef struct {
260 FRAMEWORK_EFI_IFR_OP_HEADER Header;
261 UINT16 QuestionId; // The ID designating what the question is about...sucked in from a #define, likely in the form of a variable name
262 UINT8 Width; // The Size of the Data being saved -- BUGBUG -- remove someday
263 STRING_REF Prompt; // The String Token for the Prompt
264 STRING_REF Help; // The string Token for the context-help
265 UINT8 Flags; // This is included solely for purposes of interactive/dynamic support.
266 UINT16 Key; // Value to be passed to caller to identify this particular op-code
267 UINT8 MinSize; // Minimum allowable sized password
268 UINT8 MaxSize; // Maximum allowable sized password
269 } FRAMEWORK_EFI_IFR_STRING;
270
271 typedef struct {
272 FRAMEWORK_EFI_IFR_OP_HEADER Header;
273 } FRAMEWORK_EFI_IFR_END_ONE_OF;
274
275 typedef struct {
276 FRAMEWORK_EFI_IFR_OP_HEADER Header;
277 UINT16 Value;
278 UINT16 Key;
279 } FRAMEWORK_EFI_IFR_HIDDEN;
280
281 typedef struct {
282 FRAMEWORK_EFI_IFR_OP_HEADER Header;
283 UINT8 Flags;
284 } FRAMEWORK_EFI_IFR_SUPPRESS;
285
286 typedef struct {
287 FRAMEWORK_EFI_IFR_OP_HEADER Header;
288 UINT8 Flags;
289 } FRAMEWORK_EFI_IFR_GRAY_OUT;
290
291 typedef struct {
292 FRAMEWORK_EFI_IFR_OP_HEADER Header;
293 STRING_REF Popup;
294 UINT8 Flags;
295 } FRAMEWORK_EFI_IFR_INCONSISTENT;
296
297 typedef struct {
298 FRAMEWORK_EFI_IFR_OP_HEADER Header;
299 UINT16 QuestionId; // offset into variable storage
300 UINT8 Width; // size of variable storage
301 UINT16 Value; // value to compare against
302 } FRAMEWORK_EFI_IFR_EQ_ID_VAL;
303
304 typedef struct {
305 FRAMEWORK_EFI_IFR_OP_HEADER Header;
306 UINT16 QuestionId; // offset into variable storage
307 UINT8 Width; // size of variable storage
308 UINT16 ListLength;
309 UINT16 ValueList[1];
310 } FRAMEWORK_EFI_IFR_EQ_ID_LIST;
311
312 typedef struct {
313 FRAMEWORK_EFI_IFR_OP_HEADER Header;
314 UINT16 QuestionId1; // offset into variable storage for first value to compare
315 UINT8 Width; // size of variable storage (must be same for both)
316 UINT16 QuestionId2; // offset into variable storage for second value to compare
317 } FRAMEWORK_EFI_IFR_EQ_ID_ID;
318
319 typedef struct {
320 FRAMEWORK_EFI_IFR_OP_HEADER Header;
321 UINT16 VariableId; // offset into variable storage
322 UINT16 Value; // value to compare against
323 } FRAMEWORK_EFI_IFR_EQ_VAR_VAL;
324
325 typedef struct {
326 FRAMEWORK_EFI_IFR_OP_HEADER Header;
327 } FRAMEWORK_EFI_IFR_AND;
328
329 typedef struct {
330 FRAMEWORK_EFI_IFR_OP_HEADER Header;
331 } FRAMEWORK_EFI_IFR_OR;
332
333 typedef struct {
334 FRAMEWORK_EFI_IFR_OP_HEADER Header;
335 } FRAMEWORK_EFI_IFR_NOT;
336
337 typedef struct {
338 FRAMEWORK_EFI_IFR_OP_HEADER Header;
339 } FRAMEWORK_EFI_IFR_END_EXPR, FRAMEWORK_EFI_IFR_END_IF;
340
341 typedef struct {
342 FRAMEWORK_EFI_IFR_OP_HEADER Header;
343 UINT16 FormId;
344 STRING_REF Prompt;
345 STRING_REF Help;
346 UINT8 Flags;
347 UINT16 Key;
348 } FRAMEWORK_EFI_IFR_SAVE_DEFAULTS;
349
350 typedef struct {
351 FRAMEWORK_EFI_IFR_OP_HEADER Header;
352 STRING_REF Help;
353 STRING_REF Text;
354 STRING_REF TextTwo; // optional text
355 } FRAMEWORK_EFI_IFR_INVENTORY;
356
357 typedef struct {
358 FRAMEWORK_EFI_IFR_OP_HEADER Header;
359 EFI_GUID Guid; // GUID for the variable
360 UINT16 VarId; // variable store ID, as referenced elsewhere in the form
361 UINT16 Size; // size of the variable storage
362 } FRAMEWORK_EFI_IFR_VARSTORE;
363
364 typedef struct {
365 FRAMEWORK_EFI_IFR_OP_HEADER Header;
366 UINT16 VarId; // variable store ID, as referenced elsewhere in the form
367 } FRAMEWORK_EFI_IFR_VARSTORE_SELECT;
368
369 //
370 // Used for the ideqid VFR statement where two variable stores may be referenced in the
371 // same VFR statement.
372 // A browser should treat this as an FRAMEWORK_EFI_IFR_VARSTORE_SELECT statement and assume that all following
373 // IFR opcodes use the VarId as defined here.
374 //
375 typedef struct {
376 FRAMEWORK_EFI_IFR_OP_HEADER Header;
377 UINT16 VarId; // variable store ID, as referenced elsewhere in the form
378 UINT16 SecondaryVarId; // variable store ID, as referenced elsewhere in the form
379 } FRAMEWORK_EFI_IFR_VARSTORE_SELECT_PAIR;
380
381 typedef struct {
382 FRAMEWORK_EFI_IFR_OP_HEADER Header;
383 } FRAMEWORK_EFI_IFR_TRUE;
384
385 typedef struct {
386 FRAMEWORK_EFI_IFR_OP_HEADER Header;
387 } FRAMEWORK_EFI_IFR_FALSE;
388
389 typedef struct {
390 FRAMEWORK_EFI_IFR_OP_HEADER Header;
391 } FRAMEWORK_EFI_IFR_GT;
392
393 typedef struct {
394 FRAMEWORK_EFI_IFR_OP_HEADER Header;
395 } FRAMEWORK_EFI_IFR_GE;
396
397 //
398 // Save defaults and restore defaults have same structure
399 //
400 #define FRAMEWORK_EFI_IFR_RESTORE_DEFAULTS FRAMEWORK_EFI_IFR_SAVE_DEFAULTS
401
402 typedef struct {
403 FRAMEWORK_EFI_IFR_OP_HEADER Header;
404 STRING_REF Title; // The string token for the banner title
405 UINT16 LineNumber; // 1-based line number
406 UINT8 Alignment; // left, center, or right-aligned
407 } FRAMEWORK_EFI_IFR_BANNER;
408
409 #define FRAMEWORK_EFI_IFR_BANNER_ALIGN_LEFT 0
410 #define FRAMEWORK_EFI_IFR_BANNER_ALIGN_CENTER 1
411 #define FRAMEWORK_EFI_IFR_BANNER_ALIGN_RIGHT 2
412 #define FRAMEWORK_EFI_IFR_BANNER_TIMEOUT 0xFF
413
414 #pragma pack()
415
416 #endif