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