summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Expression.c8
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c8
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c4
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c12
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Setup.c277
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Setup.h38
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Ui.c2
7 files changed, 255 insertions, 94 deletions
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c b/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
index b9034fa2e0..ff46fcbc5a 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
@@ -891,7 +891,7 @@ IdToQuestion (
// to keep synchronous, always reload the Question Value.
//
if (Question->Storage->Type == EFI_HII_VARSTORE_EFI_VARIABLE) {
- GetQuestionValue (FormSet, Form, Question, FALSE);
+ GetQuestionValue (FormSet, Form, Question, GetSetValueWithHiiDriver);
}
return Question;
@@ -2142,7 +2142,7 @@ GetQuestionValueFromForm (
//
// Get the question value.
//
- Status = GetQuestionValue(FormSet, Form, Question, FALSE);
+ Status = GetQuestionValue(FormSet, Form, Question, GetSetValueWithHiiDriver);
if (EFI_ERROR (Status)) {
GetTheVal = FALSE;
goto Done;
@@ -2343,7 +2343,7 @@ EvaluateExpression (
//
// Get value from string except for STRING value.
//
- Status = GetValueByName (OpCode->VarStorage, OpCode->ValueName, &StrPtr);
+ Status = GetValueByName (OpCode->VarStorage, OpCode->ValueName, &StrPtr, GetSetValueWithEditBuffer);
if (!EFI_ERROR (Status)) {
ASSERT (StrPtr != NULL);
TempLength = StrLen (StrPtr);
@@ -2796,7 +2796,7 @@ EvaluateExpression (
for (Index = 0; Index < OpCode->ValueWidth; Index ++, TempBuffer --) {
StrPtr += UnicodeValueToString (StrPtr, PREFIX_ZERO | RADIX_HEX, *TempBuffer, 2);
}
- Status = SetValueByName (OpCode->VarStorage, OpCode->ValueName, NameValue, TRUE);
+ Status = SetValueByName (OpCode->VarStorage, OpCode->ValueName, NameValue, GetSetValueWithEditBuffer);
FreePool (NameValue);
if (!EFI_ERROR (Status)) {
Data1.Value.b = TRUE;
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c b/MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c
index dd022ce554..81190464cb 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/InputHandler.c
@@ -799,9 +799,9 @@ EnterCarriageReturn:
//
// Input value is not valid, restore Question Value
//
- GetQuestionValue (FormSet, Form, Question, TRUE);
+ GetQuestionValue (FormSet, Form, Question, GetSetValueWithEditBuffer);
} else {
- SetQuestionValue (FormSet, Form, Question, TRUE);
+ SetQuestionValue (FormSet, Form, Question, GetSetValueWithEditBuffer);
if (!DateOrTime || (Question->Storage != NULL)) {
//
// NV flag is unnecessary for RTC type of Date/Time
@@ -1351,9 +1351,9 @@ TheKey:
//
// Input value is not valid, restore Question Value
//
- GetQuestionValue (Selection->FormSet, Selection->Form, Question, TRUE);
+ GetQuestionValue (Selection->FormSet, Selection->Form, Question, GetSetValueWithEditBuffer);
} else {
- SetQuestionValue (Selection->FormSet, Selection->Form, Question, TRUE);
+ SetQuestionValue (Selection->FormSet, Selection->Form, Question, GetSetValueWithEditBuffer);
UpdateStatusBar (Selection, NV_UPDATE_REQUIRED, Question->QuestionFlags, TRUE);
}
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
index 7edbdb6229..6e46e0e961 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
@@ -1287,7 +1287,7 @@ ProcessCallBackFunction (
// "retrieve" should update to the question's temp buffer.
//
if (Action == EFI_BROWSER_ACTION_CHANGING || Action == EFI_BROWSER_ACTION_RETRIEVE) {
- SetQuestionValue(Selection->FormSet, Selection->Form, Statement, TRUE);
+ SetQuestionValue(Selection->FormSet, Selection->Form, Statement, GetSetValueWithEditBuffer);
}
} else {
//
@@ -1295,7 +1295,7 @@ ProcessCallBackFunction (
// "retrieve", should restore the question's value.
//
if (Action == EFI_BROWSER_ACTION_CHANGING || Action == EFI_BROWSER_ACTION_RETRIEVE) {
- GetQuestionValue(Selection->FormSet, Selection->Form, Statement, TRUE);
+ GetQuestionValue(Selection->FormSet, Selection->Form, Statement, GetSetValueWithEditBuffer);
}
if (Status == EFI_UNSUPPORTED) {
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c b/MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c
index 2a51af8e2f..181afec16d 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c
@@ -482,7 +482,7 @@ ProcessOptions (
}
SetArrayData (ValueArray, ValueType, Index2, 0);
- Status = SetQuestionValue (Selection->FormSet, Selection->Form, Question, TRUE);
+ Status = SetQuestionValue (Selection->FormSet, Selection->Form, Question, GetSetValueWithEditBuffer);
UpdateStatusBar (Selection, NV_UPDATE_REQUIRED, Question->QuestionFlags, TRUE);
FreePool (*OptionString);
@@ -551,7 +551,7 @@ ProcessOptions (
if ((Option->SuppressExpression == NULL) ||
(EvaluateExpressionList(Option->SuppressExpression, FALSE, NULL, NULL) == ExpressFalse)) {
CopyMem (QuestionValue, &Option->Value, sizeof (EFI_HII_VALUE));
- SetQuestionValue (Selection->FormSet, Selection->Form, Question, TRUE);
+ SetQuestionValue (Selection->FormSet, Selection->Form, Question, GetSetValueWithEditBuffer);
UpdateStatusBar (Selection, NV_UPDATE_REQUIRED, Question->QuestionFlags, TRUE);
break;
}
@@ -587,7 +587,7 @@ ProcessOptions (
(EvaluateExpressionList(OneOfOption->SuppressExpression, FALSE, NULL, NULL) == ExpressFalse)) {
Suppress = FALSE;
CopyMem (QuestionValue, &OneOfOption->Value, sizeof (EFI_HII_VALUE));
- SetQuestionValue (Selection->FormSet, Selection->Form, Question, TRUE);
+ SetQuestionValue (Selection->FormSet, Selection->Form, Question, GetSetValueWithEditBuffer);
UpdateStatusBar (Selection, NV_UPDATE_REQUIRED, Question->QuestionFlags, TRUE);
gST->ConOut->SetAttribute (gST->ConOut, PcdGet8 (PcdBrowserFieldTextColor) | FIELD_BACKGROUND);
break;
@@ -640,7 +640,7 @@ ProcessOptions (
//
// Save Question value
//
- Status = SetQuestionValue (Selection->FormSet, Selection->Form, Question, TRUE);
+ Status = SetQuestionValue (Selection->FormSet, Selection->Form, Question, GetSetValueWithEditBuffer);
UpdateStatusBar (Selection, NV_UPDATE_REQUIRED, Question->QuestionFlags, TRUE);
}
@@ -753,7 +753,7 @@ ProcessOptions (
HiiSetString(Selection->FormSet->HiiHandle, Question->HiiValue.Value.string, (CHAR16*)Question->BufferValue, NULL);
} else {
CopyMem (Question->BufferValue, StringPtr, Maximum * sizeof (CHAR16));
- SetQuestionValue (Selection->FormSet, Selection->Form, Question, TRUE);
+ SetQuestionValue (Selection->FormSet, Selection->Form, Question, GetSetValueWithEditBuffer);
UpdateStatusBar (Selection, NV_UPDATE_REQUIRED, Question->QuestionFlags, TRUE);
}
@@ -940,7 +940,7 @@ ProcessOptions (
PasswordCallback (Selection, MenuOption, StringPtr);
} else {
CopyMem (Question->BufferValue, StringPtr, Maximum * sizeof (CHAR16));
- SetQuestionValue (Selection->FormSet, Selection->Form, Question, FALSE);
+ SetQuestionValue (Selection->FormSet, Selection->Form, Question, GetSetValueWithHiiDriver);
}
}
} else {
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
index 1389f261ae..8aced87c85 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
@@ -933,6 +933,7 @@ SynchronizeStorage (
@param Storage The NameValue Storage.
@param Name The Name.
@param Value The retured Value.
+ @param GetValueFrom Where to get source value, from EditValue or Value.
@retval EFI_SUCCESS Value found for given Name.
@retval EFI_NOT_FOUND No such Name found in NameValue storage.
@@ -940,14 +941,19 @@ SynchronizeStorage (
**/
EFI_STATUS
GetValueByName (
- IN FORMSET_STORAGE *Storage,
- IN CHAR16 *Name,
- IN OUT CHAR16 **Value
+ IN FORMSET_STORAGE *Storage,
+ IN CHAR16 *Name,
+ IN OUT CHAR16 **Value,
+ IN GET_SET_QUESTION_VALUE_WITH GetValueFrom
)
{
LIST_ENTRY *Link;
NAME_VALUE_NODE *Node;
+ if (GetValueFrom != GetSetValueWithEditBuffer && GetValueFrom != GetSetValueWithBuffer) {
+ return EFI_INVALID_PARAMETER;
+ }
+
*Value = NULL;
Link = GetFirstNode (&Storage->NameValueListHead);
@@ -955,7 +961,11 @@ GetValueByName (
Node = NAME_VALUE_NODE_FROM_LINK (Link);
if (StrCmp (Name, Node->Name) == 0) {
- NewStringCpy (Value, Node->EditValue);
+ if (GetValueFrom == GetSetValueWithEditBuffer) {
+ NewStringCpy (Value, Node->EditValue);
+ } else {
+ NewStringCpy (Value, Node->Value);
+ }
return EFI_SUCCESS;
}
@@ -972,7 +982,7 @@ GetValueByName (
@param Storage The NameValue Storage.
@param Name The Name.
@param Value The Value to set.
- @param Edit Whether update editValue or Value.
+ @param SetValueTo Whether update editValue or Value.
@retval EFI_SUCCESS Value found for given Name.
@retval EFI_NOT_FOUND No such Name found in NameValue storage.
@@ -983,19 +993,23 @@ SetValueByName (
IN FORMSET_STORAGE *Storage,
IN CHAR16 *Name,
IN CHAR16 *Value,
- IN BOOLEAN Edit
+ IN GET_SET_QUESTION_VALUE_WITH SetValueTo
)
{
LIST_ENTRY *Link;
NAME_VALUE_NODE *Node;
CHAR16 *Buffer;
+ if (SetValueTo != GetSetValueWithEditBuffer && SetValueTo != GetSetValueWithBuffer) {
+ return EFI_INVALID_PARAMETER;
+ }
+
Link = GetFirstNode (&Storage->NameValueListHead);
while (!IsNull (&Storage->NameValueListHead, Link)) {
Node = NAME_VALUE_NODE_FROM_LINK (Link);
if (StrCmp (Name, Node->Name) == 0) {
- if (Edit) {
+ if (SetValueTo == GetSetValueWithEditBuffer) {
Buffer = Node->EditValue;
} else {
Buffer = Node->Value;
@@ -1005,7 +1019,7 @@ SetValueByName (
}
Buffer = AllocateCopyPool (StrSize (Value), Value);
ASSERT (Buffer != NULL);
- if (Edit) {
+ if (SetValueTo == GetSetValueWithEditBuffer) {
Node->EditValue = Buffer;
} else {
Node->Value = Buffer;
@@ -1162,7 +1176,7 @@ ConfigRespToStorage (
if (StrPtr != NULL) {
*StrPtr = 0;
}
- SetValueByName (Storage, Name, Value, TRUE);
+ SetValueByName (Storage, Name, Value, GetSetValueWithEditBuffer);
}
break;
@@ -1182,8 +1196,7 @@ ConfigRespToStorage (
@param FormSet FormSet data structure.
@param Form Form data structure.
@param Question Question to be initialized.
- @param Cached TRUE: get from Edit copy FALSE: get from original
- Storage
+ @param GetValueFrom Where to get value, may from editbuffer, buffer or hii driver.
@retval EFI_SUCCESS The function completed successfully.
@@ -1193,7 +1206,7 @@ GetQuestionValue (
IN FORM_BROWSER_FORMSET *FormSet,
IN FORM_BROWSER_FORM *Form,
IN OUT FORM_BROWSER_STATEMENT *Question,
- IN BOOLEAN Cached
+ IN GET_SET_QUESTION_VALUE_WITH GetValueFrom
)
{
EFI_STATUS Status;
@@ -1222,6 +1235,10 @@ GetQuestionValue (
Value = NULL;
Result = NULL;
+ if (GetValueFrom >= GetSetValueWithMax) {
+ return EFI_INVALID_PARAMETER;
+ }
+
//
// Statement don't have storage, skip them
//
@@ -1373,15 +1390,22 @@ GetQuestionValue (
IsBufferStorage = FALSE;
}
IsString = (BOOLEAN) ((Question->HiiValue.Type == EFI_IFR_TYPE_STRING) ? TRUE : FALSE);
- if (Cached) {
+ if (GetValueFrom == GetSetValueWithEditBuffer || GetValueFrom == GetSetValueWithBuffer ) {
if (IsBufferStorage) {
- //
- // Copy from storage Edit buffer
- //
- CopyMem (Dst, Storage->EditBuffer + Question->VarStoreInfo.VarOffset, StorageWidth);
+ if (GetValueFrom == GetSetValueWithEditBuffer) {
+ //
+ // Copy from storage Edit buffer
+ //
+ CopyMem (Dst, Storage->EditBuffer + Question->VarStoreInfo.VarOffset, StorageWidth);
+ } else {
+ //
+ // Copy from storage Edit buffer
+ //
+ CopyMem (Dst, Storage->Buffer + Question->VarStoreInfo.VarOffset, StorageWidth);
+ }
} else {
Value = NULL;
- Status = GetValueByName (Storage, Question->VariableName, &Value);
+ Status = GetValueByName (Storage, Question->VariableName, &Value, GetValueFrom);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -1578,7 +1602,7 @@ GetQuestionValue (
if (IsBufferStorage) {
CopyMem (Storage->EditBuffer + Question->VarStoreInfo.VarOffset, Dst, StorageWidth);
} else {
- SetValueByName (Storage, Question->VariableName, Value, TRUE);
+ SetValueByName (Storage, Question->VariableName, Value, GetSetValueWithEditBuffer);
}
if (Result != NULL) {
@@ -1596,8 +1620,7 @@ GetQuestionValue (
@param FormSet FormSet data structure.
@param Form Form data structure.
@param Question Pointer to the Question.
- @param Cached TRUE: set to Edit copy FALSE: set to original
- Storage
+ @param SetValueTo Update the question value to editbuffer , buffer or hii driver.
@retval EFI_SUCCESS The function completed successfully.
@@ -1607,7 +1630,7 @@ SetQuestionValue (
IN FORM_BROWSER_FORMSET *FormSet,
IN FORM_BROWSER_FORM *Form,
IN OUT FORM_BROWSER_STATEMENT *Question,
- IN BOOLEAN Cached
+ IN GET_SET_QUESTION_VALUE_WITH SetValueTo
)
{
EFI_STATUS Status;
@@ -1632,6 +1655,10 @@ SetQuestionValue (
Status = EFI_SUCCESS;
+ if (SetValueTo >= GetSetValueWithMax) {
+ return EFI_INVALID_PARAMETER;
+ }
+
//
// Statement don't have storage, skip them
//
@@ -1747,47 +1774,55 @@ SetQuestionValue (
IsBufferStorage = FALSE;
}
IsString = (BOOLEAN) ((Question->HiiValue.Type == EFI_IFR_TYPE_STRING) ? TRUE : FALSE);
- if (IsBufferStorage) {
- //
- // Copy to storage edit buffer
- //
- CopyMem (Storage->EditBuffer + Question->VarStoreInfo.VarOffset, Src, StorageWidth);
- } else {
- if (IsString) {
- //
- // Allocate enough string buffer.
- //
- Value = NULL;
- BufferLen = ((StrLen ((CHAR16 *) Src) * 4) + 1) * sizeof (CHAR16);
- Value = AllocateZeroPool (BufferLen);
- ASSERT (Value != NULL);
- //
- // Convert Unicode String to Config String, e.g. "ABCD" => "0041004200430044"
- //
- TemName = (CHAR16 *) Src;
- TemString = Value;
- for (; *TemName != L'\0'; TemName++) {
- TemString += UnicodeValueToString (TemString, PREFIX_ZERO | RADIX_HEX, *TemName, 4);
+
+ if (SetValueTo == GetSetValueWithEditBuffer || SetValueTo == GetSetValueWithBuffer) {
+ if (IsBufferStorage) {
+ if (SetValueTo == GetSetValueWithEditBuffer) {
+ //
+ // Copy to storage edit buffer
+ //
+ CopyMem (Storage->EditBuffer + Question->VarStoreInfo.VarOffset, Src, StorageWidth);
+ } else if (SetValueTo == GetSetValueWithBuffer) {
+ //
+ // Copy to storage edit buffer
+ //
+ CopyMem (Storage->Buffer + Question->VarStoreInfo.VarOffset, Src, StorageWidth);
}
} else {
- BufferLen = StorageWidth * 2 + 1;
- Value = AllocateZeroPool (BufferLen * sizeof (CHAR16));
- ASSERT (Value != NULL);
- //
- // Convert Buffer to Hex String
- //
- TemBuffer = Src + StorageWidth - 1;
- TemString = Value;
- for (Index = 0; Index < StorageWidth; Index ++, TemBuffer --) {
- TemString += UnicodeValueToString (TemString, PREFIX_ZERO | RADIX_HEX, *TemBuffer, 2);
+ if (IsString) {
+ //
+ // Allocate enough string buffer.
+ //
+ Value = NULL;
+ BufferLen = ((StrLen ((CHAR16 *) Src) * 4) + 1) * sizeof (CHAR16);
+ Value = AllocateZeroPool (BufferLen);
+ ASSERT (Value != NULL);
+ //
+ // Convert Unicode String to Config String, e.g. "ABCD" => "0041004200430044"
+ //
+ TemName = (CHAR16 *) Src;
+ TemString = Value;
+ for (; *TemName != L'\0'; TemName++) {
+ TemString += UnicodeValueToString (TemString, PREFIX_ZERO | RADIX_HEX, *TemName, 4);
+ }
+ } else {
+ BufferLen = StorageWidth * 2 + 1;
+ Value = AllocateZeroPool (BufferLen * sizeof (CHAR16));
+ ASSERT (Value != NULL);
+ //
+ // Convert Buffer to Hex String
+ //
+ TemBuffer = Src + StorageWidth - 1;
+ TemString = Value;
+ for (Index = 0; Index < StorageWidth; Index ++, TemBuffer --) {
+ TemString += UnicodeValueToString (TemString, PREFIX_ZERO | RADIX_HEX, *TemBuffer, 2);
+ }
}
- }
-
- Status = SetValueByName (Storage, Question->VariableName, Value, TRUE);
- FreePool (Value);
- }
- if (!Cached) {
+ Status = SetValueByName (Storage, Question->VariableName, Value, SetValueTo);
+ FreePool (Value);
+ }
+ } else if (SetValueTo == GetSetValueWithHiiDriver) {
if (Storage->Type == EFI_HII_VARSTORE_BUFFER || Storage->Type == EFI_HII_VARSTORE_NAME_VALUE) {
//
// <ConfigResp> ::= <ConfigHdr> + <BlockName> + "&VALUE=" + "<HexCh>StorageWidth * 2" ||
@@ -2115,6 +2150,105 @@ SynchronizeStorageForForm (
return Status;
}
+/**
+ When discard the question value, call the callback function with Changed type
+ to inform the hii driver.
+
+ @param FormSet FormSet data structure.
+ @param Form Form data structure.
+
+**/
+VOID
+SendDiscardInfoToDriver (
+ IN FORM_BROWSER_FORMSET *FormSet,
+ IN FORM_BROWSER_FORM *Form
+ )
+{
+ LIST_ENTRY *Link;
+ FORM_BROWSER_STATEMENT *Question;
+ EFI_STATUS Status;
+ EFI_HII_VALUE HiiValue;
+ UINT8 *BufferValue;
+ BOOLEAN ValueChanged;
+ EFI_IFR_TYPE_VALUE *TypeValue;
+ EFI_BROWSER_ACTION_REQUEST ActionRequest;
+
+ ValueChanged = FALSE;
+ BufferValue = NULL;
+
+ if(!Form->NvUpdateRequired) {
+ return;
+ }
+
+ Link = GetFirstNode (&Form->StatementListHead);
+ while (!IsNull (&Form->StatementListHead, Link)) {
+ Question = FORM_BROWSER_STATEMENT_FROM_LINK (Link);
+ Link = GetNextNode (&Form->StatementListHead, Link);
+
+ if (Question->Storage == NULL || Question->Storage->Type == EFI_HII_VARSTORE_EFI_VARIABLE) {
+ continue;
+ }
+
+ if (Question->Operand == EFI_IFR_PASSWORD_OP) {
+ continue;
+ }
+
+ if (Question->BufferValue != NULL) {
+ BufferValue = AllocateZeroPool (Question->StorageWidth);
+ ASSERT (BufferValue != NULL);
+ CopyMem (BufferValue, Question->BufferValue, Question->StorageWidth);
+ } else {
+ HiiValue.Type = Question->HiiValue.Type;
+ CopyMem (&HiiValue.Value, &Question->HiiValue.Value, sizeof (EFI_IFR_TYPE_VALUE));
+ }
+
+ Status = GetQuestionValue (FormSet, Form, Question, GetSetValueWithBuffer);
+ if (EFI_ERROR (Status)) {
+ if (BufferValue != NULL) {
+ FreePool (BufferValue);
+ BufferValue = NULL;
+ }
+ continue;
+ }
+
+ if (Question->BufferValue != NULL) {
+ if (CompareMem (BufferValue, Question->BufferValue, Question->StorageWidth)) {
+ ValueChanged = TRUE;
+ }
+ } else {
+ if (CompareMem (&HiiValue.Value, &Question->HiiValue.Value, sizeof (EFI_IFR_TYPE_VALUE))) {
+ ValueChanged = TRUE;
+ }
+ }
+
+ if (BufferValue != NULL) {
+ FreePool (BufferValue);
+ BufferValue = NULL;
+ }
+
+ if (!ValueChanged) {
+ continue;
+ }
+
+ ValueChanged = FALSE;
+
+ if (Question->HiiValue.Type == EFI_IFR_TYPE_BUFFER) {
+ TypeValue = (EFI_IFR_TYPE_VALUE *) Question->BufferValue;
+ } else {
+ TypeValue = &Question->HiiValue.Value;
+ }
+
+ ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
+ FormSet->ConfigAccess->Callback (
+ FormSet->ConfigAccess,
+ EFI_BROWSER_ACTION_CHANGED,
+ Question->QuestionId,
+ Question->HiiValue.Type,
+ TypeValue,
+ &ActionRequest
+ );
+ }
+}
/**
Discard data based on the input setting scope (Form, FormSet or System).
@@ -2165,6 +2299,11 @@ DiscardForm (
}
//
+ // Call callback with Changed type to inform the driver.
+ //
+ SendDiscardInfoToDriver (FormSet, Form);
+
+ //
// Prepare <ConfigResp>
//
SynchronizeStorageForForm(FormSet, ConfigInfo, FALSE);
@@ -2172,6 +2311,18 @@ DiscardForm (
Form->NvUpdateRequired = FALSE;
} else if (SettingScope == FormSetLevel && IsNvUpdateRequired(FormSet)) {
+
+ Link = GetFirstNode (&FormSet->FormListHead);
+ while (!IsNull (&FormSet->FormListHead, Link)) {
+ Form = FORM_BROWSER_FORM_FROM_LINK (Link);
+ Link = GetNextNode (&FormSet->FormListHead, Link);
+
+ //
+ // Call callback with Changed type to inform the driver.
+ //
+ SendDiscardInfoToDriver (FormSet, Form);
+ }
+
//
// Discard Buffer storage or Name/Value storage
//
@@ -3060,7 +3211,7 @@ ExtractDefault (
//
if ((Question->Storage != NULL) &&
(Question->Storage->Type != EFI_HII_VARSTORE_EFI_VARIABLE)) {
- SetQuestionValue (FormSet, Form, Question, TRUE);
+ SetQuestionValue (FormSet, Form, Question, GetSetValueWithEditBuffer);
//
// Update Form NV flag.
//
@@ -3183,7 +3334,7 @@ LoadFormConfig (
//
// Initialize local copy of Value for each Question
//
- Status = GetQuestionValue (FormSet, Form, Question, TRUE);
+ Status = GetQuestionValue (FormSet, Form, Question, GetSetValueWithEditBuffer);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -3389,8 +3540,8 @@ CopyStorage (
while (!IsNull (&Src->NameValueListHead, Link)) {
Node = NAME_VALUE_NODE_FROM_LINK (Link);
- SetValueByName (Dst, Node->Name, Node->EditValue, TRUE);
- SetValueByName (Dst, Node->Name, Node->Value, FALSE);
+ SetValueByName (Dst, Node->Name, Node->EditValue, GetSetValueWithEditBuffer);
+ SetValueByName (Dst, Node->Name, Node->Value, GetSetValueWithBuffer);
Link = GetNextNode (&Src->NameValueListHead, Link);
}
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
index fcc17254ed..12ffc523f8 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
@@ -584,6 +584,16 @@ typedef enum {
GetDefaultForMax // Invalid value.
} BROWSER_GET_DEFAULT_VALUE;
+//
+// Get/set question value from/to.
+//
+typedef enum {
+ GetSetValueWithEditBuffer, // Get/Set question value from/to editbuffer in the storage.
+ GetSetValueWithBuffer, // Get/Set question value from/to buffer in the storage.
+ GetSetValueWithHiiDriver, // Get/Set question value from/to hii driver.
+ GetSetValueWithMax // Invalid value.
+} GET_SET_QUESTION_VALUE_WITH;
+
extern EFI_HII_DATABASE_PROTOCOL *mHiiDatabase;
extern EFI_HII_STRING_PROTOCOL *mHiiString;
extern EFI_HII_CONFIG_ROUTING_PROTOCOL *mHiiConfigRouting;
@@ -887,6 +897,7 @@ CreateDialog (
@param Storage The NameValue Storage.
@param Name The Name.
@param Value The retured Value.
+ @param GetValueFrom Where to get source value, from EditValue or Value.
@retval EFI_SUCCESS Value found for given Name.
@retval EFI_NOT_FOUND No such Name found in NameValue storage.
@@ -894,9 +905,10 @@ CreateDialog (
**/
EFI_STATUS
GetValueByName (
- IN FORMSET_STORAGE *Storage,
- IN CHAR16 *Name,
- IN OUT CHAR16 **Value
+ IN FORMSET_STORAGE *Storage,
+ IN CHAR16 *Name,
+ IN OUT CHAR16 **Value,
+ IN GET_SET_QUESTION_VALUE_WITH GetValueFrom
);
/**
@@ -905,7 +917,7 @@ GetValueByName (
@param Storage The NameValue Storage.
@param Name The Name.
@param Value The Value to set.
- @param Edit Whether update editValue or Value.
+ @param SetValueTo Whether update editValue or Value.
@retval EFI_SUCCESS Value found for given Name.
@retval EFI_NOT_FOUND No such Name found in NameValue storage.
@@ -913,10 +925,10 @@ GetValueByName (
**/
EFI_STATUS
SetValueByName (
- IN FORMSET_STORAGE *Storage,
- IN CHAR16 *Name,
- IN CHAR16 *Value,
- IN BOOLEAN Edit
+ IN FORMSET_STORAGE *Storage,
+ IN CHAR16 *Name,
+ IN CHAR16 *Value,
+ IN GET_SET_QUESTION_VALUE_WITH SetValueTo
);
/**
@@ -925,8 +937,7 @@ SetValueByName (
@param FormSet FormSet data structure.
@param Form Form data structure.
@param Question Question to be initialized.
- @param Cached TRUE: get from Edit copy FALSE: get from original
- Storage
+ @param GetValueFrom Where to get value, may from editbuffer, buffer or hii driver.
@retval EFI_SUCCESS The function completed successfully.
@@ -936,7 +947,7 @@ GetQuestionValue (
IN FORM_BROWSER_FORMSET *FormSet,
IN FORM_BROWSER_FORM *Form,
IN OUT FORM_BROWSER_STATEMENT *Question,
- IN BOOLEAN Cached
+ IN GET_SET_QUESTION_VALUE_WITH GetValueFrom
);
/**
@@ -945,8 +956,7 @@ GetQuestionValue (
@param FormSet FormSet data structure.
@param Form Form data structure.
@param Question Pointer to the Question.
- @param Cached TRUE: set to Edit copy FALSE: set to original
- Storage
+ @param SetValueTo Update the question value to editbuffer , buffer or hii driver.
@retval EFI_SUCCESS The function completed successfully.
@@ -956,7 +966,7 @@ SetQuestionValue (
IN FORM_BROWSER_FORMSET *FormSet,
IN FORM_BROWSER_FORM *Form,
IN OUT FORM_BROWSER_STATEMENT *Question,
- IN BOOLEAN Cached
+ IN GET_SET_QUESTION_VALUE_WITH SetValueTo
);
/**
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
index 7e846a2926..a2f336c2a4 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
@@ -439,7 +439,7 @@ RefreshQuestion (
Selection = MenuRefreshEntry->Selection;
Question = MenuRefreshEntry->MenuOption->ThisTag;
- Status = GetQuestionValue (Selection->FormSet, Selection->Form, Question, FALSE);
+ Status = GetQuestionValue (Selection->FormSet, Selection->Form, Question, GetSetValueWithHiiDriver);
if (EFI_ERROR (Status)) {
return Status;
}