]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Library/IfrSupportLib.h
UEFI HII: Merge UEFI HII support changes from branch.
[mirror_edk2.git] / MdePkg / Include / Library / IfrSupportLib.h
1 /*++
2
3 Copyright (c) 2007, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 UefiIfrLibrary.h
15
16 Abstract:
17
18 The file contain all library function for Ifr Operations.
19
20 --*/
21
22 #ifndef _IFRLIBRARY_H
23 #define _IFRLIBRARY_H
24
25
26 #include <Protocol/HiiFont.h>
27 #include <Protocol/HiiImage.h>
28 #include <Protocol/HiiString.h>
29 #include <Protocol/HiiDatabase.h>
30 #include <Protocol/HiiConfigRouting.h>
31 #include <Protocol/HiiConfigAccess.h>
32 #include <Protocol/FormBrowser2.h>
33 #include <Protocol/SimpleTextOut.h>
34
35 #include <Guid/GlobalVariable.h>
36
37 #define IFR_LIB_DEFAULT_STRING_SIZE 0x200
38
39 //
40 // The architectural variable "Lang" and "LangCodes" are deprecated in UEFI
41 // specification. While, UEFI specification also states that these deprecated
42 // variables may be provided for backwards compatibility.
43 // If "LANG_SUPPORT" is defined, "Lang" and "LangCodes" will be produced;
44 // If "LANG_SUPPORT" is undefined, "Lang" and "LangCodes" will not be produced.
45 //
46 #define LANG_SUPPORT
47
48 #define EFI_LANGUAGE_VARIABLE L"Lang"
49 #define EFI_LANGUAGE_CODES_VARIABLE L"LangCodes"
50
51 #define UEFI_LANGUAGE_VARIABLE L"PlatformLang"
52 #define UEFI_LANGUAGE_CODES_VARIABLE L"PlatformLangCodes"
53
54 //
55 // Limited buffer size recommended by RFC4646 (4.3. Length Considerations)
56 // (42 characters plus a NULL terminator)
57 //
58 #define RFC_3066_ENTRY_SIZE (42 + 1)
59 #define ISO_639_2_ENTRY_SIZE 3
60
61 #define INVALID_VARSTORE_ID 0
62
63 #define QUESTION_FLAGS (EFI_IFR_FLAG_READ_ONLY | EFI_IFR_FLAG_CALLBACK | EFI_IFR_FLAG_RESET_REQUIRED | EFI_IFR_FLAG_OPTIONS_ONLY)
64 #define QUESTION_FLAGS_MASK (~QUESTION_FLAGS)
65
66 extern EFI_HII_DATABASE_PROTOCOL *gIfrLibHiiDatabase;
67 extern EFI_HII_STRING_PROTOCOL *gIfrLibHiiString;
68
69 #pragma pack(1)
70 typedef struct {
71 EFI_STRING_ID StringToken;
72 EFI_IFR_TYPE_VALUE Value;
73 UINT8 Flags;
74 } IFR_OPTION;
75 #pragma pack()
76
77 typedef struct {
78 //
79 // Buffer size allocated for Data.
80 //
81 UINT32 BufferSize;
82
83 //
84 // Offset in Data to append the newly created opcode binary.
85 // It will be adjusted automatically in Create***OpCode(), and should be
86 // initialized to 0 before invocation of a serial of Create***OpCode()
87 //
88 UINT32 Offset;
89
90 //
91 // The destination buffer for created op-codes
92 //
93 UINT8 *Data;
94 } EFI_HII_UPDATE_DATA;
95
96
97 //
98 // Exported Library functions
99 //
100 EFI_STATUS
101 CreateEndOpCode (
102 IN OUT EFI_HII_UPDATE_DATA *Data
103 )
104 /*++
105
106 Routine Description:
107 Create EFI_IFR_END_OP opcode.
108
109 Arguments:
110 Data - Destination for the created opcode binary
111
112 Returns:
113 EFI_SUCCESS - Opcode create success
114
115 --*/
116 ;
117
118 EFI_STATUS
119 CreateDefaultOpCode (
120 IN EFI_IFR_TYPE_VALUE *Value,
121 IN UINT8 Type,
122 IN OUT EFI_HII_UPDATE_DATA *Data
123 )
124 /*++
125
126 Routine Description:
127 Create EFI_IFR_DEFAULT_OP opcode.
128
129 Arguments:
130 Value - Value for the default
131 Type - Type for the default
132 Data - Destination for the created opcode binary
133
134 Returns:
135 EFI_SUCCESS - Opcode create success
136
137 --*/
138 ;
139
140 EFI_STATUS
141 CreateActionOpCode (
142 IN EFI_QUESTION_ID QuestionId,
143 IN EFI_STRING_ID Prompt,
144 IN EFI_STRING_ID Help,
145 IN UINT8 QuestionFlags,
146 IN EFI_STRING_ID QuestionConfig,
147 IN OUT EFI_HII_UPDATE_DATA *Data
148 )
149 /*++
150
151 Routine Description:
152 Create EFI_IFR_ACTION_OP opcode.
153
154 Arguments:
155 QuestionId - Question ID
156 Prompt - String ID for Prompt
157 Help - String ID for Help
158 QuestionFlags - Flags in Question Header
159 QuestionConfig - String ID for configuration
160 Data - Destination for the created opcode binary
161
162 Returns:
163 EFI_SUCCESS - Opcode create success
164
165 --*/
166 ;
167
168 EFI_STATUS
169 CreateSubTitleOpCode (
170 IN EFI_STRING_ID Prompt,
171 IN EFI_STRING_ID Help,
172 IN UINT8 Flags,
173 IN UINT8 Scope,
174 IN OUT EFI_HII_UPDATE_DATA *Data
175 )
176 /*++
177
178 Routine Description:
179 Create EFI_IFR_SUBTITLE_OP opcode.
180
181 Arguments:
182 Prompt - String ID for Prompt
183 Help - String ID for Help
184 Flags - Subtitle opcode flags
185 Scope - Subtitle Scope bit
186 Data - Destination for the created opcode binary
187
188 Returns:
189 EFI_SUCCESS - Opcode create success
190
191 --*/
192 ;
193
194 EFI_STATUS
195 CreateTextOpCode (
196 IN EFI_STRING_ID Prompt,
197 IN EFI_STRING_ID Help,
198 IN EFI_STRING_ID TextTwo,
199 IN OUT EFI_HII_UPDATE_DATA *Data
200 )
201 /*++
202
203 Routine Description:
204 Create EFI_IFR_TEXT_OP opcode.
205
206 Arguments:
207 Prompt - String ID for Prompt
208 Help - String ID for Help
209 TextTwo - String ID for text two
210 Data - Destination for the created opcode binary
211
212 Returns:
213 EFI_SUCCESS - Opcode create success
214
215 --*/
216 ;
217
218 EFI_STATUS
219 CreateGotoOpCode (
220 IN EFI_FORM_ID FormId,
221 IN EFI_STRING_ID Prompt,
222 IN EFI_STRING_ID Help,
223 IN UINT8 QuestionFlags,
224 IN EFI_QUESTION_ID QuestionId,
225 IN OUT EFI_HII_UPDATE_DATA *Data
226 )
227 /*++
228
229 Routine Description:
230 Create EFI_IFR_REF_OP opcode.
231
232 Arguments:
233 FormId - Destination Form ID
234 Prompt - String ID for Prompt
235 Help - String ID for Help
236 QuestionFlags - Flags in Question Header
237 QuestionId - Question ID
238 Data - Destination for the created opcode binary
239
240 Returns:
241 EFI_SUCCESS - Opcode create success
242
243 --*/
244 ;
245
246 EFI_STATUS
247 CreateOneOfOptionOpCode (
248 IN UINTN OptionCount,
249 IN IFR_OPTION *OptionsList,
250 IN UINT8 Type,
251 IN OUT EFI_HII_UPDATE_DATA *Data
252 )
253 ;
254
255 EFI_STATUS
256 CreateOneOfOpCode (
257 IN EFI_QUESTION_ID QuestionId,
258 IN EFI_VARSTORE_ID VarStoreId,
259 IN UINT16 VarOffset,
260 IN EFI_STRING_ID Prompt,
261 IN EFI_STRING_ID Help,
262 IN UINT8 QuestionFlags,
263 IN UINT8 OneOfFlags,
264 IN IFR_OPTION *OptionsList,
265 IN UINTN OptionCount,
266 IN OUT EFI_HII_UPDATE_DATA *Data
267 )
268 /*++
269
270 Routine Description:
271 Create EFI_IFR_ONE_OF_OP opcode.
272
273 Arguments:
274 QuestionId - Question ID
275 VarStoreId - Storage ID
276 VarOffset - Offset in Storage
277 Prompt - String ID for Prompt
278 Help - String ID for Help
279 QuestionFlags - Flags in Question Header
280 OneOfFlags - Flags for oneof opcode
281 OptionsList - List of options
282 OptionCount - Number of options in option list
283 Data - Destination for the created opcode binary
284
285 Returns:
286 EFI_SUCCESS - Opcode create success
287
288 --*/
289 ;
290
291 EFI_STATUS
292 CreateOrderedListOpCode (
293 IN EFI_QUESTION_ID QuestionId,
294 IN EFI_VARSTORE_ID VarStoreId,
295 IN UINT16 VarOffset,
296 IN EFI_STRING_ID Prompt,
297 IN EFI_STRING_ID Help,
298 IN UINT8 QuestionFlags,
299 IN UINT8 Flags,
300 IN UINT8 DataType,
301 IN UINT8 MaxContainers,
302 IN IFR_OPTION *OptionsList,
303 IN UINTN OptionCount,
304 IN OUT EFI_HII_UPDATE_DATA *Data
305 )
306 /*++
307
308 Routine Description:
309 Create EFI_IFR_ORDERED_LIST_OP opcode.
310
311 Arguments:
312 QuestionId - Question ID
313 VarStoreId - Storage ID
314 VarOffset - Offset in Storage
315 Prompt - String ID for Prompt
316 Help - String ID for Help
317 QuestionFlags - Flags in Question Header
318 Flags - Flags for ordered list opcode
319 DataType - Type for option value
320 MaxContainers - Maximum count for options in this ordered list
321 OptionsList - List of options
322 OptionCount - Number of options in option list
323 Data - Destination for the created opcode binary
324
325 Returns:
326 EFI_SUCCESS - Opcode create success
327
328 --*/
329 ;
330
331 EFI_STATUS
332 CreateCheckBoxOpCode (
333 IN EFI_QUESTION_ID QuestionId,
334 IN EFI_VARSTORE_ID VarStoreId,
335 IN UINT16 VarOffset,
336 IN EFI_STRING_ID Prompt,
337 IN EFI_STRING_ID Help,
338 IN UINT8 QuestionFlags,
339 IN UINT8 CheckBoxFlags,
340 IN OUT EFI_HII_UPDATE_DATA *Data
341 )
342 /*++
343
344 Routine Description:
345 Create EFI_IFR_CHECKBOX_OP opcode.
346
347 Arguments:
348 QuestionId - Question ID
349 VarStoreId - Storage ID
350 VarOffset - Offset in Storage
351 Prompt - String ID for Prompt
352 Help - String ID for Help
353 QuestionFlags - Flags in Question Header
354 CheckBoxFlags - Flags for checkbox opcode
355 Data - Destination for the created opcode binary
356
357 Returns:
358 EFI_SUCCESS - Opcode create success
359
360 --*/
361 ;
362
363 EFI_STATUS
364 CreateNumericOpCode (
365 IN EFI_QUESTION_ID QuestionId,
366 IN EFI_VARSTORE_ID VarStoreId,
367 IN UINT16 VarOffset,
368 IN EFI_STRING_ID Prompt,
369 IN EFI_STRING_ID Help,
370 IN UINT8 QuestionFlags,
371 IN UINT8 NumericFlags,
372 IN UINT64 Minimum,
373 IN UINT64 Maximum,
374 IN UINT64 Step,
375 IN UINT64 Default,
376 IN OUT EFI_HII_UPDATE_DATA *Data
377 )
378 /*++
379
380 Routine Description:
381 Create EFI_IFR_NUMERIC_OP opcode.
382
383 Arguments:
384 QuestionId - Question ID
385 VarStoreId - Storage ID
386 VarOffset - Offset in Storage
387 Prompt - String ID for Prompt
388 Help - String ID for Help
389 QuestionFlags - Flags in Question Header
390 NumericFlags - Flags for numeric opcode
391 Minimum - Numeric minimum value
392 Maximum - Numeric maximum value
393 Step - Numeric step for edit
394 Default - Numeric default value
395 Data - Destination for the created opcode binary
396
397 Returns:
398 EFI_SUCCESS - Opcode create success
399
400 --*/
401 ;
402
403 EFI_STATUS
404 CreateStringOpCode (
405 IN EFI_QUESTION_ID QuestionId,
406 IN EFI_VARSTORE_ID VarStoreId,
407 IN UINT16 VarOffset,
408 IN EFI_STRING_ID Prompt,
409 IN EFI_STRING_ID Help,
410 IN UINT8 QuestionFlags,
411 IN UINT8 StringFlags,
412 IN UINT8 MinSize,
413 IN UINT8 MaxSize,
414 IN OUT EFI_HII_UPDATE_DATA *Data
415 )
416 /*++
417
418 Routine Description:
419 Create EFI_IFR_STRING_OP opcode.
420
421 Arguments:
422 QuestionId - Question ID
423 VarStoreId - Storage ID
424 VarOffset - Offset in Storage
425 Prompt - String ID for Prompt
426 Help - String ID for Help
427 QuestionFlags - Flags in Question Header
428 StringFlags - Flags for string opcode
429 MinSize - String minimum length
430 MaxSize - String maximum length
431 Data - Destination for the created opcode binary
432
433 Returns:
434 EFI_SUCCESS - Opcode create success
435
436 --*/
437 ;
438
439 EFI_STATUS
440 CreateBannerOpCode (
441 IN EFI_STRING_ID Title,
442 IN UINT16 LineNumber,
443 IN UINT8 Alignment,
444 IN OUT EFI_HII_UPDATE_DATA *Data
445 )
446 /*++
447
448 Routine Description:
449 Create GUIDed opcode for banner.
450
451 Arguments:
452 Title - String ID for title
453 LineNumber - Line number for this banner
454 Alignment - Alignment for this banner, left, center or right
455 Data - Destination for the created opcode binary
456
457 Returns:
458 EFI_SUCCESS - Opcode create success
459
460 --*/
461 ;
462
463 EFI_HII_PACKAGE_LIST_HEADER *
464 PreparePackageList (
465 IN UINTN NumberOfPackages,
466 IN EFI_GUID *GuidId,
467 ...
468 )
469 /*++
470
471 Routine Description:
472 Assemble EFI_HII_PACKAGE_LIST according to the passed in packages.
473
474 Arguments:
475 NumberOfPackages - Number of packages.
476 GuidId - Package GUID.
477
478 Returns:
479 Pointer of EFI_HII_PACKAGE_LIST_HEADER.
480
481 --*/
482 ;
483
484 EFI_HII_HANDLE
485 DevicePathToHiiHandle (
486 IN EFI_HII_DATABASE_PROTOCOL *HiiDatabase,
487 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
488 )
489 /*++
490
491 Routine Description:
492 Find HII Handle associated with given Device Path.
493
494 Arguments:
495 HiiDatabase - Point to EFI_HII_DATABASE_PROTOCOL instance.
496 DevicePath - Device Path associated with the HII package list handle.
497
498 Returns:
499 Handle - HII package list Handle associated with the Device Path.
500 NULL - Hii Package list handle is not found.
501
502 --*/
503 ;
504
505 EFI_STATUS
506 ExtractDefault(
507 IN VOID *Buffer,
508 IN UINTN *BufferSize,
509 UINTN Number,
510 ...
511 )
512 /*++
513
514 Routine Description:
515 Configure the buffer accrording to ConfigBody strings.
516
517 Arguments:
518 DefaultId - the ID of default.
519 Buffer - the start address of buffer.
520 BufferSize - the size of buffer.
521 Number - the number of the strings.
522
523 Returns:
524 EFI_BUFFER_TOO_SMALL - the BufferSize is too small to operate.
525 EFI_INVALID_PARAMETER - Buffer is NULL or BufferSize is 0.
526 EFI_SUCCESS - Operation successful.
527
528 --*/
529 ;
530
531 EFI_STATUS
532 ExtractGuidFromHiiHandle (
533 IN EFI_HII_HANDLE Handle,
534 OUT EFI_GUID *Guid
535 )
536 /*++
537
538 Routine Description:
539 Extract Hii package list GUID for given HII handle.
540
541 Arguments:
542 HiiHandle - Hii handle
543 Guid - Package list GUID
544
545 Returns:
546 EFI_SUCCESS - Successfully extract GUID from Hii database.
547
548 --*/
549 ;
550
551 EFI_STATUS
552 BufferToHexString (
553 IN OUT CHAR16 *Str,
554 IN UINT8 *Buffer,
555 IN UINTN BufferSize
556 )
557 /*++
558
559 Routine Description:
560 Converts binary buffer to Unicode string in reversed byte order to BufToHexString().
561
562 Arguments:
563 Str - String for output
564 Buffer - Binary buffer.
565 BufferSize - Size of the buffer in bytes.
566
567 Returns:
568 EFI_SUCCESS - The function completed successfully.
569
570 --*/
571 ;
572
573 EFI_STATUS
574 HexStringToBuffer (
575 IN OUT UINT8 *Buffer,
576 IN OUT UINTN *BufferSize,
577 IN CHAR16 *Str
578 )
579 /*++
580
581 Routine Description:
582 Converts Hex String to binary buffer in reversed byte order to HexStringToBuf().
583
584 Arguments:
585 Buffer - Pointer to buffer that receives the data.
586 BufferSize - Length in bytes of the buffer to hold converted data.
587 If routine return with EFI_SUCCESS, containing length of converted data.
588 If routine return with EFI_BUFFER_TOO_SMALL, containg length of buffer desired.
589 Str - String to be converted from.
590
591 Returns:
592 EFI_SUCCESS - The function completed successfully.
593
594 --*/
595 ;
596
597 EFI_STATUS
598 ConstructConfigHdr (
599 IN OUT CHAR16 *ConfigHdr,
600 IN OUT UINTN *StrBufferLen,
601 IN EFI_GUID *Guid,
602 IN CHAR16 *Name, OPTIONAL
603 IN EFI_HANDLE *DriverHandle
604 )
605 /*++
606
607 Routine Description:
608 Construct <ConfigHdr> using routing information GUID/NAME/PATH.
609
610 Arguments:
611 ConfigHdr - Pointer to the ConfigHdr string.
612 StrBufferLen - On input: Length in bytes of buffer to hold the ConfigHdr string. Includes tailing '\0' character.
613 On output:
614 If return EFI_SUCCESS, containing length of ConfigHdr string buffer.
615 If return EFI_BUFFER_TOO_SMALL, containg length of string buffer desired.
616 Guid - Routing information: GUID.
617 Name - Routing information: NAME.
618 DriverHandle - Driver handle which contains the routing information: PATH.
619
620 Returns:
621 EFI_SUCCESS - Routine success.
622 EFI_BUFFER_TOO_SMALL - The ConfigHdr string buffer is too small.
623
624 --*/
625 ;
626
627 BOOLEAN
628 FindBlockName (
629 IN OUT CHAR16 *String,
630 UINTN Offset,
631 UINTN Width
632 )
633 /*++
634
635 Routine Description:
636 Search BlockName "&OFFSET=Offset&WIDTH=Width" in a string.
637
638 Arguments:
639 String - The string to be searched in.
640 Offset - Offset in BlockName.
641 Width - Width in BlockName.
642
643 Returns:
644 TRUE - Block name found.
645 FALSE - Block name not found.
646
647 --*/
648 ;
649
650 EFI_STATUS
651 GetBrowserData (
652 EFI_GUID *VariableGuid, OPTIONAL
653 CHAR16 *VariableName, OPTIONAL
654 UINTN *BufferSize,
655 UINT8 *Buffer
656 )
657 /*++
658
659 Routine Description:
660 This routine is invoked by ConfigAccess.Callback() to retrived uncommitted data from Form Browser.
661
662 Arguments:
663 VariableGuid - An optional field to indicate the target variable GUID name to use.
664 VariableName - An optional field to indicate the target human-readable variable name.
665 BufferSize - On input: Length in bytes of buffer to hold retrived data.
666 On output:
667 If return EFI_BUFFER_TOO_SMALL, containg length of buffer desired.
668 Buffer - Buffer to hold retrived data.
669
670 Returns:
671 EFI_SUCCESS - Routine success.
672 EFI_BUFFER_TOO_SMALL - The intput buffer is too small.
673
674 --*/
675 ;
676
677 EFI_STATUS
678 GetHiiHandles (
679 IN OUT UINTN *HandleBufferLength,
680 OUT EFI_HII_HANDLE **HiiHandleBuffer
681 )
682 /*++
683
684 Routine Description:
685 Determines the handles that are currently active in the database.
686 It's the caller's responsibility to free handle buffer.
687
688 Arguments:
689 HiiDatabase - A pointer to the EFI_HII_DATABASE_PROTOCOL instance.
690 HandleBufferLength - On input, a pointer to the length of the handle buffer. On output,
691 the length of the handle buffer that is required for the handles found.
692 HiiHandleBuffer - Pointer to an array of Hii Handles returned.
693
694 Returns:
695 EFI_SUCCESS - Get an array of Hii Handles successfully.
696 EFI_INVALID_PARAMETER - Hii is NULL.
697 EFI_NOT_FOUND - Database not found.
698
699 --*/
700 ;
701
702 EFI_STATUS
703 SetBrowserData (
704 EFI_GUID *VariableGuid, OPTIONAL
705 CHAR16 *VariableName, OPTIONAL
706 UINTN BufferSize,
707 UINT8 *Buffer,
708 CHAR16 *RequestElement OPTIONAL
709 )
710 /*++
711
712 Routine Description:
713 This routine is invoked by ConfigAccess.Callback() to update uncommitted data of Form Browser.
714
715 Arguments:
716 VariableGuid - An optional field to indicate the target variable GUID name to use.
717 VariableName - An optional field to indicate the target human-readable variable name.
718 BufferSize - Length in bytes of buffer to hold retrived data.
719 Buffer - Buffer to hold retrived data.
720 RequestElement - An optional field to specify which part of the buffer data
721 will be send back to Browser. If NULL, the whole buffer of
722 data will be committed to Browser.
723 <RequestElement> ::= &OFFSET=<Number>&WIDTH=<Number>*
724
725 Returns:
726 EFI_SUCCESS - Routine success.
727 Other - Updating Browser uncommitted data failed.
728
729 --*/
730 ;
731
732 EFI_STATUS
733 ConvertRfc3066LanguageToIso639Language (
734 CHAR8 *LanguageRfc3066,
735 CHAR8 *LanguageIso639
736 )
737 /*++
738
739 Routine Description:
740 Convert language code from RFC3066 to ISO639-2.
741
742 Arguments:
743 LanguageRfc3066 - RFC3066 language code.
744 LanguageIso639 - ISO639-2 language code.
745
746 Returns:
747 EFI_SUCCESS - Language code converted.
748 EFI_NOT_FOUND - Language code not found.
749
750 --*/
751 ;
752
753 CHAR8 *
754 Rfc3066ToIso639 (
755 CHAR8 *SupportedLanguages
756 )
757 /*++
758
759 Routine Description:
760 Convert language code list from RFC3066 to ISO639-2, e.g. "en-US;fr-FR" will
761 be converted to "engfra".
762
763 Arguments:
764 SupportedLanguages - The RFC3066 language list.
765
766 Returns:
767 The ISO639-2 language list.
768
769 --*/
770 ;
771
772 EFI_STATUS
773 GetCurrentLanguage (
774 OUT CHAR8 *Lang
775 )
776 /*++
777
778 Routine Description:
779 Determine what is the current language setting
780
781 Arguments:
782 Lang - Pointer of system language
783
784 Returns:
785 Status code
786
787 --*/
788 ;
789
790 VOID
791 GetNextLanguage (
792 IN OUT CHAR8 **LangCode,
793 OUT CHAR8 *Lang
794 )
795 /*++
796
797 Routine Description:
798 Get next language from language code list.
799
800 Arguments:
801 LangCode - The language code.
802 Lang - Returned language.
803
804 Returns:
805 None.
806
807 --*/
808 ;
809
810 CHAR8 *
811 GetSupportedLanguages (
812 IN EFI_HII_HANDLE HiiHandle
813 )
814 /*++
815
816 Routine Description:
817 This function returns the list of supported languages, in the format specified
818 in UEFI specification Appendix M.
819
820 Arguments:
821 HiiHandle - The HII package list handle.
822
823 Returns:
824 The supported languages.
825
826 --*/
827 ;
828
829 UINT16
830 GetSupportedLanguageNumber (
831 IN EFI_HII_HANDLE HiiHandle
832 )
833 /*++
834
835 Routine Description:
836 This function returns the number of supported languages
837
838 Arguments:
839 HiiHandle - The HII package list handle.
840
841 Returns:
842 The number of supported languages.
843
844 --*/
845 ;
846
847 EFI_STATUS
848 GetStringFromHandle (
849 IN EFI_HII_HANDLE HiiHandle,
850 IN EFI_STRING_ID StringId,
851 OUT EFI_STRING *String
852 )
853 /*++
854
855 Routine Description:
856 Get string specified by StringId form the HiiHandle.
857
858 Arguments:
859 HiiHandle - The HII handle of package list.
860 StringId - The String ID.
861 String - The output string.
862
863 Returns:
864 EFI_NOT_FOUND - String is not found.
865 EFI_SUCCESS - Operation is successful.
866 EFI_OUT_OF_RESOURCES - There is not enought memory in the system.
867 EFI_INVALID_PARAMETER - The String is NULL.
868
869 --*/
870 ;
871
872 EFI_STATUS
873 GetStringFromToken (
874 IN EFI_GUID *ProducerGuid,
875 IN EFI_STRING_ID StringId,
876 OUT EFI_STRING *String
877 )
878 /*++
879
880 Routine Description:
881 Get the string given the StringId and String package Producer's Guid.
882
883 Arguments:
884 ProducerGuid - The Guid of String package list.
885 StringId - The String ID.
886 String - The output string.
887
888 Returns:
889 EFI_NOT_FOUND - String is not found.
890 EFI_SUCCESS - Operation is successful.
891 EFI_OUT_OF_RESOURCES - There is not enought memory in the system.
892
893 --*/
894 ;
895
896 EFI_STATUS
897 IfrLibNewString (
898 IN EFI_HII_HANDLE PackageList,
899 OUT EFI_STRING_ID *StringId,
900 IN CONST EFI_STRING String
901 )
902 /*++
903
904 Routine Description:
905 This function adds the string into String Package of each language.
906
907 Arguments:
908 PackageList - Handle of the package list where this string will be added.
909 StringId - On return, contains the new strings id, which is unique within PackageList.
910 String - Points to the new null-terminated string.
911
912 Returns:
913 EFI_SUCCESS - The new string was added successfully.
914 EFI_NOT_FOUND - The specified PackageList could not be found in database.
915 EFI_OUT_OF_RESOURCES - Could not add the string due to lack of resources.
916 EFI_INVALID_PARAMETER - String is NULL or StringId is NULL is NULL.
917
918 --*/
919 ;
920
921 EFI_STATUS
922 IfrLibGetString (
923 IN EFI_HII_HANDLE PackageList,
924 IN EFI_STRING_ID StringId,
925 OUT EFI_STRING String,
926 IN OUT UINTN *StringSize
927 )
928 /*++
929
930 Routine Description:
931 This function try to retrieve string from String package of current language.
932 If fail, it try to retrieve string from String package of first language it support.
933
934 Arguments:
935 PackageList - The package list in the HII database to search for the specified string.
936 StringId - The string's id, which is unique within PackageList.
937 String - Points to the new null-terminated string.
938 StringSize - On entry, points to the size of the buffer pointed to by String, in bytes. On return,
939 points to the length of the string, in bytes.
940
941 Returns:
942 EFI_SUCCESS - The string was returned successfully.
943 EFI_NOT_FOUND - The string specified by StringId is not available.
944 EFI_BUFFER_TOO_SMALL - The buffer specified by StringLength is too small to hold the string.
945 EFI_INVALID_PARAMETER - The String or StringSize was NULL.
946
947 --*/
948 ;
949
950 EFI_STATUS
951 IfrLibSetString (
952 IN EFI_HII_HANDLE PackageList,
953 IN EFI_STRING_ID StringId,
954 IN CONST EFI_STRING String
955 )
956 /*++
957
958 Routine Description:
959 This function updates the string in String package of current language.
960
961 Arguments:
962 PackageList - The package list containing the strings.
963 StringId - The string's id, which is unique within PackageList.
964 String - Points to the new null-terminated string.
965
966 Returns:
967 EFI_SUCCESS - The string was updated successfully.
968 EFI_NOT_FOUND - The string specified by StringId is not in the database.
969 EFI_INVALID_PARAMETER - The String was NULL.
970 EFI_OUT_OF_RESOURCES - The system is out of resources to accomplish the task.
971
972 --*/
973 ;
974
975 EFI_STATUS
976 IfrLibCreatePopUp (
977 IN UINTN NumberOfLines,
978 OUT EFI_INPUT_KEY *KeyValue,
979 IN CHAR16 *String,
980 ...
981 )
982 /*++
983
984 Routine Description:
985 Draw a dialog and return the selected key.
986
987 Arguments:
988 NumberOfLines - The number of lines for the dialog box
989 KeyValue - The EFI_KEY value returned if HotKey is TRUE..
990 String - Pointer to the first string in the list
991 ... - A series of (quantity == NumberOfLines) text strings which
992 will be used to construct the dialog box
993
994 Returns:
995 EFI_SUCCESS - Displayed dialog and received user interaction
996 EFI_INVALID_PARAMETER - One of the parameters was invalid.
997
998 --*/
999 ;
1000
1001 EFI_STATUS
1002 IfrLibUpdateForm (
1003 IN EFI_HII_HANDLE Handle,
1004 IN EFI_GUID *FormSetGuid, OPTIONAL
1005 IN EFI_FORM_ID FormId,
1006 IN UINT16 Label,
1007 IN BOOLEAN Insert,
1008 IN EFI_HII_UPDATE_DATA *Data
1009 )
1010 /*++
1011
1012 Routine Description:
1013 This function allows the caller to update a form that has
1014 previously been registered with the EFI HII database.
1015
1016 Arguments:
1017 Handle - Hii Handle
1018 FormSetGuid - The formset should be updated.
1019 FormId - The form should be updated.
1020 Label - Update information starting immediately after this label in the IFR
1021 Insert - If TRUE and Data is not NULL, insert data after Label.
1022 If FALSE, replace opcodes between two labels with Data.
1023 Data - The adding data; If NULL, remove opcodes between two Label.
1024
1025 Returns:
1026 EFI_SUCCESS - Update success.
1027 Other - Update fail.
1028
1029 --*/
1030 ;
1031 #endif