Home | History | Annotate | Download | only in DriverSampleDxe
      1 ///** @file
      2 //
      3 //    Sample Setup formset.
      4 //
      5 //  Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>
      6 //  This program and the accompanying materials
      7 //  are licensed and made available under the terms and conditions of the BSD License
      8 //  which accompanies this distribution.  The full text of the license may be found at
      9 //  http://opensource.org/licenses/bsd-license.php
     10 //
     11 //  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     12 //  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     13 //
     14 //**/
     15 
     16 
     17 #include "NVDataStruc.h"
     18 
     19 //
     20 // Formset class used by Device Manager
     21 //
     22 #define EFI_NON_DEVICE_CLASS              0x00
     23 #define EFI_DISK_DEVICE_CLASS             0x01
     24 #define EFI_VIDEO_DEVICE_CLASS            0x02
     25 #define EFI_NETWORK_DEVICE_CLASS          0x04
     26 #define EFI_INPUT_DEVICE_CLASS            0x08
     27 #define EFI_ON_BOARD_DEVICE_CLASS         0x10
     28 #define EFI_OTHER_DEVICE_CLASS            0x20
     29 
     30 //
     31 // Formset subclass
     32 //
     33 #define EFI_SETUP_APPLICATION_SUBCLASS    0x00
     34 #define EFI_GENERAL_APPLICATION_SUBCLASS  0x01
     35 #define EFI_FRONT_PAGE_SUBCLASS           0x02
     36 #define EFI_SINGLE_USE_SUBCLASS           0x03
     37 
     38 //
     39 // EFI Variable attributes
     40 //
     41 #define EFI_VARIABLE_NON_VOLATILE       0x00000001
     42 #define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002
     43 #define EFI_VARIABLE_RUNTIME_ACCESS     0x00000004
     44 #define EFI_VARIABLE_READ_ONLY          0x00000008
     45 
     46 #define EFI_USER_INFO_ACCESS_SETUP_ADMIN_GUID \
     47   { 0x85b75607, 0xf7ce, 0x471e, { 0xb7, 0xe4, 0x2a, 0xea, 0x5f, 0x72, 0x32, 0xee } }
     48 
     49 #define PERL_GUID \
     50   { 0x63E60A51, 0x497D, 0xD427, {0xC4, 0xA5, 0xB8, 0xAB, 0xDC, 0x3A, 0xAE, 0xB6 }}
     51 
     52 //
     53 // Labels definition
     54 //
     55 #define LABEL_1_VALUE               0x01
     56 #define LABEL_2_VALUE               0x1000
     57 #define LABEL_UPDATE_BBS            0x2222
     58 
     59 formset
     60   guid      = DRIVER_SAMPLE_FORMSET_GUID,
     61   title     = STRING_TOKEN(STR_FORM_SET_TITLE),
     62   help      = STRING_TOKEN(STR_FORM_SET_TITLE_HELP),
     63   classguid = EFI_HII_PLATFORM_SETUP_FORMSET_GUID,
     64   
     65   //
     66   // Notes: VfrCompiler will insert a Standard Default Storage declaration 
     67   // after the formset declaration.    >00000040: 5C 06 00 00 00 00.
     68   // So we don't need to declare the Standard Default.
     69   // Please check the vfr.lst file for details.
     70   // To enable list file for VFR, add "-l" to VfrCompile <Command> in [Build.Visual-Form-Representation-File] as follows:
     71   //          VfrCompile -l --no-pre-processing --output-directory ${d_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
     72   //
     73   
     74    //
     75   // Define a Buffer Storage (EFI_IFR_VARSTORE)
     76   //
     77   varstore DRIVER_SAMPLE_CONFIGURATION,     // This is the data structure type
     78     varid = CONFIGURATION_VARSTORE_ID,      // Optional VarStore ID
     79     name  = MyIfrNVData,                    // Define referenced name in vfr
     80     guid  = DRIVER_SAMPLE_FORMSET_GUID;     // GUID of this buffer storage
     81 
     82   //
     83   // Define a EFI variable Storage (EFI_IFR_VARSTORE_EFI)
     84   //
     85   efivarstore MY_EFI_VARSTORE_DATA,
     86     attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,  // EFI variable attribures  
     87     name  = MyEfiVar,
     88     guid  = DRIVER_SAMPLE_FORMSET_GUID;
     89 
     90   //
     91   // Define a Name/Value Storage (EFI_IFR_VARSTORE_NAME_VALUE)
     92   //
     93   namevaluevarstore MyNameValueVar,                // Define storage reference name in vfr
     94     name = STRING_TOKEN(STR_NAME_VALUE_VAR_NAME0), // Define Name list of this storage, refer it by MyNameValueVar[0]
     95     name = STRING_TOKEN(STR_NAME_VALUE_VAR_NAME1), // Define Name list of this storage, refer it by MyNameValueVar[1]
     96     name = STRING_TOKEN(STR_NAME_VALUE_VAR_NAME2), // Define Name list of this storage, refer it by MyNameValueVar[2]
     97     guid = DRIVER_SAMPLE_FORMSET_GUID;             // GUID of this Name/Value storage
     98 
     99   defaultstore MyStandardDefault,
    100     prompt      = STRING_TOKEN(STR_STANDARD_DEFAULT_PROMPT),
    101     attribute   = 0x0000;                         // Default ID: 0000 standard default
    102 
    103   defaultstore MyManufactureDefault,
    104     prompt      = STRING_TOKEN(STR_MANUFACTURE_DEFAULT_PROMPT),
    105     attribute   = 0x0001;                         // Default ID: 0001 manufacture default
    106 
    107   //
    108   // Define a Form (EFI_IFR_FORM)
    109   //
    110   form formid = 1,                                // Form ID
    111        title  = STRING_TOKEN(STR_FORM1_TITLE);    // Form title
    112 
    113     subtitle text = STRING_TOKEN(STR_SUBTITLE_TEXT);
    114 
    115     subtitle text = STRING_TOKEN(STR_SUBTITLE_TEXT2);
    116 
    117     //
    118     // Define a display only text (EFI_IFR_TEXT)
    119     //
    120     text
    121       help   = STRING_TOKEN(STR_TEXT_HELP),       // Help string
    122       text   = STRING_TOKEN(STR_CPU_STRING),      // Prompt string
    123         text   = STRING_TOKEN(STR_CPU_STRING2);   // TextTwo
    124 
    125     //
    126     // Define action button (EFI_IFR_ACTION)
    127     //
    128     text
    129       help   = STRING_TOKEN(STR_EXIT_TEXT),
    130       text   = STRING_TOKEN(STR_EXIT_TEXT),
    131       flags  = INTERACTIVE,   // VfrCompiler will generate opcode EFI_IFR_ACTION for Text marked as INTERACTIVE
    132       key    = 0x1237;
    133 
    134     text
    135       help   = STRING_TOKEN(STR_SAVE_TEXT),
    136       text   = STRING_TOKEN(STR_SAVE_TEXT),
    137       flags  = INTERACTIVE,
    138       key    = 0x1238;
    139 
    140     text
    141       help   = STRING_TOKEN(STR_SAVE_CURRENT),
    142       text   = STRING_TOKEN(STR_SAVE_CURRENT),
    143       flags  = INTERACTIVE,
    144       key    = 0x1243;
    145 
    146     text
    147       help   = STRING_TOKEN(STR_DISCARD_CURRENT_AND_EXIT),
    148       text   = STRING_TOKEN(STR_DISCARD_CURRENT_AND_EXIT),
    149       flags  = INTERACTIVE,
    150       key    = 0x1244;
    151     //
    152     // Define oneof (EFI_IFR_ONE_OF)
    153     //
    154     oneof name = MyOneOf,                                // Define reference name for Question
    155       varid   = MyIfrNVData.SuppressGrayOutSomething,    // Use "DataStructure.Member" to reference Buffer Storage
    156       prompt  = STRING_TOKEN(STR_ONE_OF_PROMPT),
    157       help    = STRING_TOKEN(STR_ONE_OF_HELP),
    158       //
    159       // Define an option (EFI_IFR_ONE_OF_OPTION)
    160       //
    161       option text = STRING_TOKEN(STR_ONE_OF_TEXT4), value = 0x0, flags = 0;
    162       option text = STRING_TOKEN(STR_ONE_OF_TEXT5), value = 0x1, flags = 0;
    163       //
    164       // DEFAULT indicate this option will be marked with EFI_IFR_OPTION_DEFAULT
    165       //
    166       option text = STRING_TOKEN(STR_ONE_OF_TEXT6), value = 0x2, flags = DEFAULT;
    167     endoneof;
    168 
    169     oneof varid  = MyIfrNVData.BootOrderLarge,
    170       prompt      = STRING_TOKEN(STR_ONE_OF_PROMPT),
    171       help        = STRING_TOKEN(STR_ONE_OF_HELP),
    172       default value = cond (pushthis == 0 ? 0 : cond ((questionref(MyOneOf) >> 0x4 & 0xF00) == 0x0 + 0x2 ? 0 : 1)),
    173       option text = STRING_TOKEN(STR_BOOT_ORDER1), value = 0x0, flags = 0;
    174       option text = STRING_TOKEN(STR_BOOT_ORDER2), value = 0x1, flags = 0;
    175     endoneof;
    176 
    177     grayoutif  ideqval MyIfrNVData.SuppressGrayOutSomething == 0x1;
    178       suppressif questionref(MyOneOf) == 0x0;
    179 
    180         checkbox varid   = MyIfrNVData.ChooseToActivateNuclearWeaponry,
    181                  prompt   = STRING_TOKEN(STR_CHECK_BOX_PROMPT),
    182                  help     = STRING_TOKEN(STR_CHECK_BOX_HELP),
    183                  //
    184                  // CHECKBOX_DEFAULT indicate this checkbox is marked with EFI_IFR_CHECKBOX_DEFAULT
    185                  // CHECKBOX_DEFAULT_MFG indicate EFI_IFR_CHECKBOX_DEFAULT_MFG.
    186                  //
    187                  flags    = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG,
    188                  default  = TRUE,
    189         endcheckbox;
    190       endif;
    191     endif;
    192 
    193     //
    194     // Ordered list:
    195     //   sizeof(MyIfrNVData) storage must be UINT8 array, and
    196     //   size written for the variable must be size of the entire
    197     //   variable.
    198     //
    199     //
    200     suppressif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x0;
    201 
    202       //
    203       // label is defined as an anchor where you want to insert some dynamic
    204       // opcodes created on-the-fly
    205       //
    206       label LABEL_UPDATE_BBS;
    207 
    208       orderedlist
    209                 varid       = MyIfrNVData.BootOrder,
    210                 prompt      = STRING_TOKEN(STR_BOOT_OPTIONS),
    211                 help        = STRING_TOKEN(STR_NULL_STRING),
    212                 flags       = RESET_REQUIRED,
    213                 option text = STRING_TOKEN(STR_BOOT_OPTION2), value = 2, flags = 0;
    214                 option text = STRING_TOKEN(STR_BOOT_OPTION1), value = 1, flags = 0;
    215                 option text = STRING_TOKEN(STR_BOOT_OPTION3), value = 3, flags = 0;
    216               suppressif ideqval MyIfrNVData.BootOrderLarge == 0;
    217                 option text = STRING_TOKEN(STR_BOOT_OPTION4), value = 4, flags = 0;
    218               endif;
    219       endlist;
    220 
    221       //
    222       // label should be paired with each other
    223       //
    224       label LABEL_END;
    225 
    226     endif;    // end suppressif
    227 
    228     disableif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x2;
    229       orderedlist
    230         varid       = MyIfrNVData.OrderedList,
    231         prompt      = STRING_TOKEN(STR_TEST_OPCODE),
    232         help        = STRING_TOKEN(STR_TEXT_HELP),
    233         flags       = RESET_REQUIRED,
    234         option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 3, flags = 0;
    235         option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 2, flags = 0;
    236         option text = STRING_TOKEN(STR_ONE_OF_TEXT3), value = 1, flags = 0;
    237         default     = {1,2,3},
    238       endlist;
    239     endif;
    240 
    241     label 100;
    242 
    243     //
    244     // Define a hyperlink (EFI_IFR_REF)
    245     //
    246     goto 0x1234,                                  // Destination Form ID
    247       prompt  = STRING_TOKEN(STR_GOTO_DYNAMIC),   // Prompt string
    248       help    = STRING_TOKEN(STR_GOTO_HELP),      // Help string
    249       flags   = INTERACTIVE,                      // INTERACTIVE indicate it's marked with EFI_IFR_FLAG_CALLBACK
    250       key     = 0x1234;                           // Question ID which will be passed-in in COnfigAccess.Callback()
    251 
    252     goto 0x1234,
    253       prompt  = STRING_TOKEN(STR_GOTO_DYNAMIC2),
    254       help    = STRING_TOKEN(STR_GOTO_HELP),
    255       flags   = INTERACTIVE,
    256       key     = 0x1235;
    257 
    258     oneof varid  = MyIfrNVData.TestLateCheck,
    259       prompt      = STRING_TOKEN(STR_TEST_OPCODE),
    260       help        = STRING_TOKEN(STR_ONE_OF_HELP),
    261       flags       = RESET_REQUIRED,
    262       option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = 0;
    263       option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = DEFAULT;
    264       warningif prompt = STRING_TOKEN(STR_WARNING_POPUP), timeout = 5,
    265         ideqval MyIfrNVData.TestLateCheck == 0
    266       endif;
    267 
    268     endoneof;
    269 
    270     oneof varid  = MyIfrNVData.TestLateCheck2,
    271       prompt      = STRING_TOKEN(STR_TEST_OPCODE2),
    272       help        = STRING_TOKEN(STR_ONE_OF_HELP),
    273       flags       = RESET_REQUIRED,
    274       option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = DEFAULT;
    275       option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = 0;
    276 
    277       inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
    278         ideqid MyIfrNVData.TestLateCheck == MyIfrNVData.TestLateCheck2
    279       endif;
    280 
    281     endoneof;
    282 
    283     oneof varid  = MyIfrNVData.QuestionAboutTreeHugging,
    284       prompt      = STRING_TOKEN(STR_ONE_OF_PROMPT_KEYWORD),
    285       help        = STRING_TOKEN(STR_ONE_OF_HELP),
    286       flags       = RESET_REQUIRED,
    287       option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = 0;
    288       option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = DEFAULT;
    289       option text = STRING_TOKEN(STR_ONE_OF_TEXT3), value = 3, flags = 0;
    290     endoneof;
    291 
    292     //
    293     // Define a string (EFI_IFR_STRING)
    294     //
    295     string    varid    = MyIfrNVData.MyStringData,
    296               prompt   = STRING_TOKEN(STR_MY_STRING_PROMPT2),
    297               help     = STRING_TOKEN(STR_MY_STRING_HELP2),
    298               flags    = INTERACTIVE,
    299               key      = 0x1236,
    300               minsize  = 6,
    301               maxsize  = 40,
    302               inconsistentif prompt = STRING_TOKEN(STR_STRING_CHECK_ERROR_POPUP),
    303                 pushthis != stringref(STRING_TOKEN(STR_STRING_CHECK))
    304               endif;
    305     endstring;
    306 
    307     //
    308     // Define a numeric (EFI_IFR_NUMERIC)
    309     //
    310     numeric varid   = MyIfrNVData.HowOldAreYouInYearsManual,
    311             prompt  = STRING_TOKEN(STR_NUMERIC_READONLY_PROMPT),
    312             help    = STRING_TOKEN(STR_NUMERIC_HELP0),
    313             flags   = READ_ONLY,  // READ_ONLY indicate it's marked with EFI_IFR_FLAG_READ_ONLY
    314             minimum = 0,
    315             maximum = 0xf0,
    316             step    = 0,          // Stepping of 0 equates to a manual entering
    317                                   // of a value, otherwise it will be adjusted by "+"/"-"
    318             default = 21,         // defaultstore could be used to specify the default type
    319                                   // If no defaultstore is specified, it implies Standard Default
    320 
    321     endnumeric;
    322 
    323     numeric varid   = MyIfrNVData.HowOldAreYouInYearsManual,
    324             prompt  = STRING_TOKEN(STR_NUMERIC_MANUAL_PROMPT),
    325             help    = STRING_TOKEN(STR_NUMERIC_HELP0),
    326             minimum = 0,
    327             maximum = 0xf0,
    328             step    = 0,
    329             default value = questionrefval(devicepath = STRING_TOKEN (STR_DEVICE_PATH), guid = DRIVER_SAMPLE_FORMSET_GUID, 0x1111),
    330 
    331             inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
    332               ideqval MyIfrNVData.HowOldAreYouInYearsManual == 99
    333               OR
    334               ideqid  MyIfrNVData.HowOldAreYouInYearsManual == MyEfiVar.Field8
    335               OR
    336               ideqvallist MyIfrNVData.HowOldAreYouInYearsManual == 1 3 5 7
    337             endif;
    338 
    339     endnumeric;
    340 
    341     numeric varid   = MyEfiVar.Field8,                    // Reference of EFI variable storage
    342             questionid  = 0x1111,
    343             prompt  = STRING_TOKEN(STR_TALL_HEX_PROMPT),
    344             help    = STRING_TOKEN(STR_NUMERIC_HELP1),
    345             flags   = DISPLAY_UINT_HEX | INTERACTIVE,     // Display in HEX format (if not specified, default is in decimal format)
    346             minimum = 0,
    347             maximum = 250,
    348             default = 18, defaultstore = MyStandardDefault,     // This is standard default value
    349             default = 19, defaultstore = MyManufactureDefault,  // This is manufacture default value
    350 
    351     endnumeric;
    352 
    353     //
    354     // Define numeric using Name/Value Storage
    355     //
    356     numeric varid   = MyNameValueVar[0],     // This numeric take NameValueVar0 as storage
    357             prompt  = STRING_TOKEN(STR_NAME_VALUE_VAR_NAME0),
    358             help    = STRING_TOKEN(STR_NAME_VALUE_VAR_NAME0_HELP),
    359             //
    360             // Size should be defined for numeric when use Name/Value storage
    361             // Valid value for numerice size are: NUMERIC_SIZE_1, NUMERIC_SIZE_2, NUMERIC_SIZE_4 and NUMERIC_SIZE_8
    362             //
    363             flags   = NUMERIC_SIZE_1,        // Size of this numeric is 1 byte
    364             minimum = 0,
    365             maximum = 0xff,
    366             step    = 0,
    367             locked,
    368             default = 16, defaultstore = MyStandardDefault,     // This is standard default value
    369             default = 17, defaultstore = MyManufactureDefault,  // This is manufacture default value
    370     endnumeric;
    371 
    372     numeric varid   = MyNameValueVar[1],     // This numeric take NameValueVar1 as storage
    373             prompt  = STRING_TOKEN(STR_NAME_VALUE_VAR_NAME1),
    374             help    = STRING_TOKEN(STR_NAME_VALUE_VAR_NAME1_HELP),
    375             flags   = NUMERIC_SIZE_2,        // Size of this numeric is 2 bytes
    376             minimum = 0,
    377             maximum = 0xffff,
    378             step    = 0,
    379             default = 18, defaultstore = MyStandardDefault,     // This is standard default value
    380             default = 19, defaultstore = MyManufactureDefault,  // This is manufacture default value
    381     endnumeric;
    382 
    383     //
    384     // Define string using Name/Value Storage
    385     //
    386     string    varid    = MyNameValueVar[2],     // This string take NameValueVar2 as storage
    387               prompt   = STRING_TOKEN(STR_NAME_VALUE_VAR_NAME2),
    388               help     = STRING_TOKEN(STR_NAME_VALUE_VAR_NAME2_HELP),
    389               minsize  = 2,
    390               maxsize  = 0x14,
    391     endstring;
    392 
    393     oneof varid   = MyEfiVar.Field16,
    394       prompt      = STRING_TOKEN(STR_ONE_OF_PROMPT),
    395       help        = STRING_TOKEN(STR_NUMERIC_NUM_HELP),
    396       option text = STRING_TOKEN(STR_BOOT_ORDER1), value = 0x0, flags = 0;
    397       option text = STRING_TOKEN(STR_BOOT_ORDER2), value = 0x1, flags = DEFAULT;
    398     endoneof;
    399 
    400     label LABEL_1_VALUE;
    401     label LABEL_2_VALUE;
    402 
    403     grayoutif  ideqval MyIfrNVData.HowOldAreYouInYearsManual == 23 AND ideqval MyIfrNVData.SuppressGrayOutSomething == 0x1;
    404       numeric varid   = MyIfrNVData.HowOldAreYouInYears,
    405               prompt  = STRING_TOKEN(STR_NUMERIC_STEP_PROMPT),
    406               help    = STRING_TOKEN(STR_NUMERIC_HELP2),
    407               minimum = 0,
    408               maximum = 243,
    409               step    = 1,
    410               default = 18, defaultstore = MyStandardDefault,     // This is standard default value
    411               default = 19, defaultstore = MyManufactureDefault,  // This is manufacture default value
    412         
    413       endnumeric;
    414     endif;
    415 
    416     numeric varid   = MyIfrNVData.GetDefaultValueFromAccess,
    417             questionid = 0x1239,
    418             prompt  = STRING_TOKEN(STR_DEFAULT_VALUE_FROM_ACCESS_PROMPT),
    419             help    = STRING_TOKEN(STR_DEFAULT_VALUE_FROM_ACCESS_HELP),
    420             flags   = DISPLAY_UINT_HEX | INTERACTIVE, 
    421             minimum = 0,
    422             maximum = 255,
    423             step    = 1,
    424             default = 18,
    425     endnumeric;
    426 
    427     numeric varid   = MyIfrNVData.GetDefaultValueFromCallBack,
    428             questionid = 0x1240,
    429             prompt  = STRING_TOKEN(STR_DEFAULT_VALUE_FROM_CALLBACK_PROMPT),
    430             help    = STRING_TOKEN(STR_DEFAULT_VALUE_FROM_CALLBACK_HELP),
    431             flags   = DISPLAY_UINT_HEX | INTERACTIVE, 
    432             minimum = 0,
    433             maximum = 255,
    434             step    = 1,
    435             default = 18,
    436     endnumeric;
    437         
    438     resetbutton
    439       defaultstore = MyStandardDefault,
    440       prompt   = STRING_TOKEN(STR_STANDARD_DEFAULT_PROMPT),
    441       help     = STRING_TOKEN(STR_STANDARD_DEFAULT_HELP),
    442     endresetbutton;
    443     
    444     resetbutton
    445       defaultstore = MyManufactureDefault,
    446       prompt   = STRING_TOKEN(STR_MANUFACTURE_DEFAULT_PROMPT),
    447       help     = STRING_TOKEN(STR_MANUFACTURE_DEFAULT_HELP),
    448     endresetbutton;
    449 
    450     //
    451     // Non-interactive password, validate by Setup Browser
    452     //
    453     password  varid    = MyIfrNVData.WhatIsThePassword,
    454               prompt   = STRING_TOKEN(STR_PASSWORD_PROMPT),
    455               help     = STRING_TOKEN(STR_PASSWORD_HELP),
    456               minsize  = 6,
    457               maxsize  = 20,
    458     endpassword;
    459 
    460     string    varid    = MyIfrNVData.PasswordClearText,
    461               prompt   = STRING_TOKEN(STR_MY_STRING_PROMPT),
    462               help     = STRING_TOKEN(STR_MY_STRING_HELP),
    463               minsize  = 6,
    464               maxsize  = 0x14,
    465               default  = STRING_TOKEN(STR_MY_STRING_DEFAULT),
    466     endstring;
    467 
    468     //
    469     // Interactive password, validate via ConfigAccess.Callback()
    470     //
    471     password  varid    = MyIfrNVData.WhatIsThePassword2,
    472               prompt   = STRING_TOKEN(STR_PASSWORD_CALLBACK_PROMPT),
    473               help     = STRING_TOKEN(STR_PASSWORD_HELP),
    474               flags    = INTERACTIVE,
    475               key      = 0x2000,
    476               minsize  = 6,
    477               maxsize  = 20,
    478     endpassword;
    479 
    480     //
    481     // Sample use case for IFR Security op-code
    482     //
    483     grayoutif NOT security (EFI_USER_INFO_ACCESS_SETUP_ADMIN_GUID);
    484       text
    485         help = STRING_TOKEN(STR_TEXT_SECRUITY_TEST_HELP),
    486         text = STRING_TOKEN(STR_TEXT_SECRUITY_TEST_TEXT);
    487     endif;
    488     
    489     goto 2,
    490       prompt = STRING_TOKEN(STR_GOTO_FORM2), //SecondSetupPage  // this too has no end-op and basically it's a jump to a form ONLY
    491       help   = STRING_TOKEN(STR_GOTO_HELP);
    492 
    493     goto 3,
    494       prompt = STRING_TOKEN(STR_GOTO_FORM3), //ThirdSetupPage  // this too has no end-op and basically it's a jump to a form ONLY
    495       help   = STRING_TOKEN(STR_GOTO_HELP);
    496 
    497     goto 4,
    498       prompt = STRING_TOKEN(STR_GOTO_FORM4), //FourthSetupPage  // this too has no end-op and basically it's a jump to a form ONLY
    499       help   = STRING_TOKEN(STR_GOTO_HELP);
    500 
    501     goto 5,
    502       prompt = STRING_TOKEN(STR_GOTO_FORM5), //FifthSetupPage  // this too has no end-op and basically it's a jump to a form ONLY
    503       help   = STRING_TOKEN(STR_GOTO_FORM5_HELP);
    504       
    505     goto 6,
    506       prompt = STRING_TOKEN(STR_GOTO_FORM6), //SixthSetupPage  // this too has no end-op and basically it's a jump to a form ONLY
    507       help   = STRING_TOKEN(STR_GOTO_HELP);
    508 
    509     goto 
    510       formsetguid = DRIVER_SAMPLE_INVENTORY_GUID,
    511       formid  = 0x1,
    512       question = 0x1,
    513       prompt  = STRING_TOKEN(STR_GOTO_ANOTHER_FORMSET),
    514       help    = STRING_TOKEN(STR_GOTO_ANOTHER_FORMSET_HELP);
    515 
    516     guidop 
    517       guid = DRIVER_SAMPLE_FORMSET_GUID,
    518       datatype = MY_EFI_VARSTORE_DATA,
    519         data.Field8  = 0x21, 
    520         data.Field16 = 0x2121,
    521         data.OrderedList[0] = 0x21,        
    522     endguidop;
    523 
    524 
    525   endform;
    526 
    527   suppressif ideqval MyIfrNVData.BootOrderLarge == 0;
    528     form formid = 2,               // SecondSetupPage,
    529       title = STRING_TOKEN(STR_FORM2_TITLE);  // note formid is a variable (for readability) (UINT16) - also added Form to the line to signify the Op-Code
    530 
    531       date
    532         name    = Date,
    533         prompt  = STRING_TOKEN(STR_DATE_PROMPT),
    534         help    = STRING_TOKEN(STR_DATE_HELP),
    535         flags   = STORAGE_TIME,
    536         default = 2004/1/1,
    537 
    538         inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
    539           ideqval Date.Day == 31
    540           AND
    541           ideqvallist Date.Month == 2 4 6 9 11
    542         endif;
    543 
    544         //
    545         // If the day is 30 AND month is 2
    546         //
    547         inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
    548           ideqval Date.Day == 30
    549           AND
    550           ideqval Date.Month == 2
    551         endif;
    552 
    553         //
    554         // If the day is 29 AND month is 2 AND it year is NOT a leapyear
    555         //
    556         inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
    557           ideqval Date.Day == 0x1D
    558           AND
    559           ideqval Date.Month == 2
    560           AND
    561           NOT
    562           ideqvallist Date.Year == 2004 2008 20012 20016 2020 2024 2028 2032 2036
    563         endif;
    564 
    565       enddate;
    566 
    567       text
    568         help   = STRING_TOKEN(STR_SAVE_CURRENT_AND_EXIT),
    569         text   = STRING_TOKEN(STR_SAVE_CURRENT_AND_EXIT),
    570         flags  = INTERACTIVE,
    571         key    = 0x1241;
    572 
    573       text
    574         help   = STRING_TOKEN(STR_DISCARD_CURRENT),
    575         text   = STRING_TOKEN(STR_DISCARD_CURRENT),
    576         flags  = INTERACTIVE,
    577         key    = 0x1242;
    578 
    579       time
    580         prompt  = STRING_TOKEN(STR_TIME_PROMPT),
    581         help    = STRING_TOKEN(STR_TIME_HELP),
    582         flags   = STORAGE_TIME,
    583       endtime;
    584       
    585       time 
    586             name    = MyTime, 
    587             varid   = MyIfrNVData.Time, 
    588             prompt  = STRING_TOKEN(STR_TIME_PROMPT), 
    589             help    = STRING_TOKEN(STR_TIME_PROMPT), 
    590             flags   = STORAGE_NORMAL | SECOND_SUPPRESS,
    591             default = 15:33:33, 
    592       endtime;
    593       
    594       checkbox varid   = MyIfrNVData.ChooseToActivateNuclearWeaponry,
    595               prompt   = STRING_TOKEN(STR_CHECK_BOX_PROMPT),
    596               help     = STRING_TOKEN(STR_CHECK_BOX_HELP),
    597               flags    = CHECKBOX_DEFAULT,
    598       endcheckbox;
    599 
    600       text
    601         help = STRING_TOKEN(STR_TEXT_HELP),
    602         text = STRING_TOKEN(STR_TEXT_TEXT_1);
    603 
    604       text
    605         help   = STRING_TOKEN(STR_TEXT_HELP),
    606         text   = STRING_TOKEN(STR_TEXT_TEXT_1),
    607         text   = STRING_TOKEN(STR_TEXT_TEXT_2);
    608 
    609       goto 1,
    610         prompt = STRING_TOKEN(STR_GOTO_FORM1), //MainSetupPage  // this too has no end-op and basically it's a jump to a form ONLY
    611         help   = STRING_TOKEN(STR_GOTO_HELP);
    612 
    613     goto 
    614       varid   = MyIfrNVData.RefData,
    615       prompt  = STRING_TOKEN(STR_GOTO_DYNAMIC3),
    616       help    = STRING_TOKEN(STR_GOTO_DYNAMIC3_HELP),
    617       flags   = INTERACTIVE,
    618       key     = 0x1248,
    619       //
    620       // Set the defult value, format is QuestionId; FormId; FormsetGuid; Device Path String Token
    621       //
    622       default = 0;0;ZERO_GUID;STRING_TOKEN(STR_NULL_STRING),  
    623     ;                                                         // goto opcode end flag.
    624 
    625     goto 
    626       prompt  = STRING_TOKEN(STR_GOTO_DYNAMIC4),
    627       help    = STRING_TOKEN(STR_GOTO_DYNAMIC4_HELP),
    628       flags   = INTERACTIVE,
    629       key     = 0x1249;
    630       
    631     endform;
    632   endif;
    633 
    634   form formid = 3, title = STRING_TOKEN(STR_FORM3_TITLE);  // note formid is a variable (for readability) (UINT16) - also added Form to the line to signify the Op-Code
    635 
    636     suppressif  ideqval MyEfiVar.Field8 == 111;
    637       text
    638         help = STRING_TOKEN(STR_TEXT_HELP),
    639         text = STRING_TOKEN(STR_TEXT_TEXT_1);
    640     endif;
    641 
    642     goto 1,
    643       prompt = STRING_TOKEN(STR_GOTO_FORM1), //MainSetupPage
    644       help   = STRING_TOKEN(STR_GOTO_HELP);
    645 
    646     numeric varid   = MyIfrNVData.DynamicRefresh,
    647             prompt  = STRING_TOKEN(STR_NUMERIC_MANUAL_PROMPT),
    648             help    = STRING_TOKEN(STR_NUMERIC_HELP0),
    649             flags   = INTERACTIVE,
    650             key     = 0x5678,
    651             minimum = 0,
    652             maximum = 0xff,
    653             step    = 0,
    654             default = 0,
    655             refresh interval = 3             // Refresh interval in seconds
    656     endnumeric;
    657 
    658     grayoutif  match2 (stringref(STRING_TOKEN(STR_PATTERN)), stringref(STRING_TOKEN(STR_STRING)), PERL_GUID);
    659       numeric 
    660         varid   = MyIfrNVData.Match2,
    661         prompt  = STRING_TOKEN(STR_MATCH2_PROMPT),
    662         help    = STRING_TOKEN(STR_MATCH2_HELP),
    663         minimum = 0,
    664         maximum = 243,
    665       endnumeric;
    666     endif;
    667 
    668     label LABEL_UPDATE2;
    669     label LABEL_END;
    670 
    671   endform;
    672 
    673   formmap formid = 4,            
    674     maptitle = STRING_TOKEN(STR_SAMPL_MAP_METHOD);  
    675     mapguid  = DRIVER_SAMPLE_FORMSET_GUID;
    676     maptitle = STRING_TOKEN(STR_STANDARD_MAP_METHOD);  
    677     mapguid  = EFI_HII_STANDARD_FORM_GUID;
    678 
    679     oneof varid = MyIfrNVData.SerialPortNo,    
    680       prompt  = STRING_TOKEN(STR_SERIAL_PORT),
    681       help    = STRING_TOKEN(STR_ONE_OF_HELP),
    682 
    683       read    cond (get(MyIfrNVData.SerialPortStatus) != 0 ? 0 : cond ((get(MyIfrNVData.SerialPortIo) & 0xF00) >> 0x8 == get(MyIfrNVData.SerialPortIrq) - 1 ? UNDEFINED : map (get(MyIfrNVData.SerialPortIo) : 0x3f8,1; 0x2F8,2; 0x3E8,3; 0x2E8,4;)));
    684       write   set(MyIfrNVData.SerialPortStatus, pushthis != 0) AND set(MyIfrNVData.SerialPortIo, map (pushthis : 1,0x3F8; 2,0x2F8; 3,0x3E8; 4,0x2E8;)) AND set (MyIfrNVData.SerialPortIrq, map (pushthis: 1,4; 2,3; 3,4; 4,3;));
    685       
    686       option text = STRING_TOKEN(STR_SERIAL_PORT_DISABLE), value = 0x0, flags = DEFAULT;
    687       option text = STRING_TOKEN(STR_SERIAL_PORT1), value = 0x1, flags = 0;
    688       option text = STRING_TOKEN(STR_SERIAL_PORT2), value = 0x2, flags = 0;
    689       option text = STRING_TOKEN(STR_SERIAL_PORT3), value = 0x3, flags = 0;
    690       option text = STRING_TOKEN(STR_SERIAL_PORT4), value = 0x4, flags = 0;
    691     endoneof;
    692 
    693     grayoutif TRUE;
    694       checkbox varid = MyIfrNVData.SerialPortStatus,
    695         prompt   = STRING_TOKEN(STR_SERIAL_PORT_STATUS),
    696         help     = STRING_TOKEN(STR_CHECK_BOX_HELP),
    697       endcheckbox;
    698     endif;
    699 
    700     grayoutif TRUE;
    701       suppressif ideqval MyIfrNVData.SerialPortStatus == 0;
    702         oneof varid = MyIfrNVData.SerialPortIo,    
    703           prompt  = STRING_TOKEN(STR_SERIAL_PORT_IO_ADDRESS),
    704           help    = STRING_TOKEN(STR_ONE_OF_HELP),
    705           
    706           option text = STRING_TOKEN(STR_SERIAL_PORT1_IOADDR), value = 0x3F8, flags = DEFAULT;
    707           option text = STRING_TOKEN(STR_SERIAL_PORT2_IOADDR), value = 0x2F8, flags = 0;
    708           option text = STRING_TOKEN(STR_SERIAL_PORT3_IOADDR), value = 0x3E8, flags = 0;
    709           option text = STRING_TOKEN(STR_SERIAL_PORT4_IOADDR), value = 0x2E8, flags = 0;
    710         endoneof;
    711       endif;
    712     endif;
    713 
    714     grayoutif TRUE;
    715       suppressif ideqval MyIfrNVData.SerialPortStatus == 0;
    716         oneof varid = MyIfrNVData.SerialPortIrq,    
    717           prompt  = STRING_TOKEN(STR_SERIAL_PORT_IRQ),
    718           help    = STRING_TOKEN(STR_ONE_OF_HELP),
    719           
    720           option text = STRING_TOKEN(STR_SERIAL_PORT13_IRQ), value = 0x4, flags = DEFAULT;
    721           option text = STRING_TOKEN(STR_SERIAL_PORT24_IRQ), value = 0x3, flags = 0;
    722         endoneof;
    723       endif;
    724     endif;
    725 
    726     goto 1,
    727       prompt = STRING_TOKEN(STR_GOTO_FORM1), //MainSetupPage
    728       help   = STRING_TOKEN(STR_GOTO_HELP);
    729 
    730   endform;
    731 
    732   form formid = 5,            // Modal form
    733        title = STRING_TOKEN(STR_MODAL_FORM_TITLE);
    734     //
    735     //  This form is a modal form.
    736     //
    737     modal;
    738     text
    739       help   = STRING_TOKEN(STR_EXIT_TEXT),
    740       text   = STRING_TOKEN(STR_EXIT_TEXT),
    741       flags  = INTERACTIVE,   // VfrCompiler will generate opcode EFI_IFR_ACTION for Text marked as INTERACTIVE
    742       key    = 0x1245;
    743 
    744     text
    745       help   = STRING_TOKEN(STR_SAVE_TEXT),
    746       text   = STRING_TOKEN(STR_SAVE_TEXT),
    747       flags  = INTERACTIVE,   // VfrCompiler will generate opcode EFI_IFR_ACTION for Text marked as INTERACTIVE
    748       key    = 0x1246;
    749   endform;
    750 
    751   form formid = 6,            // Form to show the refresh guid group op-code
    752        title = STRING_TOKEN(STR_FORM6_TITLE); 
    753 
    754     text
    755       help   = STRING_TOKEN(STR_TEXT_REFRESH_GUID),
    756       text   = STRING_TOKEN(STR_TEXT_REFRESH_GUID);
    757 
    758     numeric varid   = MyIfrNVData.RefreshGuidCount,
    759             prompt  = STRING_TOKEN(STR_TEXT_REFRESH_GUID_COUNT),
    760             help    = STRING_TOKEN(STR_NUMERIC_HELP0),
    761             flags   = INTERACTIVE,
    762             key     = 0x1247,
    763             minimum = 0,
    764             maximum = 0xff,
    765             step    = 0,
    766             default = 0,
    767             refreshguid = EFI_IFR_REFRESH_ID_OP_GUID,
    768     endnumeric;
    769 
    770     label LABEL_UPDATE3;
    771     label LABEL_END;
    772 
    773   endform;
    774 
    775   form formid = 0x1234,            // Dynamically created page,
    776        title = STRING_TOKEN(STR_DYNAMIC_TITLE);  // note formid is a variable (for readability) (UINT16) - also added Form to the line to signify the Op-Code
    777 
    778     label LABEL_UPDATE1;
    779     //
    780     // This is where we will insert dynamic created opcodes
    781     //
    782     label LABEL_END;
    783 
    784   endform;
    785 
    786 endformset;
    787