/** @file\r
Entry and initialization module for the browser.\r
\r
-Copyright (c) 2007 - 2010, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
http://opensource.org/licenses/bsd-license.php\r
\r
gOptionBlockWidth = (CHAR16) ((gScreenDimensions.RightColumn - gScreenDimensions.LeftColumn) / 3);\r
gHelpBlockWidth = gOptionBlockWidth;\r
- gPromptBlockWidth = gOptionBlockWidth;\r
+ gPromptBlockWidth = (CHAR16) (gOptionBlockWidth + LEFT_SKIPPED_COLUMNS);\r
+ gOptionBlockWidth = (CHAR16) (gOptionBlockWidth - LEFT_SKIPPED_COLUMNS);\r
\r
//\r
// Initialize the strings for the browser, upon exit of the browser, the strings will be freed\r
{\r
EFI_STRING String;\r
\r
+ if (HiiHandle == NULL) {\r
+ return NULL;\r
+ }\r
+\r
String = HiiGetString (HiiHandle, Token, NULL);\r
if (String == NULL) {\r
String = AllocateCopyPool (sizeof (mUnknownString), mUnknownString);\r
}\r
return Status;\r
}\r
+ \r
+ //\r
+ // Get question value by read expression.\r
+ //\r
+ if (Question->ReadExpression != NULL && Form->FormType == STANDARD_MAP_FORM_TYPE) {\r
+ Status = EvaluateExpression (FormSet, Form, Question->ReadExpression);\r
+ if (!EFI_ERROR (Status) && (Question->ReadExpression->Result.Type < EFI_IFR_TYPE_OTHER)) {\r
+ //\r
+ // Only update question value to the valid result.\r
+ //\r
+ CopyMem (&Question->HiiValue, &Question->ReadExpression->Result, sizeof (EFI_HII_VALUE));\r
+ return EFI_SUCCESS;\r
+ }\r
+ }\r
\r
//\r
// Question value is provided by RTC\r
//\r
CopyMem (Dst, Storage->EditBuffer + Question->VarStoreInfo.VarOffset, StorageWidth);\r
} else {\r
+ Value = NULL;\r
Status = GetValueByName (Storage, Question->VariableName, &Value);\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
\r
+ ASSERT (Value != NULL);\r
LengthStr = StrLen (Value);\r
Status = EFI_SUCCESS;\r
if (IsString) {\r
if (Question->ValueExpression != NULL) {\r
return Status;\r
}\r
+ \r
+ //\r
+ // Before set question value, evaluate its write expression.\r
+ //\r
+ if (Question->WriteExpression != NULL && Form->FormType == STANDARD_MAP_FORM_TYPE) {\r
+ Status = EvaluateExpression (FormSet, Form, Question->WriteExpression);\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ }\r
\r
//\r
// Question value is provided by RTC\r
\r
\r
/**\r
- Perform NoSubmit check for a Form.\r
+ Perform NoSubmit check for each Form in FormSet.\r
\r
@param FormSet FormSet data structure.\r
- @param Form Form data structure.\r
\r
@retval EFI_SUCCESS Form validation pass.\r
@retval other Form validation failed.\r
**/\r
EFI_STATUS\r
NoSubmitCheck (\r
- IN FORM_BROWSER_FORMSET *FormSet,\r
- IN FORM_BROWSER_FORM *Form\r
+ IN FORM_BROWSER_FORMSET *FormSet\r
)\r
{\r
EFI_STATUS Status;\r
LIST_ENTRY *Link;\r
FORM_BROWSER_STATEMENT *Question;\r
+ FORM_BROWSER_FORM *Form;\r
+ LIST_ENTRY *LinkForm;\r
\r
- Link = GetFirstNode (&Form->StatementListHead);\r
- while (!IsNull (&Form->StatementListHead, Link)) {\r
- Question = FORM_BROWSER_STATEMENT_FROM_LINK (Link);\r
+ LinkForm = GetFirstNode (&FormSet->FormListHead);\r
+ while (!IsNull (&FormSet->FormListHead, LinkForm)) {\r
+ Form = FORM_BROWSER_FORM_FROM_LINK (LinkForm);\r
\r
- Status = ValidateQuestion (FormSet, Form, Question, EFI_HII_EXPRESSION_NO_SUBMIT_IF);\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
+ Link = GetFirstNode (&Form->StatementListHead);\r
+ while (!IsNull (&Form->StatementListHead, Link)) {\r
+ Question = FORM_BROWSER_STATEMENT_FROM_LINK (Link);\r
+\r
+ Status = ValidateQuestion (FormSet, Form, Question, EFI_HII_EXPRESSION_NO_SUBMIT_IF);\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ Link = GetNextNode (&Form->StatementListHead, Link);\r
}\r
\r
- Link = GetNextNode (&Form->StatementListHead, Link);\r
+ LinkForm = GetNextNode (&FormSet->FormListHead, LinkForm);\r
}\r
\r
return EFI_SUCCESS;\r
//\r
// Validate the Form by NoSubmit check\r
//\r
- Status = NoSubmitCheck (FormSet, Form);\r
+ Status = NoSubmitCheck (FormSet);\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
//\r
// Check whether EfiVarstore with CallBack can be got.\r
//\r
- if ((Question->QuestionId != 0) && (Question->Storage != NULL) &&\r
+ if ((FormSet->ConfigAccess != NULL) &&\r
+ (Selection->Action != UI_ACTION_REFRESH_FORMSET) &&\r
+ (Question->QuestionId != 0) && \r
+ (Question->Storage != NULL) &&\r
(Question->Storage->Type == EFI_HII_VARSTORE_EFI_VARIABLE) && \r
((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) == EFI_IFR_FLAG_CALLBACK)) {\r
- //\r
- // ConfigAccess can't be NULL.\r
- //\r
- if (FormSet->ConfigAccess == NULL) {\r
- return EFI_UNSUPPORTED;\r
- }\r
+\r
//\r
// Check QuestionValue does exist.\r
//\r
break;\r
}\r
\r
- //\r
- // Try to compare against formset class GUID\r
- //\r
- NumberOfClassGuid = (UINT8) (((EFI_IFR_FORM_SET *) OpCodeData)->Flags & 0x3);\r
- ClassGuid = (EFI_GUID *) (OpCodeData + sizeof (EFI_IFR_FORM_SET));\r
- for (Index = 0; Index < NumberOfClassGuid; Index++) {\r
- if (CompareGuid (ComparingGuid, ClassGuid + Index)) {\r
- ClassGuidMatch = TRUE;\r
+ if (((EFI_IFR_OP_HEADER *) OpCodeData)->Length > OFFSET_OF (EFI_IFR_FORM_SET, Flags)) {\r
+ //\r
+ // Try to compare against formset class GUID\r
+ //\r
+ NumberOfClassGuid = (UINT8) (((EFI_IFR_FORM_SET *) OpCodeData)->Flags & 0x3);\r
+ ClassGuid = (EFI_GUID *) (OpCodeData + sizeof (EFI_IFR_FORM_SET));\r
+ for (Index = 0; Index < NumberOfClassGuid; Index++) {\r
+ if (CompareGuid (ComparingGuid, ClassGuid + Index)) {\r
+ ClassGuidMatch = TRUE;\r
+ break;\r
+ }\r
+ }\r
+ if (ClassGuidMatch) {\r
break;\r
}\r
- }\r
- if (ClassGuidMatch) {\r
+ } else if (ComparingGuid == &gEfiHiiPlatformSetupFormsetGuid) {\r
+ ClassGuidMatch = TRUE;\r
break;\r
}\r
}\r