Sync in bug fix from EDK I:
1) issue with setup browser and IFR refresh opcode 2) [HII]HIIConfigRoutingExportConfig generate error format of <MultiConfigAltResp> 3) [HII] ConfigRouting->ExtractConfig() will cause overflow 4) [Hii Database] EFI_HII_DATABASE_NOTIFY should be invoked when a string package is created internally when a new String Token is created 5) [PT]HIIConfigAccessProtocolTest fail on NT32uefi 6) Incorrect HII package types in EDK git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6378 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/** @file
|
||||
Copyright (c) 2004 - 2007, Intel Corporation
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -29,6 +29,8 @@ EFI_GUID mInventoryGuid = INVENTORY_GUID;
|
||||
|
||||
CHAR16 VariableName[] = L"MyIfrNVData";
|
||||
|
||||
UINT8 VfrMyIfrNVDataBlockName[] = "BugBug";
|
||||
|
||||
VOID
|
||||
EncodePassword (
|
||||
IN CHAR16 *Password,
|
||||
@@ -259,6 +261,7 @@ ExtractConfig (
|
||||
PrivateData = DRIVER_SAMPLE_PRIVATE_FROM_THIS (This);
|
||||
HiiConfigRouting = PrivateData->HiiConfigRouting;
|
||||
|
||||
//
|
||||
//
|
||||
// Get Buffer Storage data from EFI variable
|
||||
//
|
||||
@@ -274,6 +277,39 @@ ExtractConfig (
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (Request == NULL) {
|
||||
//
|
||||
// Request is set to NULL, return all configurable elements together with ALTCFG
|
||||
//
|
||||
Status = ConstructConfigAltResp (
|
||||
NULL,
|
||||
NULL,
|
||||
Results,
|
||||
&mFormSetGuid,
|
||||
VariableName,
|
||||
PrivateData->DriverHandle[0],
|
||||
&PrivateData->Configuration,
|
||||
BufferSize,
|
||||
VfrMyIfrNVDataBlockName,
|
||||
2,
|
||||
STRING_TOKEN (STR_STANDARD_DEFAULT_PROMPT),
|
||||
VfrMyIfrNVDataDefault0000,
|
||||
STRING_TOKEN (STR_MANUFACTURE_DEFAULT_PROMPT),
|
||||
VfrMyIfrNVDataDefault0001
|
||||
);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Check routing data in <ConfigHdr>.
|
||||
// Note: if only one Storage is used, then this checking could be skipped.
|
||||
//
|
||||
if (!IsConfigHdrMatch (Request, &mFormSetGuid, VariableName)) {
|
||||
*Progress = Request;
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
//
|
||||
// Convert buffer data to <ConfigResp> by helper function BlockToConfig()
|
||||
//
|
||||
@@ -320,9 +356,21 @@ RouteConfig (
|
||||
DRIVER_SAMPLE_PRIVATE_DATA *PrivateData;
|
||||
EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;
|
||||
|
||||
if (Configuration == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
PrivateData = DRIVER_SAMPLE_PRIVATE_FROM_THIS (This);
|
||||
HiiConfigRouting = PrivateData->HiiConfigRouting;
|
||||
|
||||
// Check routing data in <ConfigHdr>.
|
||||
// Note: if only one Storage is used, then this checking could be skipped.
|
||||
//
|
||||
if (!IsConfigHdrMatch (Configuration, &mFormSetGuid, VariableName)) {
|
||||
*Progress = Configuration;
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
//
|
||||
// Get Buffer Storage data from EFI variable
|
||||
//
|
||||
@@ -405,6 +453,7 @@ DriverCallback (
|
||||
EFI_STATUS Status;
|
||||
EFI_HII_UPDATE_DATA UpdateData;
|
||||
IFR_OPTION *IfrOptionList;
|
||||
UINT8 MyVar;
|
||||
|
||||
if ((Value == NULL) || (ActionRequest == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
@@ -416,12 +465,9 @@ DriverCallback (
|
||||
switch (QuestionId) {
|
||||
case 0x1234:
|
||||
//
|
||||
// Create dynamic page for this interactive goto
|
||||
// Initialize the container for dynamic opcodes
|
||||
//
|
||||
UpdateData.BufferSize = 0x1000;
|
||||
UpdateData.Offset = 0;
|
||||
UpdateData.Data = AllocatePool (0x1000);
|
||||
ASSERT (UpdateData.Data != NULL);
|
||||
IfrLibInitUpdateData (&UpdateData, 0x1000);
|
||||
|
||||
IfrOptionList = AllocatePool (2 * sizeof (IFR_OPTION));
|
||||
ASSERT (IfrOptionList != NULL);
|
||||
@@ -433,62 +479,127 @@ DriverCallback (
|
||||
IfrOptionList[1].StringToken = STRING_TOKEN (STR_BOOT_OPTION2);
|
||||
IfrOptionList[1].Value.u8 = 2;
|
||||
|
||||
CreateActionOpCode (
|
||||
0x1237,
|
||||
STRING_TOKEN(STR_EXIT_TEXT),
|
||||
STRING_TOKEN(STR_EXIT_TEXT),
|
||||
EFI_IFR_FLAG_CALLBACK,
|
||||
0,
|
||||
&UpdateData
|
||||
);
|
||||
|
||||
CreateOneOfOpCode (
|
||||
0x8001,
|
||||
0,
|
||||
0,
|
||||
STRING_TOKEN (STR_ONE_OF_PROMPT),
|
||||
STRING_TOKEN (STR_ONE_OF_HELP),
|
||||
EFI_IFR_FLAG_CALLBACK,
|
||||
EFI_IFR_NUMERIC_SIZE_1,
|
||||
IfrOptionList,
|
||||
2,
|
||||
&UpdateData
|
||||
);
|
||||
|
||||
CreateOrderedListOpCode (
|
||||
0x8002,
|
||||
0,
|
||||
0,
|
||||
STRING_TOKEN (STR_BOOT_OPTIONS),
|
||||
STRING_TOKEN (STR_BOOT_OPTIONS),
|
||||
EFI_IFR_FLAG_RESET_REQUIRED,
|
||||
0,
|
||||
EFI_IFR_NUMERIC_SIZE_1,
|
||||
10,
|
||||
IfrOptionList,
|
||||
2,
|
||||
&UpdateData
|
||||
);
|
||||
|
||||
CreateGotoOpCode (
|
||||
1,
|
||||
STRING_TOKEN (STR_GOTO_FORM1),
|
||||
STRING_TOKEN (STR_GOTO_HELP),
|
||||
0,
|
||||
0x8003,
|
||||
&UpdateData
|
||||
);
|
||||
|
||||
Status = IfrLibUpdateForm (
|
||||
PrivateData->HiiHandle[0],
|
||||
&mFormSetGuid,
|
||||
0x1234,
|
||||
0x1234,
|
||||
TRUE,
|
||||
&UpdateData
|
||||
);
|
||||
gBS->FreePool (IfrOptionList);
|
||||
gBS->FreePool (UpdateData.Data);
|
||||
CreateActionOpCode (
|
||||
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
|
||||
&UpdateData // Container for dynamic created opcodes
|
||||
);
|
||||
|
||||
//
|
||||
// Prepare initial value for the dynamic created oneof Question
|
||||
//
|
||||
PrivateData->Configuration.DynamicOneof = 2;
|
||||
Status = gRT->SetVariable(
|
||||
VariableName,
|
||||
&mFormSetGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
sizeof (DRIVER_SAMPLE_CONFIGURATION),
|
||||
&PrivateData->Configuration
|
||||
);
|
||||
CreateOneOfOpCode (
|
||||
0x8001, // Question ID (or call it "key")
|
||||
CONFIGURATION_VARSTORE_ID, // VarStore ID
|
||||
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
|
||||
IfrOptionList, // Option list
|
||||
2, // Number of options in Option list
|
||||
&UpdateData // Container for dynamic created opcodes
|
||||
);
|
||||
|
||||
CreateOrderedListOpCode (
|
||||
0x8002, // Question ID
|
||||
CONFIGURATION_VARSTORE_ID, // VarStore ID
|
||||
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
|
||||
IfrOptionList, // Option list
|
||||
2, // Number of options in Option list
|
||||
&UpdateData // Container for dynamic created opcodes
|
||||
);
|
||||
|
||||
CreateGotoOpCode (
|
||||
1, // Target Form ID
|
||||
STRING_TOKEN (STR_GOTO_FORM1), // Prompt text
|
||||
STRING_TOKEN (STR_GOTO_HELP), // Help text
|
||||
0, // Question flag
|
||||
0x8003, // Question ID
|
||||
&UpdateData // Container for dynamic created opcodes
|
||||
);
|
||||
|
||||
Status = IfrLibUpdateForm (
|
||||
PrivateData->HiiHandle[0], // HII handle
|
||||
&mFormSetGuid, // Formset GUID
|
||||
0x1234, // Form ID
|
||||
0x1234, // Label for where to insert opcodes
|
||||
TRUE, // Append or replace
|
||||
&UpdateData // Dynamic created opcodes
|
||||
);
|
||||
gBS->FreePool (IfrOptionList);
|
||||
IfrLibFreeUpdateData (&UpdateData);
|
||||
break;
|
||||
|
||||
case 0x5678:
|
||||
//
|
||||
// We will reach here once the Question is refreshed
|
||||
//
|
||||
IfrLibInitUpdateData (&UpdateData, 0x1000);
|
||||
|
||||
IfrOptionList = AllocatePool (2 * sizeof (IFR_OPTION));
|
||||
ASSERT (IfrOptionList != NULL);
|
||||
|
||||
CreateActionOpCode (
|
||||
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
|
||||
&UpdateData // Container for dynamic created opcodes
|
||||
);
|
||||
|
||||
Status = IfrLibUpdateForm (
|
||||
PrivateData->HiiHandle[0], // HII handle
|
||||
&mFormSetGuid, // Formset GUID
|
||||
3, // Form ID
|
||||
0x2234, // Label for where to insert opcodes
|
||||
TRUE, // Append or replace
|
||||
&UpdateData // Dynamic created opcodes
|
||||
);
|
||||
IfrLibFreeUpdateData (&UpdateData);
|
||||
|
||||
//
|
||||
// Refresh the Question value
|
||||
//
|
||||
PrivateData->Configuration.DynamicRefresh++;
|
||||
Status = gRT->SetVariable(
|
||||
VariableName,
|
||||
&mFormSetGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
sizeof (DRIVER_SAMPLE_CONFIGURATION),
|
||||
&PrivateData->Configuration
|
||||
);
|
||||
|
||||
//
|
||||
// Change an EFI Variable storage (MyEfiVar) asynchronous, this will cause
|
||||
// the first statement in Form 3 be suppressed
|
||||
//
|
||||
MyVar = 111;
|
||||
Status = gRT->SetVariable(
|
||||
L"MyVar",
|
||||
&mFormSetGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
1,
|
||||
&MyVar
|
||||
);
|
||||
break;
|
||||
|
||||
case 0x1237:
|
||||
|
Reference in New Issue
Block a user