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