summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/Library
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2020-03-04 10:44:12 +0100
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-03-05 08:55:21 +0000
commit9b08c655ff683e7438d13a29b13e550ea70be224 (patch)
tree8d122d57322f4bf9292b455472e271261a4df5eb /OvmfPkg/Library
parent3b9cd714542a8744252d973e1f163222a9f21b9e (diff)
downloadedk2-9b08c655ff683e7438d13a29b13e550ea70be224.tar.gz
edk2-9b08c655ff683e7438d13a29b13e550ea70be224.tar.bz2
edk2-9b08c655ff683e7438d13a29b13e550ea70be224.zip
OvmfPkg/PlatformBootManagerLib: sync Timeout with PcdPlatformBootTimeOut
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>
Diffstat (limited to 'OvmfPkg/Library')
-rw-r--r--OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c26
-rw-r--r--OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf2
2 files changed, 26 insertions, 2 deletions
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index 8af9b71f18..45d0ee9cc3 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -353,6 +353,7 @@ PlatformBootManagerBeforeConsole (
{
EFI_HANDLE Handle;
EFI_STATUS Status;
+ UINT16 FrontPageTimeout;
RETURN_STATUS PcdStatus;
DEBUG ((EFI_D_INFO, "PlatformBootManagerBeforeConsole\n"));
@@ -400,9 +401,30 @@ PlatformBootManagerBeforeConsole (
PlatformInitializeConsole (
XenDetected() ? gXenPlatformConsole : gPlatformConsole);
- PcdStatus = PcdSet16S (PcdPlatformBootTimeOut,
- GetFrontPageTimeoutFromQemu ());
+
+ FrontPageTimeout = GetFrontPageTimeoutFromQemu ();
+ PcdStatus = PcdSet16S (PcdPlatformBootTimeOut, FrontPageTimeout);
ASSERT_RETURN_ERROR (PcdStatus);
+ //
+ // Reflect the PCD in the standard Timeout variable.
+ //
+ Status = gRT->SetVariable (
+ EFI_TIME_OUT_VARIABLE_NAME,
+ &gEfiGlobalVariableGuid,
+ (EFI_VARIABLE_NON_VOLATILE |
+ EFI_VARIABLE_BOOTSERVICE_ACCESS |
+ EFI_VARIABLE_RUNTIME_ACCESS),
+ sizeof FrontPageTimeout,
+ &FrontPageTimeout
+ );
+ DEBUG ((
+ EFI_ERROR (Status) ? DEBUG_ERROR : DEBUG_VERBOSE,
+ "%a: SetVariable(%s, %u): %r\n",
+ __FUNCTION__,
+ EFI_TIME_OUT_VARIABLE_NAME,
+ FrontPageTimeout,
+ Status
+ ));
PlatformRegisterOptionsAndKeys ();
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index f89cce1879..c479f113b9 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -38,6 +38,7 @@
BaseLib
MemoryAllocationLib
UefiBootServicesTableLib
+ UefiRuntimeServicesTableLib
BaseMemoryLib
DebugLib
PcdLib
@@ -79,5 +80,6 @@
[Guids]
gEfiEndOfDxeEventGroupGuid
+ gEfiGlobalVariableGuid
gRootBridgesConnectedEventGroupGuid
gUefiShellFileGuid