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