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