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