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