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