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.web12.1736.1571046648890506285 for ; Mon, 14 Oct 2019 02:50:49 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: redhat.com, ip: 209.132.183.28, mailfrom: philmd@redhat.com) Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3C3ED81DEB for ; Mon, 14 Oct 2019 09:50:48 +0000 (UTC) Received: by mail-wr1-f70.google.com with SMTP id o10so8248574wrm.22 for ; Mon, 14 Oct 2019 02:50:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=a9W9ROJo5HvROVOC3pXFA8zQPljGQoBjR2okavaQ56k=; b=X9WiYSqWoDep5N45z1/OybL6bF7v9Za5bzRw4s+b1foR5A+Pc/c7AjbEypeQZa/aeI C04odrm90NFC0HbHVkPrBGSxMGUAd0KO6xVszpugogSSSvbissCbYm3ILGkvToxV8Lub mB2BtynA2kmGldGblxvypFlanhRnpgeVcrNjSimJNjY/FmpsvRJp+3sz25+aZp/rcLCz B5l8hbyveL2NGIR0V2KspCwIf02fvP77fHmIvxaVBvHdpYomsqfFDINUy0O0VCahKLwb PtkXCeK7hChOjrn7uDIFdi7Z18jkuUZxUmXaCpXpYL+Q3fzDpRxu9h1mvMJ7n07Vkquw xJsQ== X-Gm-Message-State: APjAAAVNF0Mqygrsn13jQdRozU0CCJS4Opk9h6HfBPoiIFbQ6s7vUFAq yGmVDdKXtM9t1y78NA5Yas7dumQ4BGZwfbfTtNXORhLjXdW/DkRM3wtm8czxPwbuq4QmGbqBzAd lqBlgXFQnX+iA6g== X-Received: by 2002:a5d:6942:: with SMTP id r2mr23917734wrw.363.1571046647018; Mon, 14 Oct 2019 02:50:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqw4w1kqDqu2Ol61vRDZx8T7cuIHArLgXq8a5dyByIH6+3Dgm++IT3OqQw3uTv06nQv4owFvSA== X-Received: by 2002:a5d:6942:: with SMTP id r2mr23917718wrw.363.1571046646824; Mon, 14 Oct 2019 02:50:46 -0700 (PDT) Received: from [192.168.50.32] (243.red-88-26-246.staticip.rima-tde.net. [88.26.246.243]) by smtp.gmail.com with ESMTPSA id a4sm13901835wmm.10.2019.10.14.02.50.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 14 Oct 2019 02:50:46 -0700 (PDT) Subject: Re: [edk2-devel] [PATCH 1/1] OvmfPkg/PlatformBootManagerLib: Don't update progress if Pcd is 0 To: devel@edk2.groups.io, pete@akeo.ie Cc: afish@apple.com, lersek@redhat.com, liming.gao@intel.com References: <20191011152451.14740-1-pete@akeo.ie> From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= Message-ID: <49e3bb35-54a2-46ca-10c8-afd0e665041f@redhat.com> Date: Mon, 14 Oct 2019 11:50:45 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 MIME-Version: 1.0 In-Reply-To: <20191011152451.14740-1-pete@akeo.ie> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit On 10/11/19 5:24 PM, 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; > + } > > 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 > ); > } > Reviewed-by: Philippe Mathieu-Daude