From 42de09370fddac6446e071d1b613f477b20fc6bc Mon Sep 17 00:00:00 2001 From: Ronald Cron Date: Fri, 4 Jul 2014 14:46:21 +0000 Subject: [PATCH] ArmPlatformPkg/Bds: Added boot timeout setting Added boot timeout setting in UEFI boot manager menu Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ronald Cron Reviewed-By: Olivier Martin git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15629 6f19259b-4bc3-4df7-8a09-765794883524 --- ArmPlatformPkg/Bds/BootMenu.c | 49 +++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/ArmPlatformPkg/Bds/BootMenu.c b/ArmPlatformPkg/Bds/BootMenu.c index 62e7927def..39013cf802 100644 --- a/ArmPlatformPkg/Bds/BootMenu.c +++ b/ArmPlatformPkg/Bds/BootMenu.c @@ -648,6 +648,54 @@ EXIT: return Status; } +/** + Set boot timeout + + Ask for the boot timeout in seconds and if the input succeeds assign the + input value to the UEFI global variable "Timeout". This function is called + when the user selects the "Set Boot Timeout" of the boot manager menu. + + @param[in] BootOptionsList List of the boot devices, not used here + + @retval EFI_SUCCESS Boot timeout in second retrieved from the standard + input and assigned to the UEFI "Timeout" global + variable + @retval !EFI_SUCCESS Either the input or the setting of the UEFI global + variable "Timeout" has failed. +**/ +EFI_STATUS +STATIC +BootMenuSetBootTimeout ( + IN LIST_ENTRY *BootOptionsList + ) +{ + EFI_STATUS Status; + UINTN Input; + UINT16 Timeout; + + Print (L"Timeout duration (in seconds): "); + Status = GetHIInputInteger (&Input); + if (EFI_ERROR (Status)) { + Print (L"\n"); + goto ErrorExit; + } + + Timeout = Input; + Status = gRT->SetVariable ( + (CHAR16*)L"Timeout", + &gEfiGlobalVariableGuid, + EFI_VARIABLE_NON_VOLATILE | + EFI_VARIABLE_BOOTSERVICE_ACCESS | + EFI_VARIABLE_RUNTIME_ACCESS, + sizeof (UINT16), + &Timeout + ); + ASSERT_EFI_ERROR (Status); + +ErrorExit: + return Status; +} + struct BOOT_MANAGER_ENTRY { CONST CHAR16* Description; EFI_STATUS (*Callback) (IN LIST_ENTRY *BootOptionsList); @@ -656,6 +704,7 @@ struct BOOT_MANAGER_ENTRY { { L"Update Boot Device Entry", BootMenuUpdateBootOption }, { L"Remove Boot Device Entry", BootMenuRemoveBootOption }, { L"Update FDT path", UpdateFdtPath }, + { L"Set Boot Timeout", BootMenuSetBootTimeout }, }; EFI_STATUS -- 2.39.2