UEFI HII: Merge UEFI HII support changes from branch.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4599 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qwang12
2008-01-21 14:39:56 +00:00
parent f79314fa8f
commit 93e3992d1e
139 changed files with 59162 additions and 382 deletions

View File

@@ -0,0 +1,788 @@
/** @file
Copyright (c) 2004 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
DriverSample.c
Abstract:
This is an example of how a driver might export data to the HII protocol to be
later utilized by the Setup Protocol
**/
#include "DriverSample.h"
#define DISPLAY_ONLY_MY_ITEM 0x0002
EFI_GUID mFormSetGuid = FORMSET_GUID;
EFI_GUID mInventoryGuid = INVENTORY_GUID;
CHAR16 VariableName[] = L"MyIfrNVData";
VOID
EncodePassword (
IN CHAR16 *Password,
IN UINT8 MaxSize
)
{
UINTN Index;
UINTN Loop;
CHAR16 *Buffer;
CHAR16 *Key;
Key = L"MAR10648567";
Buffer = AllocateZeroPool (MaxSize);
ASSERT (Buffer != NULL);
for (Index = 0; Key[Index] != 0; Index++) {
for (Loop = 0; Loop < (UINT8) (MaxSize / 2); Loop++) {
Buffer[Loop] = (CHAR16) (Password[Loop] ^ Key[Index]);
}
}
CopyMem (Password, Buffer, MaxSize);
gBS->FreePool (Buffer);
return ;
}
EFI_STATUS
ValidatePassword (
DRIVER_SAMPLE_PRIVATE_DATA *PrivateData,
EFI_STRING_ID StringId
)
{
EFI_STATUS Status;
UINTN Index;
UINTN BufferSize;
CHAR16 *Password;
CHAR16 *EncodedPassword;
BOOLEAN OldPassword;
//
// Get encoded password first
//
BufferSize = sizeof (DRIVER_SAMPLE_CONFIGURATION);
Status = gRT->GetVariable (
VariableName,
&mFormSetGuid,
NULL,
&BufferSize,
&PrivateData->Configuration
);
if (EFI_ERROR (Status)) {
//
// Old password not exist, prompt for new password
//
return EFI_SUCCESS;
}
OldPassword = FALSE;
//
// Check whether we have any old password set
//
for (Index = 0; Index < 20; Index++) {
if (PrivateData->Configuration.WhatIsThePassword2[Index] != 0) {
OldPassword = TRUE;
break;
}
}
if (!OldPassword) {
//
// Old password not exist, return EFI_SUCCESS to prompt for new password
//
return EFI_SUCCESS;
}
//
// Get user input password
//
BufferSize = 21 * sizeof (CHAR16);
Password = AllocateZeroPool (BufferSize);
ASSERT (Password != NULL);
Status = IfrLibGetString (PrivateData->HiiHandle[0], StringId, Password, &BufferSize);
if (EFI_ERROR (Status)) {
gBS->FreePool (Password);
return Status;
}
//
// Validate old password
//
EncodedPassword = AllocateCopyPool (21 * sizeof (CHAR16), Password);
ASSERT (EncodedPassword != NULL);
EncodePassword (EncodedPassword, 20 * sizeof (CHAR16));
if (CompareMem (EncodedPassword, PrivateData->Configuration.WhatIsThePassword2, 20 * sizeof (CHAR16)) != 0) {
//
// Old password mismatch, return EFI_NOT_READY to prompt for error message
//
Status = EFI_NOT_READY;
} else {
Status = EFI_SUCCESS;
}
gBS->FreePool (Password);
gBS->FreePool (EncodedPassword);
return Status;
}
EFI_STATUS
SetPassword (
DRIVER_SAMPLE_PRIVATE_DATA *PrivateData,
EFI_STRING_ID StringId
)
{
EFI_STATUS Status;
UINTN BufferSize;
CHAR16 *Password;
DRIVER_SAMPLE_CONFIGURATION *Configuration;
//
// Get Buffer Storage data from EFI variable
//
BufferSize = sizeof (DRIVER_SAMPLE_CONFIGURATION);
Status = gRT->GetVariable (
VariableName,
&mFormSetGuid,
NULL,
&BufferSize,
&PrivateData->Configuration
);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Get user input password
//
Password = &PrivateData->Configuration.WhatIsThePassword2[0];
ZeroMem (Password, 20 * sizeof (CHAR16));
Status = IfrLibGetString (PrivateData->HiiHandle[0], StringId, Password, &BufferSize);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Retrive uncommitted data from Browser
//
BufferSize = sizeof (DRIVER_SAMPLE_CONFIGURATION);
Configuration = AllocateZeroPool (sizeof (DRIVER_SAMPLE_PRIVATE_DATA));
ASSERT (Configuration != NULL);
Status = GetBrowserData (&mFormSetGuid, VariableName, &BufferSize, (UINT8 *) Configuration);
if (!EFI_ERROR (Status)) {
//
// Update password's clear text in the screen
//
CopyMem (Configuration->PasswordClearText, Password, 20 * sizeof (CHAR16));
//
// Update uncommitted data of Browser
//
BufferSize = sizeof (DRIVER_SAMPLE_CONFIGURATION);
Status = SetBrowserData (
&mFormSetGuid,
VariableName,
BufferSize,
(UINT8 *) Configuration,
NULL
);
}
gBS->FreePool (Configuration);
//
// Set password
//
EncodePassword (Password, 20 * sizeof (CHAR16));
Status = gRT->SetVariable(
VariableName,
&mFormSetGuid,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
sizeof (DRIVER_SAMPLE_CONFIGURATION),
&PrivateData->Configuration
);
return Status;
}
/**
This function allows a caller to extract the current configuration for one
or more named elements from the target driver.
@param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
@param Request A null-terminated Unicode string in
<ConfigRequest> format.
@param Progress On return, points to a character in the Request
string. Points to the string's null terminator if
request was successful. Points to the most recent
'&' before the first failing name/value pair (or
the beginning of the string if the failure is in
the first name/value pair) if the request was not
successful.
@param Results A null-terminated Unicode string in
<ConfigAltResp> format which has all values filled
in for the names in the Request string. String to
be allocated by the called function.
@retval EFI_SUCCESS The Results is filled with the requested values.
@retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
@retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.
@retval EFI_NOT_FOUND Routing data doesn't match any storage in this
driver.
**/
EFI_STATUS
EFIAPI
ExtractConfig (
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
IN CONST EFI_STRING Request,
OUT EFI_STRING *Progress,
OUT EFI_STRING *Results
)
{
EFI_STATUS Status;
UINTN BufferSize;
DRIVER_SAMPLE_PRIVATE_DATA *PrivateData;
EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;
PrivateData = DRIVER_SAMPLE_PRIVATE_FROM_THIS (This);
HiiConfigRouting = PrivateData->HiiConfigRouting;
//
// Get Buffer Storage data from EFI variable
//
BufferSize = sizeof (DRIVER_SAMPLE_CONFIGURATION);
Status = gRT->GetVariable (
VariableName,
&mFormSetGuid,
NULL,
&BufferSize,
&PrivateData->Configuration
);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Convert buffer data to <ConfigResp> by helper function BlockToConfig()
//
Status = HiiConfigRouting->BlockToConfig (
HiiConfigRouting,
Request,
(UINT8 *) &PrivateData->Configuration,
BufferSize,
Results,
Progress
);
return Status;
}
/**
This function processes the results of changes in configuration.
@param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
@param Configuration A null-terminated Unicode string in <ConfigResp>
format.
@param Progress A pointer to a string filled in with the offset of
the most recent '&' before the first failing
name/value pair (or the beginning of the string if
the failure is in the first name/value pair) or
the terminating NULL if all was successful.
@retval EFI_SUCCESS The Results is processed successfully.
@retval EFI_INVALID_PARAMETER Configuration is NULL.
@retval EFI_NOT_FOUND Routing data doesn't match any storage in this
driver.
**/
EFI_STATUS
EFIAPI
RouteConfig (
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
IN CONST EFI_STRING Configuration,
OUT EFI_STRING *Progress
)
{
EFI_STATUS Status;
UINTN BufferSize;
DRIVER_SAMPLE_PRIVATE_DATA *PrivateData;
EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;
PrivateData = DRIVER_SAMPLE_PRIVATE_FROM_THIS (This);
HiiConfigRouting = PrivateData->HiiConfigRouting;
//
// Get Buffer Storage data from EFI variable
//
BufferSize = sizeof (DRIVER_SAMPLE_CONFIGURATION);
Status = gRT->GetVariable (
VariableName,
&mFormSetGuid,
NULL,
&BufferSize,
&PrivateData->Configuration
);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Convert <ConfigResp> to buffer data by helper function ConfigToBlock()
//
BufferSize = sizeof (DRIVER_SAMPLE_CONFIGURATION);
Status = HiiConfigRouting->ConfigToBlock (
HiiConfigRouting,
Configuration,
(UINT8 *) &PrivateData->Configuration,
&BufferSize,
Progress
);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Store Buffer Storage back to EFI variable
//
Status = gRT->SetVariable(
VariableName,
&mFormSetGuid,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
sizeof (DRIVER_SAMPLE_CONFIGURATION),
&PrivateData->Configuration
);
return Status;
}
/**
This function processes the results of changes in configuration.
@param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
@param Action Specifies the type of action taken by the browser.
@param QuestionId A unique value which is sent to the original
exporting driver so that it can identify the type
of data to expect.
@param Type The type of value for the question.
@param Value A pointer to the data being sent to the original
exporting driver.
@param ActionRequest On return, points to the action requested by the
callback function.
@retval EFI_SUCCESS The callback successfully handled the action.
@retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the
variable and its data.
@retval EFI_DEVICE_ERROR The variable could not be saved.
@retval EFI_UNSUPPORTED The specified Action is not supported by the
callback.
**/
EFI_STATUS
EFIAPI
DriverCallback (
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
IN EFI_BROWSER_ACTION Action,
IN EFI_QUESTION_ID QuestionId,
IN UINT8 Type,
IN EFI_IFR_TYPE_VALUE *Value,
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
)
{
DRIVER_SAMPLE_PRIVATE_DATA *PrivateData;
EFI_STATUS Status;
EFI_HII_UPDATE_DATA UpdateData;
IFR_OPTION *IfrOptionList;
if ((Value == NULL) || (ActionRequest == NULL)) {
return EFI_INVALID_PARAMETER;
}
Status = EFI_SUCCESS;
PrivateData = DRIVER_SAMPLE_PRIVATE_FROM_THIS (This);
switch (QuestionId) {
case 0x1234:
//
// Create dynamic page for this interactive goto
//
UpdateData.BufferSize = 0x1000;
UpdateData.Offset = 0;
UpdateData.Data = AllocatePool (0x1000);
ASSERT (UpdateData.Data != NULL);
IfrOptionList = AllocatePool (2 * sizeof (IFR_OPTION));
ASSERT (IfrOptionList != NULL);
IfrOptionList[0].Flags = 0;
IfrOptionList[0].StringToken = STRING_TOKEN (STR_BOOT_OPTION1);
IfrOptionList[0].Value.u8 = 1;
IfrOptionList[1].Flags = EFI_IFR_OPTION_DEFAULT;
IfrOptionList[1].StringToken = STRING_TOKEN (STR_BOOT_OPTION2);
IfrOptionList[1].Value.u8 = 2;
CreateActionOpCode (
0x1237,
STRING_TOKEN(STR_EXIT_TEXT),
STRING_TOKEN(STR_EXIT_TEXT),
EFI_IFR_FLAG_CALLBACK,
0,
&UpdateData
);
CreateOneOfOpCode (
0x8001,
0,
0,
STRING_TOKEN (STR_ONE_OF_PROMPT),
STRING_TOKEN (STR_ONE_OF_HELP),
EFI_IFR_FLAG_CALLBACK,
EFI_IFR_NUMERIC_SIZE_1,
IfrOptionList,
2,
&UpdateData
);
CreateOrderedListOpCode (
0x8002,
0,
0,
STRING_TOKEN (STR_BOOT_OPTIONS),
STRING_TOKEN (STR_BOOT_OPTIONS),
EFI_IFR_FLAG_RESET_REQUIRED,
0,
EFI_IFR_NUMERIC_SIZE_1,
10,
IfrOptionList,
2,
&UpdateData
);
CreateGotoOpCode (
1,
STRING_TOKEN (STR_GOTO_FORM1),
STRING_TOKEN (STR_GOTO_HELP),
0,
0x8003,
&UpdateData
);
Status = IfrLibUpdateForm (
PrivateData->HiiHandle[0],
&mFormSetGuid,
0x1234,
0x1234,
TRUE,
&UpdateData
);
gBS->FreePool (IfrOptionList);
gBS->FreePool (UpdateData.Data);
break;
case 0x1237:
//
// User press "Exit now", request Browser to exit
//
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
break;
case 0x1238:
//
// User press "Save now", request Browser to save the uncommitted data.
//
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;
break;
case 0x2000:
//
// When try to set a new password, user will be chanlleged with old password.
// The Callback is responsible for validating old password input by user,
// If Callback return EFI_SUCCESS, it indicates validation pass.
//
switch (PrivateData->PasswordState) {
case BROWSER_STATE_VALIDATE_PASSWORD:
Status = ValidatePassword (PrivateData, Value->string);
if (Status == EFI_SUCCESS) {
PrivateData->PasswordState = BROWSER_STATE_SET_PASSWORD;
}
break;
case BROWSER_STATE_SET_PASSWORD:
Status = SetPassword (PrivateData, Value->string);
PrivateData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;
break;
default:
break;
}
break;
default:
break;
}
return Status;
}
EFI_STATUS
EFIAPI
DriverSampleInit (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
EFI_STATUS SavedStatus;
EFI_HII_PACKAGE_LIST_HEADER *PackageList;
EFI_HII_HANDLE HiiHandle[2];
EFI_HANDLE DriverHandle[2];
DRIVER_SAMPLE_PRIVATE_DATA *PrivateData;
EFI_SCREEN_DESCRIPTOR Screen;
EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
EFI_HII_STRING_PROTOCOL *HiiString;
EFI_FORM_BROWSER2_PROTOCOL *FormBrowser2;
EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;
CHAR16 *NewString;
UINTN BufferSize;
DRIVER_SAMPLE_CONFIGURATION *Configuration;
BOOLEAN ExtractIfrDefault;
//
// Initialize the library and our protocol.
//
//@MT: EfiInitializeDriverLib (ImageHandle, SystemTable);
//
// Initialize screen dimensions for SendForm().
// Remove 3 characters from top and bottom
//
ZeroMem (&Screen, sizeof (EFI_SCREEN_DESCRIPTOR));
gST->ConOut->QueryMode (gST->ConOut, gST->ConOut->Mode->Mode, &Screen.RightColumn, &Screen.BottomRow);
Screen.TopRow = 3;
Screen.BottomRow = Screen.BottomRow - 3;
//
// Initialize driver private data
//
PrivateData = AllocatePool (sizeof (DRIVER_SAMPLE_PRIVATE_DATA));
if (PrivateData == NULL) {
return EFI_OUT_OF_RESOURCES;
}
PrivateData->Signature = DRIVER_SAMPLE_PRIVATE_SIGNATURE;
PrivateData->ConfigAccess.ExtractConfig = ExtractConfig;
PrivateData->ConfigAccess.RouteConfig = RouteConfig;
PrivateData->ConfigAccess.Callback = DriverCallback;
PrivateData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;
//
// Locate Hii Database protocol
//
Status = gBS->LocateProtocol (&gEfiHiiDatabaseProtocolGuid, NULL, (VOID **) &HiiDatabase);
if (EFI_ERROR (Status)) {
return Status;
}
PrivateData->HiiDatabase = HiiDatabase;
//
// Locate HiiString protocol
//
Status = gBS->LocateProtocol (&gEfiHiiStringProtocolGuid, NULL, (VOID **) &HiiString);
if (EFI_ERROR (Status)) {
return Status;
}
PrivateData->HiiString = HiiString;
//
// Locate Formbrowser2 protocol
//
Status = gBS->LocateProtocol (&gEfiFormBrowser2ProtocolGuid, NULL, (VOID **) &FormBrowser2);
if (EFI_ERROR (Status)) {
return Status;
}
PrivateData->FormBrowser2 = FormBrowser2;
//
// Locate ConfigRouting protocol
//
Status = gBS->LocateProtocol (&gEfiHiiConfigRoutingProtocolGuid, NULL, (VOID **) &HiiConfigRouting);
if (EFI_ERROR (Status)) {
return Status;
}
PrivateData->HiiConfigRouting = HiiConfigRouting;
//
// Install Config Access protocol
//
Status = HiiLibCreateHiiDriverHandle (&DriverHandle[0]);
if (EFI_ERROR (Status)) {
return Status;
}
PrivateData->DriverHandle[0] = DriverHandle[0];
Status = gBS->InstallProtocolInterface (
&DriverHandle[0],
&gEfiHiiConfigAccessProtocolGuid,
EFI_NATIVE_INTERFACE,
&PrivateData->ConfigAccess
);
ASSERT_EFI_ERROR (Status);
//
// Publish our HII data
//
PackageList = PreparePackageList (
2,
&mFormSetGuid,
DriverSampleStrings,
VfrBin
);
if (PackageList == NULL) {
return EFI_OUT_OF_RESOURCES;
}
Status = HiiDatabase->NewPackageList (
HiiDatabase,
PackageList,
DriverHandle[0],
&HiiHandle[0]
);
gBS->FreePool (PackageList);
if (EFI_ERROR (Status)) {
return Status;
}
PrivateData->HiiHandle[0] = HiiHandle[0];
//
// Publish another Fromset
//
Status = HiiLibCreateHiiDriverHandle (&DriverHandle[1]);
if (EFI_ERROR (Status)) {
return Status;
}
PrivateData->DriverHandle[1] = DriverHandle[1];
PackageList = PreparePackageList (
2,
&mInventoryGuid,
DriverSampleStrings,
InventoryBin
);
if (PackageList == NULL) {
return EFI_OUT_OF_RESOURCES;
}
Status = HiiDatabase->NewPackageList (
HiiDatabase,
PackageList,
DriverHandle[1],
&HiiHandle[1]
);
gBS->FreePool (PackageList);
if (EFI_ERROR (Status)) {
return Status;
}
PrivateData->HiiHandle[1] = HiiHandle[1];
//
// Very simple example of how one would update a string that is already
// in the HII database
//
NewString = L"700 Mhz";
Status = IfrLibSetString (HiiHandle[0], STRING_TOKEN (STR_CPU_STRING2), NewString);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Initialize configuration data
//
Configuration = &PrivateData->Configuration;
ZeroMem (Configuration, sizeof (DRIVER_SAMPLE_CONFIGURATION));
//
// Try to read NV config EFI variable first
//
ExtractIfrDefault = TRUE;
BufferSize = sizeof (DRIVER_SAMPLE_CONFIGURATION);
Status = gRT->GetVariable (VariableName, &mFormSetGuid, NULL, &BufferSize, Configuration);
if (!EFI_ERROR (Status) && (BufferSize == sizeof (DRIVER_SAMPLE_CONFIGURATION))) {
ExtractIfrDefault = FALSE;
}
if (ExtractIfrDefault) {
//
// EFI variable for NV config doesn't exit, we should build this variable
// based on default values stored in IFR
//
BufferSize = sizeof (DRIVER_SAMPLE_CONFIGURATION);
Status = ExtractDefault (Configuration, &BufferSize, 1, VfrMyIfrNVDataDefault0000);
if (!EFI_ERROR (Status)) {
gRT->SetVariable(
VariableName,
&mFormSetGuid,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
sizeof (DRIVER_SAMPLE_CONFIGURATION),
Configuration
);
}
}
//
// Example of how to display only the item we sent to HII
//
if (DISPLAY_ONLY_MY_ITEM == 0x0001) {
//
// Have the browser pull out our copy of the data, and only display our data
//
// Status = FormConfig->SendForm (FormConfig, TRUE, HiiHandle, NULL, NULL, NULL, &Screen, NULL);
//
Status = FormBrowser2->SendForm (
FormBrowser2,
HiiHandle,
1,
NULL,
0,
NULL,
NULL
);
SavedStatus = Status;
Status = HiiDatabase->RemovePackageList (HiiDatabase, HiiHandle[0]);
if (EFI_ERROR (Status)) {
return Status;
}
Status = HiiDatabase->RemovePackageList (HiiDatabase, HiiHandle[1]);
if (EFI_ERROR (Status)) {
return Status;
}
return SavedStatus;
} else {
//
// Have the browser pull out all the data in the HII Database and display it.
//
// Status = FormConfig->SendForm (FormConfig, TRUE, 0, NULL, NULL, NULL, NULL, NULL);
//
}
return EFI_SUCCESS;
}

View File

@@ -0,0 +1,97 @@
/** @file
Copyright (c) 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
DriverSample.h
Abstract:
Revision History
**/
#ifndef _DRIVER_SAMPLE_H
#define _DRIVER_SAMPLE_H
#include <PiDxe.h>
#include <Protocol/HiiConfigRouting.h>
#include <Protocol/FormBrowser2.h>
#include <Protocol/HiiConfigAccess.h>
#include <Protocol/HiiDatabase.h>
#include <Protocol/HiiString.h>
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/IfrSupportLib.h>
#include <Library/HiiLib.h>
#include <MdeModuleHii.h>
#include "NVDataStruc.h"
//
// This is the generated <AltResp> for defaults defined in VFR
//
extern UINT8 VfrMyIfrNVDataDefault0000[];
//
// This is the generated IFR binary data for each formset defined in VFR.
// This data array is ready to be used as input of PreparePackageList() to
// create a packagelist (which contains Form packages, String packages, etc).
//
extern UINT8 VfrBin[];
extern UINT8 InventoryBin[];
//
// This is the generated String package data for all .UNI files.
// This data array is ready to be used as input of PreparePackageList() to
// create a packagelist (which contains Form packages, String packages, etc).
//
extern UINT8 DriverSampleStrings[];
#define SAMPLE_STRING L"This is an error!"
#define DRIVER_SAMPLE_PRIVATE_SIGNATURE EFI_SIGNATURE_32 ('D', 'S', 'p', 's')
typedef struct {
UINTN Signature;
EFI_HANDLE DriverHandle[2];
EFI_HII_HANDLE HiiHandle[2];
DRIVER_SAMPLE_CONFIGURATION Configuration;
UINT8 PasswordState;
//
// Consumed protocol
//
EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
EFI_HII_STRING_PROTOCOL *HiiString;
EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;
EFI_FORM_BROWSER2_PROTOCOL *FormBrowser2;
//
// Produced protocol
//
EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
} DRIVER_SAMPLE_PRIVATE_DATA;
#define DRIVER_SAMPLE_PRIVATE_FROM_THIS(a) CR (a, DRIVER_SAMPLE_PRIVATE_DATA, ConfigAccess, DRIVER_SAMPLE_PRIVATE_SIGNATURE)
#endif

View File

@@ -0,0 +1,72 @@
#/** @file
# Component name for module DriverSample
#
# FIX ME!
# Copyright (c) 2007, Intel Corporation. All rights reserved.
#
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
#
#**/
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = DriverSample
FILE_GUID = FE3542FE-C1D3-4EF8-657C-8048606FF671
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x0002000A
ENTRY_POINT = DriverSampleInit
#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
#
[Sources.common]
DriverSample.c
inventorystrings.uni
NVDataStruc.h
VfrStrings.uni
DriverSample.h
Inventory.vfr
Vfr.vfr
VfrStrings.uni
[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
[LibraryClasses]
MemoryAllocationLib
UefiBootServicesTableLib
UefiDriverEntryPoint
UefiRuntimeServicesTableLib
BaseMemoryLib
DebugLib
HiiLib
IfrSupportLib
BaseLib
[Protocols]
gEfiHiiStringProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiHiiConfigRoutingProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiHiiConfigAccessProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiFormBrowser2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiHiiDatabaseProtocolGuid # PROTOCOL ALWAYS_CONSUMED
[Depex]
gEfiSimpleTextOutProtocolGuid AND gEfiHiiDatabaseProtocolGuid

View File

@@ -0,0 +1,80 @@
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<MsaHeader>
<ModuleName>DriverSample</ModuleName>
<ModuleType>DXE_DRIVER</ModuleType>
<GuidValue>FE3542FE-C1D3-4EF8-657C-8048606FF671</GuidValue>
<Version>1.0</Version>
<Abstract>Component name for module DriverSample</Abstract>
<Description>FIX ME!</Description>
<Copyright>Copyright (c) 2007, Intel Corporation. All rights reserved.</Copyright>
<License>All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
<Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
</MsaHeader>
<ModuleDefinitions>
<SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
<BinaryModule>false</BinaryModule>
<OutputFileBasename>DriverSample</OutputFileBasename>
</ModuleDefinitions>
<LibraryClassDefinitions>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>DebugLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>BaseMemoryLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>UefiRuntimeServicesTableLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>UefiDriverEntryPoint</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>UefiBootServicesTableLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>MemoryAllocationLib</Keyword>
</LibraryClass>
</LibraryClassDefinitions>
<SourceFiles>
<Filename>DriverSample.h</Filename>
<Filename>VfrStrings.uni</Filename>
<Filename>NVDataStruc.h</Filename>
<Filename>inventorystrings.uni</Filename>
<Filename>DriverSample.c</Filename>
<Filename>DriverSample.dxs</Filename>
</SourceFiles>
<PackageDependencies>
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
<Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
</PackageDependencies>
<Protocols>
<Protocol Usage="ALWAYS_CONSUMED">
<ProtocolCName>gEfiHiiDatabaseProtocolGuid</ProtocolCName>
</Protocol>
<Protocol Usage="ALWAYS_CONSUMED">
<ProtocolCName>gEfiFormBrowser2ProtocolGuid</ProtocolCName>
</Protocol>
<Protocol Usage="ALWAYS_CONSUMED">
<ProtocolCName>gEfiHiiConfigAccessProtocolGuid</ProtocolCName>
</Protocol>
<Protocol Usage="ALWAYS_CONSUMED">
<ProtocolCName>gEfiHiiConfigRoutingProtocolGuid</ProtocolCName>
</Protocol>
<Protocol Usage="ALWAYS_CONSUMED">
<ProtocolCName>gEfiHiiStringProtocolGuid</ProtocolCName>
</Protocol>
</Protocols>
<Externs>
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
<Extern>
<ModuleEntryPoint>DriverSampleInit</ModuleEntryPoint>
</Extern>
</Externs>
</ModuleSurfaceArea>

View File

@@ -0,0 +1,64 @@
/** @file
Copyright (c) 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
NVDataStruc.h
Abstract:
NVData structure used by the sample driver
Revision History:
**/
#ifndef _NVDATASTRUC_H
#define _NVDATASTRUC_H
#define FORMSET_GUID \
{ \
0xA04A27f4, 0xDF00, 0x4D42, 0xB5, 0x52, 0x39, 0x51, 0x13, 0x02, 0x11, 0x3D \
}
#define INVENTORY_GUID \
{ \
0xb3f56470, 0x6141, 0x4621, 0x8f, 0x19, 0x70, 0x4e, 0x57, 0x7a, 0xa9, 0xe8 \
}
#define VAR_EQ_TEST_NAME 0x100
#pragma pack(1)
typedef struct {
UINT16 WhatIsThePassword[20];
UINT16 WhatIsThePassword2[20];
UINT16 MyStringData[20];
UINT16 PasswordClearText[20];
UINT16 SomethingHiddenForHtml;
UINT8 HowOldAreYouInYearsManual;
UINT16 HowTallAreYouManual;
UINT8 HowOldAreYouInYears;
UINT16 HowTallAreYou;
UINT8 MyFavoriteNumber;
UINT8 TestLateCheck;
UINT8 TestLateCheck2;
UINT8 QuestionAboutTreeHugging;
UINT8 ChooseToActivateNuclearWeaponry;
UINT8 SuppressGrayOutSomething;
UINT8 OrderedList[8];
UINT8 BootOrder[8];
UINT8 BootOrderLarge;
UINT8 DynamicCheck;
} DRIVER_SAMPLE_CONFIGURATION;
#pragma pack()
#endif

View File

@@ -0,0 +1,504 @@
// *++
//
// Copyright (c) 2007, Intel Corporation
// All rights reserved. This program and the accompanying materials
// are licensed and made available under the terms and conditions of the BSD License
// which accompanies this distribution. The full text of the license may be found at
// http://opensource.org/licenses/bsd-license.php
//
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
//
// Module Name:
//
// Vfr.vfr
//
// Abstract:
//
// Sample Setup formset
//
// Revision History:
//
// --*/
#include "NVDataStruc.h"
//
// Formset class used by Device Manager
//
#define EFI_NON_DEVICE_CLASS 0x00
#define EFI_DISK_DEVICE_CLASS 0x01
#define EFI_VIDEO_DEVICE_CLASS 0x02
#define EFI_NETWORK_DEVICE_CLASS 0x04
#define EFI_INPUT_DEVICE_CLASS 0x08
#define EFI_ON_BOARD_DEVICE_CLASS 0x10
#define EFI_OTHER_DEVICE_CLASS 0x20
//
// Formset subclass
//
#define EFI_SETUP_APPLICATION_SUBCLASS 0x00
#define EFI_GENERAL_APPLICATION_SUBCLASS 0x01
#define EFI_FRONT_PAGE_SUBCLASS 0x02
#define EFI_SINGLE_USE_SUBCLASS 0x03
//
// EFI Variable attributes
//
#define EFI_VARIABLE_NON_VOLATILE 0x00000001
#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002
#define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004
#define EFI_VARIABLE_READ_ONLY 0x00000008
//
// NV data structure definition
//
typedef struct {
UINT8 Field8;
UINT16 Field16;
UINT8 OrderedList[3];
} MY_DATA2;
//
// Labels definition
//
#define LABEL_1_VALUE 0x01
#define LABEL_2_VALUE 0x1000
#define LABEL_UPDATE_BBS 0x2222
#define LABEL_END 0x2223
formset
guid = FORMSET_GUID,
title = STRING_TOKEN(STR_FORM_SET_TITLE),
help = STRING_TOKEN(STR_FORM_SET_TITLE_HELP),
class = EFI_ON_BOARD_DEVICE_CLASS,
subclass = EFI_SETUP_APPLICATION_SUBCLASS,
//
// Define a Buffer Storage (EFI_IFR_VARSTORE)
//
varstore DRIVER_SAMPLE_CONFIGURATION, // This is the data structure type
varid = 0x1234, // Optional VarStore ID
name = MyIfrNVData, // Define referenced name in vfr
guid = FORMSET_GUID; // GUID of this buffer storage
//
// Define another Buffer Storage
//
varstore MY_DATA2,
name = MyIfrNVData2,
guid = FORMSET_GUID;
//
// Define a EFI variable Storage (EFI_IFR_VARSTORE_EFI)
//
efivarstore MyEfiVar, // Define referenced name in vfr
attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS, // EFI variable attribures
name = STRING_TOKEN(STR_VAR_NAME), // EFI variable name
varsize = 1, // Size of the EFI variable
guid = FORMSET_GUID; // EFI variable GUID
//
// Define a Form (EFI_IFR_FORM)
//
form formid = 1, // Form ID
title = STRING_TOKEN(STR_FORM1_TITLE); // Form title
subtitle text = STRING_TOKEN(STR_SUBTITLE_TEXT);
subtitle text = STRING_TOKEN(STR_SUBTITLE_TEXT2);
//
// Define a display only text (EFI_IFR_TEXT)
//
text
help = STRING_TOKEN(STR_TEXT_HELP), // Help string
text = STRING_TOKEN(STR_CPU_STRING), // Prompt string
text = STRING_TOKEN(STR_CPU_STRING2); // TextTwo
text
help = STRING_TOKEN(STR_EXIT_TEXT),
text = STRING_TOKEN(STR_EXIT_TEXT),
text = STRING_TOKEN(STR_EXIT_TEXT),
flags = INTERACTIVE,
key = 0x1237;
text
help = STRING_TOKEN(STR_SAVE_TEXT),
text = STRING_TOKEN(STR_SAVE_TEXT),
text = STRING_TOKEN(STR_SAVE_TEXT),
flags = INTERACTIVE,
key = 0x1238;
//
// Define oneof (EFI_IFR_ONE_OF)
//
oneof varid = MyIfrNVData.SuppressGrayOutSomething, // Use "DataStructure.Member" to reference Buffer Storage
prompt = STRING_TOKEN(STR_ONE_OF_PROMPT),
help = STRING_TOKEN(STR_ONE_OF_HELP),
//
// Define an option (EFI_IFR_ONE_OF_OPTION)
//
option text = STRING_TOKEN(STR_ONE_OF_TEXT4), value = 0x0, flags = 0;
option text = STRING_TOKEN(STR_ONE_OF_TEXT5), value = 0x1, flags = 0;
//
// DEFAULT indicate this option will be marked with EFI_IFR_OPTION_DEFAULT
//
option text = STRING_TOKEN(STR_ONE_OF_TEXT6), value = 0x2, flags = DEFAULT;
endoneof;
oneof varid = MyIfrNVData.BootOrderLarge,
prompt = STRING_TOKEN(STR_ONE_OF_PROMPT),
help = STRING_TOKEN(STR_ONE_OF_HELP),
option text = STRING_TOKEN(STR_BOOT_ORDER1), value = 0x0, flags = 0;
option text = STRING_TOKEN(STR_BOOT_ORDER2), value = 0x1, flags = DEFAULT;
endoneof;
grayoutif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x1;
suppressif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x0;
checkbox varid = MyIfrNVData.ChooseToActivateNuclearWeaponry,
prompt = STRING_TOKEN(STR_CHECK_BOX_PROMPT),
help = STRING_TOKEN(STR_CHECK_BOX_HELP),
//
// CHECKBOX_DEFAULT indicate this checkbox is marked with EFI_IFR_CHECKBOX_DEFAULT
//
flags = CHECKBOX_DEFAULT,
key = 0,
endcheckbox;
endif;
endif;
//
// Ordered list:
// sizeof(MyIfrNVData) storage must be UINT8 array, and
// size written for the variable must be size of the entire
// variable.
//
//
suppressif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x0;
//
// label is defined as an anchor where you want to insert some dynamic
// opcodes created on-the-fly
//
label LABEL_UPDATE_BBS;
orderedlist
varid = MyIfrNVData.BootOrder,
prompt = STRING_TOKEN(STR_BOOT_OPTIONS),
help = STRING_TOKEN(STR_NULL_STRING),
option text = STRING_TOKEN(STR_BOOT_OPTION2), value = 2, flags = RESET_REQUIRED;
option text = STRING_TOKEN(STR_BOOT_OPTION1), value = 1, flags = RESET_REQUIRED;
option text = STRING_TOKEN(STR_BOOT_OPTION3), value = 3, flags = RESET_REQUIRED;
suppressif ideqval MyIfrNVData.BootOrderLarge == 0;
option text = STRING_TOKEN(STR_BOOT_OPTION4), value = 4, flags = 0;
endif
endlist;
//
// label should be paired with each other
//
label LABEL_END;
endif; // end suppressif
suppressif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x2;
orderedlist
varid = MyIfrNVData.OrderedList,
prompt = STRING_TOKEN(STR_TEST_OPCODE),
help = STRING_TOKEN(STR_TEXT_HELP),
option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 3, flags = RESET_REQUIRED;
option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 2, flags = RESET_REQUIRED;
option text = STRING_TOKEN(STR_ONE_OF_TEXT3), value = 1, flags = RESET_REQUIRED;
endlist;
endif;
label 100;
//
// Define a hyperlink (EFI_IFR_REF)
//
goto 0x1234, // Destination Form ID
prompt = STRING_TOKEN(STR_GOTO_DYNAMIC), // Prompt string
help = STRING_TOKEN(STR_GOTO_HELP), // Help string
flags = INTERACTIVE, // INTERACTIVE indicate it's marked with EFI_IFR_FLAG_CALLBACK
key = 0x1234; // Question ID which will be passed-in in COnfigAccess.Callback()
goto 0x1234,
prompt = STRING_TOKEN(STR_GOTO_DYNAMIC2),
help = STRING_TOKEN(STR_GOTO_HELP),
flags = INTERACTIVE,
key = 0x1235;
oneof varid = MyIfrNVData.TestLateCheck,
prompt = STRING_TOKEN(STR_TEST_OPCODE),
help = STRING_TOKEN(STR_ONE_OF_HELP),
option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = RESET_REQUIRED;
option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = DEFAULT | RESET_REQUIRED;
endoneof;
oneof varid = MyIfrNVData.TestLateCheck2,
prompt = STRING_TOKEN(STR_TEST_OPCODE2),
help = STRING_TOKEN(STR_ONE_OF_HELP),
option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = DEFAULT | RESET_REQUIRED;
option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = RESET_REQUIRED;
inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
ideqid MyIfrNVData.TestLateCheck == MyIfrNVData.TestLateCheck2
endif
endoneof;
oneof varid = MyIfrNVData.QuestionAboutTreeHugging,
prompt = STRING_TOKEN(STR_ONE_OF_PROMPT),
help = STRING_TOKEN(STR_ONE_OF_HELP),
option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = RESET_REQUIRED;
option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = DEFAULT | RESET_REQUIRED;
option text = STRING_TOKEN(STR_ONE_OF_TEXT3), value = 0x03, flags = RESET_REQUIRED;
endoneof;
//
// Define a string (EFI_IFR_STRING)
//
string varid = MyIfrNVData.MyStringData,
prompt = STRING_TOKEN(STR_MY_STRING_PROMPT2),
help = STRING_TOKEN(STR_MY_STRING_HELP2),
flags = INTERACTIVE,
key = 0x1236,
minsize = 6,
maxsize = 20,
endstring;
//
// Define a numeric (EFI_IFR_NUMERIC)
//
numeric varid = MyIfrNVData.HowOldAreYouInYearsManual,
prompt = STRING_TOKEN(STR_NUMERIC_READONLY_PROMPT),
help = STRING_TOKEN(STR_NUMERIC_HELP0),
flags = READ_ONLY, // READ_ONLY indicate it's marked with EFI_IFR_FLAG_READ_ONLY
minimum = 0,
maximum = 0xf0,
step = 0, // Stepping of 0 equates to a manual entering
// of a value, otherwise it will be adjusted by "+"/"-"
default = 20,
endnumeric;
numeric varid = MyIfrNVData.HowOldAreYouInYearsManual,
prompt = STRING_TOKEN(STR_NUMERIC_MANUAL_PROMPT),
help = STRING_TOKEN(STR_NUMERIC_HELP0),
minimum = 0,
maximum = 0xf0,
step = 0,
default = 21,
inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
ideqval MyIfrNVData.HowOldAreYouInYearsManual == 99
OR
ideqid MyIfrNVData.HowOldAreYouInYearsManual == MyEfiVar
OR
ideqvallist MyIfrNVData.HowOldAreYouInYearsManual == 1 3 5 7
endif
endnumeric;
numeric varid = MyEfiVar, // Reference of EFI variable storage
prompt = STRING_TOKEN(STR_TALL_HEX_PROMPT),
help = STRING_TOKEN(STR_NUMERIC_HELP1),
flags = DISPLAY_UINT_HEX, // Display in HEX format (if not specified, default is in decimal format)
minimum = 0,
maximum = 250,
default = 175,
endnumeric;
label LABEL_1_VALUE;
label LABEL_2_VALUE;
grayoutif ideqval MyIfrNVData.HowOldAreYouInYearsManual == 23 AND ideqval MyIfrNVData.SuppressGrayOutSomething == 0x1;
numeric varid = MyIfrNVData.HowOldAreYouInYears,
prompt = STRING_TOKEN(STR_NUMERIC_STEP_PROMPT),
help = STRING_TOKEN(STR_NUMERIC_HELP2),
minimum = 0,
maximum = 243,
step = 1,
default = 18,
endnumeric;
endif;
//
// Non-interactive password, validate by Setup Browser
//
password varid = MyIfrNVData.WhatIsThePassword,
prompt = STRING_TOKEN(STR_PASSWORD_PROMPT),
help = STRING_TOKEN(STR_PASSWORD_HELP),
minsize = 6,
maxsize = 20, // new opcode
endpassword;
string varid = MyIfrNVData.PasswordClearText,
prompt = STRING_TOKEN(STR_MY_STRING_PROMPT),
help = STRING_TOKEN(STR_MY_STRING_HELP),
minsize = 6,
maxsize = 0x14,
endstring;
//
// Interactive password, validate via ConfigAccess.Callback()
//
password varid = MyIfrNVData.WhatIsThePassword2,
prompt = STRING_TOKEN(STR_PASSWORD_CALLBACK_PROMPT),
help = STRING_TOKEN(STR_PASSWORD_HELP),
flags = INTERACTIVE,
key = 0x2000,
minsize = 6,
maxsize = 20, // new opcode
endpassword;
goto 2,
prompt = STRING_TOKEN(STR_GOTO_FORM2), //SecondSetupPage // this too has no end-op and basically it's a jump to a form ONLY
help = STRING_TOKEN(STR_GOTO_HELP);
goto 3,
prompt = STRING_TOKEN(STR_GOTO_FORM3), //ThirdSetupPage // this too has no end-op and basically it's a jump to a form ONLY
help = STRING_TOKEN(STR_GOTO_HELP);
endform;
form formid = 2, // SecondSetupPage,
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
date year varid = Date.Year, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
prompt = STRING_TOKEN(STR_DATE_PROMPT),
help = STRING_TOKEN(STR_DATE_YEAR_HELP),
minimum = 1998,
maximum = 2099,
step = 1,
default = 2004,
month varid = Date.Month, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
prompt = STRING_TOKEN(STR_DATE_PROMPT),
help = STRING_TOKEN(STR_DATE_MONTH_HELP),
minimum = 1,
maximum = 12,
step = 1,
default = 1,
day varid = Date.Day, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
prompt = STRING_TOKEN(STR_DATE_PROMPT),
help = STRING_TOKEN(STR_DATE_DAY_HELP),
minimum = 1,
maximum = 31,
step = 0x1,
default = 1,
inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
ideqval Date.Day == 31
AND
ideqvallist Date.Month == 2 4 6 9 11
endif
//
// If the day is 30 AND month is 2
//
inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
ideqval Date.Day == 30
AND
ideqval Date.Month == 2
endif
//
// If the day is 29 AND month is 2 AND it year is NOT a leapyear
//
inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
ideqval Date.Day == 0x1D
AND
ideqval Date.Month == 2
AND
NOT
ideqvallist Date.Year == 2004 2008 20012 20016 2020 2024 2028 2032 2036
endif
enddate;
time hour varid = Time.Hours, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
prompt = STRING_TOKEN(STR_TIME_PROMPT),
help = STRING_TOKEN(STR_TIME_HOUR_HELP),
minimum = 0,
maximum = 23,
step = 1,
default = 0,
minute varid = Time.Minutes, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
prompt = STRING_TOKEN(STR_TIME_PROMPT),
help = STRING_TOKEN(STR_TIME_MINUTE_HELP),
minimum = 0,
maximum = 59,
step = 1,
default = 0,
second varid = Time.Seconds, // Note that it is a member of NULL, so the RTC will be the system resource to retrieve and save from
prompt = STRING_TOKEN(STR_TIME_PROMPT),
help = STRING_TOKEN(STR_TIME_SECOND_HELP),
minimum = 0,
maximum = 59,
step = 1,
default = 0,
endtime;
checkbox varid = MyIfrNVData.ChooseToActivateNuclearWeaponry,
prompt = STRING_TOKEN(STR_CHECK_BOX_PROMPT),
help = STRING_TOKEN(STR_CHECK_BOX_HELP),
flags = CHECKBOX_DEFAULT,
key = 0,
endcheckbox;
text
help = STRING_TOKEN(STR_TEXT_HELP),
text = STRING_TOKEN(STR_TEXT_TEXT_1);
text
help = STRING_TOKEN(STR_TEXT_HELP),
text = STRING_TOKEN(STR_TEXT_TEXT_1),
text = STRING_TOKEN(STR_TEXT_TEXT_2);
goto 1,
prompt = STRING_TOKEN(STR_GOTO_FORM1), //MainSetupPage // this too has no end-op and basically it's a jump to a form ONLY
help = STRING_TOKEN(STR_GOTO_HELP);
endform;
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
grayoutif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x1;
text
help = STRING_TOKEN(STR_TEXT_HELP),
text = STRING_TOKEN(STR_TEXT_TEXT_1);
endif;
endform;
form formid = 4, title = STRING_TOKEN(STR_FORM3_TITLE);
endform;
form formid = 0x1234, // Dynamically created page,
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
label 0x1234;
//
// This is where we will insert dynamic created opcodes
//
label LABEL_END;
endform;
endformset;

Binary file not shown.

View File

@@ -0,0 +1,121 @@
// *++
//
// Copyright (c) 2007, Intel Corporation
// All rights reserved. This program and the accompanying materials
// are licensed and made available under the terms and conditions of the BSD License
// which accompanies this distribution. The full text of the license may be found at
// http://opensource.org/licenses/bsd-license.php
//
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
//
// Module Name:
//
// Inventory.vfr
//
// Abstract:
//
// Sample Inventory Data.
//
// Revision History:
//
// --*/
#define INVENTORY_GUID { 0xb3f56470, 0x6141, 0x4621, 0x8f, 0x19, 0x70, 0x4e, 0x57, 0x7a, 0xa9, 0xe8 }
formset
guid = INVENTORY_GUID,
title = STRING_TOKEN(STR_INV_FORM_SET_TITLE),
help = STRING_TOKEN(STR_INV_FORM_SET_HELP),
class = 0x04,
subclass = 0x03,
form formid = 1,
title = STRING_TOKEN(STR_INV_FORM1_TITLE); // note formid is a variable (for readability) (UINT16) - also added Form to the line to signify the Op-Code
text
help = STRING_TOKEN(STR_INV_VERSION_HELP),
text = STRING_TOKEN(STR_INV_VERSION_TEXT),
text = STRING_TOKEN(STR_INV_EMPTY_STRING),
flags = 0,
key = 0;
text
help = STRING_TOKEN(STR_INV_EMPTY_STRING),
text = STRING_TOKEN(STR_INV_VERSION_TEXT2),
text = STRING_TOKEN(STR_INV_EMPTY_STRING),
flags = 0,
key = 0;
text
help = STRING_TOKEN(STR_INV_EMPTY_STRING),
text = STRING_TOKEN(STR_INV_VERSION_TEXT3),
text = STRING_TOKEN(STR_INV_EMPTY_STRING),
flags = 0,
key = 0;
text
help = STRING_TOKEN(STR_INV_EMPTY_STRING),
text = STRING_TOKEN(STR_INV_VERSION_TEXT4),
text = STRING_TOKEN(STR_INV_EMPTY_STRING),
flags = 0,
key = 0;
subtitle text = STRING_TOKEN(STR_INV_EMPTY_STRING);
text
help = STRING_TOKEN(STR_INV_EMPTY_STRING),
text = STRING_TOKEN(STR_INV_VERSION_TEXT5),
text = STRING_TOKEN(STR_INV_EMPTY_STRING),
flags = 0,
key = 0;
text
help = STRING_TOKEN(STR_INV_EMPTY_STRING),
text = STRING_TOKEN(STR_INV_VERSION_TEXT6),
text = STRING_TOKEN(STR_INV_EMPTY_STRING),
flags = 0,
key = 0;
text
help = STRING_TOKEN(STR_INV_EMPTY_STRING),
text = STRING_TOKEN(STR_INV_VERSION_TEXT7),
text = STRING_TOKEN(STR_INV_EMPTY_STRING),
flags = 0,
key = 0;
text
help = STRING_TOKEN(STR_INV_EMPTY_STRING),
text = STRING_TOKEN(STR_INV_VERSION_TEXT8),
text = STRING_TOKEN(STR_INV_EMPTY_STRING),
flags = 0,
key = 0;
text
help = STRING_TOKEN(STR_INV_EMPTY_STRING),
text = STRING_TOKEN(STR_INV_VERSION_TEXT9),
text = STRING_TOKEN(STR_INV_EMPTY_STRING),
flags = 0,
key = 0;
text
help = STRING_TOKEN(STR_INV_EMPTY_STRING),
text = STRING_TOKEN(STR_INV_VERSION_TEXT10),
text = STRING_TOKEN(STR_INV_EMPTY_STRING),
flags = 0,
key = 0;
text
help = STRING_TOKEN(STR_INV_EMPTY_STRING),
text = STRING_TOKEN(STR_INV_VERSION_TEXT11),
text = STRING_TOKEN(STR_INV_EMPTY_STRING),
flags = 0,
key = 0;
subtitle text = STRING_TOKEN(STR_INV_EMPTY_STRING);
subtitle text = STRING_TOKEN(STR_INV_VERSION_TEXT12);
endform;
endformset;