From: Pete Batard Date: Mon, 14 Oct 2019 15:03:10 +0000 (+0100) Subject: OvmfPkg/PlatformBootManagerLib: Don't update progress if Pcd is 0 X-Git-Tag: edk2-stable201911~156 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=c3c90d8aa7e6c43e8564cb44dc8f73d0565ad122 OvmfPkg/PlatformBootManagerLib: Don't update progress if Pcd is 0 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 Reviewed-by: Laszlo Ersek Reviewed-by: Philippe Mathieu-Daude Message-Id: <20191014150311.16740-2-pete@akeo.ie> --- diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c index 70df6b841a..8af9b71f18 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c +++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c @@ -1631,9 +1631,18 @@ 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 +1652,7 @@ PlatformBootManagerWaitCallback ( Black.Pixel, L"Start boot option", White.Pixel, - (Timeout - TimeoutRemain) * 100 / Timeout, + (TimeoutInitial - TimeoutRemain) * 100 / TimeoutInitial, 0 ); }