summaryrefslogtreecommitdiff
path: root/MdePkg/Include/Protocol/HiiDatabase.h
blob: a100a6bba8a53d7cdafebf88ff6b802680357088 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
/** @file
  The file provides Database manager for HII-related data
  structures.
  
  Copyright (c) 2006 - 2007, Intel Corporation
  All rights reserved. This program and the accompanying materials                          
  are licensed and made available under the terms and conditions of the BSD License         
  which accompanies this distribution.  The full text of the license may be found at        
  http://opensource.org/licenses/bsd-license.php                                            

  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

**/

#ifndef __HII_DATABASE_H__
#define __HII_DATABASE_H__

#error "UEFI 2.1 HII is not fully implemented for now, Please don't include this file now."

#define EFI_HII_DATABASE_PROTOCOL_GUID \
  { 0xef9fc172, 0xa1b2, 0x4693, { 0xb3, 0x27, 0x6d, 0x32, 0xfc, 0x41, 0x60, 0x42 } }


typedef struct _EFI_HII_DATABASE_PROTOCOL EFI_HII_DATABASE_PROTOCOL;

//
// ConfigurationS of HII.
// 
#define GLYPH_WIDTH         8
#define GLYPH_HEIGHT        19

/**
    
  Each package starts with a header, as defined above, which  
  indicates the size and type of the package. When added to a  
  pointer pointing to the start of the header, Length points at  
  the next package. The package lists form a package list when  
  concatenated together and terminated with an  
  EFI_HII_PACKAGE_HEADER with a Type of EFI_HII_PACKAGE_END. The  
  type EFI_HII_PACKAGE_TYPE_GUID is used for vendor-defined HII  
  packages, whose contents are determined by the Guid. The range  
  of package types starting with EFI_HII_PACKAGE_TYPE_SYSTEM_BEGIN  
  through EFI_HII_PACKAGE_TYPE_SYSTEM_END are reserved for system  
  firmware implementers.  
  
  @param Length The size of the package in bytes.
  
  @param Type   The package type. See EFI_HII_PACKAGE_TYPE_x,
                below.
  
  @param Data   The package data, the format of which is
                determined by Type.
  
**/
typedef struct {
  UINT32  Length:24;
  UINT32  Type:8;
  // UINT8  Data[...];
} EFI_HII_PACKAGE_HEADER;

//
// EFI_HII_PACKAGE_TYPE_x.
// 
#define EFI_HII_PACKAGE_TYPE_ALL      0x00
#define EFI_HII_PACKAGE_TYPE_GUID     0x01
#define EFI_HII_PACKAGE_FORM_CONFIG   0x02
#define EFI_HII_PACKAGE_FORM_APP      0x03
#define EFI_HII_PACKAGE_STRINGS       0x04
#define EFI_HII_PACKAGE_FONTS         0x05
#define EFI_HII_PACKAGE_IMAGES        0x06
#define EFI_HII_PACKAGE_SIMPLE_FONTS  0x07
#define EFI_HII_PACKAGE_DEVICE_PATH   0x08
#define EFI_HII_PACKAGE_END           0x09
#define EFI_HII_PACKAGE_TYPE_SYSTEM_BEGIN   0xE0
#define EFI_HII_PACKAGE_TYPE_SYSTEM_END     0xFF


/**
  
  This header uniquely identifies the package list.and is placed   
  in front of a list of packages. Package lists with the same   
  PackageListGuid value should contain the same data set. Updated   
  versions should have updated GUIDs.   
  
  @param PackageListGuid  The unique identifier applied to the
                          list of packages which follows.
  
  
  @param PackageLength    The size of the package list (in
                         bytes), including the header.

**/
typedef struct {
  EFI_GUID  PackageListGuid;
  UINT32    PackagLength;
} EFI_HII_PACKAGE_LIST_HEADER;

/**

  The fonts must be presented in Unicode sort order. That is,
  the primary sort key is the UnicodeWeight and the secondary
  sort key is the SurrogateWeight. It is up to developers who
  manage fonts to choose efficient mechanisms for accessing
  fonts. The contiguous presentation can easily be used because
  narrow and wide glyphs are not intermixed, so a binary search
  is possible (hence the requirement that the glyphs be sorted
  by weight).

  @param Header   The header contains a Length and Type field.
                  In the case of a font package, the type will
                  be EFI_HII_PACKAGE_SIMPLE_FONTS and the length
                  will be the total size of the font package
                  including the size of the narrow and wide
                  glyphs. See EFI_HII_PACKAGE_HEADER.

  @param NumberOfNarrowGlyphs   The number of NarrowGlyphs that
                                are included in the font package.

  @param NumberOfWideGlyphs   The number of WideGlyphs that are
                              included in the font package.

  @param NarrowGlyphs   An array of EFI_NARROW_GLYPH entries.
                        The number of entries is specified by
                        NumberOfNarrowGlyphs.

  @param WideGlyphs   An array of EFI_WIDE_GLYPH entries. The
                      number of entries is specified by
                      NumberOfWideGlyphs. To calculate the
                      offset of WideGlyphs, use the offset of
                      NarrowGlyphs and add the size of
                      EFI_NARROW_GLYPH multiplied by the
                      NumberOfNarrowGlyphs.

*/
typedef struct _EFI_HII_SIMPLE_FONT_PACKAGE_HDR {
  EFI_HII_PACKAGE_HEADER  Header;
  UINT16                  NumberOfNarrowGlyphs;
  UINT16                  NumberOfWideGlyphs;
  // EFI_NARROW_GLYPH         NarrowGlyphs[];
  // EFI_WIDE_GLYPH           WideGlyphs[];
} EFI_HII_SIMPLE_FONT_PACKAGE_HDR;

//
// Contents of EFI_NARROW_GLYPH.Attributes
//
#define EFI_GLYPH_NON_SPACING 0x01
#define EFI_GLYPH_WIDE        0x02

/**

  Glyphs are represented by two structures, one each for the two
  sizes of glyphs. The narrow glyph (EFI_NARROW_GLYPH) is the
  normal glyph used for text display.

  @param UnicodeWeight  The Unicode representation of the glyph.
                        The term weight is the technical term
                        for a character value.

  @param Attributes   The data element containing the glyph
                      definitions; see Related Definitions
                      below.

  @param GlyphCol1  The column major glyph representation of the
                    character. Bits   with values of one
                    indicate that the corresponding pixel is to
                    be on when normally displayed; those with
                    zero are off.

**/
typedef struct {
  CHAR16  UnicodeWeight;
  UINT8   Attributes;
  UINT8   GlyphCol1[19];
} EFI_NARROW_GLYPH;

/**
   
  Glyphs are represented via the two structures, one each for the
  two sizes of glyphs. The wide glyph (EFI_WIDE_GLYPH) is large
  enough to display logographic characters.

  @param UnicodeWeight  The Unicode representation of the glyph.
                        The term weight is the technical term
                        for a character value.

  @param Attributes   The data element containing the glyph
                      definitions; see Related Definitions in
                      EFI_NARROW_GLYPH for attribute values.
  
  @param GlyphCol1, GlyphCol2   The column major glyph
                                representation of the character.
                                Bits with values of one indicate
                                that the corresponding pixel is
                                to be on when normally
                                displayed; those with zero are
                                off.
  
  @param Pad  Ensures that sizeof(EFI_WIDE_GLYPH) is twice the
              sizeof(EFI_NARROW_GLYPH). The contents of Pad must
              bezero.


**/
typedef struct {
  CHAR16  UnicodeWeight;
  UINT8   Attributes;
  UINT8   GlyphCol1[GLYPH_HEIGHT];
  UINT8   GlyphCol2[GLYPH_HEIGHT];
  UINT8   Pad[3];
} EFI_WIDE_GLYPH;


//
// EFI_HII_FONT_STYLE
// 
typedef UINT32  EFI_HII_FONT_STYLE;
#define EFI_HII_FONT_STYLE_BOLD       0x00000001
#define EFI_HII_FONT_STYLE_ITALIC     0x00000002
#define EFI_HII_FONT_STYLE_EMBOSS     0x00010000
#define EFI_HII_FONT_STYLE_OUTLINE    0x00020000
#define EFI_HII_FONT_STYLE_SHADOW     0x00040000
#define EFI_HII_FONT_STYLE_UNDERLINE  0x00080000
#define EFI_HII_FONT_STYLE_DBL_UNDER  0x00100000

//
// EFI_HII_GLYPH_BLOCK.BlockType
// 
#define EFI_HII_GIBT_END            0x00
#define EFI_HII_GIBT_GLYPH          0x10
#define EFI_HII_GIBT_GLYPHS         0x11
#define EFI_HII_GIBT_GLYPH_DEFAULT  0x12
#define EFI_HII_GIBT_GLYPHS_DEFAULT 0x13
#define EFI_HII_GIBT_DUPLICATE      0x20
#define EFI_HII_GIBT_SKIP2          0x21 
#define EFI_HII_GIBT_SKIP1          0x22
#define EFI_HII_GIBT_DEFAULTS       0x23
#define EFI_HII_GIBT_EXT1           0x30
#define EFI_HII_GIBT_EXT2           0x31
#define EFI_HII_GIBT_EXT4           0x32

/**

  EFI_HII_GIBT_END block is found. When processing the glyph
  blocks, each block refers to the current character value
  (CharValueCurrent), which is initially set to one (1). Glyph
  blocks of an unknown type should be skipped. If they cannot be
  skipped, then processing halts.

**/
typedef struct _EFI_HII_GLYPH_BLOCK {
  UINT8 BlockType;
  UINT8 BlockBody[1];
} EFI_HII_GLYPH_BLOCK;


/**

  @param Width  Width of the character or character cell, in
                pixels. For fixed-pitch fonts, this is the same
                as the advance.

  @param Height   Height of the character or character cell, in
                  pixels.

  @param OffsetX  Offset to the horizontal edge of the character
                  cell.

  @param OffsetY  Offset to the vertical edge of the character
                  cell.

  @param AdvanceX   Number of pixels to advance to the right
                    when moving from the origin of the current
                    glyph to the origin of the next glyph.
   
**/
typedef struct _EFI_HII_GLYPH_INFO {
  UINT16  Width;
  UINT16  Height;
  INT16   OffsetX;
  INT16   OffsetY;
  INT16   AdvanceX;
} EFI_HII_GLYPH_INFO;


/**
   
  Changes the default cell information used for subsequent
  EFI_HII_GIBT_GLYPH_DEFAULT and EFI_HII_GIBT_GLYPHS_DEFAULT glyph
  blocks. The cell information described by Cell remains in effect
  until the next EFI_HII_GIBT_DEFAULTS is found. Prior to the
  first EFI_HII_GIBT_DEFAULTS block, the cell information in the
  fixed header are used.

  @param Header   Standard glyph block header, where
                  Header.BlockType = EFI_HII_GIBT_DEFAULTS.
  
  @param Cell   The new default cell information which will be
                applied to all subsequent GLYPH_DEFAULT and
                GLYPHS_DEFAULT blocks.

**/
typedef struct _EFI_HII_GIBT_DEFAULTS_BLOCK {
  EFI_HII_GLYPH_BLOCK   Header;
  EFI_HII_GLYPH_INFO    Cell;
} EFI_HII_GIBT_DEFAULTS_BLOCK;


/**
   
  Indicates that the glyph with character value CharValueCurrent
  has the same glyph as a previously defined character value and
  increments CharValueCurrent by one.

  @param Header   Standard glyph block header, where
                  Header.BlockType = EFI_HII_GIBT_DUPLICATE.

  @param CharValue  The previously defined character value with
                    the exact same glyph.

**/
typedef struct _EFI_HII_GIBT_DUPLICATE_BLOCK {
  EFI_HII_GLYPH_BLOCK   Header;
  CHAR16                CharValue;
} EFI_HII_GIBT_DUPLICATE_BLOCK;


/**
   
  Any glyphs with a character value greater than or equal to
  CharValueCurrent are empty.

  @param Header   Standard glyph block header, where
                  Header.BlockType = EFI_HII_GIBT_END.

**/
typedef struct _EFI_GLYPH_GIBT_END_BLOCK {
  EFI_HII_GLYPH_BLOCK   Header;
} EFI_GLYPH_GIBT_END_BLOCK;

/**
  
  These are reserved for future expansion, with length bytes
  included so that they can be easily skipped.

  @param Header   Standard glyph block header, where
                  Header.BlockType = EFI_HII_GIBT_EXT1,
                  EFI_HII_GIBT_EXT2 or EFI_HII_GIBT_EXT4.

  @param Length   Size of the glyph block, in bytes.

**/
typedef struct _EFI_HII_GIBT_EXT1_BLOCK {
  EFI_HII_GLYPH_BLOCK Header;
  UINT8               BlockType2;
  UINT8               Length;
} EFI_HII_GIBT_EXT1_BLOCK;


/**
  
  These are reserved for future expansion, with length bytes
  included so that they can be easily skipped.

  @param Header   Standard glyph block header, where
                  Header.BlockType = EFI_HII_GIBT_EXT1,
                  EFI_HII_GIBT_EXT2 or EFI_HII_GIBT_EXT4.

  @param Length   Size of the glyph block, in bytes.

**/
typedef struct _EFI_HII_GIBT_EXT2_BLOCK {
  EFI_HII_GLYPH_BLOCK Header;
  UINT8               BlockType2;
  UINT16              Length;
} EFI_HII_GIBT_EXT2_BLOCK;

/**
  
  These are reserved for future expansion, with length bytes
  included so that they can be easily skipped.

  @param Header   Standard glyph block header, where
                  Header.BlockType = EFI_HII_GIBT_EXT1,
                  EFI_HII_GIBT_EXT2 or EFI_HII_GIBT_EXT4.

  @param Length   Size of the glyph block, in bytes.

**/
typedef struct _EFI_HII_GIBT_EXT4_BLOCK {
  EFI_HII_GLYPH_BLOCK Header;
  UINT8               BlockType2;
  UINT32              Length;
} EFI_HII_GIBT_EXT4_BLOCK;


/**
   
  This block provides the bitmap for the character with the value
  CharValueCurrent and increments CharValueCurrent by one. Each
  glyph contains a glyph width and height, a drawing offset,
  number of pixels to advance after drawing and then the encoded
  bitmap.

  @param Header   Standard glyph block header, where
                  Header.BlockType = EFI_HII_GIBT_GLYPH.

  @param Cell   Contains the width and height of the encoded
                bitmap (Cell.Width and Cell.Height), the number
                of pixels (signed) right of the character cell
                origin where the left edge of the bitmap should
                be placed (Cell.OffsetX), the number of pixels
                above the character cell origin where the top
                edge of the bitmap should be placed
                (Cell.OffsetY) and the number of pixels (signed)
                to move right to find the origin for the next
                charactercell (Cell.AdvanceX).

  @param GlyphCount   The number of glyph bitmaps.

  @param BitmapData   The bitmap data specifies a series of
                      pixels, one bit per pixel, left-to-right,
                      top-tobottom. Each glyph bitmap only
                      encodes the portion of the bitmap enclosed
                      by its character-bounding box, but the
                      entire glyph is padded out to the nearest
                      byte. The number of bytes per bitmap can
                      be calculated as: ((Cell.Width + 7)/8) *
                      Cell.Height.


**/
typedef struct _EFI_HII_GIBT_GLYPH_BLOCK {
  EFI_HII_GLYPH_BLOCK   Header;
  EFI_HII_GLYPH_INFO    Cell;
  UINT16                GlyphCount;
  UINT8                 BitmapData[1];
} EFI_HII_GIBT_GLYPH_BLOCK;

/**
   
  Provides the bitmaps for the characters with the values
  CharValueCurrent through CharValueCurrent + Count -1 and
  increments CharValueCurrent by Count. These glyphs have
  identical cell information and the encoded bitmaps are exactly
  the same number of byes.

  @param Header   Standard glyph block header, where
                  Header.BlockType = EFI_HII_GIBT_GLYPHS.

  @param Cell     Contains the width and height of the encoded
                  bitmap (Cell.Width and Cell.Height), the
                  number of pixels (signed) right of the
                  character cell origin where the left edge of
                  the bitmap should be placed (Cell.OffsetX),
                  the number of pixels above the character cell
                  origin where the top edge of the bitmap should
                  be placed (Cell.OffsetY) and the number of
                  pixels(signed) to move right to find the
                  origin for the next character cell
                  (Cell.AdvanceX).

  @param BitmapData   The bitmap data specifies a series of
                      pixels, one bit per pixel, left-to-right,
                      top-tobottom, for each glyph. Each glyph
                      bitmap only encodes the portion of the
                      bitmap enclosed by its character-bounding
                      box. The number of bytes per bitmap can be
                      calculated as: ((Cell.Width + 7)/8) *
                      Cell.Height.

**/
typedef struct _EFI_HII_GIBT_GLYPHS_BLOCK {
  EFI_HII_GLYPH_BLOCK   Header;
  EFI_HII_GLYPH_INFO    Cell;
  UINT8                 BitmapData[1];
} EFI_HII_GIBT_GLYPHS_BLOCK;

/**
   
  Provides the bitmap for the character with the value
  CharValueCurrent and increments CharValueCurrent by 1. This
  glyph uses the default cell information. The default cell
  information is found in the font header or the most recently
  processed EFI_HII_GIBT_DEFAULTS.

  @param Header   Standard glyph block header, where
                  Header.BlockType = EFI_HII_GIBT_GLYPH_DEFAULT.

  @param BitmapData   The bitmap data specifies a series of
                      pixels, one bit per pixel, left-to-right,
                      top-tobottom. Each glyph bitmap only
                      encodes the portion of the bitmap enclosed
                      by its character-bounding box. The number
                      of bytes per bitmap can be calculated as:
                      ((Global.Cell.Width + 7)/8) *
                      Global.Cell.Height.

**/
typedef struct _EFI_HII_GIBT_GLYPH_DEFAULT_BLOCK {
  EFI_HII_GLYPH_BLOCK Header;
  UINT8               BitmapData[1];
} EFI_HII_GIBT_GLYPH_DEFAULT_BLOCK;




/**
   
  Provides the bitmaps for the characters with the values
  CharValueCurrent through CharValueCurrent + Count -1 and
  increments CharValueCurrent by Count. These glyphs use the
  default cell information and the encoded bitmaps have exactly
  the same number of byes.

  @param Header   Standard glyph block header, where
                  Header.BlockType =
                  EFI_HII_GIBT_GLYPHS_DEFAULT.

  @param Count    Number of glyphs in the glyph block.

  @param BitmapData   The bitmap data specifies a series of
                      pixels, one bit per pixel, left-to-right,
                      top-tobottom, for each glyph. Each glyph
                      bitmap only encodes the portion of the
                      bitmap enclosed by its character-bounding
                      box. The number of bytes per bitmap can be
                      calculated as: ((Global.Cell.Width + 7)/8)
                      Global.Cell.Height.

**/
typedef struct _EFI_HII_GIBT_GLYPHS_DEFAULT_BLOCK {
  EFI_HII_GLYPH_BLOCK Header;
  UINT16              Count;
  UINT8               BitmapData[1];
} EFI_HII_GIBT_GLYPHS_DEFAULT_BLOCK;

/**
   
  Increments the current character value CharValueCurrent by the
  number specified.

  @param Header   Standard glyph block header, where BlockType =
                  EFI_HII_GIBT_SKIP1 or EFI_HII_GIBT_SKIP2.

  @param SkipCount  The unsigned 8- or 16-bit value to add to
                    CharValueCurrent.

**/
typedef struct _EFI_HII_GIBT_SKIP2_BLOCK {
  EFI_HII_GLYPH_BLOCK Header;
  UINT16              SkipCount;
} EFI_HII_GIBT_SKIP2_BLOCK;


/**
   
  Increments the current character value CharValueCurrent by the
  number specified.

  @param Header   Standard glyph block header, where BlockType =
                  EFI_HII_GIBT_SKIP1 or EFI_HII_GIBT_SKIP2.

  @param SkipCount  The unsigned 8- or 16-bit value to add to
                    CharValueCurrent.

**/
typedef struct _EFI_HII_GIBT_SKIP1_BLOCK {
  EFI_HII_GLYPH_BLOCK Header;
  UINT8               SkipCount;
} EFI_HII_GIBT_SKIP1_BLOCK;


/**
   
  This package is created by NewPackageList() when the package
  list is first added to the HII database by locating the
  EFI_DEVICE_PATH_PROTOCOL attached to the driver handle passed in
  to that function.
  
**/
typedef EFI_DEVICE_PATH_PROTOCOL  EFI_HII_DEVICE_PATH_PACKAGE_HDR;


/**
   
  This is a free-form package type designed to allow extensibility
  by allowing the format to be specified using Guid.

  @param Guid   Identifier which describes the remaining data
                within the package.

**/
typedef struct _EFI_HII_GUID_PACKAGE_HDR {
  EFI_GUID Guid;
} EFI_HII_GUID_PACKAGE_HDR;


/**
   
  The Strings package record describes the mapping between string
  identifiers and the actual text of the strings themselves. The
  package consists of three parts: a fixed header, the string
  information and the font information.

  @param Header   The standard package header, where Header.Type
                  = EFI_HII_PACKAGE_STRINGS.

  @param HdrSize  Size of this header.

  @param StringInfoOffset   Offset, relative to the start of
                            this header, of the string information.

  @param LanguageWindow   Specifies the default values placed in
                          the static and dynamic windows before
                          processing each SCSU-encoded strings.


  @param LanguageName   String identifier within the current
                        string package of the full name of the
                        language specified by Language. Language
                        Language of the strings, as specified by
                        RFC 3066.

**/
typedef struct _EFI_HII_STRING_PACKAGE_HDR {
  EFI_HII_PACKAGE_HEADER  Header;
  UINT32                  HdrSize;
  UINT32                  StringInfoOffset;
  CHAR16                  LanguageWindow[16];
  EFI_STRING_ID           LanguageName;
  CHAR8 Language[1];
} EFI_HII_STRING_PACKAGE_HDR;



/**

  The fixed header consists of a standard record header and then
  the character values in this section, the flags (including the
  encoding method) and the offsets of the glyph information, the
  glyph bitmaps and the character map.

  @param Header   The standard package header, where Header.Size
                  EFI_HII_PACKAGE_FONTS.

  @param HdrSize  Size of this header.

  @param GlyphInfoOffset  The offset, relative to the start of
                          this header, of a series of
                          variable-length glyph blocks, each
                          describing information about the
                          bitmap associated with a glyph.

  @param Cell   This contains the measurement of the widest and
                tallest characters in the font (Cell.Width and
                Cell.Height). It also contains the offset to the
                horizontal and vertical origin point of the
                character cell (Cell.OffsetX and Cell.OffsetY).
                Finally, it contains the default AdvanceX. The
                individual glyph's OffsetX and OffsetY value is
                added to this position to determine where to
                draw the top-left pixel of the character's
                glyph. The character glyph's AdvanceX is added
                to this position to determine the origin point
                for the next character.

  @param FontStyle  The design style of the font, 1 bit per
                    style. See EFI_HII_FONT_STYLE.

  @param FontFamily   The null-terminated string with the name
                      of the font family to which the font
                      belongs.

**/
typedef struct _EFI_HII_FONT_PACKAGE_HDR {
  EFI_HII_PACKAGE_HEADER  Header;
  UINT32                  HdrSize;
  UINT32                  GlyphBlockOffset;
  EFI_HII_GLYPH_INFO      Cell;
  EFI_HII_FONT_STYLE      FontStyle;
  CHAR16                  FontFamily[1];
} EFI_HII_FONT_PACKAGE_HDR;


//
// EFI_HII_STRING_BLOCK.BlockType
// 
#define FI_HII_SIBT_END                 0x00
#define EFI_HII_SIBT_STRING_SCSU        0x10
#define EFI_HII_SIBT_STRING_SCSU_FONT   0x11
#define EFI_HII_SIBT_STRINGS_SCSU       0x12
#define EFI_HII_SIBT_STRINGS_SCSU_FONT  0x13
#define EFI_HII_SIBT_STRING_UCS2        0x14
#define EFI_HII_SIBT_STRING_UCS2_FONT   0x15
#define EFI_HII_SIBT_STRINGS_UCS2       0x16
#define EFI_HII_SIBT_STRINGS_UCS2_FONT  0x17
#define EFI_HII_SIBT_DUPLICATE          0x20
#define EFI_HII_SIBT_SKIP2              0x21
#define EFI_HII_SIBT_SKIP1              0x22
#define EFI_HII_SIBT_EXT1               0x30
#define EFI_HII_SIBT_EXT2               0x31
#define EFI_HII_SIBT_EXT4               0x32
#define EFI_HII_SIBT_FONT               0x40

/**
   
  String blocks specify the text and font for the current string
  identifier and increment to the next string identifier.
**/
typedef struct {
  UINT8   BlockType;
  UINT8   BlockBody[1];
} EFI_HII_STRING_BLOCK;


/**
   
  Indicates that the string with string identifier
  StringIdCurrent is the same as a previously defined string and
  increments StringIdCurrent by one.
  
  @param Header   Standard string block header, where
                  Header.BlockType = EFI_HII_SIBT_DUPLICATE.
  
  @param StringId   The string identifier of a previously
                    defined string with the exact same string
                    text. Description


**/
typedef struct _EFI_HII_SIBT_DUPLICATE_BLOCK {
  EFI_HII_STRING_BLOCK  Header;
  EFI_STRING_ID         StringId;
} EFI_HII_SIBT_DUPLICATE_BLOCK;

/**
   
  Any strings with a string identifier greater than or equal to
  StringIdCurrent are empty.

  @param Header   Standard string block header, where
                  Header.BlockType = EFI_HII_SIBT_END.

**/
typedef struct _EFI_HII_SIBT_END_BLOCK {
  EFI_HII_STRING_BLOCK  Header;
} EFI_HII_SIBT_END_BLOCK;


/**
   
  These are reserved for future expansion, with length bytes
  included so that they can be easily skip

  @param Header   Standard string block header, where
                  Header.BlockType = EFI_HII_SIBT_EXT1,
                  EFI_HII_SIBT_EXT2 or EFI_HII_SIBT_EXT4.
  
  @param Length   Size of the string block, in bytes.

**/
typedef struct _EFI_HII_SIBT_EXT1_BLOCK {
  EFI_HII_STRING_BLOCK  Header;
  UINT8                 BlockType2;
  UINT8                 Length;
} EFI_HII_SIBT_EXT1_BLOCK;

/**
   
  These are reserved for future expansion, with length bytes
  included so that they can be easily skip

  @param Header   Standard string block header, where
                  Header.BlockType = EFI_HII_SIBT_EXT1,
                  EFI_HII_SIBT_EXT2 or EFI_HII_SIBT_EXT4.
  
  @param Length   Size of the string block, in bytes.

**/
typedef struct _EFI_HII_SIBT_EXT2_BLOCK {
  EFI_HII_STRING_BLOCK  Header;
  UINT8                 BlockType2;
  UINT16                Length;
} EFI_HII_SIBT_EXT2_BLOCK;

/**
   
  These are reserved for future expansion, with length bytes
  included so that they can be easily skip

  @param Header   Standard string block header, where
                  Header.BlockType = EFI_HII_SIBT_EXT1,
                  EFI_HII_SIBT_EXT2 or EFI_HII_SIBT_EXT4.
  
  @param Length   Size of the string block, in bytes.

**/
typedef struct _EFI_HII_SIBT_EXT4_BLOCK {
  EFI_HII_STRING_BLOCK  Header;
  UINT8                 BlockType2;
  UINT32                Length;
} EFI_HII_SIBT_EXT4_BLOCK;

/**
   
  Associates a font identifier FontId with a font name FontName,
  size FontSize and style FontStyle. This font identifier may be
  used with the string blocks. The font identifier 0 is the
  default font for those string blocks which do not specify a font
  identifier.

  @param Header   Standard extended header, where
                  Header.BlockType = EFI_HII_SIBT_FONT.

  @param FontId   Font identifier, which must be unique within
                  the font package.

  @param FontSize   Character cell size, in pixels, of the font.

  @param FontStyle  Font style.

  @param FontName   Null-terminated font family name.

**/
typedef struct _EFI_HII_SIBT_FONT_BLOCK {
  EFI_HII_SIBT_EXT2_BLOCK   Header;
  UINT8                     FontId;
  UINT16                    FontSize;
  EFI_HII_FONT_STYLE        FontStyle;
  CHAR16                    FontName[1];
} EFI_HII_SIBT_FONT_BLOCK;

/**
   
  Increments the current string identifier StringIdCurrent by the
  number specified.

  @param Header   Standard string block header, where
                  Header.BlockType = EFI_HII_SIBT_SKIP1.
  
  @param SkipCount  The unsigned 8-bit value to add to
                    StringIdCurrent.

**/
typedef struct _EFI_HII_SIBT_SKIP1_BLOCK {
  EFI_HII_STRING_BLOCK  Header;
  UINT8                 SkipCount;
} EFI_HII_SIBT_SKIP1_BLOCK;

/**

  Increments the current string identifier StringIdCurrent by
  the number specified.

  @param Header   Standard string block header, where
                  Header.BlockType = EFI_HII_SIBT_SKIP2.

  @param SkipCount  The unsigned 16-bit value to add to
                    StringIdCurrent.

**/
typedef struct _EFI_HII_SIBT_SKIP2_BLOCK {
  EFI_HII_STRING_BLOCK  Header;
  UINT16                SkipCount;
} EFI_HII_SIBT_SKIP2_BLOCK;

/**
   
  This string block provides the SCSU-encoded text for the string
  in the default font with string identifier StringIdCurrent and
  increments StringIdCurrent by one.

  @param Header   Standard header where Header.BlockType =
                  EFI_HII_SIBT_STRING_SCSU.

  @param StringText   The string text is a null-terminated
                      string, which is assigned to the string
                      identifier StringIdCurrent.

**/
typedef struct _EFI_HII_SIBT_STRING_SCSU_BLOCK {
  EFI_HII_STRING_BLOCK Header;
  UINT8 StringText[1];
} EFI_HII_SIBT_STRING_SCSU_BLOCK;


/**

  This string block provides the SCSU-encoded text for the string
  in the font specified by FontIdentifier with string identifier
  StringIdCurrent and increments StringIdCurrent by one.

  @param Header   Standard string block header, where
                  Header.BlockType = EFI_HII_SIBT_STRING_SCSU_FONT.

  @param FontIdentifier   The identifier of the font to be used
                          as the starting font for the entire
                          string. The identifier must either be
                          0 for the default font or an
                          identifier previously specified by an
                          EFI_HII_SIBT_FONT block. Any string
                          characters that deviates from this
                          font family, size or style must
                          provide an explicit control character.

  @param StringText   The string text is a null-terminated
                      encoded string, which is assigned to the
                      string identifier StringIdCurrent.


**/
typedef struct _EFI_HII_SIBT_STRING_SCSU_FONT_BLOCK {
  EFI_HII_STRING_BLOCK  Header;
  UINT8                 FontIdentifier;
  UINT8                 StringText[1];
} EFI_HII_SIBT_STRING_SCSU_FONT_BLOCK;


/**
   
  This string block provides the SCSU-encoded text for StringCount
  strings which have the default font and which have sequential
  string identifiers. The strings are assigned the identifiers,
  starting with StringIdCurrent and continuing through
  StringIdCurrent + StringCount ??C 1. StringIdCurrent is
  incremented by StringCount.

  @param Header   Standard header where Header.BlockType =
                  EFI_HII_SIBT_STRINGS_SCSU.

  @param StringCount  Number of strings in StringText.

  @param StringText   The strings, where each string is a
                      null-terminated encoded string.

**/
typedef struct _EFI_HII_SIBT_STRINGS_SCSU_BLOCK {
  EFI_HII_STRING_BLOCK  Header;
  UINT16                StringCount;
  UINT8                 StringText[1];
} EFI_HII_SIBT_STRINGS_SCSU_BLOCK;


/**
   
  This string block provides the SCSU-encoded text for StringCount
  strings which have the font specified by FontIdentifier and
  which have sequential string identifiers. The strings are
  assigned the identifiers, starting with StringIdCurrent and
  continuing through StringIdCurrent + StringCount ??C 1.
  StringIdCurrent is incremented by StringCount.

  @param Header   Standard header where Header.BlockType =
                  EFI_HII_SIBT_STRINGS_SCSU_FONT.

  @param StringCount  Number of strings in StringText.

  @param FontIdentifier   The identifier of the font to be used
                          as the starting font for the entire
                          string. The identifier must either be
                          0 for the default font or an
                          identifier previously specified by an
                          EFI_HII_SIBT_FONT block. Any string
                          characters that deviates from this
                          font family, size or style must
                          provide an explicit control character.

  @param StringText   The strings, where each string is a
                      null-terminated encoded string.

**/
typedef struct _EFI_HII_SIBT_STRINGS_SCSU_FONT_BLOCK {
  EFI_HII_STRING_BLOCK  Header;
  UINT16                StringCount;
  UINT8                 FontIdentifier;
  UINT8                 StringText[1];
} EFI_HII_SIBT_STRINGS_SCSU_FONT_BLOCK;


/**
   
  This string block provides the UCS-2 encoded text for the string
  in the default font with string identifier StringIdCurrent and
  increments StringIdCurrent by one.

  @param Header   Standard header where Header.BlockType =
                  EFI_HII_SIBT_STRING_UCS2.

  @param StringText   The string text is a null-terminated UCS-2
                      string, which is assigned to the string
                      identifier StringIdCurrent.

**/
typedef struct _EFI_HII_SIBT_STRING_UCS2_BLOCK {
  EFI_HII_STRING_BLOCK  Header;
  CHAR16                StringText[1];
} EFI_HII_SIBT_STRING_UCS2_BLOCK;


/**
   
  This string block provides the UCS-2 encoded text for the string
  in the font specified by FontIdentifier with string identifier
  StringIdCurrent and increments StringIdCurrent by one

  @param Header   Standard header where Header.BlockType =
                  EFI_HII_SIBT_STRING_UCS2_FONT.

  @param FontIdentifier   The identifier of the font to be used
                          as the starting font for the entire
                          string. The identifier must either be
                          0 for the default font or an
                          identifier previously specified by an
                          EFI_HII_SIBT_FONT block. Any string
                          characters that deviates from this
                          font family, size or style must
                          provide an explicit control character.

  @param StringText   The string text is a null-terminated UCS-2
                      string, which is assigned to the string
                      identifier StringIdCurrent.

**/
typedef struct _EFI_HII_SIBT_STRING_UCS2_FONT_BLOCK {
  EFI_HII_STRING_BLOCK  Header;
  UINT8                 FontIdentifier;
  CHAR16                StringText[1];
} EFI_HII_SIBT_STRING_UCS2_FONT_BLOCK;


/**
   
  This string block provides the UCS-2 encoded text for the
  strings in the default font with string identifiers
  StringIdCurrent to StringIdCurrent + StringCount - 1 and
  increments StringIdCurrent by StringCount.

  @param Header   Standard header where Header.BlockType =
                  EFI_HII_SIBT_STRINGS_UCS2.

  @param StringCount  Number of strings in StringText.

  @param StringText   The string text is a series of
                      null-terminated UCS-2 strings, which are
                      assigned to the string identifiers
                      StringIdCurrent.to StringIdCurrent +
                      StringCount - 1.
  
**/
typedef struct _EFI_HII_SIBT_STRINGS_UCS2_BLOCK {
  EFI_HII_STRING_BLOCK  Header;
  UINT16                StringCount;
  CHAR16                StringText[1];
} EFI_HII_SIBT_STRINGS_UCS2_BLOCK;


/**
   
  The fixed header consists of a standard record header and the
  offsets of the image and palette information.

  @param Header   Standard package header, where Header.Type =
                  EFI_HII_PACKAGE_IMAGES. ImageInfoOffset
                  Offset, relative to this header, of the image
                  information. If this is zero, then there are
                  no images in the package.

  @param PaletteInfoOffset  Offset, relative to this header, of
                            the palette information. If this is
                            zero, then there are no palettes in
                            the image package.

**/
typedef struct _EFI_HII_IMAGE_PACKAGE_HDR {
  EFI_HII_PACKAGE_HEADER  Header;
  UINT32                  ImageInfoOffset;
  UINT32                  PaletteInfoOffset;
} EFI_HII_IMAGE_PACKAGE_HDR;


//
// EFI_HII_IMAGE_BLOCK
// 
typedef struct _EFI_HII_IMAGE_BLOCK {
  UINT8   BlockType;
  UINT8   BlockBody[1];
} EFI_HII_IMAGE_BLOCK;

//
// EFI_HII_IMAGE_BLOCK.BlockType.
// 
#define EFI_HII_IIBT_END                0x00
#define EFI_HII_IIBT_IMAGE_1BIT         0x10
#define EFI_HII_IIBT_IMAGE_1BIT_TRANS   0x11
#define EFI_HII_IIBT_IMAGE_4BIT         0x12
#define EFI_HII_IIBT_IMAGE_4BIT_TRANS   0x13
#define EFI_HII_IIBT_IMAGE_8BIT         0x14
#define EFI_HII_IIBT_IMAGE_8BIT_TRANS   0x15
#define EFI_HII_IIBT_IMAGE_24BIT        0x16
#define EFI_HII_IIBT_IMAGE_24BIT_TRANS  0x17
#define EFI_HII_IIBT_IMAGE_JPEG         0x18
#define EFI_HII_IIBT_DUPLICATE          0x20
#define EFI_HII_IIBT_SKIP2              0x21
#define EFI_HII_IIBT_SKIP1              0x22
#define EFI_HII_IIBT_EXT1               0x30
#define EFI_HII_IIBT_EXT2               0x31
#define EFI_HII_IIBT_EXT4               0x32


/**
   
  Any images with an image identifier greater than or equal to
  ImageIdCurrent are empty.

  @param Header   Standard image block header, where
                  Header.BlockType = EFI_HII_IIBT_END.

**/
typedef struct _EFI_HII_IIBT_END_BLOCK {
  EFI_HII_IMAGE_BLOCK   Header;
} EFI_HII_IIBT_END_BLOCK;


/**
   
  Future extensions for image records which need a length-byte
  length use this prefix.

  @param Header   Standard image block header, where
                  Header.BlockType = EFI_HII_IIBT_EXT1,
                  EFI_HII_IIBT_EXT2 or EFI_HII_IIBT_EXT4.
  
  @param Length   Size of the image block, in bytes, including
                  the image block header.

**/
typedef struct _EFI_HII_IIBT_EXT1_BLOCK {
  EFI_HII_IMAGE_BLOCK Header;
  UINT8               BlockType2;
  UINT8               Length;
} EFI_HII_IIBT_EXT1_BLOCK;

/**
   
  Future extensions for image records which need a length-byte
  length use this prefix.

  @param Header   Standard image block header, where
                  Header.BlockType = EFI_HII_IIBT_EXT1,
                  EFI_HII_IIBT_EXT2 or EFI_HII_IIBT_EXT4.
  
  @param Length   Size of the image block, in bytes, including
                  the image block header.

**/
typedef struct _EFI_HII_IIBT_EXT2_BLOCK {
  EFI_HII_IMAGE_BLOCK Header;
  UINT8               BlockType2;
  UINT16              Length;
} EFI_HII_IIBT_EXT2_BLOCK;

/**
   
  Future extensions for image records which need a length-byte
  length use this prefix.

  @param Header   Standard image block header, where
                  Header.BlockType = EFI_HII_IIBT_EXT1,
                  EFI_HII_IIBT_EXT2 or EFI_HII_IIBT_EXT4.
  
  @param Length   Size of the image block, in bytes, including
                  the image block header.

**/
typedef struct _EFI_HII_IIBT_EXT4_BLOCK {
  EFI_HII_IMAGE_BLOCK Header;
  UINT8               BlockType2;
  UINT32              Length;
} EFI_HII_IIBT_EXT4_BL0CK;

//
// EFI_HII_IIBT_IMAGE_1BIT_BASE
// 
typedef struct _EFI_HII_IIBT_IMAGE_1BIT_BASE {
  UINT16 Width;
  UINT16 Height;
  // UINT8 Data[...];
} EFI_HII_IIBT_IMAGE_1BIT_BASE;

/**

  This record assigns the 1-bit-per-pixel bitmap data to the
  ImageIdCurrent identifier and increment ImageIdCurrent by one.
  The data in the EFI_HII_IMAGE_1BIT_TRANS structure is exactly
  the same as the EFI_HII_IMAGE_1BIT structure, the difference is
  how the data is treated. The bitmap pixel value 0 is the
  transparency value and will not be written to the
  screen. The bitmap pixel value 1 will be translated to the color
  specified by Palette.

  @param Header   Standard image header, where Header.BlockType
                  = EFI_HII_IIBT_IMAGE_1BIT_TRANS.

  @param PaletteIndex   Index of the palette in the palette
                        information.

  @param Bitmap   The bitmap specifies a series of pixels, one
                  bit per pixel, left-to-right, top-to-bottom,
                  and is padded out to the nearest byte. The
                  number of bytes per bitmap can be calculated
                  as: ((Width + 7)/8) * Height.

**/
typedef struct _EFI_HII_IBIT_IMAGE_1BIT_BLOCK {
  EFI_HII_IMAGE_BLOCK           Header;
  UINT8                         PaletteIndex;
  EFI_HII_IIBT_IMAGE_1BIT_BASE  Bitmap;
} EFI_HII_IIBT_IMAGE_1BIT_BLOCK;

typedef EFI_HII_IIBT_IMAGE_1BIT_BLOCK   EFI_HII_IIBT_IMAGE_1BIT_TRANS_BLOCK;


//
// EFI_HII_RGB_PIXEL
// 
typedef struct _EFI_HII_RGB_PIXEL {
  UINT8 b;
  UINT8 g;
  UINT8 r;
} EFI_HII_RGB_PIXEL;

//
// FI_HII_IIBT_IMAGE_24BIT_BASE
// 
typedef struct _EFI_HII_IIBT_IMAGE_24BIT_BASE {
  UINT16 Width;
  UINT16 Height;
  // EFI_HII_RGB_PIXEL Bitmap[...];
} EFI_HII_IIBT_IMAGE_24BIT_BASE;

/**

  This record assigns the 24-bit-per-pixel bitmap data to the   
  ImageIdCurrent identifier and increment ImageIdCurrent by one.   
  The image's upper left hand corner pixel is composed of the
  first three bitmap bytes. The first byte is the pixel????s blue   
  component value, the next byte is the pixel????s green component   
  value, and the third byte is the pixel's red component value
  (B,G,R). Each color component value can vary from 0x00 (color   
  off) to 0xFF (color full on), allowing 16.8 millions colors that   
  can be specified.

  @param Header   Standard image header, where Header.BlockType
                  = EFI_HII_IIBT_IMAGE_24BIT. Bitmap The bitmap
                  specifies a series of pixels, 24 bits per
                  pixel, left-to-right, top-to-bottom. The
                  number of bytes per bitmap can be calculated
                  as: (Width * 3) * Height.

  @param Type     See EFI_HII_RGB_PIXEL definition.

**/
typedef struct {
  EFI_HII_IMAGE_BLOCK           Header;
  EFI_HII_IIBT_IMAGE_24BIT_BASE Bitmap;
} EFI_HII_IIBT_IMAGE_24BIT_BLOCK;

typedef EFI_HII_IIBT_IMAGE_24BIT_BLOCK EFI_HII_IIBT_IMAGE_24BIT_TRANS_BLOCK;



//
// EFI_HII_IIBT_IMAGE_4BIT_BASE
// 
typedef struct _EFI_HII_IIBT_IMAGE_4BIT_BASE {
  UINT16 Width;
  UINT16 Height;
  // UINT8 Data[...];
} EFI_HII_IIBT_IMAGE_4BIT_BASE;

/**
   
  This record assigns the 4-bit-per-pixel bitmap data to the
  ImageIdCurrent identifier using the specified palette and
  increment ImageIdCurrent by one. The image????s upper left hand
  corner pixel is the most significant nibble of the first bitmap
  byte.

  @param Header   Standard image header, where Header.BlockType
                  = EFI_HII_IIBT_IMAGE_4BIT.

  @param PaletteIndex   Index of the palette in the palette
                        information.

  @param Bitmap   The bitmap specifies a series of pixels, four
                  bits per pixel, left-to-right, top-to-bottom,
                  and is padded out to the nearest byte. The
                  number of bytes per bitmap can be calculated
                  as: ((Width + 1)/2) Height.

**/
typedef struct _EFI_HII_IIBT_IMAGE_4BIT_BLOCK {
  EFI_HII_IMAGE_BLOCK           Header;
  UINT8                         PaletteIndex;
  EFI_HII_IIBT_IMAGE_4BIT_BASE  Bitmap;
} EFI_HII_IIBT_IMAGE_4BIT_BLOCK;

typedef EFI_HII_IIBT_IMAGE_4BIT_BLOCK EFI_HII_IIBT_IMAGE_4BIT_TRANS_BLOCK;



//
// EFI_HII_IIBT_IMAGE_8BIT_BASE 
// 
typedef struct _EFI_HII_IIBT_IMAGE_8BIT_BASE {
  UINT16  Width;
  UINT16  Height;
  // UINT8 Data[...];
} EFI_HII_IIBT_IMAGE_8BIT_BASE;

/**
   
  This record assigns the 8-bit-per-pixel bitmap data to the
  ImageIdCurrent identifier using the specified palette and
  increment ImageIdCurrent by one. The image????s upper left hand
  corner pixel is the first bitmap byte.

  @param Header   Standard image header, where Header.BlockType
                  = EFI_HII_IIBT_IMAGE_8BIT.

  @param PaletteIndex   Index of the palette in the palette
                        information.

  @param Bitmap   The bitmap specifies a series of pixels, eight
                  bits per pixel, left-to-right, top-to-bottom.
                  The number of bytes per bitmap can be
                  calculated as: Width * Height.

**/
typedef struct _EFI_HII_IIBT_IMAGE_8BIT_PALETTE {
  EFI_HII_IMAGE_BLOCK           Header;
  UINT8                         PaletteIndex;
  EFI_HII_IIBT_IMAGE_8BIT_BASE  Bitmap;
} EFI_HII_IIBT_IMAGE_8BIT_PALETTE;

typedef EFI_HII_IIBT_IMAGE_8BIT_PALETTE   EFI_HII_IIBT_IMAGE_8BIT_TRANS_BLOCK;


/**
   
  Indicates that the image with image ID ImageValueCurrent has the
  same image as a previously defined image ID and increments
  ImageValueCurrent by one

  @param Header   Standard image header, where Header.BlockType
                  = EFI_HII_IIBT_DUPLICATE.

  @param ImageId  The previously defined image ID with the exact
                  same image.


**/
typedef struct _EFI_HII_IIBT_DUPLICATE_BLOCK {
  EFI_HII_IMAGE_BLOCK   Header;
  EFI_IMAGE_ID          ImageId;
} EFI_HII_IIBT_DUPLICATE_BLOCK;


/**
   
  This record assigns the JPEG image data to the ImageIdCurrent
  identifier and increment ImageIdCurrent by one. The JPEG decoder
  is only required to cover the basic JPEG encoding types, which
  are produced by standard available paint packages (for example:
  MSPaint under Windows from Microsoft). This would include JPEG
  encoding of high (1:1:1) and medium (4:1:1) quality with only
  three components (R,G,B) ??C no support for the special gray
  component encoding.

  @param Header   Standard image header, where Header.BlockType
                  = EFI_HII_IIBT_IMAGE_JPEG.
  
  @param Size   Specifies the size of the JPEG encoded data.
  
  @param Data   JPEG encoded data with ????JFIF???? signature at
                offset 6 in the data block. The JPEG encoded
                data, specifies type of encoding and final size
                of true-color image.

**/
typedef struct _EFI_HII_IIBT_JPEG {
  EFI_HII_IMAGE_BLOCK Header;
  UINT32              Size;
  //UINT8 Data[ ¡­ ];
} EFI_HII_IIBT_JPEG;


/**
   
  Increments the current image ID ImageIdCurrent by the number
  specified.
  
  @param Header   Standard image header, where Header.BlockType
                  = EFI_HII_IIBT_SKIP1.
  
  @param SkipCount  The unsigned 8-bit value to add  to
                    ImageIdCurrent.

**/
typedef struct _EFI_HII_IIBT_SKIP1_BLOCK {
  EFI_HII_IMAGE_BLOCK Header;
  UINT8               SkipCount;
} EFI_HII_IIBT_SKIP1_BLOCK;

/**
  
  Increments the current image ID ImageIdCurrent by the number
  specified.
  
  @param Header   Standard image header, where Header.BlockType
                  = EFI_HII_IIBT_SKIP2.
  
  @param SkipCount  The unsigned 16-bit value to add to
                    ImageIdCurrent.

**/
typedef struct _EFI_HII_IIBT_SKIP2_BLOCK {
  EFI_HII_IMAGE_BLOCK   Header;
  UINT16                SkipCount;
} EFI_HII_IIBT_SKIP2_BLOCK;


/**
   
  This fixed header is followed by zero or more variable-length
  palette information records. The structures are assigned a
  number 1 to n.

  @param PaletteCount   Number of palettes.

**/
typedef struct _EFI_HII_IMAGE_PALETTE_INFO_HEADER {
  UINT16  PaletteCount;
} EFI_HII_IMAGE_PALETTE_INFO_HEADER;

/**
   
  Each palette information record is an array of 24-bit color
  structures. The first entry (PaletteValue[0]) corresponds to
  color 0 in the source image; the second entry (PaletteValue[1])
  corresponds to color 1, etc. Each palette entry is a three byte
  entry, with the first byte equal to the blue component of the
  color, followed by green, and finally red (B,G,R). Each color
  component value can vary from 0x00 (color off) to 0xFF (color
  full on), allowing 16.8 millions colors that can be specified.

  @param PaletteSize  Size of the palette information.
  
  @param PaletteValue   Array of color values.
  
**/
typedef struct _EFI_HII_IMAGE_PALETTE_INFO {
  UINT16 PaletteSize;
  // EFI_HII_RGB_PIXEL PaletteValue[...];
} EFI_HII_IMAGE_PALETTE_INFO;



//
// EFI_HII_DATABASE_NOTIFY_TYPE
// 
typedef UINTN   EFI_HII_DATABASE_NOTIFY_TYPE;
#define EFI_HII_DATABASE_NOTIFY_NEW_PACK    0x00000001
#define EFI_HII_DATABASE_NOTIFY_REMOVE_PACK 0x00000002
#define EFI_HII_DATABASE_NOTIFY_EXPORT_PACK 0x00000004
#define EFI_HII_DATABASE_NOTIFY_ADD_PACK    0x00000008
/**
   
  Functions which are registered to receive notification of
  database events have this prototype. The actual event is encoded
  in NotifyType. The following table describes how PackageType,
  PackageGuid, Handle, and Package are used for each of the
  notification types.

  @param PackageType  Package type of the notification.

  @param PackageGuid  If PackageType is
                      EFI_HII_PACKAGE_TYPE_GUID, then this is
                      the pointer to the GUID from the Guid
                      field of EFI_HII_PACKAGE_GUID_HEADER.
                      Otherwise, it must be NULL.

  @param Package  Points to the package referred to by the
                  notification Handle The handle of the package
                  list which contains the specified package.

  @param NotifyType   The type of change concerning the
                      database. See
                      EFI_HII_DATABASE_NOTIFY_TYPE.

**/
typedef
EFI_STATUS
(EFIAPI *EFI_HII_DATABASE_NOTIFY) (
  IN CONST  UINT8                         PackageType,
  IN CONST  EFI_GUID                      *PackageGuid,
  IN CONST  EFI_HII_PACKAGE_HEADER        *Package,
  IN CONST  EFI_HII_HANDLE                Handle,
  IN CONST  EFI_HII_DATABASE_NOTIFY_TYPE  NotifyType
);

/**

  This function adds the packages in the package list to the
  database and returns a handle. If there is a
  EFI_DEVICE_PATH_PROTOCOL associated with the DriverHandle, then
  this function will create a package of type
  EFI_PACKAGE_TYPE_DEVICE_PATH and add it to the package list. For
  each package in the package list, registered functions with the
  notification type NEW_PACK and having the same package type will
  be called. For each call to NewPackageList(), there should be a
  corresponding call to
  EFI_HII_DATABASE_PROTOCOL.RemovePackageList().

  @param This   A pointer to the EFI_HII_DATABASE_PROTOCOL
                instance.

  @param PackageList  A pointer to an
                      EFI_HII_PACKAGE_LIST_HEADER structure.

  @param DriverHandle   Associate the package list with this EFI
                        handle Handle A pointer to the
                        EFI_HII_HANDLE instance.

  @retval EFI_SUCCESS   The package list associated with the
                        Handle was added to the HII database.

  @retval EFI_OUT_OF_RESOURCES  Unable to allocate necessary
                                resources for the new database
                                contents.

  @retval EFI_INVALID_PARAMETER   PackageList is NULL or Handle
                                  is NULL.

**/
typedef
EFI_STATUS
(EFIAPI *EFI_HII_NEW_PACK) (
  IN CONST  EFI_HII_DATABASE_PROTOCOL   *This,
  IN CONST  EFI_HII_PACKAGE_LIST_HEADER *PackageList,
  IN CONST  EFI_HANDLE                  DriverHandle,
  OUT       EFI_HII_HANDLE              *Handle
);


/**

  This function removes the package list that is associated with a
  handle Handle from the HII database. Before removing the
  package, any registered functions with the notification type
  REMOVE_PACK and the same package type will be called. For each
  call to EFI_HII_DATABASE_PROTOCOL.NewPackageList(), there should
  be a corresponding call to RemovePackageList.

  @param This   A pointer to the EFI_HII_DATABASE_PROTOCOL
                instance.
  
  @param Handle   The handle that was registered to the data
                  that is requested for removal.
  
  @retval EFI_SUCCESS   The data associated with the Handle was
                        removed from the HII database.
  
  @retval EFI_INVALID_PARAMETER   The Handle was not valid.

**/
typedef
EFI_STATUS
(EFIAPI *EFI_HII_REMOVE_PACK) (
  IN CONST  EFI_HII_DATABASE_PROTOCOL *This,
  IN CONST  EFI_HII_HANDLE            Handle
);


/**
   
  This function updates the existing package list (which has the
  specified Handle) in the HII databases, using the new package
  list specified by PackageList. The update process has the
  following steps: Collect all the package types in the package
  list specified by PackageList. A package type consists of the
  Type field of EFI_HII_PACKAGE_HEADER and, if the Type is
  EFI_HII_PACKAGE_TYPE_GUID, the Guid field, as defined in
  EFI_HII_PACKAGE_GUID_HEADER. Iterate through the packages within
  the existing package list in the HII database specified by
  Handle. If a package??s type matches one of the types collected
  in step 1, then perform the following steps:
  - Call any functions registered with the notification type
  REMOVE_PACK.
  - Remove the package from the package list and the HII
  database.
  Add all of the packages within the new package list specified
  by PackageList, using the following steps:
  - Add the package to the package list and the HII database.
  - Call any functions registered with the notification type
  ADD_PACK.

  @param This   A pointer to the EFI_HII_DATABASE_PROTOCOL
                instance.
  
  @param Handle   The handle that was registered to the data
                  that is requested for removal.
  
  @param PackageList  A pointer to an EFI_HII_PACKAGE_LIST
                      package.
  
  @retval EFI_SUCCESS   The HII database was successfully
                        updated.
  
  @retval EFI_OUT_OF_RESOURCES  Unable to allocate enough memory
                                for the updated database.
  
  @retval EFI_INVALID_PARAMETER   The Handle was not valid.

**/
typedef
EFI_STATUS
(EFIAPI *EFI_HII_UPDATE_PACK) (
  IN CONST  EFI_HII_DATABASE_PROTOCOL   *This,
  IN CONST  EFI_HII_HANDLE              Handle,
  IN CONST  EFI_HII_PACKAGE_LIST_HEADER *PackageList
);


/**
  
  This function returns a list of the package handles of the   
  specified type that are currently active in the database. The   
  pseudo-type EFI_HII_PACKAGE_TYPE_ALL will cause all package   
  handles to be listed.
  
  @param This   A pointer to the EFI_HII_DATABASE_PROTOCOL
                instance.
  
  @param PackageType  Specifies the package type of the packages
                      to list or EFI_HII_PACKAGE_TYPE_ALL for
                      all packages to be listed.
  
  @param PackageGuid  If PackageType is
                      EFI_HII_PACKAGE_TYPE_GUID, then this is
                      the pointer to the GUID which must match
                      the Guid field of
                      EFI_HII_PACKAGE_GUID_HEADER. Otherwise, it
                      must be NULL.
  
  @param HandleBufferLength   On input, a pointer to the length
                              of the handle buffer. On output,
                              the length of the handle buffer
                              that is required for the handles
                              found.

  @param Handle   An array of EFI_HII_HANDLE instances returned.


  @retval EFI_SUCCESS   Handle was updated successfully.

  @retval EFI_BUFFER_TOO_SMALL  The HandleBufferLength parameter
                                indicates that Handle is too
                                small to support the number of
                                handles. HandleBufferLength is
                                updated with a value that will
                                enable the data to fit.


**/
typedef
EFI_STATUS
(EFIAPI *EFI_HII_LIST_PACKS) (
  IN CONST  EFI_HII_DATABASE_PROTOCOL *This,
  IN CONST  UINT8                     PackageType,
  IN CONST  EFI_GUID                  *PackageGuid,
  IN OUT    UINTN                     *HandleBufferLength,
  OUT       EFI_HII_HANDLE            *Handle
);






/**

  This function will export one or all package lists in the
  database to a buffer. For each package list exported, this
  function will call functions registered with EXPORT_PACK and
  then copy the package list to the buffer. The registered
  functions may call EFI_HII_DATABASE_PROTOCOL.UpdatePackageList()
  to modify the package list before it is copied to the buffer. If
  the specified BufferSize is too small, then the status
  EFI_OUT_OF_RESOURCES will be returned and the actual package
  size will be returned in BufferSize.

  @param This   A pointer to the EFI_HII_DATABASE_PROTOCOL
                instance.

  @param Handle   An EFI_HII_HANDLE that corresponds to the
                  desired package list in the HII database to
                  export or NULL to indicate all package lists
                  should be exported. 

  @param BufferSize   On input, a pointer to the length of the
                      buffer. On output, the length of the
                      buffer that is required for the exported
                      data.

  @param Buffer   A pointer to a buffer that will contain the
                  results of the export function.
  
  
  @retval EFI_SUCCESS   Package exported.
  
  @retval EFI_OUT_OF_RESOURCES  BufferSize is too small to hold
                                the package.

**/
typedef
EFI_STATUS
(EFIAPI *EFI_HII_EXPORT_PACKS) (
  IN CONST  EFI_HII_DATABASE_PROTOCOL *This,
  IN CONST  EFI_HII_HANDLE            Handle,
  IN OUT    UINTN                     *BufferSize,
  OUT       EFI_HII_PACKAGE_HEADER    *Buffer
);


/**
   
  
  This function registers a function which will be called when
  specified actions related to packages of the specified type
  occur in the HII database. By registering a function, other
  HII-related drivers are notified when specific package types
  are added, removed or updated in the HII database. Each driver
  or application which registers a notification should use
  EFI_HII_DATABASE_PROTOCOL.UnregisterPackageNotify() before
  exiting.
  
  
  @param This   A pointer to the EFI_HII_DATABASE_PROTOCOL
                instance.

  @param PackageType  The package type. See
                      EFI_HII_PACKAGE_TYPE_x in EFI_HII_PACKAGE_HEADER. 

  @param PackageGuid  If PackageType is
                      EFI_HII_PACKAGE_TYPE_GUID, then this is
                      the pointer to the GUID which must match
                      the Guid field of
                      EFI_HII_PACKAGE_GUID_HEADER. Otherwise, it
                      must be NULL.

  @param PackageNotifyFn  Points to the function to be called
                          when the event specified by
                          NotificationType occurs. See
                          EFI_HII_DATABASE_NOTIFY.

  @param NotifyType   Describes the types of notification which
                      this function will be receiving. See
                      EFI_HII_DATABASE_NOTIFY_TYPE for more a
                      list of types.

  @param NotifyHandle   Points to the unique handle assigned to
                        the registered notification. Can be used
                        in
                        EFI_HII_DATABASE_PROTOCOL.UnregisterPack
                        to stop notifications.


  @retval EFI_SUCCESS   Notification registered successfully.

  @retval EFI_OUT_OF_RESOURCES  Unable to allocate necessary
                                data structures.

  @retval EFI_INVALID_PARAMETER   PackageGuid is not NULL when
                                  PackageType is not
                                  EFI_HII_PACKAGE_TYPE_GUID.

**/
typedef
EFI_STATUS
(EFIAPI *EFI_HII_REGISTER_NOTIFY) (
  IN CONST  EFI_HII_DATABASE_PROTOCOL     *This,
  IN CONST  UINT8                         PackageType,
  IN CONST  EFI_GUID                      *PackageGuid,
  IN CONST  EFI_HII_DATABASE_NOTIFY       PackageNotifyFn,
  IN CONST  EFI_HII_DATABASE_NOTIFY_TYPE  NotifyType,
  OUT       EFI_HANDLE                    *NotifyHandle
);


/**
   
  Removes the specified HII database package-related notification.
  
  @param This   A pointer to the EFI_HII_DATABASE_PROTOCOL
                instance.
  
  @param NotificationHandle   The handle of the notification
                              function being unregistered.
  
  @retval EFI_SUCCESS   Unregister the notification
                        Successsfully
  
  @retval EFI_INVALID_PARAMETER   The Handle is invalid.

**/
typedef
EFI_STATUS
(EFIAPI *EFI_HII_UNREGISTER_NOTIFY) (
  IN CONST  EFI_HII_DATABASE_PROTOCOL *This,
  IN CONST  EFI_HANDLE                NotificationHandle
);


/**
   
  @param Header   The general pack header which defines both the
                  type of pack and the length of the entire
                  pack.

  @param LayoutCount  The number of keyboard layouts contained
                      in the entire keyboard pack.

  @param Layout   An array of LayoutCount number of keyboard
                  layouts.

**/
typedef struct {
  EFI_HII_PACKAGE_HEADER  Header;
  UINT16                  LayoutCount;
  // EFI_HII_KEYBOARD_LAYOUT Layout[...];
} EFI_HII_KEYBOARD_PACK;

/**
   
  @param LayoutLength   The length of the current keyboard
                        layout.

  @param Guid   The unique ID associated with this keyboard
                layout.

  @param LayoutDescriptorString   An offset location (0 is the
                                  beginning of the
                                  EFI_KEYBOARD_LAYOUT instance)
                                  of the string which describes
                                  this keyboard layout. The data
                                  that is being referenced is in
                                  EFI_DESCRIPTION_STRING_BUNDLE
                                  format.

  @param DescriptorCount  The number of Descriptor entries in
                          this layout.

  @param Descriptors  An array of key descriptors.

**/
typedef struct {
  UINT16              LayoutLength;
  EFI_GUID            Guid;
  RELOFST             LayoutDescriptorString;
  UINT8               DescriptorCount;
  // EFI_KEY_DESCRIPTOR   Descriptors[...];
} EFI_HII_KEYBOARD_LAYOUT;


/**
   
  @param Language   The language to associate with
                    DescriptionString.

  @param Space  A space (U-0x0020) character to force as a
                separator between the Language field and the
                formal description string.

  @param DescriptionString  A null-terminated description
                            string.

**/
typedef struct {
  CHAR16  Language[3];
  CHAR16  Space;
  CHAR16  DescriptionString[1];
} EFI_DESCRIPTION_STRING;

/**
   
  @param DescriptionCount   The number of description strings.

  @param DescriptionString  An array of language-specific
                            description strings.

**/
typedef struct {
  UINT16                  DescriptionCount;
  // EFI_DESCRIPTION_STRING   DescriptionString[];
} EFI_DESCRIPTION_STRING_BUNDLE;

/**

  See the figure below for which key corresponds to the values in
  the enumeration above. For example, EfiKeyLCtrl corresponds to
  the left control key in the lower-left corner of the keyboard,
  EfiKeyFour corresponds to the 4 key on the numeric keypad, and
  EfiKeySLck corresponds to the Scroll Lock key in the upper-right
  corner of the keyboard.

**/
typedef enum {
  EfiKeyLCtrl, EfiKeyA0, EfiKeyLAlt, EfiKeySpaceBar,
  EfiKeyA2, EfiKeyA3, EfiKeyA4, EfiKeyRCtrl, EfiKeyLeftArrow,
  EfiKeyDownArrow, EfiKeyRightArrow, EfiKeyZero,
  EfiKeyPeriod, EfiKeyEnter, EfiKeyLShift, EfiKeyB0,
  EfiKeyB1, EfiKeyB2, EfiKeyB3, EfiKeyB4, EfiKeyB5, EfiKeyB6,
  EfiKeyB7, EfiKeyB8, EfiKeyB9, EfiKeyB10, EfiKeyRshift,
  EfiKeyUpArrow, EfiKeyOne, EfiKeyTwo, EfiKeyThree,
  EfiKeyCapsLock, EfiKeyC1, EfiKeyC2, EfiKeyC3, EfiKeyC4,
  EfiKeyC5, EfiKeyC6, EfiKeyC7, EfiKeyC8, EfiKeyC9,
  EfiKeyC10, EfiKeyC11, EfiKeyC12, EfiKeyFour, EfiKeyFive,
  EfiKeySix, EfiKeyPlus, EfiKeyTab, EfiKeyD1, EfiKeyD2,
  EfiKeyD3, EfiKeyD4, EfiKeyD5, EfiKeyD6, EfiKeyD7, EfiKeyD8,
  EfiKeyD9, EfiKeyD10, EfiKeyD11, EfiKeyD12, EfiKeyD13,
  EfiKeyDel, EfiKeyEnd, EfiKeyPgDn, EfiKeySeven, EfiKeyEight,
  EfiKeyNine, EfiKeyE0, EfiKeyE1, EfiKeyE2, EfiKeyE3,
  EfiKeyE4, EfiKeyE5, EfiKeyE6, EfiKeyE7, EfiKeyE8, EfiKeyE9,
  EfiKeyE10, EfiKeyE11, EfiKeyE12, EfiKeyBackSpace,
  EfiKeyIns, EfiKeyHome, EfiKeyPgUp, EfiKeyNLck, EfiKeySlash,
  EfiKeyAsterisk, EfiKeyMinus, EfiKeyEsc, EfiKeyF1, EfiKeyF2,
  EfiKeyF3, EfiKeyF4, EfiKeyF5, EfiKeyF6, EfiKeyF7, EfiKeyF8,
  EfiKeyF9, EfiKeyF10, EfiKeyF11, EfiKeyF12, EfiKeyPrint,
  EfiKeySLck, EfiKeyPause
} EFI_KEY;

/**
   
  @param Key Used to describe a physical key on a keyboard.

  @param Unicode  Unicode value for the Key.

  @param ShiftedUnicode   Unicode value for the key with the
                          shift key being held down. 

  @param AltGrUnicode   Unicode value for the key with the
                        Alt-GR being held down.

  @param ShiftedAltGrUnicode  Unicode value for the key with the
                              Alt-GR and shift keys being held down.

  @param Modifier   Modifier keys are defined to allow for
                    special functionality that is not
                    necessarily accomplished by a printable
                    character. Many of these modifier keys are
                    flags to toggle certain state bits on and
                    off inside of a keyboard driver.
  
**/
typedef struct {
  EFI_KEY Key;
  CHAR16  Unicode;
  CHAR16  ShiftedUnicode;
  CHAR16  AltGrUnicode;
  CHAR16  ShiftedAltGrUnicode;
  UINT16  Modifier;
} EFI_KEY_DESCRIPTOR;


//
// Modifier values
//
#define EFI_NULL_MODIFIER                 0x0000
#define EFI_LEFT_CONTROL_MODIFIER         0x0001
#define EFI_RIGHT_CONTROL_MODIFIER        0x0002
#define EFI_LEFT_ALT_MODIFIER             0x0003
#define EFI_RIGHT_ALT_MODIFIER            0x0004
#define EFI_ALT_GR_MODIFIER               0x0005
#define EFI_INSERT_MODIFIER               0x0006
#define EFI_DELETE_MODIFIER               0x0007
#define EFI_PAGE_DOWN_MODIFIER            0x0008
#define EFI_PAGE_UP_MODIFIER              0x0009
#define EFI_HOME_MODIFIER                 0x000A
#define EFI_END_MODIFIER                  0x000B
#define EFI_LEFT_SHIFT_MODIFIER           0x000C
#define EFI_RIGHT_SHIFT_MODIFIER          0x000D
#define EFI_CAPS_LOCK_MODIFIER            0x000E
#define EFI_NUM_LOCK _MODIFIER            0x000F
#define EFI_LEFT_ARROW_MODIFIER           0x0010
#define EFI_RIGHT_ARROW_MODIFIER          0x0011
#define EFI_DOWN_ARROW_MODIFIER           0x0012
#define EFI_UP_ARROW_MODIFIER             0X0013
#define EFI_NS_KEY_MODIFIER               0x0014
#define EFI_NS_KEY_DEPENDENCY_MODIFIER    0x0015
#define EFI_FUNCTION_KEY_ONE_MODIFIER     0x0016
#define EFI_FUNCTION_KEY_TWO_MODIFIER     0x0017
#define EFI_FUNCTION_KEY_THREE_MODIFIER   0x0018
#define EFI_FUNCTION_KEY_FOUR_MODIFIER    0x0019
#define EFI_FUNCTION_KEY_FIVE_MODIFIER    0x001A
#define EFI_FUNCTION_KEY_SIX_MODIFIER     0x001B
#define EFI_FUNCTION_KEY_SEVEN_MODIFIER   0x001C
#define EFI_FUNCTION_KEY_EIGHT_MODIFIER   0x001D
#define EFI_FUNCTION_KEY_NINE_MODIFIER    0x001E
#define EFI_FUNCTION_KEY_TEN_MODIFIER     0x001F
#define EFI_FUNCTION_KEY_ELEVEN_MODIFIER  0x0020
#define EFI_FUNCTION_KEY_TWELVE_MODIFIER  0x0021
//
// Keys that have multiple control functions based on modifier
// settings are handled in the keyboard driver implementation.
// For instance PRINT_KEY might have a modifier held down and
// is still a nonprinting character, but might have an alternate
// control function like SYSREQUEST
//
#define EFI_PRINT_MODIFIER                0x0022
#define EFI_SYS_REQUEST_MODIFIER          0x0023
#define EFI_SCROLL_LOCK_MODIFIER          0x0024
#define EFI_PAUSE_MODIFIER                0x0025
#define EFI_BREAK_MODIFIER                0x0026



/**
   
  This routine retrieves an array of GUID values for each keyboard
  layout that was previously registered in the system.

  @param This   A pointer to the EFI_HII_PROTOCOL instance.

  @param KeyGuidBufferLength  On input, a pointer to the length
                              of the keyboard GUID buffer. On
                              output, the length of the handle
                              buffer that is required for the
                              handles found. KeyGuidBuffer An
                              array of keyboard layout GUID
                              instances returned.

  @retval EFI_SUCCESS   KeyGuidBuffer was updated successfully.
  
  @retval EFI_BUFFER_TOO_SMALL  The KeyGuidBufferLength
                                parameter indicates that
                                KeyGuidBuffer is too small to
                                support the number of GUIDs.
                                KeyGuidBufferLength is updated
                                with a value that will enable
                                the data to fit.

**/
typedef
EFI_STATUS
(EFIAPI *EFI_HII_FIND_KEYBOARD_LAYOUTS) (
  IN CONST  EFI_HII_DATABASE_PROTOCOL *This,
  IN OUT    UINT16                    *KeyGuidBufferLength,
  OUT       EFI_GUID                  *KeyGuidBuffer
);


/**
   
  This routine retrieves the requested keyboard layout. The layout
  is a physical description of the keys on a keyboard and the
  character(s) that are associated with a particular set of key
  strokes.

  @param This   A pointer to the EFI_HII_PROTOCOL instance.
  
  @param KeyGuid  A pointer to the unique ID associated with a
                  given keyboard layout. If KeyGuid is NULL then
                  the current layout will be retrieved.
  
  @param KeyboardLayout A pointer to a buffer containing the
                        retrieved keyboard layout. below.
  
  @retval EFI_SUCCESS   The keyboard layout was retrieved
                        successfully.
  
  @retval EFI_NOT_FOUND   The requested keyboard layout was not
                          found.

**/
typedef
EFI_STATUS
(EFIAPI *EFI_HII_GET_KEYBOARD_LAYOUT) (
  IN CONST  EFI_HII_DATABASE_PROTOCOL *This,
  IN CONST  EFI_GUID                  *KeyGuid,
  OUT       EFI_HII_KEYBOARD_LAYOUT   *KeyboardLayout
);

/**
   
  This routine sets the default keyboard layout to the one
  referenced by KeyGuid. When this routine is called, an event
  will be signaled of the EFI_HII_SET_KEYBOARD_LAYOUT_EVENT_GUID
  group type. This is so that agents which are sensitive to the
  current keyboard layout being changed can be notified of this
  change.

  @param This   A pointer to the EFI_HII_DATABASE_PROTOCOL
                instance.

  @param KeyGuid  A pointer to the unique ID associated with a
                  given keyboard layout.


  @retval EFI_SUCCESS   The current keyboard layout was
                        successfully set.
  
  @retval EFI_NOT_FOUND   The referenced keyboard layout was not
                          found, so action was taken.

**/
typedef
EFI_STATUS
(EFIAPI *EFI_HII_SET_KEYBOARD_LAYOUT) (
  IN CONST  EFI_HII_DATABASE_PROTOCOL *This,
  IN CONST  EFI_GUID                  *KeyGuid
);

/**
   
  Return the EFI handle associated with a package list.
  
  @param This   A pointer to the EFI_HII_DATABASE_PROTOCOL
                instance.
  
  @param PackageListHandle  An EFI_HII_HANDLE that corresponds
                            to the desired package list in the
                            HIIdatabase.
  
  @param DriverHandle   On return, contains the EFI_HANDLE which
                        was registered with the package list in
                        NewPackageList().
  
  @retval EFI_SUCCESS   The DriverHandle was returned
                        successfully.
  
  @retval EFI_INVALID_PARAMETER   The PackageListHandle was not
                                  valid.

**/
typedef
EFI_STATUS
(EFIAPI *EFI_HII_GET_PACK_HANDLE) (
  IN CONST  EFI_HII_DATABASE_PROTOCOL *This,
  IN CONST  EFI_HII_HANDLE            PackageListHandle,
  OUT       EFI_HANDLE                *DriverHandle
);

/**
   
  @param NewPackageList Add a new package list to the HII
                        database.

  @param RemovePackageList  Remove a package list from the HII
                            database.

  @param UpdatePackageList  Update a package list in the HII
                            database.

  @param ListPackageLists   List the handles of the package
                            lists within the HII database. 

  @param ExportPackageLists Export package lists from the HII
                            database.

  @param RegisterPackageNotify  Register notification when
                                packages of a certain type are
                                installed.

  @param UnregisterPackageNotify  Unregister notification of
                                  packages.

  @param FindKeyboardLayouts  Retrieves a list of the keyboard
                              layouts in the system.

  @param GetKeyboardLayout  Allows a program to extract the
                            current keyboard layout. See the
                            GetKeyboardLayout() function
                            description.

  @param SetKeyboardLayout  Changes the current keyboard layout.
                            See the SetKeyboardLayout() function


**/
struct _EFI_HII_DATABASE_PROTOCOL {
  EFI_HII_NEW_PACK                NewPackageList;
  EFI_HII_REMOVE_PACK             RemovePackageList;
  EFI_HII_UPDATE_PACK             UpdatePackageList;
  EFI_HII_LIST_PACKS              ListPackageLists;
  EFI_HII_EXPORT_PACKS            ExportPackageLists;
  EFI_HII_REGISTER_NOTIFY         RegisterPackageNotify;
  EFI_HII_UNREGISTER_NOTIFY       UnregisterPackageNotify;
  EFI_HII_FIND_KEYBOARD_LAYOUTS   FindKeyboardLayouts;
  EFI_HII_GET_KEYBOARD_LAYOUT     GetKeyboardLayout;
  EFI_HII_SET_KEYBOARD_LAYOUT     SetKeyboardLayout;
  EFI_HII_GET_PACK_HANDLE         GetPackageHandle;
};

extern EFI_GUID gEfiHiiDatabaseProtocolGuid;

#endif