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