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
This commit is contained in:
lgao4 2009-11-13 06:46:59 +00:00
parent 766c7483c3
commit eccfeab1ca
9 changed files with 131 additions and 28 deletions

View File

@ -12,7 +12,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "Ui.h"
#include "Setup.h"
//

View File

@ -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;

View File

@ -12,7 +12,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "Ui.h"
#include "Setup.h"

View File

@ -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;
@ -982,14 +981,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
//

View File

@ -13,7 +13,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "Ui.h"
#include "Setup.h"

View File

@ -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,13 +2012,18 @@ 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)) {
@ -2032,16 +2037,99 @@ LoadFormConfig (
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);
}
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.

View File

@ -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
);
/**

View File

@ -12,7 +12,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "Ui.h"
#include "Setup.h"
LIST_ENTRY gMenuOption;

View File

@ -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
//