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 2de1f611be, 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 <pete@akeo.ie>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Message-Id: <20191014150311.16740-2-pete@akeo.ie>
This commit is contained in:
Pete Batard 2019-10-14 16:03:10 +01:00 committed by Laszlo Ersek
parent cd70b1a71d
commit c3c90d8aa7
1 changed files with 12 additions and 3 deletions

View File

@ -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
);
}