1 /** @file
2 Private structures definitions in HiiDatabase.
3 
4 Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution.  The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9 
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 
13 **/
14 
15 #ifndef __HII_DATABASE_PRIVATE_H__
16 #define __HII_DATABASE_PRIVATE_H__
17 
18 #include <Uefi.h>
19 
20 #include <Protocol/DevicePath.h>
21 #include <Protocol/HiiFont.h>
22 #include <Protocol/HiiImage.h>
23 #include <Protocol/HiiString.h>
24 #include <Protocol/HiiDatabase.h>
25 #include <Protocol/HiiConfigRouting.h>
26 #include <Protocol/HiiConfigAccess.h>
27 #include <Protocol/SimpleTextOut.h>
28 
29 #include <Guid/HiiKeyBoardLayout.h>
30 #include <Guid/GlobalVariable.h>
31 
32 
33 #include <Library/DebugLib.h>
34 #include <Library/BaseMemoryLib.h>
35 #include <Library/UefiDriverEntryPoint.h>
36 #include <Library/UefiBootServicesTableLib.h>
37 #include <Library/BaseLib.h>
38 #include <Library/DevicePathLib.h>
39 #include <Library/MemoryAllocationLib.h>
40 #include <Library/UefiLib.h>
41 #include <Library/PcdLib.h>
42 #include <Library/UefiRuntimeServicesTableLib.h>
43 #include <Library/PrintLib.h>
44 
45 #define MAX_STRING_LENGTH                  1024
46 #define MAX_FONT_NAME_LEN                  256
47 #define NARROW_BASELINE                    15
48 #define WIDE_BASELINE                      14
49 #define SYS_FONT_INFO_MASK                 0x37
50 #define REPLACE_UNKNOWN_GLYPH              0xFFFD
51 #define PROPORTIONAL_GLYPH                 0x80
52 #define NARROW_GLYPH                       0x40
53 
54 #define BITMAP_LEN_1_BIT(Width, Height)  (((Width) + 7) / 8 * (Height))
55 #define BITMAP_LEN_4_BIT(Width, Height)  (((Width) + 1) / 2 * (Height))
56 #define BITMAP_LEN_8_BIT(Width, Height)  ((Width) * (Height))
57 #define BITMAP_LEN_24_BIT(Width, Height) ((Width) * (Height) * 3)
58 
59 //
60 // IFR data structure
61 //
62 // BASE_CR (a, IFR_DEFAULT_VALUE_DATA, Entry) to get the whole structure.
63 
64 typedef struct {
65   LIST_ENTRY          Entry;             // Link to VarStorage
66   EFI_GUID            Guid;
67   CHAR16              *Name;
68   UINT16              Size;
69   UINT8               Type;
70   LIST_ENTRY          BlockEntry;        // Link to its Block array
71 } IFR_VARSTORAGE_DATA;
72 
73 typedef struct {
74   LIST_ENTRY          Entry;             // Link to Block array
75   UINT16              Offset;
76   UINT16              Width;
77   EFI_QUESTION_ID     QuestionId;
78   UINT8               OpCode;
79   UINT8               Scope;
80   LIST_ENTRY          DefaultValueEntry; // Link to its default value array
81   CHAR16              *Name;
82 } IFR_BLOCK_DATA;
83 
84 //
85 // Get default value from IFR data.
86 //
87 typedef enum {
88   DefaultValueFromDefault = 0,     // Get from the minimum or first one when not set default value.
89   DefaultValueFromFlag,            // Get default value from the defalut flag.
90   DefaultValueFromOpcode           // Get default value from default opcode, highest priority.
91 } DEFAULT_VALUE_TYPE;
92 
93 typedef struct {
94   LIST_ENTRY          Entry;
95   DEFAULT_VALUE_TYPE  Type;
96   BOOLEAN             Cleaned;       // Whether this value is cleaned
97                                      // TRUE  Cleaned, the value can't be used
98                                      // FALSE Not cleaned, the value can  be used.
99   UINT16              DefaultId;
100   EFI_IFR_TYPE_VALUE  Value;
101 } IFR_DEFAULT_DATA;
102 
103 //
104 // Storage types
105 //
106 #define EFI_HII_VARSTORE_BUFFER              0
107 #define EFI_HII_VARSTORE_NAME_VALUE          1
108 #define EFI_HII_VARSTORE_EFI_VARIABLE        2
109 #define EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER 3
110 
111 #define HII_FORMSET_STORAGE_SIGNATURE           SIGNATURE_32 ('H', 'S', 'T', 'G')
112 typedef struct {
113   UINTN               Signature;
114   LIST_ENTRY          Entry;
115 
116   EFI_HII_HANDLE      HiiHandle;
117   EFI_HANDLE          DriverHandle;
118 
119   UINT8               Type;   // EFI_HII_VARSTORE_BUFFER, EFI_HII_VARSTORE_NAME_VALUE, EFI_HII_VARSTORE_EFI_VARIABLE
120   EFI_GUID            Guid;
121   CHAR16              *Name;
122   UINT16              Size;
123 } HII_FORMSET_STORAGE;
124 
125 
126 //
127 // String Package definitions
128 //
129 #define HII_STRING_PACKAGE_SIGNATURE    SIGNATURE_32 ('h','i','s','p')
130 typedef struct _HII_STRING_PACKAGE_INSTANCE {
131   UINTN                                 Signature;
132   EFI_HII_STRING_PACKAGE_HDR            *StringPkgHdr;
133   UINT8                                 *StringBlock;
134   LIST_ENTRY                            StringEntry;
135   LIST_ENTRY                            FontInfoList;  // local font info list
136   UINT8                                 FontId;
137   EFI_STRING_ID                         MaxStringId;   // record StringId
138 } HII_STRING_PACKAGE_INSTANCE;
139 
140 //
141 // Form Package definitions
142 //
143 #define HII_IFR_PACKAGE_SIGNATURE       SIGNATURE_32 ('h','f','r','p')
144 typedef struct _HII_IFR_PACKAGE_INSTANCE {
145   UINTN                                 Signature;
146   EFI_HII_PACKAGE_HEADER                FormPkgHdr;
147   UINT8                                 *IfrData;
148   LIST_ENTRY                            IfrEntry;
149 } HII_IFR_PACKAGE_INSTANCE;
150 
151 //
152 // Simple Font Package definitions
153 //
154 #define HII_S_FONT_PACKAGE_SIGNATURE    SIGNATURE_32 ('h','s','f','p')
155 typedef struct _HII_SIMPLE_FONT_PACKAGE_INSTANCE {
156   UINTN                                 Signature;
157   EFI_HII_SIMPLE_FONT_PACKAGE_HDR       *SimpleFontPkgHdr;
158   LIST_ENTRY                            SimpleFontEntry;
159 } HII_SIMPLE_FONT_PACKAGE_INSTANCE;
160 
161 //
162 // Font Package definitions
163 //
164 #define HII_FONT_PACKAGE_SIGNATURE      SIGNATURE_32 ('h','i','f','p')
165 typedef struct _HII_FONT_PACKAGE_INSTANCE {
166   UINTN                                 Signature;
167   EFI_HII_FONT_PACKAGE_HDR              *FontPkgHdr;
168   UINT16                                Height;
169   UINT16                                BaseLine;
170   UINT8                                 *GlyphBlock;
171   LIST_ENTRY                            FontEntry;
172   LIST_ENTRY                            GlyphInfoList;
173 } HII_FONT_PACKAGE_INSTANCE;
174 
175 #define HII_GLYPH_INFO_SIGNATURE        SIGNATURE_32 ('h','g','i','s')
176 typedef struct _HII_GLYPH_INFO {
177   UINTN                                 Signature;
178   LIST_ENTRY                            Entry;
179   CHAR16                                CharId;
180   EFI_HII_GLYPH_INFO                    Cell;
181 } HII_GLYPH_INFO;
182 
183 #define HII_FONT_INFO_SIGNATURE         SIGNATURE_32 ('h','l','f','i')
184 typedef struct _HII_FONT_INFO {
185   UINTN                                 Signature;
186   LIST_ENTRY                            Entry;
187   LIST_ENTRY                            *GlobalEntry;
188   UINT8                                 FontId;
189 } HII_FONT_INFO;
190 
191 #define HII_GLOBAL_FONT_INFO_SIGNATURE  SIGNATURE_32 ('h','g','f','i')
192 typedef struct _HII_GLOBAL_FONT_INFO {
193   UINTN                                 Signature;
194   LIST_ENTRY                            Entry;
195   HII_FONT_PACKAGE_INSTANCE             *FontPackage;
196   UINTN                                 FontInfoSize;
197   EFI_FONT_INFO                         *FontInfo;
198 } HII_GLOBAL_FONT_INFO;
199 
200 //
201 // Image Package definitions
202 //
203 
204 #define HII_PIXEL_MASK                  0x80
205 
206 typedef struct _HII_IMAGE_PACKAGE_INSTANCE {
207   EFI_HII_IMAGE_PACKAGE_HDR             ImagePkgHdr;
208   UINT32                                ImageBlockSize;
209   UINT32                                PaletteInfoSize;
210   UINT8                                 *ImageBlock;
211   UINT8                                 *PaletteBlock;
212 } HII_IMAGE_PACKAGE_INSTANCE;
213 
214 //
215 // Keyboard Layout Pacakge definitions
216 //
217 #define HII_KB_LAYOUT_PACKAGE_SIGNATURE SIGNATURE_32 ('h','k','l','p')
218 typedef struct _HII_KEYBOARD_LAYOUT_PACKAGE_INSTANCE {
219   UINTN                                 Signature;
220   UINT8                                 *KeyboardPkg;
221   LIST_ENTRY                            KeyboardEntry;
222 } HII_KEYBOARD_LAYOUT_PACKAGE_INSTANCE;
223 
224 //
225 // Guid Package definitions
226 //
227 #define HII_GUID_PACKAGE_SIGNATURE      SIGNATURE_32 ('h','i','g','p')
228 typedef struct _HII_GUID_PACKAGE_INSTANCE {
229   UINTN                                 Signature;
230   UINT8                                 *GuidPkg;
231   LIST_ENTRY                            GuidEntry;
232 } HII_GUID_PACKAGE_INSTANCE;
233 
234 //
235 // A package list can contain only one or less than one device path package.
236 // This rule also applies to image package since ImageId can not be duplicate.
237 //
238 typedef struct _HII_DATABASE_PACKAGE_LIST_INSTANCE {
239   EFI_HII_PACKAGE_LIST_HEADER           PackageListHdr;
240   LIST_ENTRY                            GuidPkgHdr;
241   LIST_ENTRY                            FormPkgHdr;
242   LIST_ENTRY                            KeyboardLayoutHdr;
243   LIST_ENTRY                            StringPkgHdr;
244   LIST_ENTRY                            FontPkgHdr;
245   HII_IMAGE_PACKAGE_INSTANCE            *ImagePkg;
246   LIST_ENTRY                            SimpleFontPkgHdr;
247   UINT8                                 *DevicePathPkg;
248 } HII_DATABASE_PACKAGE_LIST_INSTANCE;
249 
250 #define HII_HANDLE_SIGNATURE            SIGNATURE_32 ('h','i','h','l')
251 
252 typedef struct {
253   UINTN               Signature;
254   LIST_ENTRY          Handle;
255   UINTN               Key;
256 } HII_HANDLE;
257 
258 #define HII_DATABASE_RECORD_SIGNATURE   SIGNATURE_32 ('h','i','d','r')
259 
260 typedef struct _HII_DATABASE_RECORD {
261   UINTN                                 Signature;
262   HII_DATABASE_PACKAGE_LIST_INSTANCE    *PackageList;
263   EFI_HANDLE                            DriverHandle;
264   EFI_HII_HANDLE                        Handle;
265   LIST_ENTRY                            DatabaseEntry;
266 } HII_DATABASE_RECORD;
267 
268 #define HII_DATABASE_NOTIFY_SIGNATURE   SIGNATURE_32 ('h','i','d','n')
269 
270 typedef struct _HII_DATABASE_NOTIFY {
271   UINTN                                 Signature;
272   EFI_HANDLE                            NotifyHandle;
273   UINT8                                 PackageType;
274   EFI_GUID                              *PackageGuid;
275   EFI_HII_DATABASE_NOTIFY               PackageNotifyFn;
276   EFI_HII_DATABASE_NOTIFY_TYPE          NotifyType;
277   LIST_ENTRY                            DatabaseNotifyEntry;
278 } HII_DATABASE_NOTIFY;
279 
280 #define HII_DATABASE_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('H', 'i', 'D', 'p')
281 
282 typedef struct _HII_DATABASE_PRIVATE_DATA {
283   UINTN                                 Signature;
284   LIST_ENTRY                            DatabaseList;
285   LIST_ENTRY                            DatabaseNotifyList;
286   EFI_HII_FONT_PROTOCOL                 HiiFont;
287   EFI_HII_IMAGE_PROTOCOL                HiiImage;
288   EFI_HII_STRING_PROTOCOL               HiiString;
289   EFI_HII_DATABASE_PROTOCOL             HiiDatabase;
290   EFI_HII_CONFIG_ROUTING_PROTOCOL       ConfigRouting;
291   LIST_ENTRY                            HiiHandleList;
292   INTN                                  HiiHandleCount;
293   LIST_ENTRY                            FontInfoList;  // global font info list
294   UINTN                                 Attribute;     // default system color
295   EFI_GUID                              CurrentLayoutGuid;
296   EFI_HII_KEYBOARD_LAYOUT               *CurrentLayout;
297 } HII_DATABASE_PRIVATE_DATA;
298 
299 #define HII_FONT_DATABASE_PRIVATE_DATA_FROM_THIS(a) \
300   CR (a, \
301       HII_DATABASE_PRIVATE_DATA, \
302       HiiFont, \
303       HII_DATABASE_PRIVATE_DATA_SIGNATURE \
304       )
305 
306 #define HII_IMAGE_DATABASE_PRIVATE_DATA_FROM_THIS(a) \
307   CR (a, \
308       HII_DATABASE_PRIVATE_DATA, \
309       HiiImage, \
310       HII_DATABASE_PRIVATE_DATA_SIGNATURE \
311       )
312 
313 #define HII_STRING_DATABASE_PRIVATE_DATA_FROM_THIS(a) \
314   CR (a, \
315       HII_DATABASE_PRIVATE_DATA, \
316       HiiString, \
317       HII_DATABASE_PRIVATE_DATA_SIGNATURE \
318       )
319 
320 #define HII_DATABASE_DATABASE_PRIVATE_DATA_FROM_THIS(a) \
321   CR (a, \
322       HII_DATABASE_PRIVATE_DATA, \
323       HiiDatabase, \
324       HII_DATABASE_PRIVATE_DATA_SIGNATURE \
325       )
326 
327 #define CONFIG_ROUTING_DATABASE_PRIVATE_DATA_FROM_THIS(a) \
328   CR (a, \
329       HII_DATABASE_PRIVATE_DATA, \
330       ConfigRouting, \
331       HII_DATABASE_PRIVATE_DATA_SIGNATURE \
332       )
333 
334 //
335 // Internal function prototypes.
336 //
337 
338 /**
339   This function checks whether a handle is a valid EFI_HII_HANDLE.
340 
341   @param  Handle                  Pointer to a EFI_HII_HANDLE
342 
343   @retval TRUE                    Valid
344   @retval FALSE                   Invalid
345 
346 **/
347 BOOLEAN
348 IsHiiHandleValid (
349   EFI_HII_HANDLE Handle
350   );
351 
352 
353 /**
354   This function checks whether EFI_FONT_INFO exists in current database. If
355   FontInfoMask is specified, check what options can be used to make a match.
356   Note that the masks relate to where the system default should be supplied
357   are ignored by this function.
358 
359   @param  Private                 Hii database private structure.
360   @param  FontInfo                Points to EFI_FONT_INFO structure.
361   @param  FontInfoMask            If not NULL, describes what options can be used
362                                   to make a match between the font requested and
363                                   the font available. The caller must guarantee
364                                   this mask is valid.
365   @param  FontHandle              On entry, Points to the font handle returned by a
366                                   previous  call to GetFontInfo() or NULL to start
367                                   with the first font.
368   @param  GlobalFontInfo          If not NULL, output the corresponding globa font
369                                   info.
370 
371   @retval TRUE                    Existed
372   @retval FALSE                   Not existed
373 
374 **/
375 BOOLEAN
376 IsFontInfoExisted (
377   IN  HII_DATABASE_PRIVATE_DATA *Private,
378   IN  EFI_FONT_INFO             *FontInfo,
379   IN  EFI_FONT_INFO_MASK        *FontInfoMask,   OPTIONAL
380   IN  EFI_FONT_HANDLE           FontHandle,      OPTIONAL
381   OUT HII_GLOBAL_FONT_INFO      **GlobalFontInfo OPTIONAL
382   );
383 
384 /**
385 
386    This function invokes the matching registered function.
387 
388    @param  Private           HII Database driver private structure.
389    @param  NotifyType        The type of change concerning the database.
390    @param  PackageInstance   Points to the package referred to by the notification.
391    @param  PackageType       Package type
392    @param  Handle            The handle of the package list which contains the specified package.
393 
394    @retval EFI_SUCCESS            Already checked all registered function and invoked
395                                   if matched.
396    @retval EFI_INVALID_PARAMETER  Any input parameter is not valid.
397 
398 **/
399 EFI_STATUS
400 InvokeRegisteredFunction (
401   IN HII_DATABASE_PRIVATE_DATA    *Private,
402   IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType,
403   IN VOID                         *PackageInstance,
404   IN UINT8                        PackageType,
405   IN EFI_HII_HANDLE               Handle
406   )
407 ;
408 
409 /**
410   Retrieve system default font and color.
411 
412   @param  Private                 HII database driver private data.
413   @param  FontInfo                Points to system default font output-related
414                                   information. It's caller's responsibility to free
415                                   this buffer.
416   @param  FontInfoSize            If not NULL, output the size of buffer FontInfo.
417 
418   @retval EFI_SUCCESS             Cell information is added to the GlyphInfoList.
419   @retval EFI_OUT_OF_RESOURCES    The system is out of resources to accomplish the
420                                   task.
421   @retval EFI_INVALID_PARAMETER   Any input parameter is invalid.
422 
423 **/
424 EFI_STATUS
425 GetSystemFont (
426   IN  HII_DATABASE_PRIVATE_DATA      *Private,
427   OUT EFI_FONT_DISPLAY_INFO          **FontInfo,
428   OUT UINTN                          *FontInfoSize OPTIONAL
429   );
430 
431 
432 /**
433   Parse all string blocks to find a String block specified by StringId.
434   If StringId = (EFI_STRING_ID) (-1), find out all EFI_HII_SIBT_FONT blocks
435   within this string package and backup its information. If LastStringId is
436   specified, the string id of last string block will also be output.
437   If StringId = 0, output the string id of last string block (EFI_HII_SIBT_STRING).
438 
439   @param  Private                 Hii database private structure.
440   @param  StringPackage           Hii string package instance.
441   @param  StringId                The string's id, which is unique within
442                                   PackageList.
443   @param  BlockType               Output the block type of found string block.
444   @param  StringBlockAddr         Output the block address of found string block.
445   @param  StringTextOffset        Offset, relative to the found block address, of
446                                   the  string text information.
447   @param  LastStringId            Output the last string id when StringId = 0 or StringId = -1.
448   @param  StartStringId           The first id in the skip block which StringId in the block.
449 
450   @retval EFI_SUCCESS             The string text and font is retrieved
451                                   successfully.
452   @retval EFI_NOT_FOUND           The specified text or font info can not be found
453                                   out.
454   @retval EFI_OUT_OF_RESOURCES    The system is out of resources to accomplish the
455                                   task.
456 
457 **/
458 EFI_STATUS
459 FindStringBlock (
460   IN HII_DATABASE_PRIVATE_DATA        *Private,
461   IN  HII_STRING_PACKAGE_INSTANCE     *StringPackage,
462   IN  EFI_STRING_ID                   StringId,
463   OUT UINT8                           *BlockType, OPTIONAL
464   OUT UINT8                           **StringBlockAddr, OPTIONAL
465   OUT UINTN                           *StringTextOffset, OPTIONAL
466   OUT EFI_STRING_ID                   *LastStringId, OPTIONAL
467   OUT EFI_STRING_ID                   *StartStringId OPTIONAL
468   );
469 
470 
471 /**
472   Parse all glyph blocks to find a glyph block specified by CharValue.
473   If CharValue = (CHAR16) (-1), collect all default character cell information
474   within this font package and backup its information.
475 
476   @param  FontPackage             Hii string package instance.
477   @param  CharValue               Unicode character value, which identifies a glyph
478                                   block.
479   @param  GlyphBuffer             Output the corresponding bitmap data of the found
480                                   block. It is the caller's responsiblity to free
481                                   this buffer.
482   @param  Cell                    Output cell information of the encoded bitmap.
483   @param  GlyphBufferLen          If not NULL, output the length of GlyphBuffer.
484 
485   @retval EFI_SUCCESS             The bitmap data is retrieved successfully.
486   @retval EFI_NOT_FOUND           The specified CharValue does not exist in current
487                                   database.
488   @retval EFI_OUT_OF_RESOURCES    The system is out of resources to accomplish the
489                                   task.
490 
491 **/
492 EFI_STATUS
493 FindGlyphBlock (
494   IN  HII_FONT_PACKAGE_INSTANCE      *FontPackage,
495   IN  CHAR16                         CharValue,
496   OUT UINT8                          **GlyphBuffer, OPTIONAL
497   OUT EFI_HII_GLYPH_INFO             *Cell, OPTIONAL
498   OUT UINTN                          *GlyphBufferLen OPTIONAL
499   );
500 
501 /**
502   This function exports Form packages to a buffer.
503   This is a internal function.
504 
505   @param  Private                Hii database private structure.
506   @param  Handle                 Identification of a package list.
507   @param  PackageList            Pointer to a package list which will be exported.
508   @param  UsedSize               The length of buffer be used.
509   @param  BufferSize             Length of the Buffer.
510   @param  Buffer                 Allocated space for storing exported data.
511   @param  ResultSize             The size of the already exported content of  this
512                                  package list.
513 
514   @retval EFI_SUCCESS            Form Packages are exported successfully.
515   @retval EFI_INVALID_PARAMETER  Any input parameter is invalid.
516 
517 **/
518 EFI_STATUS
519 ExportFormPackages (
520   IN HII_DATABASE_PRIVATE_DATA          *Private,
521   IN EFI_HII_HANDLE                     Handle,
522   IN HII_DATABASE_PACKAGE_LIST_INSTANCE *PackageList,
523   IN UINTN                              UsedSize,
524   IN UINTN                              BufferSize,
525   IN OUT VOID                           *Buffer,
526   IN OUT UINTN                          *ResultSize
527   );
528 
529 //
530 // EFI_HII_FONT_PROTOCOL protocol interfaces
531 //
532 
533 
534 /**
535   Renders a string to a bitmap or to the display.
536 
537   @param  This                    A pointer to the EFI_HII_FONT_PROTOCOL instance.
538   @param  Flags                   Describes how the string is to be drawn.
539   @param  String                  Points to the null-terminated string to be
540                                   displayed.
541   @param  StringInfo              Points to the string output information,
542                                   including the color and font.  If NULL, then the
543                                   string will be output in the default system font
544                                   and color.
545   @param  Blt                     If this points to a non-NULL on entry, this
546                                   points to the image, which is Width pixels   wide
547                                   and Height pixels high. The string will be drawn
548                                   onto this image and
549                                   EFI_HII_OUT_FLAG_CLIP is implied. If this points
550                                   to a NULL on entry, then a              buffer
551                                   will be allocated to hold the generated image and
552                                   the pointer updated on exit. It is the caller's
553                                   responsibility to free this buffer.
554   @param  BltX                    Together with BltX, Specifies the offset from the left and top edge
555                                   of the image of the first character cell in the
556                                   image.
557   @param  BltY                    Together with BltY, Specifies the offset from the left and top edge
558                                   of the image of the first character cell in the
559                                   image.
560   @param  RowInfoArray            If this is non-NULL on entry, then on exit, this
561                                   will point to an allocated buffer    containing
562                                   row information and RowInfoArraySize will be
563                                   updated to contain the        number of elements.
564                                   This array describes the characters which were at
565                                   least partially drawn and the heights of the
566                                   rows. It is the caller's responsibility to free
567                                   this buffer.
568   @param  RowInfoArraySize        If this is non-NULL on entry, then on exit it
569                                   contains the number of elements in RowInfoArray.
570   @param  ColumnInfoArray         If this is non-NULL, then on return it will be
571                                   filled with the horizontal offset for each
572                                   character in the string on the row where it is
573                                   displayed. Non-printing characters will     have
574                                   the offset ~0. The caller is responsible to
575                                   allocate a buffer large enough so that    there
576                                   is one entry for each character in the string,
577                                   not including the null-terminator. It is possible
578                                   when character display is normalized that some
579                                   character cells overlap.
580 
581   @retval EFI_SUCCESS             The string was successfully rendered.
582   @retval EFI_OUT_OF_RESOURCES    Unable to allocate an output buffer for
583                                   RowInfoArray or Blt.
584   @retval EFI_INVALID_PARAMETER The String or Blt.
585   @retval EFI_INVALID_PARAMETER Flags were invalid combination..
586 
587 **/
588 EFI_STATUS
589 EFIAPI
590 HiiStringToImage (
591   IN  CONST EFI_HII_FONT_PROTOCOL    *This,
592   IN  EFI_HII_OUT_FLAGS              Flags,
593   IN  CONST EFI_STRING               String,
594   IN  CONST EFI_FONT_DISPLAY_INFO    *StringInfo       OPTIONAL,
595   IN  OUT EFI_IMAGE_OUTPUT           **Blt,
596   IN  UINTN                          BltX,
597   IN  UINTN                          BltY,
598   OUT EFI_HII_ROW_INFO               **RowInfoArray    OPTIONAL,
599   OUT UINTN                          *RowInfoArraySize OPTIONAL,
600   OUT UINTN                          *ColumnInfoArray  OPTIONAL
601   );
602 
603 
604 /**
605   Render a string to a bitmap or the screen containing the contents of the specified string.
606 
607   @param  This                    A pointer to the EFI_HII_FONT_PROTOCOL instance.
608   @param  Flags                   Describes how the string is to be drawn.
609   @param  PackageList             The package list in the HII database to search
610                                   for the specified string.
611   @param  StringId                The string's id, which is unique within
612                                   PackageList.
613   @param  Language                Points to the language for the retrieved string.
614                                   If NULL, then the current system language is
615                                   used.
616   @param  StringInfo              Points to the string output information,
617                                   including the color and font.  If NULL, then the
618                                   string will be output in the default system font
619                                   and color.
620   @param  Blt                     If this points to a non-NULL on entry, this
621                                   points to the image, which is Width pixels   wide
622                                   and Height pixels high. The string will be drawn
623                                   onto this image and
624                                   EFI_HII_OUT_FLAG_CLIP is implied. If this points
625                                   to a NULL on entry, then a              buffer
626                                   will be allocated to hold the generated image and
627                                   the pointer updated on exit. It is the caller's
628                                   responsibility to free this buffer.
629   @param  BltX                    Together with BltX, Specifies the offset from the left and top edge
630                                   of the image of the first character cell in the
631                                   image.
632   @param  BltY                    Together with BltY, Specifies the offset from the left and top edge
633                                   of the image of the first character cell in the
634                                   image.
635   @param  RowInfoArray            If this is non-NULL on entry, then on exit, this
636                                   will point to an allocated buffer    containing
637                                   row information and RowInfoArraySize will be
638                                   updated to contain the        number of elements.
639                                   This array describes the characters which were at
640                                   least partially drawn and the heights of the
641                                   rows. It is the caller's responsibility to free
642                                   this buffer.
643   @param  RowInfoArraySize        If this is non-NULL on entry, then on exit it
644                                   contains the number of elements in RowInfoArray.
645   @param  ColumnInfoArray         If this is non-NULL, then on return it will be
646                                   filled with the horizontal offset for each
647                                   character in the string on the row where it is
648                                   displayed. Non-printing characters will     have
649                                   the offset ~0. The caller is responsible to
650                                   allocate a buffer large enough so that    there
651                                   is one entry for each character in the string,
652                                   not including the null-terminator. It is possible
653                                   when character display is normalized that some
654                                   character cells overlap.
655 
656   @retval EFI_SUCCESS             The string was successfully rendered.
657   @retval EFI_OUT_OF_RESOURCES    Unable to allocate an output buffer for
658                                   RowInfoArray or Blt.
659   @retval EFI_INVALID_PARAMETER The Blt or PackageList was NULL.
660   @retval EFI_INVALID_PARAMETER Flags were invalid combination.
661   @retval EFI_NOT_FOUND         The specified PackageList is not in the Database or the stringid is not
662                           in the specified PackageList.
663 
664 **/
665 EFI_STATUS
666 EFIAPI
667 HiiStringIdToImage (
668   IN  CONST EFI_HII_FONT_PROTOCOL    *This,
669   IN  EFI_HII_OUT_FLAGS              Flags,
670   IN  EFI_HII_HANDLE                 PackageList,
671   IN  EFI_STRING_ID                  StringId,
672   IN  CONST CHAR8*                   Language,
673   IN  CONST EFI_FONT_DISPLAY_INFO    *StringInfo       OPTIONAL,
674   IN  OUT EFI_IMAGE_OUTPUT           **Blt,
675   IN  UINTN                          BltX,
676   IN  UINTN                          BltY,
677   OUT EFI_HII_ROW_INFO               **RowInfoArray    OPTIONAL,
678   OUT UINTN                          *RowInfoArraySize OPTIONAL,
679   OUT UINTN                          *ColumnInfoArray  OPTIONAL
680   );
681 
682 
683 /**
684   Convert the glyph for a single character into a bitmap.
685 
686   @param  This                    A pointer to the EFI_HII_FONT_PROTOCOL instance.
687   @param  Char                    Character to retrieve.
688   @param  StringInfo              Points to the string font and color information
689                                   or NULL if the string should use the default
690                                   system font and color.
691   @param  Blt                     Thus must point to a NULL on entry. A buffer will
692                                   be allocated to hold the output and the pointer
693                                   updated on exit. It is the caller's
694                                   responsibility to free this buffer.
695   @param  Baseline                Number of pixels from the bottom of the bitmap to
696                                   the baseline.
697 
698   @retval EFI_SUCCESS             Glyph bitmap created.
699   @retval EFI_OUT_OF_RESOURCES    Unable to allocate the output buffer Blt.
700   @retval EFI_WARN_UNKNOWN_GLYPH  The glyph was unknown and was replaced with the
701                                   glyph for Unicode character 0xFFFD.
702   @retval EFI_INVALID_PARAMETER   Blt is NULL or *Blt is not NULL.
703 
704 **/
705 EFI_STATUS
706 EFIAPI
707 HiiGetGlyph (
708   IN  CONST EFI_HII_FONT_PROTOCOL    *This,
709   IN  CHAR16                         Char,
710   IN  CONST EFI_FONT_DISPLAY_INFO    *StringInfo,
711   OUT EFI_IMAGE_OUTPUT               **Blt,
712   OUT UINTN                          *Baseline OPTIONAL
713   );
714 
715 
716 /**
717   This function iterates through fonts which match the specified font, using
718   the specified criteria. If String is non-NULL, then all of the characters in
719   the string must exist in order for a candidate font to be returned.
720 
721   @param  This                    A pointer to the EFI_HII_FONT_PROTOCOL instance.
722   @param  FontHandle              On entry, points to the font handle returned by a
723                                    previous call to GetFontInfo() or NULL to start
724                                   with the  first font. On return, points to the
725                                   returned font handle or points to NULL if there
726                                   are no more matching fonts.
727   @param  StringInfoIn            Upon entry, points to the font to return information
728                                   about. If NULL, then the information about the system
729                                   default font will be returned.
730   @param  StringInfoOut           Upon return, contains the matching font's information.
731                                   If NULL, then no information is returned. This buffer
732                                   is allocated with a call to the Boot Service AllocatePool().
733                                   It is the caller's responsibility to call the Boot
734                                   Service FreePool() when the caller no longer requires
735                                   the contents of StringInfoOut.
736   @param  String                  Points to the string which will be tested to
737                                   determine  if all characters are available. If
738                                   NULL, then any font  is acceptable.
739 
740   @retval EFI_SUCCESS             Matching font returned successfully.
741   @retval EFI_NOT_FOUND           No matching font was found.
742   @retval EFI_INVALID_PARAMETER   StringInfoIn is NULL.
743   @retval EFI_INVALID_PARAMETER   StringInfoIn->FontInfoMask is an invalid combination.
744   @retval EFI_OUT_OF_RESOURCES    There were insufficient resources to complete the
745                                   request.
746 **/
747 EFI_STATUS
748 EFIAPI
749 HiiGetFontInfo (
750   IN  CONST EFI_HII_FONT_PROTOCOL    *This,
751   IN  OUT   EFI_FONT_HANDLE          *FontHandle,
752   IN  CONST EFI_FONT_DISPLAY_INFO    *StringInfoIn, OPTIONAL
753   OUT       EFI_FONT_DISPLAY_INFO    **StringInfoOut,
754   IN  CONST EFI_STRING               String OPTIONAL
755   );
756 
757 //
758 // EFI_HII_IMAGE_PROTOCOL interfaces
759 //
760 
761 
762 /**
763   This function adds the image Image to the group of images owned by PackageList, and returns
764   a new image identifier (ImageId).
765 
766   @param  This                    A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
767   @param  PackageList             Handle of the package list where this image will
768                                   be added.
769   @param  ImageId                 On return, contains the new image id, which is
770                                   unique within PackageList.
771   @param  Image                   Points to the image.
772 
773   @retval EFI_SUCCESS             The new image was added successfully.
774   @retval EFI_NOT_FOUND           The specified PackageList could not be found in
775                                   database.
776   @retval EFI_OUT_OF_RESOURCES    Could not add the image due to lack of resources.
777   @retval EFI_INVALID_PARAMETER   Image is NULL or ImageId is NULL.
778 
779 **/
780 EFI_STATUS
781 EFIAPI
782 HiiNewImage (
783   IN  CONST EFI_HII_IMAGE_PROTOCOL   *This,
784   IN  EFI_HII_HANDLE                 PackageList,
785   OUT EFI_IMAGE_ID                   *ImageId,
786   IN  CONST EFI_IMAGE_INPUT          *Image
787   );
788 
789 
790 /**
791   This function retrieves the image specified by ImageId which is associated with
792   the specified PackageList and copies it into the buffer specified by Image.
793 
794   @param  This                    A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
795   @param  PackageList             Handle of the package list where this image will
796                                   be searched.
797   @param  ImageId                 The image's id,, which is unique within
798                                   PackageList.
799   @param  Image                   Points to the image.
800 
801   @retval EFI_SUCCESS             The new image was returned successfully.
802   @retval EFI_NOT_FOUND           The image specified by ImageId is not available.
803                                                  The specified PackageList is not in the database.
804   @retval EFI_BUFFER_TOO_SMALL    The buffer specified by ImageSize is too small to
805                                   hold the image.
806   @retval EFI_INVALID_PARAMETER   The Image or ImageSize was NULL.
807   @retval EFI_OUT_OF_RESOURCES   The bitmap could not be retrieved because there was not
808                                                        enough memory.
809 
810 **/
811 EFI_STATUS
812 EFIAPI
813 HiiGetImage (
814   IN  CONST EFI_HII_IMAGE_PROTOCOL   *This,
815   IN  EFI_HII_HANDLE                 PackageList,
816   IN  EFI_IMAGE_ID                   ImageId,
817   OUT EFI_IMAGE_INPUT                *Image
818   );
819 
820 
821 /**
822   This function updates the image specified by ImageId in the specified PackageListHandle to
823   the image specified by Image.
824 
825   @param  This                    A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
826   @param  PackageList             The package list containing the images.
827   @param  ImageId                 The image's id,, which is unique within
828                                   PackageList.
829   @param  Image                   Points to the image.
830 
831   @retval EFI_SUCCESS             The new image was updated successfully.
832   @retval EFI_NOT_FOUND           The image specified by ImageId is not in the
833                                                 database. The specified PackageList is not in the database.
834   @retval EFI_INVALID_PARAMETER   The Image was NULL.
835 
836 **/
837 EFI_STATUS
838 EFIAPI
839 HiiSetImage (
840   IN CONST EFI_HII_IMAGE_PROTOCOL    *This,
841   IN EFI_HII_HANDLE                  PackageList,
842   IN EFI_IMAGE_ID                    ImageId,
843   IN CONST EFI_IMAGE_INPUT           *Image
844   );
845 
846 
847 /**
848   This function renders an image to a bitmap or the screen using the specified
849   color and options. It draws the image on an existing bitmap, allocates a new
850   bitmap or uses the screen. The images can be clipped.
851 
852   @param  This                    A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
853   @param  Flags                   Describes how the image is to be drawn.
854   @param  Image                   Points to the image to be displayed.
855   @param  Blt                     If this points to a non-NULL on entry, this
856                                   points to the image, which is Width pixels wide
857                                   and Height pixels high.  The image will be drawn
858                                   onto this image and  EFI_HII_DRAW_FLAG_CLIP is
859                                   implied. If this points to a  NULL on entry, then
860                                   a buffer will be allocated to hold  the generated
861                                   image and the pointer updated on exit. It is the
862                                   caller's responsibility to free this buffer.
863   @param  BltX                    Specifies the offset from the left and top edge
864                                   of the  output image of the first pixel in the
865                                   image.
866   @param  BltY                    Specifies the offset from the left and top edge
867                                   of the  output image of the first pixel in the
868                                   image.
869 
870   @retval EFI_SUCCESS             The image was successfully drawn.
871   @retval EFI_OUT_OF_RESOURCES    Unable to allocate an output buffer for Blt.
872   @retval EFI_INVALID_PARAMETER   The Image or Blt was NULL.
873   @retval EFI_INVALID_PARAMETER   Any combination of Flags is invalid.
874 
875 **/
876 EFI_STATUS
877 EFIAPI
878 HiiDrawImage (
879   IN CONST EFI_HII_IMAGE_PROTOCOL    *This,
880   IN EFI_HII_DRAW_FLAGS              Flags,
881   IN CONST EFI_IMAGE_INPUT           *Image,
882   IN OUT EFI_IMAGE_OUTPUT            **Blt,
883   IN UINTN                           BltX,
884   IN UINTN                           BltY
885   );
886 
887 
888 /**
889   This function renders an image to a bitmap or the screen using the specified
890   color and options. It draws the image on an existing bitmap, allocates a new
891   bitmap or uses the screen. The images can be clipped.
892 
893   @param  This                    A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
894   @param  Flags                   Describes how the image is to be drawn.
895   @param  PackageList             The package list in the HII database to search
896                                   for the  specified image.
897   @param  ImageId                 The image's id, which is unique within
898                                   PackageList.
899   @param  Blt                     If this points to a non-NULL on entry, this
900                                   points to the image, which is Width pixels wide
901                                   and Height pixels high. The image will be drawn
902                                   onto this image and
903                                   EFI_HII_DRAW_FLAG_CLIP is implied. If this points
904                                   to a  NULL on entry, then a buffer will be
905                                   allocated to hold  the generated image and the
906                                   pointer updated on exit. It is the caller's
907                                   responsibility to free this buffer.
908   @param  BltX                    Specifies the offset from the left and top edge
909                                   of the  output image of the first pixel in the
910                                   image.
911   @param  BltY                    Specifies the offset from the left and top edge
912                                   of the  output image of the first pixel in the
913                                   image.
914 
915   @retval EFI_SUCCESS             The image was successfully drawn.
916   @retval EFI_OUT_OF_RESOURCES    Unable to allocate an output buffer for Blt.
917   @retval EFI_INVALID_PARAMETER  The Blt was NULL.
918   @retval EFI_NOT_FOUND          The image specified by ImageId is not in the database.
919                            The specified PackageList is not in the database.
920 
921 **/
922 EFI_STATUS
923 EFIAPI
924 HiiDrawImageId (
925   IN CONST EFI_HII_IMAGE_PROTOCOL    *This,
926   IN EFI_HII_DRAW_FLAGS              Flags,
927   IN EFI_HII_HANDLE                  PackageList,
928   IN EFI_IMAGE_ID                    ImageId,
929   IN OUT EFI_IMAGE_OUTPUT            **Blt,
930   IN UINTN                           BltX,
931   IN UINTN                           BltY
932   )
933 
934 ;
935 
936 //
937 // EFI_HII_STRING_PROTOCOL
938 //
939 
940 
941 /**
942   This function adds the string String to the group of strings owned by PackageList, with the
943   specified font information StringFontInfo and returns a new string id.
944 
945   @param  This                    A pointer to the EFI_HII_STRING_PROTOCOL
946                                   instance.
947   @param  PackageList             Handle of the package list where this string will
948                                   be added.
949   @param  StringId                On return, contains the new strings id, which is
950                                   unique within PackageList.
951   @param  Language                Points to the language for the new string.
952   @param  LanguageName            Points to the printable language name to
953                                   associate with the passed in  Language field.If
954                                   LanguageName is not NULL and the string package
955                                   header's LanguageName  associated with a given
956                                   Language is not zero, the LanguageName being
957                                   passed  in will be ignored.
958   @param  String                  Points to the new null-terminated string.
959   @param  StringFontInfo          Points to the new string's font information or
960                                   NULL if the string should have the default system
961                                   font, size and style.
962 
963   @retval EFI_SUCCESS             The new string was added successfully.
964   @retval EFI_NOT_FOUND           The specified PackageList could not be found in
965                                   database.
966   @retval EFI_OUT_OF_RESOURCES    Could not add the string due to lack of
967                                   resources.
968   @retval EFI_INVALID_PARAMETER   String is NULL or StringId is NULL or Language is
969                                   NULL.
970 
971 **/
972 EFI_STATUS
973 EFIAPI
974 HiiNewString (
975   IN  CONST EFI_HII_STRING_PROTOCOL   *This,
976   IN  EFI_HII_HANDLE                  PackageList,
977   OUT EFI_STRING_ID                   *StringId,
978   IN  CONST CHAR8                     *Language,
979   IN  CONST CHAR16                    *LanguageName, OPTIONAL
980   IN  CONST EFI_STRING                String,
981   IN  CONST EFI_FONT_INFO             *StringFontInfo OPTIONAL
982   );
983 
984 
985 /**
986   This function retrieves the string specified by StringId which is associated
987   with the specified PackageList in the language Language and copies it into
988   the buffer specified by String.
989 
990   @param  This                    A pointer to the EFI_HII_STRING_PROTOCOL
991                                   instance.
992   @param  Language                Points to the language for the retrieved string.
993   @param  PackageList             The package list in the HII database to search
994                                   for the  specified string.
995   @param  StringId                The string's id, which is unique within
996                                   PackageList.
997   @param  String                  Points to the new null-terminated string.
998   @param  StringSize              On entry, points to the size of the buffer
999                                   pointed to by  String, in bytes. On return,
1000                                   points to the length of the string, in bytes.
1001   @param  StringFontInfo          If not NULL, points to the string's font
1002                                   information.  It's caller's responsibility to
1003                                   free this buffer.
1004 
1005   @retval EFI_SUCCESS             The string was returned successfully.
1006   @retval EFI_NOT_FOUND           The string specified by StringId is not
1007                                   available.
1008                                   The specified PackageList is not in the database.
1009   @retval EFI_INVALID_LANGUAGE    The string specified by StringId is available but
1010                                   not in the specified language.
1011   @retval EFI_BUFFER_TOO_SMALL    The buffer specified by StringSize is too small
1012                                   to  hold the string.
1013   @retval EFI_INVALID_PARAMETER   The Language or StringSize was NULL.
1014   @retval EFI_INVALID_PARAMETER   The value referenced by StringSize was not zero
1015                                   and String was NULL.
1016   @retval EFI_OUT_OF_RESOURCES    There were insufficient resources to complete the
1017                                    request.
1018 
1019 **/
1020 EFI_STATUS
1021 EFIAPI
1022 HiiGetString (
1023   IN  CONST EFI_HII_STRING_PROTOCOL   *This,
1024   IN  CONST CHAR8                     *Language,
1025   IN  EFI_HII_HANDLE                  PackageList,
1026   IN  EFI_STRING_ID                   StringId,
1027   OUT EFI_STRING                      String,
1028   IN  OUT UINTN                       *StringSize,
1029   OUT EFI_FONT_INFO                   **StringFontInfo OPTIONAL
1030   );
1031 
1032 
1033 /**
1034   This function updates the string specified by StringId in the specified PackageList to the text
1035   specified by String and, optionally, the font information specified by StringFontInfo.
1036 
1037   @param  This                    A pointer to the EFI_HII_STRING_PROTOCOL
1038                                   instance.
1039   @param  PackageList             The package list containing the strings.
1040   @param  StringId                The string's id, which is unique within
1041                                   PackageList.
1042   @param  Language                Points to the language for the updated string.
1043   @param  String                  Points to the new null-terminated string.
1044   @param  StringFontInfo          Points to the string's font information or NULL
1045                                   if the string font information is not changed.
1046 
1047   @retval EFI_SUCCESS             The string was updated successfully.
1048   @retval EFI_NOT_FOUND           The string specified by StringId is not in the
1049                                   database.
1050   @retval EFI_INVALID_PARAMETER   The String or Language was NULL.
1051   @retval EFI_OUT_OF_RESOURCES    The system is out of resources to accomplish the
1052                                   task.
1053 
1054 **/
1055 EFI_STATUS
1056 EFIAPI
1057 HiiSetString (
1058   IN CONST EFI_HII_STRING_PROTOCOL    *This,
1059   IN EFI_HII_HANDLE                   PackageList,
1060   IN EFI_STRING_ID                    StringId,
1061   IN CONST CHAR8                      *Language,
1062   IN CONST EFI_STRING                 String,
1063   IN CONST EFI_FONT_INFO              *StringFontInfo OPTIONAL
1064   );
1065 
1066 
1067 /**
1068   This function returns the list of supported languages, in the format specified
1069   in Appendix M of UEFI 2.1 spec.
1070 
1071   @param  This                    A pointer to the EFI_HII_STRING_PROTOCOL
1072                                   instance.
1073   @param  PackageList             The package list to examine.
1074   @param  Languages               Points to the buffer to hold the returned
1075                                   null-terminated ASCII string.
1076   @param  LanguagesSize           On entry, points to the size of the buffer
1077                                   pointed to by  Languages, in bytes. On  return,
1078                                   points to the length of Languages, in bytes.
1079 
1080   @retval EFI_SUCCESS             The languages were returned successfully.
1081   @retval EFI_INVALID_PARAMETER   The LanguagesSize was NULL.
1082   @retval EFI_INVALID_PARAMETER   The value referenced by LanguagesSize is not zero and Languages is NULL.
1083   @retval EFI_BUFFER_TOO_SMALL    The LanguagesSize is too small to hold the list
1084                                   of  supported languages. LanguageSize is updated
1085                                   to contain the required size.
1086   @retval EFI_NOT_FOUND           Could not find string package in specified
1087                                   packagelist.
1088 
1089 **/
1090 EFI_STATUS
1091 EFIAPI
1092 HiiGetLanguages (
1093   IN CONST EFI_HII_STRING_PROTOCOL    *This,
1094   IN EFI_HII_HANDLE                   PackageList,
1095   IN OUT CHAR8                        *Languages,
1096   IN OUT UINTN                        *LanguagesSize
1097   );
1098 
1099 
1100 /**
1101   Each string package has associated with it a single primary language and zero
1102   or more secondary languages. This routine returns the secondary languages
1103   associated with a package list.
1104 
1105   @param  This                    A pointer to the EFI_HII_STRING_PROTOCOL
1106                                   instance.
1107   @param  PackageList             The package list to examine.
1108   @param  PrimaryLanguage         Points to the null-terminated ASCII string that specifies
1109                                   the primary language. Languages are specified in the
1110                                   format specified in Appendix M of the UEFI 2.0 specification.
1111   @param  SecondaryLanguages      Points to the buffer to hold the returned null-terminated
1112                                   ASCII string that describes the list of
1113                                   secondary languages for the specified
1114                                   PrimaryLanguage. If there are no secondary
1115                                   languages, the function returns successfully,
1116                                   but this is set to NULL.
1117   @param  SecondaryLanguagesSize  On entry, points to the size of the buffer
1118                                   pointed to by SecondaryLanguages, in bytes. On
1119                                   return, points to the length of SecondaryLanguages
1120                                   in bytes.
1121 
1122   @retval EFI_SUCCESS             Secondary languages were correctly returned.
1123   @retval EFI_INVALID_PARAMETER   PrimaryLanguage or SecondaryLanguagesSize was NULL.
1124   @retval EFI_INVALID_PARAMETER   The value referenced by SecondaryLanguagesSize is not
1125                                   zero and SecondaryLanguages is NULL.
1126   @retval EFI_BUFFER_TOO_SMALL    The buffer specified by SecondaryLanguagesSize is
1127                                   too small to hold the returned information.
1128                                   SecondaryLanguageSize is updated to hold the size of
1129                                   the buffer required.
1130   @retval EFI_INVALID_LANGUAGE    The language specified by PrimaryLanguage is not
1131                                   present in the specified package list.
1132   @retval EFI_NOT_FOUND           The specified PackageList is not in the Database.
1133 
1134 **/
1135 EFI_STATUS
1136 EFIAPI
1137 HiiGetSecondaryLanguages (
1138   IN CONST EFI_HII_STRING_PROTOCOL   *This,
1139   IN EFI_HII_HANDLE                  PackageList,
1140   IN CONST CHAR8                     *PrimaryLanguage,
1141   IN OUT CHAR8                       *SecondaryLanguages,
1142   IN OUT UINTN                       *SecondaryLanguagesSize
1143   );
1144 
1145 //
1146 // EFI_HII_DATABASE_PROTOCOL protocol interfaces
1147 //
1148 
1149 
1150 /**
1151   This function adds the packages in the package list to the database and returns a handle. If there is a
1152   EFI_DEVICE_PATH_PROTOCOL associated with the DriverHandle, then this function will
1153   create a package of type EFI_PACKAGE_TYPE_DEVICE_PATH and add it to the package list.
1154 
1155   @param  This                    A pointer to the EFI_HII_DATABASE_PROTOCOL
1156                                   instance.
1157   @param  PackageList             A pointer to an EFI_HII_PACKAGE_LIST_HEADER
1158                                   structure.
1159   @param  DriverHandle            Associate the package list with this EFI handle.
1160                                   If a NULL is specified, this data will not be associate
1161                                   with any drivers and cannot have a callback induced.
1162   @param  Handle                  A pointer to the EFI_HII_HANDLE instance.
1163 
1164   @retval EFI_SUCCESS             The package list associated with the Handle was
1165                                   added to the HII database.
1166   @retval EFI_OUT_OF_RESOURCES    Unable to allocate necessary resources for the
1167                                   new database contents.
1168   @retval EFI_INVALID_PARAMETER   PackageList is NULL or Handle is NULL.
1169 
1170 **/
1171 EFI_STATUS
1172 EFIAPI
1173 HiiNewPackageList (
1174   IN CONST EFI_HII_DATABASE_PROTOCOL    *This,
1175   IN CONST EFI_HII_PACKAGE_LIST_HEADER  *PackageList,
1176   IN CONST EFI_HANDLE                   DriverHandle, OPTIONAL
1177   OUT EFI_HII_HANDLE                    *Handle
1178   );
1179 
1180 
1181 /**
1182   This function removes the package list that is associated with a handle Handle
1183   from the HII database. Before removing the package, any registered functions
1184   with the notification type REMOVE_PACK and the same package type will be called.
1185 
1186   @param  This                    A pointer to the EFI_HII_DATABASE_PROTOCOL
1187                                   instance.
1188   @param  Handle                  The handle that was registered to the data that
1189                                   is requested  for removal.
1190 
1191   @retval EFI_SUCCESS             The data associated with the Handle was removed
1192                                   from  the HII database.
1193   @retval EFI_NOT_FOUND           The specified Handle is not in database.
1194 
1195 **/
1196 EFI_STATUS
1197 EFIAPI
1198 HiiRemovePackageList (
1199   IN CONST EFI_HII_DATABASE_PROTOCOL    *This,
1200   IN EFI_HII_HANDLE                     Handle
1201   );
1202 
1203 
1204 /**
1205   This function updates the existing package list (which has the specified Handle)
1206   in the HII databases, using the new package list specified by PackageList.
1207 
1208   @param  This                    A pointer to the EFI_HII_DATABASE_PROTOCOL
1209                                   instance.
1210   @param  Handle                  The handle that was registered to the data that
1211                                   is  requested to be updated.
1212   @param  PackageList             A pointer to an EFI_HII_PACKAGE_LIST_HEADER
1213                                   package.
1214 
1215   @retval EFI_SUCCESS             The HII database was successfully updated.
1216   @retval EFI_OUT_OF_RESOURCES    Unable to allocate enough memory for the updated
1217                                   database.
1218   @retval EFI_INVALID_PARAMETER  PackageList was NULL.
1219   @retval EFI_NOT_FOUND          The specified Handle is not in database.
1220 
1221 **/
1222 EFI_STATUS
1223 EFIAPI
1224 HiiUpdatePackageList (
1225   IN CONST EFI_HII_DATABASE_PROTOCOL    *This,
1226   IN EFI_HII_HANDLE                     Handle,
1227   IN CONST EFI_HII_PACKAGE_LIST_HEADER  *PackageList
1228   );
1229 
1230 
1231 /**
1232   This function returns a list of the package handles of the specified type
1233   that are currently active in the database. The pseudo-type
1234   EFI_HII_PACKAGE_TYPE_ALL will cause all package handles to be listed.
1235 
1236   @param  This                    A pointer to the EFI_HII_DATABASE_PROTOCOL
1237                                   instance.
1238   @param  PackageType             Specifies the package type of the packages to
1239                                   list or EFI_HII_PACKAGE_TYPE_ALL for all packages
1240                                   to be listed.
1241   @param  PackageGuid             If PackageType is EFI_HII_PACKAGE_TYPE_GUID, then
1242                                   this  is the pointer to the GUID which must match
1243                                   the Guid field of EFI_HII_GUID_PACKAGE_GUID_HDR.
1244                                   Otherwise,  it must be NULL.
1245   @param  HandleBufferLength      On input, a pointer to the length of the handle
1246                                   buffer.  On output, the length of the handle
1247                                   buffer that is required for the handles found.
1248   @param  Handle                  An array of EFI_HII_HANDLE instances returned.
1249 
1250   @retval EFI_SUCCESS             The matching handles are outputed successfully.
1251                                   HandleBufferLength is updated with the actual length.
1252   @retval EFI_BUFFER_TO_SMALL     The HandleBufferLength parameter indicates that
1253                                   Handle is too small to support the number of
1254                                   handles. HandleBufferLength is updated with a
1255                                   value that will  enable the data to fit.
1256   @retval EFI_NOT_FOUND           No matching handle could not be found in
1257                                   database.
1258   @retval EFI_INVALID_PARAMETER   HandleBufferLength was NULL.
1259   @retval EFI_INVALID_PARAMETER   The value referenced by HandleBufferLength was not
1260                                   zero and Handle was NULL.
1261   @retval EFI_INVALID_PARAMETER   PackageType is not a EFI_HII_PACKAGE_TYPE_GUID but
1262                                   PackageGuid is not NULL, PackageType is a EFI_HII_
1263                                   PACKAGE_TYPE_GUID but PackageGuid is NULL.
1264 
1265 **/
1266 EFI_STATUS
1267 EFIAPI
1268 HiiListPackageLists (
1269   IN  CONST EFI_HII_DATABASE_PROTOCOL   *This,
1270   IN  UINT8                             PackageType,
1271   IN  CONST EFI_GUID                    *PackageGuid,
1272   IN  OUT UINTN                         *HandleBufferLength,
1273   OUT EFI_HII_HANDLE                    *Handle
1274   );
1275 
1276 
1277 /**
1278   This function will export one or all package lists in the database to a buffer.
1279   For each package list exported, this function will call functions registered
1280   with EXPORT_PACK and then copy the package list to the buffer.
1281 
1282   @param  This                    A pointer to the EFI_HII_DATABASE_PROTOCOL
1283                                   instance.
1284   @param  Handle                  An EFI_HII_HANDLE that corresponds to the desired
1285                                   package list in the HII database to export or
1286                                   NULL to indicate  all package lists should be
1287                                   exported.
1288   @param  BufferSize              On input, a pointer to the length of the buffer.
1289                                   On output, the length of the buffer that is
1290                                   required for the exported data.
1291   @param  Buffer                  A pointer to a buffer that will contain the
1292                                   results of  the export function.
1293 
1294   @retval EFI_SUCCESS             Package exported.
1295   @retval EFI_BUFFER_TO_SMALL     The HandleBufferLength parameter indicates that
1296                                   Handle is too small to support the number of
1297                                   handles.      HandleBufferLength is updated with
1298                                   a value that will enable the data to fit.
1299   @retval EFI_NOT_FOUND           The specifiecd Handle could not be found in the
1300                                   current database.
1301   @retval EFI_INVALID_PARAMETER   BufferSize was NULL.
1302   @retval EFI_INVALID_PARAMETER   The value referenced by BufferSize was not zero
1303                                   and Buffer was NULL.
1304 
1305 **/
1306 EFI_STATUS
1307 EFIAPI
1308 HiiExportPackageLists (
1309   IN  CONST EFI_HII_DATABASE_PROTOCOL   *This,
1310   IN  EFI_HII_HANDLE                    Handle,
1311   IN  OUT UINTN                         *BufferSize,
1312   OUT EFI_HII_PACKAGE_LIST_HEADER       *Buffer
1313   );
1314 
1315 
1316 /**
1317   This function registers a function which will be called when specified actions related to packages of
1318   the specified type occur in the HII database. By registering a function, other HII-related drivers are
1319   notified when specific package types are added, removed or updated in the HII database.
1320   Each driver or application which registers a notification should use
1321   EFI_HII_DATABASE_PROTOCOL.UnregisterPackageNotify() before exiting.
1322 
1323   @param  This                    A pointer to the EFI_HII_DATABASE_PROTOCOL
1324                                   instance.
1325   @param  PackageType             Specifies the package type of the packages to
1326                                   list or EFI_HII_PACKAGE_TYPE_ALL for all packages
1327                                   to be listed.
1328   @param  PackageGuid             If PackageType is EFI_HII_PACKAGE_TYPE_GUID, then
1329                                   this is the pointer to the GUID which must match
1330                                   the Guid field of
1331                                   EFI_HII_GUID_PACKAGE_GUID_HDR. Otherwise, it must
1332                                   be NULL.
1333   @param  PackageNotifyFn         Points to the function to be called when the
1334                                   event specified by
1335                                   NotificationType occurs.
1336   @param  NotifyType              Describes the types of notification which this
1337                                   function will be receiving.
1338   @param  NotifyHandle            Points to the unique handle assigned to the
1339                                   registered notification. Can be used in
1340                                   EFI_HII_DATABASE_PROTOCOL.UnregisterPackageNotify()
1341                                   to stop notifications.
1342 
1343   @retval EFI_SUCCESS             Notification registered successfully.
1344   @retval EFI_OUT_OF_RESOURCES    Unable to allocate necessary data structures
1345   @retval EFI_INVALID_PARAMETER   NotifyHandle is NULL.
1346   @retval EFI_INVALID_PARAMETER   PackageGuid is not NULL when PackageType is not
1347                                   EFI_HII_PACKAGE_TYPE_GUID.
1348   @retval EFI_INVALID_PARAMETER   PackageGuid is NULL when PackageType is
1349                                   EFI_HII_PACKAGE_TYPE_GUID.
1350 
1351 **/
1352 EFI_STATUS
1353 EFIAPI
1354 HiiRegisterPackageNotify (
1355   IN  CONST EFI_HII_DATABASE_PROTOCOL   *This,
1356   IN  UINT8                             PackageType,
1357   IN  CONST EFI_GUID                    *PackageGuid,
1358   IN  CONST EFI_HII_DATABASE_NOTIFY     PackageNotifyFn,
1359   IN  EFI_HII_DATABASE_NOTIFY_TYPE      NotifyType,
1360   OUT EFI_HANDLE                        *NotifyHandle
1361   );
1362 
1363 
1364 /**
1365   Removes the specified HII database package-related notification.
1366 
1367   @param  This                    A pointer to the EFI_HII_DATABASE_PROTOCOL
1368                                   instance.
1369   @param  NotificationHandle      The handle of the notification function being
1370                                   unregistered.
1371 
1372   @retval EFI_SUCCESS             Notification is unregistered successfully.
1373   @retval EFI_NOT_FOUND          The incoming notification handle does not exist
1374                            in current hii database.
1375 
1376 **/
1377 EFI_STATUS
1378 EFIAPI
1379 HiiUnregisterPackageNotify (
1380   IN CONST EFI_HII_DATABASE_PROTOCOL    *This,
1381   IN EFI_HANDLE                         NotificationHandle
1382   );
1383 
1384 
1385 /**
1386   This routine retrieves an array of GUID values for each keyboard layout that
1387   was previously registered in the system.
1388 
1389   @param  This                    A pointer to the EFI_HII_DATABASE_PROTOCOL
1390                                   instance.
1391   @param  KeyGuidBufferLength     On input, a pointer to the length of the keyboard
1392                                   GUID  buffer. On output, the length of the handle
1393                                   buffer  that is required for the handles found.
1394   @param  KeyGuidBuffer           An array of keyboard layout GUID instances
1395                                   returned.
1396 
1397   @retval EFI_SUCCESS             KeyGuidBuffer was updated successfully.
1398   @retval EFI_BUFFER_TOO_SMALL    The KeyGuidBufferLength parameter indicates
1399                                   that KeyGuidBuffer is too small to support the
1400                                   number of GUIDs. KeyGuidBufferLength is
1401                                   updated with a value that will enable the data to
1402                                   fit.
1403   @retval EFI_INVALID_PARAMETER   The KeyGuidBufferLength is NULL.
1404   @retval EFI_INVALID_PARAMETER   The value referenced by KeyGuidBufferLength is not
1405                                   zero and KeyGuidBuffer is NULL.
1406   @retval EFI_NOT_FOUND           There was no keyboard layout.
1407 
1408 **/
1409 EFI_STATUS
1410 EFIAPI
1411 HiiFindKeyboardLayouts (
1412   IN  CONST EFI_HII_DATABASE_PROTOCOL   *This,
1413   IN  OUT UINT16                        *KeyGuidBufferLength,
1414   OUT EFI_GUID                          *KeyGuidBuffer
1415   );
1416 
1417 
1418 /**
1419   This routine retrieves the requested keyboard layout. The layout is a physical description of the keys
1420   on a keyboard and the character(s) that are associated with a particular set of key strokes.
1421 
1422   @param  This                    A pointer to the EFI_HII_DATABASE_PROTOCOL
1423                                   instance.
1424   @param  KeyGuid                 A pointer to the unique ID associated with a
1425                                   given keyboard layout. If KeyGuid is NULL then
1426                                   the current layout will be retrieved.
1427   @param  KeyboardLayoutLength    On input, a pointer to the length of the
1428                                   KeyboardLayout buffer.  On output, the length of
1429                                   the data placed into KeyboardLayout.
1430   @param  KeyboardLayout          A pointer to a buffer containing the retrieved
1431                                   keyboard layout.
1432 
1433   @retval EFI_SUCCESS             The keyboard layout was retrieved successfully.
1434   @retval EFI_NOT_FOUND           The requested keyboard layout was not found.
1435   @retval EFI_INVALID_PARAMETER   The KeyboardLayout or KeyboardLayoutLength was
1436                                   NULL.
1437 
1438 **/
1439 EFI_STATUS
1440 EFIAPI
1441 HiiGetKeyboardLayout (
1442   IN  CONST EFI_HII_DATABASE_PROTOCOL   *This,
1443   IN  CONST EFI_GUID                          *KeyGuid,
1444   IN OUT UINT16                         *KeyboardLayoutLength,
1445   OUT EFI_HII_KEYBOARD_LAYOUT           *KeyboardLayout
1446   );
1447 
1448 
1449 /**
1450   This routine sets the default keyboard layout to the one referenced by KeyGuid. When this routine
1451   is called, an event will be signaled of the EFI_HII_SET_KEYBOARD_LAYOUT_EVENT_GUID
1452   group type. This is so that agents which are sensitive to the current keyboard layout being changed
1453   can be notified of this change.
1454 
1455   @param  This                    A pointer to the EFI_HII_DATABASE_PROTOCOL
1456                                   instance.
1457   @param  KeyGuid                 A pointer to the unique ID associated with a
1458                                   given keyboard layout.
1459 
1460   @retval EFI_SUCCESS             The current keyboard layout was successfully set.
1461   @retval EFI_NOT_FOUND           The referenced keyboard layout was not found, so
1462                                   action was taken.
1463   @retval EFI_INVALID_PARAMETER   The KeyGuid was NULL.
1464 
1465 **/
1466 EFI_STATUS
1467 EFIAPI
1468 HiiSetKeyboardLayout (
1469   IN CONST EFI_HII_DATABASE_PROTOCOL          *This,
1470   IN CONST EFI_GUID                           *KeyGuid
1471   );
1472 
1473 
1474 /**
1475   Return the EFI handle associated with a package list.
1476 
1477   @param  This                    A pointer to the EFI_HII_DATABASE_PROTOCOL
1478                                   instance.
1479   @param  PackageListHandle       An EFI_HII_HANDLE that corresponds to the desired
1480                                   package list in the HIIdatabase.
1481   @param  DriverHandle            On return, contains the EFI_HANDLE which was
1482                                   registered with the package list in
1483                                   NewPackageList().
1484 
1485   @retval EFI_SUCCESS             The DriverHandle was returned successfully.
1486   @retval EFI_INVALID_PARAMETER   The PackageListHandle was not valid or
1487                                   DriverHandle was NULL.
1488 
1489 **/
1490 EFI_STATUS
1491 EFIAPI
1492 HiiGetPackageListHandle (
1493   IN  CONST EFI_HII_DATABASE_PROTOCOL         *This,
1494   IN  EFI_HII_HANDLE                    PackageListHandle,
1495   OUT EFI_HANDLE                        *DriverHandle
1496   );
1497 
1498 //
1499 // EFI_HII_CONFIG_ROUTING_PROTOCOL interfaces
1500 //
1501 
1502 
1503 /**
1504   This function allows a caller to extract the current configuration
1505   for one or more named elements from one or more drivers.
1506 
1507   @param  This                    A pointer to the EFI_HII_CONFIG_ROUTING_PROTOCOL
1508                                   instance.
1509   @param  Request                 A null-terminated Unicode string in
1510                                   <MultiConfigRequest> format.
1511   @param  Progress                On return, points to a character in the Request
1512                                   string. Points to the string's null terminator if
1513                                   request was successful. Points to the most recent
1514                                   & before the first failing name / value pair (or
1515                                   the beginning of the string if the failure is in
1516                                   the first name / value pair) if the request was
1517                                   not successful.
1518   @param  Results                 Null-terminated Unicode string in
1519                                   <MultiConfigAltResp> format which has all values
1520                                   filled in for the names in the Request string.
1521                                   String to be allocated by the called function.
1522 
1523   @retval EFI_SUCCESS             The Results string is filled with the values
1524                                   corresponding to all requested names.
1525   @retval EFI_OUT_OF_RESOURCES    Not enough memory to store the parts of the
1526                                   results that must be stored awaiting possible
1527                                   future        protocols.
1528   @retval EFI_NOT_FOUND           Routing data doesn't match any known driver.
1529                                      Progress set to the "G" in "GUID" of the
1530                                   routing  header that doesn't match. Note: There
1531                                   is no         requirement that all routing data
1532                                   be validated before any configuration extraction.
1533   @retval EFI_INVALID_PARAMETER   For example, passing in a NULL for the Request
1534                                   parameter would result in this type of error. The
1535                                   Progress parameter is set to NULL.
1536   @retval EFI_INVALID_PARAMETER   Illegal syntax. Progress set to most recent &
1537                                   before the error or the beginning of the string.
1538   @retval EFI_INVALID_PARAMETER   Unknown name. Progress points to the & before the
1539                                   name in question.
1540 
1541 **/
1542 EFI_STATUS
1543 EFIAPI
1544 HiiConfigRoutingExtractConfig (
1545   IN  CONST EFI_HII_CONFIG_ROUTING_PROTOCOL  *This,
1546   IN  CONST EFI_STRING                       Request,
1547   OUT EFI_STRING                             *Progress,
1548   OUT EFI_STRING                             *Results
1549   );
1550 
1551 
1552 /**
1553   This function allows the caller to request the current configuration for the
1554   entirety of the current HII database and returns the data in a null-terminated Unicode string.
1555 
1556   @param  This                    A pointer to the EFI_HII_CONFIG_ROUTING_PROTOCOL
1557                                   instance.
1558   @param  Results                 Null-terminated Unicode string in
1559                                   <MultiConfigAltResp> format which has all values
1560                                   filled in for the entirety of the current HII
1561                                   database. String to be allocated by the  called
1562                                   function. De-allocation is up to the caller.
1563 
1564   @retval EFI_SUCCESS             The Results string is filled with the values
1565                                   corresponding to all requested names.
1566   @retval EFI_OUT_OF_RESOURCES    Not enough memory to store the parts of the
1567                                   results that must be stored awaiting possible
1568                                   future        protocols.
1569   @retval EFI_INVALID_PARAMETER   For example, passing in a NULL for the Results
1570                                   parameter would result in this type of error.
1571 
1572 **/
1573 EFI_STATUS
1574 EFIAPI
1575 HiiConfigRoutingExportConfig (
1576   IN  CONST EFI_HII_CONFIG_ROUTING_PROTOCOL  *This,
1577   OUT EFI_STRING                             *Results
1578   );
1579 
1580 
1581 /**
1582   This function processes the results of processing forms and routes it to the
1583   appropriate handlers or storage.
1584 
1585   @param  This                    A pointer to the EFI_HII_CONFIG_ROUTING_PROTOCOL
1586                                   instance.
1587   @param  Configuration           A null-terminated Unicode string in
1588                                   <MulltiConfigResp> format.
1589   @param  Progress                A pointer to a string filled in with the offset
1590                                   of the most recent & before the first failing
1591                                   name / value pair (or the beginning of the string
1592                                   if the failure is in the first name / value pair)
1593                                   or the terminating NULL if all was successful.
1594 
1595   @retval EFI_SUCCESS             The results have been distributed or are awaiting
1596                                   distribution.
1597   @retval EFI_OUT_OF_RESOURCES    Not enough memory to store the parts of the
1598                                   results that must be stored awaiting possible
1599                                   future        protocols.
1600   @retval EFI_INVALID_PARAMETER   Passing in a NULL for the Configuration parameter
1601                                   would result in this type of error.
1602   @retval EFI_NOT_FOUND           Target for the specified routing data was not
1603                                   found.
1604 
1605 **/
1606 EFI_STATUS
1607 EFIAPI
1608 HiiConfigRoutingRouteConfig (
1609   IN  CONST EFI_HII_CONFIG_ROUTING_PROTOCOL  *This,
1610   IN  CONST EFI_STRING                       Configuration,
1611   OUT EFI_STRING                             *Progress
1612   );
1613 
1614 
1615 
1616 /**
1617   This helper function is to be called by drivers to map configuration data stored
1618   in byte array ("block") formats such as UEFI Variables into current configuration strings.
1619 
1620   @param  This                    A pointer to the EFI_HII_CONFIG_ROUTING_PROTOCOL
1621                                   instance.
1622   @param  ConfigRequest           A null-terminated Unicode string in
1623                                   <ConfigRequest> format.
1624   @param  Block                   Array of bytes defining the block's
1625                                   configuration.
1626   @param  BlockSize               Length in bytes of Block.
1627   @param  Config                  Filled-in configuration string. String allocated
1628                                   by  the function. Returned only if call is
1629                                   successful.
1630   @param  Progress                A pointer to a string filled in with the offset
1631                                   of  the most recent & before the first failing
1632                                   name/value pair (or the beginning of the string
1633                                   if the failure is in the first name / value pair)
1634                                   or the terminating NULL if all was successful.
1635 
1636   @retval EFI_SUCCESS             The request succeeded. Progress points to the
1637                                   null terminator at the end of the ConfigRequest
1638                                         string.
1639   @retval EFI_OUT_OF_RESOURCES    Not enough memory to allocate Config.
1640                                   Progress points to the first character of
1641                                   ConfigRequest.
1642   @retval EFI_INVALID_PARAMETER   Passing in a NULL for the ConfigRequest or
1643                                   Block parameter would result in this type of
1644                                   error. Progress points to the first character of
1645                                   ConfigRequest.
1646   @retval EFI_NOT_FOUND           Target for the specified routing data was not
1647                                   found. Progress points to the "G" in "GUID" of
1648                                   the      errant routing data.
1649   @retval EFI_DEVICE_ERROR        Block not large enough. Progress undefined.
1650   @retval EFI_INVALID_PARAMETER   Encountered non <BlockName> formatted string.
1651                                        Block is left updated and Progress points at
1652                                   the '&' preceding the first non-<BlockName>.
1653 
1654 **/
1655 EFI_STATUS
1656 EFIAPI
1657 HiiBlockToConfig (
1658   IN  CONST EFI_HII_CONFIG_ROUTING_PROTOCOL  *This,
1659   IN  CONST EFI_STRING                       ConfigRequest,
1660   IN  CONST UINT8                            *Block,
1661   IN  CONST UINTN                            BlockSize,
1662   OUT EFI_STRING                             *Config,
1663   OUT EFI_STRING                             *Progress
1664   );
1665 
1666 
1667 /**
1668   This helper function is to be called by drivers to map configuration strings
1669   to configurations stored in byte array ("block") formats such as UEFI Variables.
1670 
1671   @param  This                    A pointer to the EFI_HII_CONFIG_ROUTING_PROTOCOL
1672                                   instance.
1673   @param  ConfigResp              A null-terminated Unicode string in <ConfigResp>
1674                                   format.
1675   @param  Block                   A possibly null array of bytes representing the
1676                                   current  block. Only bytes referenced in the
1677                                   ConfigResp string  in the block are modified. If
1678                                   this parameter is null or if the *BlockSize
1679                                   parameter is (on input) shorter than required by
1680                                   the Configuration string, only the BlockSize
1681                                   parameter is updated and an appropriate status
1682                                   (see below)  is returned.
1683   @param  BlockSize               The length of the Block in units of UINT8.  On
1684                                   input, this is the size of the Block. On output,
1685                                   if successful, contains the largest index of the
1686                                   modified byte in the Block, or the required buffer
1687                                   size if the Block is not large enough.
1688   @param  Progress                On return, points to an element of the ConfigResp
1689                                    string filled in with the offset of the most
1690                                   recent '&' before the first failing name / value
1691                                   pair (or  the beginning of the string if the
1692                                   failure is in the  first name / value pair) or
1693                                   the terminating NULL if all was successful.
1694 
1695   @retval EFI_SUCCESS             The request succeeded. Progress points to the
1696                                   null terminator at the end of the ConfigResp
1697                                   string.
1698   @retval EFI_OUT_OF_RESOURCES    Not enough memory to allocate Config.
1699                                   Progress points to the first character of
1700                                   ConfigResp.
1701   @retval EFI_INVALID_PARAMETER   Passing in a NULL for the ConfigResp or
1702                                   Block parameter would result in this type of
1703                                   error. Progress points to the first character of
1704                                            ConfigResp.
1705   @retval EFI_NOT_FOUND           Target for the specified routing data was not
1706                                   found. Progress points to the "G" in "GUID" of
1707                                   the      errant routing data.
1708   @retval EFI_INVALID_PARAMETER   Encountered non <BlockName> formatted name /
1709                                   value pair. Block is left updated and
1710                                   Progress points at the '&' preceding the first
1711                                   non-<BlockName>.
1712   @retval EFI_BUFFER_TOO_SMALL    Block not large enough. Progress undefined.
1713                                   BlockSize is updated with the required buffer size.
1714 
1715 **/
1716 EFI_STATUS
1717 EFIAPI
1718 HiiConfigToBlock (
1719   IN     CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,
1720   IN     CONST EFI_STRING                      ConfigResp,
1721   IN OUT UINT8                                 *Block,
1722   IN OUT UINTN                                 *BlockSize,
1723   OUT    EFI_STRING                            *Progress
1724   );
1725 
1726 
1727 /**
1728   This helper function is to be called by drivers to extract portions of
1729   a larger configuration string.
1730 
1731   @param  This                    A pointer to the EFI_HII_CONFIG_ROUTING_PROTOCOL
1732                                   instance.
1733   @param  Configuration           A null-terminated Unicode string in
1734                                   <MultiConfigAltResp> format.
1735   @param  Guid                    A pointer to the GUID value to search for in the
1736                                   routing portion of the ConfigResp string when
1737                                   retrieving  the requested data. If Guid is NULL,
1738                                   then all GUID  values will be searched for.
1739   @param  Name                    A pointer to the NAME value to search for in the
1740                                   routing portion of the ConfigResp string when
1741                                   retrieving  the requested data. If Name is NULL,
1742                                   then all Name  values will be searched for.
1743   @param  DevicePath              A pointer to the PATH value to search for in the
1744                                   routing portion of the ConfigResp string when
1745                                   retrieving  the requested data. If DevicePath is
1746                                   NULL, then all  DevicePath values will be
1747                                   searched for.
1748   @param  AltCfgId                A pointer to the ALTCFG value to search for in
1749                                   the  routing portion of the ConfigResp string
1750                                   when retrieving  the requested data.  If this
1751                                   parameter is NULL,  then the current setting will
1752                                   be retrieved.
1753   @param  AltCfgResp              A pointer to a buffer which will be allocated by
1754                                   the  function which contains the retrieved string
1755                                   as requested.   This buffer is only allocated if
1756                                   the call was successful.
1757 
1758   @retval EFI_SUCCESS             The request succeeded. The requested data was
1759                                   extracted  and placed in the newly allocated
1760                                   AltCfgResp buffer.
1761   @retval EFI_OUT_OF_RESOURCES    Not enough memory to allocate AltCfgResp.
1762   @retval EFI_INVALID_PARAMETER   Any parameter is invalid.
1763   @retval EFI_NOT_FOUND           Target for the specified routing data was not
1764                                   found.
1765 
1766 **/
1767 EFI_STATUS
1768 EFIAPI
1769 HiiGetAltCfg (
1770   IN  CONST EFI_HII_CONFIG_ROUTING_PROTOCOL    *This,
1771   IN  CONST EFI_STRING                         Configuration,
1772   IN  CONST EFI_GUID                           *Guid,
1773   IN  CONST EFI_STRING                         Name,
1774   IN  CONST EFI_DEVICE_PATH_PROTOCOL           *DevicePath,
1775   IN  CONST UINT16                             *AltCfgId,
1776   OUT EFI_STRING                               *AltCfgResp
1777   );
1778 
1779 
1780 /**
1781   Compare whether two names of languages are identical.
1782 
1783   @param  Language1              Name of language 1 from StringPackage
1784   @param  Language2              Name of language 2 to be compared with language 1.
1785 
1786   @retval TRUE                   same
1787   @retval FALSE                  not same
1788 
1789 **/
1790 BOOLEAN
1791 HiiCompareLanguage (
1792   IN  CHAR8  *Language1,
1793   IN  CHAR8  *Language2
1794   )
1795 ;
1796 
1797 //
1798 // Global variables
1799 //
1800 extern EFI_EVENT gHiiKeyboardLayoutChanged;
1801 #endif
1802