From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.120]) by mx.groups.io with SMTP id smtpd.web11.6142.1592483192460189732 for ; Thu, 18 Jun 2020 05:26:32 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iGH5dw7g; spf=pass (domain: redhat.com, ip: 207.211.31.120, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592483191; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uRc1yZQ5SRhl6vTpemcCVWAvtr0FmspR0YFjJVNTBVg=; b=iGH5dw7gJXzpc1cFB2j1dgRdUVGTfGIwvxsgwLZWSS+83nPTLFFnV9Yf1FQ2jLLVLtLyDe 4C96ZjFYit2Iz0gVv1OJYXotieNPyDitS13qMwfi32PZChDR1tUAbVceZQnjM4jj8HimpJ KJJR6sLsKPpXhb1nCaenhkSn5GZ2tuA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-133-BuTaOYExNSaUctyIEfnCyw-1; Thu, 18 Jun 2020 08:22:41 -0400 X-MC-Unique: BuTaOYExNSaUctyIEfnCyw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 77324107ACCD; Thu, 18 Jun 2020 12:22:40 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-60.ams2.redhat.com [10.36.113.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3297A6ED96; Thu, 18 Jun 2020 12:22:38 +0000 (UTC) Subject: Re: [edk2-devel] [patch] MdeModulePkg/DisplayEngine: Add Debug message to show mismatch menu info To: devel@edk2.groups.io, dandan.bi@intel.com Cc: Liming Gao , Eric Dong References: <20200618032410.106828-1-dandan.bi@intel.com> From: "Laszlo Ersek" Message-ID: <76e0f855-3449-9b48-b566-c5501dd6e7fe@redhat.com> Date: Thu, 18 Jun 2020 14:22:38 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20200618032410.106828-1-dandan.bi@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 06/18/20 05:24, 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 > Signed-off-by: Dandan Bi > --- > .../DisplayEngineDxe/ProcessOptions.c | 78 +++++++++++++++++++ > 1 file changed, 78 insertions(+) > > diff --git a/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c b/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c > index e7306f6d04..4331b2903c 100644 > --- a/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c > +++ b/MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c > @@ -911,10 +911,73 @@ 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 *OneOfOptionStr; > + CHAR16 *QuestionName; > + LIST_ENTRY *Link; > + FORM_DISPLAY_ENGINE_STATEMENT *Question; > + EFI_IFR_ORDERED_LIST *OrderList; > + UINTN Index; > + EFI_HII_VALUE HiiValue; > + EFI_HII_VALUE *QuestionValue; > + DISPLAY_QUESTION_OPTION *Option; > + UINT8 *ValueArray; > + UINT8 ValueType; > + > + Question = MenuOption->ThisTag; > + FormTitleStr = GetToken (gFormData->FormTitle, gFormData->HiiHandle); > + > + DEBUG ((DEBUG_ERROR, "\n[DisplayEngine]: Mismatch Formset : Formset Guid = %g.\n", &gFormData->FormSetGuid)); I suggest replacing the open-coded "[DisplayEngine]" strings in this patch with "[%a]", and passing gEfiCallerBaseName. This will make no difference in practice (given "BASE_NAME = DisplayEngine" in "DisplayEngineDxe.inf"), but it's a better pattern -- the resultant debug strings are less verbose, and they'd update themselves if we ever changed BASE_NAME. No other comments from me. Thanks, Laszlo > + DEBUG ((DEBUG_ERROR, "[DisplayEngine]: Mismatch Form : FormId = %d, Form title = %s.\n", 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, "[DisplayEngine]: Mismatch OrderedList: Name = %s.\n", QuestionName)); > + DEBUG ((DEBUG_ERROR, "[DisplayEngine]: Mismatch OrderedList: Value Arrary:\n")); > + > + 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] =%d.\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, "[DisplayEngine]: Mismatch OneOf : Named = %s.\n", QuestionName)); > + DEBUG ((DEBUG_ERROR, "[DisplayEngine]: Mismatch OneOf : Current value = %d.\n",QuestionValue->Value.u8)); > + } > + > + Index = 0; > + Link = GetFirstNode (&Question->OptionListHead); > + while (!IsNull (&Question->OptionListHead, Link)) { > + Option = DISPLAY_QUESTION_OPTION_FROM_LINK (Link); > + OneOfOptionStr = GetToken (Option->OptionOpCode->Option, gFormData->HiiHandle); > + DEBUG ((DEBUG_ERROR, "[DisplayEngine]: Option %d : Option Name = %s. Option Value = %d.\n",Index,OneOfOptionStr,Option->OptionOpCode->Value.u8)); > + Link = GetNextNode (&Question->OptionListHead, Link); > + Index++; > + } > +} > + > /** > Process a Question's Option (whether selected or un-selected). > > @param MenuOption The MenuOption for this Question. > @param Selected TRUE: if Question is selected. > @@ -1010,10 +1073,15 @@ ProcessOptions ( > break; > } > > OneOfOption = ValueToOption (Question, &HiiValue); > if (OneOfOption == NULL) { > + // > + // Print debug msg for the mistach menu. > + // > + PrintMismatchMenuInfo (MenuOption); > + > if (SkipErrorValue) { > // > // Just try to get the option string, skip the value which not has option. > // > continue; > @@ -1102,10 +1170,15 @@ ProcessOptions ( > continue; > } > > if (!ValueInvalid) { > ValueInvalid = TRUE; > + // > + // Print debug msg for the mistach menu. > + // > + PrintMismatchMenuInfo (MenuOption); > + > // > // Show error message > // > do { > CreateDialog (&Key, gEmptyString, gOptionMismatch, gPressEnter, gEmptyString, NULL); > @@ -1152,10 +1225,15 @@ ProcessOptions ( > *OptionString = AllocateZeroPool (BufferSize); > ASSERT (*OptionString); > > OneOfOption = ValueToOption (Question, QuestionValue); > if (OneOfOption == NULL) { > + // > + // Print debug msg for the mistach menu. > + // > + PrintMismatchMenuInfo (MenuOption); > + > if (SkipErrorValue) { > // > // Not report error, just get the correct option string info. > // > Link = GetFirstNode (&Question->OptionListHead); >