]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/PlatformBootManagerLib: sync Timeout with PcdPlatformBootTimeOut
authorLaszlo Ersek <lersek@redhat.com>
Wed, 4 Mar 2020 09:44:12 +0000 (10:44 +0100)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Thu, 5 Mar 2020 08:55:21 +0000 (08:55 +0000)
Set the Timeout global variable to the same value as
PcdPlatformBootTimeOut. This way the "setvar" command in the UEFI shell,
and the "efibootmgr" command in a Linux guest, can report the front page
timeout that was requested on the QEMU command line (see
GetFrontPageTimeoutFromQemu()).

A DEBUG_VERBOSE message is logged on success too, for our QE team's sake.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20200304094413.19462-2-lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf

index 8af9b71f18a3df4e0bf5dd2ebf3678fbc515698e..45d0ee9cc3a8df517f9f4c5f5051b95f4019de2a 100644 (file)
@@ -353,6 +353,7 @@ PlatformBootManagerBeforeConsole (
 {\r
   EFI_HANDLE    Handle;\r
   EFI_STATUS    Status;\r
 {\r
   EFI_HANDLE    Handle;\r
   EFI_STATUS    Status;\r
+  UINT16        FrontPageTimeout;\r
   RETURN_STATUS PcdStatus;\r
 \r
   DEBUG ((EFI_D_INFO, "PlatformBootManagerBeforeConsole\n"));\r
   RETURN_STATUS PcdStatus;\r
 \r
   DEBUG ((EFI_D_INFO, "PlatformBootManagerBeforeConsole\n"));\r
@@ -400,9 +401,30 @@ PlatformBootManagerBeforeConsole (
 \r
   PlatformInitializeConsole (\r
     XenDetected() ? gXenPlatformConsole : gPlatformConsole);\r
 \r
   PlatformInitializeConsole (\r
     XenDetected() ? gXenPlatformConsole : gPlatformConsole);\r
-  PcdStatus = PcdSet16S (PcdPlatformBootTimeOut,\r
-                GetFrontPageTimeoutFromQemu ());\r
+\r
+  FrontPageTimeout = GetFrontPageTimeoutFromQemu ();\r
+  PcdStatus = PcdSet16S (PcdPlatformBootTimeOut, FrontPageTimeout);\r
   ASSERT_RETURN_ERROR (PcdStatus);\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
   PlatformRegisterOptionsAndKeys ();\r
 \r
 \r
   PlatformRegisterOptionsAndKeys ();\r
 \r
index f89cce187942b07c9c7cec8ee4ce36f1993c9724..c479f113b92b2b852e156d579a1eb6f3288ad76b 100644 (file)
@@ -38,6 +38,7 @@
   BaseLib\r
   MemoryAllocationLib\r
   UefiBootServicesTableLib\r
   BaseLib\r
   MemoryAllocationLib\r
   UefiBootServicesTableLib\r
+  UefiRuntimeServicesTableLib\r
   BaseMemoryLib\r
   DebugLib\r
   PcdLib\r
   BaseMemoryLib\r
   DebugLib\r
   PcdLib\r
@@ -79,5 +80,6 @@
 \r
 [Guids]\r
   gEfiEndOfDxeEventGroupGuid\r
 \r
 [Guids]\r
   gEfiEndOfDxeEventGroupGuid\r
+  gEfiGlobalVariableGuid\r
   gRootBridgesConnectedEventGroupGuid\r
   gUefiShellFileGuid\r
   gRootBridgesConnectedEventGroupGuid\r
   gUefiShellFileGuid\r