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