• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 - 2008, Intel Corporation
7   All rights reserved. This program and the accompanying materials
8   are licensed and made available under the terms and conditions of the BSD License
9   which accompanies this distribution.  The full text of the license may be found at
10   http://opensource.org/licenses/bsd-license.php
11 
12   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 
15   @par Revision Reference:
16   These definitions are from UEFI2.1.
17 
18 **/
19 
20 #ifndef __UEFI_INTERNAL_FORMREPRESENTATION_H__
21 #define __UEFI_INTERNAL_FORMREPRESENTATION_H__
22 
23 ///
24 /// The following types are currently defined:
25 ///
26 typedef VOID*   EFI_HII_HANDLE;
27 typedef CHAR16* EFI_STRING;
28 typedef UINT16  EFI_IMAGE_ID;
29 typedef UINT16  EFI_QUESTION_ID;
30 typedef UINT16  EFI_STRING_ID;
31 typedef UINT16  EFI_FORM_ID;
32 typedef UINT16  EFI_VARSTORE_ID;
33 
34 typedef UINT16  EFI_DEFAULT_ID;
35 
36 typedef UINT32  EFI_HII_FONT_STYLE;
37 
38 
39 
40 #pragma pack(1)
41 
42 //
43 // Definitions for Package Lists and Package Headers
44 // Section 27.3.1
45 //
46 
47 ///
48 /// The header found at the start of each package list.
49 ///
50 typedef struct {
51   EFI_GUID               PackageListGuid;
52   UINT32                 PackageLength;
53 } EFI_HII_PACKAGE_LIST_HEADER;
54 
55 ///
56 /// The header found at the start of each package.
57 ///
58 typedef struct {
59   UINT32  Length:24;
60   UINT32  Type:8;
61   // UINT8  Data[...];
62 } EFI_HII_PACKAGE_HEADER;
63 
64 //
65 // Value of HII package type
66 //
67 #define EFI_HII_PACKAGE_TYPE_ALL             0x00
68 #define EFI_HII_PACKAGE_TYPE_GUID            0x01
69 #define EFI_HII_PACKAGE_FORMS                0x02
70 #define EFI_HII_PACKAGE_STRINGS              0x04
71 #define EFI_HII_PACKAGE_FONTS                0x05
72 #define EFI_HII_PACKAGE_IMAGES               0x06
73 #define EFI_HII_PACKAGE_SIMPLE_FONTS         0x07
74 #define EFI_HII_PACKAGE_DEVICE_PATH          0x08
75 #define EFI_HII_PACKAGE_KEYBOARD_LAYOUT      0x09
76 #define EFI_HII_PACKAGE_END                  0xDF
77 #define EFI_HII_PACKAGE_TYPE_SYSTEM_BEGIN    0xE0
78 #define EFI_HII_PACKAGE_TYPE_SYSTEM_END      0xFF
79 
80 //
81 // Definitions for Simplified Font Package
82 // Section 27.3.2
83 //
84 
85 //
86 // Contents of EFI_NARROW_GLYPH.Attributes
87 //
88 #define EFI_GLYPH_NON_SPACING                0x01
89 #define EFI_GLYPH_WIDE                       0x02
90 #define EFI_GLYPH_HEIGHT                     19
91 #define EFI_GLYPH_WIDTH                      8
92 
93 typedef struct {
94   CHAR16                 UnicodeWeight;
95   UINT8                  Attributes;
96   UINT8                  GlyphCol1[EFI_GLYPH_HEIGHT];
97 } EFI_NARROW_GLYPH;
98 
99 typedef struct {
100   CHAR16                 UnicodeWeight;
101   UINT8                  Attributes;
102   UINT8                  GlyphCol1[EFI_GLYPH_HEIGHT];
103   UINT8                  GlyphCol2[EFI_GLYPH_HEIGHT];
104   UINT8                  Pad[3];
105 } EFI_WIDE_GLYPH;
106 
107 ///
108 /// A simplified font package consists of a font header
109 /// followed by a series of glyph structures.
110 ///
111 typedef struct _EFI_HII_SIMPLE_FONT_PACKAGE_HDR {
112   EFI_HII_PACKAGE_HEADER Header;
113   UINT16                 NumberOfNarrowGlyphs;
114   UINT16                 NumberOfWideGlyphs;
115   // EFI_NARROW_GLYPH       NarrowGlyphs[];
116   // EFI_WIDE_GLYPH         WideGlyphs[];
117 } EFI_HII_SIMPLE_FONT_PACKAGE_HDR;
118 
119 //
120 // Definitions for Font Package
121 // Section 27.3.3
122 //
123 
124 //
125 // Value for font style
126 //
127 #define EFI_HII_FONT_STYLE_NORMAL            0x00000000
128 #define EFI_HII_FONT_STYLE_BOLD              0x00000001
129 #define EFI_HII_FONT_STYLE_ITALIC            0x00000002
130 #define EFI_HII_FONT_STYLE_EMBOSS            0x00010000
131 #define EFI_HII_FONT_STYLE_OUTLINE           0x00020000
132 #define EFI_HII_FONT_STYLE_SHADOW            0x00040000
133 #define EFI_HII_FONT_STYLE_UNDERLINE         0x00080000
134 #define EFI_HII_FONT_STYLE_DBL_UNDER         0x00100000
135 
136 typedef struct _EFI_HII_GLYPH_INFO {
137   UINT16                 Width;
138   UINT16                 Height;
139   INT16                  OffsetX;
140   INT16                  OffsetY;
141   INT16                  AdvanceX;
142 } EFI_HII_GLYPH_INFO;
143 
144 ///
145 /// The fixed header consists of a standard record header and
146 /// then the character values in this section, the flags
147 /// (including the encoding method) and the offsets of the glyph
148 /// information, the glyph bitmaps and the character map.
149 ///
150 typedef struct _EFI_HII_FONT_PACKAGE_HDR {
151   EFI_HII_PACKAGE_HEADER Header;
152   UINT32                 HdrSize;
153   UINT32                 GlyphBlockOffset;
154   EFI_HII_GLYPH_INFO     Cell;
155   EFI_HII_FONT_STYLE     FontStyle;
156   CHAR16                 FontFamily[1];
157 } EFI_HII_FONT_PACKAGE_HDR;
158 
159 //
160 // Value of different glyph info block types
161 //
162 #define EFI_HII_GIBT_END                  0x00
163 #define EFI_HII_GIBT_GLYPH                0x10
164 #define EFI_HII_GIBT_GLYPHS               0x11
165 #define EFI_HII_GIBT_GLYPH_DEFAULT        0x12
166 #define EFI_HII_GIBT_GLYPHS_DEFAULT       0x13
167 #define EFI_HII_GIBT_DUPLICATE            0x20
168 #define EFI_HII_GIBT_SKIP2                0x21
169 #define EFI_HII_GIBT_SKIP1                0x22
170 #define EFI_HII_GIBT_DEFAULTS             0x23
171 #define EFI_HII_GIBT_EXT1                 0x30
172 #define EFI_HII_GIBT_EXT2                 0x31
173 #define EFI_HII_GIBT_EXT4                 0x32
174 
175 typedef struct _EFI_HII_GLYPH_BLOCK {
176   UINT8                  BlockType;
177 } EFI_HII_GLYPH_BLOCK;
178 
179 //
180 // Definition of different glyph info block types
181 //
182 
183 typedef struct _EFI_HII_GIBT_DEFAULTS_BLOCK {
184   EFI_HII_GLYPH_BLOCK    Header;
185   EFI_HII_GLYPH_INFO     Cell;
186 } EFI_HII_GIBT_DEFAULTS_BLOCK;
187 
188 typedef struct _EFI_HII_GIBT_DUPLICATE_BLOCK {
189   EFI_HII_GLYPH_BLOCK    Header;
190   CHAR16                 CharValue;
191 } EFI_HII_GIBT_DUPLICATE_BLOCK;
192 
193 typedef struct _EFI_GLYPH_GIBT_END_BLOCK {
194   EFI_HII_GLYPH_BLOCK    Header;
195 } EFI_GLYPH_GIBT_END_BLOCK;
196 
197 typedef struct _EFI_HII_GIBT_EXT1_BLOCK {
198   EFI_HII_GLYPH_BLOCK    Header;
199   UINT8                  BlockType2;
200   UINT8                  Length;
201 } EFI_HII_GIBT_EXT1_BLOCK;
202 
203 typedef struct _EFI_HII_GIBT_EXT2_BLOCK {
204   EFI_HII_GLYPH_BLOCK    Header;
205   UINT8                  BlockType2;
206   UINT16                 Length;
207 } EFI_HII_GIBT_EXT2_BLOCK;
208 
209 typedef struct _EFI_HII_GIBT_EXT4_BLOCK {
210   EFI_HII_GLYPH_BLOCK    Header;
211   UINT8                  BlockType2;
212   UINT32                 Length;
213 } EFI_HII_GIBT_EXT4_BLOCK;
214 
215 typedef struct _EFI_HII_GIBT_GLYPH_BLOCK {
216   EFI_HII_GLYPH_BLOCK    Header;
217   EFI_HII_GLYPH_INFO     Cell;
218   UINT8                  BitmapData[1];
219 } EFI_HII_GIBT_GLYPH_BLOCK;
220 
221 typedef struct _EFI_HII_GIBT_GLYPHS_BLOCK {
222   EFI_HII_GLYPH_BLOCK    Header;
223   EFI_HII_GLYPH_INFO     Cell;
224   UINT16                 Count;
225   UINT8                  BitmapData[1];
226 } EFI_HII_GIBT_GLYPHS_BLOCK;
227 
228 typedef struct _EFI_HII_GIBT_GLYPH_DEFAULT_BLOCK {
229   EFI_HII_GLYPH_BLOCK    Header;
230   UINT8                  BitmapData[1];
231 } EFI_HII_GIBT_GLYPH_DEFAULT_BLOCK;
232 
233 typedef struct _EFI_HII_GIBT_GLYPHS_DEFAULT_BLOCK {
234   EFI_HII_GLYPH_BLOCK    Header;
235   UINT16                 Count;
236   UINT8                  BitmapData[1];
237 } EFI_HII_GIBT_GLYPHS_DEFAULT_BLOCK;
238 
239 typedef struct _EFI_HII_GIBT_SKIP1_BLOCK {
240   EFI_HII_GLYPH_BLOCK    Header;
241   UINT8                  SkipCount;
242 } EFI_HII_GIBT_SKIP1_BLOCK;
243 
244 typedef struct _EFI_HII_GIBT_SKIP2_BLOCK {
245   EFI_HII_GLYPH_BLOCK    Header;
246   UINT16                 SkipCount;
247 } EFI_HII_GIBT_SKIP2_BLOCK;
248 
249 //
250 // Definitions for Device Path Package
251 // Section 27.3.4
252 //
253 
254 ///
255 /// The device path package is used to carry a device path
256 /// associated with the package list.
257 ///
258 typedef struct _EFI_HII_DEVICE_PATH_PACKAGE {
259   EFI_HII_PACKAGE_HEADER   Header;
260   // EFI_DEVICE_PATH_PROTOCOL DevicePath[];
261 } EFI_HII_DEVICE_PATH_PACKAGE;
262 
263 //
264 // Definitions for GUID Package
265 // Section 27.3.5
266 //
267 
268 ///
269 /// The GUID package is used to carry data where the format is defined by a GUID.
270 ///
271 typedef struct _EFI_HII_GUID_PACKAGE_HDR {
272   EFI_HII_PACKAGE_HEADER  Header;
273   EFI_GUID                Guid;
274   // Data per GUID definition may follow
275 } EFI_HII_GUID_PACKAGE_HDR;
276 
277 //
278 // Definitions for String Package
279 // Section 27.3.6
280 //
281 
282 #define UEFI_CONFIG_LANG  L"x-UEFI"
283 #define UEFI_CONFIG_LANG2 L"x-i-UEFI"
284 
285 ///
286 /// The fixed header consists of a standard record header and then the string identifiers
287 /// contained in this section and the offsets of the string and language information.
288 ///
289 typedef struct _EFI_HII_STRING_PACKAGE_HDR {
290   EFI_HII_PACKAGE_HEADER  Header;
291   UINT32                  HdrSize;
292   UINT32                  StringInfoOffset;
293   CHAR16                  LanguageWindow[16];
294   EFI_STRING_ID           LanguageName;
295   CHAR8                   Language[1];
296 } EFI_HII_STRING_PACKAGE_HDR;
297 
298 typedef struct {
299   UINT8                   BlockType;
300 } EFI_HII_STRING_BLOCK;
301 
302 //
303 // Value of different string information block types
304 //
305 #define EFI_HII_SIBT_END                     0x00
306 #define EFI_HII_SIBT_STRING_SCSU             0x10
307 #define EFI_HII_SIBT_STRING_SCSU_FONT        0x11
308 #define EFI_HII_SIBT_STRINGS_SCSU            0x12
309 #define EFI_HII_SIBT_STRINGS_SCSU_FONT       0x13
310 #define EFI_HII_SIBT_STRING_UCS2             0x14
311 #define EFI_HII_SIBT_STRING_UCS2_FONT        0x15
312 #define EFI_HII_SIBT_STRINGS_UCS2            0x16
313 #define EFI_HII_SIBT_STRINGS_UCS2_FONT       0x17
314 #define EFI_HII_SIBT_DUPLICATE               0x20
315 #define EFI_HII_SIBT_SKIP2                   0x21
316 #define EFI_HII_SIBT_SKIP1                   0x22
317 #define EFI_HII_SIBT_EXT1                    0x30
318 #define EFI_HII_SIBT_EXT2                    0x31
319 #define EFI_HII_SIBT_EXT4                    0x32
320 #define EFI_HII_SIBT_FONT                    0x40
321 
322 //
323 // Definition of different string information block types
324 //
325 
326 typedef struct _EFI_HII_SIBT_DUPLICATE_BLOCK {
327   EFI_HII_STRING_BLOCK    Header;
328   EFI_STRING_ID           StringId;
329 } EFI_HII_SIBT_DUPLICATE_BLOCK;
330 
331 typedef struct _EFI_HII_SIBT_END_BLOCK {
332   EFI_HII_STRING_BLOCK    Header;
333 } EFI_HII_SIBT_END_BLOCK;
334 
335 typedef struct _EFI_HII_SIBT_EXT1_BLOCK {
336   EFI_HII_STRING_BLOCK    Header;
337   UINT8                   BlockType2;
338   UINT8                   Length;
339 } EFI_HII_SIBT_EXT1_BLOCK;
340 
341 typedef struct _EFI_HII_SIBT_EXT2_BLOCK {
342   EFI_HII_STRING_BLOCK    Header;
343   UINT8                   BlockType2;
344   UINT16                  Length;
345 } EFI_HII_SIBT_EXT2_BLOCK;
346 
347 typedef struct _EFI_HII_SIBT_EXT4_BLOCK {
348   EFI_HII_STRING_BLOCK    Header;
349   UINT8                   BlockType2;
350   UINT32                  Length;
351 } EFI_HII_SIBT_EXT4_BLOCK;
352 
353 typedef struct _EFI_HII_SIBT_FONT_BLOCK {
354   EFI_HII_SIBT_EXT2_BLOCK Header;
355   UINT8                   FontId;
356   UINT16                  FontSize;
357   EFI_HII_FONT_STYLE      FontStyle;
358   CHAR16                  FontName[1];
359 } EFI_HII_SIBT_FONT_BLOCK;
360 
361 typedef struct _EFI_HII_SIBT_SKIP1_BLOCK {
362   EFI_HII_STRING_BLOCK    Header;
363   UINT8                   SkipCount;
364 } EFI_HII_SIBT_SKIP1_BLOCK;
365 
366 typedef struct _EFI_HII_SIBT_SKIP2_BLOCK {
367   EFI_HII_STRING_BLOCK    Header;
368   UINT16                  SkipCount;
369 } EFI_HII_SIBT_SKIP2_BLOCK;
370 
371 typedef struct _EFI_HII_SIBT_STRING_SCSU_BLOCK {
372   EFI_HII_STRING_BLOCK    Header;
373   UINT8                   StringText[1];
374 } EFI_HII_SIBT_STRING_SCSU_BLOCK;
375 
376 typedef struct _EFI_HII_SIBT_STRING_SCSU_FONT_BLOCK {
377   EFI_HII_STRING_BLOCK    Header;
378   UINT8                   FontIdentifier;
379   UINT8                   StringText[1];
380 } EFI_HII_SIBT_STRING_SCSU_FONT_BLOCK;
381 
382 typedef struct _EFI_HII_SIBT_STRINGS_SCSU_BLOCK {
383   EFI_HII_STRING_BLOCK    Header;
384   UINT16                  StringCount;
385   UINT8                   StringText[1];
386 } EFI_HII_SIBT_STRINGS_SCSU_BLOCK;
387 
388 typedef struct _EFI_HII_SIBT_STRINGS_SCSU_FONT_BLOCK {
389   EFI_HII_STRING_BLOCK    Header;
390   UINT8                   FontIdentifier;
391   UINT16                  StringCount;
392   UINT8                   StringText[1];
393 } EFI_HII_SIBT_STRINGS_SCSU_FONT_BLOCK;
394 
395 typedef struct _EFI_HII_SIBT_STRING_UCS2_BLOCK {
396   EFI_HII_STRING_BLOCK    Header;
397   CHAR16                  StringText[1];
398 } EFI_HII_SIBT_STRING_UCS2_BLOCK;
399 
400 typedef struct _EFI_HII_SIBT_STRING_UCS2_FONT_BLOCK {
401   EFI_HII_STRING_BLOCK    Header;
402   UINT8                   FontIdentifier;
403   CHAR16                  StringText[1];
404 } EFI_HII_SIBT_STRING_UCS2_FONT_BLOCK;
405 
406 typedef struct _EFI_HII_SIBT_STRINGS_UCS2_BLOCK {
407   EFI_HII_STRING_BLOCK    Header;
408   UINT16                  StringCount;
409   CHAR16                  StringText[1];
410 } EFI_HII_SIBT_STRINGS_UCS2_BLOCK;
411 
412 typedef struct _EFI_HII_SIBT_STRINGS_UCS2_FONT_BLOCK {
413   EFI_HII_STRING_BLOCK    Header;
414   UINT8                   FontIdentifier;
415   UINT16                  StringCount;
416   CHAR16                  StringText[1];
417 } EFI_HII_SIBT_STRINGS_UCS2_FONT_BLOCK;
418 
419 //
420 // Definitions for Image Package
421 // Section 27.3.7
422 //
423 
424 typedef struct _EFI_HII_IMAGE_PACKAGE_HDR {
425   EFI_HII_PACKAGE_HEADER  Header;
426   UINT32                  ImageInfoOffset;
427   UINT32                  PaletteInfoOffset;
428 } EFI_HII_IMAGE_PACKAGE_HDR;
429 
430 typedef struct _EFI_HII_IMAGE_BLOCK {
431   UINT8                   BlockType;
432 } EFI_HII_IMAGE_BLOCK;
433 
434 //
435 // Value of different image information block types
436 //
437 #define EFI_HII_IIBT_END               0x00
438 #define EFI_HII_IIBT_IMAGE_1BIT        0x10
439 #define EFI_HII_IIBT_IMAGE_1BIT_TRANS  0x11
440 #define EFI_HII_IIBT_IMAGE_4BIT        0x12
441 #define EFI_HII_IIBT_IMAGE_4BIT_TRANS  0x13
442 #define EFI_HII_IIBT_IMAGE_8BIT        0x14
443 #define EFI_HII_IIBT_IMAGE_8BIT_TRANS  0x15
444 #define EFI_HII_IIBT_IMAGE_24BIT       0x16
445 #define EFI_HII_IIBT_IMAGE_24BIT_TRANS 0x17
446 #define EFI_HII_IIBT_IMAGE_JPEG        0x18
447 #define EFI_HII_IIBT_DUPLICATE         0x20
448 #define EFI_HII_IIBT_SKIP2             0x21
449 #define EFI_HII_IIBT_SKIP1             0x22
450 #define EFI_HII_IIBT_EXT1              0x30
451 #define EFI_HII_IIBT_EXT2              0x31
452 #define EFI_HII_IIBT_EXT4              0x32
453 
454 //
455 // Definition of different image information block types
456 //
457 
458 typedef struct _EFI_HII_IIBT_END_BLOCK {
459   EFI_HII_IMAGE_BLOCK          Header;
460 } EFI_HII_IIBT_END_BLOCK;
461 
462 typedef struct _EFI_HII_IIBT_EXT1_BLOCK {
463   EFI_HII_IMAGE_BLOCK          Header;
464   UINT8                        BlockType2;
465   UINT8                        Length;
466 } EFI_HII_IIBT_EXT1_BLOCK;
467 
468 typedef struct _EFI_HII_IIBT_EXT2_BLOCK {
469   EFI_HII_IMAGE_BLOCK          Header;
470   UINT8                        BlockType2;
471   UINT16                       Length;
472 } EFI_HII_IIBT_EXT2_BLOCK;
473 
474 typedef struct _EFI_HII_IIBT_EXT4_BLOCK {
475   EFI_HII_IMAGE_BLOCK          Header;
476   UINT8                        BlockType2;
477   UINT32                       Length;
478 } EFI_HII_IIBT_EXT4_BLOCK;
479 
480 typedef struct _EFI_HII_IIBT_IMAGE_1BIT_BASE {
481   UINT16                       Width;
482   UINT16                       Height;
483   UINT8                        Data[1];
484 } EFI_HII_IIBT_IMAGE_1BIT_BASE;
485 
486 typedef struct _EFI_HII_IIBT_IMAGE_1BIT_BLOCK {
487   EFI_HII_IMAGE_BLOCK          Header;
488   UINT8                        PaletteIndex;
489   EFI_HII_IIBT_IMAGE_1BIT_BASE Bitmap;
490 } EFI_HII_IIBT_IMAGE_1BIT_BLOCK;
491 
492 typedef struct _EFI_HII_IIBT_IMAGE_1BIT_TRANS_BLOCK {
493   EFI_HII_IMAGE_BLOCK          Header;
494   UINT8                        PaletteIndex;
495   EFI_HII_IIBT_IMAGE_1BIT_BASE Bitmap;
496 } EFI_HII_IIBT_IMAGE_1BIT_TRANS_BLOCK;
497 
498 typedef struct _EFI_HII_RGB_PIXEL {
499   UINT8                        b;
500   UINT8                        g;
501   UINT8                        r;
502 } EFI_HII_RGB_PIXEL;
503 
504 typedef struct _EFI_HII_IIBT_IMAGE_24BIT_BASE {
505   UINT16                       Width;
506   UINT16                       Height;
507   EFI_HII_RGB_PIXEL            Bitmap[1];
508 } EFI_HII_IIBT_IMAGE_24BIT_BASE;
509 
510 typedef struct _EFI_HII_IIBT_IMAGE_24BIT_BLOCK {
511   EFI_HII_IMAGE_BLOCK           Header;
512   EFI_HII_IIBT_IMAGE_24BIT_BASE Bitmap;
513 } EFI_HII_IIBT_IMAGE_24BIT_BLOCK;
514 
515 typedef struct _EFI_HII_IIBT_IMAGE_24BIT_TRANS_BLOCK {
516   EFI_HII_IMAGE_BLOCK           Header;
517   EFI_HII_IIBT_IMAGE_24BIT_BASE Bitmap;
518 } EFI_HII_IIBT_IMAGE_24BIT_TRANS_BLOCK;
519 
520 typedef struct _EFI_HII_IIBT_IMAGE_4BIT_BASE {
521   UINT16                       Width;
522   UINT16                       Height;
523   UINT8                        Data[1];
524 } EFI_HII_IIBT_IMAGE_4BIT_BASE;
525 
526 typedef struct _EFI_HII_IIBT_IMAGE_4BIT_BLOCK {
527   EFI_HII_IMAGE_BLOCK          Header;
528   UINT8                        PaletteIndex;
529   EFI_HII_IIBT_IMAGE_4BIT_BASE Bitmap;
530 } EFI_HII_IIBT_IMAGE_4BIT_BLOCK;
531 
532 typedef struct _EFI_HII_IIBT_IMAGE_4BIT_TRANS_BLOCK {
533   EFI_HII_IMAGE_BLOCK          Header;
534   UINT8                        PaletteIndex;
535   EFI_HII_IIBT_IMAGE_4BIT_BASE Bitmap;
536 } EFI_HII_IIBT_IMAGE_4BIT_TRANS_BLOCK;
537 
538 typedef struct _EFI_HII_IIBT_IMAGE_8BIT_BASE {
539   UINT16                       Width;
540   UINT16                       Height;
541   UINT8                        Data[1];
542 } EFI_HII_IIBT_IMAGE_8BIT_BASE;
543 
544 typedef struct _EFI_HII_IIBT_IMAGE_8BIT_PALETTE_BLOCK {
545   EFI_HII_IMAGE_BLOCK          Header;
546   UINT8                        PaletteIndex;
547   EFI_HII_IIBT_IMAGE_8BIT_BASE Bitmap;
548 } EFI_HII_IIBT_IMAGE_8BIT_BLOCK;
549 
550 typedef struct _EFI_HII_IIBT_IMAGE_8BIT_TRANS_BLOCK {
551   EFI_HII_IMAGE_BLOCK          Header;
552   UINT8                        PaletteIndex;
553   EFI_HII_IIBT_IMAGE_8BIT_BASE Bitmap;
554 } EFI_HII_IIBT_IMAGE_8BIT_TRAN_BLOCK;
555 
556 typedef struct _EFI_HII_IIBT_DUPLICATE_BLOCK {
557   EFI_HII_IMAGE_BLOCK          Header;
558   EFI_IMAGE_ID                 ImageId;
559 } EFI_HII_IIBT_DUPLICATE_BLOCK;
560 
561 typedef struct _EFI_HII_IIBT_JPEG_BLOCK {
562   EFI_HII_IMAGE_BLOCK          Header;
563   UINT32                       Size;
564   UINT8                        Data[1];
565 } EFI_HII_IIBT_JPEG_BLOCK;
566 
567 typedef struct _EFI_HII_IIBT_SKIP1_BLOCK {
568   EFI_HII_IMAGE_BLOCK          Header;
569   UINT8                        SkipCount;
570 } EFI_HII_IIBT_SKIP1_BLOCK;
571 
572 typedef struct _EFI_HII_IIBT_SKIP2_BLOCK {
573   EFI_HII_IMAGE_BLOCK          Header;
574   UINT16                       SkipCount;
575 } EFI_HII_IIBT_SKIP2_BLOCK;
576 
577 //
578 // Definitions for Palette Information
579 //
580 
581 typedef struct _EFI_HII_IMAGE_PALETTE_INFO_HEADER {
582   UINT16                       PaletteCount;
583 } EFI_HII_IMAGE_PALETTE_INFO_HEADER;
584 
585 typedef struct _EFI_HII_IMAGE_PALETTE_INFO {
586   UINT16                       PaletteSize;
587   EFI_HII_RGB_PIXEL            PaletteValue[1];
588 } EFI_HII_IMAGE_PALETTE_INFO;
589 
590 //
591 // Definitions for Forms Package
592 // Section 27.3.8
593 //
594 
595 ///
596 /// The Forms package is used to carry forms-based encoding data.
597 ///
598 typedef struct _EFI_HII_FORM_PACKAGE {
599   EFI_HII_PACKAGE_HEADER       Header;
600   // EFI_IFR_OP_HEADER         OpCodeHeader;
601   // More op-codes follow
602 } EFI_HII_FORM_PACKAGE;
603 
604 typedef struct {
605   UINT8 Hour;
606   UINT8 Minute;
607   UINT8 Second;
608 } EFI_HII_TIME;
609 
610 typedef struct {
611   UINT16 Year;
612   UINT8  Month;
613   UINT8  Day;
614 } EFI_HII_DATE;
615 
616 typedef union {
617   UINT8           u8;
618   UINT16          u16;
619   UINT32          u32;
620   UINT64          u64;
621   BOOLEAN         b;
622   EFI_HII_TIME    time;
623   EFI_HII_DATE    date;
624   EFI_STRING_ID   string;
625 } EFI_IFR_TYPE_VALUE;
626 
627 //
628 // IFR Opcodes
629 //
630 #define EFI_IFR_FORM_OP                0x01
631 #define EFI_IFR_SUBTITLE_OP            0x02
632 #define EFI_IFR_TEXT_OP                0x03
633 #define EFI_IFR_IMAGE_OP               0x04
634 #define EFI_IFR_ONE_OF_OP              0x05
635 #define EFI_IFR_CHECKBOX_OP            0x06
636 #define EFI_IFR_NUMERIC_OP             0x07
637 #define EFI_IFR_PASSWORD_OP            0x08
638 #define EFI_IFR_ONE_OF_OPTION_OP       0x09
639 #define EFI_IFR_SUPPRESS_IF_OP         0x0A
640 #define EFI_IFR_LOCKED_OP              0x0B
641 #define EFI_IFR_ACTION_OP              0x0C
642 #define EFI_IFR_RESET_BUTTON_OP        0x0D
643 #define EFI_IFR_FORM_SET_OP            0x0E
644 #define EFI_IFR_REF_OP                 0x0F
645 #define EFI_IFR_NO_SUBMIT_IF_OP        0x10
646 #define EFI_IFR_INCONSISTENT_IF_OP     0x11
647 #define EFI_IFR_EQ_ID_VAL_OP           0x12
648 #define EFI_IFR_EQ_ID_ID_OP            0x13
649 #define EFI_IFR_EQ_ID_LIST_OP          0x14
650 #define EFI_IFR_AND_OP                 0x15
651 #define EFI_IFR_OR_OP                  0x16
652 #define EFI_IFR_NOT_OP                 0x17
653 #define EFI_IFR_RULE_OP                0x18
654 #define EFI_IFR_GRAY_OUT_IF_OP         0x19
655 #define EFI_IFR_DATE_OP                0x1A
656 #define EFI_IFR_TIME_OP                0x1B
657 #define EFI_IFR_STRING_OP              0x1C
658 #define EFI_IFR_REFRESH_OP             0x1D
659 #define EFI_IFR_DISABLE_IF_OP          0x1E
660 #define EFI_IFR_TO_LOWER_OP            0x20
661 #define EFI_IFR_TO_UPPER_OP            0x21
662 #define EFI_IFR_ORDERED_LIST_OP        0x23
663 #define EFI_IFR_VARSTORE_OP            0x24
664 #define EFI_IFR_VARSTORE_NAME_VALUE_OP 0x25
665 #define EFI_IFR_VARSTORE_EFI_OP        0x26
666 #define EFI_IFR_VARSTORE_DEVICE_OP     0x27
667 #define EFI_IFR_VERSION_OP             0x28
668 #define EFI_IFR_END_OP                 0x29
669 #define EFI_IFR_MATCH_OP               0x2A
670 #define EFI_IFR_EQUAL_OP               0x2F
671 #define EFI_IFR_NOT_EQUAL_OP           0x30
672 #define EFI_IFR_GREATER_THAN_OP        0x31
673 #define EFI_IFR_GREATER_EQUAL_OP       0x32
674 #define EFI_IFR_LESS_THAN_OP           0x33
675 #define EFI_IFR_LESS_EQUAL_OP          0x34
676 #define EFI_IFR_BITWISE_AND_OP         0x35
677 #define EFI_IFR_BITWISE_OR_OP          0x36
678 #define EFI_IFR_BITWISE_NOT_OP         0x37
679 #define EFI_IFR_SHIFT_LEFT_OP          0x38
680 #define EFI_IFR_SHIFT_RIGHT_OP         0x39
681 #define EFI_IFR_ADD_OP                 0x3A
682 #define EFI_IFR_SUBTRACT_OP            0x3B
683 #define EFI_IFR_MULTIPLY_OP            0x3C
684 #define EFI_IFR_DIVIDE_OP              0x3D
685 #define EFI_IFR_MODULO_OP              0x3E
686 #define EFI_IFR_RULE_REF_OP            0x3F
687 #define EFI_IFR_QUESTION_REF1_OP       0x40
688 #define EFI_IFR_QUESTION_REF2_OP       0x41
689 #define EFI_IFR_UINT8_OP               0x42
690 #define EFI_IFR_UINT16_OP              0x43
691 #define EFI_IFR_UINT32_OP              0x44
692 #define EFI_IFR_UINT64_OP              0x45
693 #define EFI_IFR_TRUE_OP                0x46
694 #define EFI_IFR_FALSE_OP               0x47
695 #define EFI_IFR_TO_UINT_OP             0x48
696 #define EFI_IFR_TO_STRING_OP           0x49
697 #define EFI_IFR_TO_BOOLEAN_OP          0x4A
698 #define EFI_IFR_MID_OP                 0x4B
699 #define EFI_IFR_FIND_OP                0x4C
700 #define EFI_IFR_TOKEN_OP               0x4D
701 #define EFI_IFR_STRING_REF1_OP         0x4E
702 #define EFI_IFR_STRING_REF2_OP         0x4F
703 #define EFI_IFR_CONDITIONAL_OP         0x50
704 #define EFI_IFR_QUESTION_REF3_OP       0x51
705 #define EFI_IFR_ZERO_OP                0x52
706 #define EFI_IFR_ONE_OP                 0x53
707 #define EFI_IFR_ONES_OP                0x54
708 #define EFI_IFR_UNDEFINED_OP           0x55
709 #define EFI_IFR_LENGTH_OP              0x56
710 #define EFI_IFR_DUP_OP                 0x57
711 #define EFI_IFR_THIS_OP                0x58
712 #define EFI_IFR_SPAN_OP                0x59
713 #define EFI_IFR_VALUE_OP               0x5A
714 #define EFI_IFR_DEFAULT_OP             0x5B
715 #define EFI_IFR_DEFAULTSTORE_OP        0x5C
716 #define EFI_IFR_CATENATE_OP            0x5E
717 #define EFI_IFR_GUID_OP                0x5F
718 
719 //
720 // Definitions of IFR Standard Headers
721 // Section 27.3.8.2
722 //
723 
724 typedef struct _EFI_IFR_OP_HEADER {
725   UINT8                    OpCode;
726   UINT8                    Length:7;
727   UINT8                    Scope:1;
728 } EFI_IFR_OP_HEADER;
729 
730 typedef struct _EFI_IFR_STATEMENT_HEADER {
731   EFI_STRING_ID            Prompt;
732   EFI_STRING_ID            Help;
733 } EFI_IFR_STATEMENT_HEADER;
734 
735 typedef struct _EFI_IFR_QUESTION_HEADER {
736   EFI_IFR_STATEMENT_HEADER Header;
737   EFI_QUESTION_ID          QuestionId;
738   EFI_VARSTORE_ID          VarStoreId;
739   union {
740     EFI_STRING_ID          VarName;
741     UINT16                 VarOffset;
742   }                        VarStoreInfo;
743   UINT8                    Flags;
744 } EFI_IFR_QUESTION_HEADER;
745 
746 //
747 // Flag values of EFI_IFR_QUESTION_HEADER
748 //
749 #define EFI_IFR_FLAG_READ_ONLY         0x01
750 #define EFI_IFR_FLAG_CALLBACK          0x04
751 #define EFI_IFR_FLAG_RESET_REQUIRED    0x10
752 #define EFI_IFR_FLAG_OPTIONS_ONLY      0x80
753 
754 //
755 // Definition for Opcode Reference
756 // Section 27.3.8.3
757 //
758 typedef struct _EFI_IFR_DEFAULTSTORE {
759   EFI_IFR_OP_HEADER        Header;
760   EFI_STRING_ID            DefaultName;
761   UINT16                   DefaultId;
762 } EFI_IFR_DEFAULTSTORE;
763 
764 //
765 // Default Identifier of default store
766 //
767 #define EFI_HII_DEFAULT_CLASS_STANDARD       0x0000
768 #define EFI_HII_DEFAULT_CLASS_MANUFACTURING  0x0001
769 #define EFI_HII_DEFAULT_CLASS_SAFE           0x0002
770 #define EFI_HII_DEFAULT_CLASS_PLATFORM_BEGIN 0x4000
771 #define EFI_HII_DEFAULT_CLASS_PLATFORM_END   0x7fff
772 #define EFI_HII_DEFAULT_CLASS_HARDWARE_BEGIN 0x8000
773 #define EFI_HII_DEFAULT_CLASS_HARDWARE_END   0xbfff
774 #define EFI_HII_DEFAULT_CLASS_FIRMWARE_BEGIN 0xc000
775 #define EFI_HII_DEFAULT_CLASS_FIRMWARE_END   0xffff
776 
777 typedef struct _EFI_IFR_VARSTORE {
778   EFI_IFR_OP_HEADER        Header;
779   EFI_GUID                 Guid;
780   EFI_VARSTORE_ID          VarStoreId;
781   UINT16                   Size;
782   UINT8                    Name[1];
783 } EFI_IFR_VARSTORE;
784 
785 typedef struct _EFI_IFR_VARSTORE_EFI {
786   EFI_IFR_OP_HEADER        Header;
787   EFI_VARSTORE_ID          VarStoreId;
788   EFI_GUID                 Guid;
789   UINT32                   Attributes;
790 } EFI_IFR_VARSTORE_EFI;
791 
792 typedef struct _EFI_IFR_VARSTORE_NAME_VALUE {
793   EFI_IFR_OP_HEADER        Header;
794   EFI_VARSTORE_ID          VarStoreId;
795   EFI_GUID                 Guid;
796 } EFI_IFR_VARSTORE_NAME_VALUE;
797 
798 typedef struct _EFI_IFR_FORM_SET {
799   EFI_IFR_OP_HEADER        Header;
800   EFI_GUID                 Guid;
801   EFI_STRING_ID            FormSetTitle;
802   EFI_STRING_ID            Help;
803 } EFI_IFR_FORM_SET;
804 
805 typedef struct _EFI_IFR_END {
806   EFI_IFR_OP_HEADER        Header;
807 } EFI_IFR_END;
808 
809 typedef struct _EFI_IFR_FORM {
810   EFI_IFR_OP_HEADER        Header;
811   UINT16                   FormId;
812   EFI_STRING_ID            FormTitle;
813 } EFI_IFR_FORM;
814 
815 typedef struct _EFI_IFR_IMAGE {
816   EFI_IFR_OP_HEADER        Header;
817   EFI_IMAGE_ID             Id;
818 } EFI_IFR_IMAGE;
819 
820 typedef struct _EFI_IFR_LOCKED {
821   EFI_IFR_OP_HEADER        Header;
822 } EFI_IFR_LOCKED;
823 
824 typedef struct _EFI_IFR_RULE {
825   EFI_IFR_OP_HEADER        Header;
826   UINT8                    RuleId;
827 } EFI_IFR_RULE;
828 
829 typedef struct _EFI_IFR_DEFAULT {
830   EFI_IFR_OP_HEADER        Header;
831   UINT16                   DefaultId;
832   UINT8                    Type;
833   EFI_IFR_TYPE_VALUE       Value;
834 } EFI_IFR_DEFAULT;
835 
836 typedef struct _EFI_IFR_VALUE {
837   EFI_IFR_OP_HEADER        Header;
838 } EFI_IFR_VALUE;
839 
840 typedef struct _EFI_IFR_SUBTITLE {
841   EFI_IFR_OP_HEADER        Header;
842   EFI_IFR_STATEMENT_HEADER Statement;
843   UINT8                    Flags;
844 } EFI_IFR_SUBTITLE;
845 
846 #define EFI_IFR_FLAGS_HORIZONTAL       0x01
847 
848 typedef struct _EFI_IFR_CHECKBOX {
849   EFI_IFR_OP_HEADER        Header;
850   EFI_IFR_QUESTION_HEADER  Question;
851   UINT8                    Flags;
852 } EFI_IFR_CHECKBOX;
853 
854 #define EFI_IFR_CHECKBOX_DEFAULT       0x01
855 #define EFI_IFR_CHECKBOX_DEFAULT_MFG   0x02
856 
857 typedef struct _EFI_IFR_TEXT {
858   EFI_IFR_OP_HEADER        Header;
859   EFI_IFR_STATEMENT_HEADER Statement;
860   EFI_STRING_ID            TextTwo;
861 } EFI_IFR_TEXT;
862 
863 typedef struct _EFI_IFR_REF {
864   EFI_IFR_OP_HEADER        Header;
865   EFI_IFR_QUESTION_HEADER  Question;
866   EFI_FORM_ID              FormId;
867 } EFI_IFR_REF;
868 
869 typedef struct _EFI_IFR_REF2 {
870   EFI_IFR_OP_HEADER        Header;
871   EFI_IFR_QUESTION_HEADER  Question;
872   EFI_FORM_ID              FormId;
873   EFI_QUESTION_ID          QuestionId;
874 } EFI_IFR_REF2;
875 
876 typedef struct _EFI_IFR_REF3 {
877   EFI_IFR_OP_HEADER        Header;
878   EFI_IFR_QUESTION_HEADER  Question;
879   EFI_FORM_ID              FormId;
880   EFI_QUESTION_ID          QuestionId;
881   EFI_GUID                 FormSetId;
882 } EFI_IFR_REF3;
883 
884 typedef struct _EFI_IFR_REF4 {
885   EFI_IFR_OP_HEADER        Header;
886   EFI_IFR_QUESTION_HEADER  Question;
887   EFI_FORM_ID              FormId;
888   EFI_QUESTION_ID          QuestionId;
889   EFI_GUID                 FormSetId;
890   EFI_STRING_ID            DevicePath;
891 } EFI_IFR_REF4;
892 
893 typedef struct _EFI_IFR_RESET_BUTTON {
894   EFI_IFR_OP_HEADER        Header;
895   EFI_IFR_QUESTION_HEADER  Question;
896   EFI_DEFAULT_ID           DefaultId;
897 } EFI_IFR_RESET_BUTTON;
898 
899 typedef struct _EFI_IFR_ACTION {
900   EFI_IFR_OP_HEADER        Header;
901   EFI_IFR_QUESTION_HEADER  Question;
902   EFI_STRING_ID            QuestionConfig;
903 } EFI_IFR_ACTION;
904 
905 typedef struct _EFI_IFR_ACTION_1 {
906   EFI_IFR_OP_HEADER        Header;
907   EFI_IFR_QUESTION_HEADER  Question;
908 } EFI_IFR_ACTION_1;
909 
910 typedef struct _EFI_IFR_DATE {
911   EFI_IFR_OP_HEADER        Header;
912   EFI_IFR_QUESTION_HEADER  Question;
913   UINT8                    Flags;
914 } EFI_IFR_DATE;
915 
916 //
917 // Flags that describe the behavior of the question.
918 //
919 #define EFI_QF_DATE_YEAR_SUPPRESS      0x01
920 #define EFI_QF_DATE_MONTH_SUPPRESS     0x02
921 #define EFI_QF_DATE_DAY_SUPPRESS       0x04
922 
923 #define EFI_QF_DATE_STORAGE            0x30
924 #define     QF_DATE_STORAGE_NORMAL     0x00
925 #define     QF_DATE_STORAGE_TIME       0x10
926 #define     QF_DATE_STORAGE_WAKEUP     0x20
927 
928 typedef union {
929   struct {
930     UINT8 MinValue;
931     UINT8 MaxValue;
932     UINT8 Step;
933   } u8;
934   struct {
935     UINT16 MinValue;
936     UINT16 MaxValue;
937     UINT16 Step;
938   } u16;
939   struct {
940     UINT32 MinValue;
941     UINT32 MaxValue;
942     UINT32 Step;
943   } u32;
944   struct {
945     UINT64 MinValue;
946     UINT64 MaxValue;
947     UINT64 Step;
948   } u64;
949 } MINMAXSTEP_DATA;
950 
951 typedef struct _EFI_IFR_NUMERIC {
952   EFI_IFR_OP_HEADER        Header;
953   EFI_IFR_QUESTION_HEADER  Question;
954   UINT8                    Flags;
955   MINMAXSTEP_DATA          data;
956 } EFI_IFR_NUMERIC;
957 
958 //
959 // Flags related to the numeric question
960 //
961 #define EFI_IFR_NUMERIC_SIZE           0x03
962 #define   EFI_IFR_NUMERIC_SIZE_1       0x00
963 #define   EFI_IFR_NUMERIC_SIZE_2       0x01
964 #define   EFI_IFR_NUMERIC_SIZE_4       0x02
965 #define   EFI_IFR_NUMERIC_SIZE_8       0x03
966 
967 #define EFI_IFR_DISPLAY                0x30
968 #define   EFI_IFR_DISPLAY_INT_DEC      0x00
969 #define   EFI_IFR_DISPLAY_UINT_DEC     0x10
970 #define   EFI_IFR_DISPLAY_UINT_HEX     0x20
971 
972 typedef struct _EFI_IFR_ONE_OF {
973   EFI_IFR_OP_HEADER        Header;
974   EFI_IFR_QUESTION_HEADER  Question;
975   UINT8                    Flags;
976   MINMAXSTEP_DATA          data;
977 } EFI_IFR_ONE_OF;
978 
979 typedef struct _EFI_IFR_STRING {
980   EFI_IFR_OP_HEADER        Header;
981   EFI_IFR_QUESTION_HEADER  Question;
982   UINT8                    MinSize;
983   UINT8                    MaxSize;
984   UINT8                    Flags;
985 } EFI_IFR_STRING;
986 
987 #define EFI_IFR_STRING_MULTI_LINE      0x01
988 
989 typedef struct _EFI_IFR_PASSWORD {
990   EFI_IFR_OP_HEADER        Header;
991   EFI_IFR_QUESTION_HEADER  Question;
992   UINT16                   MinSize;
993   UINT16                   MaxSize;
994 } EFI_IFR_PASSWORD;
995 
996 typedef struct _EFI_IFR_ORDERED_LIST {
997   EFI_IFR_OP_HEADER        Header;
998   EFI_IFR_QUESTION_HEADER  Question;
999   UINT8                    MaxContainers;
1000   UINT8                    Flags;
1001 } EFI_IFR_ORDERED_LIST;
1002 
1003 #define EFI_IFR_UNIQUE_SET             0x01
1004 #define EFI_IFR_NO_EMPTY_SET           0x02
1005 
1006 typedef struct _EFI_IFR_TIME {
1007   EFI_IFR_OP_HEADER        Header;
1008   EFI_IFR_QUESTION_HEADER  Question;
1009   UINT8                    Flags;
1010 } EFI_IFR_TIME;
1011 
1012 //
1013 // A bit-mask that determines which unique settings are active for this opcode.
1014 //
1015 #define QF_TIME_HOUR_SUPPRESS          0x01
1016 #define QF_TIME_MINUTE_SUPPRESS        0x02
1017 #define QF_TIME_SECOND_SUPPRESS        0x04
1018 
1019 #define QF_TIME_STORAGE                0x30
1020 #define   QF_TIME_STORAGE_NORMAL       0x00
1021 #define   QF_TIME_STORAGE_TIME         0x10
1022 #define   QF_TIME_STORAGE_WAKEUP       0x20
1023 
1024 typedef struct _EFI_IFR_DISABLE_IF {
1025   EFI_IFR_OP_HEADER        Header;
1026 } EFI_IFR_DISABLE_IF;
1027 
1028 typedef struct _EFI_IFR_SUPPRESS_IF {
1029   EFI_IFR_OP_HEADER        Header;
1030 } EFI_IFR_SUPPRESS_IF;
1031 
1032 typedef struct _EFI_IFR_GRAY_OUT_IF {
1033   EFI_IFR_OP_HEADER        Header;
1034 } EFI_IFR_GRAY_OUT_IF;
1035 
1036 typedef struct _EFI_IFR_INCONSISTENT_IF {
1037   EFI_IFR_OP_HEADER        Header;
1038   EFI_STRING_ID            Error;
1039 } EFI_IFR_INCONSISTENT_IF;
1040 
1041 typedef struct _EFI_IFR_NO_SUBMIT_IF {
1042   EFI_IFR_OP_HEADER        Header;
1043   EFI_STRING_ID            Error;
1044 } EFI_IFR_NO_SUBMIT_IF;
1045 
1046 typedef struct _EFI_IFR_REFRESH {
1047   EFI_IFR_OP_HEADER        Header;
1048   UINT8                    RefreshInterval;
1049 } EFI_IFR_REFRESH;
1050 
1051 typedef struct _EFI_IFR_VARSTORE_DEVICE {
1052   EFI_IFR_OP_HEADER        Header;
1053   EFI_STRING_ID            DevicePath;
1054 } EFI_IFR_VARSTORE_DEVICE;
1055 
1056 typedef struct _EFI_IFR_ONE_OF_OPTION {
1057   EFI_IFR_OP_HEADER        Header;
1058   EFI_STRING_ID            Option;
1059   UINT8                    Flags;
1060   UINT8                    Type;
1061   EFI_IFR_TYPE_VALUE       Value;
1062 } EFI_IFR_ONE_OF_OPTION;
1063 
1064 //
1065 // Types of the option's value.
1066 //
1067 #define EFI_IFR_TYPE_NUM_SIZE_8        0x00
1068 #define EFI_IFR_TYPE_NUM_SIZE_16       0x01
1069 #define EFI_IFR_TYPE_NUM_SIZE_32       0x02
1070 #define EFI_IFR_TYPE_NUM_SIZE_64       0x03
1071 #define EFI_IFR_TYPE_BOOLEAN           0x04
1072 #define EFI_IFR_TYPE_TIME              0x05
1073 #define EFI_IFR_TYPE_DATE              0x06
1074 #define EFI_IFR_TYPE_STRING            0x07
1075 #define EFI_IFR_TYPE_OTHER             0x08
1076 
1077 #define EFI_IFR_OPTION_DEFAULT         0x10
1078 #define EFI_IFR_OPTION_DEFAULT_MFG     0x20
1079 
1080 typedef struct _EFI_IFR_GUID {
1081   EFI_IFR_OP_HEADER        Header;
1082   EFI_GUID                 Guid;
1083   //Optional Data Follows
1084 } EFI_IFR_GUID;
1085 
1086 typedef struct _EFI_IFR_DUP {
1087   EFI_IFR_OP_HEADER        Header;
1088 } EFI_IFR_DUP;
1089 
1090 typedef struct _EFI_IFR_EQ_ID_ID {
1091   EFI_IFR_OP_HEADER        Header;
1092   EFI_QUESTION_ID          QuestionId1;
1093   EFI_QUESTION_ID          QuestionId2;
1094 } EFI_IFR_EQ_ID_ID;
1095 
1096 typedef struct _EFI_IFR_EQ_ID_VAL {
1097   EFI_IFR_OP_HEADER        Header;
1098   EFI_QUESTION_ID          QuestionId;
1099   UINT16                   Value;
1100 } EFI_IFR_EQ_ID_VAL;
1101 
1102 typedef struct _EFI_IFR_EQ_ID_LIST {
1103   EFI_IFR_OP_HEADER        Header;
1104   EFI_QUESTION_ID          QuestionId;
1105   UINT16                   ListLength;
1106   UINT16                   ValueList[1];
1107 } EFI_IFR_EQ_ID_LIST;
1108 
1109 typedef struct _EFI_IFR_UINT8 {
1110   EFI_IFR_OP_HEADER        Header;
1111   UINT8 Value;
1112 } EFI_IFR_UINT8;
1113 
1114 typedef struct _EFI_IFR_UINT16 {
1115   EFI_IFR_OP_HEADER        Header;
1116   UINT16                   Value;
1117 } EFI_IFR_UINT16;
1118 
1119 typedef struct _EFI_IFR_UINT32 {
1120   EFI_IFR_OP_HEADER        Header;
1121   UINT32                   Value;
1122 } EFI_IFR_UINT32;
1123 
1124 typedef struct _EFI_IFR_UINT64 {
1125   EFI_IFR_OP_HEADER        Header;
1126   UINT64 Value;
1127 } EFI_IFR_UINT64;
1128 
1129 typedef struct _EFI_IFR_QUESTION_REF1 {
1130   EFI_IFR_OP_HEADER        Header;
1131   EFI_QUESTION_ID          QuestionId;
1132 } EFI_IFR_QUESTION_REF1;
1133 
1134 typedef struct _EFI_IFR_QUESTION_REF2 {
1135   EFI_IFR_OP_HEADER        Header;
1136 } EFI_IFR_QUESTION_REF2;
1137 
1138 typedef struct _EFI_IFR_QUESTION_REF3 {
1139   EFI_IFR_OP_HEADER        Header;
1140 } EFI_IFR_QUESTION_REF3;
1141 
1142 typedef struct _EFI_IFR_QUESTION_REF3_2 {
1143   EFI_IFR_OP_HEADER        Header;
1144   EFI_STRING_ID            DevicePath;
1145 } EFI_IFR_QUESTION_REF3_2;
1146 
1147 typedef struct _EFI_IFR_QUESTION_REF3_3 {
1148   EFI_IFR_OP_HEADER        Header;
1149   EFI_STRING_ID            DevicePath;
1150   EFI_GUID                 Guid;
1151 } EFI_IFR_QUESTION_REF3_3;
1152 
1153 typedef struct _EFI_IFR_RULE_REF {
1154   EFI_IFR_OP_HEADER        Header;
1155   UINT8                    RuleId;
1156 } EFI_IFR_RULE_REF;
1157 
1158 typedef struct _EFI_IFR_STRING_REF1 {
1159   EFI_IFR_OP_HEADER        Header;
1160   EFI_STRING_ID            StringId;
1161 } EFI_IFR_STRING_REF1;
1162 
1163 typedef struct _EFI_IFR_STRING_REF2 {
1164   EFI_IFR_OP_HEADER        Header;
1165 } EFI_IFR_STRING_REF2;
1166 
1167 typedef struct _EFI_IFR_THIS {
1168   EFI_IFR_OP_HEADER        Header;
1169 } EFI_IFR_THIS;
1170 
1171 typedef struct _EFI_IFR_TRUE {
1172   EFI_IFR_OP_HEADER        Header;
1173 } EFI_IFR_TRUE;
1174 
1175 typedef struct _EFI_IFR_FALSE {
1176   EFI_IFR_OP_HEADER        Header;
1177 } EFI_IFR_FALSE;
1178 
1179 typedef struct _EFI_IFR_ONE {
1180   EFI_IFR_OP_HEADER        Header;
1181 } EFI_IFR_ONE;
1182 
1183 typedef struct _EFI_IFR_ONES {
1184   EFI_IFR_OP_HEADER        Header;
1185 } EFI_IFR_ONES;
1186 
1187 typedef struct _EFI_IFR_ZERO {
1188   EFI_IFR_OP_HEADER        Header;
1189 } EFI_IFR_ZERO;
1190 
1191 typedef struct _EFI_IFR_UNDEFINED {
1192   EFI_IFR_OP_HEADER        Header;
1193 } EFI_IFR_UNDEFINED;
1194 
1195 typedef struct _EFI_IFR_VERSION {
1196   EFI_IFR_OP_HEADER        Header;
1197 } EFI_IFR_VERSION;
1198 
1199 typedef struct _EFI_IFR_LENGTH {
1200   EFI_IFR_OP_HEADER        Header;
1201 } EFI_IFR_LENGTH;
1202 
1203 typedef struct _EFI_IFR_NOT {
1204   EFI_IFR_OP_HEADER        Header;
1205 } EFI_IFR_NOT;
1206 
1207 typedef struct _EFI_IFR_BITWISE_NOT {
1208   EFI_IFR_OP_HEADER        Header;
1209 } EFI_IFR_BITWISE_NOT;
1210 
1211 typedef struct _EFI_IFR_TO_BOOLEAN {
1212   EFI_IFR_OP_HEADER        Header;
1213 } EFI_IFR_TO_BOOLEAN;
1214 
1215 //
1216 // For EFI_IFR_TO_STRING, when converting from
1217 // unsigned integers, these flags control the format:
1218 // 0 = unsigned decimal
1219 // 1 = signed decimal
1220 // 2 = hexadecimal (lower-case alpha)
1221 // 3 = hexadecimal (upper-case alpha)
1222 //
1223 #define EFI_IFR_STRING_UNSIGNED_DEC      0
1224 #define EFI_IFR_STRING_SIGNED_DEC        1
1225 #define EFI_IFR_STRING_LOWERCASE_HEX     2
1226 #define EFI_IFR_STRING_UPPERCASE_HEX     3
1227 //
1228 // When converting from a buffer, these flags control the format:
1229 // 0 = ASCII
1230 // 8 = Unicode
1231 //
1232 #define EFI_IFR_STRING_ASCII             0
1233 #define EFI_IFR_STRING_UNICODE           8
1234 
1235 typedef struct _EFI_IFR_TO_STRING {
1236   EFI_IFR_OP_HEADER        Header;
1237   UINT8                    Format;
1238 } EFI_IFR_TO_STRING;
1239 
1240 typedef struct _EFI_IFR_TO_UINT {
1241   EFI_IFR_OP_HEADER        Header;
1242 } EFI_IFR_TO_UINT;
1243 
1244 typedef struct _EFI_IFR_TO_UPPER {
1245   EFI_IFR_OP_HEADER        Header;
1246 } EFI_IFR_TO_UPPER;
1247 
1248 typedef struct _EFI_IFR_TO_LOWER {
1249   EFI_IFR_OP_HEADER        Header;
1250 } EFI_IFR_TO_LOWER;
1251 
1252 typedef struct _EFI_IFR_ADD {
1253   EFI_IFR_OP_HEADER        Header;
1254 } EFI_IFR_ADD;
1255 
1256 typedef struct _EFI_IFR_AND {
1257   EFI_IFR_OP_HEADER        Header;
1258 } EFI_IFR_AND;
1259 
1260 typedef struct _EFI_IFR_BITWISE_AND {
1261   EFI_IFR_OP_HEADER        Header;
1262 } EFI_IFR_BITWISE_AND;
1263 
1264 typedef struct _EFI_IFR_BITWISE_OR {
1265   EFI_IFR_OP_HEADER        Header;
1266 } EFI_IFR_BITWISE_OR;
1267 
1268 typedef struct _EFI_IFR_CATENATE {
1269   EFI_IFR_OP_HEADER        Header;
1270 } EFI_IFR_CATENATE;
1271 
1272 typedef struct _EFI_IFR_DIVIDE {
1273   EFI_IFR_OP_HEADER        Header;
1274 } EFI_IFR_DIVIDE;
1275 
1276 typedef struct _EFI_IFR_EQUAL {
1277   EFI_IFR_OP_HEADER        Header;
1278 } EFI_IFR_EQUAL;
1279 
1280 typedef struct _EFI_IFR_GREATER_EQUAL {
1281   EFI_IFR_OP_HEADER        Header;
1282 } EFI_IFR_GREATER_EQUAL;
1283 
1284 typedef struct _EFI_IFR_GREATER_THAN {
1285   EFI_IFR_OP_HEADER        Header;
1286 } EFI_IFR_GREATER_THAN;
1287 
1288 typedef struct _EFI_IFR_LESS_EQUAL {
1289   EFI_IFR_OP_HEADER        Header;
1290 } EFI_IFR_LESS_EQUAL;
1291 
1292 typedef struct _EFI_IFR_LESS_THAN {
1293   EFI_IFR_OP_HEADER        Header;
1294 } EFI_IFR_LESS_THAN;
1295 
1296 typedef struct _EFI_IFR_MATCH {
1297   EFI_IFR_OP_HEADER        Header;
1298 } EFI_IFR_MATCH;
1299 
1300 typedef struct _EFI_IFR_MULTIPLY {
1301   EFI_IFR_OP_HEADER        Header;
1302 } EFI_IFR_MULTIPLY;
1303 
1304 typedef struct _EFI_IFR_MODULO {
1305   EFI_IFR_OP_HEADER        Header;
1306 } EFI_IFR_MODULO;
1307 
1308 typedef struct _EFI_IFR_NOT_EQUAL {
1309   EFI_IFR_OP_HEADER        Header;
1310 } EFI_IFR_NOT_EQUAL;
1311 
1312 typedef struct _EFI_IFR_OR {
1313   EFI_IFR_OP_HEADER        Header;
1314 } EFI_IFR_OR;
1315 
1316 typedef struct _EFI_IFR_SHIFT_LEFT {
1317   EFI_IFR_OP_HEADER        Header;
1318 } EFI_IFR_SHIFT_LEFT;
1319 
1320 typedef struct _EFI_IFR_SHIFT_RIGHT {
1321   EFI_IFR_OP_HEADER        Header;
1322 } EFI_IFR_SHIFT_RIGHT;
1323 
1324 typedef struct _EFI_IFR_SUBTRACT {
1325   EFI_IFR_OP_HEADER        Header;
1326 } EFI_IFR_SUBTRACT;
1327 
1328 typedef struct _EFI_IFR_CONDITIONAL {
1329   EFI_IFR_OP_HEADER        Header;
1330 } EFI_IFR_CONDITIONAL;
1331 
1332 //
1333 // Flags governing the matching criteria of EFI_IFR_FIND
1334 //
1335 #define EFI_IFR_FF_CASE_SENSITIVE    0x00
1336 #define EFI_IFR_FF_CASE_INSENSITIVE  0x01
1337 
1338 typedef struct _EFI_IFR_FIND {
1339   EFI_IFR_OP_HEADER        Header;
1340   UINT8                    Format;
1341 } EFI_IFR_FIND;
1342 
1343 typedef struct _EFI_IFR_MID {
1344   EFI_IFR_OP_HEADER        Header;
1345 } EFI_IFR_MID;
1346 
1347 typedef struct _EFI_IFR_TOKEN {
1348   EFI_IFR_OP_HEADER        Header;
1349 } EFI_IFR_TOKEN;
1350 
1351 //
1352 // Flags specifying whether to find the first matching string
1353 // or the first non-matching string.
1354 //
1355 #define EFI_IFR_FLAGS_FIRST_MATCHING     0x00
1356 #define EFI_IFR_FLAGS_FIRST_NON_MATCHING 0x01
1357 
1358 typedef struct _EFI_IFR_SPAN {
1359   EFI_IFR_OP_HEADER        Header;
1360   UINT8                    Flags;
1361 } EFI_IFR_SPAN;
1362 
1363 //
1364 // Definitions for Keyboard Package
1365 // Section 27.3.9
1366 // Releated definitions are in Section of EFI_HII_DATABASE_PROTOCOL
1367 //
1368 
1369 typedef enum {
1370   EfiKeyLCtrl,
1371   EfiKeyA0,
1372   EfiKeyLAlt,
1373   EfiKeySpaceBar,
1374   EfiKeyA2,
1375   EfiKeyA3,
1376   EfiKeyA4,
1377   EfiKeyRCtrl,
1378   EfiKeyLeftArrow,
1379   EfiKeyDownArrow,
1380   EfiKeyRightArrow,
1381   EfiKeyZero,
1382   EfiKeyPeriod,
1383   EfiKeyEnter,
1384   EfiKeyLShift,
1385   EfiKeyB0,
1386   EfiKeyB1,
1387   EfiKeyB2,
1388   EfiKeyB3,
1389   EfiKeyB4,
1390   EfiKeyB5,
1391   EfiKeyB6,
1392   EfiKeyB7,
1393   EfiKeyB8,
1394   EfiKeyB9,
1395   EfiKeyB10,
1396   EfiKeyRShift,
1397   EfiKeyUpArrow,
1398   EfiKeyOne,
1399   EfiKeyTwo,
1400   EfiKeyThree,
1401   EfiKeyCapsLock,
1402   EfiKeyC1,
1403   EfiKeyC2,
1404   EfiKeyC3,
1405   EfiKeyC4,
1406   EfiKeyC5,
1407   EfiKeyC6,
1408   EfiKeyC7,
1409   EfiKeyC8,
1410   EfiKeyC9,
1411   EfiKeyC10,
1412   EfiKeyC11,
1413   EfiKeyC12,
1414   EfiKeyFour,
1415   EfiKeyFive,
1416   EfiKeySix,
1417   EfiKeyPlus,
1418   EfiKeyTab,
1419   EfiKeyD1,
1420   EfiKeyD2,
1421   EfiKeyD3,
1422   EfiKeyD4,
1423   EfiKeyD5,
1424   EfiKeyD6,
1425   EfiKeyD7,
1426   EfiKeyD8,
1427   EfiKeyD9,
1428   EfiKeyD10,
1429   EfiKeyD11,
1430   EfiKeyD12,
1431   EfiKeyD13,
1432   EfiKeyDel,
1433   EfiKeyEnd,
1434   EfiKeyPgDn,
1435   EfiKeySeven,
1436   EfiKeyEight,
1437   EfiKeyNine,
1438   EfiKeyE0,
1439   EfiKeyE1,
1440   EfiKeyE2,
1441   EfiKeyE3,
1442   EfiKeyE4,
1443   EfiKeyE5,
1444   EfiKeyE6,
1445   EfiKeyE7,
1446   EfiKeyE8,
1447   EfiKeyE9,
1448   EfiKeyE10,
1449   EfiKeyE11,
1450   EfiKeyE12,
1451   EfiKeyBackSpace,
1452   EfiKeyIns,
1453   EfiKeyHome,
1454   EfiKeyPgUp,
1455   EfiKeyNLck,
1456   EfiKeySlash,
1457   EfiKeyAsterisk,
1458   EfiKeyMinus,
1459   EfiKeyEsc,
1460   EfiKeyF1,
1461   EfiKeyF2,
1462   EfiKeyF3,
1463   EfiKeyF4,
1464   EfiKeyF5,
1465   EfiKeyF6,
1466   EfiKeyF7,
1467   EfiKeyF8,
1468   EfiKeyF9,
1469   EfiKeyF10,
1470   EfiKeyF11,
1471   EfiKeyF12,
1472   EfiKeyPrint,
1473   EfiKeySLck,
1474   EfiKeyPause
1475 } EFI_KEY;
1476 
1477 typedef struct {
1478   EFI_KEY                 Key;
1479   CHAR16                  Unicode;
1480   CHAR16                  ShiftedUnicode;
1481   CHAR16                  AltGrUnicode;
1482   CHAR16                  ShiftedAltGrUnicode;
1483   UINT16                  Modifier;
1484   UINT16                  AffectedAttribute;
1485 } EFI_KEY_DESCRIPTOR;
1486 
1487 ///
1488 /// A key which is affected by all the standard shift modifiers.
1489 /// Most keys would be expected to have this bit active.
1490 ///
1491 #define EFI_AFFECTED_BY_STANDARD_SHIFT       0x0001
1492 
1493 ///
1494 /// This key is affected by the caps lock so that if a keyboard driver
1495 /// would need to disambiguate between a key which had a "1" defined
1496 /// versus a "a" character.  Having this bit turned on would tell
1497 /// the keyboard driver to use the appropriate shifted state or not.
1498 ///
1499 #define EFI_AFFECTED_BY_CAPS_LOCK            0x0002
1500 
1501 ///
1502 /// Similar to the case of CAPS lock, if this bit is active, the key
1503 /// is affected by the num lock being turned on.
1504 ///
1505 #define EFI_AFFECTED_BY_NUM_LOCK             0x0004
1506 
1507 typedef struct {
1508   UINT16                  LayoutLength;
1509   EFI_GUID                Guid;
1510   UINT32                  LayoutDescriptorStringOffset;
1511   UINT8                   DescriptorCount;
1512   // EFI_KEY_DESCRIPTOR    Descriptors[];
1513 } EFI_HII_KEYBOARD_LAYOUT;
1514 
1515 typedef struct {
1516   EFI_HII_PACKAGE_HEADER  Header;
1517   UINT16                  LayoutCount;
1518   // EFI_HII_KEYBOARD_LAYOUT Layout[];
1519 } EFI_HII_KEYBOARD_PACKAGE_HDR;
1520 
1521 //
1522 // Modifier values
1523 //
1524 #define EFI_NULL_MODIFIER                0x0000
1525 #define EFI_LEFT_CONTROL_MODIFIER        0x0001
1526 #define EFI_RIGHT_CONTROL_MODIFIER       0x0002
1527 #define EFI_LEFT_ALT_MODIFIER            0x0003
1528 #define EFI_RIGHT_ALT_MODIFIER           0x0004
1529 #define EFI_ALT_GR_MODIFIER              0x0005
1530 #define EFI_INSERT_MODIFIER              0x0006
1531 #define EFI_DELETE_MODIFIER              0x0007
1532 #define EFI_PAGE_DOWN_MODIFIER           0x0008
1533 #define EFI_PAGE_UP_MODIFIER             0x0009
1534 #define EFI_HOME_MODIFIER                0x000A
1535 #define EFI_END_MODIFIER                 0x000B
1536 #define EFI_LEFT_SHIFT_MODIFIER          0x000C
1537 #define EFI_RIGHT_SHIFT_MODIFIER         0x000D
1538 #define EFI_CAPS_LOCK_MODIFIER           0x000E
1539 #define EFI_NUM_LOCK_MODIFIER            0x000F
1540 #define EFI_LEFT_ARROW_MODIFIER          0x0010
1541 #define EFI_RIGHT_ARROW_MODIFIER         0x0011
1542 #define EFI_DOWN_ARROW_MODIFIER          0x0012
1543 #define EFI_UP_ARROW_MODIFIER            0x0013
1544 #define EFI_NS_KEY_MODIFIER              0x0014
1545 #define EFI_NS_KEY_DEPENDENCY_MODIFIER   0x0015
1546 #define EFI_FUNCTION_KEY_ONE_MODIFIER    0x0016
1547 #define EFI_FUNCTION_KEY_TWO_MODIFIER    0x0017
1548 #define EFI_FUNCTION_KEY_THREE_MODIFIER  0x0018
1549 #define EFI_FUNCTION_KEY_FOUR_MODIFIER   0x0019
1550 #define EFI_FUNCTION_KEY_FIVE_MODIFIER   0x001A
1551 #define EFI_FUNCTION_KEY_SIX_MODIFIER    0x001B
1552 #define EFI_FUNCTION_KEY_SEVEN_MODIFIER  0x001C
1553 #define EFI_FUNCTION_KEY_EIGHT_MODIFIER  0x001D
1554 #define EFI_FUNCTION_KEY_NINE_MODIFIER   0x001E
1555 #define EFI_FUNCTION_KEY_TEN_MODIFIER    0x001F
1556 #define EFI_FUNCTION_KEY_ELEVEN_MODIFIER 0x0020
1557 #define EFI_FUNCTION_KEY_TWELVE_MODIFIER 0x0021
1558 
1559 //
1560 // Keys that have multiple control functions based on modifier
1561 // settings are handled in the keyboard driver implementation.
1562 // For instance PRINT_KEY might have a modifier held down and
1563 // is still a nonprinting character, but might have an alternate
1564 // control function like SYSREQUEST
1565 //
1566 #define EFI_PRINT_MODIFIER               0x0022
1567 #define EFI_SYS_REQUEST_MODIFIER         0x0023
1568 #define EFI_SCROLL_LOCK_MODIFIER         0x0024
1569 #define EFI_PAUSE_MODIFIER               0x0025
1570 #define EFI_BREAK_MODIFIER               0x0026
1571 
1572 #define EFI_LEFT_LOGO_MODIFIER           0x0027
1573 #define EFI_RIGHT_LOGO_MODIFIER          0x0028
1574 #define EFI_MENU_MODIFIER                0x0029
1575 
1576 #pragma pack()
1577 
1578 
1579 
1580 ///
1581 /// References to string tokens must use this macro to enable scanning for
1582 /// token usages.
1583 ///
1584 ///
1585 /// STRING_TOKEN is not defined in UEFI specification. But it is placed
1586 /// here for the easy access by C files and VFR source files.
1587 ///
1588 #define STRING_TOKEN(t) t
1589 
1590 #endif
1591