summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Universal/HiiDatabaseDxe
diff options
context:
space:
mode:
authorDandan Bi <dandan.bi@intel.com>2015-08-27 08:35:19 +0000
committerdandanbi <dandanbi@Edk2>2015-08-27 08:35:19 +0000
commite68c776bf83b698dad76df1202bb763fe32de89e (patch)
treed931c9f0a4db3ca3d7ca48e406e974af091441c6 /MdeModulePkg/Universal/HiiDatabaseDxe
parent2bf63b20d24947d59b8cc93c2b460c0a607fe4aa (diff)
downloadedk2-e68c776bf83b698dad76df1202bb763fe32de89e.tar.gz
edk2-e68c776bf83b698dad76df1202bb763fe32de89e.tar.bz2
edk2-e68c776bf83b698dad76df1202bb763fe32de89e.zip
MdeModulePkg:Set default string value
Previously construct Default Value in AltResp for string opcode is String Id, Now change it to string value if the string opcode has default value. This change is compatible for SetupBrowser to handle.And add default value for string in DriverSample to test this case. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18337 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/HiiDatabaseDxe')
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
index 56868831a1..1081e75921 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
@@ -2056,11 +2056,6 @@ ParseIfrData (
if (EFI_ERROR (Status)) {
goto Done;
}
-
- //
- // No default value for string.
- //
- BlockData = NULL;
break;
case EFI_IFR_PASSWORD_OP:
@@ -2850,6 +2845,7 @@ GetStorageWidth (
/**
Generate ConfigAltResp string base on the varstore info.
+ @param HiiHandle Hii Handle for this hii package.
@param ConfigHdr The config header for this varstore.
@param VarStorageData The varstore info.
@param DefaultIdArray The Default id array.
@@ -2860,6 +2856,7 @@ GetStorageWidth (
**/
EFI_STATUS
GenerateAltConfigResp (
+ IN EFI_HII_HANDLE HiiHandle,
IN CHAR16 *ConfigHdr,
IN IFR_VARSTORAGE_DATA *VarStorageData,
IN IFR_DEFAULT_DATA *DefaultIdArray,
@@ -2878,10 +2875,11 @@ GenerateAltConfigResp (
IFR_DEFAULT_DATA *DefaultValueData;
UINTN Width;
UINT8 *TmpBuffer;
+ CHAR16 *DefaultString;
BlockData = NULL;
DataExist = FALSE;
-
+ DefaultString = NULL;
//
// Add length for <ConfigHdr> + '\0'
//
@@ -2993,10 +2991,19 @@ GenerateAltConfigResp (
// Convert Value to a hex string in "%x" format
// NOTE: This is in the opposite byte that GUID and PATH use
//
- TmpBuffer = (UINT8 *) &(DefaultValueData->Value);
- for (; Width > 0; Width--) {
+ if (BlockData->OpCode == EFI_IFR_STRING_OP){
+ DefaultString = InternalGetString(HiiHandle, DefaultValueData->Value.string);
+ TmpBuffer = (UINT8 *) DefaultString;
+ } else {
+ TmpBuffer = (UINT8 *) &(DefaultValueData->Value);
+ }
+ for (; Width > 0 && (TmpBuffer != NULL); Width--) {
StringPtr += UnicodeValueToString (StringPtr, PREFIX_ZERO | RADIX_HEX, TmpBuffer[Width - 1], 2);
}
+ if (DefaultString != NULL){
+ FreePool(DefaultString);
+ DefaultString = NULL;
+ }
}
}
}
@@ -3218,7 +3225,7 @@ GetFullStringFromHiiFormPackages (
// Go through all VarStorageData Entry and get the DefaultId array for each one
// Then construct them all to : ConfigHdr AltConfigHdr ConfigBody AltConfigHdr ConfigBody
//
- Status = GenerateAltConfigResp (ConfigHdr, VarStorageData, DefaultIdArray, &DefaultAltCfgResp);
+ Status = GenerateAltConfigResp (DataBaseRecord->Handle,ConfigHdr, VarStorageData, DefaultIdArray, &DefaultAltCfgResp);
if (EFI_ERROR (Status)) {
goto Done;
}