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