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