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