]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkPkg/Include/Library/FrameworkIfrSupportLib.h
6eab8f61bfc5e454abff1252a6d73dffdd20dfd7
[mirror_edk2.git] / IntelFrameworkPkg / Include / Library / FrameworkIfrSupportLib.h
1 /** @file
2 Library class name: FrameworkIfrSupportLib
3
4 FrameworkIfrSupportLib is designed for produce IFR operation interface .
5 The IFR format follows framework specification.
6
7 Copyright (c) 2006, Intel Corporation
8 All rights reserved. This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
12
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15
16 **/
17
18 #ifndef _IFRSUPPORTLIBRARY_H_
19 #define _IFRSUPPORTLIBRARY_H_
20
21 #define DEFAULT_FORM_BUFFER_SIZE 0xFFFF
22 #define DEFAULT_STRING_BUFFER_SIZE 0xFFFF
23
24 #pragma pack(1)
25 typedef struct {
26 CHAR16 *OptionString; // Passed in string to generate a token for in a truly dynamic form creation
27 STRING_REF StringToken; // This is used when creating a single op-code without generating a StringToken (have one already)
28 UINT16 Value;
29 UINT8 Flags;
30 UINT16 Key;
31 } IFR_OPTION;
32 #pragma pack()
33
34 /**
35 Determine what is the current language setting.
36
37 The setting is stored in language variable in flash. This routine
38 will get setting by accesssing that variable. If failed to access
39 language variable, then use default setting that 'eng' as current
40 language setting.
41
42 @param Lang Pointer of system language
43
44 @return whether success to get setting from variable
45 **/
46 EFI_STATUS
47 EFIAPI
48 GetCurrentLanguage (
49 OUT CHAR16 *Lang
50 );
51
52 /**
53 Add a string to the incoming buffer and return the token and offset data.
54
55 @param StringBuffer The incoming buffer
56 @param Language Currrent language
57 @param String The string to be added
58 @param StringToken The index where the string placed
59
60 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
61 @retval EFI_SUCCESS String successfully added to the incoming buffer
62 **/
63 EFI_STATUS
64 EFIAPI
65 AddString (
66 IN VOID *StringBuffer,
67 IN CHAR16 *Language,
68 IN CHAR16 *String,
69 IN OUT STRING_REF *StringToken
70 );
71
72 /**
73 Add op-code data to the FormBuffer.
74
75 @param FormBuffer Form buffer to be inserted to
76 @param OpCodeData Op-code data to be inserted
77
78 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
79 @retval EFI_SUCCESS Op-code data successfully inserted
80 **/
81 EFI_STATUS
82 EFIAPI
83 AddOpCode (
84 IN VOID *FormBuffer,
85 IN OUT VOID *OpCodeData
86 );
87
88 /**
89 Create a formset
90
91 The form package is a collection of forms that are intended to describe the pages that will be
92 displayed to the user.
93
94 @param FormSetTitle Title of formset
95 @param Guid Guid of formset
96 @param Class Class of formset
97 @param SubClass Sub class of formset
98 @param FormBuffer Pointer of the formset created
99 @param StringBuffer Pointer of FormSetTitile string created
100
101 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
102 @retval EFI_SUCCESS Formset successfully created
103 **/
104 EFI_STATUS
105 EFIAPI
106 CreateFormSet (
107 IN CHAR16 *FormSetTitle,
108 IN EFI_GUID *Guid,
109 IN UINT8 Class,
110 IN UINT8 SubClass,
111 IN OUT VOID **FormBuffer,
112 IN OUT VOID **StringBuffer
113 );
114
115 /**
116 Create a form.
117 A form is the encapsulation of what amounts to a browser page. The header defines a FormId,
118 which is referenced by the form package, among others. It also defines a FormTitle, which is a
119 string to be used as the title for the form
120
121 @param FormTitle Title of the form
122 @param FormId Id of the form
123 @param FormBuffer Pointer of the form created
124 @param StringBuffer Pointer of FormTitil string created
125
126 @retval EFI_SUCCESS Form successfully created
127 **/
128 EFI_STATUS
129 EFIAPI
130 CreateForm (
131 IN CHAR16 *FormTitle,
132 IN UINT16 FormId,
133 IN OUT VOID *FormBuffer,
134 IN OUT VOID *StringBuffer
135 );
136
137 /**
138 Create a SubTitle
139
140 Subtitle strings are intended to be used by authors to separate sections of questions into semantic
141 groups.
142
143 @param SubTitle Sub title to be created
144 @param FormBuffer Where this subtitle to add to
145 @param StringBuffer String buffer created for subtitle
146
147 @retval EFI_SUCCESS Subtitle successfully created
148 **/
149 EFI_STATUS
150 EFIAPI
151 CreateSubTitle (
152 IN CHAR16 *SubTitle,
153 IN OUT VOID *FormBuffer,
154 IN OUT VOID *StringBuffer
155 );
156
157 /**
158 Create a line of text
159 Unlike HTML, text is simply another tag.
160 This tag type enables IFR to be more easily localized.
161
162 @param String First string of the text
163 @param String2 Second string of the text
164 @param String3 Help string of the text
165 @param Flags Flag of the text
166 @param Key Key of the text
167 @param FormBuffer The form where this text adds to
168 @param StringBuffer String buffer created for String, String2 and String3
169
170 @retval EFI_SUCCESS Text successfully created
171 **/
172 EFI_STATUS
173 EFIAPI
174 CreateText (
175 IN CHAR16 *String,
176 IN CHAR16 *String2,
177 IN CHAR16 *String3,
178 IN UINT8 Flags,
179 IN UINT16 Key,
180 IN OUT VOID *FormBuffer,
181 IN OUT VOID *StringBuffer
182 );
183
184 /**
185 Create a hyperlink.
186
187 @param FormId Form ID of the hyperlink
188 @param Prompt Prompt of the hyperlink
189 @param FormBuffer The form where this hyperlink adds to
190 @param StringBuffer String buffer created for Prompt
191
192 @retval EFI_SUCCESS Hyperlink successfully created
193 **/
194 EFI_STATUS
195 EFIAPI
196 CreateGoto (
197 IN UINT16 FormId,
198 IN CHAR16 *Prompt,
199 IN OUT VOID *FormBuffer,
200 IN OUT VOID *StringBuffer
201 );
202
203 /**
204 Create a one-of question with a set of options to choose from. The
205 OptionsList is a pointer to a null-terminated list of option descriptions.
206
207 @param QuestionId Question ID of the one-of box
208 @param DataWidth DataWidth of the one-of box
209 @param Prompt Prompt of the one-of box
210 @param Help Help of the one-of box
211 @param OptionsList Each string in it is an option of the one-of box
212 @param OptionCount Option string count
213 @param FormBuffer The form where this one-of box adds to
214 @param StringBuffer String buffer created for Prompt, Help and Option strings
215
216 @retval EFI_DEVICE_ERROR DataWidth > 2
217 @retval EFI_SUCCESS One-Of box successfully created.
218 **/
219 EFI_STATUS
220 EFIAPI
221 CreateOneOf (
222 IN UINT16 QuestionId,
223 IN UINT8 DataWidth,
224 IN CHAR16 *Prompt,
225 IN CHAR16 *Help,
226 IN IFR_OPTION *OptionsList,
227 IN UINTN OptionCount,
228 IN OUT VOID *FormBuffer,
229 IN OUT VOID *StringBuffer
230 );
231
232 /**
233 Create a one-of question with a set of options to choose from. The
234 OptionsList is a pointer to a null-terminated list of option descriptions.
235
236 @param QuestionId Question ID of the ordered list
237 @param MaxEntries MaxEntries of the ordered list
238 @param Prompt Prompt of the ordered list
239 @param Help Help of the ordered list
240 @param OptionsList Each string in it is an option of the ordered list
241 @param OptionCount Option string count
242 @param FormBuffer The form where this ordered list adds to
243 @param StringBuffer String buffer created for Prompt, Help and Option strings
244
245 @retval EFI_SUCCESS Ordered list successfully created.
246 **/
247 EFI_STATUS
248 EFIAPI
249 CreateOrderedList (
250 IN UINT16 QuestionId,
251 IN UINT8 MaxEntries,
252 IN CHAR16 *Prompt,
253 IN CHAR16 *Help,
254 IN IFR_OPTION *OptionsList,
255 IN UINTN OptionCount,
256 IN OUT VOID *FormBuffer,
257 IN OUT VOID *StringBuffer
258 );
259
260 /**
261 Create a checkbox
262
263 @param QuestionId Question ID of the check box
264 @param DataWidth DataWidth of the check box
265 @param Prompt Prompt of the check box
266 @param Help Help of the check box
267 @param Flags Flags of the check box
268 @param FormBuffer The form where this check box adds to
269 @param StringBuffer String buffer created for Prompt and Help.
270
271 @retval EFI_DEVICE_ERROR DataWidth > 1
272 @retval EFI_SUCCESS Check box successfully created
273 **/
274 EFI_STATUS
275 EFIAPI
276 CreateCheckBox (
277 IN UINT16 QuestionId,
278 IN UINT8 DataWidth,
279 IN CHAR16 *Prompt,
280 IN CHAR16 *Help,
281 IN UINT8 Flags,
282 IN OUT VOID *FormBuffer,
283 IN OUT VOID *StringBuffer
284 );
285
286 /**
287 Create a numeric
288
289 @param QuestionId Question ID of the numeric
290 @param DataWidth DataWidth of the numeric
291 @param Prompt Prompt of the numeric
292 @param Help Help of the numeric
293 @param Minimum Minumun boundary of the numeric
294 @param Maximum Maximum boundary of the numeric
295 @param Step Step of the numeric
296 @param Default Default value
297 @param Flags Flags of the numeric
298 @param Key Key of the numeric
299 @param FormBuffer The form where this numeric adds to
300 @param StringBuffer String buffer created for Prompt and Help.
301
302 @retval EFI_DEVICE_ERROR DataWidth > 2
303 @retval EFI_SUCCESS Numeric is successfully created
304 **/
305 EFI_STATUS
306 EFIAPI
307 CreateNumeric (
308 IN UINT16 QuestionId,
309 IN UINT8 DataWidth,
310 IN CHAR16 *Prompt,
311 IN CHAR16 *Help,
312 IN UINT16 Minimum,
313 IN UINT16 Maximum,
314 IN UINT16 Step,
315 IN UINT16 Default,
316 IN UINT8 Flags,
317 IN UINT16 Key,
318 IN OUT VOID *FormBuffer,
319 IN OUT VOID *StringBuffer
320 );
321
322 /**
323 Create a string.
324
325 @param QuestionId Question ID of the string
326 @param DataWidth DataWidth of the string
327 @param Prompt Prompt of the string
328 @param Help Help of the string
329 @param MinSize Min size boundary of the string
330 @param MaxSize Max size boundary of the string
331 @param Flags Flags of the string
332 @param Key Key of the string
333 @param FormBuffer The form where this string adds to
334 @param StringBuffer String buffer created for Prompt and Help.
335 @retval EFI_SUCCESS String successfully created.
336 **/
337 EFI_STATUS
338 EFIAPI
339 CreateString (
340 IN UINT16 QuestionId,
341 IN UINT8 DataWidth,
342 IN CHAR16 *Prompt,
343 IN CHAR16 *Help,
344 IN UINT8 MinSize,
345 IN UINT8 MaxSize,
346 IN UINT8 Flags,
347 IN UINT16 Key,
348 IN OUT VOID *FormBuffer,
349 IN OUT VOID *StringBuffer
350 );
351
352 /**
353 Extract information pertaining to the HiiHandle.
354
355 @param HiiHandle Hii handle
356 @param ImageLength For input, length of DefaultImage;
357 For output, length of actually required
358 @param DefaultImage Image buffer prepared by caller
359 @param Guid Guid information about the form
360
361 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
362 @retval EFI_BUFFER_TOO_SMALL DefualtImage has no enough ImageLength
363 @retval EFI_SUCCESS Successfully extract data from Hii database.
364 **/
365 EFI_STATUS
366 EFIAPI
367 ExtractDataFromHiiHandle (
368 IN FRAMEWORK_EFI_HII_HANDLE HiiHandle,
369 IN OUT UINT16 *ImageLength,
370 OUT UINT8 *DefaultImage,
371 OUT EFI_GUID *Guid
372 );
373
374 /**
375 Finds HII handle for given pack GUID previously registered with the HII.
376
377 @param HiiProtocol pointer to pointer to HII protocol interface.
378 If NULL, the interface will be found but not returned.
379 If it points to NULL, the interface will be found and
380 written back to the pointer that is pointed to.
381 @param Guid The GUID of the pack that registered with the HII.
382
383 @return Handle to the HII pack previously registered by the memory driver.
384 **/
385 FRAMEWORK_EFI_HII_HANDLE
386 EFIAPI
387 FindHiiHandle (
388 IN OUT EFI_HII_PROTOCOL **HiiProtocol, OPTIONAL
389 IN EFI_GUID *Guid
390 );
391
392 /**
393 Create a SubTitle opcode independent of string creation
394 This is used primarily by users who need to create just one particular valid op-code and the string
395 data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
396 location to pre-defined forms in HII)
397
398 @param StringToken StringToken of the subtitle
399 @param FormBuffer Output of subtitle as a form
400
401 @retval EFI_SUCCESS Subtitle created to be a form
402 **/
403 EFI_STATUS
404 EFIAPI
405 CreateSubTitleOpCode (
406 IN STRING_REF StringToken,
407 IN OUT VOID *FormBuffer
408 );
409
410 /**
411 Create a Text opcode independent of string creation.
412
413 This is used primarily by users who need to create just one particular valid op-code and the string
414 data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
415 location to pre-defined forms in HII)
416
417 @param StringToken First string token of the text
418 @param StringTokenTwo Second string token of the text
419 @param StringTokenThree Help string token of the text
420 @param Flags Flag of the text
421 @param Key Key of the text
422 @param FormBuffer Output of text as a form
423
424 @retval EFI_SUCCESS Text created to be a form
425 **/
426 EFI_STATUS
427 EFIAPI
428 CreateTextOpCode (
429 IN STRING_REF StringToken,
430 IN STRING_REF StringTokenTwo,
431 IN STRING_REF StringTokenThree,
432 IN UINT8 Flags,
433 IN UINT16 Key,
434 IN OUT VOID *FormBuffer
435 );
436
437 /**
438 Create a hyperlink opcode independent of string creation.
439
440 This is used primarily by users who need to create just one particular valid op-code and the string
441 data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
442 location to pre-defined forms in HII)
443
444
445 @param FormId Form ID of the hyperlink
446 @param StringToken Prompt string token of the hyperlink
447 @param StringTokenTwo Help string token of the hyperlink
448 @param Flags Flags of the hyperlink
449 @param Key Key of the hyperlink
450 @param FormBuffer Output of hyperlink as a form
451 @retval EFI_SUCCESS Hyperlink created to be a form
452 **/
453 EFI_STATUS
454 EFIAPI
455 CreateGotoOpCode (
456 IN UINT16 FormId,
457 IN STRING_REF StringToken,
458 IN STRING_REF StringTokenTwo,
459 IN UINT8 Flags,
460 IN UINT16 Key,
461 IN OUT VOID *FormBuffer
462 );
463
464 /**
465 Create a one-of opcode with a set of option op-codes to choose from independent of string creation.
466 This is used primarily by users who need to create just one particular valid op-code and the string
467 data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
468 location to pre-defined forms in HII)
469
470 OptionsList is a pointer to a null-terminated list of option descriptions. Ensure that OptionsList[x].StringToken
471 has been filled in since this routine will not generate StringToken values.
472
473 @param QuestionId Question ID of the one-of box
474 @param DataWidth DataWidth of the one-of box
475 @param PromptToken Prompt string token of the one-of box
476 @param HelpToken Help string token of the one-of box
477 @param OptionsList Each string in it is an option of the one-of box
478 @param OptionCount Option string count
479 @param FormBuffer Output of One-Of box as a form
480
481
482 @retval EFI_SUCCESS One-Of box created to be a form
483 @retval EFI_DEVICE_ERROR DataWidth > 2
484 **/
485 EFI_STATUS
486 EFIAPI
487 CreateOneOfOpCode (
488 IN UINT16 QuestionId,
489 IN UINT8 DataWidth,
490 IN STRING_REF PromptToken,
491 IN STRING_REF HelpToken,
492 IN IFR_OPTION *OptionsList,
493 IN UINTN OptionCount,
494 IN OUT VOID *FormBuffer
495 );
496
497 /**
498 Create a ordered list opcode with a set of option op-codes to choose from independent of string creation.
499 This is used primarily by users who need to create just one particular valid op-code and the string
500 data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
501 location to pre-defined forms in HII)
502
503 OptionsList is a pointer to a null-terminated list of option descriptions. Ensure that OptionsList[x].StringToken
504 has been filled in since this routine will not generate StringToken values.
505
506 @param QuestionId Question ID of the ordered list
507 @param MaxEntries MaxEntries of the ordered list
508 @param PromptToken Prompt string token of the ordered list
509 @param HelpToken Help string token of the ordered list
510 @param OptionsList Each string in it is an option of the ordered list
511 @param OptionCount Option string count
512 @param FormBuffer Output of ordered list as a form
513
514 @retval EFI_SUCCESS Ordered list created to be a form
515 **/
516 EFI_STATUS
517 EFIAPI
518 CreateOrderedListOpCode (
519 IN UINT16 QuestionId,
520 IN UINT8 MaxEntries,
521 IN STRING_REF PromptToken,
522 IN STRING_REF HelpToken,
523 IN IFR_OPTION *OptionsList,
524 IN UINTN OptionCount,
525 IN OUT VOID *FormBuffer
526 );
527
528 /**
529 Create a checkbox opcode independent of string creation
530 This is used primarily by users who need to create just one particular valid op-code and the string
531 data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
532 location to pre-defined forms in HII)
533
534 @param QuestionId Question ID of the check box
535 @param DataWidth DataWidth of the check box
536 @param PromptToken Prompt string token of the check box
537 @param HelpToken Help string token of the check box
538 @param Flags Flags of the check box
539 @param Key Key of the check box
540 @param FormBuffer Output of the check box as a form
541
542 @retval EFI_SUCCESS Checkbox created to be a form
543 @retval EFI_DEVICE_ERROR DataWidth > 1
544 **/
545 EFI_STATUS
546 EFIAPI
547 CreateCheckBoxOpCode (
548 IN UINT16 QuestionId,
549 IN UINT8 DataWidth,
550 IN STRING_REF PromptToken,
551 IN STRING_REF HelpToken,
552 IN UINT8 Flags,
553 IN UINT16 Key,
554 IN OUT VOID *FormBuffer
555 );
556
557 /**
558 Create a numeric opcode independent of string creation.
559 This is used primarily by users who need to create just one particular valid op-code and the string
560 data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
561 location to pre-defined forms in HII)
562
563 @param QuestionId Question ID of the numeric
564 @param DataWidth DataWidth of the numeric
565 @param PromptToken Prompt string token of the numeric
566 @param HelpToken Help string token of the numeric
567 @param Minimum Minumun boundary of the numeric
568 @param Maximum Maximum boundary of the numeric
569 @param Step Step of the numeric
570 @param Default Default value of the numeric
571 @param Flags Flags of the numeric
572 @param Key Key of the numeric
573 @param FormBuffer Output of the numeric as a form
574
575
576 @retval EFI_SUCCESS The numeric created to be a form.
577 @retval EFI_DEVICE_ERROR DataWidth > 2
578 **/
579 EFI_STATUS
580 EFIAPI
581 CreateNumericOpCode (
582 IN UINT16 QuestionId,
583 IN UINT8 DataWidth,
584 IN STRING_REF PromptToken,
585 IN STRING_REF HelpToken,
586 IN UINT16 Minimum,
587 IN UINT16 Maximum,
588 IN UINT16 Step,
589 IN UINT16 Default,
590 IN UINT8 Flags,
591 IN UINT16 Key,
592 IN OUT VOID *FormBuffer
593 );
594
595 /**
596 Create a numeric opcode independent of string creation
597 This is used primarily by users who need to create just one particular valid op-code and the string
598 data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
599 location to pre-defined forms in HII)
600
601 @param QuestionId Question ID of the string
602 @param DataWidth DataWidth of the string
603 @param PromptToken Prompt token of the string
604 @param HelpToken Help token of the string
605 @param MinSize Min size boundary of the string
606 @param MaxSize Max size boundary of the string
607 @param Flags Flags of the string
608 @param Key Key of the string
609 @param FormBuffer Output of the string as a form
610
611 @retval EFI_SUCCESS String created to be a form.
612 **/
613 EFI_STATUS
614 EFIAPI
615 CreateStringOpCode (
616 IN UINT16 QuestionId,
617 IN UINT8 DataWidth,
618 IN STRING_REF PromptToken,
619 IN STRING_REF HelpToken,
620 IN UINT8 MinSize,
621 IN UINT8 MaxSize,
622 IN UINT8 Flags,
623 IN UINT16 Key,
624 IN OUT VOID *FormBuffer
625 );
626
627 /**
628 Validate that the data associated with the HiiHandle in NVRAM is within
629 the reasonable parameters for that FormSet. Values for strings and passwords
630 are not verified due to their not having the equivalent of valid range settings.
631
632 @param HiiHandle Handle of the HII database entry to query
633
634 @param Results If return Status is EFI_SUCCESS, Results provides valid data
635 TRUE = NVRAM Data is within parameters
636 FALSE = NVRAM Data is NOT within parameters
637 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
638 @retval EFI_SUCCESS Data successfully validated
639 **/
640 EFI_STATUS
641 EFIAPI
642 ValidateDataFromHiiHandle (
643 IN FRAMEWORK_EFI_HII_HANDLE HiiHandle,
644 OUT BOOLEAN *Results
645 );
646
647 /**
648 Create a banner opcode. This is primarily used by the FrontPage implementation from BDS.
649
650 @param Title Title of the banner
651 @param LineNumber LineNumber of the banner
652 @param Alignment Alignment of the banner
653 @param FormBuffer Output of banner as a form
654
655 @retval EFI_SUCCESS Banner created to be a form.
656 **/
657 EFI_STATUS
658 EFIAPI
659 CreateBannerOpCode (
660 IN UINT16 Title,
661 IN UINT16 LineNumber,
662 IN UINT8 Alignment,
663 IN OUT VOID *FormBuffer
664 );
665
666 /**
667 Extracts a variable form a Pack.
668
669 @param Pack List of variables
670 @param Name Name of the variable/map
671 @param Guid GUID of the variable/map
672 @param Id The index of the variable/map to retrieve
673 @param Var Pointer to the variable/map
674 @param Size Size of the variable/map in bytes
675 **/
676 VOID
677 EFIAPI
678 EfiLibHiiVariablePackGetMap (
679 IN EFI_HII_VARIABLE_PACK *Pack,
680 OUT CHAR16 **Name, OPTIONAL
681 OUT EFI_GUID **Guid, OPTIONAL
682 OUT UINT16 *Id, OPTIONAL
683 OUT VOID **Var, OPTIONAL
684 OUT UINTN *Size OPTIONAL
685 );
686
687 /**
688 Finds a count of the variables/maps in the List.
689
690 @param List List of variables
691
692 @return The number of map count.
693 **/
694 UINTN
695 EFIAPI
696 EfiLibHiiVariablePackListGetMapCnt (
697 IN EFI_HII_VARIABLE_PACK_LIST *List
698 );
699
700 /**
701 type definition for the callback to be
702 used with EfiLibHiiVariablePackListForEachVar().
703
704 @param Id Variable/Map ID
705 @param Name Name of the variable/map
706 @param Guid GUID of the variable/map
707 @param Var Pointer to the variable/map
708 @param Size Size of the variable/map in bytes
709 **/
710 typedef VOID (EFI_LIB_HII_VARIABLE_PACK_LIST_CALLBACK) (
711 IN CHAR16 *Name,
712 IN EFI_GUID *Guid,
713 IN UINT16 Id,
714 IN VOID *Var,
715 IN UINTN Size
716 );
717
718 /**
719 Will iterate all variable/maps as appearing
720 in List and for each, it will call the Callback.
721
722 @param List List of variables
723 @param Callback Routine to be called for each iterated variable.
724 **/
725 VOID
726 EFIAPI
727 EfiLibHiiVariablePackListForEachVar (
728 IN EFI_HII_VARIABLE_PACK_LIST *List,
729 IN EFI_LIB_HII_VARIABLE_PACK_LIST_CALLBACK *Callback
730 );
731
732 /**
733 Finds a variable form List given
734 the order number as appears in the List.
735
736 @param Idx The index of the variable/map to retrieve
737 @param List List of variables
738 @param Name Name of the variable/map
739 @param Guid GUID of the variable/map
740 @param Id Id of the variable/map
741 @param Var Pointer to the variable/map
742 @param Size Size of the variable/map in bytes
743
744 @return EFI_SUCCESS Variable is found, OUT parameters are valid
745 @return EFI_NOT_FOUND Variable is not found, OUT parameters are not valid
746 **/
747 EFI_STATUS
748 EFIAPI
749 EfiLibHiiVariablePackListGetMapByIdx (
750 IN UINTN Idx,
751 IN EFI_HII_VARIABLE_PACK_LIST *List,
752 OUT CHAR16 **Name, OPTIONAL
753 OUT EFI_GUID **Guid, OPTIONAL
754 OUT UINT16 *Id, OPTIONAL
755 OUT VOID **Var,
756 OUT UINTN *Size
757 );
758
759 /**
760 Finds a variable form List given the
761 order number as appears in the List.
762
763 @param Id The ID of the variable/map to retrieve
764 @param List List of variables
765 @param Name Name of the variable/map
766 @param Guid GUID of the variable/map
767 @param Var Pointer to the variable/map
768 @param Size Size of the variable/map in bytes
769
770 @retval EFI_SUCCESS Variable is found, OUT parameters are valid
771 @retval EFI_NOT_FOUND Variable is not found, OUT parameters are not valid
772 **/
773 EFI_STATUS
774 EFIAPI
775 EfiLibHiiVariablePackListGetMapById (
776 IN UINT16 Id,
777 IN EFI_HII_VARIABLE_PACK_LIST *List,
778 OUT CHAR16 **Name, OPTIONAL
779 OUT EFI_GUID **Guid, OPTIONAL
780 OUT VOID **Var,
781 OUT UINTN *Size
782 );
783
784 /**
785 Finds a variable form EFI_HII_VARIABLE_PACK_LIST given name and GUID.
786
787 @param List List of variables
788 @param Name Name of the variable/map to be found
789 @param Guid GUID of the variable/map to be found
790 @param Id Id of the variable/map to be found
791 @param Var Pointer to the variable/map found
792 @param Size Size of the variable/map in bytes found
793
794 @retval EFI_SUCCESS variable is found, OUT parameters are valid
795 @retval EFI_NOT_FOUND variable is not found, OUT parameters are not valid
796 **/
797 EFI_STATUS
798 EFIAPI
799 EfiLibHiiVariablePackListGetMap (
800 IN EFI_HII_VARIABLE_PACK_LIST *List,
801 IN CHAR16 *Name,
802 IN EFI_GUID *Guid,
803 OUT UINT16 *Id,
804 OUT VOID **Var,
805 OUT UINTN *Size
806 );
807
808 /**
809 Finds out if a variable of specific Name/Guid/Size exists in NV.
810 If it does, it will retrieve it into the Var.
811
812 @param Name Parameters of the variable to retrieve. Must match exactly.
813 @param Guid Parameters of the variable to retrieve. Must match exactly.
814 @param Size Parameters of the variable to retrieve. Must match exactly.
815 @param Var Variable will be retrieved into buffer pointed by this pointer.
816 If pointing to NULL, the buffer will be allocated. Caller is responsible for releasing the buffer.
817
818 @retval EFI_SUCCESS The variable of exact Name/Guid/Size parameters was retrieved and written to Var.
819 @retval EFI_NOT_FOUND The variable of this Name/Guid was not found in the NV.
820 @retval EFI_LOAD_ERROR The variable in the NV was of different size, or NV API returned error.
821 **/
822 EFI_STATUS
823 EFIAPI
824 EfiLibHiiVariableRetrieveFromNv (
825 IN CHAR16 *Name,
826 IN EFI_GUID *Guid,
827 IN UINTN Size,
828 OUT VOID **Var
829 );
830
831 /**
832 Overrrides the variable with NV data if found.
833 But it only does it if the Name ends with specified Suffix.
834 For example, if Suffix="MyOverride" and the Name="XyzSetupMyOverride",
835 the Suffix matches the end of Name, so the variable will be loaded from NV
836 provided the variable exists and the GUID and Size matches.
837
838 @param Suffix Suffix the Name should end with.
839 @param Name Name of the variable to retrieve.
840 @param Guid Guid of the variable to retrieve.
841 @param Size Parameters of the variable to retrieve.
842 @param Var Variable will be retrieved into this buffer.
843 Caller is responsible for providing storage of exactly Size size in bytes.
844
845 @retval EFI_SUCCESS The variable was overriden with NV variable of same Name/Guid/Size.
846 @retval EFI_INVALID_PARAMETER The name of the variable does not end with <Suffix>.
847 @retval EFI_NOT_FOUND The variable of this Name/Guid was not found in the NV.
848 @retval EFI_LOAD_ERROR The variable in the NV was of different size, or NV API returned error.
849 **/
850 EFI_STATUS
851 EFIAPI
852 EfiLibHiiVariableOverrideIfSuffix (
853 IN CHAR16 *Suffix,
854 IN CHAR16 *Name,
855 IN EFI_GUID *Guid,
856 IN UINTN Size,
857 OUT VOID *Var
858 );
859
860 /**
861 Overrrides the variable with NV data if found.
862 But it only does it if the NV contains the same variable with Name is appended with Suffix.
863 For example, if Suffix="MyOverride" and the Name="XyzSetup",
864 the Suffix will be appended to the end of Name, and the variable with Name="XyzSetupMyOverride"
865 will be loaded from NV provided the variable exists and the GUID and Size matches.
866
867 @param Suffix Suffix the variable will be appended with.
868 @param Name Parameters of the Name variable to retrieve.
869 @param Guid Parameters of the Guid variable to retrieve.
870 @param Size Parameters of the Size variable to retrieve.
871 @param Var Variable will be retrieved into this buffer.
872 Caller is responsible for providing storage of exactly Size size in bytes.
873
874 @retval EFI_SUCCESS The variable was overriden with NV variable of same Name/Guid/Size.
875 @retval EFI_NOT_FOUND The variable of this Name/Guid was not found in the NV.
876 @retval EFI_LOAD_ERROR The variable in the NV was of different size, or NV API returned error.
877 **/
878 EFI_STATUS
879 EFIAPI
880 EfiLibHiiVariableOverrideBySuffix (
881 IN CHAR16 *Suffix,
882 IN CHAR16 *Name,
883 IN EFI_GUID *Guid,
884 IN UINTN Size,
885 OUT VOID *Var
886 );
887
888 #endif