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