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