diff options
author | Dandan Bi <dandan.bi@intel.com> | 2015-08-04 09:09:10 +0000 |
---|---|---|
committer | dandanbi <dandanbi@Edk2> | 2015-08-04 09:09:10 +0000 |
commit | 40ffc3b9f7ff2821ebfcc5361b3fb2be648c64c5 (patch) | |
tree | 77c27e5cbe6945b97df04ce78b56b23422b0aff0 /MdeModulePkg | |
parent | 6f2ef18e8097c4fa11dd6ff5fdd0152c2c61ffc5 (diff) | |
download | edk2-40ffc3b9f7ff2821ebfcc5361b3fb2be648c64c5.tar.gz edk2-40ffc3b9f7ff2821ebfcc5361b3fb2be648c64c5.tar.bz2 edk2-40ffc3b9f7ff2821ebfcc5361b3fb2be648c64c5.zip |
MdeModulePkg:Fix the issue that refresh the question fail in DriverSample
Once the question is refreshed,the processing should happen in the callback function
of EFI_BROWSER_ACTION_RETRIEVE case,rather than EFI_BROWSER_ACTION_CHANGING in DriverSample.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18150 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg')
-rw-r--r-- | MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c | 165 |
1 files changed, 82 insertions, 83 deletions
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c index a21f58a77d..2f77d39e52 100644 --- a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c +++ b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c @@ -1375,14 +1375,90 @@ DriverCallback ( case EFI_BROWSER_ACTION_RETRIEVE:
{
- if (QuestionId == 0x1248) {
- {
- if (Type != EFI_IFR_TYPE_REF) {
- return EFI_INVALID_PARAMETER;
+ 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
+ );
}
-
- Value->ref.FormId = 0x3;
+ FreePool (EfiData);
}
+ break;
}
}
break;
@@ -1596,83 +1672,6 @@ DriverCallback ( HiiFreeOpCodeHandle (EndOpCodeHandle);
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;
-
case 0x2000:
//
// Only used to update the state.
|