diff options
author | Dandan Bi <dandan.bi@intel.com> | 2015-08-27 08:35:19 +0000 |
---|---|---|
committer | dandanbi <dandanbi@Edk2> | 2015-08-27 08:35:19 +0000 |
commit | e68c776bf83b698dad76df1202bb763fe32de89e (patch) | |
tree | d931c9f0a4db3ca3d7ca48e406e974af091441c6 | |
parent | 2bf63b20d24947d59b8cc93c2b460c0a607fe4aa (diff) | |
download | edk2-platforms-e68c776bf83b698dad76df1202bb763fe32de89e.tar.xz |
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
-rw-r--r-- | MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr | 1 | ||||
-rw-r--r-- | MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni | bin | 63554 -> 63834 bytes | |||
-rw-r--r-- | MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c | 25 |
3 files changed, 17 insertions, 9 deletions
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr b/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr index 1366e827f2..8da0d4b30b 100644 --- a/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr +++ b/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr @@ -461,6 +461,7 @@ formset help = STRING_TOKEN(STR_MY_STRING_HELP),
minsize = 6,
maxsize = 0x14,
+ default = STRING_TOKEN(STR_MY_STRING_DEFAULT),
endstring;
//
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni b/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni Binary files differindex a3fbaed8a4..0a5c2424d5 100644 --- a/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni +++ b/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni 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;
}
|