]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
ArmVirtPkg/PlatformBootManagerLib: sync Timeout with PcdPlatformBootTimeOut
[mirror_edk2.git] / ArmVirtPkg / Library / PlatformBootManagerLib / PlatformBm.c
index 30c015eec5b0ad86af7bec93636f4d04c8551148..69448ff65bde5bd98d970965d824c9f14a3c6161 100644 (file)
@@ -25,6 +25,7 @@
 #include <Protocol/PciRootBridgeIo.h>\r
 #include <Protocol/VirtioDevice.h>\r
 #include <Guid/EventGroup.h>\r
+#include <Guid/GlobalVariable.h>\r
 #include <Guid/RootBridgesConnectedEventGroup.h>\r
 #include <Guid/SerialPortLibVendor.h>\r
 \r
@@ -686,7 +687,9 @@ PlatformBootManagerBeforeConsole (
   VOID\r
   )\r
 {\r
+  UINT16        FrontPageTimeout;\r
   RETURN_STATUS PcdStatus;\r
+  EFI_STATUS    Status;\r
 \r
   //\r
   // Signal EndOfDxe PI Event\r
@@ -744,9 +747,29 @@ PlatformBootManagerBeforeConsole (
   //\r
   // Set the front page timeout from the QEMU configuration.\r
   //\r
-  PcdStatus = PcdSet16S (PcdPlatformBootTimeOut,\r
-                GetFrontPageTimeoutFromQemu ());\r
+  FrontPageTimeout = GetFrontPageTimeoutFromQemu ();\r
+  PcdStatus = PcdSet16S (PcdPlatformBootTimeOut, FrontPageTimeout);\r
   ASSERT_RETURN_ERROR (PcdStatus);\r
+  //\r
+  // Reflect the PCD in the standard Timeout variable.\r
+  //\r
+  Status = gRT->SetVariable (\r
+                  EFI_TIME_OUT_VARIABLE_NAME,\r
+                  &gEfiGlobalVariableGuid,\r
+                  (EFI_VARIABLE_NON_VOLATILE |\r
+                   EFI_VARIABLE_BOOTSERVICE_ACCESS |\r
+                   EFI_VARIABLE_RUNTIME_ACCESS),\r
+                  sizeof FrontPageTimeout,\r
+                  &FrontPageTimeout\r
+                  );\r
+  DEBUG ((\r
+    EFI_ERROR (Status) ? DEBUG_ERROR : DEBUG_VERBOSE,\r
+    "%a: SetVariable(%s, %u): %r\n",\r
+    __FUNCTION__,\r
+    EFI_TIME_OUT_VARIABLE_NAME,\r
+    FrontPageTimeout,\r
+    Status\r
+    ));\r
 \r
   //\r
   // Register platform-specific boot options and keyboard shortcuts.\r
@@ -842,9 +865,17 @@ 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
+  TimeoutInitial = PcdGet16 (PcdPlatformBootTimeOut);\r
 \r
-  Timeout = PcdGet16 (PcdPlatformBootTimeOut);\r
+  //\r
+  // If PcdPlatformBootTimeOut is set to zero, then we consider\r
+  // that no progress update should be enacted.\r
+  //\r
+  if (TimeoutInitial == 0) {\r
+    return;\r
+  }\r
 \r
   Black.Raw = 0x00000000;\r
   White.Raw = 0x00FFFFFF;\r
@@ -854,7 +885,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