From 7288ff4095cf4254dd2f86ad97c648d9e6114fc8 Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Wed, 4 Mar 2020 10:44:13 +0100 Subject: [PATCH] ArmVirtPkg/PlatformBootManagerLib: sync Timeout with PcdPlatformBootTimeOut MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Cc: Leif Lindholm Cc: Philippe Mathieu-Daudé Signed-off-by: Laszlo Ersek Message-Id: <20200304094413.19462-3-lersek@redhat.com> Reviewed-by: Ard Biesheuvel Reviewed-by: Philippe Mathieu-Daude --- .../PlatformBootManagerLib/PlatformBm.c | 27 +++++++++++++++++-- .../PlatformBootManagerLib.inf | 1 + 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c index 5f6cfe64da..69448ff65b 100644 --- a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c +++ b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -686,7 +687,9 @@ PlatformBootManagerBeforeConsole ( VOID ) { + UINT16 FrontPageTimeout; RETURN_STATUS PcdStatus; + EFI_STATUS Status; // // Signal EndOfDxe PI Event @@ -744,9 +747,29 @@ PlatformBootManagerBeforeConsole ( // // Set the front page timeout from the QEMU configuration. // - 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 + )); // // Register platform-specific boot options and keyboard shortcuts. diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf index a9d4888d43..6fe0a1bb12 100644 --- a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf +++ b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf @@ -68,6 +68,7 @@ gEfiFileSystemInfoGuid gEfiFileSystemVolumeLabelInfoIdGuid gEfiEndOfDxeEventGroupGuid + gEfiGlobalVariableGuid gRootBridgesConnectedEventGroupGuid gUefiShellFileGuid -- 2.39.2