[edk2-devel] [patch V2] MdeModulePkg/DisplayEngine: Add Debug message to show mismatch menu info
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2326 Currently when meet mismatch case for one-of and ordered-list menu, just show a popup window to indicate mismatch, no more info for debugging. This patch is to add more debug message about mismatch menu info which is helpful to debug. Cc: Liming Gao Cc: Eric Dong Cc: Laszlo Ersek Signed-off-by: Dandan Bi --- v2: 1) Refine debug message info. 2) Use gEfiCallerBaseName.to replace hard code "DisplayEngine" 3) Handle question and option value based on value type. .../DisplayEngineDxe/ProcessOptions.c | 125 ++ 1 file changed, 125 insertions(+) diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c b/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c index e7306f6d04..c02e36a63a 100644 --- a/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c +++ b/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c @@ -911,10 +911,120 @@ PasswordProcess ( FreePool (StringPtr); return Status; } +/** + Print some debug message about mismatched menu info. + + @param MenuOption The MenuOption for this Question. + +**/ +VOID +PrintMismatchMenuInfo ( + IN UI_MENU_OPTION *MenuOption +) +{ + CHAR16 *FormTitleStr; + CHAR16 *FormSetTitleStr; + CHAR16 *OneOfOptionStr; + CHAR16 *QuestionName; + LIST_ENTRY *Link; + FORM_DISPLAY_ENGINE_STATEMENT *Question; + EFI_IFR_ORDERED_LIST*OrderList; + UINT8 Index; + EFI_HII_VALUE HiiValue; + EFI_HII_VALUE *QuestionValue; + DISPLAY_QUESTION_OPTION *Option; + UINT8 *ValueArray; + UINT8 ValueType; + EFI_IFR_FORM_SET*FormsetBuffer; + UINTN FormsetBufferSize; + + Question = MenuOption->ThisTag; + HiiGetFormSetFromHiiHandle (gFormData->HiiHandle, &FormsetBuffer, &FormsetBufferSize); + + FormSetTitleStr = GetToken (FormsetBuffer->FormSetTitle, gFormData->HiiHandle); + FormTitleStr = GetToken (gFormData->FormTitle, gFormData->HiiHandle); + + DEBUG ((DEBUG_ERROR, "\n[%a]: Mismatch Formset: Formset Guid = %g, FormSet title = %s\n", gEfiCallerBaseName, &gFormData->FormSetGuid, FormSetTitleStr)); + DEBUG ((DEBUG_ERROR, "[%a]: Mismatch Form : FormId = %d, Form title = %s.\n", gEfiCallerBaseName, gFormData->FormId, FormTitleStr)); + + if (Question->OpCode->OpCode == EFI_IFR_ORDERED_LIST_OP) { +QuestionName = GetToken (((EFI_IFR_ORDERED_LIST*)MenuOption->ThisTag->OpCode)->Question.Header.Prompt, gFormData->HiiHandle); +Link = GetFirstNode (&Question->OptionListHead); +Option = DISPLAY_QUESTION_OPTION_FROM_LINK (Link); +ValueType = Option->OptionOpCode->Type; +DEBUG ((DEBUG_ERROR, "[%a]: Mismatch Error : OrderedList value in the array doesn't match with option value.\n", gEfiCallerBaseName)); +DEBUG ((DEBUG_ERROR, "[%a]: Mismatch OrderedList: Name = %s.\n", gEfiCallerBaseName, QuestionName)); +DEBUG ((DEBUG_ERROR, "[%a]: Mismatch OrderedList: OrderedList array value :\n", gEfiCallerBaseName)); + +OrderList = (EFI_IFR_ORDERED_LIST *) Question->OpCode; +for (Index = 0; Index < OrderList->MaxContainers; Index++) { + ValueArray = Question->CurrentValue.Buffer; + HiiValue.Value.u64 = GetArrayData (ValueArray, ValueType, Index); + DEBUG ((DEBUG_ERROR, " Value[%d] =%ld.\n", Index, HiiValue.Value.u64)); +} + } else if (Question->OpCode->OpCode == EFI_IFR_ONE_OF_OP) { +QuestionName = GetToken (((EFI_IFR_ONE_OF*)MenuOption->ThisTag->OpCode)->Question.Header.Prompt, gFormData->HiiHandle); +QuestionValue = &Question->CurrentValue; +DEBUG ((DEBUG_ERROR, "[%a]: Mismatch Error : OneOf value doesn't match with option value.\n", gEfiCallerBaseName)); +DEBUG ((DEBUG_ERROR, "[%a]: Mismatch OneOf : Name = %s.\n", gEfiCallerBaseName, QuestionName)); +switch (QuestionValue->Type) { + case EFI_IFR_TYPE_NUM_SIZE_64: +DEBUG ((DEBUG_ERROR, "[%a]: Mismatch OneOf : OneOf value = %ld.\n",gEfiCallerBaseName, QuestionValue->Value.u64)); +break; + + case EFI_IFR_TYPE_NUM_SIZE_32: +DEBUG ((DEBUG_ERROR, "[%a]: Mismatch OneOf : OneOf value = %d.\n",gEfiCallerBaseName, QuestionValue->Value.u32)); +break; + + case EFI_IFR_TYPE_NUM_SIZE_16: +DEBUG ((DEBUG_ERROR, "[%a]: Mismatch OneOf : OneOf value = %d.\n",gEfiCallerBaseName, QuestionValue->Value.u16)); +break; + + case EFI_IFR_TYPE_NUM_SIZE_8: +DEBUG ((DEBUG_ERROR, "[%a]: Mismatch OneOf : OneOf value = %d.\n",gEfiCallerBaseName, QuestionValue->Value.u8)); +break; + + default: +ASSERT (FALSE); +break; +} + } + + Index = 0; + Link = GetFirstNo
Re: [edk2-devel] [patch V2] MdeModulePkg/DisplayEngine: Add Debug message to show mismatch menu info
On 06/28/20 04:16, Dandan Bi wrote: > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2326 > > Currently when meet mismatch case for one-of and ordered-list > menu, just show a popup window to indicate mismatch, no more > info for debugging. This patch is to add more debug message > about mismatch menu info which is helpful to debug. > > Cc: Liming Gao > Cc: Eric Dong > Cc: Laszlo Ersek > Signed-off-by: Dandan Bi > --- > v2: > 1) Refine debug message info. > 2) Use gEfiCallerBaseName.to replace hard code "DisplayEngine" Thanks for the update, I have no more comments! Laszlo > 3) Handle question and option value based on value type. > > .../DisplayEngineDxe/ProcessOptions.c | 125 ++ > 1 file changed, 125 insertions(+) > > diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c > b/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c > index e7306f6d04..c02e36a63a 100644 > --- a/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c > +++ b/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c > @@ -911,10 +911,120 @@ PasswordProcess ( >FreePool (StringPtr); > >return Status; > } > > +/** > + Print some debug message about mismatched menu info. > + > + @param MenuOption The MenuOption for this Question. > + > +**/ > +VOID > +PrintMismatchMenuInfo ( > + IN UI_MENU_OPTION *MenuOption > +) > +{ > + CHAR16 *FormTitleStr; > + CHAR16 *FormSetTitleStr; > + CHAR16 *OneOfOptionStr; > + CHAR16 *QuestionName; > + LIST_ENTRY *Link; > + FORM_DISPLAY_ENGINE_STATEMENT *Question; > + EFI_IFR_ORDERED_LIST*OrderList; > + UINT8 Index; > + EFI_HII_VALUE HiiValue; > + EFI_HII_VALUE *QuestionValue; > + DISPLAY_QUESTION_OPTION *Option; > + UINT8 *ValueArray; > + UINT8 ValueType; > + EFI_IFR_FORM_SET*FormsetBuffer; > + UINTN FormsetBufferSize; > + > + Question = MenuOption->ThisTag; > + HiiGetFormSetFromHiiHandle (gFormData->HiiHandle, &FormsetBuffer, > &FormsetBufferSize); > + > + FormSetTitleStr = GetToken (FormsetBuffer->FormSetTitle, > gFormData->HiiHandle); > + FormTitleStr = GetToken (gFormData->FormTitle, gFormData->HiiHandle); > + > + DEBUG ((DEBUG_ERROR, "\n[%a]: Mismatch Formset: Formset Guid = %g, > FormSet title = %s\n", gEfiCallerBaseName, &gFormData->FormSetGuid, > FormSetTitleStr)); > + DEBUG ((DEBUG_ERROR, "[%a]: Mismatch Form : FormId = %d, Form title > = %s.\n", gEfiCallerBaseName, gFormData->FormId, FormTitleStr)); > + > + if (Question->OpCode->OpCode == EFI_IFR_ORDERED_LIST_OP) { > +QuestionName = GetToken > (((EFI_IFR_ORDERED_LIST*)MenuOption->ThisTag->OpCode)->Question.Header.Prompt, > gFormData->HiiHandle); > +Link = GetFirstNode (&Question->OptionListHead); > +Option = DISPLAY_QUESTION_OPTION_FROM_LINK (Link); > +ValueType = Option->OptionOpCode->Type; > +DEBUG ((DEBUG_ERROR, "[%a]: Mismatch Error : OrderedList value in > the array doesn't match with option value.\n", gEfiCallerBaseName)); > +DEBUG ((DEBUG_ERROR, "[%a]: Mismatch OrderedList: Name = %s.\n", > gEfiCallerBaseName, QuestionName)); > +DEBUG ((DEBUG_ERROR, "[%a]: Mismatch OrderedList: OrderedList array > value :\n", gEfiCallerBaseName)); > + > +OrderList = (EFI_IFR_ORDERED_LIST *) Question->OpCode; > +for (Index = 0; Index < OrderList->MaxContainers; Index++) { > + ValueArray = Question->CurrentValue.Buffer; > + HiiValue.Value.u64 = GetArrayData (ValueArray, ValueType, Index); > + DEBUG ((DEBUG_ERROR, " Value[%d] > =%ld.\n", Index, HiiValue.Value.u64)); > +} > + } else if (Question->OpCode->OpCode == EFI_IFR_ONE_OF_OP) { > +QuestionName = GetToken > (((EFI_IFR_ONE_OF*)MenuOption->ThisTag->OpCode)->Question.Header.Prompt, > gFormData->HiiHandle); > +QuestionValue = &Question->CurrentValue; > +DEBUG ((DEBUG_ERROR, "[%a]: Mismatch Error : OneOf value doesn't > match with option value.\n", gEfiCallerBaseName)); > +DEBUG ((DEBUG_ERROR, "[%a]: Mismatch OneOf : Name = %s.\n", > gEfiCallerBaseName, QuestionName)); > +switch (QuestionValue->Type) { > + case EFI_IFR_TYPE_NUM_SIZE_64: > +DEBUG ((DEBUG_ERROR, "[%a]: Mismatch OneOf : OneOf value = > %ld.\n",gEfiCallerBaseName, QuestionValue->Value.u64)); > +break; > + > + case EFI_IFR_TYPE_NUM_SIZE_32: > +DEBUG ((DEBUG_ERROR, "[%a]: Mismatch OneOf : OneOf value = > %d.\n",gEfiCallerBaseName, QuestionValue->Value.u32)); > +break; > + > + case EFI_IFR_TYPE_NUM_SIZE_16: > +DEBUG ((DEBUG_ERROR, "[%a]: Mismatch OneOf : OneOf value = > %d.\n",gEfiCallerBaseName, QuestionV
Re: [edk2-devel] [patch V2] MdeModulePkg/DisplayEngine: Add Debug message to show mismatch menu info
Reviewed-by: Eric Dong > -Original Message- > From: Bi, Dandan > Sent: Sunday, June 28, 2020 10:17 AM > To: devel@edk2.groups.io > Cc: Gao, Liming ; Dong, Eric ; > Laszlo Ersek > Subject: [patch V2] MdeModulePkg/DisplayEngine: Add Debug message to > show mismatch menu info > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2326 > > Currently when meet mismatch case for one-of and ordered-list menu, just > show a popup window to indicate mismatch, no more info for debugging. > This patch is to add more debug message about mismatch menu info which is > helpful to debug. > > Cc: Liming Gao > Cc: Eric Dong > Cc: Laszlo Ersek > Signed-off-by: Dandan Bi > --- > v2: > 1) Refine debug message info. > 2) Use gEfiCallerBaseName.to replace hard code "DisplayEngine" > 3) Handle question and option value based on value type. > > .../DisplayEngineDxe/ProcessOptions.c | 125 ++ > 1 file changed, 125 insertions(+) > > diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c > b/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c > index e7306f6d04..c02e36a63a 100644 > --- a/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c > +++ b/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c > @@ -911,10 +911,120 @@ PasswordProcess ( >FreePool (StringPtr); > >return Status; > } > > +/** > + Print some debug message about mismatched menu info. > + > + @param MenuOption The MenuOption for this Question. > + > +**/ > +VOID > +PrintMismatchMenuInfo ( > + IN UI_MENU_OPTION *MenuOption > +) > +{ > + CHAR16 *FormTitleStr; > + CHAR16 *FormSetTitleStr; > + CHAR16 *OneOfOptionStr; > + CHAR16 *QuestionName; > + LIST_ENTRY *Link; > + FORM_DISPLAY_ENGINE_STATEMENT *Question; > + EFI_IFR_ORDERED_LIST*OrderList; > + UINT8 Index; > + EFI_HII_VALUE HiiValue; > + EFI_HII_VALUE *QuestionValue; > + DISPLAY_QUESTION_OPTION *Option; > + UINT8 *ValueArray; > + UINT8 ValueType; > + EFI_IFR_FORM_SET*FormsetBuffer; > + UINTN FormsetBufferSize; > + > + Question = MenuOption->ThisTag; > + HiiGetFormSetFromHiiHandle (gFormData->HiiHandle, &FormsetBuffer, > + &FormsetBufferSize); > + > + FormSetTitleStr = GetToken (FormsetBuffer->FormSetTitle, > + gFormData->HiiHandle); FormTitleStr = GetToken (gFormData->FormTitle, > + gFormData->HiiHandle); > + > + DEBUG ((DEBUG_ERROR, "\n[%a]: Mismatch Formset: Formset Guid > = %g, FormSet title = %s\n", gEfiCallerBaseName, &gFormData- > >FormSetGuid, FormSetTitleStr)); > + DEBUG ((DEBUG_ERROR, "[%a]: Mismatch Form : FormId = %d, Form > title = %s.\n", gEfiCallerBaseName, gFormData->FormId, FormTitleStr)); > + > + if (Question->OpCode->OpCode == EFI_IFR_ORDERED_LIST_OP) { > +QuestionName = GetToken (((EFI_IFR_ORDERED_LIST*)MenuOption- > >ThisTag->OpCode)->Question.Header.Prompt, gFormData->HiiHandle); > +Link = GetFirstNode (&Question->OptionListHead); > +Option = DISPLAY_QUESTION_OPTION_FROM_LINK (Link); > +ValueType = Option->OptionOpCode->Type; > +DEBUG ((DEBUG_ERROR, "[%a]: Mismatch Error : OrderedList value in > the array doesn't match with option value.\n", gEfiCallerBaseName)); > +DEBUG ((DEBUG_ERROR, "[%a]: Mismatch OrderedList: Name = %s.\n", > gEfiCallerBaseName, QuestionName)); > +DEBUG ((DEBUG_ERROR, "[%a]: Mismatch OrderedList: OrderedList array > + value :\n", gEfiCallerBaseName)); > + > +OrderList = (EFI_IFR_ORDERED_LIST *) Question->OpCode; > +for (Index = 0; Index < OrderList->MaxContainers; Index++) { > + ValueArray = Question->CurrentValue.Buffer; > + HiiValue.Value.u64 = GetArrayData (ValueArray, ValueType, Index); > + DEBUG ((DEBUG_ERROR, " Value[%d] > =%ld.\n", Index, > HiiValue.Value.u64)); > +} > + } else if (Question->OpCode->OpCode == EFI_IFR_ONE_OF_OP) { > +QuestionName = GetToken (((EFI_IFR_ONE_OF*)MenuOption->ThisTag- > >OpCode)->Question.Header.Prompt, gFormData->HiiHandle); > +QuestionValue = &Question->CurrentValue; > +DEBUG ((DEBUG_ERROR, "[%a]: Mismatch Error : OneOf value doesn't > match with option value.\n", gEfiCallerBaseName)); > +DEBUG ((DEBUG_ERROR, "[%a]: Mismatch OneOf : Name = %s.\n", > gEfiCallerBaseName, QuestionName)); > +switch (QuestionValue->Type) { > + case EFI_IFR_TYPE_NUM_SIZE_64: > +DEBUG ((DEBUG_ERROR, "[%a]: Mismatch OneOf : OneOf value > = %ld.\n",gEfiCallerBaseName, QuestionValue->Value.u64)); > +break; > + > + case EFI_IFR_TYPE_NUM_SIZE_32: > +DEBUG ((DEBUG_ERROR, "[%a]: Mismatch OneOf : OneOf value > = %d.\n",gEfiCallerBaseName, QuestionValue->Value