]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/PlatformBootManagerLib: Don't update progress if Pcd is 0
authorPete Batard <pete@akeo.ie>
Mon, 14 Oct 2019 15:03:10 +0000 (16:03 +0100)
committerLaszlo Ersek <lersek@redhat.com>
Wed, 16 Oct 2019 16:27:37 +0000 (18:27 +0200)
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 <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>

OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c

index 70df6b841accb8177d8d772250c982be799c50e7..8af9b71f18a3df4e0bf5dd2ebf3678fbc515698e 100644 (file)
@@ -1631,9 +1631,18 @@ PlatformBootManagerWaitCallback (
 {\r
   EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION Black;\r
   EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION White;\r
-  UINT16                              Timeout;\r
+  UINT16                              TimeoutInitial;\r
 \r
-  Timeout = PcdGet16 (PcdPlatformBootTimeOut);\r
+  TimeoutInitial = PcdGet16 (PcdPlatformBootTimeOut);\r
+\r
+  //\r
+  // If PcdPlatformBootTimeOut is set to zero, then we consider\r
+  // that no progress update should be enacted (since we'd only\r
+  // ever display a one-shot progress of either 0% or 100%).\r
+  //\r
+  if (TimeoutInitial == 0) {\r
+    return;\r
+  }\r
 \r
   Black.Raw = 0x00000000;\r
   White.Raw = 0x00FFFFFF;\r
@@ -1643,7 +1652,7 @@ PlatformBootManagerWaitCallback (
     Black.Pixel,\r
     L"Start boot option",\r
     White.Pixel,\r
-    (Timeout - TimeoutRemain) * 100 / Timeout,\r
+    (TimeoutInitial - TimeoutRemain) * 100 / TimeoutInitial,\r
     0\r
     );\r
 }\r