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