\r
@retval EFI_NOT_FOUND The device path is not invalid.\r
@retval EFI_INVALID_PARAMETER Any incoming parameter is invalid.\r
- @retval EFI_OUT_OF_RESOURCES Lake of resources to store neccesary structures.\r
+ @retval EFI_OUT_OF_RESOURCES Lake of resources to store necessary structures.\r
@retval EFI_SUCCESS The device path is retrieved and translated to\r
binary format.\r
\r
to free memory.\r
@param Len Length of the <Number>, in characters.\r
\r
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to store neccessary\r
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to store necessary\r
structures.\r
@retval EFI_SUCCESS Value of <Number> is outputted in Number\r
successfully.\r
@param Found The Block whether has been found.\r
@param BufferLen The length of the buffer.\r
\r
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to store neccessary structures.\r
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to store necessary structures.\r
@retval EFI_SUCCESS The function finishes successfully.\r
\r
**/\r
@param AltConfigHdr Pointer to a Unicode string in <AltConfigHdr> format.\r
@param ConfigAltRespChanged Whether the ConfigAltResp has been changed.\r
\r
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to store neccessary structures.\r
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to store necessary structures.\r
@retval EFI_SUCCESS The function finishes successfully.\r
\r
**/\r
@param AltConfigHdr Pointer to a Unicode string in <AltConfigHdr> format.\r
@param ConfigAltRespChanged Whether the ConfigAltResp has been changed.\r
\r
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to store neccessary structures.\r
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to store necessary structures.\r
@retval EFI_SUCCESS The function finishes successfully.\r
\r
**/\r
string for the different varstore buffer.\r
@param AltConfigHdr Pointer to a Unicode string in <AltConfigHdr> format.\r
\r
- @retval EFI_OUT_OF_RESOURCES Insufficient resources to store neccessary\r
+ @retval EFI_OUT_OF_RESOURCES Insufficient resources to store necessary\r
structures.\r
@retval EFI_SUCCESS The function finishes successfully.\r
\r
}\r
\r
//\r
- // Get the requestr ConfigHdr\r
+ // Get the request ConfigHdr\r
//\r
SizeAltCfgResp = 0;\r
StringPtr = *AltCfgResp;\r
if (DefaultValueArray->DefaultId == DefaultValueData->DefaultId) {\r
//\r
// DEFAULT_VALUE_FROM_OPCODE has high priority, DEFAULT_VALUE_FROM_DEFAULT has low priority.\r
+ // When default types are DEFAULT_VALUE_FROM_OTHER_DEFAULT, the default value can be overrode.\r
//\r
- if (DefaultValueData->Type > DefaultValueArray->Type) {\r
+ if ((DefaultValueData->Type > DefaultValueArray->Type) || (DefaultValueData->Type == DefaultValueArray->Type && DefaultValueData->Type == DefaultValueFromOtherDefault)) {\r
//\r
// Update the default value array in BlockData.\r
//\r
@param[in] HiiHandle A handle that was previously registered in the HII Database.\r
\r
@retval NULL HiiHandle is not registered in the HII database\r
- @retval NULL There are not enough resources available to retrieve the suported \r
+ @retval NULL There are not enough resources available to retrieve the supported\r
languages.\r
- @retval NULL The list of suported languages could not be retrieved.\r
+ @retval NULL The list of supported languages could not be retrieved.\r
@retval Other A pointer to the Null-terminated ASCII string of supported languages.\r
\r
**/\r
} \r
\r
//\r
- // Free alllocated temp string.\r
+ // Free allocated temp string.\r
//\r
FreePool (VarStoreName);\r
FreePool (GuidStr);\r
@param Name Varstore name.\r
@param ConfigHdr Current configRequest info.\r
\r
- @retval TRUE This varstore is the requst one.\r
- @retval FALSE This varstore is not the requst one.\r
+ @retval TRUE This varstore is the request one.\r
+ @retval FALSE This varstore is not the request one.\r
\r
**/\r
BOOLEAN\r
@param DataBaseRecord The DataBaseRecord instance contains the found Hii handle and package.\r
@param ConfigHdr Request string ConfigHdr. If it is NULL,\r
the first found varstore will be as ConfigHdr.\r
- @retval TRUE This hii package is the reqeust one.\r
- @retval FALSE This hii package is not the reqeust one.\r
+ @retval TRUE This hii package is the request one.\r
+ @retval FALSE This hii package is not the request one.\r
**/ \r
BOOLEAN\r
IsThisPackageList (\r
\r
@param RequestBlockArray The array includes all the request info or NULL.\r
@param HiiHandle The hii handle for this form package.\r
- @param VarStorageData The varstore data strucure.\r
+ @param VarStorageData The varstore data structure.\r
@param IfrOpHdr Ifr opcode header for this opcode.\r
@param VarWidth The buffer width for this opcode.\r
@param ReturnData The data block added for this opcode.\r
\r
@param HiiHandle Hii Handle for this hii package.\r
@param Package Pointer to the form package data.\r
- @param PackageLength Length of the pacakge.\r
+ @param PackageLength Length of the package.\r
@param ConfigHdr Request string ConfigHdr. If it is NULL,\r
the first found varstore will be as ConfigHdr.\r
@param RequestBlockArray The block array is retrieved from the request string.\r
@param DefaultIdArray Point to the got default id and default name array.\r
\r
@retval EFI_SUCCESS The block array and the default value array are got.\r
- @retval EFI_INVALID_PARAMETER The varstore defintion in the differnt form pacakges\r
+ @retval EFI_INVALID_PARAMETER The varstore definition in the different form packages\r
are conflicted. \r
@retval EFI_OUT_OF_RESOURCES No enough memory.\r
**/\r
EFI_IFR_VARSTORE_NAME_VALUE *IfrNameValueVarStore;\r
EFI_HII_PACKAGE_HEADER *PackageHeader;\r
EFI_VARSTORE_ID VarStoreId;\r
+ UINT16 SmallestDefaultId;\r
+ BOOLEAN SmallestIdFromFlag;\r
+ BOOLEAN FromOtherDefaultOpcode;\r
\r
Status = EFI_SUCCESS;\r
BlockData = NULL;\r
FirstOrderedList = FALSE;\r
VarStoreName = NULL;\r
ZeroMem (&DefaultData, sizeof (IFR_DEFAULT_DATA));\r
+ SmallestDefaultId = 0xFFFF;\r
+ FromOtherDefaultOpcode = FALSE;\r
\r
//\r
// Go through the form package to parse OpCode one by one.\r
//\r
ASSERT (BlockData != NULL);\r
\r
+ SmallestIdFromFlag = FALSE;\r
+\r
//\r
// Add default value for standard ID by CheckBox Flag\r
//\r
DefaultData.DefaultId = VarDefaultId;\r
if ((IfrCheckBox->Flags & EFI_IFR_CHECKBOX_DEFAULT) == EFI_IFR_CHECKBOX_DEFAULT) {\r
//\r
- // When flag is set, defautl value is TRUE.\r
+ // When flag is set, default value is TRUE.\r
//\r
DefaultData.Type = DefaultValueFromFlag;\r
DefaultData.Value.b = TRUE;\r
- } else {\r
- //\r
- // When flag is not set, defautl value is FASLE.\r
- //\r
- DefaultData.Type = DefaultValueFromDefault;\r
- DefaultData.Value.b = FALSE;\r
+ InsertDefaultValue (BlockData, &DefaultData);\r
+\r
+ if (SmallestDefaultId > EFI_HII_DEFAULT_CLASS_STANDARD) {\r
+ //\r
+ // Record the SmallestDefaultId and update the SmallestIdFromFlag.\r
+ //\r
+ SmallestDefaultId = EFI_HII_DEFAULT_CLASS_STANDARD;\r
+ SmallestIdFromFlag = TRUE;\r
+ }\r
}\r
- //\r
- // Add DefaultValue into current BlockData\r
- //\r
- InsertDefaultValue (BlockData, &DefaultData);\r
\r
//\r
// Add default value for Manufacture ID by CheckBox Flag\r
DefaultData.DefaultId = VarDefaultId;\r
if ((IfrCheckBox->Flags & EFI_IFR_CHECKBOX_DEFAULT_MFG) == EFI_IFR_CHECKBOX_DEFAULT_MFG) {\r
//\r
- // When flag is set, defautl value is TRUE.\r
+ // When flag is set, default value is TRUE.\r
//\r
DefaultData.Type = DefaultValueFromFlag;\r
DefaultData.Value.b = TRUE;\r
+ InsertDefaultValue (BlockData, &DefaultData);\r
+\r
+ if (SmallestDefaultId > EFI_HII_DEFAULT_CLASS_MANUFACTURING) {\r
+ //\r
+ // Record the SmallestDefaultId and update the SmallestIdFromFlag.\r
+ //\r
+ SmallestDefaultId = EFI_HII_DEFAULT_CLASS_MANUFACTURING;\r
+ SmallestIdFromFlag = TRUE;\r
+ }\r
+ }\r
+ if (SmallestIdFromFlag) {\r
+ //\r
+ // When smallest default Id is given by the flag of CheckBox, set default value with TRUE for other default Id in the DefaultId list.\r
+ //\r
+ DefaultData.Type = DefaultValueFromOtherDefault;\r
+ DefaultData.Value.b = TRUE;\r
+ //\r
+ // Set default value for all the default id in the DefaultId list.\r
+ //\r
+ for (LinkData = DefaultIdArray->Entry.ForwardLink; LinkData != &DefaultIdArray->Entry; LinkData = LinkData->ForwardLink) {\r
+ DefaultDataPtr = BASE_CR (LinkData, IFR_DEFAULT_DATA, Entry);\r
+ DefaultData.DefaultId = DefaultDataPtr->DefaultId;\r
+ InsertDefaultValue (BlockData, &DefaultData);\r
+ }\r
} else {\r
//\r
- // When flag is not set, defautl value is FASLE.\r
+ // When flag is not set, default value is FASLE.\r
//\r
DefaultData.Type = DefaultValueFromDefault;\r
DefaultData.Value.b = FALSE;\r
+ //\r
+ // Set default value for all the default id in the DefaultId list.\r
+ //\r
+ for (LinkData = DefaultIdArray->Entry.ForwardLink; LinkData != &DefaultIdArray->Entry; LinkData = LinkData->ForwardLink) {\r
+ DefaultDataPtr = BASE_CR (LinkData, IFR_DEFAULT_DATA, Entry);\r
+ DefaultData.DefaultId = DefaultDataPtr->DefaultId;\r
+ InsertDefaultValue (BlockData, &DefaultData);\r
+ }\r
}\r
- //\r
- // Add DefaultValue into current BlockData\r
- //\r
- InsertDefaultValue (BlockData, &DefaultData);\r
break;\r
\r
case EFI_IFR_DATE_OP:\r
\r
//\r
// 1. Set default value for OneOf option when flag field has default attribute.\r
+ // And set the default value with the smallest default id for other default id in the DefaultId list.\r
//\r
if (((IfrOneOfOption->Flags & EFI_IFR_OPTION_DEFAULT) == EFI_IFR_OPTION_DEFAULT) ||\r
((IfrOneOfOption->Flags & EFI_IFR_OPTION_DEFAULT_MFG) == EFI_IFR_OPTION_DEFAULT_MFG)) {\r
// The first oneof option value will be used as default value when no default value is specified. \r
//\r
FirstOneOfOption = FALSE;\r
+\r
+ SmallestIdFromFlag = FALSE;\r
\r
// Prepare new DefaultValue\r
//\r
if ((IfrOneOfOption->Flags & EFI_IFR_OPTION_DEFAULT) == EFI_IFR_OPTION_DEFAULT) {\r
DefaultData.DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD;\r
InsertDefaultValue (BlockData, &DefaultData);\r
- } \r
+ if (SmallestDefaultId > EFI_HII_DEFAULT_CLASS_STANDARD) {\r
+ //\r
+ // Record the SmallestDefaultId and update the SmallestIdFromFlag.\r
+ //\r
+ SmallestDefaultId = EFI_HII_DEFAULT_CLASS_STANDARD;\r
+ SmallestIdFromFlag = TRUE;\r
+ }\r
+ }\r
if ((IfrOneOfOption->Flags & EFI_IFR_OPTION_DEFAULT_MFG) == EFI_IFR_OPTION_DEFAULT_MFG) {\r
DefaultData.DefaultId = EFI_HII_DEFAULT_CLASS_MANUFACTURING;\r
InsertDefaultValue (BlockData, &DefaultData);\r
+ if (SmallestDefaultId > EFI_HII_DEFAULT_CLASS_MANUFACTURING) {\r
+ //\r
+ // Record the SmallestDefaultId and update the SmallestIdFromFlag.\r
+ //\r
+ SmallestDefaultId = EFI_HII_DEFAULT_CLASS_MANUFACTURING;\r
+ SmallestIdFromFlag = TRUE;\r
+ }\r
+ }\r
+\r
+ if (SmallestIdFromFlag) {\r
+ //\r
+ // When smallest default Id is given by the flag of oneofOption, set this option value for other default Id in the DefaultId list.\r
+ //\r
+ DefaultData.Type = DefaultValueFromOtherDefault;\r
+ //\r
+ // Set default value for other default id in the DefaultId list.\r
+ //\r
+ for (LinkData = DefaultIdArray->Entry.ForwardLink; LinkData != &DefaultIdArray->Entry; LinkData = LinkData->ForwardLink) {\r
+ DefaultDataPtr = BASE_CR (LinkData, IFR_DEFAULT_DATA, Entry);\r
+ DefaultData.DefaultId = DefaultDataPtr->DefaultId;\r
+ InsertDefaultValue (BlockData, &DefaultData);\r
+ }\r
}\r
}\r
\r
InsertDefaultValue (BlockData, &DefaultData);\r
\r
//\r
- // After insert the default value, reset the cleaned value for next \r
- // time used. If not set here, need to set the value before everytime \r
+ // Set default value for other default id in the DefaultId list.\r
+ // when SmallestDefaultId == VarDefaultId means there are two defaults with same default Id.\r
+ // If the two defaults are both from default opcode, use the first default as the default value of other default Id.\r
+ // If one from flag and the other form default opcode, use the default opcode value as the default value of other default Id.\r
+ //\r
+ if ((SmallestDefaultId > VarDefaultId) || (SmallestDefaultId == VarDefaultId && !FromOtherDefaultOpcode)) {\r
+ FromOtherDefaultOpcode = TRUE;\r
+ SmallestDefaultId = VarDefaultId;\r
+ for (LinkData = DefaultIdArray->Entry.ForwardLink; LinkData != &DefaultIdArray->Entry; LinkData = LinkData->ForwardLink) {\r
+ DefaultDataPtr = BASE_CR (LinkData, IFR_DEFAULT_DATA, Entry);\r
+ if (DefaultDataPtr->DefaultId != DefaultData.DefaultId){\r
+ DefaultData.Type = DefaultValueFromOtherDefault;\r
+ DefaultData.DefaultId = DefaultDataPtr->DefaultId;\r
+ InsertDefaultValue (BlockData, &DefaultData);\r
+ }\r
+ }\r
+ }\r
+\r
+ //\r
+ // After insert the default value, reset the cleaned value for next\r
+ // time used. If not set here, need to set the value before every time.\r
// use it.\r
//\r
DefaultData.Cleaned = FALSE;\r
}\r
if (BlockData->Scope == 0) {\r
BlockData = NULL;\r
+ //\r
+ // when finishing parsing a question, clean the SmallestDefaultId and GetDefaultFromDefaultOpcode.\r
+ //\r
+ SmallestDefaultId = 0xFFFF;\r
+ FromOtherDefaultOpcode = FALSE;\r
}\r
}\r
\r
When Request points to NULL, the default value string \r
for each varstore in form package will be merged into \r
a <MultiConfigAltResp> format string and return.\r
- @param PointerProgress Optional parameter, it can be be NULL. \r
+ @param PointerProgress Optional parameter, it can be NULL.\r
When it is not NULL, if Request is NULL, it returns NULL. \r
On return, points to a character in the Request\r
string. Points to the string's null terminator if\r
}\r
\r
//\r
- // 1. Get the request block array by Request String when Request string containts the block array.\r
+ // 1. Get the request block array by Request String when Request string contains the block array.\r
//\r
StringPtr = NULL;\r
if (*Request != NULL) {\r
//\r
\r
//\r
- // Parse the opcode in form pacakge to get the default setting.\r
+ // Parse the opcode in form package to get the default setting.\r
//\r
Status = ParseIfrData (DataBaseRecord->Handle,\r
HiiFormPackage,\r
}\r
\r
//\r
- // 5. Merge string into the input AltCfgResp if the iput *AltCfgResp is not NULL.\r
+ // 5. Merge string into the input AltCfgResp if the input *AltCfgResp is not NULL.\r
//\r
if (*AltCfgResp != NULL && DefaultAltCfgResp != NULL) {\r
Status = MergeDefaultString (AltCfgResp, DefaultAltCfgResp);\r
}\r
\r
//\r
- // Free Pacakge data\r
+ // Free Package data\r
//\r
if (HiiFormPackage != NULL) {\r
FreePool (HiiFormPackage);\r
\r
//\r
// Attach this <ConfigAltResp> to a <MultiConfigAltResp>. There is a '&'\r
- // which seperates the first <ConfigAltResp> and the following ones.\r
+ // which separates the first <ConfigAltResp> and the following ones.\r
//\r
ASSERT (*AccessProgress == 0);\r
\r
\r
//\r
// Attach this <ConfigAltResp> to a <MultiConfigAltResp>. There is a '&'\r
- // which seperates the first <ConfigAltResp> and the following ones. \r
+ // which separates the first <ConfigAltResp> and the following ones.\r
//\r
if (!FirstElement) {\r
Status = AppendToMultiString (Results, L"&");\r