]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
Fix K8 issues in HiiDataBase
[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 This function exports Form packages to a buffer.
489 This is a internal function.
490
491 @param Private Hii database private structure.
492 @param Handle Identification of a package list.
493 @param PackageList Pointer to a package list which will be exported.
494 @param UsedSize The length of buffer be used.
495 @param BufferSize Length of the Buffer.
496 @param Buffer Allocated space for storing exported data.
497 @param ResultSize The size of the already exported content of this
498 package list.
499
500 @retval EFI_SUCCESS Form Packages are exported successfully.
501 @retval EFI_INVALID_PARAMETER Any input parameter is invalid.
502
503 **/
504 EFI_STATUS
505 ExportFormPackages (
506 IN HII_DATABASE_PRIVATE_DATA *Private,
507 IN EFI_HII_HANDLE Handle,
508 IN HII_DATABASE_PACKAGE_LIST_INSTANCE *PackageList,
509 IN UINTN UsedSize,
510 IN UINTN BufferSize,
511 IN OUT VOID *Buffer,
512 IN OUT UINTN *ResultSize
513 );
514
515 //
516 // EFI_HII_FONT_PROTOCOL protocol interfaces
517 //
518
519
520 /**
521 Renders a string to a bitmap or to the display.
522
523 @param This A pointer to the EFI_HII_FONT_PROTOCOL instance.
524 @param Flags Describes how the string is to be drawn.
525 @param String Points to the null-terminated string to be
526 displayed.
527 @param StringInfo Points to the string output information,
528 including the color and font. If NULL, then the
529 string will be output in the default system font
530 and color.
531 @param Blt If this points to a non-NULL on entry, this
532 points to the image, which is Width pixels wide
533 and Height pixels high. The string will be drawn
534 onto this image and
535 EFI_HII_OUT_FLAG_CLIP is implied. If this points
536 to a NULL on entry, then a buffer
537 will be allocated to hold the generated image and
538 the pointer updated on exit. It is the caller's
539 responsibility to free this buffer.
540 @param BltX Together with BltX, Specifies the offset from the left and top edge
541 of the image of the first character cell in the
542 image.
543 @param BltY Together with BltY, Specifies the offset from the left and top edge
544 of the image of the first character cell in the
545 image.
546 @param RowInfoArray If this is non-NULL on entry, then on exit, this
547 will point to an allocated buffer containing
548 row information and RowInfoArraySize will be
549 updated to contain the number of elements.
550 This array describes the characters which were at
551 least partially drawn and the heights of the
552 rows. It is the caller's responsibility to free
553 this buffer.
554 @param RowInfoArraySize If this is non-NULL on entry, then on exit it
555 contains the number of elements in RowInfoArray.
556 @param ColumnInfoArray If this is non-NULL, then on return it will be
557 filled with the horizontal offset for each
558 character in the string on the row where it is
559 displayed. Non-printing characters will have
560 the offset ~0. The caller is responsible to
561 allocate a buffer large enough so that there
562 is one entry for each character in the string,
563 not including the null-terminator. It is possible
564 when character display is normalized that some
565 character cells overlap.
566
567 @retval EFI_SUCCESS The string was successfully rendered.
568 @retval EFI_OUT_OF_RESOURCES Unable to allocate an output buffer for
569 RowInfoArray or Blt.
570 @retval EFI_INVALID_PARAMETER The String or Blt.
571 @retval EFI_INVALID_PARAMETER Flags were invalid combination..
572
573 **/
574 EFI_STATUS
575 EFIAPI
576 HiiStringToImage (
577 IN CONST EFI_HII_FONT_PROTOCOL *This,
578 IN EFI_HII_OUT_FLAGS Flags,
579 IN CONST EFI_STRING String,
580 IN CONST EFI_FONT_DISPLAY_INFO *StringInfo OPTIONAL,
581 IN OUT EFI_IMAGE_OUTPUT **Blt,
582 IN UINTN BltX,
583 IN UINTN BltY,
584 OUT EFI_HII_ROW_INFO **RowInfoArray OPTIONAL,
585 OUT UINTN *RowInfoArraySize OPTIONAL,
586 OUT UINTN *ColumnInfoArray OPTIONAL
587 );
588
589
590 /**
591 Render a string to a bitmap or the screen containing the contents of the specified string.
592
593 @param This A pointer to the EFI_HII_FONT_PROTOCOL instance.
594 @param Flags Describes how the string is to be drawn.
595 @param PackageList The package list in the HII database to search
596 for the specified string.
597 @param StringId The string's id, which is unique within
598 PackageList.
599 @param Language Points to the language for the retrieved string.
600 If NULL, then the current system language is
601 used.
602 @param StringInfo Points to the string output information,
603 including the color and font. If NULL, then the
604 string will be output in the default system font
605 and color.
606 @param Blt If this points to a non-NULL on entry, this
607 points to the image, which is Width pixels wide
608 and Height pixels high. The string will be drawn
609 onto this image and
610 EFI_HII_OUT_FLAG_CLIP is implied. If this points
611 to a NULL on entry, then a buffer
612 will be allocated to hold the generated image and
613 the pointer updated on exit. It is the caller's
614 responsibility to free this buffer.
615 @param BltX Together with BltX, Specifies the offset from the left and top edge
616 of the image of the first character cell in the
617 image.
618 @param BltY Together with BltY, Specifies the offset from the left and top edge
619 of the image of the first character cell in the
620 image.
621 @param RowInfoArray If this is non-NULL on entry, then on exit, this
622 will point to an allocated buffer containing
623 row information and RowInfoArraySize will be
624 updated to contain the number of elements.
625 This array describes the characters which were at
626 least partially drawn and the heights of the
627 rows. It is the caller's responsibility to free
628 this buffer.
629 @param RowInfoArraySize If this is non-NULL on entry, then on exit it
630 contains the number of elements in RowInfoArray.
631 @param ColumnInfoArray If this is non-NULL, then on return it will be
632 filled with the horizontal offset for each
633 character in the string on the row where it is
634 displayed. Non-printing characters will have
635 the offset ~0. The caller is responsible to
636 allocate a buffer large enough so that there
637 is one entry for each character in the string,
638 not including the null-terminator. It is possible
639 when character display is normalized that some
640 character cells overlap.
641
642 @retval EFI_SUCCESS The string was successfully rendered.
643 @retval EFI_OUT_OF_RESOURCES Unable to allocate an output buffer for
644 RowInfoArray or Blt.
645 @retval EFI_INVALID_PARAMETER The Blt or PackageList was NULL.
646 @retval EFI_INVALID_PARAMETER Flags were invalid combination.
647 @retval EFI_NOT_FOUND The specified PackageList is not in the Database or the stringid is not
648 in the specified PackageList.
649
650 **/
651 EFI_STATUS
652 EFIAPI
653 HiiStringIdToImage (
654 IN CONST EFI_HII_FONT_PROTOCOL *This,
655 IN EFI_HII_OUT_FLAGS Flags,
656 IN EFI_HII_HANDLE PackageList,
657 IN EFI_STRING_ID StringId,
658 IN CONST CHAR8* Language,
659 IN CONST EFI_FONT_DISPLAY_INFO *StringInfo OPTIONAL,
660 IN OUT EFI_IMAGE_OUTPUT **Blt,
661 IN UINTN BltX,
662 IN UINTN BltY,
663 OUT EFI_HII_ROW_INFO **RowInfoArray OPTIONAL,
664 OUT UINTN *RowInfoArraySize OPTIONAL,
665 OUT UINTN *ColumnInfoArray OPTIONAL
666 );
667
668
669 /**
670 Convert the glyph for a single character into a bitmap.
671
672 @param This A pointer to the EFI_HII_FONT_PROTOCOL instance.
673 @param Char Character to retrieve.
674 @param StringInfo Points to the string font and color information
675 or NULL if the string should use the default
676 system font and color.
677 @param Blt Thus must point to a NULL on entry. A buffer will
678 be allocated to hold the output and the pointer
679 updated on exit. It is the caller's
680 responsibility to free this buffer.
681 @param Baseline Number of pixels from the bottom of the bitmap to
682 the baseline.
683
684 @retval EFI_SUCCESS Glyph bitmap created.
685 @retval EFI_OUT_OF_RESOURCES Unable to allocate the output buffer Blt.
686 @retval EFI_WARN_UNKNOWN_GLYPH The glyph was unknown and was replaced with the
687 glyph for Unicode character 0xFFFD.
688 @retval EFI_INVALID_PARAMETER Blt is NULL or *Blt is not NULL.
689
690 **/
691 EFI_STATUS
692 EFIAPI
693 HiiGetGlyph (
694 IN CONST EFI_HII_FONT_PROTOCOL *This,
695 IN CHAR16 Char,
696 IN CONST EFI_FONT_DISPLAY_INFO *StringInfo,
697 OUT EFI_IMAGE_OUTPUT **Blt,
698 OUT UINTN *Baseline OPTIONAL
699 );
700
701
702 /**
703 This function iterates through fonts which match the specified font, using
704 the specified criteria. If String is non-NULL, then all of the characters in
705 the string must exist in order for a candidate font to be returned.
706
707 @param This A pointer to the EFI_HII_FONT_PROTOCOL instance.
708 @param FontHandle On entry, points to the font handle returned by a
709 previous call to GetFontInfo() or NULL to start
710 with the first font. On return, points to the
711 returned font handle or points to NULL if there
712 are no more matching fonts.
713 @param StringInfoIn Upon entry, points to the font to return
714 information about. If NULL, then the information about the system default
715 font will be returned.
716 @param StringInfoOut Upon return, contains the matching font's
717 information. If NULL, then no information is
718 returned. It's caller's responsibility to free
719 this buffer.
720 @param String Points to the string which will be tested to
721 determine if all characters are available. If
722 NULL, then any font is acceptable.
723
724 @retval EFI_SUCCESS Matching font returned successfully.
725 @retval EFI_NOT_FOUND No matching font was found.
726 @retval EFI_INVALID_PARAMETER StringInfoIn is NULL.
727 @retval EFI_INVALID_PARAMETER StringInfoIn->FontInfoMask is an invalid combination.
728 @retval EFI_OUT_OF_RESOURCES There were insufficient resources to complete the
729 request.
730 **/
731 EFI_STATUS
732 EFIAPI
733 HiiGetFontInfo (
734 IN CONST EFI_HII_FONT_PROTOCOL *This,
735 IN OUT EFI_FONT_HANDLE *FontHandle,
736 IN CONST EFI_FONT_DISPLAY_INFO *StringInfoIn, OPTIONAL
737 OUT EFI_FONT_DISPLAY_INFO **StringInfoOut,
738 IN CONST EFI_STRING String OPTIONAL
739 );
740
741 //
742 // EFI_HII_IMAGE_PROTOCOL interfaces
743 //
744
745
746 /**
747 This function adds the image Image to the group of images owned by PackageList, and returns
748 a new image identifier (ImageId).
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 added.
753 @param ImageId On return, contains the new image id, which is
754 unique within PackageList.
755 @param Image Points to the image.
756
757 @retval EFI_SUCCESS The new image was added successfully.
758 @retval EFI_NOT_FOUND The specified PackageList could not be found in
759 database.
760 @retval EFI_OUT_OF_RESOURCES Could not add the image due to lack of resources.
761 @retval EFI_INVALID_PARAMETER Image is NULL or ImageId is NULL.
762
763 **/
764 EFI_STATUS
765 EFIAPI
766 HiiNewImage (
767 IN CONST EFI_HII_IMAGE_PROTOCOL *This,
768 IN EFI_HII_HANDLE PackageList,
769 OUT EFI_IMAGE_ID *ImageId,
770 IN CONST EFI_IMAGE_INPUT *Image
771 );
772
773
774 /**
775 This function retrieves the image specified by ImageId which is associated with
776 the specified PackageList and copies it into the buffer specified by Image.
777
778 @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
779 @param PackageList Handle of the package list where this image will
780 be searched.
781 @param ImageId The image's id,, which is unique within
782 PackageList.
783 @param Image Points to the image.
784
785 @retval EFI_SUCCESS The new image was returned successfully.
786 @retval EFI_NOT_FOUND The image specified by ImageId is not available.
787 The specified PackageList is not in the database.
788 @retval EFI_BUFFER_TOO_SMALL The buffer specified by ImageSize is too small to
789 hold the image.
790 @retval EFI_INVALID_PARAMETER The Image or ImageSize was NULL.
791 @retval EFI_OUT_OF_RESOURCES The bitmap could not be retrieved because there was not
792 enough memory.
793
794 **/
795 EFI_STATUS
796 EFIAPI
797 HiiGetImage (
798 IN CONST EFI_HII_IMAGE_PROTOCOL *This,
799 IN EFI_HII_HANDLE PackageList,
800 IN EFI_IMAGE_ID ImageId,
801 OUT EFI_IMAGE_INPUT *Image
802 );
803
804
805 /**
806 This function updates the image specified by ImageId in the specified PackageListHandle to
807 the image specified by Image.
808
809 @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
810 @param PackageList The package list containing the images.
811 @param ImageId The image's id,, which is unique within
812 PackageList.
813 @param Image Points to the image.
814
815 @retval EFI_SUCCESS The new image was updated successfully.
816 @retval EFI_NOT_FOUND The image specified by ImageId is not in the
817 database. The specified PackageList is not in the database.
818 @retval EFI_INVALID_PARAMETER The Image was NULL.
819
820 **/
821 EFI_STATUS
822 EFIAPI
823 HiiSetImage (
824 IN CONST EFI_HII_IMAGE_PROTOCOL *This,
825 IN EFI_HII_HANDLE PackageList,
826 IN EFI_IMAGE_ID ImageId,
827 IN CONST EFI_IMAGE_INPUT *Image
828 );
829
830
831 /**
832 This function renders an image to a bitmap or the screen using the specified
833 color and options. It draws the image on an existing bitmap, allocates a new
834 bitmap or uses the screen. The images can be clipped.
835
836 @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
837 @param Flags Describes how the image is to be drawn.
838 @param Image Points to the image to be displayed.
839 @param Blt If this points to a non-NULL on entry, this
840 points to the image, which is Width pixels wide
841 and Height pixels high. The image will be drawn
842 onto this image and EFI_HII_DRAW_FLAG_CLIP is
843 implied. If this points to a NULL on entry, then
844 a buffer will be allocated to hold the generated
845 image and the pointer updated on exit. It is the
846 caller's responsibility to free this buffer.
847 @param BltX Specifies the offset from the left and top edge
848 of the output image of the first pixel in the
849 image.
850 @param BltY Specifies the offset from the left and top edge
851 of the output image of the first pixel in the
852 image.
853
854 @retval EFI_SUCCESS The image was successfully drawn.
855 @retval EFI_OUT_OF_RESOURCES Unable to allocate an output buffer for Blt.
856 @retval EFI_INVALID_PARAMETER The Image or Blt was NULL.
857 @retval EFI_INVALID_PARAMETER Any combination of Flags is invalid.
858
859 **/
860 EFI_STATUS
861 EFIAPI
862 HiiDrawImage (
863 IN CONST EFI_HII_IMAGE_PROTOCOL *This,
864 IN EFI_HII_DRAW_FLAGS Flags,
865 IN CONST EFI_IMAGE_INPUT *Image,
866 IN OUT EFI_IMAGE_OUTPUT **Blt,
867 IN UINTN BltX,
868 IN UINTN BltY
869 );
870
871
872 /**
873 This function renders an image to a bitmap or the screen using the specified
874 color and options. It draws the image on an existing bitmap, allocates a new
875 bitmap or uses the screen. The images can be clipped.
876
877 @param This A pointer to the EFI_HII_IMAGE_PROTOCOL instance.
878 @param Flags Describes how the image is to be drawn.
879 @param PackageList The package list in the HII database to search
880 for the specified image.
881 @param ImageId The image's id, which is unique within
882 PackageList.
883 @param Blt If this points to a non-NULL on entry, this
884 points to the image, which is Width pixels wide
885 and Height pixels high. The image will be drawn
886 onto this image and
887 EFI_HII_DRAW_FLAG_CLIP is implied. If this points
888 to a NULL on entry, then a buffer will be
889 allocated to hold the generated image and the
890 pointer updated on exit. It is the caller's
891 responsibility to free this buffer.
892 @param BltX Specifies the offset from the left and top edge
893 of the output image of the first pixel in the
894 image.
895 @param BltY Specifies the offset from the left and top edge
896 of the output image of the first pixel in the
897 image.
898
899 @retval EFI_SUCCESS The image was successfully drawn.
900 @retval EFI_OUT_OF_RESOURCES Unable to allocate an output buffer for Blt.
901 @retval EFI_INVALID_PARAMETER The Blt was NULL.
902 @retval EFI_NOT_FOUND The image specified by ImageId is not in the database.
903 The specified PackageList is not in the database.
904
905 **/
906 EFI_STATUS
907 EFIAPI
908 HiiDrawImageId (
909 IN CONST EFI_HII_IMAGE_PROTOCOL *This,
910 IN EFI_HII_DRAW_FLAGS Flags,
911 IN EFI_HII_HANDLE PackageList,
912 IN EFI_IMAGE_ID ImageId,
913 IN OUT EFI_IMAGE_OUTPUT **Blt,
914 IN UINTN BltX,
915 IN UINTN BltY
916 )
917
918 ;
919
920 //
921 // EFI_HII_STRING_PROTOCOL
922 //
923
924
925 /**
926 This function adds the string String to the group of strings owned by PackageList, with the
927 specified font information StringFontInfo and returns a new string id.
928
929 @param This A pointer to the EFI_HII_STRING_PROTOCOL
930 instance.
931 @param PackageList Handle of the package list where this string will
932 be added.
933 @param StringId On return, contains the new strings id, which is
934 unique within PackageList.
935 @param Language Points to the language for the new string.
936 @param LanguageName Points to the printable language name to
937 associate with the passed in Language field.If
938 LanguageName is not NULL and the string package
939 header's LanguageName associated with a given
940 Language is not zero, the LanguageName being
941 passed in will be ignored.
942 @param String Points to the new null-terminated string.
943 @param StringFontInfo Points to the new string's font information or
944 NULL if the string should have the default system
945 font, size and style.
946
947 @retval EFI_SUCCESS The new string was added successfully.
948 @retval EFI_NOT_FOUND The specified PackageList could not be found in
949 database.
950 @retval EFI_OUT_OF_RESOURCES Could not add the string due to lack of
951 resources.
952 @retval EFI_INVALID_PARAMETER String is NULL or StringId is NULL or Language is
953 NULL.
954
955 **/
956 EFI_STATUS
957 EFIAPI
958 HiiNewString (
959 IN CONST EFI_HII_STRING_PROTOCOL *This,
960 IN EFI_HII_HANDLE PackageList,
961 OUT EFI_STRING_ID *StringId,
962 IN CONST CHAR8 *Language,
963 IN CONST CHAR16 *LanguageName, OPTIONAL
964 IN CONST EFI_STRING String,
965 IN CONST EFI_FONT_INFO *StringFontInfo OPTIONAL
966 );
967
968
969 /**
970 This function retrieves the string specified by StringId which is associated
971 with the specified PackageList in the language Language and copies it into
972 the buffer specified by String.
973
974 @param This A pointer to the EFI_HII_STRING_PROTOCOL
975 instance.
976 @param Language Points to the language for the retrieved string.
977 @param PackageList The package list in the HII database to search
978 for the specified string.
979 @param StringId The string's id, which is unique within
980 PackageList.
981 @param String Points to the new null-terminated string.
982 @param StringSize On entry, points to the size of the buffer
983 pointed to by String, in bytes. On return,
984 points to the length of the string, in bytes.
985 @param StringFontInfo If not NULL, points to the string's font
986 information. It's caller's responsibility to
987 free this buffer.
988
989 @retval EFI_SUCCESS The string was returned successfully.
990 @retval EFI_NOT_FOUND The string specified by StringId is not
991 available.
992 @retval EFI_NOT_FOUND The string specified by StringId is available but
993 not in the specified language.
994 The specified PackageList is not in the database.
995 @retval EFI_INVALID_LANGUAGE - The string specified by StringId is available but
996 @retval EFI_BUFFER_TOO_SMALL The buffer specified by StringSize is too small
997 to hold the string.
998 @retval EFI_INVALID_PARAMETER The String or Language or StringSize was NULL.
999 @retval EFI_OUT_OF_RESOURCES There were insufficient resources to complete the
1000 request.
1001
1002 **/
1003 EFI_STATUS
1004 EFIAPI
1005 HiiGetString (
1006 IN CONST EFI_HII_STRING_PROTOCOL *This,
1007 IN CONST CHAR8 *Language,
1008 IN EFI_HII_HANDLE PackageList,
1009 IN EFI_STRING_ID StringId,
1010 OUT EFI_STRING String,
1011 IN OUT UINTN *StringSize,
1012 OUT EFI_FONT_INFO **StringFontInfo OPTIONAL
1013 );
1014
1015
1016 /**
1017 This function updates the string specified by StringId in the specified PackageList to the text
1018 specified by String and, optionally, the font information specified by StringFontInfo.
1019
1020 @param This A pointer to the EFI_HII_STRING_PROTOCOL
1021 instance.
1022 @param PackageList The package list containing the strings.
1023 @param StringId The string's id, which is unique within
1024 PackageList.
1025 @param Language Points to the language for the updated string.
1026 @param String Points to the new null-terminated string.
1027 @param StringFontInfo Points to the string's font information or NULL
1028 if the string font information is not changed.
1029
1030 @retval EFI_SUCCESS The string was updated successfully.
1031 @retval EFI_NOT_FOUND The string specified by StringId is not in the
1032 database.
1033 @retval EFI_INVALID_PARAMETER The String or Language was NULL.
1034 @retval EFI_OUT_OF_RESOURCES The system is out of resources to accomplish the
1035 task.
1036
1037 **/
1038 EFI_STATUS
1039 EFIAPI
1040 HiiSetString (
1041 IN CONST EFI_HII_STRING_PROTOCOL *This,
1042 IN EFI_HII_HANDLE PackageList,
1043 IN EFI_STRING_ID StringId,
1044 IN CONST CHAR8 *Language,
1045 IN CONST EFI_STRING String,
1046 IN CONST EFI_FONT_INFO *StringFontInfo OPTIONAL
1047 );
1048
1049
1050 /**
1051 This function returns the list of supported languages, in the format specified
1052 in Appendix M of UEFI 2.1 spec.
1053
1054 @param This A pointer to the EFI_HII_STRING_PROTOCOL
1055 instance.
1056 @param PackageList The package list to examine.
1057 @param Languages Points to the buffer to hold the returned string.
1058 @param LanguagesSize On entry, points to the size of the buffer
1059 pointed to by Languages, in bytes. On return,
1060 points to the length of Languages, in bytes.
1061
1062 @retval EFI_SUCCESS The languages were returned successfully.
1063 @retval EFI_INVALID_PARAMETER The Languages or LanguagesSize was NULL.
1064 @retval EFI_BUFFER_TOO_SMALL The LanguagesSize is too small to hold the list
1065 of supported languages. LanguageSize is updated
1066 to contain the required size.
1067 @retval EFI_NOT_FOUND Could not find string package in specified
1068 packagelist.
1069
1070 **/
1071 EFI_STATUS
1072 EFIAPI
1073 HiiGetLanguages (
1074 IN CONST EFI_HII_STRING_PROTOCOL *This,
1075 IN EFI_HII_HANDLE PackageList,
1076 IN OUT CHAR8 *Languages,
1077 IN OUT UINTN *LanguagesSize
1078 );
1079
1080
1081 /**
1082 Each string package has associated with it a single primary language and zero
1083 or more secondary languages. This routine returns the secondary languages
1084 associated with a package list.
1085
1086 @param This A pointer to the EFI_HII_STRING_PROTOCOL
1087 instance.
1088 @param PackageList The package list to examine.
1089 @param FirstLanguage Points to the primary language.
1090 @param SecondaryLanguages Points to the buffer to hold the returned list of
1091 secondary languages for the specified
1092 FirstLanguage. If there are no secondary
1093 languages, the function returns successfully,
1094 but this is set to NULL.
1095 @param SecondaryLanguagesSize On entry, points to the size of the buffer
1096 pointed to by SecondLanguages, in bytes. On
1097 return, points to the length of SecondLanguages
1098 in bytes.
1099
1100 @retval EFI_SUCCESS Secondary languages were correctly returned.
1101 @retval EFI_INVALID_PARAMETER FirstLanguage or SecondLanguages or
1102 SecondLanguagesSize was NULL.
1103 @retval EFI_BUFFER_TOO_SMALL The buffer specified by SecondLanguagesSize is
1104 too small to hold the returned information.
1105 SecondLanguageSize is updated to hold the size of
1106 the buffer required.
1107 @retval EFI_INVALID_LANGUAGE The language specified by FirstLanguage is not
1108 present in the specified package list.
1109 @retval EFI_NOT_FOUND The specified PackageList is not in the Database.
1110
1111 **/
1112 EFI_STATUS
1113 EFIAPI
1114 HiiGetSecondaryLanguages (
1115 IN CONST EFI_HII_STRING_PROTOCOL *This,
1116 IN EFI_HII_HANDLE PackageList,
1117 IN CONST CHAR8 *FirstLanguage,
1118 IN OUT CHAR8 *SecondaryLanguages,
1119 IN OUT UINTN *SecondaryLanguagesSize
1120 );
1121
1122 //
1123 // EFI_HII_DATABASE_PROTOCOL protocol interfaces
1124 //
1125
1126
1127 /**
1128 This function adds the packages in the package list to the database and returns a handle. If there is a
1129 EFI_DEVICE_PATH_PROTOCOL associated with the DriverHandle, then this function will
1130 create a package of type EFI_PACKAGE_TYPE_DEVICE_PATH and add it to the package list.
1131
1132 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL
1133 instance.
1134 @param PackageList A pointer to an EFI_HII_PACKAGE_LIST_HEADER
1135 structure.
1136 @param DriverHandle Associate the package list with this EFI handle.
1137 @param Handle A pointer to the EFI_HII_HANDLE instance.
1138
1139 @retval EFI_SUCCESS The package list associated with the Handle was
1140 added to the HII database.
1141 @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary resources for the
1142 new database contents.
1143 @retval EFI_INVALID_PARAMETER PackageList is NULL or Handle is NULL.
1144
1145 **/
1146 EFI_STATUS
1147 EFIAPI
1148 HiiNewPackageList (
1149 IN CONST EFI_HII_DATABASE_PROTOCOL *This,
1150 IN CONST EFI_HII_PACKAGE_LIST_HEADER *PackageList,
1151 IN CONST EFI_HANDLE DriverHandle,
1152 OUT EFI_HII_HANDLE *Handle
1153 );
1154
1155
1156 /**
1157 This function removes the package list that is associated with a handle Handle
1158 from the HII database. Before removing the package, any registered functions
1159 with the notification type REMOVE_PACK and the same package type will be called.
1160
1161 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL
1162 instance.
1163 @param Handle The handle that was registered to the data that
1164 is requested for removal.
1165
1166 @retval EFI_SUCCESS The data associated with the Handle was removed
1167 from the HII database.
1168 @retval EFI_NOT_FOUND The specified Handle is not in database.
1169
1170 **/
1171 EFI_STATUS
1172 EFIAPI
1173 HiiRemovePackageList (
1174 IN CONST EFI_HII_DATABASE_PROTOCOL *This,
1175 IN EFI_HII_HANDLE Handle
1176 );
1177
1178
1179 /**
1180 This function updates the existing package list (which has the specified Handle)
1181 in the HII databases, using the new package list specified by PackageList.
1182
1183 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL
1184 instance.
1185 @param Handle The handle that was registered to the data that
1186 is requested to be updated.
1187 @param PackageList A pointer to an EFI_HII_PACKAGE_LIST_HEADER
1188 package.
1189
1190 @retval EFI_SUCCESS The HII database was successfully updated.
1191 @retval EFI_OUT_OF_RESOURCES Unable to allocate enough memory for the updated
1192 database.
1193 @retval EFI_INVALID_PARAMETER PackageList was NULL.
1194 @retval EFI_NOT_FOUND The specified Handle is not in database.
1195
1196 **/
1197 EFI_STATUS
1198 EFIAPI
1199 HiiUpdatePackageList (
1200 IN CONST EFI_HII_DATABASE_PROTOCOL *This,
1201 IN EFI_HII_HANDLE Handle,
1202 IN CONST EFI_HII_PACKAGE_LIST_HEADER *PackageList
1203 );
1204
1205
1206 /**
1207 This function returns a list of the package handles of the specified type
1208 that are currently active in the database. The pseudo-type
1209 EFI_HII_PACKAGE_TYPE_ALL will cause all package handles to be listed.
1210
1211 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL
1212 instance.
1213 @param PackageType Specifies the package type of the packages to
1214 list or EFI_HII_PACKAGE_TYPE_ALL for all packages
1215 to be listed.
1216 @param PackageGuid If PackageType is EFI_HII_PACKAGE_TYPE_GUID, then
1217 this is the pointer to the GUID which must match
1218 the Guid field of EFI_HII_GUID_PACKAGE_GUID_HDR.
1219 Otherwise, it must be NULL.
1220 @param HandleBufferLength On input, a pointer to the length of the handle
1221 buffer. On output, the length of the handle
1222 buffer that is required for the handles found.
1223 @param Handle An array of EFI_HII_HANDLE instances returned.
1224
1225 @retval EFI_SUCCESS The matching handles are outputed successfully.
1226 HandleBufferLength is updated with the actual length.
1227 @retval EFI_BUFFER_TO_SMALL The HandleBufferLength parameter indicates that
1228 Handle is too small to support the number of
1229 handles. HandleBufferLength is updated with a
1230 value that will enable the data to fit.
1231 @retval EFI_NOT_FOUND No matching handle could not be found in
1232 database.
1233 @retval EFI_INVALID_PARAMETER Handle or HandleBufferLength was NULL.
1234 @retval EFI_INVALID_PARAMETER PackageType is not a EFI_HII_PACKAGE_TYPE_GUID but
1235 PackageGuid is not NULL, PackageType is a EFI_HII_
1236 PACKAGE_TYPE_GUID but PackageGuid is NULL.
1237
1238
1239 **/
1240 EFI_STATUS
1241 EFIAPI
1242 HiiListPackageLists (
1243 IN CONST EFI_HII_DATABASE_PROTOCOL *This,
1244 IN UINT8 PackageType,
1245 IN CONST EFI_GUID *PackageGuid,
1246 IN OUT UINTN *HandleBufferLength,
1247 OUT EFI_HII_HANDLE *Handle
1248 );
1249
1250
1251 /**
1252 This function will export one or all package lists in the database to a buffer.
1253 For each package list exported, this function will call functions registered
1254 with EXPORT_PACK and then copy the package list to the buffer.
1255
1256 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL
1257 instance.
1258 @param Handle An EFI_HII_HANDLE that corresponds to the desired
1259 package list in the HII database to export or
1260 NULL to indicate all package lists should be
1261 exported.
1262 @param BufferSize On input, a pointer to the length of the buffer.
1263 On output, the length of the buffer that is
1264 required for the exported data.
1265 @param Buffer A pointer to a buffer that will contain the
1266 results of the export function.
1267
1268 @retval EFI_SUCCESS Package exported.
1269 @retval EFI_BUFFER_TO_SMALL The HandleBufferLength parameter indicates that
1270 Handle is too small to support the number of
1271 handles. HandleBufferLength is updated with
1272 a value that will enable the data to fit.
1273 @retval EFI_NOT_FOUND The specifiecd Handle could not be found in the
1274 current database.
1275 @retval EFI_INVALID_PARAMETER Handle or Buffer or BufferSize was NULL.
1276
1277 **/
1278 EFI_STATUS
1279 EFIAPI
1280 HiiExportPackageLists (
1281 IN CONST EFI_HII_DATABASE_PROTOCOL *This,
1282 IN EFI_HII_HANDLE Handle,
1283 IN OUT UINTN *BufferSize,
1284 OUT EFI_HII_PACKAGE_LIST_HEADER *Buffer
1285 );
1286
1287
1288 /**
1289 This function registers a function which will be called when specified actions related to packages of
1290 the specified type occur in the HII database. By registering a function, other HII-related drivers are
1291 notified when specific package types are added, removed or updated in the HII database.
1292 Each driver or application which registers a notification should use
1293 EFI_HII_DATABASE_PROTOCOL.UnregisterPackageNotify() before exiting.
1294
1295 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL
1296 instance.
1297 @param PackageType Specifies the package type of the packages to
1298 list or EFI_HII_PACKAGE_TYPE_ALL for all packages
1299 to be listed.
1300 @param PackageGuid If PackageType is EFI_HII_PACKAGE_TYPE_GUID, then
1301 this is the pointer to the GUID which must match
1302 the Guid field of
1303 EFI_HII_GUID_PACKAGE_GUID_HDR. Otherwise, it must
1304 be NULL.
1305 @param PackageNotifyFn Points to the function to be called when the
1306 event specified by
1307 NotificationType occurs.
1308 @param NotifyType Describes the types of notification which this
1309 function will be receiving.
1310 @param NotifyHandle Points to the unique handle assigned to the
1311 registered notification. Can be used in
1312 EFI_HII_DATABASE_PROTOCOL.UnregisterPackageNotify()
1313 to stop notifications.
1314
1315 @retval EFI_SUCCESS Notification registered successfully.
1316 @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary data structures
1317 @retval EFI_INVALID_PARAMETER NotifyHandle is NULL.
1318 @retval EFI_INVALID_PARAMETER PackageGuid is not NULL when PackageType is not
1319 EFI_HII_PACKAGE_TYPE_GUID.
1320 @retval EFI_INVALID_PARAMETER PackageGuid is NULL when PackageType is
1321 EFI_HII_PACKAGE_TYPE_GUID.
1322
1323 **/
1324 EFI_STATUS
1325 EFIAPI
1326 HiiRegisterPackageNotify (
1327 IN CONST EFI_HII_DATABASE_PROTOCOL *This,
1328 IN UINT8 PackageType,
1329 IN CONST EFI_GUID *PackageGuid,
1330 IN CONST EFI_HII_DATABASE_NOTIFY PackageNotifyFn,
1331 IN EFI_HII_DATABASE_NOTIFY_TYPE NotifyType,
1332 OUT EFI_HANDLE *NotifyHandle
1333 );
1334
1335
1336 /**
1337 Removes the specified HII database package-related notification.
1338
1339 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL
1340 instance.
1341 @param NotificationHandle The handle of the notification function being
1342 unregistered.
1343
1344 @retval EFI_SUCCESS Notification is unregistered successfully.
1345 @retval EFI_NOT_FOUND The incoming notification handle does not exist
1346 in current hii database.
1347
1348 **/
1349 EFI_STATUS
1350 EFIAPI
1351 HiiUnregisterPackageNotify (
1352 IN CONST EFI_HII_DATABASE_PROTOCOL *This,
1353 IN EFI_HANDLE NotificationHandle
1354 );
1355
1356
1357 /**
1358 This routine retrieves an array of GUID values for each keyboard layout that
1359 was previously registered in the system.
1360
1361 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL
1362 instance.
1363 @param KeyGuidBufferLength On input, a pointer to the length of the keyboard
1364 GUID buffer. On output, the length of the handle
1365 buffer that is required for the handles found.
1366 @param KeyGuidBuffer An array of keyboard layout GUID instances
1367 returned.
1368
1369 @retval EFI_SUCCESS KeyGuidBuffer was updated successfully.
1370 @retval EFI_BUFFER_TOO_SMALL The KeyGuidBufferLength parameter indicates
1371 that KeyGuidBuffer is too small to support the
1372 number of GUIDs. KeyGuidBufferLength is
1373 updated with a value that will enable the data to
1374 fit.
1375 @retval EFI_INVALID_PARAMETER The KeyGuidBuffer or KeyGuidBufferLength was
1376 NULL.
1377 @retval EFI_NOT_FOUND There was no keyboard layout.
1378
1379 **/
1380 EFI_STATUS
1381 EFIAPI
1382 HiiFindKeyboardLayouts (
1383 IN CONST EFI_HII_DATABASE_PROTOCOL *This,
1384 IN OUT UINT16 *KeyGuidBufferLength,
1385 OUT EFI_GUID *KeyGuidBuffer
1386 );
1387
1388
1389 /**
1390 This routine retrieves the requested keyboard layout. The layout is a physical description of the keys
1391 on a keyboard and the character(s) that are associated with a particular set of key strokes.
1392
1393 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL
1394 instance.
1395 @param KeyGuid A pointer to the unique ID associated with a
1396 given keyboard layout. If KeyGuid is NULL then
1397 the current layout will be retrieved.
1398 @param KeyboardLayoutLength On input, a pointer to the length of the
1399 KeyboardLayout buffer. On output, the length of
1400 the data placed into KeyboardLayout.
1401 @param KeyboardLayout A pointer to a buffer containing the retrieved
1402 keyboard layout.
1403
1404 @retval EFI_SUCCESS The keyboard layout was retrieved successfully.
1405 @retval EFI_NOT_FOUND The requested keyboard layout was not found.
1406 @retval EFI_INVALID_PARAMETER The KeyboardLayout or KeyboardLayoutLength was
1407 NULL.
1408
1409 **/
1410 EFI_STATUS
1411 EFIAPI
1412 HiiGetKeyboardLayout (
1413 IN CONST EFI_HII_DATABASE_PROTOCOL *This,
1414 IN CONST EFI_GUID *KeyGuid,
1415 IN OUT UINT16 *KeyboardLayoutLength,
1416 OUT EFI_HII_KEYBOARD_LAYOUT *KeyboardLayout
1417 );
1418
1419
1420 /**
1421 This routine sets the default keyboard layout to the one referenced by KeyGuid. When this routine
1422 is called, an event will be signaled of the EFI_HII_SET_KEYBOARD_LAYOUT_EVENT_GUID
1423 group type. This is so that agents which are sensitive to the current keyboard layout being changed
1424 can be notified of this change.
1425
1426 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL
1427 instance.
1428 @param KeyGuid A pointer to the unique ID associated with a
1429 given keyboard layout.
1430
1431 @retval EFI_SUCCESS The current keyboard layout was successfully set.
1432 @retval EFI_NOT_FOUND The referenced keyboard layout was not found, so
1433 action was taken.
1434 @retval EFI_INVALID_PARAMETER The KeyGuid was NULL.
1435
1436 **/
1437 EFI_STATUS
1438 EFIAPI
1439 HiiSetKeyboardLayout (
1440 IN CONST EFI_HII_DATABASE_PROTOCOL *This,
1441 IN CONST EFI_GUID *KeyGuid
1442 );
1443
1444
1445 /**
1446 Return the EFI handle associated with a package list.
1447
1448 @param This A pointer to the EFI_HII_DATABASE_PROTOCOL
1449 instance.
1450 @param PackageListHandle An EFI_HII_HANDLE that corresponds to the desired
1451 package list in the HIIdatabase.
1452 @param DriverHandle On return, contains the EFI_HANDLE which was
1453 registered with the package list in
1454 NewPackageList().
1455
1456 @retval EFI_SUCCESS The DriverHandle was returned successfully.
1457 @retval EFI_INVALID_PARAMETER The PackageListHandle was not valid or
1458 DriverHandle was NULL.
1459
1460 **/
1461 EFI_STATUS
1462 EFIAPI
1463 HiiGetPackageListHandle (
1464 IN CONST EFI_HII_DATABASE_PROTOCOL *This,
1465 IN EFI_HII_HANDLE PackageListHandle,
1466 OUT EFI_HANDLE *DriverHandle
1467 );
1468
1469 //
1470 // EFI_HII_CONFIG_ROUTING_PROTOCOL interfaces
1471 //
1472
1473
1474 /**
1475 This function allows a caller to extract the current configuration
1476 for one or more named elements from one or more drivers.
1477
1478 @param This A pointer to the EFI_HII_CONFIG_ROUTING_PROTOCOL
1479 instance.
1480 @param Request A null-terminated Unicode string in
1481 <MultiConfigRequest> format.
1482 @param Progress On return, points to a character in the Request
1483 string. Points to the string's null terminator if
1484 request was successful. Points to the most recent
1485 & before the first failing name / value pair (or
1486 the beginning of the string if the failure is in
1487 the first name / value pair) if the request was
1488 not successful.
1489 @param Results Null-terminated Unicode string in
1490 <MultiConfigAltResp> format which has all values
1491 filled in for the names in the Request string.
1492 String to be allocated by the called function.
1493
1494 @retval EFI_SUCCESS The Results string is filled with the values
1495 corresponding to all requested names.
1496 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the parts of the
1497 results that must be stored awaiting possible
1498 future protocols.
1499 @retval EFI_NOT_FOUND Routing data doesn't match any known driver.
1500 Progress set to the "G" in "GUID" of the
1501 routing header that doesn't match. Note: There
1502 is no requirement that all routing data
1503 be validated before any configuration extraction.
1504 @retval EFI_INVALID_PARAMETER For example, passing in a NULL for the Request
1505 parameter would result in this type of error. The
1506 Progress parameter is set to NULL.
1507 @retval EFI_INVALID_PARAMETER Illegal syntax. Progress set to most recent &
1508 before the error or the beginning of the string.
1509 @retval EFI_INVALID_PARAMETER Unknown name. Progress points to the & before the
1510 name in question.
1511
1512 **/
1513 EFI_STATUS
1514 EFIAPI
1515 HiiConfigRoutingExtractConfig (
1516 IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,
1517 IN CONST EFI_STRING Request,
1518 OUT EFI_STRING *Progress,
1519 OUT EFI_STRING *Results
1520 );
1521
1522
1523 /**
1524 This function allows the caller to request the current configuration for the
1525 entirety of the current HII database and returns the data in a null-terminated Unicode string.
1526
1527 @param This A pointer to the EFI_HII_CONFIG_ROUTING_PROTOCOL
1528 instance.
1529 @param Results Null-terminated Unicode string in
1530 <MultiConfigAltResp> format which has all values
1531 filled in for the names in the Request string.
1532 String to be allocated by the called function.
1533 De-allocation is up to the caller.
1534
1535 @retval EFI_SUCCESS The Results string is filled with the values
1536 corresponding to all requested names.
1537 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the parts of the
1538 results that must be stored awaiting possible
1539 future protocols.
1540 @retval EFI_INVALID_PARAMETER For example, passing in a NULL for the Results
1541 parameter would result in this type of error.
1542
1543 **/
1544 EFI_STATUS
1545 EFIAPI
1546 HiiConfigRoutingExportConfig (
1547 IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,
1548 OUT EFI_STRING *Results
1549 );
1550
1551
1552 /**
1553 This function processes the results of processing forms and routes it to the
1554 appropriate handlers or storage.
1555
1556 @param This A pointer to the EFI_HII_CONFIG_ROUTING_PROTOCOL
1557 instance.
1558 @param Configuration A null-terminated Unicode string in
1559 <MulltiConfigResp> format.
1560 @param Progress A pointer to a string filled in with the offset
1561 of the most recent & before the first failing
1562 name / value pair (or the beginning of the string
1563 if the failure is in the first name / value pair)
1564 or the terminating NULL if all was successful.
1565
1566 @retval EFI_SUCCESS The results have been distributed or are awaiting
1567 distribution.
1568 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the parts of the
1569 results that must be stored awaiting possible
1570 future protocols.
1571 @retval EFI_INVALID_PARAMETER Passing in a NULL for the Configuration parameter
1572 would result in this type of error.
1573 @retval EFI_NOT_FOUND Target for the specified routing data was not
1574 found.
1575
1576 **/
1577 EFI_STATUS
1578 EFIAPI
1579 HiiConfigRoutingRouteConfig (
1580 IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,
1581 IN CONST EFI_STRING Configuration,
1582 OUT EFI_STRING *Progress
1583 );
1584
1585
1586
1587 /**
1588 This helper function is to be called by drivers to map configuration data stored
1589 in byte array ("block") formats such as UEFI Variables into current configuration strings.
1590
1591 @param This A pointer to the EFI_HII_CONFIG_ROUTING_PROTOCOL
1592 instance.
1593 @param ConfigRequest A null-terminated Unicode string in
1594 <ConfigRequest> format.
1595 @param Block Array of bytes defining the block's
1596 configuration.
1597 @param BlockSize Length in bytes of Block.
1598 @param Config Filled-in configuration string. String allocated
1599 by the function. Returned only if call is
1600 successful.
1601 @param Progress A pointer to a string filled in with the offset
1602 of the most recent & before the first failing
1603 name/value pair (or the beginning of the string
1604 if the failure is in the first name / value pair)
1605 or the terminating NULL if all was successful.
1606
1607 @retval EFI_SUCCESS The request succeeded. Progress points to the
1608 null terminator at the end of the ConfigRequest
1609 string.
1610 @retval EFI_OUT_OF_RESOURCES Not enough memory to allocate Config.
1611 Progress points to the first character of
1612 ConfigRequest.
1613 @retval EFI_INVALID_PARAMETER Passing in a NULL for the ConfigRequest or
1614 Block parameter would result in this type of
1615 error. Progress points to the first character of
1616 ConfigRequest.
1617 @retval EFI_NOT_FOUND Target for the specified routing data was not
1618 found. Progress points to the "G" in "GUID" of
1619 the errant routing data.
1620 @retval EFI_DEVICE_ERROR Block not large enough. Progress undefined.
1621 @retval EFI_INVALID_PARAMETER Encountered non <BlockName> formatted string.
1622 Block is left updated and Progress points at
1623 the '&' preceding the first non-<BlockName>.
1624
1625 **/
1626 EFI_STATUS
1627 EFIAPI
1628 HiiBlockToConfig (
1629 IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,
1630 IN CONST EFI_STRING ConfigRequest,
1631 IN CONST UINT8 *Block,
1632 IN CONST UINTN BlockSize,
1633 OUT EFI_STRING *Config,
1634 OUT EFI_STRING *Progress
1635 );
1636
1637
1638 /**
1639 This helper function is to be called by drivers to map configuration strings
1640 to configurations stored in byte array ("block") formats such as UEFI Variables.
1641
1642 @param This A pointer to the EFI_HII_CONFIG_ROUTING_PROTOCOL
1643 instance.
1644 @param ConfigResp A null-terminated Unicode string in <ConfigResp>
1645 format.
1646 @param Block A possibly null array of bytes representing the
1647 current block. Only bytes referenced in the
1648 ConfigResp string in the block are modified. If
1649 this parameter is null or if the *BlockSize
1650 parameter is (on input) shorter than required by
1651 the Configuration string, only the BlockSize
1652 parameter is updated and an appropriate status
1653 (see below) is returned.
1654 @param BlockSize The length of the Block in units of UINT8. On
1655 input, this is the size of the Block. On output,
1656 if successful, contains the index of the last
1657 modified byte in the Block.
1658 @param Progress On return, points to an element of the ConfigResp
1659 string filled in with the offset of the most
1660 recent '&' before the first failing name / value
1661 pair (or the beginning of the string if the
1662 failure is in the first name / value pair) or
1663 the terminating NULL if all was successful.
1664
1665 @retval EFI_SUCCESS The request succeeded. Progress points to the
1666 null terminator at the end of the ConfigResp
1667 string.
1668 @retval EFI_OUT_OF_RESOURCES Not enough memory to allocate Config.
1669 Progress points to the first character of
1670 ConfigResp.
1671 @retval EFI_INVALID_PARAMETER Passing in a NULL for the ConfigResp or
1672 Block parameter would result in this type of
1673 error. Progress points to the first character of
1674 ConfigResp.
1675 @retval EFI_NOT_FOUND Target for the specified routing data was not
1676 found. Progress points to the "G" in "GUID" of
1677 the errant routing data.
1678 @retval EFI_INVALID_PARAMETER Encountered non <BlockName> formatted name /
1679 value pair. Block is left updated and
1680 Progress points at the '&' preceding the first
1681 non-<BlockName>.
1682
1683 **/
1684 EFI_STATUS
1685 EFIAPI
1686 HiiConfigToBlock (
1687 IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,
1688 IN CONST EFI_STRING ConfigResp,
1689 IN OUT UINT8 *Block,
1690 IN OUT UINTN *BlockSize,
1691 OUT EFI_STRING *Progress
1692 );
1693
1694
1695 /**
1696 This helper function is to be called by drivers to extract portions of
1697 a larger configuration string.
1698
1699 @param This A pointer to the EFI_HII_CONFIG_ROUTING_PROTOCOL
1700 instance.
1701 @param Configuration A null-terminated Unicode string in
1702 <MultiConfigAltResp> format.
1703 @param Guid A pointer to the GUID value to search for in the
1704 routing portion of the ConfigResp string when
1705 retrieving the requested data. If Guid is NULL,
1706 then all GUID values will be searched for.
1707 @param Name A pointer to the NAME value to search for in the
1708 routing portion of the ConfigResp string when
1709 retrieving the requested data. If Name is NULL,
1710 then all Name values will be searched for.
1711 @param DevicePath A pointer to the PATH value to search for in the
1712 routing portion of the ConfigResp string when
1713 retrieving the requested data. If DevicePath is
1714 NULL, then all DevicePath values will be
1715 searched for.
1716 @param AltCfgId A pointer to the ALTCFG value to search for in
1717 the routing portion of the ConfigResp string
1718 when retrieving the requested data. If this
1719 parameter is NULL, then the current setting will
1720 be retrieved.
1721 @param AltCfgResp A pointer to a buffer which will be allocated by
1722 the function which contains the retrieved string
1723 as requested. This buffer is only allocated if
1724 the call was successful.
1725
1726 @retval EFI_SUCCESS The request succeeded. The requested data was
1727 extracted and placed in the newly allocated
1728 AltCfgResp buffer.
1729 @retval EFI_OUT_OF_RESOURCES Not enough memory to allocate AltCfgResp.
1730 @retval EFI_INVALID_PARAMETER Any parameter is invalid.
1731 @retval EFI_NOT_FOUND Target for the specified routing data was not
1732 found.
1733
1734 **/
1735 EFI_STATUS
1736 EFIAPI
1737 HiiGetAltCfg (
1738 IN CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *This,
1739 IN CONST EFI_STRING Configuration,
1740 IN CONST EFI_GUID *Guid,
1741 IN CONST EFI_STRING Name,
1742 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
1743 IN CONST UINT16 *AltCfgId,
1744 OUT EFI_STRING *AltCfgResp
1745 );
1746
1747 //
1748 // Global variables
1749 //
1750 extern EFI_EVENT gHiiKeyboardLayoutChanged;
1751 #endif