Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / ipxe / src / include / ipxe / efi / Uefi / UefiInternalFormRepresentation.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 - 2013, Intel Corporation. All rights reserved.<BR>
7 This program and the accompanying materials are licensed and made available under
8 the terms and conditions of the BSD License that accompanies this distribution.
9 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   @par Revision Reference:
16   These definitions are from UEFI 2.1 and 2.2.
17
18 **/
19
20 #ifndef __UEFI_INTERNAL_FORMREPRESENTATION_H__
21 #define __UEFI_INTERNAL_FORMREPRESENTATION_H__
22
23 FILE_LICENCE ( BSD3 );
24
25 #include <ipxe/efi/Guid/HiiFormMapMethodGuid.h>
26
27 ///
28 /// The following types are currently defined:
29 ///
30 typedef VOID*   EFI_HII_HANDLE;
31 typedef CHAR16* EFI_STRING;
32 typedef UINT16  EFI_IMAGE_ID;
33 typedef UINT16  EFI_QUESTION_ID;
34 typedef UINT16  EFI_STRING_ID;
35 typedef UINT16  EFI_FORM_ID;
36 typedef UINT16  EFI_VARSTORE_ID;
37 typedef UINT16  EFI_ANIMATION_ID;
38
39 typedef UINT16  EFI_DEFAULT_ID;
40
41 typedef UINT32  EFI_HII_FONT_STYLE;
42
43
44
45 #pragma pack(1)
46
47 //
48 // Definitions for Package Lists and Package Headers
49 // Section 27.3.1
50 //
51
52 ///
53 /// The header found at the start of each package list.
54 ///
55 typedef struct {
56   EFI_GUID               PackageListGuid;
57   UINT32                 PackageLength;
58 } EFI_HII_PACKAGE_LIST_HEADER;
59
60 ///
61 /// The header found at the start of each package.
62 ///
63 typedef struct {
64   UINT32  Length:24;
65   UINT32  Type:8;
66   // UINT8  Data[...];
67 } EFI_HII_PACKAGE_HEADER;
68
69 //
70 // Value of HII package type
71 //
72 #define EFI_HII_PACKAGE_TYPE_ALL             0x00
73 #define EFI_HII_PACKAGE_TYPE_GUID            0x01
74 #define EFI_HII_PACKAGE_FORMS                0x02
75 #define EFI_HII_PACKAGE_STRINGS              0x04
76 #define EFI_HII_PACKAGE_FONTS                0x05
77 #define EFI_HII_PACKAGE_IMAGES               0x06
78 #define EFI_HII_PACKAGE_SIMPLE_FONTS         0x07
79 #define EFI_HII_PACKAGE_DEVICE_PATH          0x08
80 #define EFI_HII_PACKAGE_KEYBOARD_LAYOUT      0x09
81 #define EFI_HII_PACKAGE_ANIMATIONS           0x0A
82 #define EFI_HII_PACKAGE_END                  0xDF
83 #define EFI_HII_PACKAGE_TYPE_SYSTEM_BEGIN    0xE0
84 #define EFI_HII_PACKAGE_TYPE_SYSTEM_END      0xFF
85
86 //
87 // Definitions for Simplified Font Package
88 //
89
90 ///
91 /// Contents of EFI_NARROW_GLYPH.Attributes.
92 ///@{
93 #define EFI_GLYPH_NON_SPACING                0x01
94 #define EFI_GLYPH_WIDE                       0x02
95 #define EFI_GLYPH_HEIGHT                     19
96 #define EFI_GLYPH_WIDTH                      8
97 ///@}
98
99 ///
100 /// The EFI_NARROW_GLYPH has a preferred dimension (w x h) of 8 x 19 pixels.
101 ///
102 typedef struct {
103   ///
104   /// The Unicode representation of the glyph. The term weight is the
105   /// technical term for a character code.
106   ///
107   CHAR16                 UnicodeWeight;
108   ///
109   /// The data element containing the glyph definitions.
110   ///
111   UINT8                  Attributes;
112   ///
113   /// The column major glyph representation of the character. Bits
114   /// with values of one indicate that the corresponding pixel is to be
115   /// on when normally displayed; those with zero are off.
116   ///
117   UINT8                  GlyphCol1[EFI_GLYPH_HEIGHT];
118 } EFI_NARROW_GLYPH;
119
120 ///
121 /// The EFI_WIDE_GLYPH has a preferred dimension (w x h) of 16 x 19 pixels, which is large enough
122 /// to accommodate logographic characters.
123 ///
124 typedef struct {
125   ///
126   /// The Unicode representation of the glyph. The term weight is the
127   /// technical term for a character code.
128   ///
129   CHAR16                 UnicodeWeight;
130   ///
131   /// The data element containing the glyph definitions.
132   ///
133   UINT8                  Attributes;
134   ///
135   /// The column major glyph representation of the character. Bits
136   /// with values of one indicate that the corresponding pixel is to be
137   /// on when normally displayed; those with zero are off.
138   ///
139   UINT8                  GlyphCol1[EFI_GLYPH_HEIGHT];
140   ///
141   /// The column major glyph representation of the character. Bits
142   /// with values of one indicate that the corresponding pixel is to be
143   /// on when normally displayed; those with zero are off.
144   ///
145   UINT8                  GlyphCol2[EFI_GLYPH_HEIGHT];
146   ///
147   /// Ensures that sizeof (EFI_WIDE_GLYPH) is twice the
148   /// sizeof (EFI_NARROW_GLYPH). The contents of Pad must
149   /// be zero.
150   ///
151   UINT8                  Pad[3];
152 } EFI_WIDE_GLYPH;
153
154 ///
155 /// A simplified font package consists of a font header
156 /// followed by a series of glyph structures.
157 ///
158 typedef struct _EFI_HII_SIMPLE_FONT_PACKAGE_HDR {
159   EFI_HII_PACKAGE_HEADER Header;
160   UINT16                 NumberOfNarrowGlyphs;
161   UINT16                 NumberOfWideGlyphs;
162   // EFI_NARROW_GLYPH       NarrowGlyphs[];
163   // EFI_WIDE_GLYPH         WideGlyphs[];
164 } EFI_HII_SIMPLE_FONT_PACKAGE_HDR;
165
166 //
167 // Definitions for Font Package
168 // Section 27.3.3
169 //
170
171 //
172 // Value for font style
173 //
174 #define EFI_HII_FONT_STYLE_NORMAL            0x00000000
175 #define EFI_HII_FONT_STYLE_BOLD              0x00000001
176 #define EFI_HII_FONT_STYLE_ITALIC            0x00000002
177 #define EFI_HII_FONT_STYLE_EMBOSS            0x00010000
178 #define EFI_HII_FONT_STYLE_OUTLINE           0x00020000
179 #define EFI_HII_FONT_STYLE_SHADOW            0x00040000
180 #define EFI_HII_FONT_STYLE_UNDERLINE         0x00080000
181 #define EFI_HII_FONT_STYLE_DBL_UNDER         0x00100000
182
183 typedef struct _EFI_HII_GLYPH_INFO {
184   UINT16                 Width;
185   UINT16                 Height;
186   INT16                  OffsetX;
187   INT16                  OffsetY;
188   INT16                  AdvanceX;
189 } EFI_HII_GLYPH_INFO;
190
191 ///
192 /// The fixed header consists of a standard record header,
193 /// then the character values in this section, the flags
194 /// (including the encoding method) and the offsets of the glyph
195 /// information, the glyph bitmaps and the character map.
196 ///
197 typedef struct _EFI_HII_FONT_PACKAGE_HDR {
198   EFI_HII_PACKAGE_HEADER Header;
199   UINT32                 HdrSize;
200   UINT32                 GlyphBlockOffset;
201   EFI_HII_GLYPH_INFO     Cell;
202   EFI_HII_FONT_STYLE     FontStyle;
203   CHAR16                 FontFamily[1];
204 } EFI_HII_FONT_PACKAGE_HDR;
205
206 //
207 // Value of different glyph info block types
208 //
209 #define EFI_HII_GIBT_END                  0x00
210 #define EFI_HII_GIBT_GLYPH                0x10
211 #define EFI_HII_GIBT_GLYPHS               0x11
212 #define EFI_HII_GIBT_GLYPH_DEFAULT        0x12
213 #define EFI_HII_GIBT_GLYPHS_DEFAULT       0x13
214 #define EFI_HII_GIBT_DUPLICATE            0x20
215 #define EFI_HII_GIBT_SKIP2                0x21
216 #define EFI_HII_GIBT_SKIP1                0x22
217 #define EFI_HII_GIBT_DEFAULTS             0x23
218 #define EFI_HII_GIBT_EXT1                 0x30
219 #define EFI_HII_GIBT_EXT2                 0x31
220 #define EFI_HII_GIBT_EXT4                 0x32
221
222 typedef struct _EFI_HII_GLYPH_BLOCK {
223   UINT8                  BlockType;
224 } EFI_HII_GLYPH_BLOCK;
225
226 //
227 // Definition of different glyph info block types
228 //
229
230 typedef struct _EFI_HII_GIBT_DEFAULTS_BLOCK {
231   EFI_HII_GLYPH_BLOCK    Header;
232   EFI_HII_GLYPH_INFO     Cell;
233 } EFI_HII_GIBT_DEFAULTS_BLOCK;
234
235 typedef struct _EFI_HII_GIBT_DUPLICATE_BLOCK {
236   EFI_HII_GLYPH_BLOCK    Header;
237   CHAR16                 CharValue;
238 } EFI_HII_GIBT_DUPLICATE_BLOCK;
239
240 typedef struct _EFI_GLYPH_GIBT_END_BLOCK {
241   EFI_HII_GLYPH_BLOCK    Header;
242 } EFI_GLYPH_GIBT_END_BLOCK;
243
244 typedef struct _EFI_HII_GIBT_EXT1_BLOCK {
245   EFI_HII_GLYPH_BLOCK    Header;
246   UINT8                  BlockType2;
247   UINT8                  Length;
248 } EFI_HII_GIBT_EXT1_BLOCK;
249
250 typedef struct _EFI_HII_GIBT_EXT2_BLOCK {
251   EFI_HII_GLYPH_BLOCK    Header;
252   UINT8                  BlockType2;
253   UINT16                 Length;
254 } EFI_HII_GIBT_EXT2_BLOCK;
255
256 typedef struct _EFI_HII_GIBT_EXT4_BLOCK {
257   EFI_HII_GLYPH_BLOCK    Header;
258   UINT8                  BlockType2;
259   UINT32                 Length;
260 } EFI_HII_GIBT_EXT4_BLOCK;
261
262 typedef struct _EFI_HII_GIBT_GLYPH_BLOCK {
263   EFI_HII_GLYPH_BLOCK    Header;
264   EFI_HII_GLYPH_INFO     Cell;
265   UINT8                  BitmapData[1];
266 } EFI_HII_GIBT_GLYPH_BLOCK;
267
268 typedef struct _EFI_HII_GIBT_GLYPHS_BLOCK {
269   EFI_HII_GLYPH_BLOCK    Header;
270   EFI_HII_GLYPH_INFO     Cell;
271   UINT16                 Count;
272   UINT8                  BitmapData[1];
273 } EFI_HII_GIBT_GLYPHS_BLOCK;
274
275 typedef struct _EFI_HII_GIBT_GLYPH_DEFAULT_BLOCK {
276   EFI_HII_GLYPH_BLOCK    Header;
277   UINT8                  BitmapData[1];
278 } EFI_HII_GIBT_GLYPH_DEFAULT_BLOCK;
279
280 typedef struct _EFI_HII_GIBT_GLYPHS_DEFAULT_BLOCK {
281   EFI_HII_GLYPH_BLOCK    Header;
282   UINT16                 Count;
283   UINT8                  BitmapData[1];
284 } EFI_HII_GIBT_GLYPHS_DEFAULT_BLOCK;
285
286 typedef struct _EFI_HII_GIBT_SKIP1_BLOCK {
287   EFI_HII_GLYPH_BLOCK    Header;
288   UINT8                  SkipCount;
289 } EFI_HII_GIBT_SKIP1_BLOCK;
290
291 typedef struct _EFI_HII_GIBT_SKIP2_BLOCK {
292   EFI_HII_GLYPH_BLOCK    Header;
293   UINT16                 SkipCount;
294 } EFI_HII_GIBT_SKIP2_BLOCK;
295
296 //
297 // Definitions for Device Path Package
298 // Section 27.3.4
299 //
300
301 ///
302 /// The device path package is used to carry a device path
303 /// associated with the package list.
304 ///
305 typedef struct _EFI_HII_DEVICE_PATH_PACKAGE_HDR {
306   EFI_HII_PACKAGE_HEADER   Header;
307   // EFI_DEVICE_PATH_PROTOCOL DevicePath[];
308 } EFI_HII_DEVICE_PATH_PACKAGE_HDR;
309
310 //
311 // Definitions for GUID Package
312 // Section 27.3.5
313 //
314
315 ///
316 /// The GUID package is used to carry data where the format is defined by a GUID.
317 ///
318 typedef struct _EFI_HII_GUID_PACKAGE_HDR {
319   EFI_HII_PACKAGE_HEADER  Header;
320   EFI_GUID                Guid;
321   // Data per GUID definition may follow
322 } EFI_HII_GUID_PACKAGE_HDR;
323
324 //
325 // Definitions for String Package
326 // Section 27.3.6
327 //
328
329 #define UEFI_CONFIG_LANG   "x-UEFI"
330 #define UEFI_CONFIG_LANG_2 "x-i-UEFI"
331
332 ///
333 /// The fixed header consists of a standard record header and then the string identifiers
334 /// contained in this section and the offsets of the string and language information.
335 ///
336 typedef struct _EFI_HII_STRING_PACKAGE_HDR {
337   EFI_HII_PACKAGE_HEADER  Header;
338   UINT32                  HdrSize;
339   UINT32                  StringInfoOffset;
340   CHAR16                  LanguageWindow[16];
341   EFI_STRING_ID           LanguageName;
342   CHAR8                   Language[1];
343 } EFI_HII_STRING_PACKAGE_HDR;
344
345 typedef struct {
346   UINT8                   BlockType;
347 } EFI_HII_STRING_BLOCK;
348
349 //
350 // Value of different string information block types
351 //
352 #define EFI_HII_SIBT_END                     0x00
353 #define EFI_HII_SIBT_STRING_SCSU             0x10
354 #define EFI_HII_SIBT_STRING_SCSU_FONT        0x11
355 #define EFI_HII_SIBT_STRINGS_SCSU            0x12
356 #define EFI_HII_SIBT_STRINGS_SCSU_FONT       0x13
357 #define EFI_HII_SIBT_STRING_UCS2             0x14
358 #define EFI_HII_SIBT_STRING_UCS2_FONT        0x15
359 #define EFI_HII_SIBT_STRINGS_UCS2            0x16
360 #define EFI_HII_SIBT_STRINGS_UCS2_FONT       0x17
361 #define EFI_HII_SIBT_DUPLICATE               0x20
362 #define EFI_HII_SIBT_SKIP2                   0x21
363 #define EFI_HII_SIBT_SKIP1                   0x22
364 #define EFI_HII_SIBT_EXT1                    0x30
365 #define EFI_HII_SIBT_EXT2                    0x31
366 #define EFI_HII_SIBT_EXT4                    0x32
367 #define EFI_HII_SIBT_FONT                    0x40
368
369 //
370 // Definition of different string information block types
371 //
372
373 typedef struct _EFI_HII_SIBT_DUPLICATE_BLOCK {
374   EFI_HII_STRING_BLOCK    Header;
375   EFI_STRING_ID           StringId;
376 } EFI_HII_SIBT_DUPLICATE_BLOCK;
377
378 typedef struct _EFI_HII_SIBT_END_BLOCK {
379   EFI_HII_STRING_BLOCK    Header;
380 } EFI_HII_SIBT_END_BLOCK;
381
382 typedef struct _EFI_HII_SIBT_EXT1_BLOCK {
383   EFI_HII_STRING_BLOCK    Header;
384   UINT8                   BlockType2;
385   UINT8                   Length;
386 } EFI_HII_SIBT_EXT1_BLOCK;
387
388 typedef struct _EFI_HII_SIBT_EXT2_BLOCK {
389   EFI_HII_STRING_BLOCK    Header;
390   UINT8                   BlockType2;
391   UINT16                  Length;
392 } EFI_HII_SIBT_EXT2_BLOCK;
393
394 typedef struct _EFI_HII_SIBT_EXT4_BLOCK {
395   EFI_HII_STRING_BLOCK    Header;
396   UINT8                   BlockType2;
397   UINT32                  Length;
398 } EFI_HII_SIBT_EXT4_BLOCK;
399
400 typedef struct _EFI_HII_SIBT_FONT_BLOCK {
401   EFI_HII_SIBT_EXT2_BLOCK Header;
402   UINT8                   FontId;
403   UINT16                  FontSize;
404   EFI_HII_FONT_STYLE      FontStyle;
405   CHAR16                  FontName[1];
406 } EFI_HII_SIBT_FONT_BLOCK;
407
408 typedef struct _EFI_HII_SIBT_SKIP1_BLOCK {
409   EFI_HII_STRING_BLOCK    Header;
410   UINT8                   SkipCount;
411 } EFI_HII_SIBT_SKIP1_BLOCK;
412
413 typedef struct _EFI_HII_SIBT_SKIP2_BLOCK {
414   EFI_HII_STRING_BLOCK    Header;
415   UINT16                  SkipCount;
416 } EFI_HII_SIBT_SKIP2_BLOCK;
417
418 typedef struct _EFI_HII_SIBT_STRING_SCSU_BLOCK {
419   EFI_HII_STRING_BLOCK    Header;
420   UINT8                   StringText[1];
421 } EFI_HII_SIBT_STRING_SCSU_BLOCK;
422
423 typedef struct _EFI_HII_SIBT_STRING_SCSU_FONT_BLOCK {
424   EFI_HII_STRING_BLOCK    Header;
425   UINT8                   FontIdentifier;
426   UINT8                   StringText[1];
427 } EFI_HII_SIBT_STRING_SCSU_FONT_BLOCK;
428
429 typedef struct _EFI_HII_SIBT_STRINGS_SCSU_BLOCK {
430   EFI_HII_STRING_BLOCK    Header;
431   UINT16                  StringCount;
432   UINT8                   StringText[1];
433 } EFI_HII_SIBT_STRINGS_SCSU_BLOCK;
434
435 typedef struct _EFI_HII_SIBT_STRINGS_SCSU_FONT_BLOCK {
436   EFI_HII_STRING_BLOCK    Header;
437   UINT8                   FontIdentifier;
438   UINT16                  StringCount;
439   UINT8                   StringText[1];
440 } EFI_HII_SIBT_STRINGS_SCSU_FONT_BLOCK;
441
442 typedef struct _EFI_HII_SIBT_STRING_UCS2_BLOCK {
443   EFI_HII_STRING_BLOCK    Header;
444   CHAR16                  StringText[1];
445 } EFI_HII_SIBT_STRING_UCS2_BLOCK;
446
447 typedef struct _EFI_HII_SIBT_STRING_UCS2_FONT_BLOCK {
448   EFI_HII_STRING_BLOCK    Header;
449   UINT8                   FontIdentifier;
450   CHAR16                  StringText[1];
451 } EFI_HII_SIBT_STRING_UCS2_FONT_BLOCK;
452
453 typedef struct _EFI_HII_SIBT_STRINGS_UCS2_BLOCK {
454   EFI_HII_STRING_BLOCK    Header;
455   UINT16                  StringCount;
456   CHAR16                  StringText[1];
457 } EFI_HII_SIBT_STRINGS_UCS2_BLOCK;
458
459 typedef struct _EFI_HII_SIBT_STRINGS_UCS2_FONT_BLOCK {
460   EFI_HII_STRING_BLOCK    Header;
461   UINT8                   FontIdentifier;
462   UINT16                  StringCount;
463   CHAR16                  StringText[1];
464 } EFI_HII_SIBT_STRINGS_UCS2_FONT_BLOCK;
465
466 //
467 // Definitions for Image Package
468 // Section 27.3.7
469 //
470
471 typedef struct _EFI_HII_IMAGE_PACKAGE_HDR {
472   EFI_HII_PACKAGE_HEADER  Header;
473   UINT32                  ImageInfoOffset;
474   UINT32                  PaletteInfoOffset;
475 } EFI_HII_IMAGE_PACKAGE_HDR;
476
477 typedef struct _EFI_HII_IMAGE_BLOCK {
478   UINT8                   BlockType;
479 } EFI_HII_IMAGE_BLOCK;
480
481 //
482 // Value of different image information block types
483 //
484 #define EFI_HII_IIBT_END               0x00
485 #define EFI_HII_IIBT_IMAGE_1BIT        0x10
486 #define EFI_HII_IIBT_IMAGE_1BIT_TRANS  0x11
487 #define EFI_HII_IIBT_IMAGE_4BIT        0x12
488 #define EFI_HII_IIBT_IMAGE_4BIT_TRANS  0x13
489 #define EFI_HII_IIBT_IMAGE_8BIT        0x14
490 #define EFI_HII_IIBT_IMAGE_8BIT_TRANS  0x15
491 #define EFI_HII_IIBT_IMAGE_24BIT       0x16
492 #define EFI_HII_IIBT_IMAGE_24BIT_TRANS 0x17
493 #define EFI_HII_IIBT_IMAGE_JPEG        0x18
494 #define EFI_HII_IIBT_DUPLICATE         0x20
495 #define EFI_HII_IIBT_SKIP2             0x21
496 #define EFI_HII_IIBT_SKIP1             0x22
497 #define EFI_HII_IIBT_EXT1              0x30
498 #define EFI_HII_IIBT_EXT2              0x31
499 #define EFI_HII_IIBT_EXT4              0x32
500
501 //
502 // Definition of different image information block types
503 //
504
505 typedef struct _EFI_HII_IIBT_END_BLOCK {
506   EFI_HII_IMAGE_BLOCK          Header;
507 } EFI_HII_IIBT_END_BLOCK;
508
509 typedef struct _EFI_HII_IIBT_EXT1_BLOCK {
510   EFI_HII_IMAGE_BLOCK          Header;
511   UINT8                        BlockType2;
512   UINT8                        Length;
513 } EFI_HII_IIBT_EXT1_BLOCK;
514
515 typedef struct _EFI_HII_IIBT_EXT2_BLOCK {
516   EFI_HII_IMAGE_BLOCK          Header;
517   UINT8                        BlockType2;
518   UINT16                       Length;
519 } EFI_HII_IIBT_EXT2_BLOCK;
520
521 typedef struct _EFI_HII_IIBT_EXT4_BLOCK {
522   EFI_HII_IMAGE_BLOCK          Header;
523   UINT8                        BlockType2;
524   UINT32                       Length;
525 } EFI_HII_IIBT_EXT4_BLOCK;
526
527 typedef struct _EFI_HII_IIBT_IMAGE_1BIT_BASE {
528   UINT16                       Width;
529   UINT16                       Height;
530   UINT8                        Data[1];
531 } EFI_HII_IIBT_IMAGE_1BIT_BASE;
532
533 typedef struct _EFI_HII_IIBT_IMAGE_1BIT_BLOCK {
534   EFI_HII_IMAGE_BLOCK          Header;
535   UINT8                        PaletteIndex;
536   EFI_HII_IIBT_IMAGE_1BIT_BASE Bitmap;
537 } EFI_HII_IIBT_IMAGE_1BIT_BLOCK;
538
539 typedef struct _EFI_HII_IIBT_IMAGE_1BIT_TRANS_BLOCK {
540   EFI_HII_IMAGE_BLOCK          Header;
541   UINT8                        PaletteIndex;
542   EFI_HII_IIBT_IMAGE_1BIT_BASE Bitmap;
543 } EFI_HII_IIBT_IMAGE_1BIT_TRANS_BLOCK;
544
545 typedef struct _EFI_HII_RGB_PIXEL {
546   UINT8                        b;
547   UINT8                        g;
548   UINT8                        r;
549 } EFI_HII_RGB_PIXEL;
550
551 typedef struct _EFI_HII_IIBT_IMAGE_24BIT_BASE {
552   UINT16                       Width;
553   UINT16                       Height;
554   EFI_HII_RGB_PIXEL            Bitmap[1];
555 } EFI_HII_IIBT_IMAGE_24BIT_BASE;
556
557 typedef struct _EFI_HII_IIBT_IMAGE_24BIT_BLOCK {
558   EFI_HII_IMAGE_BLOCK           Header;
559   EFI_HII_IIBT_IMAGE_24BIT_BASE Bitmap;
560 } EFI_HII_IIBT_IMAGE_24BIT_BLOCK;
561
562 typedef struct _EFI_HII_IIBT_IMAGE_24BIT_TRANS_BLOCK {
563   EFI_HII_IMAGE_BLOCK           Header;
564   EFI_HII_IIBT_IMAGE_24BIT_BASE Bitmap;
565 } EFI_HII_IIBT_IMAGE_24BIT_TRANS_BLOCK;
566
567 typedef struct _EFI_HII_IIBT_IMAGE_4BIT_BASE {
568   UINT16                       Width;
569   UINT16                       Height;
570   UINT8                        Data[1];
571 } EFI_HII_IIBT_IMAGE_4BIT_BASE;
572
573 typedef struct _EFI_HII_IIBT_IMAGE_4BIT_BLOCK {
574   EFI_HII_IMAGE_BLOCK          Header;
575   UINT8                        PaletteIndex;
576   EFI_HII_IIBT_IMAGE_4BIT_BASE Bitmap;
577 } EFI_HII_IIBT_IMAGE_4BIT_BLOCK;
578
579 typedef struct _EFI_HII_IIBT_IMAGE_4BIT_TRANS_BLOCK {
580   EFI_HII_IMAGE_BLOCK          Header;
581   UINT8                        PaletteIndex;
582   EFI_HII_IIBT_IMAGE_4BIT_BASE Bitmap;
583 } EFI_HII_IIBT_IMAGE_4BIT_TRANS_BLOCK;
584
585 typedef struct _EFI_HII_IIBT_IMAGE_8BIT_BASE {
586   UINT16                       Width;
587   UINT16                       Height;
588   UINT8                        Data[1];
589 } EFI_HII_IIBT_IMAGE_8BIT_BASE;
590
591 typedef struct _EFI_HII_IIBT_IMAGE_8BIT_PALETTE_BLOCK {
592   EFI_HII_IMAGE_BLOCK          Header;
593   UINT8                        PaletteIndex;
594   EFI_HII_IIBT_IMAGE_8BIT_BASE Bitmap;
595 } EFI_HII_IIBT_IMAGE_8BIT_BLOCK;
596
597 typedef struct _EFI_HII_IIBT_IMAGE_8BIT_TRANS_BLOCK {
598   EFI_HII_IMAGE_BLOCK          Header;
599   UINT8                        PaletteIndex;
600   EFI_HII_IIBT_IMAGE_8BIT_BASE Bitmap;
601 } EFI_HII_IIBT_IMAGE_8BIT_TRAN_BLOCK;
602
603 typedef struct _EFI_HII_IIBT_DUPLICATE_BLOCK {
604   EFI_HII_IMAGE_BLOCK          Header;
605   EFI_IMAGE_ID                 ImageId;
606 } EFI_HII_IIBT_DUPLICATE_BLOCK;
607
608 typedef struct _EFI_HII_IIBT_JPEG_BLOCK {
609   EFI_HII_IMAGE_BLOCK          Header;
610   UINT32                       Size;
611   UINT8                        Data[1];
612 } EFI_HII_IIBT_JPEG_BLOCK;
613
614 typedef struct _EFI_HII_IIBT_SKIP1_BLOCK {
615   EFI_HII_IMAGE_BLOCK          Header;
616   UINT8                        SkipCount;
617 } EFI_HII_IIBT_SKIP1_BLOCK;
618
619 typedef struct _EFI_HII_IIBT_SKIP2_BLOCK {
620   EFI_HII_IMAGE_BLOCK          Header;
621   UINT16                       SkipCount;
622 } EFI_HII_IIBT_SKIP2_BLOCK;
623
624 //
625 // Definitions for Palette Information
626 //
627
628 typedef struct _EFI_HII_IMAGE_PALETTE_INFO_HEADER {
629   UINT16                       PaletteCount;
630 } EFI_HII_IMAGE_PALETTE_INFO_HEADER;
631
632 typedef struct _EFI_HII_IMAGE_PALETTE_INFO {
633   UINT16                       PaletteSize;
634   EFI_HII_RGB_PIXEL            PaletteValue[1];
635 } EFI_HII_IMAGE_PALETTE_INFO;
636
637 //
638 // Definitions for Forms Package
639 // Section 27.3.8
640 //
641
642 ///
643 /// The Form package is used to carry form-based encoding data.
644 ///
645 typedef struct _EFI_HII_FORM_PACKAGE_HDR {
646   EFI_HII_PACKAGE_HEADER       Header;
647   // EFI_IFR_OP_HEADER         OpCodeHeader;
648   // More op-codes follow
649 } EFI_HII_FORM_PACKAGE_HDR;
650
651 typedef struct {
652   UINT8 Hour;
653   UINT8 Minute;
654   UINT8 Second;
655 } EFI_HII_TIME;
656
657 typedef struct {
658   UINT16 Year;
659   UINT8  Month;
660   UINT8  Day;
661 } EFI_HII_DATE;
662
663 typedef struct {
664   EFI_QUESTION_ID QuestionId;
665   EFI_FORM_ID     FormId;
666   EFI_GUID        FormSetGuid;
667   EFI_STRING_ID   DevicePath;
668 } EFI_HII_REF;
669
670 typedef union {
671   UINT8           u8;
672   UINT16          u16;
673   UINT32          u32;
674   UINT64          u64;
675   BOOLEAN         b;
676   EFI_HII_TIME    time;
677   EFI_HII_DATE    date;
678   EFI_STRING_ID   string; ///< EFI_IFR_TYPE_STRING, EFI_IFR_TYPE_ACTION
679   EFI_HII_REF     ref;    ///< EFI_IFR_TYPE_REF
680   // UINT8 buffer[];      ///< EFI_IFR_TYPE_BUFFER
681 } EFI_IFR_TYPE_VALUE;
682
683 //
684 // IFR Opcodes
685 //
686 #define EFI_IFR_FORM_OP                0x01
687 #define EFI_IFR_SUBTITLE_OP            0x02
688 #define EFI_IFR_TEXT_OP                0x03
689 #define EFI_IFR_IMAGE_OP               0x04
690 #define EFI_IFR_ONE_OF_OP              0x05
691 #define EFI_IFR_CHECKBOX_OP            0x06
692 #define EFI_IFR_NUMERIC_OP             0x07
693 #define EFI_IFR_PASSWORD_OP            0x08
694 #define EFI_IFR_ONE_OF_OPTION_OP       0x09
695 #define EFI_IFR_SUPPRESS_IF_OP         0x0A
696 #define EFI_IFR_LOCKED_OP              0x0B
697 #define EFI_IFR_ACTION_OP              0x0C
698 #define EFI_IFR_RESET_BUTTON_OP        0x0D
699 #define EFI_IFR_FORM_SET_OP            0x0E
700 #define EFI_IFR_REF_OP                 0x0F
701 #define EFI_IFR_NO_SUBMIT_IF_OP        0x10
702 #define EFI_IFR_INCONSISTENT_IF_OP     0x11
703 #define EFI_IFR_EQ_ID_VAL_OP           0x12
704 #define EFI_IFR_EQ_ID_ID_OP            0x13
705 #define EFI_IFR_EQ_ID_VAL_LIST_OP      0x14
706 #define EFI_IFR_AND_OP                 0x15
707 #define EFI_IFR_OR_OP                  0x16
708 #define EFI_IFR_NOT_OP                 0x17
709 #define EFI_IFR_RULE_OP                0x18
710 #define EFI_IFR_GRAY_OUT_IF_OP         0x19
711 #define EFI_IFR_DATE_OP                0x1A
712 #define EFI_IFR_TIME_OP                0x1B
713 #define EFI_IFR_STRING_OP              0x1C
714 #define EFI_IFR_REFRESH_OP             0x1D
715 #define EFI_IFR_DISABLE_IF_OP          0x1E
716 #define EFI_IFR_ANIMATION_OP           0x1F
717 #define EFI_IFR_TO_LOWER_OP            0x20
718 #define EFI_IFR_TO_UPPER_OP            0x21
719 #define EFI_IFR_MAP_OP                 0x22
720 #define EFI_IFR_ORDERED_LIST_OP        0x23
721 #define EFI_IFR_VARSTORE_OP            0x24
722 #define EFI_IFR_VARSTORE_NAME_VALUE_OP 0x25
723 #define EFI_IFR_VARSTORE_EFI_OP        0x26
724 #define EFI_IFR_VARSTORE_DEVICE_OP     0x27
725 #define EFI_IFR_VERSION_OP             0x28
726 #define EFI_IFR_END_OP                 0x29
727 #define EFI_IFR_MATCH_OP               0x2A
728 #define EFI_IFR_GET_OP                 0x2B
729 #define EFI_IFR_SET_OP                 0x2C
730 #define EFI_IFR_READ_OP                0x2D
731 #define EFI_IFR_WRITE_OP               0x2E
732 #define EFI_IFR_EQUAL_OP               0x2F
733 #define EFI_IFR_NOT_EQUAL_OP           0x30
734 #define EFI_IFR_GREATER_THAN_OP        0x31
735 #define EFI_IFR_GREATER_EQUAL_OP       0x32
736 #define EFI_IFR_LESS_THAN_OP           0x33
737 #define EFI_IFR_LESS_EQUAL_OP          0x34
738 #define EFI_IFR_BITWISE_AND_OP         0x35
739 #define EFI_IFR_BITWISE_OR_OP          0x36
740 #define EFI_IFR_BITWISE_NOT_OP         0x37
741 #define EFI_IFR_SHIFT_LEFT_OP          0x38
742 #define EFI_IFR_SHIFT_RIGHT_OP         0x39
743 #define EFI_IFR_ADD_OP                 0x3A
744 #define EFI_IFR_SUBTRACT_OP            0x3B
745 #define EFI_IFR_MULTIPLY_OP            0x3C
746 #define EFI_IFR_DIVIDE_OP              0x3D
747 #define EFI_IFR_MODULO_OP              0x3E
748 #define EFI_IFR_RULE_REF_OP            0x3F
749 #define EFI_IFR_QUESTION_REF1_OP       0x40
750 #define EFI_IFR_QUESTION_REF2_OP       0x41
751 #define EFI_IFR_UINT8_OP               0x42
752 #define EFI_IFR_UINT16_OP              0x43
753 #define EFI_IFR_UINT32_OP              0x44
754 #define EFI_IFR_UINT64_OP              0x45
755 #define EFI_IFR_TRUE_OP                0x46
756 #define EFI_IFR_FALSE_OP               0x47
757 #define EFI_IFR_TO_UINT_OP             0x48
758 #define EFI_IFR_TO_STRING_OP           0x49
759 #define EFI_IFR_TO_BOOLEAN_OP          0x4A
760 #define EFI_IFR_MID_OP                 0x4B
761 #define EFI_IFR_FIND_OP                0x4C
762 #define EFI_IFR_TOKEN_OP               0x4D
763 #define EFI_IFR_STRING_REF1_OP         0x4E
764 #define EFI_IFR_STRING_REF2_OP         0x4F
765 #define EFI_IFR_CONDITIONAL_OP         0x50
766 #define EFI_IFR_QUESTION_REF3_OP       0x51
767 #define EFI_IFR_ZERO_OP                0x52
768 #define EFI_IFR_ONE_OP                 0x53
769 #define EFI_IFR_ONES_OP                0x54
770 #define EFI_IFR_UNDEFINED_OP           0x55
771 #define EFI_IFR_LENGTH_OP              0x56
772 #define EFI_IFR_DUP_OP                 0x57
773 #define EFI_IFR_THIS_OP                0x58
774 #define EFI_IFR_SPAN_OP                0x59
775 #define EFI_IFR_VALUE_OP               0x5A
776 #define EFI_IFR_DEFAULT_OP             0x5B
777 #define EFI_IFR_DEFAULTSTORE_OP        0x5C
778 #define EFI_IFR_FORM_MAP_OP            0x5D
779 #define EFI_IFR_CATENATE_OP            0x5E
780 #define EFI_IFR_GUID_OP                0x5F
781 #define EFI_IFR_SECURITY_OP            0x60
782 #define EFI_IFR_MODAL_TAG_OP           0x61
783 #define EFI_IFR_REFRESH_ID_OP          0x62
784 #define EFI_IFR_WARNING_IF_OP          0x63
785
786 //
787 // Definitions of IFR Standard Headers
788 // Section 27.3.8.2
789 //
790
791 typedef struct _EFI_IFR_OP_HEADER {
792   UINT8                    OpCode;
793   UINT8                    Length:7;
794   UINT8                    Scope:1;
795 } EFI_IFR_OP_HEADER;
796
797 typedef struct _EFI_IFR_STATEMENT_HEADER {
798   EFI_STRING_ID            Prompt;
799   EFI_STRING_ID            Help;
800 } EFI_IFR_STATEMENT_HEADER;
801
802 typedef struct _EFI_IFR_QUESTION_HEADER {
803   EFI_IFR_STATEMENT_HEADER Header;
804   EFI_QUESTION_ID          QuestionId;
805   EFI_VARSTORE_ID          VarStoreId;
806   union {
807     EFI_STRING_ID          VarName;
808     UINT16                 VarOffset;
809   }                        VarStoreInfo;
810   UINT8                    Flags;
811 } EFI_IFR_QUESTION_HEADER;
812
813 //
814 // Flag values of EFI_IFR_QUESTION_HEADER
815 //
816 #define EFI_IFR_FLAG_READ_ONLY         0x01
817 #define EFI_IFR_FLAG_CALLBACK          0x04
818 #define EFI_IFR_FLAG_RESET_REQUIRED    0x10
819 #define EFI_IFR_FLAG_OPTIONS_ONLY      0x80
820
821 //
822 // Definition for Opcode Reference
823 // Section 27.3.8.3
824 //
825 typedef struct _EFI_IFR_DEFAULTSTORE {
826   EFI_IFR_OP_HEADER        Header;
827   EFI_STRING_ID            DefaultName;
828   UINT16                   DefaultId;
829 } EFI_IFR_DEFAULTSTORE;
830
831 //
832 // Default Identifier of default store
833 //
834 #define EFI_HII_DEFAULT_CLASS_STANDARD       0x0000
835 #define EFI_HII_DEFAULT_CLASS_MANUFACTURING  0x0001
836 #define EFI_HII_DEFAULT_CLASS_SAFE           0x0002
837 #define EFI_HII_DEFAULT_CLASS_PLATFORM_BEGIN 0x4000
838 #define EFI_HII_DEFAULT_CLASS_PLATFORM_END   0x7fff
839 #define EFI_HII_DEFAULT_CLASS_HARDWARE_BEGIN 0x8000
840 #define EFI_HII_DEFAULT_CLASS_HARDWARE_END   0xbfff
841 #define EFI_HII_DEFAULT_CLASS_FIRMWARE_BEGIN 0xc000
842 #define EFI_HII_DEFAULT_CLASS_FIRMWARE_END   0xffff
843
844 typedef struct _EFI_IFR_VARSTORE {
845   EFI_IFR_OP_HEADER        Header;
846   EFI_GUID                 Guid;
847   EFI_VARSTORE_ID          VarStoreId;
848   UINT16                   Size;
849   UINT8                    Name[1];
850 } EFI_IFR_VARSTORE;
851
852 typedef struct _EFI_IFR_VARSTORE_EFI {
853   EFI_IFR_OP_HEADER        Header;
854   EFI_VARSTORE_ID          VarStoreId;
855   EFI_GUID                 Guid;
856   UINT32                   Attributes;
857   UINT16                   Size;
858   UINT8                    Name[1];
859 } EFI_IFR_VARSTORE_EFI;
860
861 typedef struct _EFI_IFR_VARSTORE_NAME_VALUE {
862   EFI_IFR_OP_HEADER        Header;
863   EFI_VARSTORE_ID          VarStoreId;
864   EFI_GUID                 Guid;
865 } EFI_IFR_VARSTORE_NAME_VALUE;
866
867 typedef struct _EFI_IFR_FORM_SET {
868   EFI_IFR_OP_HEADER        Header;
869   EFI_GUID                 Guid;
870   EFI_STRING_ID            FormSetTitle;
871   EFI_STRING_ID            Help;
872   UINT8                    Flags;
873   // EFI_GUID              ClassGuid[];
874 } EFI_IFR_FORM_SET;
875
876 typedef struct _EFI_IFR_END {
877   EFI_IFR_OP_HEADER        Header;
878 } EFI_IFR_END;
879
880 typedef struct _EFI_IFR_FORM {
881   EFI_IFR_OP_HEADER        Header;
882   UINT16                   FormId;
883   EFI_STRING_ID            FormTitle;
884 } EFI_IFR_FORM;
885
886 typedef struct _EFI_IFR_IMAGE {
887   EFI_IFR_OP_HEADER        Header;
888   EFI_IMAGE_ID             Id;
889 } EFI_IFR_IMAGE;
890
891 typedef struct _EFI_IFR_MODAL_TAG {
892   EFI_IFR_OP_HEADER        Header;
893 } EFI_IFR_MODAL_TAG;
894
895 typedef struct _EFI_IFR_LOCKED {
896   EFI_IFR_OP_HEADER        Header;
897 } EFI_IFR_LOCKED;
898
899 typedef struct _EFI_IFR_RULE {
900   EFI_IFR_OP_HEADER        Header;
901   UINT8                    RuleId;
902 } EFI_IFR_RULE;
903
904 typedef struct _EFI_IFR_DEFAULT {
905   EFI_IFR_OP_HEADER        Header;
906   UINT16                   DefaultId;
907   UINT8                    Type;
908   EFI_IFR_TYPE_VALUE       Value;
909 } EFI_IFR_DEFAULT;
910
911 typedef struct _EFI_IFR_DEFAULT_2 {
912   EFI_IFR_OP_HEADER        Header;
913   UINT16                   DefaultId;
914   UINT8                    Type;
915 } EFI_IFR_DEFAULT_2;
916
917 typedef struct _EFI_IFR_VALUE {
918   EFI_IFR_OP_HEADER        Header;
919 } EFI_IFR_VALUE;
920
921 typedef struct _EFI_IFR_SUBTITLE {
922   EFI_IFR_OP_HEADER        Header;
923   EFI_IFR_STATEMENT_HEADER Statement;
924   UINT8                    Flags;
925 } EFI_IFR_SUBTITLE;
926
927 #define EFI_IFR_FLAGS_HORIZONTAL       0x01
928
929 typedef struct _EFI_IFR_CHECKBOX {
930   EFI_IFR_OP_HEADER        Header;
931   EFI_IFR_QUESTION_HEADER  Question;
932   UINT8                    Flags;
933 } EFI_IFR_CHECKBOX;
934
935 #define EFI_IFR_CHECKBOX_DEFAULT       0x01
936 #define EFI_IFR_CHECKBOX_DEFAULT_MFG   0x02
937
938 typedef struct _EFI_IFR_TEXT {
939   EFI_IFR_OP_HEADER        Header;
940   EFI_IFR_STATEMENT_HEADER Statement;
941   EFI_STRING_ID            TextTwo;
942 } EFI_IFR_TEXT;
943
944 typedef struct _EFI_IFR_REF {
945   EFI_IFR_OP_HEADER        Header;
946   EFI_IFR_QUESTION_HEADER  Question;
947   EFI_FORM_ID              FormId;
948 } EFI_IFR_REF;
949
950 typedef struct _EFI_IFR_REF2 {
951   EFI_IFR_OP_HEADER        Header;
952   EFI_IFR_QUESTION_HEADER  Question;
953   EFI_FORM_ID              FormId;
954   EFI_QUESTION_ID          QuestionId;
955 } EFI_IFR_REF2;
956
957 typedef struct _EFI_IFR_REF3 {
958   EFI_IFR_OP_HEADER        Header;
959   EFI_IFR_QUESTION_HEADER  Question;
960   EFI_FORM_ID              FormId;
961   EFI_QUESTION_ID          QuestionId;
962   EFI_GUID                 FormSetId;
963 } EFI_IFR_REF3;
964
965 typedef struct _EFI_IFR_REF4 {
966   EFI_IFR_OP_HEADER        Header;
967   EFI_IFR_QUESTION_HEADER  Question;
968   EFI_FORM_ID              FormId;
969   EFI_QUESTION_ID          QuestionId;
970   EFI_GUID                 FormSetId;
971   EFI_STRING_ID            DevicePath;
972 } EFI_IFR_REF4;
973
974 typedef struct _EFI_IFR_REF5 {
975   EFI_IFR_OP_HEADER Header;
976   EFI_IFR_QUESTION_HEADER Question;
977 } EFI_IFR_REF5;
978
979 typedef struct _EFI_IFR_RESET_BUTTON {
980   EFI_IFR_OP_HEADER        Header;
981   EFI_IFR_STATEMENT_HEADER Statement;
982   EFI_DEFAULT_ID           DefaultId;
983 } EFI_IFR_RESET_BUTTON;
984
985 typedef struct _EFI_IFR_ACTION {
986   EFI_IFR_OP_HEADER        Header;
987   EFI_IFR_QUESTION_HEADER  Question;
988   EFI_STRING_ID            QuestionConfig;
989 } EFI_IFR_ACTION;
990
991 typedef struct _EFI_IFR_ACTION_1 {
992   EFI_IFR_OP_HEADER        Header;
993   EFI_IFR_QUESTION_HEADER  Question;
994 } EFI_IFR_ACTION_1;
995
996 typedef struct _EFI_IFR_DATE {
997   EFI_IFR_OP_HEADER        Header;
998   EFI_IFR_QUESTION_HEADER  Question;
999   UINT8                    Flags;
1000 } EFI_IFR_DATE;
1001
1002 //
1003 // Flags that describe the behavior of the question.
1004 //
1005 #define EFI_QF_DATE_YEAR_SUPPRESS      0x01
1006 #define EFI_QF_DATE_MONTH_SUPPRESS     0x02
1007 #define EFI_QF_DATE_DAY_SUPPRESS       0x04
1008
1009 #define EFI_QF_DATE_STORAGE            0x30
1010 #define     QF_DATE_STORAGE_NORMAL     0x00
1011 #define     QF_DATE_STORAGE_TIME       0x10
1012 #define     QF_DATE_STORAGE_WAKEUP     0x20
1013
1014 typedef union {
1015   struct {
1016     UINT8 MinValue;
1017     UINT8 MaxValue;
1018     UINT8 Step;
1019   } u8;
1020   struct {
1021     UINT16 MinValue;
1022     UINT16 MaxValue;
1023     UINT16 Step;
1024   } u16;
1025   struct {
1026     UINT32 MinValue;
1027     UINT32 MaxValue;
1028     UINT32 Step;
1029   } u32;
1030   struct {
1031     UINT64 MinValue;
1032     UINT64 MaxValue;
1033     UINT64 Step;
1034   } u64;
1035 } MINMAXSTEP_DATA;
1036
1037 typedef struct _EFI_IFR_NUMERIC {
1038   EFI_IFR_OP_HEADER        Header;
1039   EFI_IFR_QUESTION_HEADER  Question;
1040   UINT8                    Flags;
1041   MINMAXSTEP_DATA          data;
1042 } EFI_IFR_NUMERIC;
1043
1044 //
1045 // Flags related to the numeric question
1046 //
1047 #define EFI_IFR_NUMERIC_SIZE           0x03
1048 #define   EFI_IFR_NUMERIC_SIZE_1       0x00
1049 #define   EFI_IFR_NUMERIC_SIZE_2       0x01
1050 #define   EFI_IFR_NUMERIC_SIZE_4       0x02
1051 #define   EFI_IFR_NUMERIC_SIZE_8       0x03
1052
1053 #define EFI_IFR_DISPLAY                0x30
1054 #define   EFI_IFR_DISPLAY_INT_DEC      0x00
1055 #define   EFI_IFR_DISPLAY_UINT_DEC     0x10
1056 #define   EFI_IFR_DISPLAY_UINT_HEX     0x20
1057
1058 typedef struct _EFI_IFR_ONE_OF {
1059   EFI_IFR_OP_HEADER        Header;
1060   EFI_IFR_QUESTION_HEADER  Question;
1061   UINT8                    Flags;
1062   MINMAXSTEP_DATA          data;
1063 } EFI_IFR_ONE_OF;
1064
1065 typedef struct _EFI_IFR_STRING {
1066   EFI_IFR_OP_HEADER        Header;
1067   EFI_IFR_QUESTION_HEADER  Question;
1068   UINT8                    MinSize;
1069   UINT8                    MaxSize;
1070   UINT8                    Flags;
1071 } EFI_IFR_STRING;
1072
1073 #define EFI_IFR_STRING_MULTI_LINE      0x01
1074
1075 typedef struct _EFI_IFR_PASSWORD {
1076   EFI_IFR_OP_HEADER        Header;
1077   EFI_IFR_QUESTION_HEADER  Question;
1078   UINT16                   MinSize;
1079   UINT16                   MaxSize;
1080 } EFI_IFR_PASSWORD;
1081
1082 typedef struct _EFI_IFR_ORDERED_LIST {
1083   EFI_IFR_OP_HEADER        Header;
1084   EFI_IFR_QUESTION_HEADER  Question;
1085   UINT8                    MaxContainers;
1086   UINT8                    Flags;
1087 } EFI_IFR_ORDERED_LIST;
1088
1089 #define EFI_IFR_UNIQUE_SET             0x01
1090 #define EFI_IFR_NO_EMPTY_SET           0x02
1091
1092 typedef struct _EFI_IFR_TIME {
1093   EFI_IFR_OP_HEADER        Header;
1094   EFI_IFR_QUESTION_HEADER  Question;
1095   UINT8                    Flags;
1096 } EFI_IFR_TIME;
1097
1098 //
1099 // A bit-mask that determines which unique settings are active for this opcode.
1100 //
1101 #define QF_TIME_HOUR_SUPPRESS          0x01
1102 #define QF_TIME_MINUTE_SUPPRESS        0x02
1103 #define QF_TIME_SECOND_SUPPRESS        0x04
1104
1105 #define QF_TIME_STORAGE                0x30
1106 #define   QF_TIME_STORAGE_NORMAL       0x00
1107 #define   QF_TIME_STORAGE_TIME         0x10
1108 #define   QF_TIME_STORAGE_WAKEUP       0x20
1109
1110 typedef struct _EFI_IFR_DISABLE_IF {
1111   EFI_IFR_OP_HEADER        Header;
1112 } EFI_IFR_DISABLE_IF;
1113
1114 typedef struct _EFI_IFR_SUPPRESS_IF {
1115   EFI_IFR_OP_HEADER        Header;
1116 } EFI_IFR_SUPPRESS_IF;
1117
1118 typedef struct _EFI_IFR_GRAY_OUT_IF {
1119   EFI_IFR_OP_HEADER        Header;
1120 } EFI_IFR_GRAY_OUT_IF;
1121
1122 typedef struct _EFI_IFR_INCONSISTENT_IF {
1123   EFI_IFR_OP_HEADER        Header;
1124   EFI_STRING_ID            Error;
1125 } EFI_IFR_INCONSISTENT_IF;
1126
1127 typedef struct _EFI_IFR_NO_SUBMIT_IF {
1128   EFI_IFR_OP_HEADER        Header;
1129   EFI_STRING_ID            Error;
1130 } EFI_IFR_NO_SUBMIT_IF;
1131
1132 typedef struct _EFI_IFR_WARNING_IF {
1133   EFI_IFR_OP_HEADER        Header;
1134   EFI_STRING_ID            Warning;
1135   UINT8                    TimeOut;
1136 } EFI_IFR_WARNING_IF;
1137
1138 typedef struct _EFI_IFR_REFRESH {
1139   EFI_IFR_OP_HEADER        Header;
1140   UINT8                    RefreshInterval;
1141 } EFI_IFR_REFRESH;
1142
1143 typedef struct _EFI_IFR_VARSTORE_DEVICE {
1144   EFI_IFR_OP_HEADER        Header;
1145   EFI_STRING_ID            DevicePath;
1146 } EFI_IFR_VARSTORE_DEVICE;
1147
1148 typedef struct _EFI_IFR_ONE_OF_OPTION {
1149   EFI_IFR_OP_HEADER        Header;
1150   EFI_STRING_ID            Option;
1151   UINT8                    Flags;
1152   UINT8                    Type;
1153   EFI_IFR_TYPE_VALUE       Value;
1154 } EFI_IFR_ONE_OF_OPTION;
1155
1156 //
1157 // Types of the option's value.
1158 //
1159 #define EFI_IFR_TYPE_NUM_SIZE_8        0x00
1160 #define EFI_IFR_TYPE_NUM_SIZE_16       0x01
1161 #define EFI_IFR_TYPE_NUM_SIZE_32       0x02
1162 #define EFI_IFR_TYPE_NUM_SIZE_64       0x03
1163 #define EFI_IFR_TYPE_BOOLEAN           0x04
1164 #define EFI_IFR_TYPE_TIME              0x05
1165 #define EFI_IFR_TYPE_DATE              0x06
1166 #define EFI_IFR_TYPE_STRING            0x07
1167 #define EFI_IFR_TYPE_OTHER             0x08
1168 #define EFI_IFR_TYPE_UNDEFINED         0x09
1169 #define EFI_IFR_TYPE_ACTION            0x0A
1170 #define EFI_IFR_TYPE_BUFFER            0x0B
1171 #define EFI_IFR_TYPE_REF               0x0C
1172
1173 #define EFI_IFR_OPTION_DEFAULT         0x10
1174 #define EFI_IFR_OPTION_DEFAULT_MFG     0x20
1175
1176 typedef struct _EFI_IFR_GUID {
1177   EFI_IFR_OP_HEADER        Header;
1178   EFI_GUID                 Guid;
1179   //Optional Data Follows
1180 } EFI_IFR_GUID;
1181
1182 typedef struct _EFI_IFR_REFRESH_ID {
1183   EFI_IFR_OP_HEADER Header;
1184   EFI_GUID          RefreshEventGroupId;
1185 } EFI_IFR_REFRESH_ID;
1186
1187 typedef struct _EFI_IFR_DUP {
1188   EFI_IFR_OP_HEADER        Header;
1189 } EFI_IFR_DUP;
1190
1191 typedef struct _EFI_IFR_EQ_ID_ID {
1192   EFI_IFR_OP_HEADER        Header;
1193   EFI_QUESTION_ID          QuestionId1;
1194   EFI_QUESTION_ID          QuestionId2;
1195 } EFI_IFR_EQ_ID_ID;
1196
1197 typedef struct _EFI_IFR_EQ_ID_VAL {
1198   EFI_IFR_OP_HEADER        Header;
1199   EFI_QUESTION_ID          QuestionId;
1200   UINT16                   Value;
1201 } EFI_IFR_EQ_ID_VAL;
1202
1203 typedef struct _EFI_IFR_EQ_ID_VAL_LIST {
1204   EFI_IFR_OP_HEADER        Header;
1205   EFI_QUESTION_ID          QuestionId;
1206   UINT16                   ListLength;
1207   UINT16                   ValueList[1];
1208 } EFI_IFR_EQ_ID_VAL_LIST;
1209
1210 typedef struct _EFI_IFR_UINT8 {
1211   EFI_IFR_OP_HEADER        Header;
1212   UINT8 Value;
1213 } EFI_IFR_UINT8;
1214
1215 typedef struct _EFI_IFR_UINT16 {
1216   EFI_IFR_OP_HEADER        Header;
1217   UINT16                   Value;
1218 } EFI_IFR_UINT16;
1219
1220 typedef struct _EFI_IFR_UINT32 {
1221   EFI_IFR_OP_HEADER        Header;
1222   UINT32                   Value;
1223 } EFI_IFR_UINT32;
1224
1225 typedef struct _EFI_IFR_UINT64 {
1226   EFI_IFR_OP_HEADER        Header;
1227   UINT64 Value;
1228 } EFI_IFR_UINT64;
1229
1230 typedef struct _EFI_IFR_QUESTION_REF1 {
1231   EFI_IFR_OP_HEADER        Header;
1232   EFI_QUESTION_ID          QuestionId;
1233 } EFI_IFR_QUESTION_REF1;
1234
1235 typedef struct _EFI_IFR_QUESTION_REF2 {
1236   EFI_IFR_OP_HEADER        Header;
1237 } EFI_IFR_QUESTION_REF2;
1238
1239 typedef struct _EFI_IFR_QUESTION_REF3 {
1240   EFI_IFR_OP_HEADER        Header;
1241 } EFI_IFR_QUESTION_REF3;
1242
1243 typedef struct _EFI_IFR_QUESTION_REF3_2 {
1244   EFI_IFR_OP_HEADER        Header;
1245   EFI_STRING_ID            DevicePath;
1246 } EFI_IFR_QUESTION_REF3_2;
1247
1248 typedef struct _EFI_IFR_QUESTION_REF3_3 {
1249   EFI_IFR_OP_HEADER        Header;
1250   EFI_STRING_ID            DevicePath;
1251   EFI_GUID                 Guid;
1252 } EFI_IFR_QUESTION_REF3_3;
1253
1254 typedef struct _EFI_IFR_RULE_REF {
1255   EFI_IFR_OP_HEADER        Header;
1256   UINT8                    RuleId;
1257 } EFI_IFR_RULE_REF;
1258
1259 typedef struct _EFI_IFR_STRING_REF1 {
1260   EFI_IFR_OP_HEADER        Header;
1261   EFI_STRING_ID            StringId;
1262 } EFI_IFR_STRING_REF1;
1263
1264 typedef struct _EFI_IFR_STRING_REF2 {
1265   EFI_IFR_OP_HEADER        Header;
1266 } EFI_IFR_STRING_REF2;
1267
1268 typedef struct _EFI_IFR_THIS {
1269   EFI_IFR_OP_HEADER        Header;
1270 } EFI_IFR_THIS;
1271
1272 typedef struct _EFI_IFR_TRUE {
1273   EFI_IFR_OP_HEADER        Header;
1274 } EFI_IFR_TRUE;
1275
1276 typedef struct _EFI_IFR_FALSE {
1277   EFI_IFR_OP_HEADER        Header;
1278 } EFI_IFR_FALSE;
1279
1280 typedef struct _EFI_IFR_ONE {
1281   EFI_IFR_OP_HEADER        Header;
1282 } EFI_IFR_ONE;
1283
1284 typedef struct _EFI_IFR_ONES {
1285   EFI_IFR_OP_HEADER        Header;
1286 } EFI_IFR_ONES;
1287
1288 typedef struct _EFI_IFR_ZERO {
1289   EFI_IFR_OP_HEADER        Header;
1290 } EFI_IFR_ZERO;
1291
1292 typedef struct _EFI_IFR_UNDEFINED {
1293   EFI_IFR_OP_HEADER        Header;
1294 } EFI_IFR_UNDEFINED;
1295
1296 typedef struct _EFI_IFR_VERSION {
1297   EFI_IFR_OP_HEADER        Header;
1298 } EFI_IFR_VERSION;
1299
1300 typedef struct _EFI_IFR_LENGTH {
1301   EFI_IFR_OP_HEADER        Header;
1302 } EFI_IFR_LENGTH;
1303
1304 typedef struct _EFI_IFR_NOT {
1305   EFI_IFR_OP_HEADER        Header;
1306 } EFI_IFR_NOT;
1307
1308 typedef struct _EFI_IFR_BITWISE_NOT {
1309   EFI_IFR_OP_HEADER        Header;
1310 } EFI_IFR_BITWISE_NOT;
1311
1312 typedef struct _EFI_IFR_TO_BOOLEAN {
1313   EFI_IFR_OP_HEADER        Header;
1314 } EFI_IFR_TO_BOOLEAN;
1315
1316 ///
1317 /// For EFI_IFR_TO_STRING, when converting from
1318 /// unsigned integers, these flags control the format:
1319 /// 0 = unsigned decimal.
1320 /// 1 = signed decimal.
1321 /// 2 = hexadecimal (lower-case alpha).
1322 /// 3 = hexadecimal (upper-case alpha).
1323 ///@{
1324 #define EFI_IFR_STRING_UNSIGNED_DEC      0
1325 #define EFI_IFR_STRING_SIGNED_DEC        1
1326 #define EFI_IFR_STRING_LOWERCASE_HEX     2
1327 #define EFI_IFR_STRING_UPPERCASE_HEX     3
1328 ///@}
1329
1330 ///
1331 /// When converting from a buffer, these flags control the format:
1332 /// 0 = ASCII.
1333 /// 8 = Unicode.
1334 ///@{
1335 #define EFI_IFR_STRING_ASCII             0
1336 #define EFI_IFR_STRING_UNICODE           8
1337 ///@}
1338
1339 typedef struct _EFI_IFR_TO_STRING {
1340   EFI_IFR_OP_HEADER        Header;
1341   UINT8                    Format;
1342 } EFI_IFR_TO_STRING;
1343
1344 typedef struct _EFI_IFR_TO_UINT {
1345   EFI_IFR_OP_HEADER        Header;
1346 } EFI_IFR_TO_UINT;
1347
1348 typedef struct _EFI_IFR_TO_UPPER {
1349   EFI_IFR_OP_HEADER        Header;
1350 } EFI_IFR_TO_UPPER;
1351
1352 typedef struct _EFI_IFR_TO_LOWER {
1353   EFI_IFR_OP_HEADER        Header;
1354 } EFI_IFR_TO_LOWER;
1355
1356 typedef struct _EFI_IFR_ADD {
1357   EFI_IFR_OP_HEADER        Header;
1358 } EFI_IFR_ADD;
1359
1360 typedef struct _EFI_IFR_AND {
1361   EFI_IFR_OP_HEADER        Header;
1362 } EFI_IFR_AND;
1363
1364 typedef struct _EFI_IFR_BITWISE_AND {
1365   EFI_IFR_OP_HEADER        Header;
1366 } EFI_IFR_BITWISE_AND;
1367
1368 typedef struct _EFI_IFR_BITWISE_OR {
1369   EFI_IFR_OP_HEADER        Header;
1370 } EFI_IFR_BITWISE_OR;
1371
1372 typedef struct _EFI_IFR_CATENATE {
1373   EFI_IFR_OP_HEADER        Header;
1374 } EFI_IFR_CATENATE;
1375
1376 typedef struct _EFI_IFR_DIVIDE {
1377   EFI_IFR_OP_HEADER        Header;
1378 } EFI_IFR_DIVIDE;
1379
1380 typedef struct _EFI_IFR_EQUAL {
1381   EFI_IFR_OP_HEADER        Header;
1382 } EFI_IFR_EQUAL;
1383
1384 typedef struct _EFI_IFR_GREATER_EQUAL {
1385   EFI_IFR_OP_HEADER        Header;
1386 } EFI_IFR_GREATER_EQUAL;
1387
1388 typedef struct _EFI_IFR_GREATER_THAN {
1389   EFI_IFR_OP_HEADER        Header;
1390 } EFI_IFR_GREATER_THAN;
1391
1392 typedef struct _EFI_IFR_LESS_EQUAL {
1393   EFI_IFR_OP_HEADER        Header;
1394 } EFI_IFR_LESS_EQUAL;
1395
1396 typedef struct _EFI_IFR_LESS_THAN {
1397   EFI_IFR_OP_HEADER        Header;
1398 } EFI_IFR_LESS_THAN;
1399
1400 typedef struct _EFI_IFR_MATCH {
1401   EFI_IFR_OP_HEADER        Header;
1402 } EFI_IFR_MATCH;
1403
1404 typedef struct _EFI_IFR_MULTIPLY {
1405   EFI_IFR_OP_HEADER        Header;
1406 } EFI_IFR_MULTIPLY;
1407
1408 typedef struct _EFI_IFR_MODULO {
1409   EFI_IFR_OP_HEADER        Header;
1410 } EFI_IFR_MODULO;
1411
1412 typedef struct _EFI_IFR_NOT_EQUAL {
1413   EFI_IFR_OP_HEADER        Header;
1414 } EFI_IFR_NOT_EQUAL;
1415
1416 typedef struct _EFI_IFR_OR {
1417   EFI_IFR_OP_HEADER        Header;
1418 } EFI_IFR_OR;
1419
1420 typedef struct _EFI_IFR_SHIFT_LEFT {
1421   EFI_IFR_OP_HEADER        Header;
1422 } EFI_IFR_SHIFT_LEFT;
1423
1424 typedef struct _EFI_IFR_SHIFT_RIGHT {
1425   EFI_IFR_OP_HEADER        Header;
1426 } EFI_IFR_SHIFT_RIGHT;
1427
1428 typedef struct _EFI_IFR_SUBTRACT {
1429   EFI_IFR_OP_HEADER        Header;
1430 } EFI_IFR_SUBTRACT;
1431
1432 typedef struct _EFI_IFR_CONDITIONAL {
1433   EFI_IFR_OP_HEADER        Header;
1434 } EFI_IFR_CONDITIONAL;
1435
1436 //
1437 // Flags governing the matching criteria of EFI_IFR_FIND
1438 //
1439 #define EFI_IFR_FF_CASE_SENSITIVE    0x00
1440 #define EFI_IFR_FF_CASE_INSENSITIVE  0x01
1441
1442 typedef struct _EFI_IFR_FIND {
1443   EFI_IFR_OP_HEADER        Header;
1444   UINT8                    Format;
1445 } EFI_IFR_FIND;
1446
1447 typedef struct _EFI_IFR_MID {
1448   EFI_IFR_OP_HEADER        Header;
1449 } EFI_IFR_MID;
1450
1451 typedef struct _EFI_IFR_TOKEN {
1452   EFI_IFR_OP_HEADER        Header;
1453 } EFI_IFR_TOKEN;
1454
1455 //
1456 // Flags specifying whether to find the first matching string
1457 // or the first non-matching string.
1458 //
1459 #define EFI_IFR_FLAGS_FIRST_MATCHING     0x00
1460 #define EFI_IFR_FLAGS_FIRST_NON_MATCHING 0x01
1461
1462 typedef struct _EFI_IFR_SPAN {
1463   EFI_IFR_OP_HEADER        Header;
1464   UINT8                    Flags;
1465 } EFI_IFR_SPAN;
1466
1467 typedef struct _EFI_IFR_SECURITY {
1468   ///
1469   /// Standard opcode header, where Header.Op = EFI_IFR_SECURITY_OP.
1470   ///
1471   EFI_IFR_OP_HEADER        Header;
1472   ///
1473   /// Security permission level.
1474   ///
1475   EFI_GUID                 Permissions;
1476 } EFI_IFR_SECURITY;
1477
1478 typedef struct _EFI_IFR_FORM_MAP_METHOD {
1479   ///
1480   /// The string identifier which provides the human-readable name of
1481   /// the configuration method for this standards map form.
1482   ///
1483   EFI_STRING_ID            MethodTitle;
1484   ///
1485   /// Identifier which uniquely specifies the configuration methods
1486   /// associated with this standards map form.
1487   ///
1488   EFI_GUID                 MethodIdentifier;
1489 } EFI_IFR_FORM_MAP_METHOD;
1490
1491 typedef struct _EFI_IFR_FORM_MAP {
1492   ///
1493   /// The sequence that defines the type of opcode as well as the length
1494   /// of the opcode being defined. Header.OpCode = EFI_IFR_FORM_MAP_OP.
1495   ///
1496   EFI_IFR_OP_HEADER        Header;
1497   ///
1498   /// The unique identifier for this particular form.
1499   ///
1500   EFI_FORM_ID              FormId;
1501   ///
1502   /// One or more configuration method's name and unique identifier.
1503   ///
1504   // EFI_IFR_FORM_MAP_METHOD  Methods[];
1505 } EFI_IFR_FORM_MAP;
1506
1507 typedef struct _EFI_IFR_SET {
1508   ///
1509   /// The sequence that defines the type of opcode as well as the length
1510   /// of the opcode being defined. Header.OpCode = EFI_IFR_SET_OP.
1511   ///
1512   EFI_IFR_OP_HEADER  Header;
1513   ///
1514   /// Specifies the identifier of a previously declared variable store to
1515   /// use when storing the question's value.
1516   ///
1517   EFI_VARSTORE_ID    VarStoreId;
1518   union {
1519     ///
1520     /// A 16-bit Buffer Storage offset.
1521     ///
1522     EFI_STRING_ID    VarName;
1523     ///
1524     /// A Name Value or EFI Variable name (VarName).
1525     ///
1526     UINT16           VarOffset;
1527   }                  VarStoreInfo;
1528   ///
1529   /// Specifies the type used for storage.
1530   ///
1531   UINT8              VarStoreType;
1532 } EFI_IFR_SET;
1533
1534 typedef struct _EFI_IFR_GET {
1535   ///
1536   /// The sequence that defines the type of opcode as well as the length
1537   /// of the opcode being defined. Header.OpCode = EFI_IFR_GET_OP.
1538   ///
1539   EFI_IFR_OP_HEADER  Header;
1540   ///
1541   /// Specifies the identifier of a previously declared variable store to
1542   /// use when retrieving the value.
1543   ///
1544   EFI_VARSTORE_ID    VarStoreId;
1545   union {
1546     ///
1547     /// A 16-bit Buffer Storage offset.
1548     ///
1549     EFI_STRING_ID    VarName;
1550     ///
1551     /// A Name Value or EFI Variable name (VarName).
1552     ///
1553     UINT16           VarOffset;
1554   }                  VarStoreInfo;
1555   ///
1556   /// Specifies the type used for storage.
1557   ///
1558   UINT8              VarStoreType;
1559 } EFI_IFR_GET;
1560
1561 typedef struct _EFI_IFR_READ {
1562   EFI_IFR_OP_HEADER       Header;
1563 } EFI_IFR_READ;
1564
1565 typedef struct _EFI_IFR_WRITE {
1566   EFI_IFR_OP_HEADER      Header;
1567 } EFI_IFR_WRITE;
1568
1569 typedef struct _EFI_IFR_MAP {
1570   EFI_IFR_OP_HEADER      Header;
1571 } EFI_IFR_MAP;
1572 //
1573 // Definitions for Keyboard Package
1574 // Releated definitions are in Section of EFI_HII_DATABASE_PROTOCOL
1575 //
1576
1577 ///
1578 /// Each enumeration values maps a physical key on a keyboard.
1579 ///
1580 typedef enum {
1581   EfiKeyLCtrl,
1582   EfiKeyA0,
1583   EfiKeyLAlt,
1584   EfiKeySpaceBar,
1585   EfiKeyA2,
1586   EfiKeyA3,
1587   EfiKeyA4,
1588   EfiKeyRCtrl,
1589   EfiKeyLeftArrow,
1590   EfiKeyDownArrow,
1591   EfiKeyRightArrow,
1592   EfiKeyZero,
1593   EfiKeyPeriod,
1594   EfiKeyEnter,
1595   EfiKeyLShift,
1596   EfiKeyB0,
1597   EfiKeyB1,
1598   EfiKeyB2,
1599   EfiKeyB3,
1600   EfiKeyB4,
1601   EfiKeyB5,
1602   EfiKeyB6,
1603   EfiKeyB7,
1604   EfiKeyB8,
1605   EfiKeyB9,
1606   EfiKeyB10,
1607   EfiKeyRShift,
1608   EfiKeyUpArrow,
1609   EfiKeyOne,
1610   EfiKeyTwo,
1611   EfiKeyThree,
1612   EfiKeyCapsLock,
1613   EfiKeyC1,
1614   EfiKeyC2,
1615   EfiKeyC3,
1616   EfiKeyC4,
1617   EfiKeyC5,
1618   EfiKeyC6,
1619   EfiKeyC7,
1620   EfiKeyC8,
1621   EfiKeyC9,
1622   EfiKeyC10,
1623   EfiKeyC11,
1624   EfiKeyC12,
1625   EfiKeyFour,
1626   EfiKeyFive,
1627   EfiKeySix,
1628   EfiKeyPlus,
1629   EfiKeyTab,
1630   EfiKeyD1,
1631   EfiKeyD2,
1632   EfiKeyD3,
1633   EfiKeyD4,
1634   EfiKeyD5,
1635   EfiKeyD6,
1636   EfiKeyD7,
1637   EfiKeyD8,
1638   EfiKeyD9,
1639   EfiKeyD10,
1640   EfiKeyD11,
1641   EfiKeyD12,
1642   EfiKeyD13,
1643   EfiKeyDel,
1644   EfiKeyEnd,
1645   EfiKeyPgDn,
1646   EfiKeySeven,
1647   EfiKeyEight,
1648   EfiKeyNine,
1649   EfiKeyE0,
1650   EfiKeyE1,
1651   EfiKeyE2,
1652   EfiKeyE3,
1653   EfiKeyE4,
1654   EfiKeyE5,
1655   EfiKeyE6,
1656   EfiKeyE7,
1657   EfiKeyE8,
1658   EfiKeyE9,
1659   EfiKeyE10,
1660   EfiKeyE11,
1661   EfiKeyE12,
1662   EfiKeyBackSpace,
1663   EfiKeyIns,
1664   EfiKeyHome,
1665   EfiKeyPgUp,
1666   EfiKeyNLck,
1667   EfiKeySlash,
1668   EfiKeyAsterisk,
1669   EfiKeyMinus,
1670   EfiKeyEsc,
1671   EfiKeyF1,
1672   EfiKeyF2,
1673   EfiKeyF3,
1674   EfiKeyF4,
1675   EfiKeyF5,
1676   EfiKeyF6,
1677   EfiKeyF7,
1678   EfiKeyF8,
1679   EfiKeyF9,
1680   EfiKeyF10,
1681   EfiKeyF11,
1682   EfiKeyF12,
1683   EfiKeyPrint,
1684   EfiKeySLck,
1685   EfiKeyPause
1686 } EFI_KEY;
1687
1688 typedef struct {
1689   ///
1690   /// Used to describe a physical key on a keyboard.
1691   ///
1692   EFI_KEY                 Key;
1693   ///
1694   /// Unicode character code for the Key.
1695   ///
1696   CHAR16                  Unicode;
1697   ///
1698   /// Unicode character code for the key with the shift key being held down.
1699   ///
1700   CHAR16                  ShiftedUnicode;
1701   ///
1702   /// Unicode character code for the key with the Alt-GR being held down.
1703   ///
1704   CHAR16                  AltGrUnicode;
1705   ///
1706   /// Unicode character code for the key with the Alt-GR and shift keys being held down.
1707   ///
1708   CHAR16                  ShiftedAltGrUnicode;
1709   ///
1710   /// Modifier keys are defined to allow for special functionality that is not necessarily
1711   /// accomplished by a printable character. Many of these modifier keys are flags to toggle
1712   /// certain state bits on and off inside of a keyboard driver.
1713   ///
1714   UINT16                  Modifier;
1715   UINT16                  AffectedAttribute;
1716 } EFI_KEY_DESCRIPTOR;
1717
1718 ///
1719 /// A key which is affected by all the standard shift modifiers.
1720 /// Most keys would be expected to have this bit active.
1721 ///
1722 #define EFI_AFFECTED_BY_STANDARD_SHIFT       0x0001
1723
1724 ///
1725 /// This key is affected by the caps lock so that if a keyboard driver
1726 /// would need to disambiguate between a key which had a "1" defined
1727 /// versus an "a" character.  Having this bit turned on would tell
1728 /// the keyboard driver to use the appropriate shifted state or not.
1729 ///
1730 #define EFI_AFFECTED_BY_CAPS_LOCK            0x0002
1731
1732 ///
1733 /// Similar to the case of CAPS lock, if this bit is active, the key
1734 /// is affected by the num lock being turned on.
1735 ///
1736 #define EFI_AFFECTED_BY_NUM_LOCK             0x0004
1737
1738 typedef struct {
1739   UINT16                  LayoutLength;
1740   EFI_GUID                Guid;
1741   UINT32                  LayoutDescriptorStringOffset;
1742   UINT8                   DescriptorCount;
1743   // EFI_KEY_DESCRIPTOR    Descriptors[];
1744 } EFI_HII_KEYBOARD_LAYOUT;
1745
1746 typedef struct {
1747   EFI_HII_PACKAGE_HEADER  Header;
1748   UINT16                  LayoutCount;
1749   // EFI_HII_KEYBOARD_LAYOUT Layout[];
1750 } EFI_HII_KEYBOARD_PACKAGE_HDR;
1751
1752 //
1753 // Modifier values
1754 //
1755 #define EFI_NULL_MODIFIER                0x0000
1756 #define EFI_LEFT_CONTROL_MODIFIER        0x0001
1757 #define EFI_RIGHT_CONTROL_MODIFIER       0x0002
1758 #define EFI_LEFT_ALT_MODIFIER            0x0003
1759 #define EFI_RIGHT_ALT_MODIFIER           0x0004
1760 #define EFI_ALT_GR_MODIFIER              0x0005
1761 #define EFI_INSERT_MODIFIER              0x0006
1762 #define EFI_DELETE_MODIFIER              0x0007
1763 #define EFI_PAGE_DOWN_MODIFIER           0x0008
1764 #define EFI_PAGE_UP_MODIFIER             0x0009
1765 #define EFI_HOME_MODIFIER                0x000A
1766 #define EFI_END_MODIFIER                 0x000B
1767 #define EFI_LEFT_SHIFT_MODIFIER          0x000C
1768 #define EFI_RIGHT_SHIFT_MODIFIER         0x000D
1769 #define EFI_CAPS_LOCK_MODIFIER           0x000E
1770 #define EFI_NUM_LOCK_MODIFIER            0x000F
1771 #define EFI_LEFT_ARROW_MODIFIER          0x0010
1772 #define EFI_RIGHT_ARROW_MODIFIER         0x0011
1773 #define EFI_DOWN_ARROW_MODIFIER          0x0012
1774 #define EFI_UP_ARROW_MODIFIER            0x0013
1775 #define EFI_NS_KEY_MODIFIER              0x0014
1776 #define EFI_NS_KEY_DEPENDENCY_MODIFIER   0x0015
1777 #define EFI_FUNCTION_KEY_ONE_MODIFIER    0x0016
1778 #define EFI_FUNCTION_KEY_TWO_MODIFIER    0x0017
1779 #define EFI_FUNCTION_KEY_THREE_MODIFIER  0x0018
1780 #define EFI_FUNCTION_KEY_FOUR_MODIFIER   0x0019
1781 #define EFI_FUNCTION_KEY_FIVE_MODIFIER   0x001A
1782 #define EFI_FUNCTION_KEY_SIX_MODIFIER    0x001B
1783 #define EFI_FUNCTION_KEY_SEVEN_MODIFIER  0x001C
1784 #define EFI_FUNCTION_KEY_EIGHT_MODIFIER  0x001D
1785 #define EFI_FUNCTION_KEY_NINE_MODIFIER   0x001E
1786 #define EFI_FUNCTION_KEY_TEN_MODIFIER    0x001F
1787 #define EFI_FUNCTION_KEY_ELEVEN_MODIFIER 0x0020
1788 #define EFI_FUNCTION_KEY_TWELVE_MODIFIER 0x0021
1789
1790 //
1791 // Keys that have multiple control functions based on modifier
1792 // settings are handled in the keyboard driver implementation.
1793 // For instance, PRINT_KEY might have a modifier held down and
1794 // is still a nonprinting character, but might have an alternate
1795 // control function like SYSREQUEST
1796 //
1797 #define EFI_PRINT_MODIFIER               0x0022
1798 #define EFI_SYS_REQUEST_MODIFIER         0x0023
1799 #define EFI_SCROLL_LOCK_MODIFIER         0x0024
1800 #define EFI_PAUSE_MODIFIER               0x0025
1801 #define EFI_BREAK_MODIFIER               0x0026
1802
1803 #define EFI_LEFT_LOGO_MODIFIER           0x0027
1804 #define EFI_RIGHT_LOGO_MODIFIER          0x0028
1805 #define EFI_MENU_MODIFIER                0x0029
1806
1807 ///
1808 /// Animation IFR opcode
1809 ///
1810 typedef struct _EFI_IFR_ANIMATION {
1811   ///
1812   /// Standard opcode header, where Header.OpCode is
1813   /// EFI_IFR_ANIMATION_OP.
1814   ///
1815   EFI_IFR_OP_HEADER        Header;
1816   ///
1817   /// Animation identifier in the HII database.
1818   ///
1819   EFI_ANIMATION_ID         Id;
1820 } EFI_IFR_ANIMATION;
1821
1822 ///
1823 /// HII animation package header.
1824 ///
1825 typedef struct _EFI_HII_ANIMATION_PACKAGE_HDR {
1826   ///
1827   /// Standard package header, where Header.Type = EFI_HII_PACKAGE_ANIMATIONS.
1828   ///
1829   EFI_HII_PACKAGE_HEADER  Header;
1830   ///
1831   /// Offset, relative to this header, of the animation information. If
1832   /// this is zero, then there are no animation sequences in the package.
1833   ///
1834   UINT32                  AnimationInfoOffset;
1835 } EFI_HII_ANIMATION_PACKAGE_HDR;
1836
1837 ///
1838 /// Animation information is encoded as a series of blocks,
1839 /// with each block prefixed by a single byte header EFI_HII_ANIMATION_BLOCK.
1840 ///
1841 typedef struct _EFI_HII_ANIMATION_BLOCK {
1842   UINT8  BlockType;
1843   //UINT8  BlockBody[];
1844 } EFI_HII_ANIMATION_BLOCK;
1845
1846 ///
1847 /// Animation block types.
1848 ///
1849 #define EFI_HII_AIBT_END                 0x00
1850 #define EFI_HII_AIBT_OVERLAY_IMAGES      0x10
1851 #define EFI_HII_AIBT_CLEAR_IMAGES        0x11
1852 #define EFI_HII_AIBT_RESTORE_SCRN        0x12
1853 #define EFI_HII_AIBT_OVERLAY_IMAGES_LOOP 0x18
1854 #define EFI_HII_AIBT_CLEAR_IMAGES_LOOP   0x19
1855 #define EFI_HII_AIBT_RESTORE_SCRN_LOOP   0x1A
1856 #define EFI_HII_AIBT_DUPLICATE           0x20
1857 #define EFI_HII_AIBT_SKIP2               0x21
1858 #define EFI_HII_AIBT_SKIP1               0x22
1859 #define EFI_HII_AIBT_EXT1                0x30
1860 #define EFI_HII_AIBT_EXT2                0x31
1861 #define EFI_HII_AIBT_EXT4                0x32
1862
1863 ///
1864 /// Extended block headers used for variable sized animation records
1865 /// which need an explicit length.
1866 ///
1867
1868 typedef struct _EFI_HII_AIBT_EXT1_BLOCK  {
1869   ///
1870   /// Standard animation header, where Header.BlockType = EFI_HII_AIBT_EXT1.
1871   ///
1872   EFI_HII_ANIMATION_BLOCK  Header;
1873   ///
1874   /// The block type.
1875   ///
1876   UINT8                    BlockType2;
1877   ///
1878   /// Size of the animation block, in bytes, including the animation block header.
1879   ///
1880   UINT8                    Length;
1881 } EFI_HII_AIBT_EXT1_BLOCK;
1882
1883 typedef struct _EFI_HII_AIBT_EXT2_BLOCK {
1884   ///
1885   /// Standard animation header, where Header.BlockType = EFI_HII_AIBT_EXT2.
1886   ///
1887   EFI_HII_ANIMATION_BLOCK  Header;
1888   ///
1889   /// The block type
1890   ///
1891   UINT8                    BlockType2;
1892   ///
1893   /// Size of the animation block, in bytes, including the animation block header.
1894   ///
1895   UINT16                   Length;
1896 } EFI_HII_AIBT_EXT2_BLOCK;
1897
1898 typedef struct _EFI_HII_AIBT_EXT4_BLOCK {
1899   ///
1900   /// Standard animation header, where Header.BlockType = EFI_HII_AIBT_EXT4.
1901   ///
1902   EFI_HII_ANIMATION_BLOCK  Header;
1903   ///
1904   /// The block type
1905   ///
1906   UINT8                    BlockType2;
1907   ///
1908   /// Size of the animation block, in bytes, including the animation block header.
1909   ///
1910   UINT32                   Length;
1911 } EFI_HII_AIBT_EXT4_BLOCK;
1912
1913 typedef struct _EFI_HII_ANIMATION_CELL {
1914   ///
1915   /// The X offset from the upper left hand corner of the logical
1916   /// window to position the indexed image.
1917   ///
1918   UINT16                    OffsetX;
1919   ///
1920   /// The Y offset from the upper left hand corner of the logical
1921   /// window to position the indexed image.
1922   ///
1923   UINT16                    OffsetY;
1924   ///
1925   /// The image to display at the specified offset from the upper left
1926   /// hand corner of the logical window.
1927   ///
1928   EFI_IMAGE_ID              ImageId;
1929   ///
1930   /// The number of milliseconds to delay after displaying the indexed
1931   /// image and before continuing on to the next linked image.  If value
1932   /// is zero, no delay.
1933   ///
1934   UINT16                    Delay;
1935 } EFI_HII_ANIMATION_CELL;
1936
1937 ///
1938 /// An animation block to describe an animation sequence that does not cycle, and
1939 /// where one image is simply displayed over the previous image.
1940 ///
1941 typedef struct _EFI_HII_AIBT_OVERLAY_IMAGES_BLOCK {
1942   ///
1943   /// This is image that is to be reference by the image protocols, if the
1944   /// animation function is not supported or disabled. This image can
1945   /// be one particular image from the animation sequence (if any one
1946   /// of the animation frames has a complete image) or an alternate
1947   /// image that can be displayed alone. If the value is zero, no image
1948   /// is displayed.
1949   ///
1950   EFI_IMAGE_ID            DftImageId;
1951   ///
1952   /// The overall width of the set of images (logical window width).
1953   ///
1954   UINT16                  Width;
1955   ///
1956   /// The overall height of the set of images (logical window height).
1957   ///
1958   UINT16                  Height;
1959   ///
1960   /// The number of EFI_HII_ANIMATION_CELL contained in the
1961   /// animation sequence.
1962   ///
1963   UINT16                  CellCount;
1964   ///
1965   /// An array of CellCount animation cells.
1966   ///
1967   EFI_HII_ANIMATION_CELL  AnimationCell[1];
1968 } EFI_HII_AIBT_OVERLAY_IMAGES_BLOCK;
1969
1970 ///
1971 /// An animation block to describe an animation sequence that does not cycle,
1972 /// and where the logical window is cleared to the specified color before
1973 /// the next image is displayed.
1974 ///
1975 typedef struct _EFI_HII_AIBT_CLEAR_IMAGES_BLOCK {
1976   ///
1977   /// This is image that is to be reference by the image protocols, if the
1978   /// animation function is not supported or disabled. This image can
1979   /// be one particular image from the animation sequence (if any one
1980   /// of the animation frames has a complete image) or an alternate
1981   /// image that can be displayed alone. If the value is zero, no image
1982   /// is displayed.
1983   ///
1984   EFI_IMAGE_ID       DftImageId;
1985   ///
1986   /// The overall width of the set of images (logical window width).
1987   ///
1988   UINT16             Width;
1989   ///
1990   /// The overall height of the set of images (logical window height).
1991   ///
1992   UINT16             Height;
1993   ///
1994   /// The number of EFI_HII_ANIMATION_CELL contained in the
1995   /// animation sequence.
1996   ///
1997   UINT16             CellCount;
1998   ///
1999   /// The color to clear the logical window to before displaying the
2000   /// indexed image.
2001   ///
2002   EFI_HII_RGB_PIXEL  BackgndColor;
2003   ///
2004   /// An array of CellCount animation cells.
2005   ///
2006   EFI_HII_ANIMATION_CELL AnimationCell[1];
2007 } EFI_HII_AIBT_CLEAR_IMAGES_BLOCK;
2008
2009 ///
2010 /// An animation block to describe an animation sequence that does not cycle,
2011 /// and where the screen is restored to the original state before the next
2012 /// image is displayed.
2013 ///
2014 typedef struct _EFI_HII_AIBT_RESTORE_SCRN_BLOCK {
2015   ///
2016   /// This is image that is to be reference by the image protocols, if the
2017   /// animation function is not supported or disabled. This image can
2018   /// be one particular image from the animation sequence (if any one
2019   /// of the animation frames has a complete image) or an alternate
2020   /// image that can be displayed alone. If the value is zero, no image
2021   /// is displayed.
2022   ///
2023   EFI_IMAGE_ID            DftImageId;
2024   ///
2025   /// The overall width of the set of images (logical window width).
2026   ///
2027   UINT16                  Width;
2028   ///
2029   /// The overall height of the set of images (logical window height).
2030   ///
2031   UINT16                  Height;
2032   ///
2033   /// The number of EFI_HII_ANIMATION_CELL contained in the
2034   /// animation sequence.
2035   ///
2036   UINT16                  CellCount;
2037   ///
2038   /// An array of CellCount animation cells.
2039   ///
2040   EFI_HII_ANIMATION_CELL  AnimationCell[1];
2041 } EFI_HII_AIBT_RESTORE_SCRN_BLOCK;
2042
2043 ///
2044 /// An animation block to describe an animation sequence that continuously cycles,
2045 /// and where one image is simply displayed over the previous image.
2046 ///
2047 typedef EFI_HII_AIBT_OVERLAY_IMAGES_BLOCK  EFI_HII_AIBT_OVERLAY_IMAGES_LOOP_BLOCK;
2048
2049 ///
2050 /// An animation block to describe an animation sequence that continuously cycles,
2051 /// and where the logical window is cleared to the specified color before
2052 /// the next image is displayed.
2053 ///
2054 typedef EFI_HII_AIBT_CLEAR_IMAGES_BLOCK    EFI_HII_AIBT_CLEAR_IMAGES_LOOP_BLOCK;
2055
2056 ///
2057 /// An animation block to describe an animation sequence that continuously cycles,
2058 /// and where the screen is restored to the original state before
2059 /// the next image is displayed.
2060 ///
2061 typedef EFI_HII_AIBT_RESTORE_SCRN_BLOCK    EFI_HII_AIBT_RESTORE_SCRN_LOOP_BLOCK;
2062
2063 ///
2064 /// Assigns a new character value to a previously defined animation sequence.
2065 ///
2066 typedef struct _EFI_HII_AIBT_DUPLICATE_BLOCK {
2067   ///
2068   /// The previously defined animation ID with the exact same
2069   /// animation information.
2070   ///
2071   EFI_ANIMATION_ID  AnimationId;
2072 } EFI_HII_AIBT_DUPLICATE_BLOCK;
2073
2074 ///
2075 /// Skips animation IDs.
2076 ///
2077 typedef struct _EFI_HII_AIBT_SKIP1_BLOCK {
2078   ///
2079   /// The unsigned 8-bit value to add to AnimationIdCurrent.
2080   ///
2081   UINT8  SkipCount;
2082 } EFI_HII_AIBT_SKIP1_BLOCK;
2083
2084 ///
2085 /// Skips animation IDs.
2086 ///
2087 typedef struct _EFI_HII_AIBT_SKIP2_BLOCK {
2088   ///
2089   /// The unsigned 16-bit value to add to AnimationIdCurrent.
2090   ///
2091   UINT16  SkipCount;
2092 } EFI_HII_AIBT_SKIP2_BLOCK;
2093
2094 #pragma pack()
2095
2096
2097
2098 ///
2099 /// References to string tokens must use this macro to enable scanning for
2100 /// token usages.
2101 ///
2102 ///
2103 /// STRING_TOKEN is not defined in UEFI specification. But it is placed
2104 /// here for the easy access by C files and VFR source files.
2105 ///
2106 #define STRING_TOKEN(t) t
2107
2108 #endif