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