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