1 /** @file
2 Private structures definitions in HiiDatabase.
3 
4 Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution.  The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9 
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 
13 **/
14 
15 #ifndef __HII_DATABASE_PRIVATE_H__
16 #define __HII_DATABASE_PRIVATE_H__
17 
18 #include <Uefi.h>
19 
20 #include <Protocol/DevicePath.h>
21 #include <Protocol/HiiFont.h>
22 #include <Protocol/HiiImage.h>
23 #include <Protocol/HiiImageEx.h>
24 #include <Protocol/HiiImageDecoder.h>
25 #include <Protocol/HiiString.h>
26 #include <Protocol/HiiDatabase.h>
27 #include <Protocol/HiiConfigRouting.h>
28 #include <Protocol/HiiConfigAccess.h>
29 #include <Protocol/HiiConfigKeyword.h>
30 #include <Protocol/SimpleTextOut.h>
31 
32 #include <Guid/HiiKeyBoardLayout.h>
33 #include <Guid/GlobalVariable.h>
34 
35 
36 #include <Library/DebugLib.h>
37 #include <Library/BaseMemoryLib.h>
38 #include <Library/UefiDriverEntryPoint.h>
39 #include <Library/UefiBootServicesTableLib.h>
40 #include <Library/BaseLib.h>
41 #include <Library/DevicePathLib.h>
42 #include <Library/MemoryAllocationLib.h>
43 #include <Library/UefiLib.h>
44 #include <Library/PcdLib.h>
45 #include <Library/UefiRuntimeServicesTableLib.h>
46 #include <Library/PrintLib.h>
47 
48 #define MAX_STRING_LENGTH                  1024
49 #define MAX_FONT_NAME_LEN                  256
50 #define NARROW_BASELINE                    15
51 #define WIDE_BASELINE                      14
52 #define SYS_FONT_INFO_MASK                 0x37
53 #define REPLACE_UNKNOWN_GLYPH              0xFFFD
54 #define PROPORTIONAL_GLYPH                 0x80
55 #define NARROW_GLYPH                       0x40
56 
57 #define BITMAP_LEN_1_BIT(Width, Height)  (((Width) + 7) / 8 * (Height))
58 #define BITMAP_LEN_4_BIT(Width, Height)  (((Width) + 1) / 2 * (Height))
59 #define BITMAP_LEN_8_BIT(Width, Height)  ((Width) * (Height))
60 #define BITMAP_LEN_24_BIT(Width, Height) ((Width) * (Height) * 3)
61 
62 //
63 // IFR data structure
64 //
65 // BASE_CR (a, IFR_DEFAULT_VALUE_DATA, Entry) to get the whole structure.
66 
67 typedef struct {
68   LIST_ENTRY          Entry;             // Link to VarStorage
69   EFI_GUID            Guid;
70   CHAR16              *Name;
71   UINT16              Size;
72   UINT8               Type;
73   LIST_ENTRY          BlockEntry;        // Link to its Block array
74 } IFR_VARSTORAGE_DATA;
75 
76 typedef struct {
77   LIST_ENTRY          Entry;             // Link to Block array
78   UINT16              Offset;
79   UINT16              Width;
80   EFI_QUESTION_ID     QuestionId;
81   UINT8               OpCode;
82   UINT8               Scope;
83   LIST_ENTRY          DefaultValueEntry; // Link to its default value array
84   CHAR16              *Name;
85 } IFR_BLOCK_DATA;
86 
87 //
88 // Get default value from IFR data.
89 //
90 typedef enum {
91   DefaultValueFromDefault = 0,     // Get from the minimum or first one when not set default value.
92   DefaultValueFromOtherDefault,    // Get default vale from other default when no default(When other
93                                    // defaults are more than one, use the default with smallest default id).
94   DefaultValueFromFlag,            // Get default value from the default flag.
95   DefaultValueFromOpcode           // Get default value from default opcode, highest priority.
96 } DEFAULT_VALUE_TYPE;
97 
98 typedef struct {
99   LIST_ENTRY          Entry;
100   DEFAULT_VALUE_TYPE  Type;
101   BOOLEAN             Cleaned;       // Whether this value is cleaned
102                                      // TRUE  Cleaned, the value can't be used
103                                      // FALSE Not cleaned, the value can  be used.
104   UINT16              DefaultId;
105   EFI_IFR_TYPE_VALUE  Value;
106 } IFR_DEFAULT_DATA;
107 
108 //
109 // Storage types
110 //
111 #define EFI_HII_VARSTORE_BUFFER              0
112 #define EFI_HII_VARSTORE_NAME_VALUE          1
113 #define EFI_HII_VARSTORE_EFI_VARIABLE        2
114 #define EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER 3
115 
116 //
117 // Keyword handler protocol filter type.
118 //
119 #define EFI_KEYWORD_FILTER_READONY           0x01
120 #define EFI_KEYWORD_FILTER_REAWRITE          0x02
121 #define EFI_KEYWORD_FILTER_BUFFER            0x10
122 #define EFI_KEYWORD_FILTER_NUMERIC           0x20
123 #define EFI_KEYWORD_FILTER_NUMERIC_1         0x30
124 #define EFI_KEYWORD_FILTER_NUMERIC_2         0x40
125 #define EFI_KEYWORD_FILTER_NUMERIC_4         0x50
126 #define EFI_KEYWORD_FILTER_NUMERIC_8         0x60
127 
128 
129 #define HII_FORMSET_STORAGE_SIGNATURE           SIGNATURE_32 ('H', 'S', 'T', 'G')
130 typedef struct {
131   UINTN               Signature;
132   LIST_ENTRY          Entry;
133 
134   EFI_HII_HANDLE      HiiHandle;
135   EFI_HANDLE          DriverHandle;
136 
137   UINT8               Type;   // EFI_HII_VARSTORE_BUFFER, EFI_HII_VARSTORE_NAME_VALUE, EFI_HII_VARSTORE_EFI_VARIABLE
138   EFI_GUID            Guid;
139   CHAR16              *Name;
140   UINT16              Size;
141 } HII_FORMSET_STORAGE;
142 
143 
144 //
145 // String Package definitions
146 //
147 #define HII_STRING_PACKAGE_SIGNATURE    SIGNATURE_32 ('h','i','s','p')
148 typedef struct _HII_STRING_PACKAGE_INSTANCE {
149   UINTN                                 Signature;
150   EFI_HII_STRING_PACKAGE_HDR            *StringPkgHdr;
151   UINT8                                 *StringBlock;
152   LIST_ENTRY                            StringEntry;
153   LIST_ENTRY                            FontInfoList;  // local font info list
154   UINT8                                 FontId;
155   EFI_STRING_ID                         MaxStringId;   // record StringId
156 } HII_STRING_PACKAGE_INSTANCE;
157 
158 //
159 // Form Package definitions
160 //
161 #define HII_IFR_PACKAGE_SIGNATURE       SIGNATURE_32 ('h','f','r','p')
162 typedef struct _HII_IFR_PACKAGE_INSTANCE {
163   UINTN                                 Signature;
164   EFI_HII_PACKAGE_HEADER                FormPkgHdr;
165   UINT8                                 *IfrData;
166   LIST_ENTRY                            IfrEntry;
167 } HII_IFR_PACKAGE_INSTANCE;
168 
169 //
170 // Simple Font Package definitions
171 //
172 #define HII_S_FONT_PACKAGE_SIGNATURE    SIGNATURE_32 ('h','s','f','p')
173 typedef struct _HII_SIMPLE_FONT_PACKAGE_INSTANCE {
174   UINTN                                 Signature;
175   EFI_HII_SIMPLE_FONT_PACKAGE_HDR       *SimpleFontPkgHdr;
176   LIST_ENTRY                            SimpleFontEntry;
177 } HII_SIMPLE_FONT_PACKAGE_INSTANCE;
178 
179 //
180 // Font Package definitions
181 //
182 #define HII_FONT_PACKAGE_SIGNATURE      SIGNATURE_32 ('h','i','f','p')
183 typedef struct _HII_FONT_PACKAGE_INSTANCE {
184   UINTN                                 Signature;
185   EFI_HII_FONT_PACKAGE_HDR              *FontPkgHdr;
186   UINT16                                Height;
187   UINT16                                BaseLine;
188   UINT8                                 *GlyphBlock;
189   LIST_ENTRY                            FontEntry;
190   LIST_ENTRY                            GlyphInfoList;
191 } HII_FONT_PACKAGE_INSTANCE;
192 
193 #define HII_GLYPH_INFO_SIGNATURE        SIGNATURE_32 ('h','g','i','s')
194 typedef struct _HII_GLYPH_INFO {
195   UINTN                                 Signature;
196   LIST_ENTRY                            Entry;
197   CHAR16                                CharId;
198   EFI_HII_GLYPH_INFO                    Cell;
199 } HII_GLYPH_INFO;
200 
201 #define HII_FONT_INFO_SIGNATURE         SIGNATURE_32 ('h','l','f','i')
202 typedef struct _HII_FONT_INFO {
203   UINTN                                 Signature;
204   LIST_ENTRY                            Entry;
205   LIST_ENTRY                            *GlobalEntry;
206   UINT8                                 FontId;
207 } HII_FONT_INFO;
208 
209 #define HII_GLOBAL_FONT_INFO_SIGNATURE  SIGNATURE_32 ('h','g','f','i')
210 typedef struct _HII_GLOBAL_FONT_INFO {
211   UINTN                                 Signature;
212   LIST_ENTRY                            Entry;
213   HII_FONT_PACKAGE_INSTANCE             *FontPackage;
214   UINTN                                 FontInfoSize;
215   EFI_FONT_INFO                         *FontInfo;
216 } HII_GLOBAL_FONT_INFO;
217 
218 //
219 // Image Package definitions
220 //
221 
222 #define HII_PIXEL_MASK                  0x80
223 
224 typedef struct _HII_IMAGE_PACKAGE_INSTANCE {
225   EFI_HII_IMAGE_PACKAGE_HDR             ImagePkgHdr;
226   UINT32                                ImageBlockSize;
227   UINT32                                PaletteInfoSize;
228   EFI_HII_IMAGE_BLOCK                   *ImageBlock;
229   UINT8                                 *PaletteBlock;
230 } HII_IMAGE_PACKAGE_INSTANCE;
231 
232 //
233 // Keyboard Layout Package definitions
234 //
235 #define HII_KB_LAYOUT_PACKAGE_SIGNATURE SIGNATURE_32 ('h','k','l','p')
236 typedef struct _HII_KEYBOARD_LAYOUT_PACKAGE_INSTANCE {
237   UINTN                                 Signature;
238   UINT8                                 *KeyboardPkg;
239   LIST_ENTRY                            KeyboardEntry;
240 } HII_KEYBOARD_LAYOUT_PACKAGE_INSTANCE;
241 
242 //
243 // Guid Package definitions
244 //
245 #define HII_GUID_PACKAGE_SIGNATURE      SIGNATURE_32 ('h','i','g','p')
246 typedef struct _HII_GUID_PACKAGE_INSTANCE {
247   UINTN                                 Signature;
248   UINT8                                 *GuidPkg;
249   LIST_ENTRY                            GuidEntry;
250 } HII_GUID_PACKAGE_INSTANCE;
251 
252 //
253 // A package list can contain only one or less than one device path package.
254 // This rule also applies to image package since ImageId can not be duplicate.
255 //
256 typedef struct _HII_DATABASE_PACKAGE_LIST_INSTANCE {
257   EFI_HII_PACKAGE_LIST_HEADER           PackageListHdr;
258   LIST_ENTRY                            GuidPkgHdr;
259   LIST_ENTRY                            FormPkgHdr;
260   LIST_ENTRY                            KeyboardLayoutHdr;
261   LIST_ENTRY                            StringPkgHdr;
262   LIST_ENTRY                            FontPkgHdr;
263   HII_IMAGE_PACKAGE_INSTANCE            *ImagePkg;
264   LIST_ENTRY                            SimpleFontPkgHdr;
265   UINT8                                 *DevicePathPkg;
266 } HII_DATABASE_PACKAGE_LIST_INSTANCE;
267 
268 #define HII_HANDLE_SIGNATURE            SIGNATURE_32 ('h','i','h','l')
269 
270 typedef struct {
271   UINTN               Signature;
272   LIST_ENTRY          Handle;
273   UINTN               Key;
274 } HII_HANDLE;
275 
276 #define HII_DATABASE_RECORD_SIGNATURE   SIGNATURE_32 ('h','i','d','r')
277 
278 typedef struct _HII_DATABASE_RECORD {
279   UINTN                                 Signature;
280   HII_DATABASE_PACKAGE_LIST_INSTANCE    *PackageList;
281   EFI_HANDLE                            DriverHandle;
282   EFI_HII_HANDLE                        Handle;
283   LIST_ENTRY                            DatabaseEntry;
284 } HII_DATABASE_RECORD;
285 
286 #define HII_DATABASE_NOTIFY_SIGNATURE   SIGNATURE_32 ('h','i','d','n')
287 
288 typedef struct _HII_DATABASE_NOTIFY {
289   UINTN                                 Signature;
290   EFI_HANDLE                            NotifyHandle;
291   UINT8                                 PackageType;
292   EFI_GUID                              *PackageGuid;
293   EFI_HII_DATABASE_NOTIFY               PackageNotifyFn;
294   EFI_HII_DATABASE_NOTIFY_TYPE          NotifyType;
295   LIST_ENTRY                            DatabaseNotifyEntry;
296 } HII_DATABASE_NOTIFY;
297 
298 #define HII_DATABASE_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('H', 'i', 'D', 'p')
299 
300 typedef struct _HII_DATABASE_PRIVATE_DATA {
301   UINTN                                 Signature;
302   LIST_ENTRY                            DatabaseList;
303   LIST_ENTRY                            DatabaseNotifyList;
304   EFI_HII_FONT_PROTOCOL                 HiiFont;
305   EFI_HII_IMAGE_PROTOCOL                HiiImage;
306   EFI_HII_IMAGE_EX_PROTOCOL             HiiImageEx;
307   EFI_HII_STRING_PROTOCOL               HiiString;
308   EFI_HII_DATABASE_PROTOCOL             HiiDatabase;
309   EFI_HII_CONFIG_ROUTING_PROTOCOL       ConfigRouting;
310   EFI_CONFIG_KEYWORD_HANDLER_PROTOCOL   ConfigKeywordHandler;
311   LIST_ENTRY                            HiiHandleList;
312   INTN                                  HiiHandleCount;
313   LIST_ENTRY                            FontInfoList;  // global font info list
314   UINTN                                 Attribute;     // default system color
315   EFI_GUID                              CurrentLayoutGuid;
316   EFI_HII_KEYBOARD_LAYOUT               *CurrentLayout;
317 } HII_DATABASE_PRIVATE_DATA;
318 
319 #define HII_FONT_DATABASE_PRIVATE_DATA_FROM_THIS(a) \
320   CR (a, \
321       HII_DATABASE_PRIVATE_DATA, \
322       HiiFont, \
323       HII_DATABASE_PRIVATE_DATA_SIGNATURE \
324       )
325 
326 #define HII_IMAGE_DATABASE_PRIVATE_DATA_FROM_THIS(a) \
327   CR (a, \
328       HII_DATABASE_PRIVATE_DATA, \
329       HiiImage, \
330       HII_DATABASE_PRIVATE_DATA_SIGNATURE \
331       )
332 
333 #define HII_IMAGE_EX_DATABASE_PRIVATE_DATA_FROM_THIS(a) \
334   CR (a, \
335       HII_DATABASE_PRIVATE_DATA, \
336       HiiImageEx, \
337       HII_DATABASE_PRIVATE_DATA_SIGNATURE \
338       )
339 
340 #define HII_STRING_DATABASE_PRIVATE_DATA_FROM_THIS(a) \
341   CR (a, \
342       HII_DATABASE_PRIVATE_DATA, \
343       HiiString, \
344       HII_DATABASE_PRIVATE_DATA_SIGNATURE \
345       )
346 
347 #define HII_DATABASE_DATABASE_PRIVATE_DATA_FROM_THIS(a) \
348   CR (a, \
349       HII_DATABASE_PRIVATE_DATA, \
350       HiiDatabase, \
351       HII_DATABASE_PRIVATE_DATA_SIGNATURE \
352       )
353 
354 #define CONFIG_ROUTING_DATABASE_PRIVATE_DATA_FROM_THIS(a) \
355   CR (a, \
356       HII_DATABASE_PRIVATE_DATA, \
357       ConfigRouting, \
358       HII_DATABASE_PRIVATE_DATA_SIGNATURE \
359       )
360 
361 #define CONFIG_KEYWORD_HANDLER_DATABASE_PRIVATE_DATA_FROM_THIS(a) \
362   CR (a, \
363       HII_DATABASE_PRIVATE_DATA, \
364       ConfigKeywordHandler, \
365       HII_DATABASE_PRIVATE_DATA_SIGNATURE \
366       )
367 
368 //
369 // Internal function prototypes.
370 //
371 
372 /**
373   Generate a sub string then output it.
374 
375   This is a internal function.
376 
377   @param  String                 A constant string which is the prefix of the to be
378                                  generated string, e.g. GUID=
379 
380   @param  BufferLen              The length of the Buffer in bytes.
381 
382   @param  Buffer                 Points to a buffer which will be converted to be the
383                                  content of the generated string.
384 
385   @param  Flag                   If 1, the buffer contains data for the value of GUID or PATH stored in
386                                  UINT8 *; if 2, the buffer contains unicode string for the value of NAME;
387                                  if 3, the buffer contains other data.
388 
389   @param  SubStr                 Points to the output string. It's caller's
390                                  responsibility to free this buffer.
391 
392 
393 **/
394 VOID
395 GenerateSubStr (
396   IN CONST EFI_STRING              String,
397   IN  UINTN                        BufferLen,
398   IN  VOID                         *Buffer,
399   IN  UINT8                        Flag,
400   OUT EFI_STRING                   *SubStr
401   );
402 
403 /**
404   This function checks whether a handle is a valid EFI_HII_HANDLE.
405 
406   @param  Handle                  Pointer to a EFI_HII_HANDLE
407 
408   @retval TRUE                    Valid
409   @retval FALSE                   Invalid
410 
411 **/
412 BOOLEAN
413 IsHiiHandleValid (
414   EFI_HII_HANDLE Handle
415   );
416 
417 
418 /**
419   This function checks whether EFI_FONT_INFO exists in current database. If
420   FontInfoMask is specified, check what options can be used to make a match.
421   Note that the masks relate to where the system default should be supplied
422   are ignored by this function.
423 
424   @param  Private                 Hii database private structure.
425   @param  FontInfo                Points to EFI_FONT_INFO structure.
426   @param  FontInfoMask            If not NULL, describes what options can be used
427                                   to make a match between the font requested and
428                                   the font available. The caller must guarantee
429                                   this mask is valid.
430   @param  FontHandle              On entry, Points to the font handle returned by a
431                                   previous  call to GetFontInfo() or NULL to start
432                                   with the first font.
433   @param  GlobalFontInfo          If not NULL, output the corresponding global font
434                                   info.
435 
436   @retval TRUE                    Existed
437   @retval FALSE                   Not existed
438 
439 **/
440 BOOLEAN
441 IsFontInfoExisted (
442   IN  HII_DATABASE_PRIVATE_DATA *Private,
443   IN  EFI_FONT_INFO             *FontInfo,
444   IN  EFI_FONT_INFO_MASK        *FontInfoMask,   OPTIONAL
445   IN  EFI_FONT_HANDLE           FontHandle,      OPTIONAL
446   OUT HII_GLOBAL_FONT_INFO      **GlobalFontInfo OPTIONAL
447   );
448 
449 /**
450 
451    This function invokes the matching registered function.
452 
453    @param  Private           HII Database driver private structure.
454    @param  NotifyType        The type of change concerning the database.
455    @param  PackageInstance   Points to the package referred to by the notification.
456    @param  PackageType       Package type
457    @param  Handle            The handle of the package list which contains the specified package.
458 
459    @retval EFI_SUCCESS            Already checked all registered function and invoked
460                                   if matched.
461    @retval EFI_INVALID_PARAMETER  Any input parameter is not valid.
462 
463 **/
464 EFI_STATUS
465 InvokeRegisteredFunction (
466   IN HII_DATABASE_PRIVATE_DATA    *Private,
467   IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType,
468   IN VOID                         *PackageInstance,
469   IN UINT8                        PackageType,
470   IN EFI_HII_HANDLE               Handle
471   )
472 ;
473 
474 /**
475   Retrieve system default font and color.
476 
477   @param  Private                 HII database driver private data.
478   @param  FontInfo                Points to system default font output-related
479                                   information. It's caller's responsibility to free
480                                   this buffer.
481   @param  FontInfoSize            If not NULL, output the size of buffer FontInfo.
482 
483   @retval EFI_SUCCESS             Cell information is added to the GlyphInfoList.
484   @retval EFI_OUT_OF_RESOURCES    The system is out of resources to accomplish the
485                                   task.
486   @retval EFI_INVALID_PARAMETER   Any input parameter is invalid.
487 
488 **/
489 EFI_STATUS
490 GetSystemFont (
491   IN  HII_DATABASE_PRIVATE_DATA      *Private,
492   OUT EFI_FONT_DISPLAY_INFO          **FontInfo,
493   OUT UINTN                          *FontInfoSize OPTIONAL
494   );
495 
496 
497 /**
498   Parse all string blocks to find a String block specified by StringId.
499   If StringId = (EFI_STRING_ID) (-1), find out all EFI_HII_SIBT_FONT blocks
500   within this string package and backup its information. If LastStringId is
501   specified, the string id of last string block will also be output.
502   If StringId = 0, output the string id of last string block (EFI_HII_SIBT_STRING).
503 
504   @param  Private                 Hii database private structure.
505   @param  StringPackage           Hii string package instance.
506   @param  StringId                The string's id, which is unique within
507                                   PackageList.
508   @param  BlockType               Output the block type of found string block.
509   @param  StringBlockAddr         Output the block address of found string block.
510   @param  StringTextOffset        Offset, relative to the found block address, of
511                                   the  string text information.
512   @param  LastStringId            Output the last string id when StringId = 0 or StringId = -1.
513   @param  StartStringId           The first id in the skip block which StringId in the block.
514 
515   @retval EFI_SUCCESS             The string text and font is retrieved
516                                   successfully.
517   @retval EFI_NOT_FOUND           The specified text or font info can not be found
518                                   out.
519   @retval EFI_OUT_OF_RESOURCES    The system is out of resources to accomplish the
520                                   task.
521 
522 **/
523 EFI_STATUS
524 FindStringBlock (
525   IN HII_DATABASE_PRIVATE_DATA        *Private,
526   IN  HII_STRING_PACKAGE_INSTANCE     *StringPackage,
527   IN  EFI_STRING_ID                   StringId,
528   OUT UINT8                           *BlockType, OPTIONAL
529   OUT UINT8                           **StringBlockAddr, OPTIONAL
530   OUT UINTN                           *StringTextOffset, OPTIONAL
531   OUT EFI_STRING_ID                   *LastStringId, OPTIONAL
532   OUT EFI_STRING_ID                   *StartStringId OPTIONAL
533   );
534 
535 
536 /**
537   Parse all glyph blocks to find a glyph block specified by CharValue.
538   If CharValue = (CHAR16) (-1), collect all default character cell information
539   within this font package and backup its information.
540 
541   @param  FontPackage             Hii string package instance.
542   @param  CharValue               Unicode character value, which identifies a glyph
543                                   block.
544   @param  GlyphBuffer             Output the corresponding bitmap data of the found
545                                   block. It is the caller's responsibility to free
546                                   this buffer.
547   @param  Cell                    Output cell information of the encoded bitmap.
548   @param  GlyphBufferLen          If not NULL, output the length of GlyphBuffer.
549 
550   @retval EFI_SUCCESS             The bitmap data is retrieved successfully.
551   @retval EFI_NOT_FOUND           The specified CharValue does not exist in current
552                                   database.
553   @retval EFI_OUT_OF_RESOURCES    The system is out of resources to accomplish the
554                                   task.
555 
556 **/
557 EFI_STATUS
558 FindGlyphBlock (
559   IN  HII_FONT_PACKAGE_INSTANCE      *FontPackage,
560   IN  CHAR16                         CharValue,
561   OUT UINT8                          **GlyphBuffer, OPTIONAL
562   OUT EFI_HII_GLYPH_INFO             *Cell, OPTIONAL
563   OUT UINTN                          *GlyphBufferLen OPTIONAL
564   );
565 
566 /**
567   This function exports Form packages to a buffer.
568   This is a internal function.
569 
570   @param  Private                Hii database private structure.
571   @param  Handle                 Identification of a package list.
572   @param  PackageList            Pointer to a package list which will be exported.
573   @param  UsedSize               The length of buffer be used.
574   @param  BufferSize             Length of the Buffer.
575   @param  Buffer                 Allocated space for storing exported data.
576   @param  ResultSize             The size of the already exported content of  this
577                                  package list.
578 
579   @retval EFI_SUCCESS            Form Packages are exported successfully.
580   @retval EFI_INVALID_PARAMETER  Any input parameter is invalid.
581 
582 **/
583 EFI_STATUS
584 ExportFormPackages (
585   IN HII_DATABASE_PRIVATE_DATA          *Private,
586   IN EFI_HII_HANDLE                     Handle,
587   IN HII_DATABASE_PACKAGE_LIST_INSTANCE *PackageList,
588   IN UINTN                              UsedSize,
589   IN UINTN                              BufferSize,
590   IN OUT VOID                           *Buffer,
591   IN OUT UINTN                          *ResultSize
592   );
593 
594 //
595 // EFI_HII_FONT_PROTOCOL protocol interfaces
596 //
597 
598 
599 /**
600   Renders a string to a bitmap or to the display.
601 
602   @param  This                    A pointer to the EFI_HII_FONT_PROTOCOL instance.
603   @param  Flags                   Describes how the string is to be drawn.
604   @param  String                  Points to the null-terminated string to be
605                                   displayed.
606   @param  StringInfo              Points to the string output information,
607                                   including the color and font.  If NULL, then the
608                                   string will be output in the default system font
609                                   and color.
610   @param  Blt                     If this points to a non-NULL on entry, this
611                                   points to the image, which is Width pixels   wide
612                                   and Height pixels high. The string will be drawn
613                                   onto this image and
614                                   EFI_HII_OUT_FLAG_CLIP is implied. If this points
615                                   to a NULL on entry, then a              buffer
616                                   will be allocated to hold the generated image and
617                                   the pointer updated on exit. It is the caller's
618                                   responsibility to free this buffer.
619   @param  BltX                    Together with BltX, Specifies the offset from the left and top edge
620                                   of the image of the first character cell in the
621                                   image.
622   @param  BltY                    Together with BltY, Specifies the offset from the left and top edge
623                                   of the image of the first character cell in the
624                                   image.
625   @param  RowInfoArray            If this is non-NULL on entry, then on exit, this
626                                   will point to an allocated buffer    containing
627                                   row information and RowInfoArraySize will be
628                                   updated to contain the        number of elements.
629                                   This array describes the characters which were at
630                                   least partially drawn and the heights of the
631                                   rows. It is the caller's responsibility to free
632                                   this buffer.
633   @param  RowInfoArraySize        If this is non-NULL on entry, then on exit it
634                                   contains the number of elements in RowInfoArray.
635   @param  ColumnInfoArray         If this is non-NULL, then on return it will be
636                                   filled with the horizontal offset for each
637                                   character in the string on the row where it is
638                                   displayed. Non-printing characters will     have
639                                   the offset ~0. The caller is responsible to
640                                   allocate a buffer large enough so that    there
641                                   is one entry for each character in the string,
642                                   not including the null-terminator. It is possible
643                                   when character display is normalized that some
644                                   character cells overlap.
645 
646   @retval EFI_SUCCESS             The string was successfully rendered.
647   @retval EFI_OUT_OF_RESOURCES    Unable to allocate an output buffer for
648                                   RowInfoArray or Blt.
649   @retval EFI_INVALID_PARAMETER The String or Blt.
650   @retval EFI_INVALID_PARAMETER Flags were invalid combination..
651 
652 **/
653 EFI_STATUS
654 EFIAPI
655 HiiStringToImage (
656   IN  CONST EFI_HII_FONT_PROTOCOL    *This,
657   IN  EFI_HII_OUT_FLAGS              Flags,
658   IN  CONST EFI_STRING               String,
659   IN  CONST EFI_FONT_DISPLAY_INFO    *StringInfo       OPTIONAL,
660   IN  OUT EFI_IMAGE_OUTPUT           **Blt,
661   IN  UINTN                          BltX,
662   IN  UINTN                          BltY,
663   OUT EFI_HII_ROW_INFO               **RowInfoArray    OPTIONAL,
664   OUT UINTN                          *RowInfoArraySize OPTIONAL,
665   OUT UINTN                          *ColumnInfoArray  OPTIONAL
666   );
667 
668 
669 /**
670   Render a string to a bitmap or the screen containing the contents of the specified string.
671 
672   @param  This                    A pointer to the EFI_HII_FONT_PROTOCOL instance.
673   @param  Flags                   Describes how the string is to be drawn.
674   @param  PackageList             The package list in the HII database to search
675                                   for the specified string.
676   @param  StringId                The string's id, which is unique within
677                                   PackageList.
678   @param  Language                Points to the language for the retrieved string.
679                                   If NULL, then the current system language is
680                                   used.
681   @param  StringInfo              Points to the string output information,
682                                   including the color and font.  If NULL, then the
683                                   string will be output in the default system font
684                                   and color.
685   @param  Blt                     If this points to a non-NULL on entry, this
686                                   points to the image, which is Width pixels   wide
687                                   and Height pixels high. The string will be drawn
688                                   onto this image and
689                                   EFI_HII_OUT_FLAG_CLIP is implied. If this points
690                                   to a NULL on entry, then a              buffer
691                                   will be allocated to hold the generated image and
692                                   the pointer updated on exit. It is the caller's
693                                   responsibility to free this buffer.
694   @param  BltX                    Together with BltX, Specifies the offset from the left and top edge
695                                   of the image of the first character cell in the
696                                   image.
697   @param  BltY                    Together with BltY, Specifies the offset from the left and top edge
698                                   of the image of the first character cell in the
699                                   image.
700   @param  RowInfoArray            If this is non-NULL on entry, then on exit, this
701                                   will point to an allocated buffer    containing
702                                   row information and RowInfoArraySize will be
703                                   updated to contain the        number of elements.
704                                   This array describes the characters which were at
705                                   least partially drawn and the heights of the
706                                   rows. It is the caller's responsibility to free
707                                   this buffer.
708   @param  RowInfoArraySize        If this is non-NULL on entry, then on exit it
709                                   contains the number of elements in RowInfoArray.
710   @param  ColumnInfoArray         If this is non-NULL, then on return it will be
711                                   filled with the horizontal offset for each
712                                   character in the string on the row where it is
713                                   displayed. Non-printing characters will     have
714                                   the offset ~0. The caller is responsible to
715                                   allocate a buffer large enough so that    there
716                                   is one entry for each character in the string,
717                                   not including the null-terminator. It is possible
718                                   when character display is normalized that some
719                                   character cells overlap.
720 
721   @retval EFI_SUCCESS             The string was successfully rendered.
722   @retval EFI_OUT_OF_RESOURCES    Unable to allocate an output buffer for
723                                   RowInfoArray or Blt.
724   @retval EFI_INVALID_PARAMETER The Blt or PackageList was NULL.
725   @retval EFI_INVALID_PARAMETER Flags were invalid combination.
726   @retval EFI_NOT_FOUND         The specified PackageList is not in the Database or the stringid is not
727                           in the specified PackageList.
728 
729 **/
730 EFI_STATUS
731 EFIAPI
732 HiiStringIdToImage (
733   IN  CONST EFI_HII_FONT_PROTOCOL    *This,
734   IN  EFI_HII_OUT_FLAGS              Flags,
735   IN  EFI_HII_HANDLE                 PackageList,
736   IN  EFI_STRING_ID                  StringId,
737   IN  CONST CHAR8*                   Language,
738   IN  CONST EFI_FONT_DISPLAY_INFO    *StringInfo       OPTIONAL,
739   IN  OUT EFI_IMAGE_OUTPUT           **Blt,
740   IN  UINTN                          BltX,
741   IN  UINTN                          BltY,
742   OUT EFI_HII_ROW_INFO               **RowInfoArray    OPTIONAL,
743   OUT UINTN                          *RowInfoArraySize OPTIONAL,
744   OUT UINTN                          *ColumnInfoArray  OPTIONAL
745   );
746 
747 
748 /**
749   Convert the glyph for a single character into a bitmap.
750 
751   @param  This                    A pointer to the EFI_HII_FONT_PROTOCOL instance.
752   @param  Char                    Character to retrieve.
753   @param  StringInfo              Points to the string font and color information
754                                   or NULL if the string should use the default
755                                   system font and color.
756   @param  Blt                     Thus must point to a NULL on entry. A buffer will
757                                   be allocated to hold the output and the pointer
758                                   updated on exit. It is the caller's
759                                   responsibility to free this buffer.
760   @param  Baseline                Number of pixels from the bottom of the bitmap to
761                                   the baseline.
762 
763   @retval EFI_SUCCESS             Glyph bitmap created.
764   @retval EFI_OUT_OF_RESOURCES    Unable to allocate the output buffer Blt.
765   @retval EFI_WARN_UNKNOWN_GLYPH  The glyph was unknown and was replaced with the
766                                   glyph for Unicode character 0xFFFD.
767   @retval EFI_INVALID_PARAMETER   Blt is NULL or *Blt is not NULL.
768 
769 **/
770 EFI_STATUS
771 EFIAPI
772 HiiGetGlyph (
773   IN  CONST EFI_HII_FONT_PROTOCOL    *This,
774   IN  CHAR16                         Char,
775   IN  CONST EFI_FONT_DISPLAY_INFO    *StringInfo,
776   OUT EFI_IMAGE_OUTPUT               **Blt,
777   OUT UINTN                          *Baseline OPTIONAL
778   );
779 
780 
781 /**
782   This function iterates through fonts which match the specified font, using
783   the specified criteria. If String is non-NULL, then all of the characters in
784   the string must exist in order for a candidate font to be returned.
785 
786   @param  This                    A pointer to the EFI_HII_FONT_PROTOCOL instance.
787   @param  FontHandle              On entry, points to the font handle returned by a
788                                    previous call to GetFontInfo() or NULL to start
789                                   with the  first font. On return, points to the
790                                   returned font handle or points to NULL if there
791                                   are no more matching fonts.
792   @param  StringInfoIn            Upon entry, points to the font to return information
793                                   about. If NULL, then the information about the system
794                                   default font will be returned.
795   @param  StringInfoOut           Upon return, contains the matching font's information.
796                                   If NULL, then no information is returned. This buffer
797                                   is allocated with a call to the Boot Service AllocatePool().
798                                   It is the caller's responsibility to call the Boot
799                                   Service FreePool() when the caller no longer requires
800                                   the contents of StringInfoOut.
801   @param  String                  Points to the string which will be tested to
802                                   determine  if all characters are available. If
803                                   NULL, then any font  is acceptable.
804 
805   @retval EFI_SUCCESS             Matching font returned successfully.
806   @retval EFI_NOT_FOUND           No matching font was found.
807   @retval EFI_INVALID_PARAMETER   StringInfoIn is NULL.
808   @retval EFI_INVALID_PARAMETER   StringInfoIn->FontInfoMask is an invalid combination.
809   @retval EFI_OUT_OF_RESOURCES    There were insufficient resources to complete the
810                                   request.
811 **/
812 EFI_STATUS
813 EFIAPI
814 HiiGetFontInfo (
815   IN  CONST EFI_HII_FONT_PROTOCOL    *This,
816   IN  OUT   EFI_FONT_HANDLE          *FontHandle,
817   IN  CONST EFI_FONT_DISPLAY_INFO    *StringInfoIn, OPTIONAL
818   OUT       EFI_FONT_DISPLAY_INFO    **StringInfoOut,
819   IN  CONST EFI_STRING               String OPTIONAL
820   );
821 
822 //
823 // EFI_HII_IMAGE_PROTOCOL interfaces
824 //
825 
826 /**
827   Get the image id of last image block: EFI_HII_IIBT_END_BLOCK when input
828   ImageId is zero, otherwise return the address of the
829   corresponding image block with identifier specified by ImageId.
830 
831   This is a internal function.
832 
833   @param ImageBlocks     Points to the beginning of a series of image blocks stored in order.
834   @param ImageId         If input ImageId is 0, output the image id of the EFI_HII_IIBT_END_BLOCK;
835                          else use this id to find its corresponding image block address.
836 
837   @return The image block address when input ImageId is not zero; otherwise return NULL.
838 
839 **/
840 EFI_HII_IMAGE_BLOCK *
841 GetImageIdOrAddress (
842   IN EFI_HII_IMAGE_BLOCK *ImageBlocks,
843   IN OUT EFI_IMAGE_ID    *ImageId
844   );
845 
846 /**
847   Return the HII package list identified by PackageList HII handle.
848 
849   @param Database    Pointer to HII database list header.
850   @param PackageList HII handle of the package list to locate.
851 
852   @retval The HII package list instance.
853 **/
854 HII_DATABASE_PACKAGE_LIST_INSTANCE *
855 LocatePackageList (
856   IN  LIST_ENTRY                     *Database,
857   IN  EFI_HII_HANDLE                 PackageList
858   );
859 
860 /**
861   This function retrieves the image specified by ImageId which is associated with
862   the specified PackageList and copies it into the buffer specified by Image.
863 
864   @param  Database               A pointer to the database list header.
865   @param  PackageList            Handle of the package list where this image will
866                                  be searched.
867   @param  ImageId                The image's id,, which is unique within
868                                  PackageList.
869   @param  Image                  Points to the image.
870   @param  BitmapOnly             TRUE to only return the bitmap type image.
871                                  FALSE to locate image decoder instance to decode image.
872 
873   @retval EFI_SUCCESS            The new image was returned successfully.
874   @retval EFI_NOT_FOUND          The image specified by ImageId is not in the
875                                  database. The specified PackageList is not in the database.
876   @retval EFI_BUFFER_TOO_SMALL   The buffer specified by ImageSize is too small to
877                                  hold the image.
878   @retval EFI_INVALID_PARAMETER  The Image or ImageSize was NULL.
879   @retval EFI_OUT_OF_RESOURCES   The bitmap could not be retrieved because there was not
880                                  enough memory.
881 **/
882 EFI_STATUS
883 IGetImage (
884   IN  LIST_ENTRY                     *Database,
885   IN  EFI_HII_HANDLE                 PackageList,
886   IN  EFI_IMAGE_ID                   ImageId,
887   OUT EFI_IMAGE_INPUT                *Image,
888   IN  BOOLEAN                        BitmapOnly
889   );
890 
891 /**
892   Return the first HII image decoder instance which supports the DecoderName.
893 
894   @param BlockType  The image block type.
895 
896   @retval Pointer to the HII image decoder instance.
897 **/
898 EFI_HII_IMAGE_DECODER_PROTOCOL *
899 LocateHiiImageDecoder (
900   UINT8                          BlockType
901   );
902 
903 /**
904   This function adds the image Image to the group of images owned by PackageList, and returns
905   a new image identifier (ImageId).
906 
907   @param  This                    A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
908   @param  PackageList             Handle of the package list where this image will
909                                   be added.
910   @param  ImageId                 On return, contains the new image id, which is
911                                   unique within PackageList.
912   @param  Image                   Points to the image.
913 
914   @retval EFI_SUCCESS             The new image was added successfully.
915   @retval EFI_NOT_FOUND           The specified PackageList could not be found in
916                                   database.
917   @retval EFI_OUT_OF_RESOURCES    Could not add the image due to lack of resources.
918   @retval EFI_INVALID_PARAMETER   Image is NULL or ImageId is NULL.
919 
920 **/
921 EFI_STATUS
922 EFIAPI
923 HiiNewImage (
924   IN  CONST EFI_HII_IMAGE_PROTOCOL   *This,
925   IN  EFI_HII_HANDLE                 PackageList,
926   OUT EFI_IMAGE_ID                   *ImageId,
927   IN  CONST EFI_IMAGE_INPUT          *Image
928   );
929 
930 
931 /**
932   This function retrieves the image specified by ImageId which is associated with
933   the specified PackageList and copies it into the buffer specified by Image.
934 
935   @param  This                    A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
936   @param  PackageList             Handle of the package list where this image will
937                                   be searched.
938   @param  ImageId                 The image's id,, which is unique within
939                                   PackageList.
940   @param  Image                   Points to the image.
941 
942   @retval EFI_SUCCESS             The new image was returned successfully.
943   @retval EFI_NOT_FOUND           The image specified by ImageId is not available.
944                                                  The specified PackageList is not in the database.
945   @retval EFI_BUFFER_TOO_SMALL    The buffer specified by ImageSize is too small to
946                                   hold the image.
947   @retval EFI_INVALID_PARAMETER   The Image or ImageSize was NULL.
948   @retval EFI_OUT_OF_RESOURCES   The bitmap could not be retrieved because there was not
949                                                        enough memory.
950 
951 **/
952 EFI_STATUS
953 EFIAPI
954 HiiGetImage (
955   IN  CONST EFI_HII_IMAGE_PROTOCOL   *This,
956   IN  EFI_HII_HANDLE                 PackageList,
957   IN  EFI_IMAGE_ID                   ImageId,
958   OUT EFI_IMAGE_INPUT                *Image
959   );
960 
961 
962 /**
963   This function updates the image specified by ImageId in the specified PackageListHandle to
964   the image specified by Image.
965 
966   @param  This                    A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
967   @param  PackageList             The package list containing the images.
968   @param  ImageId                 The image's id,, which is unique within
969                                   PackageList.
970   @param  Image                   Points to the image.
971 
972   @retval EFI_SUCCESS             The new image was updated successfully.
973   @retval EFI_NOT_FOUND           The image specified by ImageId is not in the
974                                                 database. The specified PackageList is not in the database.
975   @retval EFI_INVALID_PARAMETER   The Image was NULL.
976 
977 **/
978 EFI_STATUS
979 EFIAPI
980 HiiSetImage (
981   IN CONST EFI_HII_IMAGE_PROTOCOL    *This,
982   IN EFI_HII_HANDLE                  PackageList,
983   IN EFI_IMAGE_ID                    ImageId,
984   IN CONST EFI_IMAGE_INPUT           *Image
985   );
986 
987 
988 /**
989   This function renders an image to a bitmap or the screen using the specified
990   color and options. It draws the image on an existing bitmap, allocates a new
991   bitmap or uses the screen. The images can be clipped.
992 
993   @param  This                    A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
994   @param  Flags                   Describes how the image is to be drawn.
995   @param  Image                   Points to the image to be displayed.
996   @param  Blt                     If this points to a non-NULL on entry, this
997                                   points to the image, which is Width pixels wide
998                                   and Height pixels high.  The image will be drawn
999                                   onto this image and  EFI_HII_DRAW_FLAG_CLIP is
1000                                   implied. If this points to a  NULL on entry, then
1001                                   a buffer will be allocated to hold  the generated
1002                                   image and the pointer updated on exit. It is the
1003                                   caller's responsibility to free this buffer.
1004   @param  BltX                    Specifies the offset from the left and top edge
1005                                   of the  output image of the first pixel in the
1006                                   image.
1007   @param  BltY                    Specifies the offset from the left and top edge
1008                                   of the  output image of the first pixel in the
1009                                   image.
1010 
1011   @retval EFI_SUCCESS             The image was successfully drawn.
1012   @retval EFI_OUT_OF_RESOURCES    Unable to allocate an output buffer for Blt.
1013   @retval EFI_INVALID_PARAMETER   The Image or Blt was NULL.
1014   @retval EFI_INVALID_PARAMETER   Any combination of Flags is invalid.
1015 
1016 **/
1017 EFI_STATUS
1018 EFIAPI
1019 HiiDrawImage (
1020   IN CONST EFI_HII_IMAGE_PROTOCOL    *This,
1021   IN EFI_HII_DRAW_FLAGS              Flags,
1022   IN CONST EFI_IMAGE_INPUT           *Image,
1023   IN OUT EFI_IMAGE_OUTPUT            **Blt,
1024   IN UINTN                           BltX,
1025   IN UINTN                           BltY
1026   );
1027 
1028 
1029 /**
1030   This function renders an image to a bitmap or the screen using the specified
1031   color and options. It draws the image on an existing bitmap, allocates a new
1032   bitmap or uses the screen. The images can be clipped.
1033 
1034   @param  This                    A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
1035   @param  Flags                   Describes how the image is to be drawn.
1036   @param  PackageList             The package list in the HII database to search
1037                                   for the  specified image.
1038   @param  ImageId                 The image's id, which is unique within
1039                                   PackageList.
1040   @param  Blt                     If this points to a non-NULL on entry, this
1041                                   points to the image, which is Width pixels wide
1042                                   and Height pixels high. The image will be drawn
1043                                   onto this image and
1044                                   EFI_HII_DRAW_FLAG_CLIP is implied. If this points
1045                                   to a  NULL on entry, then a buffer will be
1046                                   allocated to hold  the generated image and the
1047                                   pointer updated on exit. It is the caller's
1048                                   responsibility to free this buffer.
1049   @param  BltX                    Specifies the offset from the left and top edge
1050                                   of the  output image of the first pixel in the
1051                                   image.
1052   @param  BltY                    Specifies the offset from the left and top edge
1053                                   of the  output image of the first pixel in the
1054                                   image.
1055 
1056   @retval EFI_SUCCESS             The image was successfully drawn.
1057   @retval EFI_OUT_OF_RESOURCES    Unable to allocate an output buffer for Blt.
1058   @retval EFI_INVALID_PARAMETER  The Blt was NULL.
1059   @retval EFI_NOT_FOUND          The image specified by ImageId is not in the database.
1060                            The specified PackageList is not in the database.
1061 
1062 **/
1063 EFI_STATUS
1064 EFIAPI
1065 HiiDrawImageId (
1066   IN CONST EFI_HII_IMAGE_PROTOCOL    *This,
1067   IN EFI_HII_DRAW_FLAGS              Flags,
1068   IN EFI_HII_HANDLE                  PackageList,
1069   IN EFI_IMAGE_ID                    ImageId,
1070   IN OUT EFI_IMAGE_OUTPUT            **Blt,
1071   IN UINTN                           BltX,
1072   IN UINTN                           BltY
1073   );
1074 
1075 /**
1076   The prototype of this extension function is the same with EFI_HII_IMAGE_PROTOCOL.NewImage().
1077   This protocol invokes EFI_HII_IMAGE_PROTOCOL.NewImage() implicitly.
1078 
1079   @param  This                   A pointer to the EFI_HII_IMAGE_EX_PROTOCOL instance.
1080   @param  PackageList            Handle of the package list where this image will
1081                                  be added.
1082   @param  ImageId                On return, contains the new image id, which is
1083                                  unique within PackageList.
1084   @param  Image                  Points to the image.
1085 
1086   @retval EFI_SUCCESS            The new image was added successfully.
1087   @retval EFI_NOT_FOUND          The PackageList could not be found.
1088   @retval EFI_OUT_OF_RESOURCES   Could not add the image due to lack of resources.
1089   @retval EFI_INVALID_PARAMETER  Image is NULL or ImageId is NULL.
1090 **/
1091 EFI_STATUS
1092 EFIAPI
1093 HiiNewImageEx (
1094   IN  CONST EFI_HII_IMAGE_EX_PROTOCOL *This,
1095   IN  EFI_HII_HANDLE                  PackageList,
1096   OUT EFI_IMAGE_ID                    *ImageId,
1097   IN  CONST EFI_IMAGE_INPUT           *Image
1098   );
1099 
1100 /**
1101   Return the information about the image, associated with the package list.
1102   The prototype of this extension function is the same with EFI_HII_IMAGE_PROTOCOL.GetImage().
1103 
1104   This function is similar to EFI_HII_IMAGE_PROTOCOL.GetImage(). The difference is that
1105   this function will locate all EFI_HII_IMAGE_DECODER_PROTOCOL instances installed in the
1106   system if the decoder of the certain image type is not supported by the
1107   EFI_HII_IMAGE_EX_PROTOCOL. The function will attempt to decode the image to the
1108   EFI_IMAGE_INPUT using the first EFI_HII_IMAGE_DECODER_PROTOCOL instance that
1109   supports the requested image type.
1110 
1111   @param  This                   A pointer to the EFI_HII_IMAGE_EX_PROTOCOL instance.
1112   @param  PackageList            The package list in the HII database to search for the
1113                                  specified image.
1114   @param  ImageId                The image's id, which is unique within PackageList.
1115   @param  Image                  Points to the image.
1116 
1117   @retval EFI_SUCCESS            The new image was returned successfully.
1118   @retval EFI_NOT_FOUND          The image specified by ImageId is not available. The specified
1119                                  PackageList is not in the Database.
1120   @retval EFI_INVALID_PARAMETER  Image was NULL or ImageId was 0.
1121   @retval EFI_OUT_OF_RESOURCES   The bitmap could not be retrieved because there
1122                                  was not enough memory.
1123 
1124 **/
1125 EFI_STATUS
1126 EFIAPI
1127 HiiGetImageEx (
1128   IN  CONST EFI_HII_IMAGE_EX_PROTOCOL *This,
1129   IN  EFI_HII_HANDLE                  PackageList,
1130   IN  EFI_IMAGE_ID                    ImageId,
1131   OUT EFI_IMAGE_INPUT                 *Image
1132   );
1133 
1134 /**
1135   Change the information about the image.
1136 
1137   Same with EFI_HII_IMAGE_PROTOCOL.SetImage(), this protocol invokes
1138   EFI_HII_IMAGE_PROTOCOL.SetImage()implicitly.
1139 
1140   @param  This                   A pointer to the EFI_HII_IMAGE_EX_PROTOCOL instance.
1141   @param  PackageList            The package list containing the images.
1142   @param  ImageId                The image's id, which is unique within PackageList.
1143   @param  Image                  Points to the image.
1144 
1145   @retval EFI_SUCCESS            The new image was successfully updated.
1146   @retval EFI_NOT_FOUND          The image specified by ImageId is not in the
1147                                  database. The specified PackageList is not in
1148                                  the database.
1149   @retval EFI_INVALID_PARAMETER  The Image was NULL, the ImageId was 0 or
1150                                  the Image->Bitmap was NULL.
1151 
1152 **/
1153 EFI_STATUS
1154 EFIAPI
1155 HiiSetImageEx (
1156   IN CONST EFI_HII_IMAGE_EX_PROTOCOL *This,
1157   IN EFI_HII_HANDLE                  PackageList,
1158   IN EFI_IMAGE_ID                    ImageId,
1159   IN CONST EFI_IMAGE_INPUT           *Image
1160   );
1161 
1162 /**
1163   Renders an image to a bitmap or to the display.
1164 
1165   The prototype of this extension function is the same with
1166   EFI_HII_IMAGE_PROTOCOL.DrawImage(). This protocol invokes
1167   EFI_HII_IMAGE_PROTOCOL.DrawImage() implicitly.
1168 
1169   @param  This                   A pointer to the EFI_HII_IMAGE_EX_PROTOCOL instance.
1170   @param  Flags                  Describes how the image is to be drawn.
1171   @param  Image                  Points to the image to be displayed.
1172   @param  Blt                    If this points to a non-NULL on entry, this points
1173                                  to the image, which is Width pixels wide and
1174                                  Height pixels high.  The image will be drawn onto
1175                                  this image and  EFI_HII_DRAW_FLAG_CLIP is implied.
1176                                  If this points to a NULL on entry, then a buffer
1177                                  will be allocated to hold the generated image and
1178                                  the pointer updated on exit. It is the caller's
1179                                  responsibility to free this buffer.
1180   @param  BltX                   Specifies the offset from the left and top edge of
1181                                  the output image of the first pixel in the image.
1182   @param  BltY                   Specifies the offset from the left and top edge of
1183                                  the output image of the first pixel in the image.
1184 
1185   @retval EFI_SUCCESS            The image was successfully drawn.
1186   @retval EFI_OUT_OF_RESOURCES   Unable to allocate an output buffer for Blt.
1187   @retval EFI_INVALID_PARAMETER  The Image or Blt was NULL.
1188 
1189 **/
1190 EFI_STATUS
1191 EFIAPI
1192 HiiDrawImageEx (
1193   IN CONST EFI_HII_IMAGE_EX_PROTOCOL *This,
1194   IN EFI_HII_DRAW_FLAGS              Flags,
1195   IN CONST EFI_IMAGE_INPUT           *Image,
1196   IN OUT EFI_IMAGE_OUTPUT            **Blt,
1197   IN UINTN                           BltX,
1198   IN UINTN                           BltY
1199   );
1200 
1201 /**
1202   Renders an image to a bitmap or the screen containing the contents of the specified
1203   image.
1204 
1205   This function is similar to EFI_HII_IMAGE_PROTOCOL.DrawImageId(). The difference is that
1206   this function will locate all EFI_HII_IMAGE_DECODER_PROTOCOL instances installed in the
1207   system if the decoder of the certain image type is not supported by the
1208   EFI_HII_IMAGE_EX_PROTOCOL. The function will attempt to decode the image to the
1209   EFI_IMAGE_INPUT using the first EFI_HII_IMAGE_DECODER_PROTOCOL instance that
1210   supports the requested image type.
1211 
1212   @param  This                   A pointer to the EFI_HII_IMAGE_EX_PROTOCOL instance.
1213   @param  Flags                  Describes how the image is to be drawn.
1214   @param  PackageList            The package list in the HII database to search for
1215                                  the  specified image.
1216   @param  ImageId                The image's id, which is unique within PackageList.
1217   @param  Blt                    If this points to a non-NULL on entry, this points
1218                                  to the image, which is Width pixels wide and
1219                                  Height pixels high. The image will be drawn onto
1220                                  this image and EFI_HII_DRAW_FLAG_CLIP is implied.
1221                                  If this points to a NULL on entry, then a buffer
1222                                  will be allocated to hold  the generated image
1223                                  and the pointer updated on exit. It is the caller's
1224                                  responsibility to free this buffer.
1225   @param  BltX                   Specifies the offset from the left and top edge of
1226                                  the output image of the first pixel in the image.
1227   @param  BltY                   Specifies the offset from the left and top edge of
1228                                  the output image of the first pixel in the image.
1229 
1230   @retval EFI_SUCCESS            The image was successfully drawn.
1231   @retval EFI_OUT_OF_RESOURCES   Unable to allocate an output buffer for Blt.
1232   @retval EFI_INVALID_PARAMETER  The Blt was NULL or ImageId was 0.
1233   @retval EFI_NOT_FOUND          The image specified by ImageId is not in the database.
1234                                  The specified PackageList is not in the database.
1235 
1236 **/
1237 EFI_STATUS
1238 EFIAPI
1239 HiiDrawImageIdEx (
1240   IN CONST EFI_HII_IMAGE_EX_PROTOCOL *This,
1241   IN EFI_HII_DRAW_FLAGS              Flags,
1242   IN EFI_HII_HANDLE                  PackageList,
1243   IN EFI_IMAGE_ID                    ImageId,
1244   IN OUT EFI_IMAGE_OUTPUT            **Blt,
1245   IN UINTN                           BltX,
1246   IN UINTN                           BltY
1247   );
1248 
1249 /**
1250   This function returns the image information to EFI_IMAGE_OUTPUT. Only the width
1251   and height are returned to the EFI_IMAGE_OUTPUT instead of decoding the image
1252   to the buffer. This function is used to get the geometry of the image. This function
1253   will try to locate all of the EFI_HII_IMAGE_DECODER_PROTOCOL installed on the
1254   system if the decoder of image type is not supported by the EFI_HII_IMAGE_EX_PROTOCOL.
1255 
1256   @param  This                   A pointer to the EFI_HII_IMAGE_EX_PROTOCOL instance.
1257   @param  PackageList            Handle of the package list where this image will
1258                                  be searched.
1259   @param  ImageId                The image's id, which is unique within PackageList.
1260   @param  Image                  Points to the image.
1261 
1262   @retval EFI_SUCCESS            The new image was returned successfully.
1263   @retval EFI_NOT_FOUND          The image specified by ImageId is not in the
1264                                  database. The specified PackageList is not in the database.
1265   @retval EFI_BUFFER_TOO_SMALL   The buffer specified by ImageSize is too small to
1266                                  hold the image.
1267   @retval EFI_INVALID_PARAMETER  The Image was NULL or the ImageId was 0.
1268   @retval EFI_OUT_OF_RESOURCES   The bitmap could not be retrieved because there
1269                                  was not enough memory.
1270 
1271 **/
1272 EFI_STATUS
1273 EFIAPI
1274 HiiGetImageInfo (
1275   IN CONST  EFI_HII_IMAGE_EX_PROTOCOL       *This,
1276   IN        EFI_HII_HANDLE                  PackageList,
1277   IN        EFI_IMAGE_ID                    ImageId,
1278   OUT       EFI_IMAGE_OUTPUT                *Image
1279   );
1280 //
1281 // EFI_HII_STRING_PROTOCOL
1282 //
1283 
1284 
1285 /**
1286   This function adds the string String to the group of strings owned by PackageList, with the
1287   specified font information StringFontInfo and returns a new string id.
1288 
1289   @param  This                    A pointer to the EFI_HII_STRING_PROTOCOL
1290                                   instance.
1291   @param  PackageList             Handle of the package list where this string will
1292                                   be added.
1293   @param  StringId                On return, contains the new strings id, which is
1294                                   unique within PackageList.
1295   @param  Language                Points to the language for the new string.
1296   @param  LanguageName            Points to the printable language name to
1297                                   associate with the passed in  Language field.If
1298                                   LanguageName is not NULL and the string package
1299                                   header's LanguageName  associated with a given
1300                                   Language is not zero, the LanguageName being
1301                                   passed  in will be ignored.
1302   @param  String                  Points to the new null-terminated string.
1303   @param  StringFontInfo          Points to the new string's font information or
1304                                   NULL if the string should have the default system
1305                                   font, size and style.
1306 
1307   @retval EFI_SUCCESS             The new string was added successfully.
1308   @retval EFI_NOT_FOUND           The specified PackageList could not be found in
1309                                   database.
1310   @retval EFI_OUT_OF_RESOURCES    Could not add the string due to lack of
1311                                   resources.
1312   @retval EFI_INVALID_PARAMETER   String is NULL or StringId is NULL or Language is
1313                                   NULL.
1314 
1315 **/
1316 EFI_STATUS
1317 EFIAPI
1318 HiiNewString (
1319   IN  CONST EFI_HII_STRING_PROTOCOL   *This,
1320   IN  EFI_HII_HANDLE                  PackageList,
1321   OUT EFI_STRING_ID                   *StringId,
1322   IN  CONST CHAR8                     *Language,
1323   IN  CONST CHAR16                    *LanguageName, OPTIONAL
1324   IN  CONST EFI_STRING                String,
1325   IN  CONST EFI_FONT_INFO             *StringFontInfo OPTIONAL
1326   );
1327 
1328 
1329 /**
1330   This function retrieves the string specified by StringId which is associated
1331   with the specified PackageList in the language Language and copies it into
1332   the buffer specified by String.
1333 
1334   @param  This                    A pointer to the EFI_HII_STRING_PROTOCOL
1335                                   instance.
1336   @param  Language                Points to the language for the retrieved string.
1337   @param  PackageList             The package list in the HII database to search
1338                                   for the  specified string.
1339   @param  StringId                The string's id, which is unique within
1340                                   PackageList.
1341   @param  String                  Points to the new null-terminated string.
1342   @param  StringSize              On entry, points to the size of the buffer
1343                                   pointed to by  String, in bytes. On return,
1344                                   points to the length of the string, in bytes.
1345   @param  StringFontInfo          If not NULL, points to the string's font
1346                                   information.  It's caller's responsibility to
1347                                   free this buffer.
1348 
1349   @retval EFI_SUCCESS             The string was returned successfully.
1350   @retval EFI_NOT_FOUND           The string specified by StringId is not
1351                                   available.
1352                                   The specified PackageList is not in the database.
1353   @retval EFI_INVALID_LANGUAGE    The string specified by StringId is available but
1354                                   not in the specified language.
1355   @retval EFI_BUFFER_TOO_SMALL    The buffer specified by StringSize is too small
1356                                   to  hold the string.
1357   @retval EFI_INVALID_PARAMETER   The Language or StringSize was NULL.
1358   @retval EFI_INVALID_PARAMETER   The value referenced by StringSize was not zero
1359                                   and String was NULL.
1360   @retval EFI_OUT_OF_RESOURCES    There were insufficient resources to complete the
1361                                    request.
1362 
1363 **/
1364 EFI_STATUS
1365 EFIAPI
1366 HiiGetString (
1367   IN  CONST EFI_HII_STRING_PROTOCOL   *This,
1368   IN  CONST CHAR8                     *Language,
1369   IN  EFI_HII_HANDLE                  PackageList,
1370   IN  EFI_STRING_ID                   StringId,
1371   OUT EFI_STRING                      String,
1372   IN  OUT UINTN                       *StringSize,
1373   OUT EFI_FONT_INFO                   **StringFontInfo OPTIONAL
1374   );
1375 
1376 
1377 /**
1378   This function updates the string specified by StringId in the specified PackageList to the text
1379   specified by String and, optionally, the font information specified by StringFontInfo.
1380 
1381   @param  This                    A pointer to the EFI_HII_STRING_PROTOCOL
1382                                   instance.
1383   @param  PackageList             The package list containing the strings.
1384   @param  StringId                The string's id, which is unique within
1385                                   PackageList.
1386   @param  Language                Points to the language for the updated string.
1387   @param  String                  Points to the new null-terminated string.
1388   @param  StringFontInfo          Points to the string's font information or NULL
1389                                   if the string font information is not changed.
1390 
1391   @retval EFI_SUCCESS             The string was updated successfully.
1392   @retval EFI_NOT_FOUND           The string specified by StringId is not in the
1393                                   database.
1394   @retval EFI_INVALID_PARAMETER   The String or Language was NULL.
1395   @retval EFI_OUT_OF_RESOURCES    The system is out of resources to accomplish the
1396                                   task.
1397 
1398 **/
1399 EFI_STATUS
1400 EFIAPI
1401 HiiSetString (
1402   IN CONST EFI_HII_STRING_PROTOCOL    *This,
1403   IN EFI_HII_HANDLE                   PackageList,
1404   IN EFI_STRING_ID                    StringId,
1405   IN CONST CHAR8                      *Language,
1406   IN CONST EFI_STRING                 String,
1407   IN CONST EFI_FONT_INFO              *StringFontInfo OPTIONAL
1408   );
1409 
1410 
1411 /**
1412   This function returns the list of supported languages, in the format specified
1413   in Appendix M of UEFI 2.1 spec.
1414 
1415   @param  This                    A pointer to the EFI_HII_STRING_PROTOCOL
1416                                   instance.
1417   @param  PackageList             The package list to examine.
1418   @param  Languages               Points to the buffer to hold the returned
1419                                   null-terminated ASCII string.
1420   @param  LanguagesSize           On entry, points to the size of the buffer
1421                                   pointed to by  Languages, in bytes. On  return,
1422                                   points to the length of Languages, in bytes.
1423 
1424   @retval EFI_SUCCESS             The languages were returned successfully.
1425   @retval EFI_INVALID_PARAMETER   The LanguagesSize was NULL.
1426   @retval EFI_INVALID_PARAMETER   The value referenced by LanguagesSize is not zero and Languages is NULL.
1427   @retval EFI_BUFFER_TOO_SMALL    The LanguagesSize is too small to hold the list
1428                                   of  supported languages. LanguageSize is updated
1429                                   to contain the required size.
1430   @retval EFI_NOT_FOUND           Could not find string package in specified
1431                                   packagelist.
1432 
1433 **/
1434 EFI_STATUS
1435 EFIAPI
1436 HiiGetLanguages (
1437   IN CONST EFI_HII_STRING_PROTOCOL    *This,
1438   IN EFI_HII_HANDLE                   PackageList,
1439   IN OUT CHAR8                        *Languages,
1440   IN OUT UINTN                        *LanguagesSize
1441   );
1442 
1443 
1444 /**
1445   Each string package has associated with it a single primary language and zero
1446   or more secondary languages. This routine returns the secondary languages
1447   associated with a package list.
1448 
1449   @param  This                    A pointer to the EFI_HII_STRING_PROTOCOL
1450                                   instance.
1451   @param  PackageList             The package list to examine.
1452   @param  PrimaryLanguage         Points to the null-terminated ASCII string that specifies
1453                                   the primary language. Languages are specified in the
1454                                   format specified in Appendix M of the UEFI 2.0 specification.
1455   @param  SecondaryLanguages      Points to the buffer to hold the returned null-terminated
1456                                   ASCII string that describes the list of
1457                                   secondary languages for the specified
1458                                   PrimaryLanguage. If there are no secondary
1459                                   languages, the function returns successfully,
1460                                   but this is set to NULL.
1461   @param  SecondaryLanguagesSize  On entry, points to the size of the buffer
1462                                   pointed to by SecondaryLanguages, in bytes. On
1463                                   return, points to the length of SecondaryLanguages
1464                                   in bytes.
1465 
1466   @retval EFI_SUCCESS             Secondary languages were correctly returned.
1467   @retval EFI_INVALID_PARAMETER   PrimaryLanguage or SecondaryLanguagesSize was NULL.
1468   @retval EFI_INVALID_PARAMETER   The value referenced by SecondaryLanguagesSize is not
1469                                   zero and SecondaryLanguages is NULL.
1470   @retval EFI_BUFFER_TOO_SMALL    The buffer specified by SecondaryLanguagesSize is
1471                                   too small to hold the returned information.
1472                                   SecondaryLanguageSize is updated to hold the size of
1473                                   the buffer required.
1474   @retval EFI_INVALID_LANGUAGE    The language specified by PrimaryLanguage is not
1475                                   present in the specified package list.
1476   @retval EFI_NOT_FOUND           The specified PackageList is not in the Database.
1477 
1478 **/
1479 EFI_STATUS
1480 EFIAPI
1481 HiiGetSecondaryLanguages (
1482   IN CONST EFI_HII_STRING_PROTOCOL   *This,
1483   IN EFI_HII_HANDLE                  PackageList,
1484   IN CONST CHAR8                     *PrimaryLanguage,
1485   IN OUT CHAR8                       *SecondaryLanguages,
1486   IN OUT UINTN                       *SecondaryLanguagesSize
1487   );
1488 
1489 //
1490 // EFI_HII_DATABASE_PROTOCOL protocol interfaces
1491 //
1492 
1493 
1494 /**
1495   This function adds the packages in the package list to the database and returns a handle. If there is a
1496   EFI_DEVICE_PATH_PROTOCOL associated with the DriverHandle, then this function will
1497   create a package of type EFI_PACKAGE_TYPE_DEVICE_PATH and add it to the package list.
1498 
1499   @param  This                    A pointer to the EFI_HII_DATABASE_PROTOCOL
1500                                   instance.
1501   @param  PackageList             A pointer to an EFI_HII_PACKAGE_LIST_HEADER
1502                                   structure.
1503   @param  DriverHandle            Associate the package list with this EFI handle.
1504                                   If a NULL is specified, this data will not be associate
1505                                   with any drivers and cannot have a callback induced.
1506   @param  Handle                  A pointer to the EFI_HII_HANDLE instance.
1507 
1508   @retval EFI_SUCCESS             The package list associated with the Handle was
1509                                   added to the HII database.
1510   @retval EFI_OUT_OF_RESOURCES    Unable to allocate necessary resources for the
1511                                   new database contents.
1512   @retval EFI_INVALID_PARAMETER   PackageList is NULL or Handle is NULL.
1513 
1514 **/
1515 EFI_STATUS
1516 EFIAPI
1517 HiiNewPackageList (
1518   IN CONST EFI_HII_DATABASE_PROTOCOL    *This,
1519   IN CONST EFI_HII_PACKAGE_LIST_HEADER  *PackageList,
1520   IN CONST EFI_HANDLE                   DriverHandle, OPTIONAL
1521   OUT EFI_HII_HANDLE                    *Handle
1522   );
1523 
1524 
1525 /**
1526   This function removes the package list that is associated with a handle Handle
1527   from the HII database. Before removing the package, any registered functions
1528   with the notification type REMOVE_PACK and the same package type will be called.
1529 
1530   @param  This                    A pointer to the EFI_HII_DATABASE_PROTOCOL
1531                                   instance.
1532   @param  Handle                  The handle that was registered to the data that
1533                                   is requested  for removal.
1534 
1535   @retval EFI_SUCCESS             The data associated with the Handle was removed
1536                                   from  the HII database.
1537   @retval EFI_NOT_FOUND           The specified Handle is not in database.
1538 
1539 **/
1540 EFI_STATUS
1541 EFIAPI
1542 HiiRemovePackageList (
1543   IN CONST EFI_HII_DATABASE_PROTOCOL    *This,
1544   IN EFI_HII_HANDLE                     Handle
1545   );
1546 
1547 
1548 /**
1549   This function updates the existing package list (which has the specified Handle)
1550   in the HII databases, using the new package list specified by PackageList.
1551 
1552   @param  This                    A pointer to the EFI_HII_DATABASE_PROTOCOL
1553                                   instance.
1554   @param  Handle                  The handle that was registered to the data that
1555                                   is  requested to be updated.
1556   @param  PackageList             A pointer to an EFI_HII_PACKAGE_LIST_HEADER
1557                                   package.
1558 
1559   @retval EFI_SUCCESS             The HII database was successfully updated.
1560   @retval EFI_OUT_OF_RESOURCES    Unable to allocate enough memory for the updated
1561                                   database.
1562   @retval EFI_INVALID_PARAMETER  PackageList was NULL.
1563   @retval EFI_NOT_FOUND          The specified Handle is not in database.
1564 
1565 **/
1566 EFI_STATUS
1567 EFIAPI
1568 HiiUpdatePackageList (
1569   IN CONST EFI_HII_DATABASE_PROTOCOL    *This,
1570   IN EFI_HII_HANDLE                     Handle,
1571   IN CONST EFI_HII_PACKAGE_LIST_HEADER  *PackageList
1572   );
1573 
1574 
1575 /**
1576   This function returns a list of the package handles of the specified type
1577   that are currently active in the database. The pseudo-type
1578   EFI_HII_PACKAGE_TYPE_ALL will cause all package handles to be listed.
1579 
1580   @param  This                    A pointer to the EFI_HII_DATABASE_PROTOCOL
1581                                   instance.
1582   @param  PackageType             Specifies the package type of the packages to
1583                                   list or EFI_HII_PACKAGE_TYPE_ALL for all packages
1584                                   to be listed.
1585   @param  PackageGuid             If PackageType is EFI_HII_PACKAGE_TYPE_GUID, then
1586                                   this  is the pointer to the GUID which must match
1587                                   the Guid field of EFI_HII_GUID_PACKAGE_GUID_HDR.
1588                                   Otherwise,  it must be NULL.
1589   @param  HandleBufferLength      On input, a pointer to the length of the handle
1590                                   buffer.  On output, the length of the handle
1591                                   buffer that is required for the handles found.
1592   @param  Handle                  An array of EFI_HII_HANDLE instances returned.
1593 
1594   @retval EFI_SUCCESS             The matching handles are outputted successfully.
1595                                   HandleBufferLength is updated with the actual length.
1596   @retval EFI_BUFFER_TO_SMALL     The HandleBufferLength parameter indicates that
1597                                   Handle is too small to support the number of
1598                                   handles. HandleBufferLength is updated with a
1599                                   value that will  enable the data to fit.
1600   @retval EFI_NOT_FOUND           No matching handle could not be found in
1601                                   database.
1602   @retval EFI_INVALID_PARAMETER   HandleBufferLength was NULL.
1603   @retval EFI_INVALID_PARAMETER   The value referenced by HandleBufferLength was not
1604                                   zero and Handle was NULL.
1605   @retval EFI_INVALID_PARAMETER   PackageType is not a EFI_HII_PACKAGE_TYPE_GUID but
1606                                   PackageGuid is not NULL, PackageType is a EFI_HII_
1607                                   PACKAGE_TYPE_GUID but PackageGuid is NULL.
1608 
1609 **/
1610 EFI_STATUS
1611 EFIAPI
1612 HiiListPackageLists (
1613   IN  CONST EFI_HII_DATABASE_PROTOCOL   *This,
1614   IN  UINT8                             PackageType,
1615   IN  CONST EFI_GUID                    *PackageGuid,
1616   IN  OUT UINTN                         *HandleBufferLength,
1617   OUT EFI_HII_HANDLE                    *Handle
1618   );
1619 
1620 
1621 /**
1622   This function will export one or all package lists in the database to a buffer.
1623   For each package list exported, this function will call functions registered
1624   with EXPORT_PACK and then copy the package list to the buffer.
1625 
1626   @param  This                    A pointer to the EFI_HII_DATABASE_PROTOCOL
1627                                   instance.
1628   @param  Handle                  An EFI_HII_HANDLE that corresponds to the desired
1629                                   package list in the HII database to export or
1630                                   NULL to indicate  all package lists should be
1631                                   exported.
1632   @param  BufferSize              On input, a pointer to the length of the buffer.
1633                                   On output, the length of the buffer that is
1634                                   required for the exported data.
1635   @param  Buffer                  A pointer to a buffer that will contain the
1636                                   results of  the export function.
1637 
1638   @retval EFI_SUCCESS             Package exported.
1639   @retval EFI_BUFFER_TO_SMALL     The HandleBufferLength parameter indicates that
1640                                   Handle is too small to support the number of
1641                                   handles.      HandleBufferLength is updated with
1642                                   a value that will enable the data to fit.
1643   @retval EFI_NOT_FOUND           The specified Handle could not be found in the
1644                                   current database.
1645   @retval EFI_INVALID_PARAMETER   BufferSize was NULL.
1646   @retval EFI_INVALID_PARAMETER   The value referenced by BufferSize was not zero
1647                                   and Buffer was NULL.
1648 
1649 **/
1650 EFI_STATUS
1651 EFIAPI
1652 HiiExportPackageLists (
1653   IN  CONST EFI_HII_DATABASE_PROTOCOL   *This,
1654   IN  EFI_HII_HANDLE                    Handle,
1655   IN  OUT UINTN                         *BufferSize,
1656   OUT EFI_HII_PACKAGE_LIST_HEADER       *Buffer
1657   );
1658 
1659 
1660 /**
1661   This function registers a function which will be called when specified actions related to packages of
1662   the specified type occur in the HII database. By registering a function, other HII-related drivers are
1663   notified when specific package types are added, removed or updated in the HII database.
1664   Each driver or application which registers a notification should use
1665   EFI_HII_DATABASE_PROTOCOL.UnregisterPackageNotify() before exiting.
1666 
1667   @param  This                    A pointer to the EFI_HII_DATABASE_PROTOCOL
1668                                   instance.
1669   @param  PackageType             Specifies the package type of the packages to
1670                                   list or EFI_HII_PACKAGE_TYPE_ALL for all packages
1671                                   to be listed.
1672   @param  PackageGuid             If PackageType is EFI_HII_PACKAGE_TYPE_GUID, then
1673                                   this is the pointer to the GUID which must match
1674                                   the Guid field of
1675                                   EFI_HII_GUID_PACKAGE_GUID_HDR. Otherwise, it must
1676                                   be NULL.
1677   @param  PackageNotifyFn         Points to the function to be called when the
1678                                   event specified by
1679                                   NotificationType occurs.
1680   @param  NotifyType              Describes the types of notification which this
1681                                   function will be receiving.
1682   @param  NotifyHandle            Points to the unique handle assigned to the
1683                                   registered notification. Can be used in
1684                                   EFI_HII_DATABASE_PROTOCOL.UnregisterPackageNotify()
1685                                   to stop notifications.
1686 
1687   @retval EFI_SUCCESS             Notification registered successfully.
1688   @retval EFI_OUT_OF_RESOURCES    Unable to allocate necessary data structures
1689   @retval EFI_INVALID_PARAMETER   NotifyHandle is NULL.
1690   @retval EFI_INVALID_PARAMETER   PackageGuid is not NULL when PackageType is not
1691                                   EFI_HII_PACKAGE_TYPE_GUID.
1692   @retval EFI_INVALID_PARAMETER   PackageGuid is NULL when PackageType is
1693                                   EFI_HII_PACKAGE_TYPE_GUID.
1694 
1695 **/
1696 EFI_STATUS
1697 EFIAPI
1698 HiiRegisterPackageNotify (
1699   IN  CONST EFI_HII_DATABASE_PROTOCOL   *This,
1700   IN  UINT8                             PackageType,
1701   IN  CONST EFI_GUID                    *PackageGuid,
1702   IN  CONST EFI_HII_DATABASE_NOTIFY     PackageNotifyFn,
1703   IN  EFI_HII_DATABASE_NOTIFY_TYPE      NotifyType,
1704   OUT EFI_HANDLE                        *NotifyHandle
1705   );
1706 
1707 
1708 /**
1709   Removes the specified HII database package-related notification.
1710 
1711   @param  This                    A pointer to the EFI_HII_DATABASE_PROTOCOL
1712                                   instance.
1713   @param  NotificationHandle      The handle of the notification function being
1714                                   unregistered.
1715 
1716   @retval EFI_SUCCESS             Notification is unregistered successfully.
1717   @retval EFI_NOT_FOUND          The incoming notification handle does not exist
1718                            in current hii database.
1719 
1720 **/
1721 EFI_STATUS
1722 EFIAPI
1723 HiiUnregisterPackageNotify (
1724   IN CONST EFI_HII_DATABASE_PROTOCOL    *This,
1725   IN EFI_HANDLE                         NotificationHandle
1726   );
1727 
1728 
1729 /**
1730   This routine retrieves an array of GUID values for each keyboard layout that
1731   was previously registered in the system.
1732 
1733   @param  This                    A pointer to the EFI_HII_DATABASE_PROTOCOL
1734                                   instance.
1735   @param  KeyGuidBufferLength     On input, a pointer to the length of the keyboard
1736                                   GUID  buffer. On output, the length of the handle
1737                                   buffer  that is required for the handles found.
1738   @param  KeyGuidBuffer           An array of keyboard layout GUID instances
1739                                   returned.
1740 
1741   @retval EFI_SUCCESS             KeyGuidBuffer was updated successfully.
1742   @retval EFI_BUFFER_TOO_SMALL    The KeyGuidBufferLength parameter indicates
1743                                   that KeyGuidBuffer is too small to support the
1744                                   number of GUIDs. KeyGuidBufferLength is
1745                                   updated with a value that will enable the data to
1746                                   fit.
1747   @retval EFI_INVALID_PARAMETER   The KeyGuidBufferLength is NULL.
1748   @retval EFI_INVALID_PARAMETER   The value referenced by KeyGuidBufferLength is not
1749                                   zero and KeyGuidBuffer is NULL.
1750   @retval EFI_NOT_FOUND           There was no keyboard layout.
1751 
1752 **/
1753 EFI_STATUS
1754 EFIAPI
1755 HiiFindKeyboardLayouts (
1756   IN  CONST EFI_HII_DATABASE_PROTOCOL   *This,
1757   IN  OUT UINT16                        *KeyGuidBufferLength,
1758   OUT EFI_GUID                          *KeyGuidBuffer
1759   );
1760 
1761 
1762 /**
1763   This routine retrieves the requested keyboard layout. The layout is a physical description of the keys
1764   on a keyboard and the character(s) that are associated with a particular set of key strokes.
1765 
1766   @param  This                    A pointer to the EFI_HII_DATABASE_PROTOCOL
1767                                   instance.
1768   @param  KeyGuid                 A pointer to the unique ID associated with a
1769                                   given keyboard layout. If KeyGuid is NULL then
1770                                   the current layout will be retrieved.
1771   @param  KeyboardLayoutLength    On input, a pointer to the length of the
1772                                   KeyboardLayout buffer.  On output, the length of
1773                                   the data placed into KeyboardLayout.
1774   @param  KeyboardLayout          A pointer to a buffer containing the retrieved
1775                                   keyboard layout.
1776 
1777   @retval EFI_SUCCESS             The keyboard layout was retrieved successfully.
1778   @retval EFI_NOT_FOUND           The requested keyboard layout was not found.
1779   @retval EFI_INVALID_PARAMETER   The KeyboardLayout or KeyboardLayoutLength was
1780                                   NULL.
1781 
1782 **/
1783 EFI_STATUS
1784 EFIAPI
1785 HiiGetKeyboardLayout (
1786   IN  CONST EFI_HII_DATABASE_PROTOCOL   *This,
1787   IN  CONST EFI_GUID                          *KeyGuid,
1788   IN OUT UINT16                         *KeyboardLayoutLength,
1789   OUT EFI_HII_KEYBOARD_LAYOUT           *KeyboardLayout
1790   );
1791 
1792 
1793 /**
1794   This routine sets the default keyboard layout to the one referenced by KeyGuid. When this routine
1795   is called, an event will be signaled of the EFI_HII_SET_KEYBOARD_LAYOUT_EVENT_GUID
1796   group type. This is so that agents which are sensitive to the current keyboard layout being changed
1797   can be notified of this change.
1798 
1799   @param  This                    A pointer to the EFI_HII_DATABASE_PROTOCOL
1800                                   instance.
1801   @param  KeyGuid                 A pointer to the unique ID associated with a
1802                                   given keyboard layout.
1803 
1804   @retval EFI_SUCCESS             The current keyboard layout was successfully set.
1805   @retval EFI_NOT_FOUND           The referenced keyboard layout was not found, so
1806                                   action was taken.
1807   @retval EFI_INVALID_PARAMETER   The KeyGuid was NULL.
1808 
1809 **/
1810 EFI_STATUS
1811 EFIAPI
1812 HiiSetKeyboardLayout (
1813   IN CONST EFI_HII_DATABASE_PROTOCOL          *This,
1814   IN CONST EFI_GUID                           *KeyGuid
1815   );
1816 
1817 
1818 /**
1819   Return the EFI handle associated with a package list.
1820 
1821   @param  This                    A pointer to the EFI_HII_DATABASE_PROTOCOL
1822                                   instance.
1823   @param  PackageListHandle       An EFI_HII_HANDLE that corresponds to the desired
1824                                   package list in the HIIdatabase.
1825   @param  DriverHandle            On return, contains the EFI_HANDLE which was
1826                                   registered with the package list in
1827                                   NewPackageList().
1828 
1829   @retval EFI_SUCCESS             The DriverHandle was returned successfully.
1830   @retval EFI_INVALID_PARAMETER   The PackageListHandle was not valid or
1831                                   DriverHandle was NULL.
1832 
1833 **/
1834 EFI_STATUS
1835 EFIAPI
1836 HiiGetPackageListHandle (
1837   IN  CONST EFI_HII_DATABASE_PROTOCOL         *This,
1838   IN  EFI_HII_HANDLE                    PackageListHandle,
1839   OUT EFI_HANDLE                        *DriverHandle
1840   );
1841 
1842 //
1843 // EFI_HII_CONFIG_ROUTING_PROTOCOL interfaces
1844 //
1845 
1846 
1847 /**
1848   This function allows a caller to extract the current configuration
1849   for one or more named elements from one or more drivers.
1850 
1851   @param  This                    A pointer to the EFI_HII_CONFIG_ROUTING_PROTOCOL
1852                                   instance.
1853   @param  Request                 A null-terminated Unicode string in
1854                                   <MultiConfigRequest> format.
1855   @param  Progress                On return, points to a character in the Request
1856                                   string. Points to the string's null terminator if
1857                                   request was successful. Points to the most recent
1858                                   & before the first failing name / value pair (or
1859                                   the beginning of the string if the failure is in
1860                                   the first name / value pair) if the request was
1861                                   not successful.
1862   @param  Results                 Null-terminated Unicode string in
1863                                   <MultiConfigAltResp> format which has all values
1864                                   filled in for the names in the Request string.
1865                                   String to be allocated by the called function.
1866 
1867   @retval EFI_SUCCESS             The Results string is filled with the values
1868                                   corresponding to all requested names.
1869   @retval EFI_OUT_OF_RESOURCES    Not enough memory to store the parts of the
1870                                   results that must be stored awaiting possible
1871                                   future        protocols.
1872   @retval EFI_NOT_FOUND           Routing data doesn't match any known driver.
1873                                      Progress set to the "G" in "GUID" of the
1874                                   routing  header that doesn't match. Note: There
1875                                   is no         requirement that all routing data
1876                                   be validated before any configuration extraction.
1877   @retval EFI_INVALID_PARAMETER   For example, passing in a NULL for the Request
1878                                   parameter would result in this type of error. The
1879                                   Progress parameter is set to NULL.
1880   @retval EFI_INVALID_PARAMETER   Illegal syntax. Progress set to most recent &
1881                                   before the error or the beginning of the string.
1882   @retval EFI_INVALID_PARAMETER   Unknown name. Progress points to the & before the
1883                                   name in question.
1884 
1885 **/
1886 EFI_STATUS
1887 EFIAPI
1888 HiiConfigRoutingExtractConfig (
1889   IN  CONST EFI_HII_CONFIG_ROUTING_PROTOCOL  *This,
1890   IN  CONST EFI_STRING                       Request,
1891   OUT EFI_STRING                             *Progress,
1892   OUT EFI_STRING                             *Results
1893   );
1894 
1895 
1896 /**
1897   This function allows the caller to request the current configuration for the
1898   entirety of the current HII database and returns the data in a null-terminated Unicode string.
1899 
1900   @param  This                    A pointer to the EFI_HII_CONFIG_ROUTING_PROTOCOL
1901                                   instance.
1902   @param  Results                 Null-terminated Unicode string in
1903                                   <MultiConfigAltResp> format which has all values
1904                                   filled in for the entirety of the current HII
1905                                   database. String to be allocated by the  called
1906                                   function. De-allocation is up to the caller.
1907 
1908   @retval EFI_SUCCESS             The Results string is filled with the values
1909                                   corresponding to all requested names.
1910   @retval EFI_OUT_OF_RESOURCES    Not enough memory to store the parts of the
1911                                   results that must be stored awaiting possible
1912                                   future        protocols.
1913   @retval EFI_INVALID_PARAMETER   For example, passing in a NULL for the Results
1914                                   parameter would result in this type of error.
1915 
1916 **/
1917 EFI_STATUS
1918 EFIAPI
1919 HiiConfigRoutingExportConfig (
1920   IN  CONST EFI_HII_CONFIG_ROUTING_PROTOCOL  *This,
1921   OUT EFI_STRING                             *Results
1922   );
1923 
1924 
1925 /**
1926   This function processes the results of processing forms and routes it to the
1927   appropriate handlers or storage.
1928 
1929   @param  This                    A pointer to the EFI_HII_CONFIG_ROUTING_PROTOCOL
1930                                   instance.
1931   @param  Configuration           A null-terminated Unicode string in
1932                                   <MulltiConfigResp> format.
1933   @param  Progress                A pointer to a string filled in with the offset
1934                                   of the most recent & before the first failing
1935                                   name / value pair (or the beginning of the string
1936                                   if the failure is in the first name / value pair)
1937                                   or the terminating NULL if all was successful.
1938 
1939   @retval EFI_SUCCESS             The results have been distributed or are awaiting
1940                                   distribution.
1941   @retval EFI_OUT_OF_RESOURCES    Not enough memory to store the parts of the
1942                                   results that must be stored awaiting possible
1943                                   future        protocols.
1944   @retval EFI_INVALID_PARAMETER   Passing in a NULL for the Configuration parameter
1945                                   would result in this type of error.
1946   @retval EFI_NOT_FOUND           Target for the specified routing data was not
1947                                   found.
1948 
1949 **/
1950 EFI_STATUS
1951 EFIAPI
1952 HiiConfigRoutingRouteConfig (
1953   IN  CONST EFI_HII_CONFIG_ROUTING_PROTOCOL  *This,
1954   IN  CONST EFI_STRING                       Configuration,
1955   OUT EFI_STRING                             *Progress
1956   );
1957 
1958 
1959 
1960 /**
1961   This helper function is to be called by drivers to map configuration data stored
1962   in byte array ("block") formats such as UEFI Variables into current configuration strings.
1963 
1964   @param  This                    A pointer to the EFI_HII_CONFIG_ROUTING_PROTOCOL
1965                                   instance.
1966   @param  ConfigRequest           A null-terminated Unicode string in
1967                                   <ConfigRequest> format.
1968   @param  Block                   Array of bytes defining the block's
1969                                   configuration.
1970   @param  BlockSize               Length in bytes of Block.
1971   @param  Config                  Filled-in configuration string. String allocated
1972                                   by  the function. Returned only if call is
1973                                   successful.
1974   @param  Progress                A pointer to a string filled in with the offset
1975                                   of  the most recent & before the first failing
1976                                   name/value pair (or the beginning of the string
1977                                   if the failure is in the first name / value pair)
1978                                   or the terminating NULL if all was successful.
1979 
1980   @retval EFI_SUCCESS             The request succeeded. Progress points to the
1981                                   null terminator at the end of the ConfigRequest
1982                                         string.
1983   @retval EFI_OUT_OF_RESOURCES    Not enough memory to allocate Config.
1984                                   Progress points to the first character of
1985                                   ConfigRequest.
1986   @retval EFI_INVALID_PARAMETER   Passing in a NULL for the ConfigRequest or
1987                                   Block parameter would result in this type of
1988                                   error. Progress points to the first character of
1989                                   ConfigRequest.
1990   @retval EFI_NOT_FOUND           Target for the specified routing data was not
1991                                   found. Progress points to the "G" in "GUID" of
1992                                   the      errant routing data.
1993   @retval EFI_DEVICE_ERROR        Block not large enough. Progress undefined.
1994   @retval EFI_INVALID_PARAMETER   Encountered non <BlockName> formatted string.
1995                                        Block is left updated and Progress points at
1996                                   the '&' preceding the first non-<BlockName>.
1997 
1998 **/
1999 EFI_STATUS
2000 EFIAPI
2001 HiiBlockToConfig (
2002   IN  CONST EFI_HII_CONFIG_ROUTING_PROTOCOL  *This,
2003   IN  CONST EFI_STRING                       ConfigRequest,
2004   IN  CONST UINT8                            *Block,
2005   IN  CONST UINTN                            BlockSize,
2006   OUT EFI_STRING                             *Config,
2007   OUT EFI_STRING                             *Progress
2008   );
2009 
2010 
2011 /**
2012   This helper function is to be called by drivers to map configuration strings
2013   to configurations stored in byte array ("block") formats such as UEFI Variables.
2014 
2015   @param  This                    A pointer to the EFI_HII_CONFIG_ROUTING_PROTOCOL
2016                                   instance.
2017   @param  ConfigResp              A null-terminated Unicode string in <ConfigResp>
2018                                   format.
2019   @param  Block                   A possibly null array of bytes representing the
2020                                   current  block. Only bytes referenced in the
2021                                   ConfigResp string  in the block are modified. If
2022                                   this parameter is null or if the *BlockSize
2023                                   parameter is (on input) shorter than required by
2024                                   the Configuration string, only the BlockSize
2025                                   parameter is updated and an appropriate status
2026                                   (see below)  is returned.
2027   @param  BlockSize               The length of the Block in units of UINT8.  On
2028                                   input, this is the size of the Block. On output,
2029                                   if successful, contains the largest index of the
2030                                   modified byte in the Block, or the required buffer
2031                                   size if the Block is not large enough.
2032   @param  Progress                On return, points to an element of the ConfigResp
2033                                    string filled in with the offset of the most
2034                                   recent '&' before the first failing name / value
2035                                   pair (or  the beginning of the string if the
2036                                   failure is in the  first name / value pair) or
2037                                   the terminating NULL if all was successful.
2038 
2039   @retval EFI_SUCCESS             The request succeeded. Progress points to the
2040                                   null terminator at the end of the ConfigResp
2041                                   string.
2042   @retval EFI_OUT_OF_RESOURCES    Not enough memory to allocate Config.
2043                                   Progress points to the first character of
2044                                   ConfigResp.
2045   @retval EFI_INVALID_PARAMETER   Passing in a NULL for the ConfigResp or
2046                                   Block parameter would result in this type of
2047                                   error. Progress points to the first character of
2048                                            ConfigResp.
2049   @retval EFI_NOT_FOUND           Target for the specified routing data was not
2050                                   found. Progress points to the "G" in "GUID" of
2051                                   the      errant routing data.
2052   @retval EFI_INVALID_PARAMETER   Encountered non <BlockName> formatted name /
2053                                   value pair. Block is left updated and
2054                                   Progress points at the '&' preceding the first
2055                                   non-<BlockName>.
2056   @retval EFI_BUFFER_TOO_SMALL    Block not large enough. Progress undefined.
2057                                   BlockSize is updated with the required buffer size.
2058 
2059 **/
2060 EFI_STATUS
2061 EFIAPI
2062 HiiConfigToBlock (
2063   IN     CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,
2064   IN     CONST EFI_STRING                      ConfigResp,
2065   IN OUT UINT8                                 *Block,
2066   IN OUT UINTN                                 *BlockSize,
2067   OUT    EFI_STRING                            *Progress
2068   );
2069 
2070 
2071 /**
2072   This helper function is to be called by drivers to extract portions of
2073   a larger configuration string.
2074 
2075   @param  This                    A pointer to the EFI_HII_CONFIG_ROUTING_PROTOCOL
2076                                   instance.
2077   @param  Configuration           A null-terminated Unicode string in
2078                                   <MultiConfigAltResp> format.
2079   @param  Guid                    A pointer to the GUID value to search for in the
2080                                   routing portion of the ConfigResp string when
2081                                   retrieving  the requested data. If Guid is NULL,
2082                                   then all GUID  values will be searched for.
2083   @param  Name                    A pointer to the NAME value to search for in the
2084                                   routing portion of the ConfigResp string when
2085                                   retrieving  the requested data. If Name is NULL,
2086                                   then all Name  values will be searched for.
2087   @param  DevicePath              A pointer to the PATH value to search for in the
2088                                   routing portion of the ConfigResp string when
2089                                   retrieving  the requested data. If DevicePath is
2090                                   NULL, then all  DevicePath values will be
2091                                   searched for.
2092   @param  AltCfgId                A pointer to the ALTCFG value to search for in
2093                                   the  routing portion of the ConfigResp string
2094                                   when retrieving  the requested data.  If this
2095                                   parameter is NULL,  then the current setting will
2096                                   be retrieved.
2097   @param  AltCfgResp              A pointer to a buffer which will be allocated by
2098                                   the  function which contains the retrieved string
2099                                   as requested.   This buffer is only allocated if
2100                                   the call was successful.
2101 
2102   @retval EFI_SUCCESS             The request succeeded. The requested data was
2103                                   extracted  and placed in the newly allocated
2104                                   AltCfgResp buffer.
2105   @retval EFI_OUT_OF_RESOURCES    Not enough memory to allocate AltCfgResp.
2106   @retval EFI_INVALID_PARAMETER   Any parameter is invalid.
2107   @retval EFI_NOT_FOUND           Target for the specified routing data was not
2108                                   found.
2109 
2110 **/
2111 EFI_STATUS
2112 EFIAPI
2113 HiiGetAltCfg (
2114   IN  CONST EFI_HII_CONFIG_ROUTING_PROTOCOL    *This,
2115   IN  CONST EFI_STRING                         Configuration,
2116   IN  CONST EFI_GUID                           *Guid,
2117   IN  CONST EFI_STRING                         Name,
2118   IN  CONST EFI_DEVICE_PATH_PROTOCOL           *DevicePath,
2119   IN  CONST UINT16                             *AltCfgId,
2120   OUT EFI_STRING                               *AltCfgResp
2121   );
2122 
2123 /**
2124 
2125   This function accepts a <MultiKeywordResp> formatted string, finds the associated
2126   keyword owners, creates a <MultiConfigResp> string from it and forwards it to the
2127   EFI_HII_ROUTING_PROTOCOL.RouteConfig function.
2128 
2129   If there is an issue in resolving the contents of the KeywordString, then the
2130   function returns an error and also sets the Progress and ProgressErr with the
2131   appropriate information about where the issue occurred and additional data about
2132   the nature of the issue.
2133 
2134   In the case when KeywordString containing multiple keywords, when an EFI_NOT_FOUND
2135   error is generated during processing the second or later keyword element, the system
2136   storage associated with earlier keywords is not modified. All elements of the
2137   KeywordString must successfully pass all tests for format and access prior to making
2138   any modifications to storage.
2139 
2140   In the case when EFI_DEVICE_ERROR is returned from the processing of a KeywordString
2141   containing multiple keywords, the state of storage associated with earlier keywords
2142   is undefined.
2143 
2144 
2145   @param This             Pointer to the EFI_KEYWORD_HANDLER _PROTOCOL instance.
2146 
2147   @param KeywordString    A null-terminated string in <MultiKeywordResp> format.
2148 
2149   @param Progress         On return, points to a character in the KeywordString.
2150                           Points to the string's NULL terminator if the request
2151                           was successful. Points to the most recent '&' before
2152                           the first failing name / value pair (or the beginning
2153                           of the string if the failure is in the first name / value
2154                           pair) if the request was not successful.
2155 
2156   @param ProgressErr      If during the processing of the KeywordString there was
2157                           a failure, this parameter gives additional information
2158                           about the possible source of the problem. The various
2159                           errors are defined in "Related Definitions" below.
2160 
2161 
2162   @retval EFI_SUCCESS             The specified action was completed successfully.
2163 
2164   @retval EFI_INVALID_PARAMETER   One or more of the following are TRUE:
2165                                   1. KeywordString is NULL.
2166                                   2. Parsing of the KeywordString resulted in an
2167                                      error. See Progress and ProgressErr for more data.
2168 
2169   @retval EFI_NOT_FOUND           An element of the KeywordString was not found.
2170                                   See ProgressErr for more data.
2171 
2172   @retval EFI_OUT_OF_RESOURCES    Required system resources could not be allocated.
2173                                   See ProgressErr for more data.
2174 
2175   @retval EFI_ACCESS_DENIED       The action violated system policy. See ProgressErr
2176                                   for more data.
2177 
2178   @retval EFI_DEVICE_ERROR        An unexpected system error occurred. See ProgressErr
2179                                   for more data.
2180 
2181 **/
2182 EFI_STATUS
2183 EFIAPI
2184 EfiConfigKeywordHandlerSetData (
2185   IN EFI_CONFIG_KEYWORD_HANDLER_PROTOCOL *This,
2186   IN CONST EFI_STRING                    KeywordString,
2187   OUT EFI_STRING                         *Progress,
2188   OUT UINT32                             *ProgressErr
2189   );
2190 
2191 /**
2192 
2193   This function accepts a <MultiKeywordRequest> formatted string, finds the underlying
2194   keyword owners, creates a <MultiConfigRequest> string from it and forwards it to the
2195   EFI_HII_ROUTING_PROTOCOL.ExtractConfig function.
2196 
2197   If there is an issue in resolving the contents of the KeywordString, then the function
2198   returns an EFI_INVALID_PARAMETER and also set the Progress and ProgressErr with the
2199   appropriate information about where the issue occurred and additional data about the
2200   nature of the issue.
2201 
2202   In the case when KeywordString is NULL, or contains multiple keywords, or when
2203   EFI_NOT_FOUND is generated while processing the keyword elements, the Results string
2204   contains values returned for all keywords processed prior to the keyword generating the
2205   error but no values for the keyword with error or any following keywords.
2206 
2207 
2208   @param This           Pointer to the EFI_KEYWORD_HANDLER _PROTOCOL instance.
2209 
2210   @param NameSpaceId    A null-terminated string containing the platform configuration
2211                         language to search through in the system. If a NULL is passed
2212                         in, then it is assumed that any platform configuration language
2213                         with the prefix of "x-UEFI-" are searched.
2214 
2215   @param KeywordString  A null-terminated string in <MultiKeywordRequest> format. If a
2216                         NULL is passed in the KeywordString field, all of the known
2217                         keywords in the system for the NameSpaceId specified are
2218                         returned in the Results field.
2219 
2220   @param Progress       On return, points to a character in the KeywordString. Points
2221                         to the string's NULL terminator if the request was successful.
2222                         Points to the most recent '&' before the first failing name / value
2223                         pair (or the beginning of the string if the failure is in the first
2224                         name / value pair) if the request was not successful.
2225 
2226   @param ProgressErr    If during the processing of the KeywordString there was a
2227                         failure, this parameter gives additional information about the
2228                         possible source of the problem. See the definitions in SetData()
2229                         for valid value definitions.
2230 
2231   @param Results        A null-terminated string in <MultiKeywordResp> format is returned
2232                         which has all the values filled in for the keywords in the
2233                         KeywordString. This is a callee-allocated field, and must be freed
2234                         by the caller after being used.
2235 
2236   @retval EFI_SUCCESS             The specified action was completed successfully.
2237 
2238   @retval EFI_INVALID_PARAMETER   One or more of the following are TRUE:
2239                                   1.Progress, ProgressErr, or Results is NULL.
2240                                   2.Parsing of the KeywordString resulted in an error. See
2241                                     Progress and ProgressErr for more data.
2242 
2243 
2244   @retval EFI_NOT_FOUND           An element of the KeywordString was not found. See
2245                                   ProgressErr for more data.
2246 
2247   @retval EFI_NOT_FOUND           The NamespaceId specified was not found.  See ProgressErr
2248                                   for more data.
2249 
2250   @retval EFI_OUT_OF_RESOURCES    Required system resources could not be allocated.  See
2251                                   ProgressErr for more data.
2252 
2253   @retval EFI_ACCESS_DENIED       The action violated system policy.  See ProgressErr for
2254                                   more data.
2255 
2256   @retval EFI_DEVICE_ERROR        An unexpected system error occurred.  See ProgressErr
2257                                   for more data.
2258 
2259 **/
2260 EFI_STATUS
2261 EFIAPI
2262 EfiConfigKeywordHandlerGetData (
2263   IN EFI_CONFIG_KEYWORD_HANDLER_PROTOCOL  *This,
2264   IN CONST EFI_STRING                     NameSpaceId, OPTIONAL
2265   IN CONST EFI_STRING                     KeywordString, OPTIONAL
2266   OUT EFI_STRING                          *Progress,
2267   OUT UINT32                              *ProgressErr,
2268   OUT EFI_STRING                          *Results
2269   );
2270 
2271 /**
2272   Compare whether two names of languages are identical.
2273 
2274   @param  Language1              Name of language 1 from StringPackage
2275   @param  Language2              Name of language 2 to be compared with language 1.
2276 
2277   @retval TRUE                   same
2278   @retval FALSE                  not same
2279 
2280 **/
2281 BOOLEAN
2282 HiiCompareLanguage (
2283   IN  CHAR8  *Language1,
2284   IN  CHAR8  *Language2
2285   )
2286 ;
2287 
2288 /**
2289   Retrieves a pointer to a Null-terminated ASCII string containing the list
2290   of languages that an HII handle in the HII Database supports.  The returned
2291   string is allocated using AllocatePool().  The caller is responsible for freeing
2292   the returned string using FreePool().  The format of the returned string follows
2293   the language format assumed the HII Database.
2294 
2295   If HiiHandle is NULL, then ASSERT().
2296 
2297   @param[in]  HiiHandle  A handle that was previously registered in the HII Database.
2298 
2299   @retval NULL   HiiHandle is not registered in the HII database
2300   @retval NULL   There are not enough resources available to retrieve the supported
2301                  languages.
2302   @retval NULL   The list of supported languages could not be retrieved.
2303   @retval Other  A pointer to the Null-terminated ASCII string of supported languages.
2304 
2305 **/
2306 CHAR8 *
2307 GetSupportedLanguages (
2308   IN EFI_HII_HANDLE           HiiHandle
2309   );
2310 
2311 /**
2312 This function mainly use to get HiiDatabase information.
2313 
2314 @param  This                   A pointer to the EFI_HII_DATABASE_PROTOCOL instance.
2315 
2316 @retval EFI_SUCCESS            Get the information successfully.
2317 @retval EFI_OUT_OF_RESOURCES   Not enough memory to store the Hiidatabase data.
2318 
2319 **/
2320 EFI_STATUS
2321 HiiGetDatabaseInfo(
2322   IN CONST EFI_HII_DATABASE_PROTOCOL        *This
2323   );
2324 
2325 /**
2326 This is an internal function,mainly use to get and update configuration settings information.
2327 
2328 @param  This                   A pointer to the EFI_HII_DATABASE_PROTOCOL instance.
2329 
2330 @retval EFI_SUCCESS            Get the information successfully.
2331 @retval EFI_OUT_OF_RESOURCES   Not enough memory to store the Configuration Setting data.
2332 
2333 **/
2334 EFI_STATUS
2335 HiiGetConfigurationSetting(
2336   IN CONST EFI_HII_DATABASE_PROTOCOL        *This
2337   );
2338 
2339 //
2340 // Global variables
2341 //
2342 extern EFI_EVENT gHiiKeyboardLayoutChanged;
2343 extern BOOLEAN   gExportAfterReadyToBoot;
2344 
2345 #endif
2346