summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>2011-11-24 08:47:57 +0000
committerydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>2011-11-24 08:47:57 +0000
commite7fd76d180744440db7b5a91a7787ca39713da05 (patch)
treec272e20dc3bca62a890dd363184021ebb32fb048
parent697ecfd313e6c21a7d01a9eec618174cc4136fb8 (diff)
downloadedk2-platforms-e7fd76d180744440db7b5a91a7787ca39713da05.tar.xz
Patch includes:
1. Support get default value for ref opcode logic. 2. Correct the sample for ref opcode with default value. 3. Refine logic about processing device path info in ref value. Signed-off-by: ydong10 Reviewed-by: lgao4 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12774 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr3
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c92
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h2
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Ui.c32
4 files changed, 98 insertions, 31 deletions
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr b/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr
index 03ae667e7c..ab4703eb82 100644
--- a/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr
+++ b/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr
@@ -645,11 +645,12 @@ formset
prompt = STRING_TOKEN(STR_GOTO_DYNAMIC3),
help = STRING_TOKEN(STR_GOTO_DYNAMIC3_HELP),
flags = INTERACTIVE,
- key = 0x1248;
+ key = 0x1248,
//
// Set the defult value, format is QuestionId; FormId; FormsetGuid; Device Path String Token
//
default = 0;0;ZERO_GUID;STRING_TOKEN(STR_NULL_STRING),
+ ; // goto opcode end flag.
goto
prompt = STRING_TOKEN(STR_GOTO_DYNAMIC4),
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
index 7cc71e2476..356b730bed 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
@@ -661,7 +661,7 @@ InsertDefaultValue (
//
// Update the default value array in BlockData.
//
- DefaultValueArray->Value = DefaultValueData->Value;
+ CopyMem (&DefaultValueArray->Value, &DefaultValueData->Value, sizeof (EFI_IFR_TYPE_VALUE));
DefaultValueArray->Type = DefaultValueData->Type;
DefaultValueArray->Cleaned = DefaultValueData->Cleaned;
}
@@ -990,6 +990,7 @@ ParseIfrData (
EFI_IFR_VARSTORE_EFI *IfrEfiVarStore;
EFI_IFR_OP_HEADER *IfrOpHdr;
EFI_IFR_ONE_OF *IfrOneOf;
+ EFI_IFR_REF4 *IfrRef;
EFI_IFR_ONE_OF_OPTION *IfrOneOfOption;
EFI_IFR_DEFAULT *IfrDefault;
EFI_IFR_ORDERED_LIST *IfrOrderedList;
@@ -1178,6 +1179,65 @@ ParseIfrData (
}
break;
+ case EFI_IFR_REF_OP:
+ //
+ // Ref question is not in IFR Form. This IFR form is not valid.
+ //
+ if (VarStorageData->Size == 0) {
+ Status = EFI_INVALID_PARAMETER;
+ goto Done;
+ }
+ //
+ // Check whether this question is for the requested varstore.
+ //
+ IfrRef = (EFI_IFR_REF4 *) IfrOpHdr;
+ if (IfrRef->Question.VarStoreId != VarStorageData->VarStoreId) {
+ break;
+ }
+
+ //
+ // Get Offset/Width by Question header.
+ //
+ VarOffset = IfrRef->Question.VarStoreInfo.VarOffset;
+ VarWidth = (UINT16) (sizeof (EFI_HII_REF));
+ //
+ // Check whether this question is in requested block array.
+ //
+ if (!BlockArrayCheck (RequestBlockArray, VarOffset, VarWidth)) {
+ //
+ // This question is not in the requested string. Skip it.
+ //
+ break;
+ }
+
+ //
+ // Check this var question is in the var storage
+ //
+ if ((VarOffset + VarWidth) > VarStorageData->Size) {
+ Status = EFI_INVALID_PARAMETER;
+ goto Done;
+ }
+
+ //
+ // Set Block Data
+ //
+ BlockData = (IFR_BLOCK_DATA *) AllocateZeroPool (sizeof (IFR_BLOCK_DATA));
+ if (BlockData == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ goto Done;
+ }
+ BlockData->Offset = VarOffset;
+ BlockData->Width = VarWidth;
+ BlockData->QuestionId = IfrRef->Question.QuestionId;
+ BlockData->OpCode = IfrOpHdr->OpCode;
+ BlockData->Scope = IfrOpHdr->Scope;
+ InitializeListHead (&BlockData->DefaultValueEntry);
+ //
+ // Add Block Data into VarStorageData BlockEntry
+ //
+ InsertBlockData (&VarStorageData->BlockEntry, &BlockData);
+ break;
+
case EFI_IFR_ONE_OF_OP:
case EFI_IFR_NUMERIC_OP:
//
@@ -1253,19 +1313,19 @@ ParseIfrData (
DefaultData.Type = DefaultValueFromDefault;
switch (IfrOneOf->Flags & EFI_IFR_NUMERIC_SIZE) {
case EFI_IFR_NUMERIC_SIZE_1:
- DefaultData.Value = (UINT64) IfrOneOf->data.u8.MinValue;
+ DefaultData.Value.u8 = IfrOneOf->data.u8.MinValue;
break;
case EFI_IFR_NUMERIC_SIZE_2:
- CopyMem (&DefaultData.Value, &IfrOneOf->data.u16.MinValue, sizeof (UINT16));
+ CopyMem (&DefaultData.Value.u16, &IfrOneOf->data.u16.MinValue, sizeof (UINT16));
break;
case EFI_IFR_NUMERIC_SIZE_4:
- CopyMem (&DefaultData.Value, &IfrOneOf->data.u32.MinValue, sizeof (UINT32));
+ CopyMem (&DefaultData.Value.u32, &IfrOneOf->data.u32.MinValue, sizeof (UINT32));
break;
case EFI_IFR_NUMERIC_SIZE_8:
- CopyMem (&DefaultData.Value, &IfrOneOf->data.u64.MinValue, sizeof (UINT64));
+ CopyMem (&DefaultData.Value.u64, &IfrOneOf->data.u64.MinValue, sizeof (UINT64));
break;
}
//
@@ -1404,14 +1464,14 @@ ParseIfrData (
//
// When flag is set, defautl value is TRUE.
//
- DefaultData.Type = DefaultValueFromFlag;
- DefaultData.Value = 1;
+ DefaultData.Type = DefaultValueFromFlag;
+ DefaultData.Value.b = TRUE;
} else {
//
// When flag is not set, defautl value is FASLE.
//
- DefaultData.Type = DefaultValueFromDefault;
- DefaultData.Value = 0;
+ DefaultData.Type = DefaultValueFromDefault;
+ DefaultData.Value.b = FALSE;
}
//
// Add DefaultValue into current BlockData
@@ -1430,14 +1490,14 @@ ParseIfrData (
//
// When flag is set, defautl value is TRUE.
//
- DefaultData.Type = DefaultValueFromFlag;
- DefaultData.Value = 1;
+ DefaultData.Type = DefaultValueFromFlag;
+ DefaultData.Value.b = TRUE;
} else {
//
// When flag is not set, defautl value is FASLE.
//
- DefaultData.Type = DefaultValueFromDefault;
- DefaultData.Value = 0;
+ DefaultData.Type = DefaultValueFromDefault;
+ DefaultData.Value.b = FALSE;
}
//
// Add DefaultValue into current BlockData
@@ -1665,7 +1725,7 @@ ParseIfrData (
// Prepare new DefaultValue
//
DefaultData.Type = DefaultValueFromFlag;
- DefaultData.Value = IfrOneOfOption->Value.u64;
+ CopyMem (&DefaultData.Value.u64, &IfrOneOfOption->Value.u64, sizeof (UINT64));
if ((IfrOneOfOption->Flags & EFI_IFR_OPTION_DEFAULT) == EFI_IFR_OPTION_DEFAULT) {
DefaultData.DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD;
InsertDefaultValue (BlockData, &DefaultData);
@@ -1690,7 +1750,7 @@ ParseIfrData (
// Prepare new DefaultValue
//
DefaultData.Type = DefaultValueFromDefault;
- DefaultData.Value = IfrOneOfOption->Value.u64;
+ CopyMem (&DefaultData.Value.u64, &IfrOneOfOption->Value.u64, sizeof (UINT64));
for (LinkData = DefaultIdArray->Entry.ForwardLink; LinkData != &DefaultIdArray->Entry; LinkData = LinkData->ForwardLink) {
DefaultDataPtr = BASE_CR (LinkData, IFR_DEFAULT_DATA, Entry);
DefaultData.DefaultId = DefaultDataPtr->DefaultId;
@@ -1726,7 +1786,7 @@ ParseIfrData (
//
DefaultData.Type = DefaultValueFromOpcode;
DefaultData.DefaultId = VarDefaultId;
- DefaultData.Value = IfrDefault->Value.u64;
+ CopyMem (&DefaultData.Value, &IfrDefault->Value, sizeof (EFI_IFR_TYPE_VALUE));
// If the value field is expression, set the cleaned flag.
if (IfrDefault->Type == EFI_IFR_TYPE_OTHER) {
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
index b0944abb1b..455dac3533 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
@@ -96,7 +96,7 @@ typedef struct {
// TRUE Cleaned, the value can't be used
// FALSE Not cleaned, the value can be used.
UINT16 DefaultId;
- UINT64 Value;
+ EFI_IFR_TYPE_VALUE Value;
} IFR_DEFAULT_DATA;
//
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
index 0be50263dd..ebe8fae2cc 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
@@ -1891,6 +1891,7 @@ ProcessGotoOpCode (
)
{
CHAR16 *StringPtr;
+ UINTN StringLen;
UINTN BufferSize;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
CHAR16 TemStr[2];
@@ -1905,8 +1906,23 @@ ProcessGotoOpCode (
Status = EFI_SUCCESS;
UpdateFormInfo = TRUE;
+ StringPtr = NULL;
+ StringLen = 0;
+ //
+ // Prepare the device path check, get the device path info first.
+ //
if (Statement->HiiValue.Value.ref.DevicePath != 0) {
+ StringPtr = GetToken (Statement->HiiValue.Value.ref.DevicePath, Selection->FormSet->HiiHandle);
+ if (StringPtr != NULL) {
+ StringLen = StrLen (StringPtr);
+ }
+ }
+
+ //
+ // Check whether the device path string is a valid string.
+ //
+ if (Statement->HiiValue.Value.ref.DevicePath != 0 && StringPtr != NULL && StringLen != 0) {
if (Selection->Form->ModalForm) {
return Status;
}
@@ -1914,16 +1930,6 @@ ProcessGotoOpCode (
// Goto another Hii Package list
//
Selection->Action = UI_ACTION_REFRESH_FORMSET;
-
- StringPtr = GetToken (Statement->HiiValue.Value.ref.DevicePath, Selection->FormSet->HiiHandle);
- if (StringPtr == NULL) {
- //
- // No device path string not found, exit
- //
- Selection->Action = UI_ACTION_EXIT;
- Selection->Statement = NULL;
- return Status;
- }
BufferSize = StrLen (StringPtr) / 2;
DevicePath = AllocatePool (BufferSize);
ASSERT (DevicePath != NULL);
@@ -1947,8 +1953,11 @@ ProcessGotoOpCode (
DevicePathBuffer [Index/2] = (UINT8) ((DevicePathBuffer [Index/2] << 4) + DigitUint8);
}
}
+ FreePool (StringPtr);
Selection->Handle = DevicePathToHiiHandle (DevicePath);
+ FreePool (DevicePath);
+
if (Selection->Handle == NULL) {
//
// If target Hii Handle not found, exit
@@ -1958,9 +1967,6 @@ ProcessGotoOpCode (
return Status;
}
- FreePool (StringPtr);
- FreePool (DevicePath);
-
CopyMem (&Selection->FormSetGuid,&Statement->HiiValue.Value.ref.FormSetGuid, sizeof (EFI_GUID));
Selection->FormId = Statement->HiiValue.Value.ref.FormId;
Selection->QuestionId = Statement->HiiValue.Value.ref.QuestionId;