summaryrefslogtreecommitdiff
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2009-11-13 06:46:59 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2009-11-13 06:46:59 +0000
commiteccfeab1cac23a27c5b87154765b1713ecb12e22 (patch)
tree84a98998ed4e854088b3cc87f7ec20f7d3bd4de4 /MdeModulePkg
parent766c7483c335931b190a78d78d62e5a5e69dc8b9 (diff)
downloadedk2-eccfeab1cac23a27c5b87154765b1713ecb12e22.zip
edk2-eccfeab1cac23a27c5b87154765b1713ecb12e22.tar.gz
edk2-eccfeab1cac23a27c5b87154765b1713ecb12e22.tar.bz2
Invoke EFI_BROWSER_ACTION_RETRIEVE callback when read EfiVarstore question.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9425 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Expression.c1
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c1
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c1
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c17
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c1
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Setup.c120
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Setup.h15
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Ui.c1
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Ui.h2
9 files changed, 131 insertions, 28 deletions
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c b/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
index 3f81032..08e830b 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
@@ -12,7 +12,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
-#include "Ui.h"
#include "Setup.h"
//
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
index 7f6ff67..c0b2de7 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
@@ -13,7 +13,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "Setup.h"
-#include "Ui.h"
UINT16 mStatementIndex;
UINT16 mExpressionOpCodeIndex;
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c b/MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c
index 1a8af2e..3e7979f 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c
@@ -12,7 +12,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
-#include "Ui.h"
#include "Setup.h"
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
index c880c8a..69c0496 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
@@ -13,7 +13,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "Setup.h"
-#include "Ui.h"
BOOLEAN mHiiPackageListUpdated;
UI_MENU_SELECTION *gCurrentSelection;
@@ -983,14 +982,28 @@ SetupBrowser (
}
//
+ // Reset FormPackage update flag
+ //
+ mHiiPackageListUpdated = FALSE;
+
+ //
// Load Questions' Value for display
//
- Status = LoadFormSetConfig (Selection->FormSet);
+ Status = LoadFormSetConfig (Selection, Selection->FormSet);
if (EFI_ERROR (Status)) {
return Status;
}
//
+ // IFR is updated during callback of read value, force to reparse the IFR binary
+ //
+ if (mHiiPackageListUpdated) {
+ Selection->Action = UI_ACTION_REFRESH_FORMSET;
+ mHiiPackageListUpdated = FALSE;
+ goto Done;
+ }
+
+ //
// Displays the Header and Footer borders
//
DisplayPageFrame ();
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c b/MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c
index cebe126..639c04d 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c
@@ -13,7 +13,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
-#include "Ui.h"
#include "Setup.h"
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
index 0bc2d1b..f52e69c 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
@@ -13,8 +13,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "Setup.h"
-#include "Ui.h"
-
SETUP_DRIVER_PRIVATE_DATA mPrivateData = {
SETUP_DRIVER_SIGNATURE,
@@ -2000,10 +1998,12 @@ ExtractFormDefault (
return EFI_SUCCESS;
}
-
/**
Initialize Question's Edit copy from Storage.
+ @param Selection Selection contains the information about
+ the Selection, form and formset to be displayed.
+ Selection action may be updated in retrieve callback.
@param FormSet FormSet data structure.
@param Form Form data structure.
@@ -2012,14 +2012,19 @@ ExtractFormDefault (
**/
EFI_STATUS
LoadFormConfig (
- IN FORM_BROWSER_FORMSET *FormSet,
- IN FORM_BROWSER_FORM *Form
+ IN OUT UI_MENU_SELECTION *Selection,
+ IN FORM_BROWSER_FORMSET *FormSet,
+ IN FORM_BROWSER_FORM *Form
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Link;
- FORM_BROWSER_STATEMENT *Question;
-
+ EFI_STATUS Status;
+ LIST_ENTRY *Link;
+ FORM_BROWSER_STATEMENT *Question;
+ UINT8 *BufferValue;
+ UINTN StorageWidth;
+ EFI_HII_VALUE *HiiValue;
+ EFI_BROWSER_ACTION_REQUEST ActionRequest;
+
Link = GetFirstNode (&Form->StatementListHead);
while (!IsNull (&Form->StatementListHead, Link)) {
Question = FORM_BROWSER_STATEMENT_FROM_LINK (Link);
@@ -2031,6 +2036,87 @@ LoadFormConfig (
if (EFI_ERROR (Status)) {
return Status;
}
+
+ //
+ // Check whether EfiVarstore with CallBack can be got.
+ //
+ if ((Question->QuestionId != 0) && (Question->Storage != NULL) &&
+ (Question->Storage->Type == EFI_HII_VARSTORE_EFI_VARIABLE) &&
+ ((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) == EFI_IFR_FLAG_CALLBACK)) {
+ //
+ // ConfigAccess can't be NULL.
+ //
+ if (FormSet->ConfigAccess == NULL) {
+ return EFI_UNSUPPORTED;
+ }
+ //
+ // Check QuestionValue does exist.
+ //
+ StorageWidth = Question->StorageWidth;
+ if (Question->BufferValue != NULL) {
+ BufferValue = Question->BufferValue;
+ } else {
+ BufferValue = (UINT8 *) &Question->HiiValue.Value;
+ }
+ Status = gRT->GetVariable (
+ Question->VariableName,
+ &Question->Storage->Guid,
+ NULL,
+ &StorageWidth,
+ BufferValue
+ );
+
+ if (!EFI_ERROR (Status)) {
+ ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
+ HiiValue = &Question->HiiValue;
+ BufferValue = (UINT8 *) &Question->HiiValue.Value;
+ if (HiiValue->Type == EFI_IFR_TYPE_STRING) {
+ //
+ // Create String in HII database for Configuration Driver to retrieve
+ //
+ HiiValue->Value.string = NewString ((CHAR16 *) Question->BufferValue, FormSet->HiiHandle);
+ } else if (HiiValue->Type == EFI_IFR_TYPE_BUFFER) {
+ BufferValue = Question->BufferValue;
+ }
+
+ Status = FormSet->ConfigAccess->Callback (
+ FormSet->ConfigAccess,
+ EFI_BROWSER_ACTION_RETRIEVE,
+ Question->QuestionId,
+ HiiValue->Type,
+ (EFI_IFR_TYPE_VALUE *) BufferValue,
+ &ActionRequest
+ );
+
+ if (HiiValue->Type == EFI_IFR_TYPE_STRING) {
+ //
+ // Clean the String in HII Database
+ //
+ DeleteString (HiiValue->Value.string, FormSet->HiiHandle);
+ }
+
+ if (!EFI_ERROR (Status)) {
+ switch (ActionRequest) {
+ case EFI_BROWSER_ACTION_REQUEST_RESET:
+ gResetRequired = TRUE;
+ break;
+
+ case EFI_BROWSER_ACTION_REQUEST_SUBMIT:
+ //
+ // Till now there is no uncommitted data, so ignore this request
+ //
+ break;
+
+ case EFI_BROWSER_ACTION_REQUEST_EXIT:
+ Selection->Action = UI_ACTION_EXIT;
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+ }
Link = GetNextNode (&Form->StatementListHead, Link);
}
@@ -2038,10 +2124,12 @@ LoadFormConfig (
return EFI_SUCCESS;
}
-
/**
Initialize Question's Edit copy from Storage for the whole Formset.
+ @param Selection Selection contains the information about
+ the Selection, form and formset to be displayed.
+ Selection action may be updated in retrieve callback.
@param FormSet FormSet data structure.
@retval EFI_SUCCESS The function completed successfully.
@@ -2049,12 +2137,13 @@ LoadFormConfig (
**/
EFI_STATUS
LoadFormSetConfig (
- IN FORM_BROWSER_FORMSET *FormSet
+ IN OUT UI_MENU_SELECTION *Selection,
+ IN FORM_BROWSER_FORMSET *FormSet
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Link;
- FORM_BROWSER_FORM *Form;
+ EFI_STATUS Status;
+ LIST_ENTRY *Link;
+ FORM_BROWSER_FORM *Form;
Link = GetFirstNode (&FormSet->FormListHead);
while (!IsNull (&FormSet->FormListHead, Link)) {
@@ -2063,7 +2152,7 @@ LoadFormSetConfig (
//
// Initialize local copy of Value for each Form
//
- Status = LoadFormConfig (FormSet, Form);
+ Status = LoadFormConfig (Selection, FormSet, Form);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -2074,7 +2163,6 @@ LoadFormSetConfig (
return EFI_SUCCESS;
}
-
/**
Fill storage's edit copy with settings requested from Configuration Driver.
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
index 310d3e6..a55195d 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
@@ -561,6 +561,7 @@ extern CHAR16 gHelpBlockWidth;
extern EFI_GUID gZeroGuid;
extern EFI_GUID gTianoHiiIfrGuid;
+#include "Ui.h"
//
// Global Procedure Defines
//
@@ -938,6 +939,9 @@ ExtractFormDefault (
/**
Initialize Question's Edit copy from Storage.
+ @param Selection Selection contains the information about
+ the Selection, form and formset to be displayed.
+ Selection action may be updated in retrieve callback.
@param FormSet FormSet data structure.
@param Form Form data structure.
@@ -946,13 +950,17 @@ ExtractFormDefault (
**/
EFI_STATUS
LoadFormConfig (
- IN FORM_BROWSER_FORMSET *FormSet,
- IN FORM_BROWSER_FORM *Form
+ IN OUT UI_MENU_SELECTION *Selection,
+ IN FORM_BROWSER_FORMSET *FormSet,
+ IN FORM_BROWSER_FORM *Form
);
/**
Initialize Question's Edit copy from Storage for the whole Formset.
+ @param Selection Selection contains the information about
+ the Selection, form and formset to be displayed.
+ Selection action may be updated in retrieve callback.
@param FormSet FormSet data structure.
@retval EFI_SUCCESS The function completed successfully.
@@ -960,7 +968,8 @@ LoadFormConfig (
**/
EFI_STATUS
LoadFormSetConfig (
- IN FORM_BROWSER_FORMSET *FormSet
+ IN OUT UI_MENU_SELECTION *Selection,
+ IN FORM_BROWSER_FORMSET *FormSet
);
/**
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
index 5deb301..5b1f361 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
@@ -12,7 +12,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
-#include "Ui.h"
#include "Setup.h"
LIST_ENTRY gMenuOption;
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.h b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.h
index 44cae88..bd75714 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.h
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.h
@@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef _UI_H_
#define _UI_H_
-#include "Setup.h"
-
//
// Globals
//