From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.groups.io with SMTP id smtpd.web10.3243.1571059800180275996 for ; Mon, 14 Oct 2019 06:30:00 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: redhat.com, ip: 209.132.183.28, mailfrom: lersek@redhat.com) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6D54A30842B0; Mon, 14 Oct 2019 13:29:59 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-117-254.ams2.redhat.com [10.36.117.254]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0EAA11001B03; Mon, 14 Oct 2019 13:29:57 +0000 (UTC) Subject: Re: [PATCH 1/1] OvmfPkg/PlatformBootManagerLib: Don't update progress if Pcd is 0 To: Pete Batard , devel@edk2.groups.io Cc: afish@apple.com, liming.gao@intel.com References: <20191011152451.14740-1-pete@akeo.ie> From: "Laszlo Ersek" Message-ID: <2a535114-ad9c-8050-c280-def2e01c5b6b@redhat.com> Date: Mon, 14 Oct 2019 15:29:54 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20191011152451.14740-1-pete@akeo.ie> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Mon, 14 Oct 2019 13:29:59 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Hi Pete, thanks for the patch. I have two requests: On 10/11/19 17:24, Pete Batard wrote: > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2266 > > Independently of how we decide to address other aspects of the regression > introduced with commit 2de1f611be06ded3a59726a4052a9039be7d459b, it doesn't > make much sense to call for a progress update if PcdPlatformBootTimeOut is > zero. > > PcdPlatformBootTimeOut 0, which is the cause of the bug (division by zero) > should be considered to indicate that a platform is not interested in > displaying a progress report, so we alter PlatformBootManagerWaitCallback > to behave that way. > > We also change one variable name to make the code more explicit. > > Signed-off-by: Pete Batard > --- > OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c > index 70df6b841acc..352163436e10 100644 > --- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c > +++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c > @@ -1631,9 +1631,16 @@ PlatformBootManagerWaitCallback ( > { > EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION Black; > EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION White; > - UINT16 Timeout; > + UINT16 TimeoutInitial; > > - Timeout = PcdGet16 (PcdPlatformBootTimeOut); > + TimeoutInitial = PcdGet16 (PcdPlatformBootTimeOut); > + > + // If PcdPlatformBootTimeOut is set to zero, then we consider > + // that no progress update should be enacted (since we'd only > + // ever display a one-shot progress of either 0% or 100%). > + if (TimeoutInitial == 0) { > + return; > + } (1) Please surround the comment block with empty "//" lines, as follows: // // blah // if (...) { ... } This is more idiomatic, under the edk2 coding style. > > Black.Raw = 0x00000000; > White.Raw = 0x00FFFFFF; > @@ -1643,7 +1650,7 @@ PlatformBootManagerWaitCallback ( > Black.Pixel, > L"Start boot option", > White.Pixel, > - (Timeout - TimeoutRemain) * 100 / Timeout, > + (TimeoutInitial - TimeoutRemain) * 100 / TimeoutInitial, > 0 > ); > } > (2) Can you please post the same patch for "ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c" as well? That would be mean two patches, in a v2 series. With both (1) and (2) covered, you can add Reviewed-by: Laszlo Ersek to both patches at once. Thanks! Laszlo