]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Library/IfrSupportLib.h
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2893 6f19259b...
[mirror_edk2.git] / MdePkg / Include / Library / IfrSupportLib.h
1 /** @file
2 The file contain all library function for Ifr Operations.
3
4 Copyright (c) 2006 - 2007, 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 __IFRSUPPORTLIBRARY_H__
16 #define __IFRSUPPORTLIBRARY_H__
17
18 #define DEFAULT_FORM_BUFFER_SIZE 0xFFFF
19 #define DEFAULT_STRING_BUFFER_SIZE 0xFFFF
20
21 #pragma pack(1)
22 typedef struct {
23 CHAR16 *OptionString; // Passed in string to generate a token for in a truly dynamic form creation
24 STRING_REF StringToken; // This is used when creating a single op-code without generating a StringToken (have one already)
25 UINT16 Value;
26 UINT8 Flags;
27 UINT16 Key;
28 } IFR_OPTION;
29 #pragma pack()
30
31 EFI_STATUS
32 GetCurrentLanguage (
33 OUT CHAR16 *Lang
34 )
35 /*++
36
37 Routine Description:
38
39 Determine what is the current language setting
40
41 Arguments:
42
43 Lang - Pointer of system language
44
45 Returns:
46
47 Status code
48
49 --*/
50 ;
51
52 EFI_STATUS
53 AddString (
54 IN VOID *StringBuffer,
55 IN CHAR16 *Language,
56 IN CHAR16 *String,
57 IN OUT STRING_REF *StringToken
58 )
59 /*++
60
61 Routine Description:
62
63 Add a string to the incoming buffer and return the token and offset data
64
65 Arguments:
66
67 StringBuffer - The incoming buffer
68
69 Language - Currrent language
70
71 String - The string to be added
72
73 StringToken - The index where the string placed
74
75 Returns:
76
77 EFI_OUT_OF_RESOURCES - No enough buffer to allocate
78
79 EFI_SUCCESS - String successfully added to the incoming buffer
80
81 --*/
82 ;
83
84 EFI_STATUS
85 AddOpCode (
86 IN VOID *FormBuffer,
87 IN OUT VOID *OpCodeData
88 )
89 /*++
90
91 Routine Description:
92
93 Add op-code data to the FormBuffer
94
95 Arguments:
96
97 FormBuffer - Form buffer to be inserted to
98
99 OpCodeData - Op-code data to be inserted
100
101 Returns:
102
103 EFI_OUT_OF_RESOURCES - No enough buffer to allocate
104
105 EFI_SUCCESS - Op-code data successfully inserted
106
107 --*/
108 ;
109
110 EFI_STATUS
111 CreateFormSet (
112 IN CHAR16 *FormSetTitle,
113 IN EFI_GUID *Guid,
114 IN UINT8 Class,
115 IN UINT8 SubClass,
116 IN OUT VOID **FormBuffer,
117 IN OUT VOID **StringBuffer
118 )
119 /*++
120
121 Routine Description:
122
123 Create a formset
124
125 Arguments:
126
127 FormSetTitle - Title of formset
128
129 Guid - Guid of formset
130
131 Class - Class of formset
132
133 SubClass - Sub class of formset
134
135 FormBuffer - Pointer of the formset created
136
137 StringBuffer - Pointer of FormSetTitile string created
138
139 Returns:
140
141 EFI_OUT_OF_RESOURCES - No enough buffer to allocate
142
143 EFI_SUCCESS - Formset successfully created
144
145 --*/
146 ;
147
148 EFI_STATUS
149 CreateForm (
150 IN CHAR16 *FormTitle,
151 IN UINT16 FormId,
152 IN OUT VOID *FormBuffer,
153 IN OUT VOID *StringBuffer
154 )
155 /*++
156
157 Routine Description:
158
159 Create a form
160
161 Arguments:
162
163 FormTitle - Title of the form
164
165 FormId - Id of the form
166
167 FormBuffer - Pointer of the form created
168
169 StringBuffer - Pointer of FormTitil string created
170
171 Returns:
172
173 EFI_SUCCESS - Form successfully created
174
175 --*/
176 ;
177
178 EFI_STATUS
179 CreateSubTitle (
180 IN CHAR16 *SubTitle,
181 IN OUT VOID *FormBuffer,
182 IN OUT VOID *StringBuffer
183 )
184 /*++
185
186 Routine Description:
187
188 Create a SubTitle
189
190 Arguments:
191
192 SubTitle - Sub title to be created
193
194 FormBuffer - Where this subtitle to add to
195
196 StringBuffer - String buffer created for subtitle
197
198 Returns:
199
200 EFI_SUCCESS - Subtitle successfully created
201
202 --*/
203 ;
204
205 EFI_STATUS
206 CreateText (
207 IN CHAR16 *String,
208 IN CHAR16 *String2,
209 IN CHAR16 *String3,
210 IN UINT8 Flags,
211 IN UINT16 Key,
212 IN OUT VOID *FormBuffer,
213 IN OUT VOID *StringBuffer
214 )
215 /*++
216
217 Routine Description:
218
219 Create a line of text
220
221 Arguments:
222
223 String - First string of the text
224
225 String2 - Second string of the text
226
227 String3 - Help string of the text
228
229 Flags - Flag of the text
230
231 Key - Key of the text
232
233 FormBuffer - The form where this text adds to
234
235 StringBuffer - String buffer created for String, String2 and String3
236
237 Returns:
238
239 EFI_SUCCESS - Text successfully created
240
241 --*/
242 ;
243
244 EFI_STATUS
245 CreateGoto (
246 IN UINT16 FormId,
247 IN CHAR16 *Prompt,
248 IN OUT VOID *FormBuffer,
249 IN OUT VOID *StringBuffer
250 )
251 /*++
252
253 Routine Description:
254
255 Create a hyperlink
256
257 Arguments:
258
259 FormId - Form ID of the hyperlink
260
261 Prompt - Prompt of the hyperlink
262
263 FormBuffer - The form where this hyperlink adds to
264
265 StringBuffer - String buffer created for Prompt
266
267 Returns:
268
269 EFI_SUCCESS - Hyperlink successfully created
270
271 --*/
272 ;
273
274 EFI_STATUS
275 CreateOneOf (
276 IN UINT16 QuestionId,
277 IN UINT8 DataWidth,
278 IN CHAR16 *Prompt,
279 IN CHAR16 *Help,
280 IN IFR_OPTION *OptionsList,
281 IN UINTN OptionCount,
282 IN OUT VOID *FormBuffer,
283 IN OUT VOID *StringBuffer
284 )
285 /*++
286
287 Routine Description:
288
289 Create a one-of question with a set of options to choose from. The
290 OptionsList is a pointer to a null-terminated list of option descriptions.
291
292 Arguments:
293
294 QuestionId - Question ID of the one-of box
295
296 DataWidth - DataWidth of the one-of box
297
298 Prompt - Prompt of the one-of box
299
300 Help - Help of the one-of box
301
302 OptionsList - Each string in it is an option of the one-of box
303
304 OptionCount - Option string count
305
306 FormBuffer - The form where this one-of box adds to
307
308 StringBuffer - String buffer created for Prompt, Help and Option strings
309
310 Returns:
311
312 EFI_DEVICE_ERROR - DataWidth > 2
313
314 EFI_SUCCESS - One-Of box successfully created.
315
316 --*/
317 ;
318
319 EFI_STATUS
320 CreateOrderedList (
321 IN UINT16 QuestionId,
322 IN UINT8 MaxEntries,
323 IN CHAR16 *Prompt,
324 IN CHAR16 *Help,
325 IN IFR_OPTION *OptionsList,
326 IN UINTN OptionCount,
327 IN OUT VOID *FormBuffer,
328 IN OUT VOID *StringBuffer
329 )
330 /*++
331
332 Routine Description:
333
334 Create a one-of question with a set of options to choose from. The
335 OptionsList is a pointer to a null-terminated list of option descriptions.
336
337 Arguments:
338
339 QuestionId - Question ID of the ordered list
340
341 MaxEntries - MaxEntries of the ordered list
342
343 Prompt - Prompt of the ordered list
344
345 Help - Help of the ordered list
346
347 OptionsList - Each string in it is an option of the ordered list
348
349 OptionCount - Option string count
350
351 FormBuffer - The form where this ordered list adds to
352
353 StringBuffer - String buffer created for Prompt, Help and Option strings
354
355 Returns:
356
357 EFI_SUCCESS - Ordered list successfully created.
358
359 --*/
360 ;
361
362 EFI_STATUS
363 CreateCheckBox (
364 IN UINT16 QuestionId,
365 IN UINT8 DataWidth,
366 IN CHAR16 *Prompt,
367 IN CHAR16 *Help,
368 IN UINT8 Flags,
369 IN OUT VOID *FormBuffer,
370 IN OUT VOID *StringBuffer
371 )
372 /*++
373
374 Routine Description:
375
376 Create a checkbox
377
378 Arguments:
379
380 QuestionId - Question ID of the check box
381
382 DataWidth - DataWidth of the check box
383
384 Prompt - Prompt of the check box
385
386 Help - Help of the check box
387
388 Flags - Flags of the check box
389
390 FormBuffer - The form where this check box adds to
391
392 StringBuffer - String buffer created for Prompt and Help.
393
394 Returns:
395
396 EFI_DEVICE_ERROR - DataWidth > 1
397
398 EFI_SUCCESS - Check box successfully created
399
400 --*/
401 ;
402
403 EFI_STATUS
404 CreateNumeric (
405 IN UINT16 QuestionId,
406 IN UINT8 DataWidth,
407 IN CHAR16 *Prompt,
408 IN CHAR16 *Help,
409 IN UINT16 Minimum,
410 IN UINT16 Maximum,
411 IN UINT16 Step,
412 IN UINT16 Default,
413 IN UINT8 Flags,
414 IN UINT16 Key,
415 IN OUT VOID *FormBuffer,
416 IN OUT VOID *StringBuffer
417 )
418 /*++
419
420 Routine Description:
421
422 Create a numeric
423
424 Arguments:
425
426 QuestionId - Question ID of the numeric
427
428 DataWidth - DataWidth of the numeric
429
430 Prompt - Prompt of the numeric
431
432 Help - Help of the numeric
433
434 Minimum - Minumun boundary of the numeric
435
436 Maximum - Maximum boundary of the numeric
437
438 Step - Step of the numeric
439
440 Default - Default value
441
442 Flags - Flags of the numeric
443
444 Key - Key of the numeric
445
446 FormBuffer - The form where this numeric adds to
447
448 StringBuffer - String buffer created for Prompt and Help.
449
450 Returns:
451
452 EFI_DEVICE_ERROR - DataWidth > 2
453
454 EFI_SUCCESS - Numeric is successfully created
455
456 --*/
457 ;
458
459 EFI_STATUS
460 CreateString (
461 IN UINT16 QuestionId,
462 IN UINT8 DataWidth,
463 IN CHAR16 *Prompt,
464 IN CHAR16 *Help,
465 IN UINT8 MinSize,
466 IN UINT8 MaxSize,
467 IN UINT8 Flags,
468 IN UINT16 Key,
469 IN OUT VOID *FormBuffer,
470 IN OUT VOID *StringBuffer
471 )
472 /*++
473
474 Routine Description:
475
476 Create a string
477
478 Arguments:
479
480 QuestionId - Question ID of the string
481
482 DataWidth - DataWidth of the string
483
484 Prompt - Prompt of the string
485
486 Help - Help of the string
487
488 MinSize - Min size boundary of the string
489
490 MaxSize - Max size boundary of the string
491
492 Flags - Flags of the string
493
494 Key - Key of the string
495
496 FormBuffer - The form where this string adds to
497
498 StringBuffer - String buffer created for Prompt and Help.
499
500 Returns:
501
502 EFI_SUCCESS - String successfully created.
503
504 --*/
505 ;
506
507 EFI_STATUS
508 ExtractDataFromHiiHandle (
509 IN EFI_HII_HANDLE HiiHandle,
510 IN OUT UINT16 *ImageLength,
511 OUT UINT8 *DefaultImage,
512 OUT EFI_GUID *Guid
513 )
514 /*++
515
516 Routine Description:
517
518 Extract information pertaining to the HiiHandle
519
520 Arguments:
521
522 HiiHandle - Hii handle
523
524 ImageLength - For input, length of DefaultImage;
525 For output, length of actually required
526
527 DefaultImage - Image buffer prepared by caller
528
529 Guid - Guid information about the form
530
531 Returns:
532
533 EFI_OUT_OF_RESOURCES - No enough buffer to allocate
534
535 EFI_BUFFER_TOO_SMALL - DefualtImage has no enough ImageLength
536
537 EFI_SUCCESS - Successfully extract data from Hii database.
538
539
540 --*/
541 ;
542
543 EFI_HII_HANDLE
544 FindHiiHandle (
545 IN OUT EFI_HII_PROTOCOL **HiiProtocol, OPTIONAL
546 IN EFI_GUID *Guid
547 )
548 /*++
549
550 Routine Description:
551 Finds HII handle for given pack GUID previously registered with the HII.
552
553 Arguments:
554 HiiProtocol - pointer to pointer to HII protocol interface.
555 If NULL, the interface will be found but not returned.
556 If it points to NULL, the interface will be found and
557 written back to the pointer that is pointed to.
558 Guid - The GUID of the pack that registered with the HII.
559
560 Returns:
561 Handle to the HII pack previously registered by the memory driver.
562
563 --*/
564 ;
565
566 EFI_STATUS
567 CreateSubTitleOpCode (
568 IN STRING_REF StringToken,
569 IN OUT VOID *FormBuffer
570 )
571 /*++
572
573 Routine Description:
574
575 Create a SubTitle opcode independent of string creation
576 This is used primarily by users who need to create just one particular valid op-code and the string
577 data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
578 location to pre-defined forms in HII)
579
580 Arguments:
581
582 StringToken - StringToken of the subtitle
583
584 FormBuffer - Output of subtitle as a form
585
586 Returns:
587
588 EFI_SUCCESS - Subtitle created to be a form
589
590 --*/
591 ;
592
593 EFI_STATUS
594 CreateTextOpCode (
595 IN STRING_REF StringToken,
596 IN STRING_REF StringTokenTwo,
597 IN STRING_REF StringTokenThree,
598 IN UINT8 Flags,
599 IN UINT16 Key,
600 IN OUT VOID *FormBuffer
601 )
602 /*++
603
604 Routine Description:
605
606 Create a Text opcode independent of string creation
607 This is used primarily by users who need to create just one particular valid op-code and the string
608 data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
609 location to pre-defined forms in HII)
610
611 Arguments:
612
613 StringToken - First string token of the text
614
615 StringTokenTwo - Second string token of the text
616
617 StringTokenThree - Help string token of the text
618
619 Flags - Flag of the text
620
621 Key - Key of the text
622
623 FormBuffer - Output of text as a form
624
625 Returns:
626
627 EFI_SUCCESS - Text created to be a form
628
629 --*/
630 ;
631
632 EFI_STATUS
633 CreateGotoOpCode (
634 IN UINT16 FormId,
635 IN STRING_REF StringToken,
636 IN STRING_REF StringTokenTwo,
637 IN UINT8 Flags,
638 IN UINT16 Key,
639 IN OUT VOID *FormBuffer
640 )
641 /*++
642
643 Routine Description:
644
645 Create a hyperlink opcode independent of string creation
646 This is used primarily by users who need to create just one particular valid op-code and the string
647 data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
648 location to pre-defined forms in HII)
649
650 Arguments:
651
652 FormId - Form ID of the hyperlink
653
654 StringToken - Prompt string token of the hyperlink
655
656 StringTokenTwo - Help string token of the hyperlink
657
658 Flags - Flags of the hyperlink
659
660 Key - Key of the hyperlink
661
662 FormBuffer - Output of hyperlink as a form
663
664 Returns:
665
666 EFI_SUCCESS - Hyperlink created to be a form
667
668 --*/
669 ;
670
671 EFI_STATUS
672 CreateOneOfOpCode (
673 IN UINT16 QuestionId,
674 IN UINT8 DataWidth,
675 IN STRING_REF PromptToken,
676 IN STRING_REF HelpToken,
677 IN IFR_OPTION *OptionsList,
678 IN UINTN OptionCount,
679 IN OUT VOID *FormBuffer
680 )
681 /*++
682
683 Routine Description:
684
685 Create a one-of opcode with a set of option op-codes to choose from independent of string creation.
686 This is used primarily by users who need to create just one particular valid op-code and the string
687 data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
688 location to pre-defined forms in HII)
689
690 OptionsList is a pointer to a null-terminated list of option descriptions. Ensure that OptionsList[x].StringToken
691 has been filled in since this routine will not generate StringToken values.
692
693 Arguments:
694
695 QuestionId - Question ID of the one-of box
696
697 DataWidth - DataWidth of the one-of box
698
699 PromptToken - Prompt string token of the one-of box
700
701 HelpToken - Help string token of the one-of box
702
703 OptionsList - Each string in it is an option of the one-of box
704
705 OptionCount - Option string count
706
707 FormBuffer - Output of One-Of box as a form
708
709 Returns:
710
711 EFI_SUCCESS - One-Of box created to be a form
712
713 EFI_DEVICE_ERROR - DataWidth > 2
714
715 --*/
716 ;
717
718 EFI_STATUS
719 CreateOrderedListOpCode (
720 IN UINT16 QuestionId,
721 IN UINT8 MaxEntries,
722 IN STRING_REF PromptToken,
723 IN STRING_REF HelpToken,
724 IN IFR_OPTION *OptionsList,
725 IN UINTN OptionCount,
726 IN OUT VOID *FormBuffer
727 )
728 /*++
729
730 Routine Description:
731
732 Create a ordered list opcode with a set of option op-codes to choose from independent of string creation.
733 This is used primarily by users who need to create just one particular valid op-code and the string
734 data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
735 location to pre-defined forms in HII)
736
737 OptionsList is a pointer to a null-terminated list of option descriptions. Ensure that OptionsList[x].StringToken
738 has been filled in since this routine will not generate StringToken values.
739
740 Arguments:
741
742 QuestionId - Question ID of the ordered list
743
744 MaxEntries - MaxEntries of the ordered list
745
746 PromptToken - Prompt string token of the ordered list
747
748 HelpToken - Help string token of the ordered list
749
750 OptionsList - Each string in it is an option of the ordered list
751
752 OptionCount - Option string count
753
754 FormBuffer - Output of ordered list as a form
755
756 Returns:
757
758 EFI_SUCCESS - Ordered list created to be a form
759
760 --*/
761 ;
762
763 EFI_STATUS
764 CreateCheckBoxOpCode (
765 IN UINT16 QuestionId,
766 IN UINT8 DataWidth,
767 IN STRING_REF PromptToken,
768 IN STRING_REF HelpToken,
769 IN UINT8 Flags,
770 IN UINT16 Key,
771 IN OUT VOID *FormBuffer
772 )
773 /*++
774
775 Routine Description:
776
777 Create a checkbox opcode independent of string creation
778 This is used primarily by users who need to create just one particular valid op-code and the string
779 data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
780 location to pre-defined forms in HII)
781
782 Arguments:
783
784 QuestionId - Question ID of the check box
785
786 DataWidth - DataWidth of the check box
787
788 PromptToken - Prompt string token of the check box
789
790 HelpToken - Help string token of the check box
791
792 Flags - Flags of the check box
793
794 Key - Key of the check box
795
796 FormBuffer - Output of the check box as a form
797
798 Returns:
799
800 EFI_SUCCESS - Checkbox created to be a form
801
802 EFI_DEVICE_ERROR - DataWidth > 1
803
804 --*/
805 ;
806
807 EFI_STATUS
808 CreateNumericOpCode (
809 IN UINT16 QuestionId,
810 IN UINT8 DataWidth,
811 IN STRING_REF PromptToken,
812 IN STRING_REF HelpToken,
813 IN UINT16 Minimum,
814 IN UINT16 Maximum,
815 IN UINT16 Step,
816 IN UINT16 Default,
817 IN UINT8 Flags,
818 IN UINT16 Key,
819 IN OUT VOID *FormBuffer
820 )
821 /*++
822
823 Routine Description:
824
825 Create a numeric opcode independent of string creation
826 This is used primarily by users who need to create just one particular valid op-code and the string
827 data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
828 location to pre-defined forms in HII)
829
830 Arguments:
831
832 QuestionId - Question ID of the numeric
833
834 DataWidth - DataWidth of the numeric
835
836 PromptToken - Prompt string token of the numeric
837
838 HelpToken - Help string token of the numeric
839
840 Minimum - Minumun boundary of the numeric
841
842 Maximum - Maximum boundary of the numeric
843
844 Step - Step of the numeric
845
846 Default - Default value of the numeric
847
848 Flags - Flags of the numeric
849
850 Key - Key of the numeric
851
852 FormBuffer - Output of the numeric as a form
853
854 Returns:
855
856 EFI_SUCCESS - The numeric created to be a form.
857
858 EFI_DEVICE_ERROR - DataWidth > 2
859
860 --*/
861 ;
862
863 EFI_STATUS
864 CreateStringOpCode (
865 IN UINT16 QuestionId,
866 IN UINT8 DataWidth,
867 IN STRING_REF PromptToken,
868 IN STRING_REF HelpToken,
869 IN UINT8 MinSize,
870 IN UINT8 MaxSize,
871 IN UINT8 Flags,
872 IN UINT16 Key,
873 IN OUT VOID *FormBuffer
874 )
875 /*++
876
877 Routine Description:
878
879 Create a numeric opcode independent of string creation
880 This is used primarily by users who need to create just one particular valid op-code and the string
881 data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
882 location to pre-defined forms in HII)
883
884 Arguments:
885
886 QuestionId - Question ID of the string
887
888 DataWidth - DataWidth of the string
889
890 PromptToken - Prompt token of the string
891
892 HelpToken - Help token of the string
893
894 MinSize - Min size boundary of the string
895
896 MaxSize - Max size boundary of the string
897
898 Flags - Flags of the string
899
900 Key - Key of the string
901
902 FormBuffer - Output of the string as a form
903
904 Returns:
905
906 EFI_SUCCESS - String created to be a form.
907
908 --*/
909 ;
910
911 EFI_STATUS
912 ValidateDataFromHiiHandle (
913 IN EFI_HII_HANDLE HiiHandle,
914 OUT BOOLEAN *Results
915 )
916 /*++
917
918 Routine Description:
919
920 Validate that the data associated with the HiiHandle in NVRAM is within
921 the reasonable parameters for that FormSet. Values for strings and passwords
922 are not verified due to their not having the equivalent of valid range settings.
923
924 Arguments:
925
926 HiiHandle - Handle of the HII database entry to query
927
928 Results - If return Status is EFI_SUCCESS, Results provides valid data
929 TRUE = NVRAM Data is within parameters
930 FALSE = NVRAM Data is NOT within parameters
931
932 Returns:
933
934 EFI_OUT_OF_RESOURCES - No enough buffer to allocate
935
936 EFI_SUCCESS - Data successfully validated
937 --*/
938 ;
939
940 EFI_STATUS
941 CreateBannerOpCode (
942 IN UINT16 Title,
943 IN UINT16 LineNumber,
944 IN UINT8 Alignment,
945 IN OUT VOID *FormBuffer
946 )
947 /*++
948
949 Routine Description:
950
951 Create a banner opcode. This is primarily used by the FrontPage implementation from BDS.
952
953 Arguments:
954
955 Title - Title of the banner
956
957 LineNumber - LineNumber of the banner
958
959 Alignment - Alignment of the banner
960
961 FormBuffer - Output of banner as a form
962
963 Returns:
964
965 EFI_SUCCESS - Banner created to be a form.
966
967 --*/
968 ;
969
970 VOID
971 EfiLibHiiVariablePackGetMap (
972 IN EFI_HII_VARIABLE_PACK *Pack,
973 OUT CHAR16 **Name, OPTIONAL
974 OUT EFI_GUID **Guid, OPTIONAL
975 OUT UINT16 *Id, OPTIONAL
976 OUT VOID **Var, OPTIONAL
977 OUT UINTN *Size OPTIONAL
978 )
979 /*++
980
981 Routine Description:
982
983 Extracts a variable form a Pack.
984
985 Arguments:
986
987 Pack - List of variables
988 Name - Name of the variable/map
989 Guid - GUID of the variable/map
990 Var - Pointer to the variable/map
991 Size - Size of the variable/map in bytes
992
993 Returns:
994
995 VOID.
996
997 --*/
998 ;
999
1000 UINTN
1001 EfiLibHiiVariablePackListGetMapCnt (
1002 IN EFI_HII_VARIABLE_PACK_LIST *List
1003 )
1004 /*++
1005
1006 Routine Description:
1007
1008 Finds a count of the variables/maps in the List.
1009
1010 Arguments:
1011
1012 List - List of variables
1013
1014 Returns:
1015
1016 Number of Map in the variable pack list.
1017
1018 --*/
1019 ;
1020
1021 typedef VOID (EFI_LIB_HII_VARIABLE_PACK_LIST_CALLBACK) (
1022 IN CHAR16 *Name,
1023 IN EFI_GUID *Guid,
1024 IN UINT16 Id,
1025 IN VOID *Var,
1026 IN UINTN Size
1027 )
1028 /*++
1029
1030 Routine Description:
1031
1032 type definition for the callback to be
1033 used with EfiLibHiiVariablePackListForEachVar().
1034
1035 Arguments:
1036
1037 Id - Variable/Map ID
1038 Name - Name of the variable/map
1039 Guid - GUID of the variable/map
1040 Var - Pointer to the variable/map
1041 Size - Size of the variable/map in bytes
1042
1043 Returns:
1044
1045 VOID
1046
1047 --*/
1048 ;
1049
1050 VOID
1051 EfiLibHiiVariablePackListForEachVar (
1052 IN EFI_HII_VARIABLE_PACK_LIST *List,
1053 IN EFI_LIB_HII_VARIABLE_PACK_LIST_CALLBACK *Callback
1054 )
1055 /*++
1056
1057 Routine Description:
1058
1059 Will iterate all variable/maps as appearing
1060 in List and for each, it will call the Callback.
1061
1062 Arguments:
1063
1064 List - List of variables
1065 Callback - Routine to be called for each iterated variable.
1066
1067 Returns:
1068
1069 VOID
1070
1071 --*/
1072 ;
1073
1074 EFI_STATUS
1075 EfiLibHiiVariablePackListGetMapByIdx (
1076 IN UINTN Idx,
1077 IN EFI_HII_VARIABLE_PACK_LIST *List,
1078 OUT CHAR16 **Name, OPTIONAL
1079 OUT EFI_GUID **Guid, OPTIONAL
1080 OUT UINT16 *Id, OPTIONAL
1081 OUT VOID **Var,
1082 OUT UINTN *Size
1083 )
1084 /*++
1085
1086 Routine Description:
1087
1088 Finds a variable form List given
1089 the order number as appears in the List.
1090
1091 Arguments:
1092
1093 Idx - The index of the variable/map to retrieve
1094 List - List of variables
1095 Name - Name of the variable/map
1096 Guid - GUID of the variable/map
1097 Var - Pointer to the variable/map
1098 Size - Size of the variable/map in bytes
1099
1100 Returns:
1101
1102 EFI_SUCCESS - Variable is found, OUT parameters are valid
1103 EFI_NOT_FOUND - Variable is not found, OUT parameters are not valid
1104
1105 --*/
1106 ;
1107
1108 EFI_STATUS
1109 EfiLibHiiVariablePackListGetMapById (
1110 IN UINT16 Id,
1111 IN EFI_HII_VARIABLE_PACK_LIST *List,
1112 OUT CHAR16 **Name, OPTIONAL
1113 OUT EFI_GUID **Guid, OPTIONAL
1114 OUT VOID **Var,
1115 OUT UINTN *Size
1116 )
1117 /*++
1118
1119 Routine Description:
1120
1121 Finds a variable form List given the
1122 order number as appears in the List.
1123
1124 Arguments:
1125
1126 Id - The ID of the variable/map to retrieve
1127 List - List of variables
1128 Name - Name of the variable/map
1129 Guid - GUID of the variable/map
1130 Var - Pointer to the variable/map
1131 Size - Size of the variable/map in bytes
1132
1133 Returns:
1134
1135 EFI_SUCCESS - Variable is found, OUT parameters are valid
1136 EFI_NOT_FOUND - Variable is not found, OUT parameters are not valid
1137
1138 --*/
1139 ;
1140
1141 EFI_STATUS
1142 EfiLibHiiVariablePackListGetMap (
1143 IN EFI_HII_VARIABLE_PACK_LIST *List,
1144 IN CHAR16 *Name,
1145 IN EFI_GUID *Guid,
1146 OUT UINT16 *Id,
1147 OUT VOID **Var,
1148 OUT UINTN *Size
1149 )
1150 /*++
1151
1152 Routine Description:
1153
1154 Finds a variable form EFI_HII_VARIABLE_PACK_LIST given name and GUID.
1155
1156 Arguments:
1157
1158 List - List of variables
1159 Name - Name of the variable/map to be found
1160 Guid - GUID of the variable/map to be found
1161 Var - Pointer to the variable/map found
1162 Size - Size of the variable/map in bytes found
1163
1164 Returns:
1165
1166 EFI_SUCCESS - variable is found, OUT parameters are valid
1167 EFI_NOT_FOUND - variable is not found, OUT parameters are not valid
1168
1169 --*/
1170 ;
1171
1172 EFI_STATUS
1173 EfiLibHiiVariableRetrieveFromNv (
1174 IN CHAR16 *Name,
1175 IN EFI_GUID *Guid,
1176 IN UINTN Size,
1177 OUT VOID **Var
1178 )
1179 /*++
1180
1181 Routine Description:
1182 Finds out if a variable of specific Name/Guid/Size exists in NV.
1183 If it does, it will retrieve it into the Var.
1184
1185 Arguments:
1186 Name, Guid, Size - Parameters of the variable to retrieve. Must match exactly.
1187 Var - Variable will be retrieved into buffer pointed by this pointer.
1188 If pointing to NULL, the buffer will be allocated. Caller is responsible for releasing the buffer.
1189 Returns:
1190 EFI_SUCCESS - The variable of exact Name/Guid/Size parameters was retrieved and written to Var.
1191 EFI_NOT_FOUND - The variable of this Name/Guid was not found in the NV.
1192 EFI_LOAD_ERROR - The variable in the NV was of different size, or NV API returned error.
1193
1194 --*/
1195 ;
1196
1197 ////
1198 //// Variable override support.
1199 ////
1200
1201 EFI_STATUS
1202 EfiLibHiiVariableOverrideIfSuffix (
1203 IN CHAR16 *Suffix,
1204 IN CHAR16 *Name,
1205 IN EFI_GUID *Guid,
1206 IN UINTN Size,
1207 OUT VOID *Var
1208 )
1209 /*++
1210
1211 Routine Description:
1212 Overrrides the variable with NV data if found.
1213 But it only does it if the Name ends with specified Suffix.
1214 For example, if Suffix="MyOverride" and the Name="XyzSetupMyOverride",
1215 the Suffix matches the end of Name, so the variable will be loaded from NV
1216 provided the variable exists and the GUID and Size matches.
1217
1218 Arguments:
1219 Suffix - Suffix the Name should end with.
1220 Name, Guid, Size - Parameters of the variable to retrieve. Must match exactly.
1221 Var - Variable will be retrieved into this buffer.
1222 Caller is responsible for providing storage of exactly Size size in bytes.
1223 Returns:
1224 EFI_SUCCESS - The variable was overriden with NV variable of same Name/Guid/Size.
1225 EFI_INVALID_PARAMETER - The name of the variable does not end with <Suffix>.
1226 EFI_NOT_FOUND - The variable of this Name/Guid was not found in the NV.
1227 EFI_LOAD_ERROR - The variable in the NV was of different size, or NV API returned error.
1228
1229 --*/
1230 ;
1231
1232 EFI_STATUS
1233 EfiLibHiiVariableOverrideBySuffix (
1234 IN CHAR16 *Suffix,
1235 IN CHAR16 *Name,
1236 IN EFI_GUID *Guid,
1237 IN UINTN Size,
1238 OUT VOID *Var
1239 )
1240 /*++
1241
1242 Routine Description:
1243 Overrrides the variable with NV data if found.
1244 But it only does it if the NV contains the same variable with Name is appended with Suffix.
1245 For example, if Suffix="MyOverride" and the Name="XyzSetup",
1246 the Suffix will be appended to the end of Name, and the variable with Name="XyzSetupMyOverride"
1247 will be loaded from NV provided the variable exists and the GUID and Size matches.
1248
1249 Arguments:
1250 Suffix - Suffix the variable will be appended with.
1251 Name, Guid, Size - Parameters of the variable to retrieve. Must match exactly.
1252 Var - Variable will be retrieved into this buffer.
1253 Caller is responsible for providing storage of exactly Size size in bytes.
1254
1255 Returns:
1256 EFI_SUCCESS - The variable was overriden with NV variable of same Name/Guid/Size.
1257 EFI_NOT_FOUND - The variable of this Name/Guid was not found in the NV.
1258 EFI_LOAD_ERROR - The variable in the NV was of different size, or NV API returned error.
1259
1260 --*/
1261 ;
1262
1263 #endif