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