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