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