diff options
author | qwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-09-04 10:15:50 +0000 |
---|---|---|
committer | qwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-09-04 10:15:50 +0000 |
commit | 8ea58c070785281087061b0f706b03cf873949c7 (patch) | |
tree | 0a2a63d7fbf05b94ebaed4e9760c7a1c5fbe6271 /EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/OpcodeCreation.c | |
parent | e00e1d46940a267d6fbe92be4ed2e547b4e946dc (diff) | |
download | edk2-platforms-8ea58c070785281087061b0f706b03cf873949c7.tar.xz |
1) Add a stringent check to make sure the package list for UpdateForm call must have IFR packages.
2) Fix a bug for Numeric Opcode creation.
3) Add AssignQuestionId to assign QuestionId to be a non-zero value always.
4) Add in Check in UefiRegisterPackageList to same package list to be registered for more than once. (Framework BDS has this behavior).
5) Fix a bug in HiiNewString
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5822 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/OpcodeCreation.c')
-rw-r--r-- | EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/OpcodeCreation.c | 84 |
1 files changed, 50 insertions, 34 deletions
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/OpcodeCreation.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/OpcodeCreation.c index 6359c8e680..0fbe943165 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/OpcodeCreation.c +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/OpcodeCreation.c @@ -44,6 +44,21 @@ AppendToUpdateBuffer ( return EFI_SUCCESS;
}
+EFI_QUESTION_ID
+AssignQuestionId (
+ IN UINT16 FwQuestionId
+ )
+{
+ if (FwQuestionId == 0) {
+ //
+ // In UEFI IFR, the Question ID can't be zero. Zero means no storage.
+ // So use 0xABBA as a Question ID.
+ //
+ return 0xABBA;
+ } else {
+ return FwQuestionId;
+ }
+}
EFI_STATUS
@@ -368,7 +383,7 @@ F2UCreateOneOfOpCode ( if (UOpcode.Question.QuestionId == 0) {
Status = FwQuestionIdToUefiQuestionId (ThunkContext, VarStoreId, FwOpcode->QuestionId, &UOpcode.Question.QuestionId);
if (EFI_ERROR (Status)) {
- UOpcode.Question.QuestionId = FwOneOfOp->Key;
+ UOpcode.Question.QuestionId = AssignQuestionId (FwOneOfOp->Key);
}
OneOfOptionMap = AllocateZeroPool (sizeof (ONE_OF_OPTION_MAP));
@@ -382,6 +397,7 @@ F2UCreateOneOfOpCode ( break;
case 2:
OneOfOptionMap->ValueType = EFI_IFR_TYPE_NUM_SIZE_16;
+ break;
default:
ASSERT (FALSE);
break;
@@ -416,7 +432,7 @@ F2UCreateOneOfOpCode ( //
Status = FwQuestionIdToUefiQuestionId (ThunkContext, VarStoreId, FwOpcode->QuestionId, &UOpcode.Question.QuestionId);
if (EFI_ERROR (Status)) {
- UOpcode.Question.QuestionId = FwOpcode->QuestionId;
+ UOpcode.Question.QuestionId = AssignQuestionId (FwOpcode->QuestionId);
}
}
@@ -519,7 +535,7 @@ F2UCreateOrderedListOpCode ( if (UOpcode.Question.QuestionId == 0) {
Status = FwQuestionIdToUefiQuestionId (ThunkContext, VarStoreId, FwOpcode->QuestionId, &UOpcode.Question.QuestionId);
if (EFI_ERROR (Status)) {
- UOpcode.Question.QuestionId = FwOneOfOp->Key;
+ UOpcode.Question.QuestionId = AssignQuestionId (FwOneOfOp->Key);
}
}
@@ -535,7 +551,7 @@ F2UCreateOrderedListOpCode ( if (UOpcode.Question.QuestionId == 0) {
Status = FwQuestionIdToUefiQuestionId (ThunkContext, VarStoreId, FwOpcode->QuestionId, &UOpcode.Question.QuestionId);
if (EFI_ERROR (Status)) {
- UOpcode.Question.QuestionId = FwOpcode->QuestionId;
+ UOpcode.Question.QuestionId = AssignQuestionId (FwOpcode->QuestionId);
}
}
@@ -626,7 +642,7 @@ F2UCreateCheckBoxOpCode ( //
// Add a new opcode and it will not trigger call back. So we just reuse the FW QuestionId.
//
- UOpcode.Question.QuestionId = FwOpcode->QuestionId;
+ UOpcode.Question.QuestionId = AssignQuestionId (FwOpcode->QuestionId);
}
} else {
UOpcode.Question.QuestionId = FwOpcode->Key;
@@ -735,7 +751,7 @@ F2UCreateNumericOpCode ( //
// Add a new opcode and it will not trigger call back. So we just reuse the FW QuestionId.
//
- UOpcode.Question.QuestionId = FwOpcode->QuestionId;
+ UOpcode.Question.QuestionId = AssignQuestionId (FwOpcode->QuestionId);
}
} else {
UOpcode.Question.QuestionId = FwOpcode->Key;
@@ -747,14 +763,11 @@ F2UCreateNumericOpCode ( // We need to create a nested default value for the UEFI Numeric Opcode.
// So turn on the scope.
//
- if (FwOpcode->Default != 0) {
- UOpcode.Header.Scope = 1;
- }
+ UOpcode.Header.Scope = 1;
UOpcode.Question.Header.Prompt = FwOpcode->Prompt;
UOpcode.Question.Header.Help = FwOpcode->Help;
- UOpcode.Question.QuestionId = FwOpcode->Key;
UOpcode.Question.VarStoreId = VarStoreId;
UOpcode.Question.VarStoreInfo.VarOffset = FwOpcode->QuestionId;
@@ -770,12 +783,12 @@ F2UCreateNumericOpCode ( switch (FwOpcode->Width) {
case 1:
{
- UOpcode.Flags = EFI_IFR_NUMERIC_SIZE_2 | EFI_IFR_DISPLAY_UINT_DEC;
+ UOpcode.Flags = EFI_IFR_NUMERIC_SIZE_1 | EFI_IFR_DISPLAY_UINT_DEC;
break;
}
case 2:
{
- UOpcode.Flags = EFI_IFR_NUMERIC_SIZE_1 | EFI_IFR_DISPLAY_UINT_DEC;
+ UOpcode.Flags = EFI_IFR_NUMERIC_SIZE_2 | EFI_IFR_DISPLAY_UINT_DEC;
break;
}
default:
@@ -793,34 +806,32 @@ F2UCreateNumericOpCode ( //
// We need to create a default value.
//
- if (FwOpcode->Default != 0) {
- ZeroMem (&UOpcodeDefault, sizeof (UOpcodeDefault));
- UOpcodeDefault.Header.Length = sizeof (UOpcodeDefault);
- UOpcodeDefault.Header.OpCode = EFI_IFR_DEFAULT_OP;
+ ZeroMem (&UOpcodeDefault, sizeof (UOpcodeDefault));
+ UOpcodeDefault.Header.Length = sizeof (UOpcodeDefault);
+ UOpcodeDefault.Header.OpCode = EFI_IFR_DEFAULT_OP;
- UOpcodeDefault.DefaultId = 0;
+ UOpcodeDefault.DefaultId = 0;
- switch (FwOpcode->Width) {
- case 1:
- {
- UOpcodeDefault.Type = EFI_IFR_TYPE_NUM_SIZE_8;
- break;
- }
- case 2:
- {
- UOpcodeDefault.Type = EFI_IFR_TYPE_NUM_SIZE_16;
- break;
- }
+ switch (FwOpcode->Width) {
+ case 1:
+ {
+ UOpcodeDefault.Type = EFI_IFR_TYPE_NUM_SIZE_8;
+ break;
+ }
+ case 2:
+ {
+ UOpcodeDefault.Type = EFI_IFR_TYPE_NUM_SIZE_16;
+ break;
}
+ }
- CopyMem (&UOpcodeDefault.Value.u8, &FwOpcode->Default, FwOpcode->Width);
+ CopyMem (&UOpcodeDefault.Value.u8, &FwOpcode->Default, FwOpcode->Width);
- Status = AppendToUpdateBuffer ((UINT8 *) &UOpcodeDefault, sizeof(UOpcodeDefault), UefiData);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- Status = UCreateEndOfOpcode (UefiData);
+ Status = AppendToUpdateBuffer ((UINT8 *) &UOpcodeDefault, sizeof(UOpcodeDefault), UefiData);
+ if (EFI_ERROR (Status)) {
+ return Status;
}
+ Status = UCreateEndOfOpcode (UefiData);
return Status;
}
@@ -1037,6 +1048,11 @@ FwUpdateDataToUefiUpdateData ( DataCount = 1;
break;
+ case FRAMEWORK_EFI_IFR_NUMERIC_OP:
+ Status = F2UCreateNumericOpCode (ThunkContext, VarStoreId, (FRAMEWORK_EFI_IFR_NUMERIC *) FwOpCode, UefiOpCode);
+ DataCount = 1;
+ break;
+
default:
ASSERT (FALSE);
return EFI_UNSUPPORTED;
|