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