summaryrefslogtreecommitdiffstats
path: root/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe
diff options
context:
space:
mode:
Diffstat (limited to 'src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe')
-rw-r--r--src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c2239
-rw-r--r--src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.h122
-rw-r--r--src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.uni17
-rw-r--r--src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf96
-rw-r--r--src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/DriverSampleExtra.uni14
-rw-r--r--src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/Inventory.vfr111
-rw-r--r--src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/InventoryStrings.uni60
-rw-r--r--src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h132
-rw-r--r--src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr968
-rw-r--r--src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni436
10 files changed, 4195 insertions, 0 deletions
diff --git a/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c b/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
new file mode 100644
index 00000000..c15cea19
--- /dev/null
+++ b/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
@@ -0,0 +1,2239 @@
+/** @file
+This is an example of how a driver might export data to the HII protocol to be
+later utilized by the Setup Protocol
+
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+
+#include "DriverSample.h"
+
+#define DISPLAY_ONLY_MY_ITEM 0x0002
+
+CHAR16 VariableName[] = L"MyIfrNVData";
+CHAR16 MyEfiVar[] = L"MyEfiVar";
+CHAR16 MyEfiBitVar[] = L"MyEfiBitVar";
+CHAR16 MyEfiUnionVar[] = L"MyEfiUnionVar";
+
+EFI_HANDLE DriverHandle[2] = {NULL, NULL};
+DRIVER_SAMPLE_PRIVATE_DATA *mPrivateData = NULL;
+EFI_EVENT mEvent;
+
+HII_VENDOR_DEVICE_PATH mHiiVendorDevicePath0 = {
+ {
+ {
+ HARDWARE_DEVICE_PATH,
+ HW_VENDOR_DP,
+ {
+ (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
+ (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
+ }
+ },
+ DRIVER_SAMPLE_FORMSET_GUID
+ },
+ {
+ END_DEVICE_PATH_TYPE,
+ END_ENTIRE_DEVICE_PATH_SUBTYPE,
+ {
+ (UINT8) (END_DEVICE_PATH_LENGTH),
+ (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)
+ }
+ }
+};
+
+HII_VENDOR_DEVICE_PATH mHiiVendorDevicePath1 = {
+ {
+ {
+ HARDWARE_DEVICE_PATH,
+ HW_VENDOR_DP,
+ {
+ (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
+ (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
+ }
+ },
+ DRIVER_SAMPLE_INVENTORY_GUID
+ },
+ {
+ END_DEVICE_PATH_TYPE,
+ END_ENTIRE_DEVICE_PATH_SUBTYPE,
+ {
+ (UINT8) (END_DEVICE_PATH_LENGTH),
+ (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)
+ }
+ }
+};
+
+/**
+ Set value of a data element in an Array by its Index.
+
+ @param Array The data array.
+ @param Type Type of the data in this array.
+ @param Index Zero based index for data in this array.
+ @param Value The value to be set.
+
+**/
+VOID
+SetArrayData (
+ IN VOID *Array,
+ IN UINT8 Type,
+ IN UINTN Index,
+ IN UINT64 Value
+ )
+{
+
+ ASSERT (Array != NULL);
+
+ switch (Type) {
+ case EFI_IFR_TYPE_NUM_SIZE_8:
+ *(((UINT8 *) Array) + Index) = (UINT8) Value;
+ break;
+
+ case EFI_IFR_TYPE_NUM_SIZE_16:
+ *(((UINT16 *) Array) + Index) = (UINT16) Value;
+ break;
+
+ case EFI_IFR_TYPE_NUM_SIZE_32:
+ *(((UINT32 *) Array) + Index) = (UINT32) Value;
+ break;
+
+ case EFI_IFR_TYPE_NUM_SIZE_64:
+ *(((UINT64 *) Array) + Index) = (UINT64) Value;
+ break;
+
+ default:
+ break;
+ }
+}
+
+/**
+ Notification function for keystrokes.
+
+ @param[in] KeyData The key that was pressed.
+
+ @retval EFI_SUCCESS The operation was successful.
+**/
+EFI_STATUS
+EFIAPI
+NotificationFunction(
+ IN EFI_KEY_DATA *KeyData
+ )
+{
+ gBS->SignalEvent (mEvent);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Function to start monitoring for CTRL-C using SimpleTextInputEx.
+
+ @retval EFI_SUCCESS The feature is enabled.
+ @retval EFI_OUT_OF_RESOURCES There is not enough mnemory available.
+**/
+EFI_STATUS
+EFIAPI
+InternalStartMonitor(
+ VOID
+ )
+{
+ EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleEx;
+ EFI_KEY_DATA KeyData;
+ EFI_STATUS Status;
+ EFI_HANDLE *Handles;
+ UINTN HandleCount;
+ UINTN HandleIndex;
+ VOID *NotifyHandle;
+
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiSimpleTextInputExProtocolGuid,
+ NULL,
+ &HandleCount,
+ &Handles
+ );
+ for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) {
+ Status = gBS->HandleProtocol (Handles[HandleIndex], &gEfiSimpleTextInputExProtocolGuid, (VOID **) &SimpleEx);
+ ASSERT_EFI_ERROR (Status);
+
+ KeyData.KeyState.KeyToggleState = 0;
+ KeyData.Key.ScanCode = 0;
+ KeyData.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID|EFI_LEFT_CONTROL_PRESSED;
+ KeyData.Key.UnicodeChar = L'c';
+
+ Status = SimpleEx->RegisterKeyNotify(
+ SimpleEx,
+ &KeyData,
+ NotificationFunction,
+ &NotifyHandle);
+ if (EFI_ERROR (Status)) {
+ break;
+ }
+
+ KeyData.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID|EFI_RIGHT_CONTROL_PRESSED;
+ Status = SimpleEx->RegisterKeyNotify(
+ SimpleEx,
+ &KeyData,
+ NotificationFunction,
+ &NotifyHandle);
+ if (EFI_ERROR (Status)) {
+ break;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Function to stop monitoring for CTRL-C using SimpleTextInputEx.
+
+ @retval EFI_SUCCESS The feature is enabled.
+ @retval EFI_OUT_OF_RESOURCES There is not enough mnemory available.
+**/
+EFI_STATUS
+EFIAPI
+InternalStopMonitor(
+ VOID
+ )
+{
+ EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleEx;
+ EFI_STATUS Status;
+ EFI_HANDLE *Handles;
+ EFI_KEY_DATA KeyData;
+ UINTN HandleCount;
+ UINTN HandleIndex;
+ VOID *NotifyHandle;
+
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiSimpleTextInputExProtocolGuid,
+ NULL,
+ &HandleCount,
+ &Handles
+ );
+ for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) {
+ Status = gBS->HandleProtocol (Handles[HandleIndex], &gEfiSimpleTextInputExProtocolGuid, (VOID **) &SimpleEx);
+ ASSERT_EFI_ERROR (Status);
+
+ KeyData.KeyState.KeyToggleState = 0;
+ KeyData.Key.ScanCode = 0;
+ KeyData.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID|EFI_LEFT_CONTROL_PRESSED;
+ KeyData.Key.UnicodeChar = L'c';
+
+ Status = SimpleEx->RegisterKeyNotify(
+ SimpleEx,
+ &KeyData,
+ NotificationFunction,
+ &NotifyHandle);
+ if (!EFI_ERROR (Status)) {
+ Status = SimpleEx->UnregisterKeyNotify (SimpleEx, NotifyHandle);
+ }
+
+ KeyData.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID|EFI_RIGHT_CONTROL_PRESSED;
+ Status = SimpleEx->RegisterKeyNotify(
+ SimpleEx,
+ &KeyData,
+ NotificationFunction,
+ &NotifyHandle);
+ if (!EFI_ERROR (Status)) {
+ Status = SimpleEx->UnregisterKeyNotify (SimpleEx, NotifyHandle);
+ }
+ }
+ return EFI_SUCCESS;
+}
+
+/**
+ Update names of Name/Value storage to current language.
+
+ @param PrivateData Points to the driver private data.
+
+ @retval EFI_SUCCESS All names are successfully updated.
+ @retval EFI_NOT_FOUND Failed to get Name from HII database.
+
+**/
+EFI_STATUS
+LoadNameValueNames (
+ IN DRIVER_SAMPLE_PRIVATE_DATA *PrivateData
+ )
+{
+ UINTN Index;
+
+ //
+ // Get Name/Value name string of current language
+ //
+ for (Index = 0; Index < NAME_VALUE_NAME_NUMBER; Index++) {
+ PrivateData->NameValueName[Index] = HiiGetString (
+ PrivateData->HiiHandle[0],
+ PrivateData->NameStringId[Index],
+ NULL
+ );
+ if (PrivateData->NameValueName[Index] == NULL) {
+ return EFI_NOT_FOUND;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+
+/**
+ Get the value of <Number> in <BlockConfig> format, i.e. the value of OFFSET
+ or WIDTH or VALUE.
+ <BlockConfig> ::= 'OFFSET='<Number>&'WIDTH='<Number>&'VALUE'=<Number>
+
+ This is a internal function.
+
+ @param StringPtr String in <BlockConfig> format and points to the
+ first character of <Number>.
+ @param Number The output value. Caller takes the responsibility
+ to free memory.
+ @param Len Length of the <Number>, in characters.
+
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to store neccessary
+ structures.
+ @retval EFI_SUCCESS Value of <Number> is outputted in Number
+ successfully.
+
+**/
+EFI_STATUS
+GetValueOfNumber (
+ IN EFI_STRING StringPtr,
+ OUT UINT8 **Number,
+ OUT UINTN *Len
+ )
+{
+ EFI_STRING TmpPtr;
+ UINTN Length;
+ EFI_STRING Str;
+ UINT8 *Buf;
+ EFI_STATUS Status;
+ UINT8 DigitUint8;
+ UINTN Index;
+ CHAR16 TemStr[2];
+
+ if (StringPtr == NULL || *StringPtr == L'\0' || Number == NULL || Len == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Buf = NULL;
+
+ TmpPtr = StringPtr;
+ while (*StringPtr != L'\0' && *StringPtr != L'&') {
+ StringPtr++;
+ }
+ *Len = StringPtr - TmpPtr;
+ Length = *Len + 1;
+
+ Str = (EFI_STRING) AllocateZeroPool (Length * sizeof (CHAR16));
+ if (Str == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ goto Exit;
+ }
+ CopyMem (Str, TmpPtr, *Len * sizeof (CHAR16));
+ *(Str + *Len) = L'\0';
+
+ Length = (Length + 1) / 2;
+ Buf = (UINT8 *) AllocateZeroPool (Length);
+ if (Buf == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ goto Exit;
+ }
+
+ Length = *Len;
+ ZeroMem (TemStr, sizeof (TemStr));
+ for (Index = 0; Index < Length; Index ++) {
+ TemStr[0] = Str[Length - Index - 1];
+ DigitUint8 = (UINT8) StrHexToUint64 (TemStr);
+ if ((Index & 1) == 0) {
+ Buf [Index/2] = DigitUint8;
+ } else {
+ Buf [Index/2] = (UINT8) ((DigitUint8 << 4) + Buf [Index/2]);
+ }
+ }
+
+ *Number = Buf;
+ Status = EFI_SUCCESS;
+
+Exit:
+ if (Str != NULL) {
+ FreePool (Str);
+ }
+
+ return Status;
+}
+
+/**
+ Create altcfg string.
+
+ @param Result The request result string.
+ @param ConfigHdr The request head info. <ConfigHdr> format.
+ @param Offset The offset of the parameter int he structure.
+ @param Width The width of the parameter.
+
+
+ @retval The string with altcfg info append at the end.
+**/
+EFI_STRING
+CreateAltCfgString (
+ IN EFI_STRING Result,
+ IN EFI_STRING ConfigHdr,
+ IN UINTN Offset,
+ IN UINTN Width
+ )
+{
+ EFI_STRING StringPtr;
+ EFI_STRING TmpStr;
+ UINTN NewLen;
+
+ NewLen = StrLen (Result);
+ //
+ // String Len = ConfigResp + AltConfig + AltConfig + 1("\0")
+ //
+ NewLen = (NewLen + ((1 + StrLen (ConfigHdr) + 8 + 4) + (8 + 4 + 7 + 4 + 7 + 4)) * 2 + 1) * sizeof (CHAR16);
+ StringPtr = AllocateZeroPool (NewLen);
+ if (StringPtr == NULL) {
+ return NULL;
+ }
+
+ TmpStr = StringPtr;
+ if (Result != NULL) {
+ StrCpyS (StringPtr, NewLen / sizeof (CHAR16), Result);
+ StringPtr += StrLen (Result);
+ FreePool (Result);
+ }
+
+ UnicodeSPrint (
+ StringPtr,
+ (1 + StrLen (ConfigHdr) + 8 + 4 + 1) * sizeof (CHAR16),
+ L"&%s&ALTCFG=%04x",
+ ConfigHdr,
+ EFI_HII_DEFAULT_CLASS_STANDARD
+ );
+ StringPtr += StrLen (StringPtr);
+
+ UnicodeSPrint (
+ StringPtr,
+ (8 + 4 + 7 + 4 + 7 + 4 + 1) * sizeof (CHAR16),
+ L"&OFFSET=%04x&WIDTH=%04x&VALUE=%04x",
+ Offset,
+ Width,
+ DEFAULT_CLASS_STANDARD_VALUE
+ );
+ StringPtr += StrLen (StringPtr);
+
+ UnicodeSPrint (
+ StringPtr,
+ (1 + StrLen (ConfigHdr) + 8 + 4 + 1) * sizeof (CHAR16),
+ L"&%s&ALTCFG=%04x",
+ ConfigHdr,
+ EFI_HII_DEFAULT_CLASS_MANUFACTURING
+ );
+ StringPtr += StrLen (StringPtr);
+
+ UnicodeSPrint (
+ StringPtr,
+ (8 + 4 + 7 + 4 + 7 + 4 + 1) * sizeof (CHAR16),
+ L"&OFFSET=%04x&WIDTH=%04x&VALUE=%04x",
+ Offset,
+ Width,
+ DEFAULT_CLASS_MANUFACTURING_VALUE
+ );
+ StringPtr += StrLen (StringPtr);
+
+ return TmpStr;
+}
+
+/**
+ Check whether need to add the altcfg string. if need to add, add the altcfg
+ string.
+
+ @param RequestResult The request result string.
+ @param ConfigRequestHdr The request head info. <ConfigHdr> format.
+
+**/
+VOID
+AppendAltCfgString (
+ IN OUT EFI_STRING *RequestResult,
+ IN EFI_STRING ConfigRequestHdr
+ )
+{
+ EFI_STRING StringPtr;
+ UINTN Length;
+ UINT8 *TmpBuffer;
+ UINTN Offset;
+ UINTN Width;
+ UINTN BlockSize;
+ UINTN ValueOffset;
+ UINTN ValueWidth;
+ EFI_STATUS Status;
+
+ TmpBuffer = NULL;
+ StringPtr = *RequestResult;
+ StringPtr = StrStr (StringPtr, L"OFFSET");
+ BlockSize = sizeof (DRIVER_SAMPLE_CONFIGURATION);
+ ValueOffset = OFFSET_OF (DRIVER_SAMPLE_CONFIGURATION, GetDefaultValueFromAccess);
+ ValueWidth = sizeof (((DRIVER_SAMPLE_CONFIGURATION *)0)->GetDefaultValueFromAccess);
+
+ if (StringPtr == NULL) {
+ return;
+ }
+
+ while (*StringPtr != 0 && StrnCmp (StringPtr, L"OFFSET=", StrLen (L"OFFSET=")) == 0) {
+ StringPtr += StrLen (L"OFFSET=");
+ //
+ // Get Offset
+ //
+ Status = GetValueOfNumber (StringPtr, &TmpBuffer, &Length);
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+ Offset = 0;
+ CopyMem (
+ &Offset,
+ TmpBuffer,
+ (((Length + 1) / 2) < sizeof (UINTN)) ? ((Length + 1) / 2) : sizeof (UINTN)
+ );
+ FreePool (TmpBuffer);
+
+ StringPtr += Length;
+ if (StrnCmp (StringPtr, L"&WIDTH=", StrLen (L"&WIDTH=")) != 0) {
+ return;
+ }
+ StringPtr += StrLen (L"&WIDTH=");
+
+ //
+ // Get Width
+ //
+ Status = GetValueOfNumber (StringPtr, &TmpBuffer, &Length);
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+ Width = 0;
+ CopyMem (
+ &Width,
+ TmpBuffer,
+ (((Length + 1) / 2) < sizeof (UINTN)) ? ((Length + 1) / 2) : sizeof (UINTN)
+ );
+ FreePool (TmpBuffer);
+
+ StringPtr += Length;
+ if (StrnCmp (StringPtr, L"&VALUE=", StrLen (L"&VALUE=")) != 0) {
+ return;
+ }
+ StringPtr += StrLen (L"&VALUE=");
+
+ //
+ // Get Value
+ //
+ Status = GetValueOfNumber (StringPtr, &TmpBuffer, &Length);
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+ StringPtr += Length;
+
+ //
+ // Skip the character "&" before "OFFSET".
+ //
+ StringPtr ++;
+
+ //
+ // Calculate Value and convert it to hex string.
+ //
+ if (Offset + Width > BlockSize) {
+ return;
+ }
+
+ if (Offset <= ValueOffset && Offset + Width >= ValueOffset + ValueWidth) {
+ *RequestResult = CreateAltCfgString(*RequestResult, ConfigRequestHdr, ValueOffset, ValueWidth);
+ return;
+ }
+ }
+}
+
+/**
+ 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 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;
+ EFI_STRING ConfigRequest;
+ EFI_STRING ConfigRequestHdr;
+ UINTN Size;
+ EFI_STRING Value;
+ UINTN ValueStrLen;
+ CHAR16 BackupChar;
+ CHAR16 *StrPointer;
+ BOOLEAN AllocatedRequest;
+
+ if (Progress == NULL || Results == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+ //
+ // Initialize the local variables.
+ //
+ ConfigRequestHdr = NULL;
+ ConfigRequest = NULL;
+ Size = 0;
+ *Progress = Request;
+ AllocatedRequest = FALSE;
+
+ PrivateData = DRIVER_SAMPLE_PRIVATE_FROM_THIS (This);
+ HiiConfigRouting = PrivateData->HiiConfigRouting;
+
+ //
+ // Get Buffer Storage data from EFI variable.
+ // Try to get the current setting from variable.
+ //
+ BufferSize = sizeof (DRIVER_SAMPLE_CONFIGURATION);
+ Status = gRT->GetVariable (
+ VariableName,
+ &gDriverSampleFormSetGuid,
+ NULL,
+ &BufferSize,
+ &PrivateData->Configuration
+ );
+ if (EFI_ERROR (Status)) {
+ return EFI_NOT_FOUND;
+ }
+
+ if (Request == NULL) {
+ //
+ // Request is set to NULL, construct full request string.
+ //
+
+ //
+ // Allocate and fill a buffer large enough to hold the <ConfigHdr> template
+ // followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a Null-terminator
+ //
+ ConfigRequestHdr = HiiConstructConfigHdr (&gDriverSampleFormSetGuid, VariableName, PrivateData->DriverHandle[0]);
+ Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
+ ConfigRequest = AllocateZeroPool (Size);
+ ASSERT (ConfigRequest != NULL);
+ AllocatedRequest = TRUE;
+ UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize);
+ FreePool (ConfigRequestHdr);
+ ConfigRequestHdr = NULL;
+ } else {
+ //
+ // Check routing data in <ConfigHdr>.
+ // Note: if only one Storage is used, then this checking could be skipped.
+ //
+ if (!HiiIsConfigHdrMatch (Request, &gDriverSampleFormSetGuid, NULL)) {
+ return EFI_NOT_FOUND;
+ }
+ //
+ // Check whether request for EFI Varstore. EFI varstore get data
+ // through hii database, not support in this path.
+ //
+ if (HiiIsConfigHdrMatch(Request, &gDriverSampleFormSetGuid, MyEfiVar)) {
+ return EFI_UNSUPPORTED;
+ }
+ if (HiiIsConfigHdrMatch(Request, &gDriverSampleFormSetGuid, MyEfiBitVar)) {
+ return EFI_UNSUPPORTED;
+ }
+ if (HiiIsConfigHdrMatch(Request, &gDriverSampleFormSetGuid, MyEfiUnionVar)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ //
+ // Set Request to the unified request string.
+ //
+ ConfigRequest = Request;
+ //
+ // Check whether Request includes Request Element.
+ //
+ if (StrStr (Request, L"OFFSET") == NULL) {
+ //
+ // Check Request Element does exist in Reques String
+ //
+ StrPointer = StrStr (Request, L"PATH");
+ if (StrPointer == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+ if (StrStr (StrPointer, L"&") == NULL) {
+ Size = (StrLen (Request) + 32 + 1) * sizeof (CHAR16);
+ ConfigRequest = AllocateZeroPool (Size);
+ ASSERT (ConfigRequest != NULL);
+ AllocatedRequest = TRUE;
+ UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", Request, (UINT64)BufferSize);
+ }
+ }
+ }
+
+ //
+ // Check if requesting Name/Value storage
+ //
+ if (StrStr (ConfigRequest, L"OFFSET") == NULL) {
+ //
+ // Update Name/Value storage Names
+ //
+ Status = LoadNameValueNames (PrivateData);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Allocate memory for <ConfigResp>, e.g. Name0=0x11, Name1=0x1234, Name2="ABCD"
+ // <Request> ::=<ConfigHdr>&Name0&Name1&Name2
+ // <ConfigResp>::=<ConfigHdr>&Name0=11&Name1=1234&Name2=0041004200430044
+ //
+ BufferSize = (StrLen (ConfigRequest) +
+ 1 + sizeof (PrivateData->Configuration.NameValueVar0) * 2 +
+ 1 + sizeof (PrivateData->Configuration.NameValueVar1) * 2 +
+ 1 + sizeof (PrivateData->Configuration.NameValueVar2) * 2 + 1) * sizeof (CHAR16);
+ *Results = AllocateZeroPool (BufferSize);
+ ASSERT (*Results != NULL);
+ StrCpyS (*Results, BufferSize / sizeof (CHAR16), ConfigRequest);
+ Value = *Results;
+
+ //
+ // Append value of NameValueVar0, type is UINT8
+ //
+ if ((Value = StrStr (*Results, PrivateData->NameValueName[0])) != NULL) {
+ Value += StrLen (PrivateData->NameValueName[0]);
+ ValueStrLen = ((sizeof (PrivateData->Configuration.NameValueVar0) * 2) + 1);
+ CopyMem (Value + ValueStrLen, Value, StrSize (Value));
+
+ BackupChar = Value[ValueStrLen];
+ *Value++ = L'=';
+ UnicodeValueToStringS (
+ Value,
+ BufferSize - ((UINTN)Value - (UINTN)*Results),
+ PREFIX_ZERO | RADIX_HEX,
+ PrivateData->Configuration.NameValueVar0,
+ sizeof (PrivateData->Configuration.NameValueVar0) * 2
+ );
+ Value += StrnLenS (Value, (BufferSize - ((UINTN)Value - (UINTN)*Results)) / sizeof (CHAR16));
+ *Value = BackupChar;
+ }
+
+ //
+ // Append value of NameValueVar1, type is UINT16
+ //
+ if ((Value = StrStr (*Results, PrivateData->NameValueName[1])) != NULL) {
+ Value += StrLen (PrivateData->NameValueName[1]);
+ ValueStrLen = ((sizeof (PrivateData->Configuration.NameValueVar1) * 2) + 1);
+ CopyMem (Value + ValueStrLen, Value, StrSize (Value));
+
+ BackupChar = Value[ValueStrLen];
+ *Value++ = L'=';
+ UnicodeValueToStringS (
+ Value,
+ BufferSize - ((UINTN)Value - (UINTN)*Results),
+ PREFIX_ZERO | RADIX_HEX,
+ PrivateData->Configuration.NameValueVar1,
+ sizeof (PrivateData->Configuration.NameValueVar1) * 2
+ );
+ Value += StrnLenS (Value, (BufferSize - ((UINTN)Value - (UINTN)*Results)) / sizeof (CHAR16));
+ *Value = BackupChar;
+ }
+
+ //
+ // Append value of NameValueVar2, type is CHAR16 *
+ //
+ if ((Value = StrStr (*Results, PrivateData->NameValueName[2])) != NULL) {
+ Value += StrLen (PrivateData->NameValueName[2]);
+ ValueStrLen = StrLen (PrivateData->Configuration.NameValueVar2) * 4 + 1;
+ CopyMem (Value + ValueStrLen, Value, StrSize (Value));
+
+ *Value++ = L'=';
+ //
+ // Convert Unicode String to Config String, e.g. "ABCD" => "0041004200430044"
+ //
+ StrPointer = (CHAR16 *) PrivateData->Configuration.NameValueVar2;
+ for (; *StrPointer != L'\0'; StrPointer++) {
+ UnicodeValueToStringS (
+ Value,
+ BufferSize - ((UINTN)Value - (UINTN)*Results),
+ PREFIX_ZERO | RADIX_HEX,
+ *StrPointer,
+ 4
+ );
+ Value += StrnLenS (Value, (BufferSize - ((UINTN)Value - (UINTN)*Results)) / sizeof (CHAR16));
+ }
+ }
+
+ Status = EFI_SUCCESS;
+ } else {
+ //
+ // Convert buffer data to <ConfigResp> by helper function BlockToConfig()
+ //
+ Status = HiiConfigRouting->BlockToConfig (
+ HiiConfigRouting,
+ ConfigRequest,
+ (UINT8 *) &PrivateData->Configuration,
+ BufferSize,
+ Results,
+ Progress
+ );
+ if (!EFI_ERROR (Status)) {
+ ConfigRequestHdr = HiiConstructConfigHdr (&gDriverSampleFormSetGuid, VariableName, PrivateData->DriverHandle[0]);
+ AppendAltCfgString(Results, ConfigRequestHdr);
+ }
+ }
+
+ //
+ // Free the allocated config request string.
+ //
+ if (AllocatedRequest) {
+ FreePool (ConfigRequest);
+ }
+
+ if (ConfigRequestHdr != NULL) {
+ FreePool (ConfigRequestHdr);
+ }
+ //
+ // Set Progress string to the original request string.
+ //
+ if (Request == NULL) {
+ *Progress = NULL;
+ } else if (StrStr (Request, L"OFFSET") == NULL) {
+ *Progress = Request + StrLen (Request);
+ }
+
+ 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;
+ CHAR16 *Value;
+ CHAR16 *StrPtr;
+ CHAR16 TemStr[5];
+ UINT8 *DataBuffer;
+ UINT8 DigitUint8;
+ UINTN Index;
+ CHAR16 *StrBuffer;
+
+ if (Configuration == NULL || Progress == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ PrivateData = DRIVER_SAMPLE_PRIVATE_FROM_THIS (This);
+ HiiConfigRouting = PrivateData->HiiConfigRouting;
+ *Progress = Configuration;
+
+ //
+ // Check routing data in <ConfigHdr>.
+ // Note: if only one Storage is used, then this checking could be skipped.
+ //
+ if (!HiiIsConfigHdrMatch (Configuration, &gDriverSampleFormSetGuid, NULL)) {
+ return EFI_NOT_FOUND;
+ }
+
+ //
+ // Check whether request for EFI Varstore. EFI varstore get data
+ // through hii database, not support in this path.
+ //
+ if (HiiIsConfigHdrMatch(Configuration, &gDriverSampleFormSetGuid, MyEfiVar)) {
+ return EFI_UNSUPPORTED;
+ }
+ if (HiiIsConfigHdrMatch(Configuration, &gDriverSampleFormSetGuid, MyEfiBitVar)) {
+ return EFI_UNSUPPORTED;
+ }
+ if (HiiIsConfigHdrMatch(Configuration, &gDriverSampleFormSetGuid, MyEfiUnionVar)) {
+ return EFI_UNSUPPORTED;
+ }
+
+ //
+ // Get Buffer Storage data from EFI variable
+ //
+ BufferSize = sizeof (DRIVER_SAMPLE_CONFIGURATION);
+ Status = gRT->GetVariable (
+ VariableName,
+ &gDriverSampleFormSetGuid,
+ NULL,
+ &BufferSize,
+ &PrivateData->Configuration
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Check if configuring Name/Value storage
+ //
+ if (StrStr (Configuration, L"OFFSET") == NULL) {
+ //
+ // Update Name/Value storage Names
+ //
+ Status = LoadNameValueNames (PrivateData);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Convert value for NameValueVar0
+ //
+ if ((Value = StrStr (Configuration, PrivateData->NameValueName[0])) != NULL) {
+ //
+ // Skip "Name="
+ //
+ Value += StrLen (PrivateData->NameValueName[0]);
+ Value++;
+ //
+ // Get Value String
+ //
+ StrPtr = StrStr (Value, L"&");
+ if (StrPtr == NULL) {
+ StrPtr = Value + StrLen (Value);
+ }
+ //
+ // Convert Value to Buffer data
+ //
+ DataBuffer = (UINT8 *) &PrivateData->Configuration.NameValueVar0;
+ ZeroMem (TemStr, sizeof (TemStr));
+ for (Index = 0, StrPtr --; StrPtr >= Value; StrPtr --, Index ++) {
+ TemStr[0] = *StrPtr;
+ DigitUint8 = (UINT8) StrHexToUint64 (TemStr);
+ if ((Index & 1) == 0) {
+ DataBuffer [Index/2] = DigitUint8;
+ } else {
+ DataBuffer [Index/2] = (UINT8) ((UINT8) (DigitUint8 << 4) + DataBuffer [Index/2]);
+ }
+ }
+ }
+
+ //
+ // Convert value for NameValueVar1
+ //
+ if ((Value = StrStr (Configuration, PrivateData->NameValueName[1])) != NULL) {
+ //
+ // Skip "Name="
+ //
+ Value += StrLen (PrivateData->NameValueName[1]);
+ Value++;
+ //
+ // Get Value String
+ //
+ StrPtr = StrStr (Value, L"&");
+ if (StrPtr == NULL) {
+ StrPtr = Value + StrLen (Value);
+ }
+ //
+ // Convert Value to Buffer data
+ //
+ DataBuffer = (UINT8 *) &PrivateData->Configuration.NameValueVar1;
+ ZeroMem (TemStr, sizeof (TemStr));
+ for (Index = 0, StrPtr --; StrPtr >= Value; StrPtr --, Index ++) {
+ TemStr[0] = *StrPtr;
+ DigitUint8 = (UINT8) StrHexToUint64 (TemStr);
+ if ((Index & 1) == 0) {
+ DataBuffer [Index/2] = DigitUint8;
+ } else {
+ DataBuffer [Index/2] = (UINT8) ((UINT8) (DigitUint8 << 4) + DataBuffer [Index/2]);
+ }
+ }
+ }
+
+ //
+ // Convert value for NameValueVar2
+ //
+ if ((Value = StrStr (Configuration, PrivateData->NameValueName[2])) != NULL) {
+ //
+ // Skip "Name="
+ //
+ Value += StrLen (PrivateData->NameValueName[2]);
+ Value++;
+ //
+ // Get Value String
+ //
+ StrPtr = StrStr (Value, L"&");
+ if (StrPtr == NULL) {
+ StrPtr = Value + StrLen (Value);
+ }
+ //
+ // Convert Config String to Unicode String, e.g "0041004200430044" => "ABCD"
+ //
+ StrBuffer = (CHAR16 *) PrivateData->Configuration.NameValueVar2;
+ ZeroMem (TemStr, sizeof (TemStr));
+ while (Value < StrPtr) {
+ StrnCpyS (TemStr, sizeof (TemStr) / sizeof (CHAR16), Value, 4);
+ *(StrBuffer++) = (CHAR16) StrHexToUint64 (TemStr);
+ Value += 4;
+ }
+ *StrBuffer = L'\0';
+ }
+
+ //
+ // Store Buffer Storage back to EFI variable
+ //
+ Status = gRT->SetVariable(
+ VariableName,
+ &gDriverSampleFormSetGuid,
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
+ sizeof (DRIVER_SAMPLE_CONFIGURATION),
+ &PrivateData->Configuration
+ );
+
+ 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,
+ &gDriverSampleFormSetGuid,
+ 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;
+ VOID *StartOpCodeHandle;
+ VOID *OptionsOpCodeHandle;
+ EFI_IFR_GUID_LABEL *StartLabel;
+ VOID *EndOpCodeHandle;
+ EFI_IFR_GUID_LABEL *EndLabel;
+ EFI_INPUT_KEY Key;
+ DRIVER_SAMPLE_CONFIGURATION *Configuration;
+ MY_EFI_VARSTORE_DATA *EfiData;
+ EFI_FORM_ID FormId;
+ EFI_STRING Progress;
+ EFI_STRING Results;
+ UINT32 ProgressErr;
+ CHAR16 *TmpStr;
+ UINTN Index;
+ UINT64 BufferValue;
+ EFI_HII_POPUP_SELECTION UserSelection;
+
+ UserSelection = 0xFF;
+
+ if (((Value == NULL) && (Action != EFI_BROWSER_ACTION_FORM_OPEN) && (Action != EFI_BROWSER_ACTION_FORM_CLOSE))||
+ (ActionRequest == NULL)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+
+ FormId = 0;
+ ProgressErr = 0;
+ Status = EFI_SUCCESS;
+ BufferValue = 3;
+ PrivateData = DRIVER_SAMPLE_PRIVATE_FROM_THIS (This);
+
+ switch (Action) {
+ case EFI_BROWSER_ACTION_FORM_OPEN:
+ {
+ if (QuestionId == 0x1234) {
+ //
+ // Sample CallBack for UEFI FORM_OPEN action:
+ // Add Save action into Form 3 when Form 1 is opened.
+ // This will be done only in FORM_OPEN CallBack of question with ID 0x1234 from Form 1.
+ //
+ PrivateData = DRIVER_SAMPLE_PRIVATE_FROM_THIS (This);
+
+ //
+ // Initialize the container for dynamic opcodes
+ //
+ StartOpCodeHandle = HiiAllocateOpCodeHandle ();
+ ASSERT (StartOpCodeHandle != NULL);
+
+ //
+ // Create Hii Extend Label OpCode as the start opcode
+ //
+ StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
+ StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
+ StartLabel->Number = LABEL_UPDATE2;
+
+ HiiCreateActionOpCode (
+ StartOpCodeHandle, // Container for dynamic created opcodes
+ 0x1238, // Question ID
+ STRING_TOKEN(STR_SAVE_TEXT), // Prompt text
+ STRING_TOKEN(STR_SAVE_TEXT), // Help text
+ EFI_IFR_FLAG_CALLBACK, // Question flag
+ 0 // Action String ID
+ );
+
+ HiiUpdateForm (
+ PrivateData->HiiHandle[0], // HII handle
+ &gDriverSampleFormSetGuid, // Formset GUID
+ 0x3, // Form ID
+ StartOpCodeHandle, // Label for where to insert opcodes
+ NULL // Insert data
+ );
+
+ HiiFreeOpCodeHandle (StartOpCodeHandle);
+ }
+
+ if (QuestionId == 0x1247) {
+ Status = InternalStartMonitor ();
+ ASSERT_EFI_ERROR (Status);
+ }
+ }
+ break;
+
+ case EFI_BROWSER_ACTION_FORM_CLOSE:
+ {
+ if (QuestionId == 0x5678) {
+ //
+ // Sample CallBack for UEFI FORM_CLOSE action:
+ // Show up a pop-up to specify Form 3 will be closed when exit Form 3.
+ //
+ do {
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &Key,
+ L"",
+ L"You are going to leave third Form!",
+ L"Press ESC or ENTER to continue ...",
+ L"",
+ NULL
+ );
+ } while ((Key.ScanCode != SCAN_ESC) && (Key.UnicodeChar != CHAR_CARRIAGE_RETURN));
+ }
+
+ if (QuestionId == 0x1247) {
+ Status = InternalStopMonitor ();
+ ASSERT_EFI_ERROR (Status);
+ }
+ }
+ break;
+
+ case EFI_BROWSER_ACTION_RETRIEVE:
+ {
+ switch (QuestionId ) {
+ case 0x1248:
+ if (Type != EFI_IFR_TYPE_REF) {
+ return EFI_INVALID_PARAMETER;
+ }
+ Value->ref.FormId = 0x3;
+ break;
+
+ case 0x5678:
+ case 0x1247:
+ //
+ // We will reach here once the Question is refreshed
+ //
+
+ //
+ // Initialize the container for dynamic opcodes
+ //
+ StartOpCodeHandle = HiiAllocateOpCodeHandle ();
+ ASSERT (StartOpCodeHandle != NULL);
+
+ //
+ // Create Hii Extend Label OpCode as the start opcode
+ //
+ StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
+ StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
+ if (QuestionId == 0x5678) {
+ StartLabel->Number = LABEL_UPDATE2;
+ FormId = 0x03;
+ PrivateData->Configuration.DynamicRefresh++;
+ } else if (QuestionId == 0x1247 ) {
+ StartLabel->Number = LABEL_UPDATE3;
+ FormId = 0x06;
+ PrivateData->Configuration.RefreshGuidCount++;
+ }
+
+ HiiCreateActionOpCode (
+ StartOpCodeHandle, // Container for dynamic created opcodes
+ 0x1237, // Question ID
+ STRING_TOKEN(STR_EXIT_TEXT), // Prompt text
+ STRING_TOKEN(STR_EXIT_TEXT), // Help text
+ EFI_IFR_FLAG_CALLBACK, // Question flag
+ 0 // Action String ID
+ );
+
+ HiiUpdateForm (
+ PrivateData->HiiHandle[0], // HII handle
+ &gDriverSampleFormSetGuid, // Formset GUID
+ FormId, // Form ID
+ StartOpCodeHandle, // Label for where to insert opcodes
+ NULL // Insert data
+ );
+
+ HiiFreeOpCodeHandle (StartOpCodeHandle);
+
+ //
+ // Refresh the Question value
+ //
+ Status = gRT->SetVariable(
+ VariableName,
+ &gDriverSampleFormSetGuid,
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
+ sizeof (DRIVER_SAMPLE_CONFIGURATION),
+ &PrivateData->Configuration
+ );
+
+ if (QuestionId == 0x5678) {
+ //
+ // Update uncommitted data of Browser
+ //
+ EfiData = AllocateZeroPool (sizeof (MY_EFI_VARSTORE_DATA));
+ ASSERT (EfiData != NULL);
+ if (HiiGetBrowserData (&gDriverSampleFormSetGuid, MyEfiVar, sizeof (MY_EFI_VARSTORE_DATA), (UINT8 *) EfiData)) {
+ EfiData->Field8 = 111;
+ HiiSetBrowserData (
+ &gDriverSampleFormSetGuid,
+ MyEfiVar,
+ sizeof (MY_EFI_VARSTORE_DATA),
+ (UINT8 *) EfiData,
+ NULL
+ );
+ }
+ FreePool (EfiData);
+ }
+ break;
+ }
+ }
+ break;
+
+ case EFI_BROWSER_ACTION_DEFAULT_STANDARD:
+ {
+ switch (QuestionId) {
+ case 0x1240:
+ Value->u8 = DEFAULT_CLASS_STANDARD_VALUE;
+ break;
+
+ case 0x1252:
+ for (Index = 0; Index < 3; Index ++) {
+ SetArrayData (Value, EFI_IFR_TYPE_NUM_SIZE_8, Index, BufferValue--);
+ }
+ break;
+
+ case 0x6666:
+ Value->u8 = 12;
+ break;
+
+ default:
+ Status = EFI_UNSUPPORTED;
+ break;
+ }
+ }
+ break;
+
+ case EFI_BROWSER_ACTION_DEFAULT_MANUFACTURING:
+ {
+ switch (QuestionId) {
+ case 0x1240:
+ Value->u8 = DEFAULT_CLASS_MANUFACTURING_VALUE;
+ break;
+
+ case 0x6666:
+ Value->u8 = 13;
+ break;
+
+ default:
+ Status = EFI_UNSUPPORTED;
+ break;
+ }
+ }
+ break;
+
+ case EFI_BROWSER_ACTION_CHANGING:
+ {
+ switch (QuestionId) {
+ case 0x1249:
+ {
+ if (Type != EFI_IFR_TYPE_REF) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Value->ref.FormId = 0x1234;
+ }
+ break;
+ case 0x1234:
+ //
+ // Initialize the container for dynamic opcodes
+ //
+ StartOpCodeHandle = HiiAllocateOpCodeHandle ();
+ ASSERT (StartOpCodeHandle != NULL);
+
+ EndOpCodeHandle = HiiAllocateOpCodeHandle ();
+ ASSERT (EndOpCodeHandle != NULL);
+
+ //
+ // Create Hii Extend Label OpCode as the start opcode
+ //
+ StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
+ StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
+ StartLabel->Number = LABEL_UPDATE1;
+
+ //
+ // Create Hii Extend Label OpCode as the end opcode
+ //
+ EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));
+ EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
+ EndLabel->Number = LABEL_END;
+
+ HiiCreateActionOpCode (
+ StartOpCodeHandle, // Container for dynamic created opcodes
+ 0x1237, // Question ID
+ STRING_TOKEN(STR_EXIT_TEXT), // Prompt text
+ STRING_TOKEN(STR_EXIT_TEXT), // Help text
+ EFI_IFR_FLAG_CALLBACK, // Question flag
+ 0 // Action String ID
+ );
+
+ //
+ // Create Option OpCode
+ //
+ OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
+ ASSERT (OptionsOpCodeHandle != NULL);
+
+ HiiCreateOneOfOptionOpCode (
+ OptionsOpCodeHandle,
+ STRING_TOKEN (STR_BOOT_OPTION1),
+ 0,
+ EFI_IFR_NUMERIC_SIZE_1,
+ 1
+ );
+
+ HiiCreateOneOfOptionOpCode (
+ OptionsOpCodeHandle,
+ STRING_TOKEN (STR_BOOT_OPTION2),
+ 0,
+ EFI_IFR_NUMERIC_SIZE_1,
+ 2
+ );
+
+ //
+ // Prepare initial value for the dynamic created oneof Question
+ //
+ PrivateData->Configuration.DynamicOneof = 2;
+ Status = gRT->SetVariable(
+ VariableName,
+ &gDriverSampleFormSetGuid,
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
+ sizeof (DRIVER_SAMPLE_CONFIGURATION),
+ &PrivateData->Configuration
+ );
+
+ //
+ // Set initial vlaue of dynamic created oneof Question in Form Browser
+ //
+ Configuration = AllocateZeroPool (sizeof (DRIVER_SAMPLE_CONFIGURATION));
+ ASSERT (Configuration != NULL);
+ if (HiiGetBrowserData (&gDriverSampleFormSetGuid, VariableName, sizeof (DRIVER_SAMPLE_CONFIGURATION), (UINT8 *) Configuration)) {
+ Configuration->DynamicOneof = 2;
+
+ //
+ // Update uncommitted data of Browser
+ //
+ HiiSetBrowserData (
+ &gDriverSampleFormSetGuid,
+ VariableName,
+ sizeof (DRIVER_SAMPLE_CONFIGURATION),
+ (UINT8 *) Configuration,
+ NULL
+ );
+ }
+ FreePool (Configuration);
+
+ HiiCreateOneOfOpCode (
+ StartOpCodeHandle, // Container for dynamic created opcodes
+ 0x8001, // Question ID (or call it "key")
+ CONFIGURATION_VARSTORE_ID, // VarStore ID
+ (UINT16) DYNAMIC_ONE_OF_VAR_OFFSET, // Offset in Buffer Storage
+ STRING_TOKEN (STR_ONE_OF_PROMPT), // Question prompt text
+ STRING_TOKEN (STR_ONE_OF_HELP), // Question help text
+ EFI_IFR_FLAG_CALLBACK, // Question flag
+ EFI_IFR_NUMERIC_SIZE_1, // Data type of Question Value
+ OptionsOpCodeHandle, // Option Opcode list
+ NULL // Default Opcode is NULl
+ );
+
+ HiiCreateOrderedListOpCode (
+ StartOpCodeHandle, // Container for dynamic created opcodes
+ 0x8002, // Question ID
+ CONFIGURATION_VARSTORE_ID, // VarStore ID
+ (UINT16) DYNAMIC_ORDERED_LIST_VAR_OFFSET, // Offset in Buffer Storage
+ STRING_TOKEN (STR_BOOT_OPTIONS), // Question prompt text
+ STRING_TOKEN (STR_BOOT_OPTIONS), // Question help text
+ EFI_IFR_FLAG_RESET_REQUIRED, // Question flag
+ 0, // Ordered list flag, e.g. EFI_IFR_UNIQUE_SET
+ EFI_IFR_NUMERIC_SIZE_1, // Data type of Question value
+ 5, // Maximum container
+ OptionsOpCodeHandle, // Option Opcode list
+ NULL // Default Opcode is NULl
+ );
+
+ HiiCreateTextOpCode (
+ StartOpCodeHandle,
+ STRING_TOKEN(STR_TEXT_SAMPLE_HELP),
+ STRING_TOKEN(STR_TEXT_SAMPLE_HELP),
+ STRING_TOKEN(STR_TEXT_SAMPLE_STRING)
+ );
+
+ HiiCreateDateOpCode (
+ StartOpCodeHandle,
+ 0x8004,
+ 0x0,
+ 0x0,
+ STRING_TOKEN(STR_DATE_SAMPLE_HELP),
+ STRING_TOKEN(STR_DATE_SAMPLE_HELP),
+ 0,
+ QF_DATE_STORAGE_TIME,
+ NULL
+ );
+
+ HiiCreateTimeOpCode (
+ StartOpCodeHandle,
+ 0x8005,
+ 0x0,
+ 0x0,
+ STRING_TOKEN(STR_TIME_SAMPLE_HELP),
+ STRING_TOKEN(STR_TIME_SAMPLE_HELP),
+ 0,
+ QF_TIME_STORAGE_TIME,
+ NULL
+ );
+
+ HiiCreateGotoOpCode (
+ StartOpCodeHandle, // Container for dynamic created opcodes
+ 1, // Target Form ID
+ STRING_TOKEN (STR_GOTO_FORM1), // Prompt text
+ STRING_TOKEN (STR_GOTO_HELP), // Help text
+ 0, // Question flag
+ 0x8003 // Question ID
+ );
+
+ HiiUpdateForm (
+ PrivateData->HiiHandle[0], // HII handle
+ &gDriverSampleFormSetGuid, // Formset GUID
+ 0x1234, // Form ID
+ StartOpCodeHandle, // Label for where to insert opcodes
+ EndOpCodeHandle // Replace data
+ );
+
+ HiiFreeOpCodeHandle (StartOpCodeHandle);
+ HiiFreeOpCodeHandle (OptionsOpCodeHandle);
+ HiiFreeOpCodeHandle (EndOpCodeHandle);
+ break;
+
+ default:
+ break;
+ }
+ }
+ break;
+
+ case EFI_BROWSER_ACTION_CHANGED:
+ switch (QuestionId) {
+ 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 0x1241:
+ case 0x1246:
+ //
+ // User press "Submit current form and Exit now", request Browser to submit current form and exit
+ //
+ *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT;
+ break;
+
+ case 0x1242:
+ //
+ // User press "Discard current form now", request Browser to discard the uncommitted data.
+ //
+ *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD;
+ break;
+
+ case 0x1243:
+ //
+ // User press "Submit current form now", request Browser to save the uncommitted data.
+ //
+ *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
+ break;
+
+ case 0x1244:
+ case 0x1245:
+ //
+ // User press "Discard current form and Exit now", request Browser to discard the uncommitted data and exit.
+ //
+ *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT;
+ break;
+
+ case 0x1231:
+ //
+ // 1. Check to see whether system support keyword.
+ //
+ Status = PrivateData->HiiKeywordHandler->GetData (PrivateData->HiiKeywordHandler,
+ L"NAMESPACE=x-UEFI-ns",
+ L"KEYWORD=iSCSIBootEnable",
+ &Progress,
+ &ProgressErr,
+ &Results
+ );
+ if (EFI_ERROR (Status)) {
+ do {
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &Key,
+ L"",
+ L"This system not support this keyword!",
+ L"Press ENTER to continue ...",
+ L"",
+ NULL
+ );
+ } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
+
+ Status = EFI_SUCCESS;
+ break;
+ }
+
+ //
+ // 2. If system support this keyword, just try to change value.
+ //
+
+ //
+ // Change value from '0' to '1' or from '1' to '0'
+ //
+ TmpStr = StrStr (Results, L"&VALUE=");
+ ASSERT (TmpStr != NULL);
+ TmpStr += StrLen (L"&VALUE=");
+ TmpStr++;
+ if (*TmpStr == L'0') {
+ *TmpStr = L'1';
+ } else {
+ *TmpStr = L'0';
+ }
+
+ //
+ // 3. Call the keyword handler protocol to change the value.
+ //
+ Status = PrivateData->HiiKeywordHandler->SetData (PrivateData->HiiKeywordHandler,
+ Results,
+ &Progress,
+ &ProgressErr
+ );
+ if (EFI_ERROR (Status)) {
+ do {
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &Key,
+ L"",
+ L"Set keyword to the system failed!",
+ L"Press ENTER to continue ...",
+ L"",
+ NULL
+ );
+ } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
+
+ Status = EFI_SUCCESS;
+ break;
+ }
+ break;
+
+ case 0x1330:
+ Status = mPrivateData->HiiPopup->CreatePopup (
+ mPrivateData->HiiPopup,
+ EfiHiiPopupStyleInfo,
+ EfiHiiPopupTypeYesNo,
+ mPrivateData->HiiHandle[0],
+ STRING_TOKEN (STR_POPUP_STRING),
+ &UserSelection
+ );
+ if (!EFI_ERROR (Status)) {
+ if (UserSelection == EfiHiiPopupSelectionYes) {
+ *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case EFI_BROWSER_ACTION_SUBMITTED:
+ {
+ if (QuestionId == 0x1250) {
+ //
+ // Sample CallBack for EFI_BROWSER_ACTION_SUBMITTED action:
+ // Show up a pop-up to show SUBMITTED callback has been triggered.
+ //
+ do {
+ CreatePopUp (
+ EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
+ &Key,
+ L"",
+ L"EfiVarstore value has been submitted!",
+ L"Press ESC or ENTER to continue ...",
+ L"",
+ NULL
+ );
+ } while ((Key.ScanCode != SCAN_ESC) && (Key.UnicodeChar != CHAR_CARRIAGE_RETURN));
+ }
+ }
+ break;
+
+ default:
+ Status = EFI_UNSUPPORTED;
+ break;
+ }
+
+ return Status;
+}
+
+/**
+ Main entry for this driver.
+
+ @param ImageHandle Image handle this driver.
+ @param SystemTable Pointer to SystemTable.
+
+ @retval EFI_SUCESS This function always complete successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+DriverSampleInit (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_HII_HANDLE HiiHandle[2];
+ 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;
+ EFI_CONFIG_KEYWORD_HANDLER_PROTOCOL *HiiKeywordHandler;
+ EFI_HII_POPUP_PROTOCOL *PopupHandler;
+ CHAR16 *NewString;
+ UINTN BufferSize;
+ DRIVER_SAMPLE_CONFIGURATION *Configuration;
+ BOOLEAN ActionFlag;
+ EFI_STRING ConfigRequestHdr;
+ EFI_STRING NameRequestHdr;
+ MY_EFI_VARSTORE_DATA *VarStoreConfig;
+ MY_EFI_BITS_VARSTORE_DATA *BitsVarStoreConfig;
+ MY_EFI_UNION_DATA *UnionConfig;
+ EFI_INPUT_KEY HotKey;
+ EDKII_FORM_BROWSER_EXTENSION_PROTOCOL *FormBrowserEx;
+
+ //
+ // Initialize the local variables.
+ //
+ ConfigRequestHdr = NULL;
+ NewString = NULL;
+
+ //
+ // 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
+ //
+ mPrivateData = AllocateZeroPool (sizeof (DRIVER_SAMPLE_PRIVATE_DATA));
+ if (mPrivateData == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ mPrivateData->Signature = DRIVER_SAMPLE_PRIVATE_SIGNATURE;
+
+ mPrivateData->ConfigAccess.ExtractConfig = ExtractConfig;
+ mPrivateData->ConfigAccess.RouteConfig = RouteConfig;
+ mPrivateData->ConfigAccess.Callback = DriverCallback;
+
+ //
+ // Locate Hii Database protocol
+ //
+ Status = gBS->LocateProtocol (&gEfiHiiDatabaseProtocolGuid, NULL, (VOID **) &HiiDatabase);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ mPrivateData->HiiDatabase = HiiDatabase;
+
+ //
+ // Locate HiiString protocol
+ //
+ Status = gBS->LocateProtocol (&gEfiHiiStringProtocolGuid, NULL, (VOID **) &HiiString);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ mPrivateData->HiiString = HiiString;
+
+ //
+ // Locate Formbrowser2 protocol
+ //
+ Status = gBS->LocateProtocol (&gEfiFormBrowser2ProtocolGuid, NULL, (VOID **) &FormBrowser2);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ mPrivateData->FormBrowser2 = FormBrowser2;
+
+ //
+ // Locate ConfigRouting protocol
+ //
+ Status = gBS->LocateProtocol (&gEfiHiiConfigRoutingProtocolGuid, NULL, (VOID **) &HiiConfigRouting);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ mPrivateData->HiiConfigRouting = HiiConfigRouting;
+
+ //
+ // Locate keyword handler protocol
+ //
+ Status = gBS->LocateProtocol (&gEfiConfigKeywordHandlerProtocolGuid, NULL, (VOID **) &HiiKeywordHandler);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ mPrivateData->HiiKeywordHandler = HiiKeywordHandler;
+
+ //
+ // Locate HiiPopup protocol
+ //
+ Status = gBS->LocateProtocol (&gEfiHiiPopupProtocolGuid, NULL, (VOID **) &PopupHandler);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ mPrivateData->HiiPopup = PopupHandler;
+
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &DriverHandle[0],
+ &gEfiDevicePathProtocolGuid,
+ &mHiiVendorDevicePath0,
+ &gEfiHiiConfigAccessProtocolGuid,
+ &mPrivateData->ConfigAccess,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ mPrivateData->DriverHandle[0] = DriverHandle[0];
+
+ //
+ // Publish our HII data
+ //
+ HiiHandle[0] = HiiAddPackages (
+ &gDriverSampleFormSetGuid,
+ DriverHandle[0],
+ DriverSampleStrings,
+ VfrBin,
+ NULL
+ );
+ if (HiiHandle[0] == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ mPrivateData->HiiHandle[0] = HiiHandle[0];
+
+ //
+ // Publish another Fromset
+ //
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &DriverHandle[1],
+ &gEfiDevicePathProtocolGuid,
+ &mHiiVendorDevicePath1,
+ &gEfiHiiConfigAccessProtocolGuid,
+ &mPrivateData->ConfigAccess,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ mPrivateData->DriverHandle[1] = DriverHandle[1];
+
+ HiiHandle[1] = HiiAddPackages (
+ &gDriverSampleInventoryGuid,
+ DriverHandle[1],
+ DriverSampleStrings,
+ InventoryBin,
+ NULL
+ );
+ if (HiiHandle[1] == NULL) {
+ DriverSampleUnload (ImageHandle);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ mPrivateData->HiiHandle[1] = HiiHandle[1];
+
+ //
+ // Update the device path string.
+ //
+ NewString = ConvertDevicePathToText((EFI_DEVICE_PATH_PROTOCOL*)&mHiiVendorDevicePath0, FALSE, FALSE);
+ if (HiiSetString (HiiHandle[0], STRING_TOKEN (STR_DEVICE_PATH), NewString, NULL) == 0) {
+ DriverSampleUnload (ImageHandle);
+ return EFI_OUT_OF_RESOURCES;
+ }
+ if (NewString != NULL) {
+ FreePool (NewString);
+ }
+
+ //
+ // Very simple example of how one would update a string that is already
+ // in the HII database
+ //
+ NewString = L"700 Mhz";
+
+ if (HiiSetString (HiiHandle[0], STRING_TOKEN (STR_CPU_STRING2), NewString, NULL) == 0) {
+ DriverSampleUnload (ImageHandle);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ HiiSetString (HiiHandle[0], 0, NewString, NULL);
+
+ //
+ // Initialize Name/Value name String ID
+ //
+ mPrivateData->NameStringId[0] = STR_NAME_VALUE_VAR_NAME0;
+ mPrivateData->NameStringId[1] = STR_NAME_VALUE_VAR_NAME1;
+ mPrivateData->NameStringId[2] = STR_NAME_VALUE_VAR_NAME2;
+
+ //
+ // Initialize configuration data
+ //
+ Configuration = &mPrivateData->Configuration;
+ ZeroMem (Configuration, sizeof (DRIVER_SAMPLE_CONFIGURATION));
+
+ //
+ // Try to read NV config EFI variable first
+ //
+ ConfigRequestHdr = HiiConstructConfigHdr (&gDriverSampleFormSetGuid, VariableName, DriverHandle[0]);
+ ASSERT (ConfigRequestHdr != NULL);
+
+ NameRequestHdr = HiiConstructConfigHdr (&gDriverSampleFormSetGuid, NULL, DriverHandle[0]);
+ ASSERT (NameRequestHdr != NULL);
+
+ BufferSize = sizeof (DRIVER_SAMPLE_CONFIGURATION);
+ Status = gRT->GetVariable (VariableName, &gDriverSampleFormSetGuid, NULL, &BufferSize, Configuration);
+ if (EFI_ERROR (Status)) {
+ //
+ // Store zero data Buffer Storage to EFI variable
+ //
+ Status = gRT->SetVariable(
+ VariableName,
+ &gDriverSampleFormSetGuid,
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
+ sizeof (DRIVER_SAMPLE_CONFIGURATION),
+ Configuration
+ );
+ if (EFI_ERROR (Status)) {
+ DriverSampleUnload (ImageHandle);
+ return Status;
+ }
+ //
+ // EFI variable for NV config doesn't exit, we should build this variable
+ // based on default values stored in IFR
+ //
+ ActionFlag = HiiSetToDefaults (NameRequestHdr, EFI_HII_DEFAULT_CLASS_STANDARD);
+ if (!ActionFlag) {
+ DriverSampleUnload (ImageHandle);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ ActionFlag = HiiSetToDefaults (ConfigRequestHdr, EFI_HII_DEFAULT_CLASS_STANDARD);
+ if (!ActionFlag) {
+ DriverSampleUnload (ImageHandle);
+ return EFI_INVALID_PARAMETER;
+ }
+ } else {
+ //
+ // EFI variable does exist and Validate Current Setting
+ //
+ ActionFlag = HiiValidateSettings (NameRequestHdr);
+ if (!ActionFlag) {
+ DriverSampleUnload (ImageHandle);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ ActionFlag = HiiValidateSettings (ConfigRequestHdr);
+ if (!ActionFlag) {
+ DriverSampleUnload (ImageHandle);
+ return EFI_INVALID_PARAMETER;
+ }
+ }
+ FreePool (ConfigRequestHdr);
+
+ //
+ // Initialize efi varstore configuration data
+ //
+ VarStoreConfig = &mPrivateData->VarStoreConfig;
+ ZeroMem (VarStoreConfig, sizeof (MY_EFI_VARSTORE_DATA));
+
+ ConfigRequestHdr = HiiConstructConfigHdr (&gDriverSampleFormSetGuid, MyEfiVar, DriverHandle[0]);
+ ASSERT (ConfigRequestHdr != NULL);
+
+ BufferSize = sizeof (MY_EFI_VARSTORE_DATA);
+ Status = gRT->GetVariable (MyEfiVar, &gDriverSampleFormSetGuid, NULL, &BufferSize, VarStoreConfig);
+ if (EFI_ERROR (Status)) {
+ //
+ // Store zero data to EFI variable Storage.
+ //
+ Status = gRT->SetVariable(
+ MyEfiVar,
+ &gDriverSampleFormSetGuid,
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
+ sizeof (MY_EFI_VARSTORE_DATA),
+ VarStoreConfig
+ );
+ if (EFI_ERROR (Status)) {
+ DriverSampleUnload (ImageHandle);
+ return Status;
+ }
+ //
+ // EFI variable for NV config doesn't exit, we should build this variable
+ // based on default values stored in IFR
+ //
+ ActionFlag = HiiSetToDefaults (ConfigRequestHdr, EFI_HII_DEFAULT_CLASS_STANDARD);
+ if (!ActionFlag) {
+ DriverSampleUnload (ImageHandle);
+ return EFI_INVALID_PARAMETER;
+ }
+ } else {
+ //
+ // EFI variable does exist and Validate Current Setting
+ //
+ ActionFlag = HiiValidateSettings (ConfigRequestHdr);
+ if (!ActionFlag) {
+ DriverSampleUnload (ImageHandle);
+ return EFI_INVALID_PARAMETER;
+ }
+ }
+ FreePool (ConfigRequestHdr);
+
+ //
+ // Initialize Bits efi varstore configuration data
+ //
+ BitsVarStoreConfig = &mPrivateData->BitsVarStoreConfig;
+ ZeroMem (BitsVarStoreConfig, sizeof (MY_EFI_BITS_VARSTORE_DATA));
+
+ ConfigRequestHdr = HiiConstructConfigHdr (&gDriverSampleFormSetGuid, MyEfiBitVar, DriverHandle[0]);
+ ASSERT (ConfigRequestHdr != NULL);
+
+ BufferSize = sizeof (MY_EFI_BITS_VARSTORE_DATA);
+ Status = gRT->GetVariable (MyEfiBitVar, &gDriverSampleFormSetGuid, NULL, &BufferSize, BitsVarStoreConfig);
+ if (EFI_ERROR (Status)) {
+ //
+ // Store zero data to EFI variable Storage.
+ //
+ Status = gRT->SetVariable(
+ MyEfiBitVar,
+ &gDriverSampleFormSetGuid,
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
+ sizeof (MY_EFI_BITS_VARSTORE_DATA),
+ BitsVarStoreConfig
+ );
+ if (EFI_ERROR (Status)) {
+ DriverSampleUnload (ImageHandle);
+ return Status;
+ }
+ //
+ // EFI variable for NV config doesn't exit, we should build this variable
+ // based on default values stored in IFR
+ //
+ ActionFlag = HiiSetToDefaults (ConfigRequestHdr, EFI_HII_DEFAULT_CLASS_STANDARD);
+ if (!ActionFlag) {
+ DriverSampleUnload (ImageHandle);
+ return EFI_INVALID_PARAMETER;
+ }
+ } else {
+ //
+ // EFI variable does exist and Validate Current Setting
+ //
+ ActionFlag = HiiValidateSettings (ConfigRequestHdr);
+ if (!ActionFlag) {
+ DriverSampleUnload (ImageHandle);
+ return EFI_INVALID_PARAMETER;
+ }
+ }
+ FreePool (ConfigRequestHdr);
+
+ //
+ // Initialize Union efi varstore configuration data
+ //
+ UnionConfig = &mPrivateData->UnionConfig;
+ ZeroMem (UnionConfig, sizeof (MY_EFI_UNION_DATA));
+
+ ConfigRequestHdr = HiiConstructConfigHdr (&gDriverSampleFormSetGuid, MyEfiUnionVar, DriverHandle[0]);
+ ASSERT (ConfigRequestHdr != NULL);
+
+ BufferSize = sizeof (MY_EFI_UNION_DATA);
+ Status = gRT->GetVariable (MyEfiUnionVar, &gDriverSampleFormSetGuid, NULL, &BufferSize, UnionConfig);
+ if (EFI_ERROR (Status)) {
+ //
+ // Store zero data to EFI variable Storage.
+ //
+ Status = gRT->SetVariable(
+ MyEfiUnionVar,
+ &gDriverSampleFormSetGuid,
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
+ sizeof (MY_EFI_UNION_DATA),
+ UnionConfig
+ );
+ if (EFI_ERROR (Status)) {
+ DriverSampleUnload (ImageHandle);
+ return Status;
+ }
+ //
+ // EFI variable for NV config doesn't exit, we should build this variable
+ // based on default values stored in IFR
+ //
+ ActionFlag = HiiSetToDefaults (ConfigRequestHdr, EFI_HII_DEFAULT_CLASS_STANDARD);
+ if (!ActionFlag) {
+ DriverSampleUnload (ImageHandle);
+ return EFI_INVALID_PARAMETER;
+ }
+ } else {
+ //
+ // EFI variable does exist and Validate Current Setting
+ //
+ ActionFlag = HiiValidateSettings (ConfigRequestHdr);
+ if (!ActionFlag) {
+ DriverSampleUnload (ImageHandle);
+ return EFI_INVALID_PARAMETER;
+ }
+ }
+ FreePool (ConfigRequestHdr);
+
+ Status = gBS->CreateEventEx (
+ EVT_NOTIFY_SIGNAL,
+ TPL_NOTIFY,
+ EfiEventEmptyFunction,
+ NULL,
+ &gEfiIfrRefreshIdOpGuid,
+ &mEvent
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Example of how to use BrowserEx protocol to register HotKey.
+ //
+ Status = gBS->LocateProtocol (&gEdkiiFormBrowserExProtocolGuid, NULL, (VOID **) &FormBrowserEx);
+ if (!EFI_ERROR (Status)) {
+ //
+ // First unregister the default hot key F9 and F10.
+ //
+ HotKey.UnicodeChar = CHAR_NULL;
+ HotKey.ScanCode = SCAN_F9;
+ FormBrowserEx->RegisterHotKey (&HotKey, 0, 0, NULL);
+ HotKey.ScanCode = SCAN_F10;
+ FormBrowserEx->RegisterHotKey (&HotKey, 0, 0, NULL);
+
+ //
+ // Register the default HotKey F9 and F10 again.
+ //
+ HotKey.ScanCode = SCAN_F10;
+ NewString = HiiGetString (mPrivateData->HiiHandle[0], STRING_TOKEN (FUNCTION_TEN_STRING), NULL);
+ ASSERT (NewString != NULL);
+ FormBrowserEx->RegisterHotKey (&HotKey, BROWSER_ACTION_SUBMIT, 0, NewString);
+ HotKey.ScanCode = SCAN_F9;
+ NewString = HiiGetString (mPrivateData->HiiHandle[0], STRING_TOKEN (FUNCTION_NINE_STRING), NULL);
+ ASSERT (NewString != NULL);
+ FormBrowserEx->RegisterHotKey (&HotKey, BROWSER_ACTION_DEFAULT, EFI_HII_DEFAULT_CLASS_STANDARD, NewString);
+ }
+
+ //
+ // In default, this driver is built into Flash device image,
+ // the following code doesn't run.
+ //
+
+ //
+ // Example of how to display only the item we sent to HII
+ // When this driver is not built into Flash device image,
+ // it need to call SendForm to show front page by itself.
+ //
+ if (DISPLAY_ONLY_MY_ITEM <= 1) {
+ //
+ // Have the browser pull out our copy of the data, and only display our data
+ //
+ Status = FormBrowser2->SendForm (
+ FormBrowser2,
+ &(HiiHandle[DISPLAY_ONLY_MY_ITEM]),
+ 1,
+ NULL,
+ 0,
+ NULL,
+ NULL
+ );
+
+ HiiRemovePackages (HiiHandle[0]);
+
+ HiiRemovePackages (HiiHandle[1]);
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Unloads the application and its installed protocol.
+
+ @param[in] ImageHandle Handle that identifies the image to be unloaded.
+
+ @retval EFI_SUCCESS The image has been unloaded.
+**/
+EFI_STATUS
+EFIAPI
+DriverSampleUnload (
+ IN EFI_HANDLE ImageHandle
+ )
+{
+ UINTN Index;
+
+ ASSERT (mPrivateData != NULL);
+
+ if (DriverHandle[0] != NULL) {
+ gBS->UninstallMultipleProtocolInterfaces (
+ DriverHandle[0],
+ &gEfiDevicePathProtocolGuid,
+ &mHiiVendorDevicePath0,
+ &gEfiHiiConfigAccessProtocolGuid,
+ &mPrivateData->ConfigAccess,
+ NULL
+ );
+ DriverHandle[0] = NULL;
+ }
+
+ if (DriverHandle[1] != NULL) {
+ gBS->UninstallMultipleProtocolInterfaces (
+ DriverHandle[1],
+ &gEfiDevicePathProtocolGuid,
+ &mHiiVendorDevicePath1,
+ &gEfiHiiConfigAccessProtocolGuid,
+ &mPrivateData->ConfigAccess,
+ NULL
+ );
+ DriverHandle[1] = NULL;
+ }
+
+ if (mPrivateData->HiiHandle[0] != NULL) {
+ HiiRemovePackages (mPrivateData->HiiHandle[0]);
+ }
+
+ if (mPrivateData->HiiHandle[1] != NULL) {
+ HiiRemovePackages (mPrivateData->HiiHandle[1]);
+ }
+
+ for (Index = 0; Index < NAME_VALUE_NAME_NUMBER; Index++) {
+ if (mPrivateData->NameValueName[Index] != NULL) {
+ FreePool (mPrivateData->NameValueName[Index]);
+ }
+ }
+ FreePool (mPrivateData);
+ mPrivateData = NULL;
+
+ gBS->CloseEvent (mEvent);
+
+ return EFI_SUCCESS;
+}
diff --git a/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.h b/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.h
new file mode 100644
index 00000000..4fa69cd7
--- /dev/null
+++ b/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.h
@@ -0,0 +1,122 @@
+/** @file
+
+Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+Module Name:
+
+ DriverSample.h
+
+Abstract:
+
+
+Revision History
+
+
+**/
+
+#ifndef _DRIVER_SAMPLE_H_
+#define _DRIVER_SAMPLE_H_
+
+#include <Uefi.h>
+
+#include <Protocol/HiiConfigRouting.h>
+#include <Protocol/FormBrowser2.h>
+#include <Protocol/HiiConfigAccess.h>
+#include <Protocol/HiiDatabase.h>
+#include <Protocol/HiiString.h>
+#include <Protocol/FormBrowserEx.h>
+#include <Protocol/HiiConfigKeyword.h>
+#include <Protocol/HiiPopup.h>
+
+#include <Guid/MdeModuleHii.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/UefiRuntimeServicesTableLib.h>
+#include <Library/UefiDriverEntryPoint.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/HiiLib.h>
+#include <Library/DevicePathLib.h>
+#include <Library/PrintLib.h>
+#include <Library/UefiLib.h>
+
+#include "NVDataStruc.h"
+
+//
+// This is the generated IFR binary data for each formset defined in VFR.
+// This data array is ready to be used as input of HiiAddPackages() 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 HiiAddPackages() to
+// create a packagelist (which contains Form packages, String packages, etc).
+//
+extern UINT8 DriverSampleStrings[];
+
+#define DYNAMIC_ONE_OF_VAR_OFFSET OFFSET_OF (DRIVER_SAMPLE_CONFIGURATION, DynamicOneof)
+#define DYNAMIC_ORDERED_LIST_VAR_OFFSET OFFSET_OF (DRIVER_SAMPLE_CONFIGURATION, DynamicOrderedList)
+
+#define DEFAULT_CLASS_MANUFACTURING_VALUE 0xFF
+#define DEFAULT_CLASS_STANDARD_VALUE 0x0
+
+//
+// Number of name in Name/Value storage
+//
+#define NAME_VALUE_NAME_NUMBER 3
+
+#define DRIVER_SAMPLE_PRIVATE_SIGNATURE SIGNATURE_32 ('D', 'S', 'p', 's')
+
+typedef struct {
+ UINTN Signature;
+
+ EFI_HANDLE DriverHandle[2];
+ EFI_HII_HANDLE HiiHandle[2];
+ DRIVER_SAMPLE_CONFIGURATION Configuration;
+ MY_EFI_VARSTORE_DATA VarStoreConfig;
+ MY_EFI_BITS_VARSTORE_DATA BitsVarStoreConfig;
+ MY_EFI_UNION_DATA UnionConfig;
+
+ //
+ // Name/Value storage Name list
+ //
+ EFI_STRING_ID NameStringId[NAME_VALUE_NAME_NUMBER];
+ EFI_STRING NameValueName[NAME_VALUE_NAME_NUMBER];
+
+ //
+ // Consumed protocol
+ //
+ EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
+ EFI_HII_STRING_PROTOCOL *HiiString;
+ EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;
+ EFI_CONFIG_KEYWORD_HANDLER_PROTOCOL *HiiKeywordHandler;
+ EFI_HII_POPUP_PROTOCOL *HiiPopup;
+
+ 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)
+
+#pragma pack(1)
+
+///
+/// HII specific Vendor Device Path definition.
+///
+typedef struct {
+ VENDOR_DEVICE_PATH VendorDevicePath;
+ EFI_DEVICE_PATH_PROTOCOL End;
+} HII_VENDOR_DEVICE_PATH;
+
+#pragma pack()
+
+#endif
diff --git a/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.uni b/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.uni
new file mode 100644
index 00000000..92cd5a1c
--- /dev/null
+++ b/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.uni
@@ -0,0 +1,17 @@
+// /** @file
+// This is a sample HII driver.
+//
+// This driver shows how HII protocol, VFR and UNI files are used to create a HII
+// driver which can be displayed and configured by a UEFI HII Form Browser.
+//
+// Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// **/
+
+
+#string STR_MODULE_ABSTRACT #language en-US "A sample HII driver"
+
+#string STR_MODULE_DESCRIPTION #language en-US "This driver shows how HII protocol, VFR and UNI files are used to create a HII driver that can be displayed and configured by a UEFI HII Form Browser."
+
diff --git a/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf b/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf
new file mode 100644
index 00000000..7fdbff3d
--- /dev/null
+++ b/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf
@@ -0,0 +1,96 @@
+## @file
+# This is a sample HII driver.
+#
+# This driver shows how HII protocol, VFR and UNI files are used to create a HII
+# driver which can be displayed and configured by a UEFI HII Form Browser.
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = DriverSample
+ MODULE_UNI_FILE = DriverSample.uni
+ FILE_GUID = FE3542FE-C1D3-4EF8-657C-8048606FF671
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ ENTRY_POINT = DriverSampleInit
+ UNLOAD_IMAGE = DriverSampleUnload
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 EBC
+#
+
+[Sources]
+ DriverSample.c
+ InventoryStrings.uni
+ NVDataStruc.h
+ VfrStrings.uni
+ DriverSample.h
+ Inventory.vfr
+ Vfr.vfr
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+
+
+[LibraryClasses]
+ BaseLib
+ MemoryAllocationLib
+ UefiBootServicesTableLib
+ UefiDriverEntryPoint
+ UefiRuntimeServicesTableLib
+ BaseMemoryLib
+ DebugLib
+ HiiLib
+ PrintLib
+ UefiLib
+ DevicePathLib
+
+[Guids]
+ gEfiIfrTianoGuid ## PRODUCES ## UNDEFINED
+ gDriverSampleInventoryGuid ## CONSUMES ## HII
+ ## SOMETIMES_PRODUCES ## Event
+ ## CONSUMES ## Event
+ gEfiIfrRefreshIdOpGuid
+ ## CONSUMES ## HII
+ ## PRODUCES ## Variable:L"MyIfrNVData"
+ ## SOMETIMES_CONSUMES ## Variable:L"MyIfrNVData"
+ ## PRODUCES ## Variable:L"MyEfiVar"
+ ## SOMETIMES_CONSUMES ## Variable:L"MyEfiVar"
+ ## PRODUCES ## GUID # HiiConstructConfigHdr MyEfiVar
+ ## PRODUCES ## GUID # HiiConstructConfigHdr MyIfrNVData
+ ## SOMETIMES_CONSUMES ## GUID # HiiIsConfigHdrMatch MyEfiVar
+ ## SOMETIMES_CONSUMES ## GUID # HiiIsConfigHdrMatch MyIfrNVData
+ ## SOMETIMES_PRODUCES ## GUID # HiiGetBrowserData MyIfrNVData
+ ## SOMETIMES_CONSUMES ## GUID # HiiSetBrowserData MyIfrNVData
+ ## SOMETIMES_PRODUCES ## GUID # HiiGetBrowserData MyEfiVar
+ ## SOMETIMES_CONSUMES ## GUID # HiiSetBrowserData MyEfiVar
+ gDriverSampleFormSetGuid
+
+[Protocols]
+ ## PRODUCES # DriverSampleFormSet
+ ## PRODUCES # DriverSampleInventory
+ gEfiDevicePathProtocolGuid
+ gEfiHiiStringProtocolGuid ## CONSUMES
+ gEfiHiiConfigRoutingProtocolGuid ## CONSUMES
+ gEfiHiiConfigAccessProtocolGuid ## PRODUCES
+ gEfiFormBrowser2ProtocolGuid ## CONSUMES
+ gEfiHiiDatabaseProtocolGuid ## CONSUMES
+ gEfiSimpleTextInputExProtocolGuid ## SOMETIMES_CONSUMES
+ gEdkiiFormBrowserExProtocolGuid ## CONSUMES
+ gEfiConfigKeywordHandlerProtocolGuid ## CONSUMES
+ gEfiHiiPopupProtocolGuid ## CONSUMES
+
+[Depex]
+ gEfiSimpleTextOutProtocolGuid AND gEfiHiiDatabaseProtocolGuid AND gEfiVariableArchProtocolGuid AND gEfiVariableWriteArchProtocolGuid
+
+[UserExtensions.TianoCore."ExtraFiles"]
+ DriverSampleExtra.uni
diff --git a/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/DriverSampleExtra.uni b/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/DriverSampleExtra.uni
new file mode 100644
index 00000000..15a8598e
--- /dev/null
+++ b/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/DriverSampleExtra.uni
@@ -0,0 +1,14 @@
+// /** @file
+// DriverSample Localized Strings and Content
+//
+// Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// **/
+
+#string STR_PROPERTIES_MODULE_NAME
+#language en-US
+"HII Sample DXE Driver"
+
+
diff --git a/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/Inventory.vfr b/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/Inventory.vfr
new file mode 100644
index 00000000..cb28c0bc
--- /dev/null
+++ b/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/Inventory.vfr
@@ -0,0 +1,111 @@
+///** @file
+//
+// Sample Inventory Data
+//
+// Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+//**/
+
+#include "NVDataStruc.h"
+
+formset
+ guid = DRIVER_SAMPLE_INVENTORY_GUID,
+ title = STRING_TOKEN(STR_INV_FORM_SET_TITLE),
+ help = STRING_TOKEN(STR_INV_FORM_SET_HELP),
+
+ 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;
+
+ text
+ help = STRING_TOKEN(STR_CHECK_KEYWORD_SUPPORT),
+ text = STRING_TOKEN(STR_CHECK_KEYWORD_SUPPORT),
+ flags = INTERACTIVE,
+ key = 0x1231;
+
+ subtitle text = STRING_TOKEN(STR_INV_EMPTY_STRING);
+
+ subtitle text = STRING_TOKEN(STR_INV_VERSION_TEXT12);
+
+ endform;
+
+endformset;
diff --git a/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/InventoryStrings.uni b/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/InventoryStrings.uni
new file mode 100644
index 00000000..83622969
--- /dev/null
+++ b/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/InventoryStrings.uni
@@ -0,0 +1,60 @@
+// *++
+//
+// Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// Module Name:
+//
+// InventoryStrings.uni
+//
+// Abstract:
+//
+// String definitions for Inventory file.
+//
+// Revision History:
+//
+// --*/
+
+
+/=#
+
+#langdef en-US "English"
+#langdef fr-FR "Francais"
+
+
+#string STR_INV_FORM_SET_TITLE #language en-US "ABC Information Sample"
+ #language fr-FR "Mi motor Español de arreglo"
+#string STR_INV_FORM_SET_HELP #language en-US "The ABC Network Controller version information, which includes Firmware versions as well as supported characteristics"
+ #language fr-FR "The ABC Network Controller version information, which includes Firmware versions as well as supported characteristics"
+#string STR_INV_FORM1_TITLE #language en-US "ABC Network Controller Version Data"
+ #language fr-FR "Mi Primero Arreglo Página"
+#string STR_INV_VERSION_TEXT #language en-US "Firmware Revision Date: 02/03/2002"
+ #language fr-FR "Firmware Revision Date: 02/03/2002"
+#string STR_INV_VERSION_HELP #language en-US "The date of the revision of the Firmware being used."
+ #language fr-FR "The date of the revision of the Firmware being used."
+#string STR_INV_VERSION_TEXT2 #language en-US "Major Version: 6.32.5"
+ #language fr-FR "Major Version: 6.32.5"
+#string STR_INV_VERSION_TEXT3 #language en-US "Patch Version: 1.02.53"
+ #language fr-FR "Patch Version: 1.02.53"
+#string STR_INV_VERSION_TEXT4 #language en-US "Characteristics: 10/100 Mb/s"
+ #language fr-FR "Characteristics: 10/100 Mb/s"
+#string STR_INV_VERSION_TEXT5 #language en-US " 3.3 V power usage"
+ #language fr-FR " 3.3 V power usage"
+#string STR_INV_VERSION_TEXT6 #language en-US " 3K Transmit FIFO"
+ #language fr-FR " 3K Transmit FIFO"
+#string STR_INV_VERSION_TEXT7 #language en-US " 3K Receive FIFO"
+ #language fr-FR " 3K Receive FIFO"
+#string STR_INV_VERSION_TEXT8 #language en-US " TCP/UDP checksum offload"
+ #language fr-FR " TCP/UDP checksum offload"
+#string STR_INV_VERSION_TEXT9 #language en-US " 128K Flash"
+ #language fr-FR " 128K Flash"
+#string STR_INV_VERSION_TEXT10 #language en-US " 32-bit PCI"
+ #language fr-FR " 32-bit PCI"
+#string STR_INV_VERSION_TEXT11 #language en-US " Intel® 82540EM"
+ #language fr-FR " Intel® 82540EM"
+#string STR_INV_VERSION_TEXT12 #language en-US "Press ESC to exit."
+ #language fr-FR "Press ESC to exit."
+#string STR_INV_EMPTY_STRING #language en-US ""
+ #language fr-FR ""
+
+
diff --git a/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h b/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h
new file mode 100644
index 00000000..ba208564
--- /dev/null
+++ b/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h
@@ -0,0 +1,132 @@
+/** @file
+
+Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>*
+(C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+Module Name:
+
+ NVDataStruc.h
+
+Abstract:
+
+ NVData structure used by the sample driver
+
+Revision History:
+
+
+**/
+
+#ifndef _NVDATASTRUC_H_
+#define _NVDATASTRUC_H_
+
+#include <Guid/HiiPlatformSetupFormset.h>
+#include <Guid/HiiFormMapMethodGuid.h>
+#include <Guid/DriverSampleHii.h>
+#include <Guid/ZeroGuid.h>
+
+#define CONFIGURATION_VARSTORE_ID 0x1234
+#define BITS_VARSTORE_ID 0x2345
+
+#pragma pack(1)
+
+//
+// !!! For a structure with a series of bit fields and used as a storage in vfr file, and if the bit fields do not add up to the size of the defined type.
+// In the C code use sizeof() to get the size the strucure, the results may vary form the compiler(VS,GCC...).
+// But the size of the storage calculated by VfrCompiler is fixed (calculate with alignment).
+// To avoid above case, we need to make the total bit width in the structure aligned with the size of the defined type for these bit fields. We can:
+// 1. Add bit field (with/without name) with remianing with for padding.
+// 2. Add unnamed bit field with 0 for padding, the amount of padding is determined by the alignment characteristics of the members of the structure.
+//
+typedef struct {
+ UINT16 NestByteField;
+ UINT8 : 1; // unamed field can be used for padding
+ UINT8 NestBitCheckbox : 1;
+ UINT8 NestBitOneof : 2;
+ UINT8 : 0; // Special width 0 can be used to force alignment at the next word boundary
+ UINT8 NestBitNumeric : 4;
+} MY_BITS_DATA;
+
+typedef union {
+ UINT8 UnionNumeric;
+ UINT8 UnionNumericAlias;
+} MY_EFI_UNION_DATA;
+
+typedef struct {
+ UINT16 MyStringData[40];
+ 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];
+ UINT16 BootOrder[8];
+ UINT8 BootOrderLarge;
+ UINT8 DynamicRefresh;
+ UINT8 DynamicOneof;
+ UINT8 DynamicOrderedList[5];
+ UINT8 Reserved;
+ EFI_HII_REF RefData;
+ UINT8 NameValueVar0;
+ UINT16 NameValueVar1;
+ UINT16 NameValueVar2[20];
+ UINT8 SerialPortNo;
+ UINT8 SerialPortStatus;
+ UINT16 SerialPortIo;
+ UINT8 SerialPortIrq;
+ UINT8 GetDefaultValueFromCallBack;
+ UINT8 GetDefaultValueFromAccess;
+ EFI_HII_TIME Time;
+ UINT8 RefreshGuidCount;
+ UINT8 Match2;
+ UINT8 GetDefaultValueFromCallBackForOrderedList[3];
+ UINT8 BitCheckbox : 1;
+ UINT8 ReservedBits: 7; // Reserved bit fields for padding.
+ UINT16 BitOneof : 6;
+ UINT16 : 0; // Width 0 used to force alignment.
+ UINT16 BitNumeric : 12;
+ MY_BITS_DATA MyBitData;
+ MY_EFI_UNION_DATA MyUnionData;
+ UINT8 QuestionXUefiKeywordRestStyle;
+ UINT8 QuestionNonXUefiKeywordRestStyle;
+} DRIVER_SAMPLE_CONFIGURATION;
+
+//
+// 2nd NV data structure definition
+//
+typedef struct {
+ UINT8 Field8;
+ UINT16 Field16;
+ UINT8 OrderedList[3];
+ UINT16 SubmittedCallback;
+} MY_EFI_VARSTORE_DATA;
+
+//
+// 3rd NV data structure definition
+//
+typedef struct {
+ MY_BITS_DATA BitsData;
+ UINT32 EfiBitGrayoutTest : 5;
+ UINT32 EfiBitNumeric : 4;
+ UINT32 EfiBitOneof : 10;
+ UINT32 EfiBitCheckbox : 1;
+ UINT32 : 0; // Width 0 used to force alignment.
+} MY_EFI_BITS_VARSTORE_DATA;
+
+//
+// Labels definition
+//
+#define LABEL_UPDATE1 0x1234
+#define LABEL_UPDATE2 0x2234
+#define LABEL_UPDATE3 0x3234
+#define LABEL_END 0x2223
+
+#pragma pack()
+
+#endif
diff --git a/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr b/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr
new file mode 100644
index 00000000..ddec2c0e
--- /dev/null
+++ b/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr
@@ -0,0 +1,968 @@
+///** @file
+//
+// Sample Setup formset.
+//
+// Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
+// (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+//**/
+
+
+#include <Uefi/UefiMultiPhase.h>
+#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
+
+#define EFI_USER_INFO_ACCESS_SETUP_ADMIN_GUID \
+ { 0x85b75607, 0xf7ce, 0x471e, { 0xb7, 0xe4, 0x2a, 0xea, 0x5f, 0x72, 0x32, 0xee } }
+
+#define PERL_GUID \
+ { 0x63E60A51, 0x497D, 0xD427, {0xC4, 0xA5, 0xB8, 0xAB, 0xDC, 0x3A, 0xAE, 0xB6 }}
+
+//
+// Labels definition
+//
+#define LABEL_1_VALUE 0x01
+#define LABEL_2_VALUE 0x1000
+#define LABEL_UPDATE_BBS 0x2222
+
+formset
+ guid = DRIVER_SAMPLE_FORMSET_GUID,
+ title = STRING_TOKEN(STR_FORM_SET_TITLE),
+ help = STRING_TOKEN(STR_FORM_SET_TITLE_HELP),
+ classguid = EFI_HII_PLATFORM_SETUP_FORMSET_GUID,
+
+ //
+ // Notes: VfrCompiler will insert a Standard Default Storage declaration
+ // after the formset declaration. >00000040: 5C 06 00 00 00 00.
+ // So we don't need to declare the Standard Default.
+ // Please check the vfr.lst file for details.
+ // To enable list file for VFR, add "-l" to VfrCompile <Command> in [Build.Visual-Form-Representation-File] as follows:
+ // VfrCompile -l --no-pre-processing --output-directory ${d_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
+ //
+
+ //
+ // Define a Buffer Storage (EFI_IFR_VARSTORE)
+ //
+ varstore DRIVER_SAMPLE_CONFIGURATION, // This is the data structure type
+ varid = CONFIGURATION_VARSTORE_ID, // Optional VarStore ID
+ name = MyIfrNVData, // Define referenced name in vfr
+ guid = DRIVER_SAMPLE_FORMSET_GUID; // GUID of this buffer storage
+
+ //
+ // Define a EFI variable Storage (EFI_IFR_VARSTORE_EFI)
+ //
+ efivarstore MY_EFI_VARSTORE_DATA,
+ attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE, // EFI variable attribures
+ name = MyEfiVar,
+ guid = DRIVER_SAMPLE_FORMSET_GUID;
+
+ //
+ // Define a Buffer Storage (EFI_IFR_VARSTORE)
+ //
+ efivarstore MY_EFI_BITS_VARSTORE_DATA, // This is the data structure type
+ attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE, // EFI variable attribures
+ name = MyEfiBitVar, // Define referenced name in vfr
+ guid = DRIVER_SAMPLE_FORMSET_GUID; // GUID of this buffer storage
+
+ efivarstore MY_EFI_UNION_DATA,
+ attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE, // EFI variable attribures
+ name = MyEfiUnionVar,
+ guid = DRIVER_SAMPLE_FORMSET_GUID;
+
+ //
+ // Define a Name/Value Storage (EFI_IFR_VARSTORE_NAME_VALUE)
+ //
+ namevaluevarstore MyNameValueVar, // Define storage reference name in vfr
+ name = STRING_TOKEN(STR_NAME_VALUE_VAR_NAME0), // Define Name list of this storage, refer it by MyNameValueVar[0]
+ name = STRING_TOKEN(STR_NAME_VALUE_VAR_NAME1), // Define Name list of this storage, refer it by MyNameValueVar[1]
+ name = STRING_TOKEN(STR_NAME_VALUE_VAR_NAME2), // Define Name list of this storage, refer it by MyNameValueVar[2]
+ guid = DRIVER_SAMPLE_FORMSET_GUID; // GUID of this Name/Value storage
+
+ defaultstore MyStandardDefault,
+ prompt = STRING_TOKEN(STR_STANDARD_DEFAULT_PROMPT),
+ attribute = 0x0000; // Default ID: 0000 standard default
+
+ defaultstore MyManufactureDefault,
+ prompt = STRING_TOKEN(STR_MANUFACTURE_DEFAULT_PROMPT),
+ attribute = 0x0001; // Default ID: 0001 manufacture default
+
+ //
+ // 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
+
+ //
+ // Define action button (EFI_IFR_ACTION)
+ //
+ text
+ help = STRING_TOKEN(STR_EXIT_TEXT),
+ text = STRING_TOKEN(STR_EXIT_TEXT),
+ flags = INTERACTIVE, // VfrCompiler will generate opcode EFI_IFR_ACTION for Text marked as INTERACTIVE
+ key = 0x1237;
+
+ text
+ help = STRING_TOKEN(STR_SAVE_TEXT),
+ text = STRING_TOKEN(STR_SAVE_TEXT),
+ flags = INTERACTIVE,
+ key = 0x1238;
+
+ text
+ help = STRING_TOKEN(STR_SAVE_CURRENT),
+ text = STRING_TOKEN(STR_SAVE_CURRENT),
+ flags = INTERACTIVE,
+ key = 0x1243;
+
+ text
+ help = STRING_TOKEN(STR_DISCARD_CURRENT_AND_EXIT),
+ text = STRING_TOKEN(STR_DISCARD_CURRENT_AND_EXIT),
+ flags = INTERACTIVE,
+ key = 0x1244;
+ //
+ // Define oneof (EFI_IFR_ONE_OF)
+ //
+ oneof name = MyOneOf, // Define reference name for Question
+ 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),
+ default value = cond (pushthis == 0 ? 0 : cond ((questionref(MyOneOf) >> 0x4 & 0xF00) == 0x0 + 0x2 ? 0 : 1)),
+ option text = STRING_TOKEN(STR_BOOT_ORDER1), value = 0x0, flags = 0;
+ option text = STRING_TOKEN(STR_BOOT_ORDER2), value = 0x1, flags = 0;
+ endoneof;
+
+ grayoutif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x1;
+ suppressif questionref(MyOneOf) == 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
+ // CHECKBOX_DEFAULT_MFG indicate EFI_IFR_CHECKBOX_DEFAULT_MFG.
+ //
+ flags = CHECKBOX_DEFAULT | CHECKBOX_DEFAULT_MFG,
+ default = TRUE,
+ 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),
+ flags = RESET_REQUIRED,
+ option text = STRING_TOKEN(STR_BOOT_OPTION2), value = 2, flags = 0;
+ option text = STRING_TOKEN(STR_BOOT_OPTION1), value = 1, flags = 0;
+ option text = STRING_TOKEN(STR_BOOT_OPTION3), value = 3, flags = 0;
+ 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
+
+ disableif ideqval MyIfrNVData.SuppressGrayOutSomething == 0x2;
+ orderedlist
+ varid = MyIfrNVData.OrderedList,
+ prompt = STRING_TOKEN(STR_TEST_OPCODE),
+ help = STRING_TOKEN(STR_TEXT_HELP),
+ flags = RESET_REQUIRED,
+ option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 3, flags = 0;
+ option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 2, flags = 0;
+ option text = STRING_TOKEN(STR_ONE_OF_TEXT3), value = 1, flags = 0;
+ default = {1,2,3},
+ 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),
+ flags = RESET_REQUIRED,
+ option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = 0;
+ option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = DEFAULT;
+ warningif prompt = STRING_TOKEN(STR_WARNING_POPUP), timeout = 5,
+ ideqval MyIfrNVData.TestLateCheck == 0
+ endif;
+
+ endoneof;
+
+ oneof varid = MyIfrNVData.TestLateCheck2,
+ prompt = STRING_TOKEN(STR_TEST_OPCODE2),
+ help = STRING_TOKEN(STR_ONE_OF_HELP),
+ flags = RESET_REQUIRED,
+ option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = DEFAULT;
+ option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = 0;
+
+ 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_KEYWORD),
+ help = STRING_TOKEN(STR_ONE_OF_HELP),
+ flags = RESET_REQUIRED,
+ option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = 0;
+ option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = DEFAULT;
+ option text = STRING_TOKEN(STR_ONE_OF_TEXT3), value = 3, flags = 0;
+ endoneof;
+
+ //
+ // This is an HII option which has REST_STYLE flag and x-UEFI namespace
+ // UNI string associated. This HII option could be configured by either in-band
+ // edk2 setup browser or the remote management in out-of-band such as Redfish
+ // service. This HII option is configured through EFI_KEYWORD_HANDLER_PROTOCOL.
+ //
+ oneof varid = MyIfrNVData.QuestionXUefiKeywordRestStyle,
+ prompt = STRING_TOKEN(STR_ONE_OF_PROMPT_X_UEFI),
+ help = STRING_TOKEN(STR_ONE_OF_PROMPT_X_UEFI_HELP),
+ flags = RESET_REQUIRED | REST_STYLE,
+ option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 0, flags = 0;
+ option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 1, flags = DEFAULT;
+ option text = STRING_TOKEN(STR_ONE_OF_TEXT3), value = 3, flags = 0;
+ endoneof;
+
+
+ //
+ // This is a HII option which has REST_STYLE flag but without the x-UEFI namespace
+ // UNI string associated. This HII option could be configured by either
+ // setup browser or the remote management in out-of-band such as Redfish
+ // service. This HII option is configured through EFI HII Configuration Routing
+ // Protocol becasue it doesn't have x-UEFI namespace UNI string.
+ //
+ numeric varid = MyIfrNVData.QuestionNonXUefiKeywordRestStyle,
+ prompt = STRING_TOKEN(STR_ONE_OF_PROMPT_NON_X_UEFI),
+ help = STRING_TOKEN(STR_ONE_OF_PROMPT_NON_X_UEFI_HELP),
+ flags = RESET_REQUIRED | REST_STYLE,
+ minimum = 0,
+ maximum = 0xf0,
+ step = 0, // Stepping of 0 equates to a manual entering
+ // of a value, otherwise it will be adjusted by "+"/"-"
+ default = 0, // defaultstore could be used to specify the default type
+ // If no defaultstore is specified, it implies Standard Default
+ endnumeric;
+
+ //
+ // 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 = 40,
+ inconsistentif prompt = STRING_TOKEN(STR_STRING_CHECK_ERROR_POPUP),
+ pushthis != stringref(STRING_TOKEN(STR_STRING_CHECK))
+ endif;
+ 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 = 21, // defaultstore could be used to specify the default type
+ // If no defaultstore is specified, it implies Standard Default
+
+ 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 value = questionrefval(devicepath = STRING_TOKEN (STR_DEVICE_PATH), guid = DRIVER_SAMPLE_FORMSET_GUID, 0x1111),
+
+ inconsistentif prompt = STRING_TOKEN(STR_ERROR_POPUP),
+ ideqval MyIfrNVData.HowOldAreYouInYearsManual == 99
+ OR
+ ideqid MyIfrNVData.HowOldAreYouInYearsManual == MyEfiVar.Field8
+ OR
+ ideqvallist MyIfrNVData.HowOldAreYouInYearsManual == 1 3 5 7
+ endif;
+
+ endnumeric;
+
+ numeric varid = MyEfiVar.Field8, // Reference of EFI variable storage
+ questionid = 0x1111,
+ prompt = STRING_TOKEN(STR_TALL_HEX_PROMPT),
+ help = STRING_TOKEN(STR_NUMERIC_HELP1),
+ flags = DISPLAY_UINT_HEX | INTERACTIVE, // Display in HEX format (if not specified, default is in decimal format)
+ minimum = 0,
+ maximum = 250,
+ default = 18, defaultstore = MyStandardDefault, // This is standard default value
+ default = 19, defaultstore = MyManufactureDefault, // This is manufacture default value
+
+ endnumeric;
+
+ //
+ // Define numeric using Name/Value Storage
+ //
+ numeric varid = MyNameValueVar[0], // This numeric take NameValueVar0 as storage
+ prompt = STRING_TOKEN(STR_NAME_VALUE_VAR_NAME0),
+ help = STRING_TOKEN(STR_NAME_VALUE_VAR_NAME0_HELP),
+ //
+ // Size should be defined for numeric when use Name/Value storage
+ // Valid value for numerice size are: NUMERIC_SIZE_1, NUMERIC_SIZE_2, NUMERIC_SIZE_4 and NUMERIC_SIZE_8
+ //
+ flags = NUMERIC_SIZE_1, // Size of this numeric is 1 byte
+ minimum = 0,
+ maximum = 0xff,
+ step = 0,
+ locked,
+ default = 16, defaultstore = MyStandardDefault, // This is standard default value
+ default = 17, defaultstore = MyManufactureDefault, // This is manufacture default value
+ endnumeric;
+
+ numeric varid = MyNameValueVar[1], // This numeric take NameValueVar1 as storage
+ prompt = STRING_TOKEN(STR_NAME_VALUE_VAR_NAME1),
+ help = STRING_TOKEN(STR_NAME_VALUE_VAR_NAME1_HELP),
+ flags = NUMERIC_SIZE_2, // Size of this numeric is 2 bytes
+ minimum = 0,
+ maximum = 0xffff,
+ step = 0,
+ default = 18, defaultstore = MyStandardDefault, // This is standard default value
+ default = 19, defaultstore = MyManufactureDefault, // This is manufacture default value
+ endnumeric;
+
+ //
+ // Define string using Name/Value Storage
+ //
+ string varid = MyNameValueVar[2], // This string take NameValueVar2 as storage
+ prompt = STRING_TOKEN(STR_NAME_VALUE_VAR_NAME2),
+ help = STRING_TOKEN(STR_NAME_VALUE_VAR_NAME2_HELP),
+ minsize = 2,
+ maxsize = 0x14,
+ endstring;
+
+ oneof varid = MyEfiVar.Field16,
+ prompt = STRING_TOKEN(STR_ONE_OF_PROMPT),
+ help = STRING_TOKEN(STR_NUMERIC_NUM_HELP),
+ option text = STRING_TOKEN(STR_BOOT_ORDER1), value = 0x0, flags = 0;
+ option text = STRING_TOKEN(STR_BOOT_ORDER2), value = 0x1, flags = DEFAULT;
+ endoneof;
+
+ 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, defaultstore = MyStandardDefault, // This is standard default value
+ default = 19, defaultstore = MyManufactureDefault, // This is manufacture default value
+
+ endnumeric;
+ endif;
+
+ numeric varid = MyIfrNVData.GetDefaultValueFromAccess,
+ questionid = 0x1239,
+ prompt = STRING_TOKEN(STR_DEFAULT_VALUE_FROM_ACCESS_PROMPT),
+ help = STRING_TOKEN(STR_DEFAULT_VALUE_FROM_ACCESS_HELP),
+ flags = DISPLAY_UINT_HEX | INTERACTIVE,
+ minimum = 0,
+ maximum = 255,
+ step = 1,
+ default = 18,
+ endnumeric;
+
+ numeric varid = MyIfrNVData.GetDefaultValueFromCallBack,
+ questionid = 0x1240,
+ prompt = STRING_TOKEN(STR_DEFAULT_VALUE_FROM_CALLBACK_PROMPT),
+ help = STRING_TOKEN(STR_DEFAULT_VALUE_FROM_CALLBACK_HELP),
+ flags = DISPLAY_UINT_HEX | INTERACTIVE,
+ minimum = 0,
+ maximum = 255,
+ step = 1,
+ default = 18,
+ endnumeric;
+
+ orderedlist
+ varid = MyIfrNVData.GetDefaultValueFromCallBackForOrderedList,
+ questionid = 0x1252,
+ prompt = STRING_TOKEN(STR_DEFAULT_VALUE_FROM_CALLBACK_PROMPT),
+ help = STRING_TOKEN(STR_DEFAULT_VALUE_FROM_CALLBACK_HELP),
+ flags = INTERACTIVE,
+ option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 1, flags = 0;
+ option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 2, flags = 0;
+ option text = STRING_TOKEN(STR_ONE_OF_TEXT3), value = 3, flags = 0;
+ endlist;
+
+ resetbutton
+ defaultstore = MyStandardDefault,
+ prompt = STRING_TOKEN(STR_STANDARD_DEFAULT_PROMPT),
+ help = STRING_TOKEN(STR_STANDARD_DEFAULT_HELP),
+ endresetbutton;
+
+ resetbutton
+ defaultstore = MyManufactureDefault,
+ prompt = STRING_TOKEN(STR_MANUFACTURE_DEFAULT_PROMPT),
+ help = STRING_TOKEN(STR_MANUFACTURE_DEFAULT_HELP),
+ endresetbutton;
+
+ //
+ // Sample use case for IFR Security op-code
+ //
+ grayoutif NOT security (EFI_USER_INFO_ACCESS_SETUP_ADMIN_GUID);
+ text
+ help = STRING_TOKEN(STR_TEXT_SECRUITY_TEST_HELP),
+ text = STRING_TOKEN(STR_TEXT_SECRUITY_TEST_TEXT);
+ endif;
+
+ numeric varid = MyEfiVar.SubmittedCallback,
+ questionid = 0x1250,
+ prompt = STRING_TOKEN(STR_SUBMITTED_CALLBACK_TEST_PROMPT),
+ help = STRING_TOKEN(STR_SUBMITTED_CALLBACK_TEST_HELP),
+ flags = INTERACTIVE,
+ minimum = 0,
+ maximum = 255,
+ default = 18,
+ endnumeric;
+
+ text
+ help = STRING_TOKEN(STR_POPUP_TEST_HELP),
+ text = STRING_TOKEN(STR_POPUP_TEST_PROMPT),
+ flags = INTERACTIVE,
+ key = 0x1330;
+
+ 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);
+
+ goto 4,
+ prompt = STRING_TOKEN(STR_GOTO_FORM4), //FourthSetupPage // this too has no end-op and basically it's a jump to a form ONLY
+ help = STRING_TOKEN(STR_GOTO_HELP);
+
+ goto 5,
+ prompt = STRING_TOKEN(STR_GOTO_FORM5), //FifthSetupPage // this too has no end-op and basically it's a jump to a form ONLY
+ help = STRING_TOKEN(STR_GOTO_FORM5_HELP);
+
+ goto 6,
+ prompt = STRING_TOKEN(STR_GOTO_FORM6), //SixthSetupPage // this too has no end-op and basically it's a jump to a form ONLY
+ help = STRING_TOKEN(STR_GOTO_HELP);
+
+ goto
+ formsetguid = DRIVER_SAMPLE_INVENTORY_GUID,
+ formid = 0x1,
+ question = 0x1,
+ prompt = STRING_TOKEN(STR_GOTO_ANOTHER_FORMSET),
+ help = STRING_TOKEN(STR_GOTO_ANOTHER_FORMSET_HELP);
+
+ guidop
+ guid = DRIVER_SAMPLE_FORMSET_GUID,
+ datatype = MY_EFI_VARSTORE_DATA,
+ data.Field8 = 0x21,
+ data.Field16 = 0x2121,
+ data.OrderedList[0] = 0x21,
+ endguidop;
+
+ goto 7,
+ prompt = STRING_TOKEN(STR_GOTO_FORM7),
+ help = STRING_TOKEN(STR_GOTO_FORM7_HELP);
+
+ endform;
+
+ suppressif ideqval MyIfrNVData.BootOrderLarge == 0;
+ 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
+ name = Date,
+ prompt = STRING_TOKEN(STR_DATE_PROMPT),
+ help = STRING_TOKEN(STR_DATE_HELP),
+ flags = STORAGE_TIME,
+ default = 2004/1/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;
+
+ text
+ help = STRING_TOKEN(STR_SAVE_CURRENT_AND_EXIT),
+ text = STRING_TOKEN(STR_SAVE_CURRENT_AND_EXIT),
+ flags = INTERACTIVE,
+ key = 0x1241;
+
+ text
+ help = STRING_TOKEN(STR_DISCARD_CURRENT),
+ text = STRING_TOKEN(STR_DISCARD_CURRENT),
+ flags = INTERACTIVE,
+ key = 0x1242;
+
+ time
+ prompt = STRING_TOKEN(STR_TIME_PROMPT),
+ help = STRING_TOKEN(STR_TIME_HELP),
+ flags = STORAGE_TIME,
+ endtime;
+
+ time
+ name = MyTime,
+ varid = MyIfrNVData.Time,
+ prompt = STRING_TOKEN(STR_TIME_PROMPT),
+ help = STRING_TOKEN(STR_TIME_PROMPT),
+ flags = STORAGE_NORMAL | SECOND_SUPPRESS,
+ default = 15:33:33,
+ endtime;
+
+ checkbox varid = MyIfrNVData.ChooseToActivateNuclearWeaponry,
+ prompt = STRING_TOKEN(STR_CHECK_BOX_PROMPT),
+ help = STRING_TOKEN(STR_CHECK_BOX_HELP),
+ flags = CHECKBOX_DEFAULT,
+ 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);
+
+ goto
+ varid = MyIfrNVData.RefData,
+ prompt = STRING_TOKEN(STR_GOTO_DYNAMIC3),
+ help = STRING_TOKEN(STR_GOTO_DYNAMIC3_HELP),
+ flags = INTERACTIVE,
+ key = 0x1248,
+ //
+ // Set the defult value, format is QuestionId; FormId; FormsetGuid; Device Path String Token
+ //
+ default = 0;0;ZERO_GUID;STRING_TOKEN(STR_NULL_STRING),
+ ; // goto opcode end flag.
+
+ goto
+ prompt = STRING_TOKEN(STR_GOTO_DYNAMIC4),
+ help = STRING_TOKEN(STR_GOTO_DYNAMIC4_HELP),
+ flags = INTERACTIVE,
+ key = 0x1249;
+
+ endform;
+ endif;
+
+ 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
+
+ suppressif ideqval MyEfiVar.Field8 == 111;
+ text
+ help = STRING_TOKEN(STR_TEXT_HELP),
+ text = STRING_TOKEN(STR_TEXT_TEXT_1);
+ endif;
+
+ goto 1,
+ prompt = STRING_TOKEN(STR_GOTO_FORM1), //MainSetupPage
+ help = STRING_TOKEN(STR_GOTO_HELP);
+
+ numeric varid = MyIfrNVData.DynamicRefresh,
+ prompt = STRING_TOKEN(STR_NUMERIC_MANUAL_PROMPT),
+ help = STRING_TOKEN(STR_NUMERIC_HELP0),
+ flags = INTERACTIVE,
+ key = 0x5678,
+ minimum = 0,
+ maximum = 0xff,
+ step = 0,
+ default = 0,
+ refresh interval = 3 // Refresh interval in seconds
+ endnumeric;
+
+ grayoutif match2 (stringref(STRING_TOKEN(STR_PATTERN)), stringref(STRING_TOKEN(STR_STRING)), PERL_GUID);
+ numeric
+ varid = MyIfrNVData.Match2,
+ prompt = STRING_TOKEN(STR_MATCH2_PROMPT),
+ help = STRING_TOKEN(STR_MATCH2_HELP),
+ minimum = 0,
+ maximum = 243,
+ endnumeric;
+ endif;
+
+ label LABEL_UPDATE2;
+ label LABEL_END;
+
+ endform;
+
+ formmap formid = 4,
+ maptitle = STRING_TOKEN(STR_SAMPL_MAP_METHOD);
+ mapguid = DRIVER_SAMPLE_FORMSET_GUID;
+ maptitle = STRING_TOKEN(STR_STANDARD_MAP_METHOD);
+ mapguid = EFI_HII_STANDARD_FORM_GUID;
+
+ oneof varid = MyIfrNVData.SerialPortNo,
+ prompt = STRING_TOKEN(STR_SERIAL_PORT),
+ help = STRING_TOKEN(STR_ONE_OF_HELP),
+
+ 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;)));
+ 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;));
+
+ option text = STRING_TOKEN(STR_SERIAL_PORT_DISABLE), value = 0x0, flags = DEFAULT;
+ option text = STRING_TOKEN(STR_SERIAL_PORT1), value = 0x1, flags = 0;
+ option text = STRING_TOKEN(STR_SERIAL_PORT2), value = 0x2, flags = 0;
+ option text = STRING_TOKEN(STR_SERIAL_PORT3), value = 0x3, flags = 0;
+ option text = STRING_TOKEN(STR_SERIAL_PORT4), value = 0x4, flags = 0;
+ endoneof;
+
+ grayoutif TRUE;
+ checkbox varid = MyIfrNVData.SerialPortStatus,
+ prompt = STRING_TOKEN(STR_SERIAL_PORT_STATUS),
+ help = STRING_TOKEN(STR_CHECK_BOX_HELP),
+ endcheckbox;
+ endif;
+
+ grayoutif TRUE;
+ suppressif ideqval MyIfrNVData.SerialPortStatus == 0;
+ oneof varid = MyIfrNVData.SerialPortIo,
+ prompt = STRING_TOKEN(STR_SERIAL_PORT_IO_ADDRESS),
+ help = STRING_TOKEN(STR_ONE_OF_HELP),
+
+ option text = STRING_TOKEN(STR_SERIAL_PORT1_IOADDR), value = 0x3F8, flags = DEFAULT;
+ option text = STRING_TOKEN(STR_SERIAL_PORT2_IOADDR), value = 0x2F8, flags = 0;
+ option text = STRING_TOKEN(STR_SERIAL_PORT3_IOADDR), value = 0x3E8, flags = 0;
+ option text = STRING_TOKEN(STR_SERIAL_PORT4_IOADDR), value = 0x2E8, flags = 0;
+ endoneof;
+ endif;
+ endif;
+
+ grayoutif TRUE;
+ suppressif ideqval MyIfrNVData.SerialPortStatus == 0;
+ oneof varid = MyIfrNVData.SerialPortIrq,
+ prompt = STRING_TOKEN(STR_SERIAL_PORT_IRQ),
+ help = STRING_TOKEN(STR_ONE_OF_HELP),
+
+ option text = STRING_TOKEN(STR_SERIAL_PORT13_IRQ), value = 0x4, flags = DEFAULT;
+ option text = STRING_TOKEN(STR_SERIAL_PORT24_IRQ), value = 0x3, flags = 0;
+ endoneof;
+ endif;
+ endif;
+
+ goto 1,
+ prompt = STRING_TOKEN(STR_GOTO_FORM1), //MainSetupPage
+ help = STRING_TOKEN(STR_GOTO_HELP);
+
+ endform;
+
+ form formid = 5, // Modal form
+ title = STRING_TOKEN(STR_MODAL_FORM_TITLE);
+ //
+ // This form is a modal form.
+ //
+ modal;
+ text
+ help = STRING_TOKEN(STR_EXIT_TEXT),
+ text = STRING_TOKEN(STR_EXIT_TEXT),
+ flags = INTERACTIVE, // VfrCompiler will generate opcode EFI_IFR_ACTION for Text marked as INTERACTIVE
+ key = 0x1245;
+
+ text
+ help = STRING_TOKEN(STR_SAVE_TEXT),
+ text = STRING_TOKEN(STR_SAVE_TEXT),
+ flags = INTERACTIVE, // VfrCompiler will generate opcode EFI_IFR_ACTION for Text marked as INTERACTIVE
+ key = 0x1246;
+ endform;
+
+ form formid = 6, // Form to show the refresh guid group op-code
+ title = STRING_TOKEN(STR_FORM6_TITLE);
+
+ text
+ help = STRING_TOKEN(STR_TEXT_REFRESH_GUID),
+ text = STRING_TOKEN(STR_TEXT_REFRESH_GUID);
+
+ numeric varid = MyIfrNVData.RefreshGuidCount,
+ prompt = STRING_TOKEN(STR_TEXT_REFRESH_GUID_COUNT),
+ help = STRING_TOKEN(STR_NUMERIC_HELP0),
+ flags = INTERACTIVE,
+ key = 0x1247,
+ minimum = 0,
+ maximum = 0xff,
+ step = 0,
+ default = 0,
+ refreshguid = EFI_IFR_REFRESH_ID_OP_GUID,
+ endnumeric;
+
+ label LABEL_UPDATE3;
+ label LABEL_END;
+
+ 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 LABEL_UPDATE1;
+ //
+ // This is where we will insert dynamic created opcodes
+ //
+ label LABEL_END;
+
+ endform;
+
+
+ form formid = 7, // Form to show the question refer to union and bit Varstore
+ title = STRING_TOKEN(STR_FORM7_TITLE);
+
+ subtitle text = STRING_TOKEN(STR_NEST_BIT_EFI_VARSTORE);
+
+ checkbox varid = MyEfiBitVar.BitsData.NestBitCheckbox,
+ prompt = STRING_TOKEN(STR_BIT_NEST_CHECK_BOX_PROMPT),
+ help = STRING_TOKEN(STR_BIT_NEST_CHECK_BOX_HELP),
+ flags = CHECKBOX_DEFAULT,
+ endcheckbox;
+
+ oneof varid = MyEfiBitVar.BitsData.NestBitOneof,
+ prompt = STRING_TOKEN(STR_ONE_OF_BIT_NEST_PROMPT),
+ help = STRING_TOKEN(STR_ONE_OF_BIT_NEST_HELP),
+ option text = STRING_TOKEN(STR_BOOT_ORDER1), value = 0, flags = MANUFACTURING;
+ option text = STRING_TOKEN(STR_BOOT_ORDER2), value = 1, flags = DEFAULT;
+ endoneof;
+
+ numeric varid = MyEfiBitVar.BitsData.NestBitNumeric,
+ questionid = 0x6666,
+ prompt = STRING_TOKEN(STR_BIT_NEST_NUMERIC_PROMPT),
+ help = STRING_TOKEN(STR_BIT_NEST_NUMERIC_DEFAULT_HELP),
+ flags = DISPLAY_UINT_HEX | INTERACTIVE,
+ minimum = 2,
+ maximum = 15,
+ step = 1,
+ endnumeric;
+
+ oneof varid = MyEfiBitVar.BitsData.NestByteField,
+ prompt = STRING_TOKEN(BYTE_QUESTION_NEST_BIT_PROMPT),
+ help = STRING_TOKEN(BYTE_QUESTION_NEST_BIT_HELP),
+ option text = STRING_TOKEN(STR_BOOT_ORDER1), value = 0, flags = MANUFACTURING;
+ option text = STRING_TOKEN(STR_BOOT_ORDER2), value = 1, flags = DEFAULT;
+ endoneof;
+
+ subtitle text = STRING_TOKEN(STR_SUBTITLE_TEXT2);
+ subtitle text = STRING_TOKEN(STR_BIT_EFI_VARSTORE);
+
+ checkbox varid = MyEfiBitVar.EfiBitCheckbox,
+ prompt = STRING_TOKEN(STR_BIT_CHECK_BOX_PROMPT),
+ help = STRING_TOKEN(STR_BIT_CHECK_BOX_HELP),
+ flags = CHECKBOX_DEFAULT,
+ endcheckbox;
+
+ grayoutif ideqval MyEfiBitVar.EfiBitGrayoutTest == 0;
+ numeric varid = MyEfiBitVar.EfiBitNumeric,
+ prompt = STRING_TOKEN(STR_BIT_NUMERIC_PROMPT),
+ help = STRING_TOKEN(STR_BIT_NUMERIC_HELP),
+ minimum = 0,
+ maximum = 7,
+ step = 0,
+ default = 4, defaultstore = MyStandardDefault,
+ default = 5, defaultstore = MyManufactureDefault,
+ endnumeric;
+ endif;
+
+ oneof varid = MyEfiBitVar.EfiBitOneof,
+ questionid = 0x9999,
+ prompt = STRING_TOKEN(STR_ONE_OF_BIT_PROMPT),
+ help = STRING_TOKEN(STR_ONE_OF_BIT_HELP),
+ option text = STRING_TOKEN(STR_BOOT_ORDER1), value = 0x0, flags = MANUFACTURING;
+ option text = STRING_TOKEN(STR_BOOT_ORDER2), value = 0x1, flags = DEFAULT;
+ endoneof;
+
+ subtitle text = STRING_TOKEN(STR_SUBTITLE_TEXT2);
+ subtitle text = STRING_TOKEN(STR_NEST_BIT_VARSTORE);
+ checkbox varid = MyIfrNVData.MyBitData.NestBitCheckbox,
+ prompt = STRING_TOKEN(STR_BIT_NEST_CHECK_BOX_PROMPT),
+ help = STRING_TOKEN(STR_BIT_NEST_CHECK_BOX_HELP),
+ flags = CHECKBOX_DEFAULT,
+ endcheckbox;
+
+ oneof varid = MyIfrNVData.MyBitData.NestBitOneof,
+ prompt = STRING_TOKEN(STR_ONE_OF_BIT_NEST_PROMPT),
+ help = STRING_TOKEN(STR_ONE_OF_BIT_NEST_HELP),
+ option text = STRING_TOKEN(STR_BOOT_ORDER1), value = 0, flags = MANUFACTURING;
+ option text = STRING_TOKEN(STR_BOOT_ORDER2), value = 1, flags = DEFAULT;
+ endoneof;
+
+ numeric varid = MyIfrNVData.MyBitData.NestBitNumeric,
+ prompt = STRING_TOKEN(STR_BIT_NEST_NUMERIC_PROMPT),
+ help = STRING_TOKEN(STR_BIT_NEST_NUMERIC_HELP),
+ minimum = 0,
+ maximum = 7,
+ step = 0,
+ default = 6, defaultstore = MyStandardDefault,
+ default = 7, defaultstore = MyManufactureDefault,
+ endnumeric;
+
+ oneof varid = MyIfrNVData.MyBitData.NestByteField,
+ prompt = STRING_TOKEN(BYTE_QUESTION_NEST_BIT_PROMPT),
+ help = STRING_TOKEN(BYTE_QUESTION_NEST_BIT_HELP),
+ option text = STRING_TOKEN(STR_BOOT_ORDER1), value = 0, flags = MANUFACTURING;
+ option text = STRING_TOKEN(STR_BOOT_ORDER2), value = 1, flags = DEFAULT;
+ endoneof;
+
+ subtitle text = STRING_TOKEN(STR_SUBTITLE_TEXT2);
+ subtitle text = STRING_TOKEN(STR_BIT_VARSTORE);
+
+ oneof varid = MyIfrNVData.BitOneof,
+ prompt = STRING_TOKEN(STR_ONE_OF_BIT_PROMPT),
+ help = STRING_TOKEN(STR_ONE_OF_BIT_HELP),
+ option text = STRING_TOKEN(STR_BOOT_ORDER1), value = 0, flags = MANUFACTURING;
+ option text = STRING_TOKEN(STR_BOOT_ORDER2), value = 1, flags = DEFAULT;
+ endoneof;
+
+ checkbox varid = MyIfrNVData.BitCheckbox,
+ prompt = STRING_TOKEN(STR_BIT_CHECK_BOX_PROMPT),
+ help = STRING_TOKEN(STR_BIT_CHECK_BOX_HELP),
+ flags = CHECKBOX_DEFAULT,
+ endcheckbox;
+
+ numeric varid = MyIfrNVData.BitNumeric,
+ prompt = STRING_TOKEN(STR_BIT_NUMERIC_PROMPT),
+ help = STRING_TOKEN(STR_BUFFER_BIT_NUMERIC_HELP),
+ minimum = 0,
+ maximum = 20,
+ step = 0,
+ default = 16, defaultstore = MyStandardDefault,
+ default = 17, defaultstore = MyManufactureDefault,
+ endnumeric;
+
+ subtitle text = STRING_TOKEN(STR_SUBTITLE_TEXT2);
+ subtitle text = STRING_TOKEN(STR_UNION_EFI_VARSTORE);
+
+ numeric varid = MyEfiUnionVar.UnionNumeric,
+ prompt = STRING_TOKEN(STR_UNION_BYTE_NUMERIC_PROMPT),
+ help = STRING_TOKEN(STR_UNION_BYTE_NUMERIC_HELP),
+ minimum = 0,
+ maximum = 20,
+ step = 0,
+ default = 7, defaultstore = MyStandardDefault,
+ default = 8, defaultstore = MyManufactureDefault,
+ endnumeric;
+
+ guidop
+ guid = DRIVER_SAMPLE_FORMSET_GUID,
+ datatype = MY_EFI_BITS_VARSTORE_DATA,
+ data.EfiBitNumeric = 1,
+ data.EfiBitOneof = 1,
+ data.EfiBitCheckbox = 1,
+ endguidop;
+
+ endform;
+
+endformset;
diff --git a/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni b/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni
new file mode 100644
index 00000000..8a3e286b
--- /dev/null
+++ b/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni
@@ -0,0 +1,436 @@
+// *++
+ //
+// Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+// (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// Module Name:
+//
+// VfrStrings.vfr
+//
+// Abstract:
+//
+// String definitions for Sample Setup formset.
+//
+// Revision History:
+//
+// --*/
+
+
+/=#
+
+#langdef en-US "English"
+#langdef fr-FR "Francais"
+#langdef x-UEFI-ns "UefiNameSpace"
+
+
+#string STR_FORM_SET_TITLE #language en-US "Browser Testcase Engine"
+ #language fr-FR "Browser Testcase Engine"
+#string STR_FORM_SET_TITLE_HELP #language en-US "This is a sample driver which is used to test the browser op-code operations. This is for development purposes and not to be distributed in any form other than a test application. Here is a set of wide \wideAAAAAAAAA\narrow and narrow AAA!"
+ #language fr-FR "This is a sample driver which is used to test the browser op-code operations. This is for development purposes and not to be distributed in any form other than a test application. Here is a set of wide \wideAAAAAAAAA\narrow and narrow AAA!"
+#string STR_FORM1_TITLE #language en-US "My First Setup Page"
+ #language fr-FR "Mi Primero Arreglo Página"
+#string STR_FORM2_TITLE #language en-US "My Second Setup Page"
+ #language fr-FR "Mi Segunda Paginación De la Disposición"
+#string STR_FORM3_TITLE #language en-US "My Third Setup Page"
+ #language fr-FR "Mi Tercera Paginación De la Disposición"
+#string STR_FORM6_TITLE #language en-US "My Sixth Setup Page"
+ #language fr-FR "My Sixth Setup Page"
+#string STR_DYNAMIC_TITLE #language en-US "My Dynamic Page"
+ #language fr-FR "My Dynamic Page Spanish"
+#string STR_SUBTITLE_TEXT #language en-US "My subtitle text"
+ #language fr-FR "Mi texto del subtítulo"
+#string STR_SUBTITLE_TEXT2 #language en-US " "
+ #language fr-FR " "
+#string STR_CPU_STRING #language en-US "My CPU Speed is "
+ #language fr-FR "My CPU Speed is "
+#string STR_CPU_STRING2 #language en-US " "
+ #language fr-FR " "
+#string STR_NUMERIC_NUM_PROMPT #language en-US "Please select the number"
+ #language fr-FR "Please select the number"
+#string STR_NUMERIC_NUM_HELP #language en-US "Check the input number, test the efi buffer varstore"
+ #language fr-FR "Check the input number, test the efi buffer varstore"
+#string STR_ONE_OF_PROMPT #language en-US "My one-of prompt #1"
+ #language fr-FR "Mi uno- de guía # 1"
+#string STR_ONE_OF_PROMPT_KEYWORD #language en-US "My Keyword Namespace Test"
+ #language fr-FR "My Keyword Namespace Test"
+ #language x-UEFI-ns "iSCSIBootEnable"
+#string STR_CHECK_KEYWORD_SUPPORT #language en-US "Check iSCSI Boot Enable"
+ #language fr-FR "Check iSCSI Boot Enable"
+#string STR_ONE_OF_PROMPT_X_UEFI #language en-US "x-UEFI HII Option"
+ #language fr-FR "x-UEFI HII Option"
+ #language x-UEFI-ns "xUefiHiiOption"
+#string STR_ONE_OF_PROMPT_X_UEFI_HELP #language en-US "This is an HII option which has REST_STYLE flag and x-UEFI namespace UNI string associated. This HII option could be configured by either in-band edk2 setup browser or the remote management in out-of-band such as Redfish service. This HII option is configured through EFI_KEYWORD_HANDLER_PROTOCOL."
+#string STR_ONE_OF_PROMPT_NON_X_UEFI #language en-US "Non x-UEFI HII Option"
+ #language fr-FR "Non x-UEFI HII Option"
+#string STR_ONE_OF_PROMPT_NON_X_UEFI_HELP #language en-US "This is a HII option which has REST_STYLE flag but without the x-UEFI namespace UNI string associated. This HII option could be configured by either setup browser or the remote management in out-of-band such as Redfish service. This HII option is configured through EFI HII Configuration Routing Protocol becasue it doesn't have x-UEFI namespace UNI string."
+#string STR_ONE_OF_HELP #language en-US "My one-of help is going to be a long string to test out the efficiency of the ability of the I am tired of typing capabilities"
+ #language fr-FR "Mi uno- de ayuda va a ser una cadena larga a probar fuera de la eficacia de la capacidad del yo es cansada de capacidades el pulsar."
+#string STR_ONE_OF_TEXT1 #language en-US "My one-of text #1"
+ #language fr-FR "Mi uno- del texto # 1"
+#string STR_ONE_OF_TEXT2 #language en-US "My one-of text #2"
+ #language fr-FR "Mi uno- del texto # 2"
+#string STR_ONE_OF_TEXT3 #language en-US "My one-of text #3"
+ #language fr-FR "Mi uno- del texto # 3"
+#string STR_ONE_OF_TEXT4 #language en-US "Suppress the Checkbox"
+ #language fr-FR "Mi uno- del texto # 4"
+#string STR_ONE_OF_TEXT5 #language en-US "GrayOut the Checkbox"
+ #language fr-FR "Mi uno- del texto # 5"
+#string STR_ONE_OF_TEXT6 #language en-US "Enable Checkbox"
+ #language fr-FR "Mi uno- del texto # 6"
+#string STR_BOOT_ORDER1 #language en-US "SmallBootList"
+ #language fr-FR "Mi uno- del texto # 7"
+#string STR_BOOT_ORDER2 #language en-US "LargeBootList"
+ #language fr-FR "Mi uno- del texto # 8"
+#string STR_CHECK_BOX_PROMPT #language en-US "Activate this check box"
+ #language fr-FR "Active Las Armas Nucleares"
+#string STR_CHECK_BOX_HELP #language en-US "This is the help message for the activation of check boxes. This is not to be confused with activating Czech boxes, since one can never tell what the ramifications are of activating foreign controlled boxes are."
+ #language fr-FR "Éste es el mensaje de la ayuda para la activación del armamento nuclear. Cuál es exactamente resistente calcular fuera sobre de eso?"
+#string STR_CHECK_DYNAMIC_PROMPT #language en-US "Activate Dynamic check box"
+ #language fr-FR "Activate Dynamico check box"
+#string STR_CHECK_DYNAMIC_HELP #language en-US "This is the help message for the activation of check boxes. This is not to be confused with activating Czech boxes, since one can never tell what the ramifications are of activating foreign controlled boxes are."
+ #language fr-FR "Spanish - This is the help message for the activation of check boxes. This is not to be confused with activating Czech boxes, since one can never tell what the ramifications are of activating foreign controlled boxes are."
+#string STR_NUMERIC_PROMPT #language en-US "How old are you?"
+ #language fr-FR "Cómo viejo es usted?"
+#string STR_NUMERIC_STEP_PROMPT #language en-US "How old are you? (Step)"
+ #language fr-FR "Cómo viejo es usted?(Step)"
+#string STR_NUMERIC_PROMPT1 #language en-US "How tall are you?"
+ #language fr-FR "Cómo viejo es usted?"
+#string STR_NUMERIC_READONLY_PROMPT #language en-US "How old are you?(Readonly)"
+ #language fr-FR "Cómo viejo es usted?(Readonly)"
+#string STR_NUMERIC_MANUAL_PROMPT #language en-US "How old are you? (Manual)"
+ #language fr-FR "Cómo viejo es usted? (Manual)"
+#string STR_TALL_HEX_PROMPT #language en-US "How tall are you? (Hex)"
+ #language fr-FR "Cómo viejo es usted? (Hex)"
+#string STR_MYIFRNVDATA2_HEX_PROMPT #language en-US "MyIfrNVData2 Uint8? (Hex)"
+#string STR_MYIFRNVDATA2_HEX_HELP #language en-US "MyIfrNVData2 Uint8? (Hex) Help"
+#string STR_NUMERIC_HELP0 #language en-US "This is the help for those who are too old to understand the question. Type how old you are in a numeric value. The valid range in this case is from 0 to 240. Let's see if you actually read this help and figure that out."
+ #language fr-FR "This is the help for those who are too old to understand the question. Type how old you are in a numeric value. The valid range in this case is from 0 to 240. Let's see if you actually read this help and figure that out."
+#string STR_NUMERIC_HELP1 #language en-US "This is the help for those who are curious about body height. Type how tall you are in a numeric value. The valid range in this case is from 0 to 250. Let's see if you actually read this help and figure that out."
+ #language fr-FR "This is the help for those who are curious about body height. Type how tall you are in a numeric value. The valid range in this case is from 0 to 250. Let's see if you actually read this help and figure that out."
+#string STR_NUMERIC_HELP2 #language en-US "This is the help for those who are too old to understand the question. Adjust how old you are step by step. The valid range in this case is from 0 to 243 in step of 1. Let's see if you actually read this help and figure that out."
+ #language fr-FR "This is the help for those who are too old to understand the question. Adjust how old you are step by step. The valid range in this case is from 0 to 243 in step of 1. Let's see if you actually read this help and figure that out."
+#string STR_NUMERIC_HELP3 #language en-US "This is the help for those who are curious about body height. Type how tall you are in a numeric value. The valid range in this case is from 0 to 190. Let's see if you actually read this help and figure that out."
+ #language fr-FR "Ésta es la ayuda para los que sean demasiado viejos entender la pregunta. Pulse cómo es viejo usted está en años."
+
+#string STR_PASSWORD_PROMPT #language en-US "Set the system password"
+ #language fr-FR "Cuál es la palabra mágica?"
+#string STR_TEXT_SECRUITY_TEST_TEXT #language en-US "Access only permitted for Admin"
+ #language fr-FR "Access only permitted for Admin"
+#string STR_TEXT_SECRUITY_TEST_HELP #language en-US "If this label is not gray, then current user has admin access setup permission. If this label is gray, then current user has no admin access setup permission."
+ #language fr-FR "If this label is not gray, then current user has admin access setup permission. If this label is gray, then current user has no admin access setup permission."
+#string STR_GOTO_FORM1 #language en-US "Enter Page 1"
+ #language fr-FR "Vaya a paginar 1"
+#string STR_GOTO_FORM2 #language en-US "Enter Page 2"
+ #language fr-FR "Vaya a paginar 2"
+#string STR_GOTO_FORM3 #language en-US "Enter Page 3"
+ #language fr-FR "Vaya a paginar 3"
+#string STR_GOTO_FORM4 #language en-US "Enter Page 4 Formmap Page"
+ #language fr-FR "Vaya a paginar 4"
+#string STR_GOTO_FORM6 #language en-US "Enter Page 6"
+ #language fr-FR "Enter Page 6"
+#string STR_GOTO_FORM5 #language en-US "Enter Page 5 Modal Page"
+ #language fr-FR "Enter Page 5 Modal Page"
+#string STR_GOTO_FORM5_HELP #language en-US "Enter this form to double confirm the selection, must select on option before exit!"
+ #language fr-FR "Enter this form to double confirm the selection, must select on option before exit!"
+#string STR_GOTO_DYNAMIC #language en-US "Goto Dynamic Page +"
+ #language fr-FR "Vaya a página dynamico"
+#string STR_GOTO_DYNAMIC2 #language en-US "Goto Fresh Dynamic Page"
+ #language fr-FR "Vaya a página fresca dynamico"
+#string STR_GOTO_DYNAMIC3 #language en-US "Update dest through retrieve"
+ #language fr-FR "Update dest through retrieve"
+#string STR_GOTO_DYNAMIC4 #language en-US "Update dest through changing"
+ #language fr-FR "Update dest through changing"
+#string STR_GOTO_DYNAMIC3_HELP #language en-US "Update the destination through "retrieve" call back type before user select it."
+ #language fr-FR "Update the destination through "retrieve" call back type before user select it."
+#string STR_GOTO_DYNAMIC4_HELP #language en-US "Update the destination through "changing" call back type when user select it."
+ #language fr-FR "Update the destination through "changing" call back type when user select it."
+#string STR_ERROR_INCONSISTENT #language en-US "This is my inconsistent error message"
+ #language fr-FR "Éste es mi mensaje de error contrario."
+#string STR_ERROR_POPUP #language en-US "You typed in something bad!"
+ #language fr-FR "Esto es un mensaje de error del popup."
+#string STR_MY_STRING_DEFAULT #language en-US "my password"
+ #language fr-FR "my password"
+#string STR_MY_STRING_PROMPT2 #language en-US "String - Interactive"
+ #language fr-FR "String - interactive"
+#string STR_MY_STRING_HELP2 #language en-US "This is my string help - Interactive"
+ #language fr-FR "This is my string help - interactive"
+#string STR_TEXT_TEXT_1 #language en-US "This is my 1st text string"
+ #language fr-FR "This is my 1st text string"
+#string STR_TEXT_TEXT_2 #language en-US "This is my 2nd text string that I am testing"
+ #language fr-FR "This is my 2nd text string that I am testing"
+#string STR_DATE_PROMPT #language en-US "System Date"
+ #language fr-FR "Fecha del sistema"
+#string STR_DATE_HELP #language en-US "This is the help for the Date (month/day/year). (Error checking will be done against month/day/year combinations that are not supported.)"
+ #language fr-FR "Esto es la ayuda para el Fecha (mes/día/las). (Verificar de error se hará contra vez mes/día/las combinaciones de año que no se sostienen.)"
+#string STR_TIME_PROMPT #language en-US "System Time"
+ #language fr-FR "Tiempo del sistema"
+#string STR_TIME_HELP #language en-US "This is the help for the Time (hour/minute/second)."
+ #language fr-FR "Esto es la ayuda para el Tiempo (hora/minuto/segundo)."
+#string STR_RESTORE_DEFAULTS_PROMPT #language en-US "This is my restore defaults prompt"
+ #language fr-FR "This is my Spanish restore defaults prompt"
+#string STR_RESTORE_DEFAULTS_HELP #language en-US "This is my restore defaults help"
+ #language fr-FR "Ésta es mi ayuda española de los defectos del restore"
+#string STR_SAVE_DEFAULTS_PROMPT #language en-US "This is my save defaults prompt"
+ #language fr-FR "This is my Spanish save defaults prompt"
+#string STR_SAVE_DEFAULTS_HELP #language en-US "This is my save defaults help"
+ #language fr-FR "This is my Spanish save defaults help"
+#string STR_TEXT_HELP #language en-US "This is my text help"
+ #language fr-FR "This is my Spanish text help"
+#string STR_GOTO_HELP #language en-US "This is my goto help"
+ #language fr-FR "This is my Spanish goto help"
+#string STR_BANNER_TITLE #language en-US "This is my English banner title"
+ #language fr-FR "Éste es mi título español de la bandera"
+#string STR_SUPPRESS_IF_TEXT1 #language en-US "This is my English suppress-if text1"
+ #language fr-FR "This is my Spanish suppress-if text1"
+#string STR_SUPPRESS_IF_TEXT2 #language en-US "This is my English suppress-if text2"
+ #language fr-FR "This is my Spanish suppress-if text2"
+#string STR_GRAYOUT_IF_TEXT1 #language en-US "This is my English grayout-if text1"
+ #language fr-FR "This is my Spanish grayout-if text1"
+#string STR_GRAYOUT_IF_TEXT2 #language en-US "This is my English grayout-if text2"
+ #language fr-FR "This is my Spanish grayout-if text2"
+#string STR_INVENTORY_HELP #language en-US "This is my English inventory help string"
+ #language fr-FR "This is my Spanish inventory help string"
+#string STR_INVENTORY_TEXT1 #language en-US "This is my English inventory text1 string"
+ #language fr-FR "This is my Spanish inventory text1 string"
+#string STR_INVENTORY_TEXT2 #language en-US "This is my English inventory text2 string"
+ #language fr-FR "This is my Spanish inventory text2 string"
+#string STR_TEST_OPCODE #language en-US "Pick 1"
+ #language fr-FR "Pick 1"
+#string STR_TEST_OPCODE2 #language en-US "Pick 2"
+ #language fr-FR "Pick 2"
+#string STR_EXIT_TEXT #language en-US "Exit now!"
+ #language fr-FR "Salir ahora!"
+#string STR_SAVE_TEXT #language en-US "Save now!"
+ #language fr-FR "(French)Save now!"
+#string STR_RESET_TEXT #language en-US "Reset now!"
+ #language fr-FR "(French)Reset now!"
+#string STR_DISCARD_CURRENT #language en-US "Discard current form now!"
+ #language fr-FR "(French)Discard current form now!"
+#string STR_SAVE_CURRENT #language en-US "Save current form now!"
+ #language fr-FR "(French)Save current form now!"
+#string STR_DISCARD_CURRENT_AND_EXIT #language en-US "Discard current form and exit now!"
+ #language fr-FR "(French)Discard current form and exit now!"
+#string STR_SAVE_CURRENT_AND_EXIT #language en-US "Save current form and exit now!"
+ #language fr-FR "(French)Save current form and exit now!"
+#string STR_NULL_STRING #language en-US ""
+ #language fr-FR ""
+#string STR_TEST_STRING #language en-US "This is a test string"
+ #language fr-FR "Esto es una secuencia de la prueba"
+#string STR_GRAYOUT_TEST #language en-US "Grayout VarEq test"
+ #language fr-FR "Grayout VarEq test"
+#string STR_SUPPRESS_TEST #language en-US "Suppress VarEq test"
+ #language fr-FR "Suppress VarEq test"
+#string STR_CLEAR_TEST #language en-US "Clear VarEq test"
+ #language fr-FR "Clear VarEq test"
+#string STR_STANDARD_DEFAULT_PROMPT #language en-US "Reset to Standard Default"
+ #language fr-FR "Reset to Standard Default"
+#string STR_STANDARD_DEFAULT_HELP #language en-US "This will reset all the Questions to their standard default value"
+ #language fr-FR "This will reset all the Questions to their standard default value"
+#string STR_MANUFACTURE_DEFAULT_PROMPT #language en-US "Reset to Manufacture Default"
+ #language fr-FR "Reset to Manufacture Default"
+#string STR_MANUFACTURE_DEFAULT_HELP #language en-US "This will reset all the Questions to their manufacture default value"
+ #language fr-FR "This will reset all the Questions to their manufacture default value"
+#string STR_NAME_VALUE_VAR_NAME0_HELP #language en-US "This numeric(UINT8) use Name/Value storage, Name is NameValueVar0"
+ #language fr-FR "This numeric(UINT8) use Name/Value storage, Name is NameValueVar0"
+#string STR_NAME_VALUE_VAR_NAME1_HELP #language en-US "This numeric(UINT16) use Name/Value storage, Name is NameValueVar1"
+ #language fr-FR "This numeric(UINT16) use Name/Value storage, Name is NameValueVar1"
+#string STR_NAME_VALUE_VAR_NAME2_HELP #language en-US "This string use Name/Value storage, Name is NameValueVar2"
+ #language fr-FR "This string use Name/Value storage, Name is NameValueVar2"
+#string STR_STRING_CHECK #language en-US "STRING"
+ #language fr-FR "STRING"
+#string STR_STRING_CHECK_ERROR_POPUP #language en-US "String you typed in is not correct!"
+ #language fr-FR "String you typed in is not correct!"
+#string STR_TEXT_REFRESH_GUID #language en-US "Add new menu by press "Ctrl + C""
+ #language fr-FR "Add new menu by press "Ctrl + C""
+#string STR_TEXT_REFRESH_GUID_COUNT #language en-US "Refresh guid event count"
+ #language fr-FR "Refresh guid event count"
+#string STR_MODAL_FORM_TITLE #language en-US "First Modal Form"
+ #language fr-FR "First Modal Form"
+#string STR_EXIT_THROUGH_FORM_DISCARD_EXIT #language en-US "Exit through form discard and exit"
+ #language fr-FR "Exit through form discard and exit"
+#string STR_EXIT_THROUGH_FORM_SUBMIT_EXIT #language en-US "Exit through form submit and exit"
+ #language fr-FR "Exit through form submit and exit"
+#string STR_DEFAULT_VALUE_FROM_CALLBACK_PROMPT #language en-US "Get Call Back default"
+ #language fr-FR "Get Call Back default"
+#string STR_DEFAULT_VALUE_FROM_CALLBACK_HELP #language en-US "This is the help for getting default value from call back function"
+ #language fr-FR "This is the help for getting default value from call back function"
+#string STR_DEFAULT_VALUE_FROM_ACCESS_PROMPT #language en-US "Get ExtractConfig default"
+ #language fr-FR "Get ExtractConfig default"
+#string STR_DEFAULT_VALUE_FROM_ACCESS_HELP #language en-US "This is the help for getting default value from ExtractConfig function"
+ #language fr-FR "This is the help for getting default value from ExtractConfig function"
+#string STR_GOTO_ANOTHER_FORMSET #language en-US "Goto ABC Information Sample FormSet"
+ #language fr-FR "Goto ABC Information Sample FormSet"
+#string STR_GOTO_ANOTHER_FORMSET_HELP #language en-US "When select this option, browser will go to another formset."
+ #language fr-FR "When select this option, browser will go to another formset."
+#string STR_DEVICE_PATH #language en-US ""
+ #language fr-FR ""
+#string STR_SUBMITTED_CALLBACK_TEST_PROMPT #language en-US "Submitted callback test"
+ #language fr-FR "Submitted callback test"
+#string STR_SUBMITTED_CALLBACK_TEST_HELP #language en-US "Change the value and press F10 to submit will pop up a dialogue to show SUBMITTED Callback has been triggered"
+ #language fr-FR "Change the value and press F10 to submit will pop up a dialogue to show SUBMITTED Callback has been triggered"
+#string STR_POPUP_TEST_PROMPT #language en-US "Select it to invoke Hii Popup Protocol"
+ #language fr-FR "Select it to invoke Hii Popup Protocol"
+#string STR_POPUP_TEST_HELP #language en-US "Select this question will pop up a message box, then user can decide whether exit current form or not"
+ #language fr-FR "Select this question will pop up a message box, then user can decide whether exit current form or not"
+#string STR_POPUP_STRING #language en-US "Are you sure to exit current form?"
+ #language fr-FR "Are you sure to exit current form?"
+//
+// Form 7 to show Questions which refer to Union Bit varstore
+//
+#string STR_FORM7_TITLE #language en-US "Form to Show Questions with union and bit VarStore"
+ #language fr-FR "Form to Show Questions with union and bit VarStore"
+#string STR_GOTO_FORM7 #language en-US "Enter Page 7"
+ #language fr-FR "Enter Page 7"
+#string STR_GOTO_FORM7_HELP #language en-US "This Form is to Show Questions with union and bit VarStore"
+ #language fr-FR "This Form is to Show Questions with union and bit VarStore"
+#string STR_NEST_BIT_EFI_VARSTORE #language en-US "Nested BIT fields in efivarstore"
+ #language fr-FR "Nested BIT fields in efivarstore"
+#string STR_BIT_EFI_VARSTORE #language en-US "BIT fields in efivarstore"
+ #language fr-FR "BIT fields in efivarstore"
+#string STR_NEST_BIT_VARSTORE #language en-US "Nested BIT fields in bufferstore"
+ #language fr-FR "Nested BIT fields in bufferstore"
+#string STR_BIT_VARSTORE #language en-US "BIT fields in bufferstore"
+ #language fr-FR "BIT fields in bufferstore"
+#string STR_UNION_EFI_VARSTORE #language en-US "Union efivarstore"
+ #language fr-FR "Union efivarstore"
+#string STR_BIT_NEST_CHECK_BOX_PROMPT #language en-US "NEST_BIT check box"
+ #language fr-FR "NEST_BIT check box"
+#string STR_BIT_NEST_CHECK_BOX_HELP #language en-US "The check box refer to nested bit field, the default is checked"
+ #language fr-FR "The check box refer to nested bit field, the default is checked"
+#string STR_ONE_OF_BIT_NEST_PROMPT #language en-US "NEST_BIT one-of"
+ #language fr-FR "NEST_BIT one-of"
+#string STR_ONE_OF_BIT_NEST_HELP #language en-US "The oneof refer to nested bit field"
+ #language fr-FR "The oneof refer to nested bit field"
+#string STR_BIT_NEST_NUMERIC_PROMPT #language en-US "NEST_BIT numeric"
+ #language fr-FR "NEST_BIT numeric"
+#string STR_BIT_NEST_NUMERIC_HELP #language en-US "The numeric refer to nested bit field, the Standard default is 6 Manufacture default is 7"
+ #language fr-FR "The numeric refer to nested bit field, the Standard default is 6 Manufacture default is 7"
+#string BYTE_QUESTION_NEST_BIT_PROMPT #language en-US "Use byte field in NEST_BIT structure"
+ #language fr-FR "Use byte field in NEST_BIT structure"
+#string BYTE_QUESTION_NEST_BIT_HELP #language en-US "The Question refer to byte field in NEST_BIT structure"
+ #language fr-FR "The Question refer to byte field in NEST_BIT structure"
+#string STR_BIT_NEST_NUMERIC_DEFAULT_HELP #language en-US "NEST_BIT numeric, default value form callback function, the Standard default is C Manufacture default is D"
+ #language fr-FR "NEST_BIT numeric, default value form callback function, the Standard default is C Manufacture default is D"
+#string STR_BIT_CHECK_BOX_PROMPT #language en-US "BIT check box"
+ #language fr-FR "BIT check box"
+#string STR_BIT_CHECK_BOX_HELP #language en-US "The check box refer to bit field, the default is checked"
+ #language fr-FR "The check box refer to bit field, the default is checked"
+#string STR_ONE_OF_BIT_PROMPT #language en-US "BIT one-of"
+ #language fr-FR "BIT one-of"
+#string STR_ONE_OF_BIT_HELP #language en-US "The one-of refer to bit field"
+ #language fr-FR "The one-of refer to bit field"
+#string STR_BIT_NUMERIC_PROMPT #language en-US "BIT numeric"
+ #language fr-FR "BIT numeric"
+#string STR_BIT_NUMERIC_HELP #language en-US "The numeric refer to bit field, the Standard default is 4 Manufacture default is 5"
+ #language fr-FR "The numeric refer to bit field the Standard default is 4 Manufacture default is 5"
+#string STR_BUFFER_BIT_NUMERIC_HELP #language en-US "The numeric refer to bit field, the Standard default is 16 Manufacture default is 17"
+ #language fr-FR "The numeric refer to bit field, the Standard default is 16 Manufacture default is 17"
+#string BYTE_QUESTION_BIT_PROMPT #language en-US "Use byte field in BIT structure"
+ #language fr-FR "Use byte field in BIT structure"
+#string BYTE_QUESTION_BIT_HELP #language en-US "The question refer to byte field in BIT structure"
+ #language fr-FR "The question refer to byte field in BIT structure"
+#string STR_UNION_BYTE_NUMERIC_PROMPT #language en-US "UNION EfiVarStore byte numeric"
+ #language fr-FR "UNION EfiVarStore byte numeric"
+#string STR_UNION_BYTE_NUMERIC_HELP #language en-US "Question refer to byte field in UNION type efivastore, the Standard default is 7 Manufacture default is 8"
+ #language fr-FR "Question refer to byte field in UNION type efivastore, the Standard default is 7 Manufacture default is 8"
+// Boot Order
+#string STR_BOOT_TITLE #language en-US "Boot"
+#string STR_BOOT_OPTIONS #language en-US "Boot Order"
+#string STR_BOOT_OPTION1 #language en-US "IDE HDD"
+#string STR_BOOT_OPTION2 #language en-US "ATAPI CD"
+#string STR_BOOT_OPTION3 #language en-US "PXE"
+#string STR_BOOT_OPTION4 #language en-US "USB"
+
+#string STR_VAR_NAME #language en-US "MyVar"
+
+#string STR_DEFAULTSTORE_MFG #language en-US "Manufacture Default"
+ #language fr-FR "Manufacture Default"
+
+#string STR_DEFAULTSTORE_SAFE #language en-US "Safe Default"
+ #language fr-FR "Safe Default"
+
+#string STR_STANDARD_DEFAULT_PROMPT #language en-US "Standard Default"
+ #language fr-FR "Standard Default"
+#string STR_MANUFACTURE_DEFAULT_PROMPT #language en-US "Manufacture Default"
+ #language fr-FR "Manufacture Default"
+
+//
+// Name list of Name/Value storage
+//
+#string STR_NAME_VALUE_VAR_NAME0 #language en-US "NameValueVar0"
+ #language fr-FR "NameValueVar0 (fr-FR)"
+#string STR_NAME_VALUE_VAR_NAME1 #language en-US "NameValueVar1"
+ #language fr-FR "NameValueVar1 (fr-FR)"
+#string STR_NAME_VALUE_VAR_NAME2 #language en-US "NameValueVar2"
+ #language fr-FR "NameValueVar2 (fr-FR)"
+//
+// Form Map method
+//
+#string STR_SAMPL_MAP_METHOD #language en-US "Sample Map Form"
+ #language fr-FR "Sample Map Form"
+#string STR_STANDARD_MAP_METHOD #language en-US "UEFI Standard Map Form"
+ #language fr-FR "UEFI Standard Map Form"
+//
+// Serial Port
+//
+#string STR_SERIAL_PORT #language en-US "Serial port number"
+ #language fr-FR "Serial port number"
+#string STR_SERIAL_PORT_DISABLE #language en-US "Serial port disable"
+ #language fr-FR "Serial port disable"
+#string STR_SERIAL_PORT1 #language en-US "Serial port 1"
+ #language fr-FR "Serial port 1"
+#string STR_SERIAL_PORT2 #language en-US "Serial port 2"
+ #language fr-FR "Serial port 2"
+#string STR_SERIAL_PORT3 #language en-US "Serial port 3"
+ #language fr-FR "Serial port 3"
+#string STR_SERIAL_PORT4 #language en-US "Serial port 4"
+ #language fr-FR "Serial port 4"
+
+#string STR_SERIAL_PORT_STATUS #language en-US "Serial port is enable"
+ #language fr-FR "Serial port is enable"
+#string STR_SERIAL_PORT_IO_ADDRESS #language en-US "Serial port IO address"
+ #language fr-FR "Serial port IO address"
+#string STR_SERIAL_PORT_IRQ #language en-US "Serial port IRQ value"
+ #language fr-FR "Serial port IRQ value"
+
+#string STR_SERIAL_PORT1_IOADDR #language en-US "3F8"
+ #language fr-FR "3F8"
+#string STR_SERIAL_PORT2_IOADDR #language en-US "2F8"
+ #language fr-FR "2F8"
+#string STR_SERIAL_PORT3_IOADDR #language en-US "3E8"
+ #language fr-FR "3E8"
+#string STR_SERIAL_PORT4_IOADDR #language en-US "2E8"
+ #language fr-FR "2E8"
+
+#string STR_SERIAL_PORT13_IRQ #language en-US "4"
+ #language fr-FR "4"
+#string STR_SERIAL_PORT24_IRQ #language en-US "3"
+ #language fr-FR "3"
+
+//
+// TEXT/DATE/TIME
+//
+#string STR_TEXT_SAMPLE_HELP #language en-US "Text Help"
+ #language fr-FR "Text Help"
+#string STR_TEXT_SAMPLE_STRING #language en-US "Text Sample"
+ #language fr-FR "Text Sample"
+#string STR_DATE_SAMPLE_HELP #language en-US "Date Sample"
+ #language fr-FR "Date Sample"
+#string STR_TIME_SAMPLE_HELP #language en-US "Time Sample"
+ #language fr-FR "Time Sample"
+
+#string FUNCTION_NINE_STRING #language en-US "F9=Reset to Defaults"
+ #language fr-FR "F9=Reset à Défauts"
+#string FUNCTION_TEN_STRING #language en-US "F10=Save"
+ #language fr-FR "F10=Économiser"
+#string STR_WARNING_POPUP #language en-US "Change value requires to reset the system."
+ #language fr-FR "Change value requires to reset the system."
+#string STR_MATCH2_PROMPT #language en-US "Match2 Test"
+ #language fr-FR "Match2 Test"
+#string STR_MATCH2_HELP #language en-US "This question used to test the match2 opcode."
+ #language fr-FR "This question used to test the match2 opcode."
+#string STR_STRING #language en-US "Match2 Test"
+ #language fr-FR "Match2 Test"
+#string STR_PATTERN #language en-US "Match2"
+ #language fr-FR "Match2"