Move to directory "Include"
[mirror_edk2.git] / MdePkg / Include / Uefi / UefiInternalFormRepresentation.h
CommitLineData
959ccb23 1\r
2/** @file\r
3 This file defines the encoding for the VFR (Visual Form Representation) language.\r
4 IFR is primarily consumed by the EFI presentation engine, and produced by EFI\r
5 internal application and drivers as well as all add-in card option-ROM drivers\r
6\r
7 Copyright (c) 2006 - 2007, Intel Corporation \r
8 All rights reserved. This program and the accompanying materials \r
9 are licensed and made available under the terms and conditions of the BSD License \r
10 which accompanies this distribution. The full text of the license may be found at \r
11 http://opensource.org/licenses/bsd-license.php \r
12\r
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
15\r
16 Module Name: UefiInternalFormRepresentation.h\r
17\r
18 @par Revision Reference:\r
19 These definitions are from UEFI2.1.\r
20\r
21**/\r
22\r
23#ifndef __UEFI_INTERNAL_FORMREPRESENTATION_H__\r
24#define __UEFI_INTERNAL_FORMREPRESENTATION_H__\r
25\r
26//\r
27// The following types are currently defined:\r
28//\r
29typedef UINT32 RELOFST;\r
30typedef CHAR16 *EFI_STRING;\r
31\r
32//\r
33// IFR Op codes\r
34//\r
35#define EFI_IFR_FORM_OP 0x01\r
36#define EFI_IFR_SUBTITLE_OP 0x02\r
37#define EFI_IFR_TEXT_OP 0x03\r
38#define EFI_IFR_GRAPHIC_OP 0x04\r
39#define EFI_IFR_ONE_OF_OP 0x05\r
40#define EFI_IFR_CHECKBOX_OP 0x06\r
41#define EFI_IFR_NUMERIC_OP 0x07\r
42#define EFI_IFR_PASSWORD_OP 0x08\r
43#define EFI_IFR_ONE_OF_OPTION_OP 0x09 // ONEOF OPTION field\r
44#define EFI_IFR_SUPPRESS_IF_OP 0x0A\r
45#define EFI_IFR_END_FORM_OP 0x0B\r
46#define EFI_IFR_HIDDEN_OP 0x0C\r
47#define EFI_IFR_END_FORM_SET_OP 0x0D\r
48#define EFI_IFR_FORM_SET_OP 0x0E\r
49#define EFI_IFR_REF_OP 0x0F\r
50#define EFI_IFR_END_ONE_OF_OP 0x10\r
51#define EFI_IFR_END_OP EFI_IFR_END_ONE_OF_OP\r
52#define EFI_IFR_INCONSISTENT_IF_OP 0x11\r
53#define EFI_IFR_EQ_ID_VAL_OP 0x12\r
54#define EFI_IFR_EQ_ID_ID_OP 0x13\r
55#define EFI_IFR_EQ_ID_LIST_OP 0x14\r
56#define EFI_IFR_AND_OP 0x15\r
57#define EFI_IFR_OR_OP 0x16\r
58#define EFI_IFR_NOT_OP 0x17\r
59#define EFI_IFR_END_IF_OP 0x18 // for endif of inconsistentif, suppressif, grayoutif\r
60#define EFI_IFR_GRAYOUT_IF_OP 0x19\r
61#define EFI_IFR_DATE_OP 0x1A\r
62#define EFI_IFR_TIME_OP 0x1B\r
63#define EFI_IFR_STRING_OP 0x1C\r
64#define EFI_IFR_LABEL_OP 0x1D\r
65#define EFI_IFR_SAVE_DEFAULTS_OP 0x1E\r
66#define EFI_IFR_RESTORE_DEFAULTS_OP 0x1F\r
67#define EFI_IFR_BANNER_OP 0x20\r
68#define EFI_IFR_INVENTORY_OP 0x21\r
69#define EFI_IFR_EQ_VAR_VAL_OP 0x22\r
70#define EFI_IFR_ORDERED_LIST_OP 0x23\r
71#define EFI_IFR_VARSTORE_OP 0x24\r
72#define EFI_IFR_VARSTORE_SELECT_OP 0x25\r
73#define EFI_IFR_VARSTORE_SELECT_PAIR_OP 0x26\r
74#define EFI_IFR_TRUE_OP 0x27\r
75#define EFI_IFR_FALSE_OP 0x28\r
76#define EFI_IFR_GT_OP 0x29\r
77#define EFI_IFR_GE_OP 0x2A\r
78#define EFI_IFR_OEM_DEFINED_OP 0x2B\r
79#define EFI_IFR_LAST_OPCODE EFI_IFR_OEM_DEFINED_OP\r
80#define EFI_IFR_OEM_OP 0xFE\r
81#define EFI_IFR_NV_ACCESS_COMMAND 0xFF\r
82\r
83//\r
84// Define values for the flags fields in some VFR opcodes. These are\r
85// bitmasks.\r
86//\r
87#define EFI_IFR_FLAG_DEFAULT 0x01\r
88#define EFI_IFR_FLAG_MANUFACTURING 0x02\r
89#define EFI_IFR_FLAG_INTERACTIVE 0x04\r
90#define EFI_IFR_FLAG_NV_ACCESS 0x08\r
91#define EFI_IFR_FLAG_RESET_REQUIRED 0x10\r
92#define EFI_IFR_FLAG_LATE_CHECK 0x20\r
93\r
94#define EFI_NON_DEVICE_CLASS 0x00 // Useful when you do not want something in the Device Manager\r
95#define EFI_DISK_DEVICE_CLASS 0x01\r
96#define EFI_VIDEO_DEVICE_CLASS 0x02\r
97#define EFI_NETWORK_DEVICE_CLASS 0x04\r
98#define EFI_INPUT_DEVICE_CLASS 0x08\r
99#define EFI_ON_BOARD_DEVICE_CLASS 0x10\r
100#define EFI_OTHER_DEVICE_CLASS 0x20\r
101\r
102#define EFI_SETUP_APPLICATION_SUBCLASS 0x00\r
103#define EFI_GENERAL_APPLICATION_SUBCLASS 0x01\r
104#define EFI_FRONT_PAGE_SUBCLASS 0x02\r
105#define EFI_SINGLE_USE_SUBCLASS 0x03 // Used to display a single entity and then exit\r
106\r
107//\r
108// Used to flag dynamically created op-codes. This is meaningful to the IFR Library set\r
109// and the browser since we need to distinguish between compiled NV map data and created data.\r
110// We do not allow new entries to be created in the NV map dynamically however we still need\r
111// to display this information correctly. To dynamically create op-codes and assume that their\r
112// data will be saved, ensure that the NV starting location they refer to is pre-defined in the\r
113// NV map.\r
114//\r
115#define EFI_IFR_FLAG_CREATED 128\r
116\r
117#pragma pack(1)\r
118//\r
119// IFR Structure definitions\r
120//\r
121typedef struct {\r
122 UINT8 OpCode;\r
123 UINT8 Length;\r
124} EFI_IFR_OP_HEADER;\r
125\r
126typedef struct {\r
127 EFI_IFR_OP_HEADER Header;\r
128 EFI_GUID Guid;\r
129 STRING_REF FormSetTitle;\r
130 STRING_REF Help;\r
131 EFI_PHYSICAL_ADDRESS CallbackHandle;\r
132 UINT16 Class;\r
133 UINT16 SubClass;\r
134 UINT16 NvDataSize; // set once, size of the NV data as defined in the script\r
135} EFI_IFR_FORM_SET;\r
136\r
137typedef struct {\r
138 EFI_IFR_OP_HEADER Header;\r
139 UINT16 FormId;\r
140 STRING_REF FormTitle;\r
141} EFI_IFR_FORM;\r
142\r
143typedef struct {\r
144 EFI_IFR_OP_HEADER Header;\r
145 UINT16 LabelId;\r
146} EFI_IFR_LABEL;\r
147\r
148typedef struct {\r
149 EFI_IFR_OP_HEADER Header;\r
150 STRING_REF SubTitle;\r
151} EFI_IFR_SUBTITLE;\r
152\r
153typedef struct {\r
154 EFI_IFR_OP_HEADER Header;\r
155 STRING_REF Help;\r
156 STRING_REF Text;\r
157 STRING_REF TextTwo;\r
158 UINT8 Flags; // This is included solely for purposes of interactive/dynamic support.\r
159 UINT16 Key; // Value to be passed to caller to identify this particular op-code\r
160} EFI_IFR_TEXT;\r
161\r
162//\r
163// goto\r
164//\r
165typedef struct {\r
166 EFI_IFR_OP_HEADER Header;\r
167 UINT16 FormId;\r
168 STRING_REF Prompt;\r
169 STRING_REF Help; // The string Token for the context-help\r
170 UINT8 Flags; // This is included solely for purposes of interactive/dynamic support.\r
171 UINT16 Key; // Value to be passed to caller to identify this particular op-code\r
172} EFI_IFR_REF;\r
173\r
174typedef struct {\r
175 EFI_IFR_OP_HEADER Header;\r
176} EFI_IFR_END_FORM;\r
177\r
178typedef struct {\r
179 EFI_IFR_OP_HEADER Header;\r
180} EFI_IFR_END_FORM_SET;\r
181\r
182//\r
183// Also notice that the IFR_ONE_OF and IFR_CHECK_BOX are identical in structure......code assumes this to be true, if this ever\r
184// changes we need to revisit the InitializeTagStructures code\r
185//\r
186typedef struct {\r
187 EFI_IFR_OP_HEADER Header;\r
188 UINT16 QuestionId; // The ID designating what the question is about...sucked in from a #define, likely in the form of a variable name\r
189 UINT8 Width; // The Size of the Data being saved\r
190 STRING_REF Prompt; // The String Token for the Prompt\r
191 STRING_REF Help; // The string Token for the context-help\r
192} EFI_IFR_ONE_OF;\r
193\r
194typedef struct {\r
195 EFI_IFR_OP_HEADER Header;\r
196 UINT16 QuestionId; // The offset in NV for storage of the data\r
197 UINT8 MaxEntries; // The maximum number of options in the ordered list (=size of NVStore)\r
198 STRING_REF Prompt; // The string token for the prompt\r
199 STRING_REF Help; // The string token for the context-help\r
200} EFI_IFR_ORDERED_LIST;\r
201\r
202typedef struct {\r
203 EFI_IFR_OP_HEADER Header;\r
204 UINT16 QuestionId; // The ID designating what the question is about...sucked in from a #define, likely in the form of a variable name\r
205 UINT8 Width; // The Size of the Data being saved\r
206 STRING_REF Prompt; // The String Token for the Prompt\r
207 STRING_REF Help; // The string Token for the context-help\r
208 UINT8 Flags; // For now, if non-zero, means that it is the default option, - further definition likely\r
209 UINT16 Key; // Value to be passed to caller to identify this particular op-code\r
210} EFI_IFR_CHECKBOX, EFI_IFR_CHECK_BOX;\r
211\r
212typedef struct {\r
213 EFI_IFR_OP_HEADER Header;\r
214 STRING_REF Option; // The string token describing the option\r
215 UINT16 Value; // The value associated with this option that is stored in the NVRAM if chosen\r
216 UINT8 Flags; // For now, if non-zero, means that it is the default option, - further definition likely above\r
217 UINT16 Key; // Value to be passed to caller to identify this particular op-code\r
218} EFI_IFR_ONE_OF_OPTION;\r
219\r
220typedef struct {\r
221 EFI_IFR_OP_HEADER Header;\r
222 UINT16 QuestionId; // The ID designating what the question is about...sucked in from a #define, likely in the form of a variable name\r
223 UINT8 Width; // The Size of the Data being saved\r
224 STRING_REF Prompt; // The String Token for the Prompt\r
225 STRING_REF Help; // The string Token for the context-help\r
226 UINT8 Flags; // This is included solely for purposes of interactive/dynamic support.\r
227 UINT16 Key; // Value to be passed to caller to identify this particular op-code\r
228 UINT16 Minimum;\r
229 UINT16 Maximum;\r
230 UINT16 Step; // If step is 0, then manual input is specified, otherwise, left/right arrow selection is called for\r
231 UINT16 Default;\r
232} EFI_IFR_NUMERIC;\r
233\r
234//\r
235// There is an interesting twist with regards to Time and Date. This is one of the few items which can accept input from\r
236// a user, however may or may not need to use storage in the NVRAM space. The decided method for determining if NVRAM space\r
237// will be used (only for a TimeOp or DateOp) is: If .QuestionId == 0 && .Width == 0 (normally an impossibility) then use system\r
238// resources to store the data away and not NV resources. In other words, the setup engine will call gRT->SetTime, and gRT->SetDate\r
239// for the saving of data, and the values displayed will be from the gRT->GetXXXX series of calls.\r
240//\r
241typedef struct {\r
242 EFI_IFR_NUMERIC Hour;\r
243 EFI_IFR_NUMERIC Minute;\r
244 EFI_IFR_NUMERIC Second;\r
245} EFI_IFR_TIME;\r
246\r
247typedef struct {\r
248 EFI_IFR_NUMERIC Year;\r
249 EFI_IFR_NUMERIC Month;\r
250 EFI_IFR_NUMERIC Day;\r
251} EFI_IFR_DATE;\r
252\r
253typedef struct {\r
254 EFI_IFR_OP_HEADER Header;\r
255 UINT16 QuestionId; // The ID designating what the question is about...sucked in from a #define, likely in the form of a variable name\r
256 UINT8 Width; // The Size of the Data being saved -- BUGBUG -- remove someday\r
257 STRING_REF Prompt; // The String Token for the Prompt\r
258 STRING_REF Help; // The string Token for the context-help\r
259 UINT8 Flags; // This is included solely for purposes of interactive/dynamic support.\r
260 UINT16 Key; // Value to be passed to caller to identify this particular op-code\r
261 UINT8 MinSize; // Minimum allowable sized password\r
262 UINT8 MaxSize; // Maximum allowable sized password\r
263 UINT16 Encoding;\r
264} EFI_IFR_PASSWORD;\r
265\r
266typedef struct {\r
267 EFI_IFR_OP_HEADER Header;\r
268 UINT16 QuestionId; // The ID designating what the question is about...sucked in from a #define, likely in the form of a variable name\r
269 UINT8 Width; // The Size of the Data being saved -- BUGBUG -- remove someday\r
270 STRING_REF Prompt; // The String Token for the Prompt\r
271 STRING_REF Help; // The string Token for the context-help\r
272 UINT8 Flags; // This is included solely for purposes of interactive/dynamic support.\r
273 UINT16 Key; // Value to be passed to caller to identify this particular op-code\r
274 UINT8 MinSize; // Minimum allowable sized password\r
275 UINT8 MaxSize; // Maximum allowable sized password\r
276} EFI_IFR_STRING;\r
277\r
278typedef struct {\r
279 EFI_IFR_OP_HEADER Header;\r
280} EFI_IFR_END_ONE_OF;\r
281\r
282typedef struct {\r
283 EFI_IFR_OP_HEADER Header;\r
284 UINT16 Value;\r
285 UINT16 Key;\r
286} EFI_IFR_HIDDEN;\r
287\r
288typedef struct {\r
289 EFI_IFR_OP_HEADER Header;\r
290 UINT8 Flags;\r
291} EFI_IFR_SUPPRESS;\r
292\r
293typedef struct {\r
294 EFI_IFR_OP_HEADER Header;\r
295 UINT8 Flags;\r
296} EFI_IFR_GRAY_OUT;\r
297\r
298typedef struct {\r
299 EFI_IFR_OP_HEADER Header;\r
300 STRING_REF Popup;\r
301 UINT8 Flags;\r
302} EFI_IFR_INCONSISTENT;\r
303\r
304typedef struct {\r
305 EFI_IFR_OP_HEADER Header;\r
306 UINT16 QuestionId; // offset into variable storage\r
307 UINT8 Width; // size of variable storage\r
308 UINT16 Value; // value to compare against\r
309} EFI_IFR_EQ_ID_VAL;\r
310\r
311typedef struct {\r
312 EFI_IFR_OP_HEADER Header;\r
313 UINT16 QuestionId; // offset into variable storage\r
314 UINT8 Width; // size of variable storage\r
315 UINT16 ListLength;\r
316 UINT16 ValueList[1];\r
317} EFI_IFR_EQ_ID_LIST;\r
318\r
319typedef struct {\r
320 EFI_IFR_OP_HEADER Header;\r
321 UINT16 QuestionId1; // offset into variable storage for first value to compare\r
322 UINT8 Width; // size of variable storage (must be same for both)\r
323 UINT16 QuestionId2; // offset into variable storage for second value to compare\r
324} EFI_IFR_EQ_ID_ID;\r
325\r
326typedef struct {\r
327 EFI_IFR_OP_HEADER Header;\r
328 UINT16 VariableId; // offset into variable storage\r
329 UINT16 Value; // value to compare against\r
330} EFI_IFR_EQ_VAR_VAL;\r
331\r
332typedef struct {\r
333 EFI_IFR_OP_HEADER Header;\r
334} EFI_IFR_AND;\r
335\r
336typedef struct {\r
337 EFI_IFR_OP_HEADER Header;\r
338} EFI_IFR_OR;\r
339\r
340typedef struct {\r
341 EFI_IFR_OP_HEADER Header;\r
342} EFI_IFR_NOT;\r
343\r
344typedef struct {\r
345 EFI_IFR_OP_HEADER Header;\r
346} EFI_IFR_END_EXPR, EFI_IFR_END_IF;\r
347\r
348typedef struct {\r
349 EFI_IFR_OP_HEADER Header;\r
350 UINT16 FormId;\r
351 STRING_REF Prompt;\r
352 STRING_REF Help;\r
353 UINT8 Flags;\r
354 UINT16 Key;\r
355} EFI_IFR_SAVE_DEFAULTS;\r
356\r
357typedef struct {\r
358 EFI_IFR_OP_HEADER Header;\r
359 STRING_REF Help;\r
360 STRING_REF Text;\r
361 STRING_REF TextTwo; // optional text\r
362} EFI_IFR_INVENTORY;\r
363\r
364typedef struct {\r
365 EFI_IFR_OP_HEADER Header;\r
366 EFI_GUID Guid; // GUID for the variable\r
367 UINT16 VarId; // variable store ID, as referenced elsewhere in the form\r
368 UINT16 Size; // size of the variable storage\r
369} EFI_IFR_VARSTORE;\r
370\r
371typedef struct {\r
372 EFI_IFR_OP_HEADER Header;\r
373 UINT16 VarId; // variable store ID, as referenced elsewhere in the form\r
374} EFI_IFR_VARSTORE_SELECT;\r
375\r
376//\r
377// Used for the ideqid VFR statement where two variable stores may be referenced in the\r
378// same VFR statement.\r
379// A browser should treat this as an EFI_IFR_VARSTORE_SELECT statement and assume that all following\r
380// IFR opcodes use the VarId as defined here.\r
381//\r
382typedef struct {\r
383 EFI_IFR_OP_HEADER Header;\r
384 UINT16 VarId; // variable store ID, as referenced elsewhere in the form\r
385 UINT16 SecondaryVarId; // variable store ID, as referenced elsewhere in the form\r
386} EFI_IFR_VARSTORE_SELECT_PAIR;\r
387\r
388typedef struct {\r
389 EFI_IFR_OP_HEADER Header;\r
390} EFI_IFR_TRUE;\r
391\r
392typedef struct {\r
393 EFI_IFR_OP_HEADER Header;\r
394} EFI_IFR_FALSE;\r
395\r
396typedef struct {\r
397 EFI_IFR_OP_HEADER Header;\r
398} EFI_IFR_GT;\r
399\r
400typedef struct {\r
401 EFI_IFR_OP_HEADER Header;\r
402} EFI_IFR_GE;\r
403\r
404//\r
405// Save defaults and restore defaults have same structure\r
406//\r
407#define EFI_IFR_RESTORE_DEFAULTS EFI_IFR_SAVE_DEFAULTS\r
408\r
409typedef struct {\r
410 EFI_IFR_OP_HEADER Header;\r
411 STRING_REF Title; // The string token for the banner title\r
412 UINT16 LineNumber; // 1-based line number\r
413 UINT8 Alignment; // left, center, or right-aligned\r
414} EFI_IFR_BANNER;\r
415\r
416#define EFI_IFR_BANNER_ALIGN_LEFT 0\r
417#define EFI_IFR_BANNER_ALIGN_CENTER 1\r
418#define EFI_IFR_BANNER_ALIGN_RIGHT 2\r
419#define EFI_IFR_BANNER_TIMEOUT 0xFF\r
420\r
421#pragma pack()\r
422\r
423\r
424\r
425#endif\r