Revision: 17336
http://sourceforge.net/p/edk2/code/17336
Author: ydong10
Date: 2015-05-06 09:36:40 +0000 (Wed, 06 May 2015)
Log Message:
-----------
MdeModulePkg: Enable buffer type value for default and oneofoption opcode.
In order to support default value for orderedlist opcode, support buffer type
value for default/oneofoption opcode.
If oneofoption used as a default value, it will not be added to normal option
list.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
Modified Paths:
--------------
trunk/edk2/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
trunk/edk2/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
Modified: trunk/edk2/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
===================================================================
--- trunk/edk2/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
2015-05-06 09:35:14 UTC (rev 17335)
+++ trunk/edk2/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
2015-05-06 09:36:40 UTC (rev 17336)
@@ -902,6 +902,9 @@
Default = QUESTION_DEFAULT_FROM_LINK (Link);
RemoveEntryList (&Default->Link);
+ if (Default->Value.Buffer != NULL) {
+ FreePool (Default->Value.Buffer);
+ }
FreePool (Default);
}
@@ -2113,7 +2116,11 @@
CurrentDefault->Value.Type = ((EFI_IFR_DEFAULT *) OpCodeData)->Type;
CopyMem (&CurrentDefault->DefaultId, &((EFI_IFR_DEFAULT *)
OpCodeData)->DefaultId, sizeof (UINT16));
- if (OpCodeLength > OFFSET_OF (EFI_IFR_DEFAULT, Value)) {
+ if (CurrentDefault->Value.Type == EFI_IFR_TYPE_BUFFER) {
+ CurrentDefault->Value.BufferLen = (UINT16) (OpCodeLength - OFFSET_OF
(EFI_IFR_DEFAULT, Value));
+ CurrentDefault->Value.Buffer = AllocateCopyPool
(CurrentDefault->Value.BufferLen, &((EFI_IFR_DEFAULT *) OpCodeData)->Value);
+ ASSERT (CurrentDefault->Value.Buffer != NULL);
+ } else {
CopyMem (&CurrentDefault->Value.Value, &((EFI_IFR_DEFAULT *)
OpCodeData)->Value, OpCodeLength - OFFSET_OF (EFI_IFR_DEFAULT, Value));
ExtendValueToU64 (&CurrentDefault->Value);
}
@@ -2132,6 +2139,32 @@
// Option
//
case EFI_IFR_ONE_OF_OPTION_OP:
+ if (ParentStatement->Operand == EFI_IFR_ORDERED_LIST_OP &&
((((EFI_IFR_ONE_OF_OPTION *) OpCodeData)->Flags & (EFI_IFR_OPTION_DEFAULT |
EFI_IFR_OPTION_DEFAULT_MFG)) != 0)) {
+ //
+ // It's keep the default value for ordered list opcode.
+ //
+ CurrentDefault = AllocateZeroPool (sizeof (QUESTION_DEFAULT));
+ ASSERT (CurrentDefault != NULL);
+ CurrentDefault->Signature = QUESTION_DEFAULT_SIGNATURE;
+
+ CurrentDefault->Value.Type = EFI_IFR_TYPE_BUFFER;
+ if ((((EFI_IFR_ONE_OF_OPTION *) OpCodeData)->Flags &
EFI_IFR_OPTION_DEFAULT) != 0) {
+ CurrentDefault->DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD;
+ } else {
+ CurrentDefault->DefaultId = EFI_HII_DEFAULT_CLASS_MANUFACTURING;
+ }
+
+ CurrentDefault->Value.BufferLen = (UINT16) (OpCodeLength - OFFSET_OF
(EFI_IFR_ONE_OF_OPTION, Value));
+ CurrentDefault->Value.Buffer = AllocateCopyPool
(CurrentDefault->Value.BufferLen, &((EFI_IFR_ONE_OF_OPTION *)
OpCodeData)->Value);
+ ASSERT (CurrentDefault->Value.Buffer != NULL);
+
+ //
+ // Insert to Default Value list of current Question
+ //
+ InsertTailList (&ParentStatement->DefaultListHead,
&CurrentDefault->Link);
+ break;
+ }
+
//
// EFI_IFR_ONE_OF_OPTION appear in scope of a Question.
// It create a selection for use in current Question.
Modified: trunk/edk2/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
===================================================================
--- trunk/edk2/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c 2015-05-06
09:35:14 UTC (rev 17335)
+++ trunk/edk2/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c 2015-05-06
09:36:40 UTC (rev 17336)
@@ -3859,7 +3859,12 @@
//
// Default value is embedded in EFI_IFR_DEFAULT
//
- CopyMem (HiiValue, &Default->Value, sizeof (EFI_HII_VALUE));
+ if (Default->Value.Type == EFI_IFR_TYPE_BUFFER) {
+ ASSERT (HiiValue->Buffer != NULL);
+ CopyMem (HiiValue->Buffer, Default->Value.Buffer,
Default->Value.BufferLen);
+ } else {
+ CopyMem (HiiValue, &Default->Value, sizeof (EFI_HII_VALUE));
+ }
}
if (HiiValue->Type == EFI_IFR_TYPE_STRING) {
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits