mirror of https://github.com/acidanthera/audk.git
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
This commit is contained in:
parent
e00e1d4694
commit
8ea58c0707
|
@ -519,13 +519,10 @@ HiiUpdateForm (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ThunkContext->IfrPackageCount == 0) && (ThunkContext->StringPackageCount != 0)) {
|
if (ThunkContext->IfrPackageCount == 0) {
|
||||||
UefiHiiHandle = TagGuidToUefiHiiHandle (Private, &ThunkContext->TagGuid);
|
ASSERT (FALSE);
|
||||||
|
|
||||||
if (UefiHiiHandle == NULL) {
|
|
||||||
Status = EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
UefiHiiHandle = ThunkContext->UefiHiiHandle;
|
UefiHiiHandle = ThunkContext->UefiHiiHandle;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,21 @@ AppendToUpdateBuffer (
|
||||||
return EFI_SUCCESS;
|
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
|
EFI_STATUS
|
||||||
|
@ -368,7 +383,7 @@ F2UCreateOneOfOpCode (
|
||||||
if (UOpcode.Question.QuestionId == 0) {
|
if (UOpcode.Question.QuestionId == 0) {
|
||||||
Status = FwQuestionIdToUefiQuestionId (ThunkContext, VarStoreId, FwOpcode->QuestionId, &UOpcode.Question.QuestionId);
|
Status = FwQuestionIdToUefiQuestionId (ThunkContext, VarStoreId, FwOpcode->QuestionId, &UOpcode.Question.QuestionId);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
UOpcode.Question.QuestionId = FwOneOfOp->Key;
|
UOpcode.Question.QuestionId = AssignQuestionId (FwOneOfOp->Key);
|
||||||
}
|
}
|
||||||
|
|
||||||
OneOfOptionMap = AllocateZeroPool (sizeof (ONE_OF_OPTION_MAP));
|
OneOfOptionMap = AllocateZeroPool (sizeof (ONE_OF_OPTION_MAP));
|
||||||
|
@ -382,6 +397,7 @@ F2UCreateOneOfOpCode (
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
OneOfOptionMap->ValueType = EFI_IFR_TYPE_NUM_SIZE_16;
|
OneOfOptionMap->ValueType = EFI_IFR_TYPE_NUM_SIZE_16;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
break;
|
break;
|
||||||
|
@ -416,7 +432,7 @@ F2UCreateOneOfOpCode (
|
||||||
//
|
//
|
||||||
Status = FwQuestionIdToUefiQuestionId (ThunkContext, VarStoreId, FwOpcode->QuestionId, &UOpcode.Question.QuestionId);
|
Status = FwQuestionIdToUefiQuestionId (ThunkContext, VarStoreId, FwOpcode->QuestionId, &UOpcode.Question.QuestionId);
|
||||||
if (EFI_ERROR (Status)) {
|
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) {
|
if (UOpcode.Question.QuestionId == 0) {
|
||||||
Status = FwQuestionIdToUefiQuestionId (ThunkContext, VarStoreId, FwOpcode->QuestionId, &UOpcode.Question.QuestionId);
|
Status = FwQuestionIdToUefiQuestionId (ThunkContext, VarStoreId, FwOpcode->QuestionId, &UOpcode.Question.QuestionId);
|
||||||
if (EFI_ERROR (Status)) {
|
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) {
|
if (UOpcode.Question.QuestionId == 0) {
|
||||||
Status = FwQuestionIdToUefiQuestionId (ThunkContext, VarStoreId, FwOpcode->QuestionId, &UOpcode.Question.QuestionId);
|
Status = FwQuestionIdToUefiQuestionId (ThunkContext, VarStoreId, FwOpcode->QuestionId, &UOpcode.Question.QuestionId);
|
||||||
if (EFI_ERROR (Status)) {
|
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.
|
// 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 {
|
} else {
|
||||||
UOpcode.Question.QuestionId = FwOpcode->Key;
|
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.
|
// 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 {
|
} else {
|
||||||
UOpcode.Question.QuestionId = FwOpcode->Key;
|
UOpcode.Question.QuestionId = FwOpcode->Key;
|
||||||
|
@ -747,14 +763,11 @@ F2UCreateNumericOpCode (
|
||||||
// We need to create a nested default value for the UEFI Numeric Opcode.
|
// We need to create a nested default value for the UEFI Numeric Opcode.
|
||||||
// So turn on the scope.
|
// 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.Prompt = FwOpcode->Prompt;
|
||||||
UOpcode.Question.Header.Help = FwOpcode->Help;
|
UOpcode.Question.Header.Help = FwOpcode->Help;
|
||||||
|
|
||||||
UOpcode.Question.QuestionId = FwOpcode->Key;
|
|
||||||
UOpcode.Question.VarStoreId = VarStoreId;
|
UOpcode.Question.VarStoreId = VarStoreId;
|
||||||
UOpcode.Question.VarStoreInfo.VarOffset = FwOpcode->QuestionId;
|
UOpcode.Question.VarStoreInfo.VarOffset = FwOpcode->QuestionId;
|
||||||
|
|
||||||
|
@ -770,12 +783,12 @@ F2UCreateNumericOpCode (
|
||||||
switch (FwOpcode->Width) {
|
switch (FwOpcode->Width) {
|
||||||
case 1:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
case 2:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -793,7 +806,6 @@ F2UCreateNumericOpCode (
|
||||||
//
|
//
|
||||||
// We need to create a default value.
|
// We need to create a default value.
|
||||||
//
|
//
|
||||||
if (FwOpcode->Default != 0) {
|
|
||||||
ZeroMem (&UOpcodeDefault, sizeof (UOpcodeDefault));
|
ZeroMem (&UOpcodeDefault, sizeof (UOpcodeDefault));
|
||||||
UOpcodeDefault.Header.Length = sizeof (UOpcodeDefault);
|
UOpcodeDefault.Header.Length = sizeof (UOpcodeDefault);
|
||||||
UOpcodeDefault.Header.OpCode = EFI_IFR_DEFAULT_OP;
|
UOpcodeDefault.Header.OpCode = EFI_IFR_DEFAULT_OP;
|
||||||
|
@ -820,7 +832,6 @@ F2UCreateNumericOpCode (
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
Status = UCreateEndOfOpcode (UefiData);
|
Status = UCreateEndOfOpcode (UefiData);
|
||||||
}
|
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -1037,6 +1048,11 @@ FwUpdateDataToUefiUpdateData (
|
||||||
DataCount = 1;
|
DataCount = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case FRAMEWORK_EFI_IFR_NUMERIC_OP:
|
||||||
|
Status = F2UCreateNumericOpCode (ThunkContext, VarStoreId, (FRAMEWORK_EFI_IFR_NUMERIC *) FwOpCode, UefiOpCode);
|
||||||
|
DataCount = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
|
|
|
@ -248,6 +248,7 @@ FindStringPackAndUpdatePackListWithOnlyIfrPack (
|
||||||
//
|
//
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
UefiRegisterPackageList(
|
UefiRegisterPackageList(
|
||||||
|
IN EFI_HII_PROTOCOL *This,
|
||||||
IN HII_THUNK_PRIVATE_DATA *Private,
|
IN HII_THUNK_PRIVATE_DATA *Private,
|
||||||
IN EFI_HII_PACKAGES *Packages,
|
IN EFI_HII_PACKAGES *Packages,
|
||||||
OUT FRAMEWORK_EFI_HII_HANDLE *Handle
|
OUT FRAMEWORK_EFI_HII_HANDLE *Handle
|
||||||
|
@ -273,12 +274,6 @@ UefiRegisterPackageList(
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
ThunkContext = CreateThunkContext (Private, StringPackageCount, IfrPackageCount);
|
|
||||||
if (ThunkContext == NULL) {
|
|
||||||
return EFI_OUT_OF_RESOURCES;
|
|
||||||
}
|
|
||||||
ThunkContext->ByFrameworkHiiNewPack = TRUE;
|
|
||||||
|
|
||||||
if (Packages->GuidId == NULL) {
|
if (Packages->GuidId == NULL) {
|
||||||
//
|
//
|
||||||
// UEFI HII Database require Package List GUID must be unique.
|
// UEFI HII Database require Package List GUID must be unique.
|
||||||
|
@ -291,9 +286,24 @@ UefiRegisterPackageList(
|
||||||
ASSERT (StringPackageCount >=1 && IfrPackageCount == 1);
|
ASSERT (StringPackageCount >=1 && IfrPackageCount == 1);
|
||||||
GenerateRandomGuid (&GuidId);
|
GenerateRandomGuid (&GuidId);
|
||||||
} else {
|
} else {
|
||||||
|
ThunkContext = TagGuidToIfrPackThunkContext (Private, Packages->GuidId);
|
||||||
|
|
||||||
|
if (IfrPackageCount > 0 &&
|
||||||
|
StringPackageCount > 0 &&
|
||||||
|
(ThunkContext!= NULL)) {
|
||||||
|
DEBUG((EFI_D_WARN, "Framework code registers HII package list with the same GUID more than once.\n"));
|
||||||
|
DEBUG((EFI_D_WARN, "This package list should be already registered. Just return successfully.\n"));
|
||||||
|
HiiRemovePack (This, ThunkContext->FwHiiHandle);
|
||||||
|
}
|
||||||
CopyGuid (&GuidId, Packages->GuidId);
|
CopyGuid (&GuidId, Packages->GuidId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ThunkContext = CreateThunkContext (Private, StringPackageCount, IfrPackageCount);
|
||||||
|
if (ThunkContext == NULL) {
|
||||||
|
return EFI_OUT_OF_RESOURCES;
|
||||||
|
}
|
||||||
|
ThunkContext->ByFrameworkHiiNewPack = TRUE;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Record the Package List GUID, it is used as a name for the package list by Framework HII.
|
// Record the Package List GUID, it is used as a name for the package list by Framework HII.
|
||||||
//
|
//
|
||||||
|
@ -426,6 +436,7 @@ Returns:
|
||||||
Private = HII_THUNK_PRIVATE_DATA_FROM_THIS(This);
|
Private = HII_THUNK_PRIVATE_DATA_FROM_THIS(This);
|
||||||
|
|
||||||
Status = UefiRegisterPackageList (
|
Status = UefiRegisterPackageList (
|
||||||
|
This,
|
||||||
Private,
|
Private,
|
||||||
Packages,
|
Packages,
|
||||||
Handle
|
Handle
|
||||||
|
@ -479,7 +490,6 @@ Returns:
|
||||||
UninstallDefaultConfigAccessProtocol (ThunkContext);
|
UninstallDefaultConfigAccessProtocol (ThunkContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveEntryList (&ThunkContext->Link);
|
|
||||||
DestroyThunkContext (ThunkContext);
|
DestroyThunkContext (ThunkContext);
|
||||||
}else {
|
}else {
|
||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
|
|
|
@ -129,6 +129,7 @@ Returns:
|
||||||
EFI_STRING_ID StringId;
|
EFI_STRING_ID StringId;
|
||||||
EFI_STRING_ID LastStringId;
|
EFI_STRING_ID LastStringId;
|
||||||
CHAR8 AsciiLanguage[ISO_639_2_ENTRY_SIZE + 1];
|
CHAR8 AsciiLanguage[ISO_639_2_ENTRY_SIZE + 1];
|
||||||
|
CHAR16 LanguageCopy[ISO_639_2_ENTRY_SIZE + 1];
|
||||||
BOOLEAN Found;
|
BOOLEAN Found;
|
||||||
CHAR8 *Rfc3066AsciiLanguage;
|
CHAR8 *Rfc3066AsciiLanguage;
|
||||||
|
|
||||||
|
@ -144,8 +145,9 @@ Returns:
|
||||||
|
|
||||||
if (Language != NULL) {
|
if (Language != NULL) {
|
||||||
ZeroMem (AsciiLanguage, sizeof (AsciiLanguage));;
|
ZeroMem (AsciiLanguage, sizeof (AsciiLanguage));;
|
||||||
|
ZeroMem (LanguageCopy, sizeof (LanguageCopy));
|
||||||
UnicodeStrToAsciiStr (Language, AsciiLanguage);
|
CopyMem (LanguageCopy, Language, ISO_639_2_ENTRY_SIZE * sizeof (CHAR16));
|
||||||
|
UnicodeStrToAsciiStr (LanguageCopy, AsciiLanguage);
|
||||||
Rfc3066AsciiLanguage = ConvertIso639ToRfc3066 (AsciiLanguage);
|
Rfc3066AsciiLanguage = ConvertIso639ToRfc3066 (AsciiLanguage);
|
||||||
ASSERT (Rfc3066AsciiLanguage != NULL);
|
ASSERT (Rfc3066AsciiLanguage != NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,8 +90,8 @@ UefiHiiHandleToThunkContext (
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
EFI_HII_HANDLE *
|
HII_THUNK_CONTEXT *
|
||||||
TagGuidToUefiHiiHandle (
|
TagGuidToIfrPackThunkContext (
|
||||||
IN CONST HII_THUNK_PRIVATE_DATA *Private,
|
IN CONST HII_THUNK_PRIVATE_DATA *Private,
|
||||||
IN CONST EFI_GUID *Guid
|
IN CONST EFI_GUID *Guid
|
||||||
)
|
)
|
||||||
|
@ -104,8 +104,8 @@ TagGuidToUefiHiiHandle (
|
||||||
while (!IsNull (&Private->ThunkContextListHead, Link)) {
|
while (!IsNull (&Private->ThunkContextListHead, Link)) {
|
||||||
ThunkContext = HII_THUNK_CONTEXT_FROM_LINK (Link);
|
ThunkContext = HII_THUNK_CONTEXT_FROM_LINK (Link);
|
||||||
|
|
||||||
if (CompareMem (Guid, &ThunkContext->TagGuid, sizeof (EFI_GUID) == 0) && (ThunkContext->IfrPackageCount != 0)) {
|
if (CompareGuid (Guid, &ThunkContext->TagGuid) && (ThunkContext->IfrPackageCount != 0)) {
|
||||||
return ThunkContext->UefiHiiHandle;
|
return ThunkContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
Link = GetNextNode (&Private->ThunkContextListHead, Link);
|
Link = GetNextNode (&Private->ThunkContextListHead, Link);
|
||||||
|
|
|
@ -45,8 +45,8 @@ UefiHiiHandleToThunkContext (
|
||||||
IN EFI_HII_HANDLE UefiHiiHandle
|
IN EFI_HII_HANDLE UefiHiiHandle
|
||||||
);
|
);
|
||||||
|
|
||||||
EFI_HII_HANDLE *
|
HII_THUNK_CONTEXT *
|
||||||
TagGuidToUefiHiiHandle (
|
TagGuidToIfrPackThunkContext (
|
||||||
IN CONST HII_THUNK_PRIVATE_DATA *Private,
|
IN CONST HII_THUNK_PRIVATE_DATA *Private,
|
||||||
IN CONST EFI_GUID *Guid
|
IN CONST EFI_GUID *Guid
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue