From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.8611.1590657481003602155 for ; Thu, 28 May 2020 02:18:01 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ard.biesheuvel@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1BBB5D6E; Thu, 28 May 2020 02:17:58 -0700 (PDT) Received: from e123331-lin.nice.arm.com (unknown [10.37.8.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 583383F6C4; Thu, 28 May 2020 02:17:56 -0700 (PDT) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: jon@solid-run.com, Ard Biesheuvel , Laszlo Ersek , Leif Lindholm , Ray Ni , Zhichao Gao Subject: [PATCH v2 1/5] ArmPkg/PlatformBootManagerLib: register 's' as UEFI Shell hotkey Date: Thu, 28 May 2020 11:17:37 +0200 Message-Id: <20200528091741.14610-2-ard.biesheuvel@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200528091741.14610-1-ard.biesheuvel@arm.com> References: <20200528091741.14610-1-ard.biesheuvel@arm.com> In preparation of hiding the UEFI Shell boot option as an ordinary boot option, make sure we can invoke it directly using the 's' hotkey. Without ConnectAll() having been called, this results in a shell that may have no block devices or other things connected, so don't advertise the 's' in the console string that is printed at boot - for novice users, we will go through the UiApp which connects everything first. For advanced use, having the ability to invoke the UEFI shell without any devices connected may be an advantage, so let's keep this behavior as is for now. Signed-off-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek --- ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c index 4aca1382b042..23c925bbdb9c 100644 --- a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c +++ b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c @@ -357,7 +357,8 @@ VOID PlatformRegisterFvBootOption ( CONST EFI_GUID *FileGuid, CHAR16 *Description, - UINT32 Attributes + UINT32 Attributes, + EFI_INPUT_KEY *Key ) { EFI_STATUS Status; @@ -409,6 +410,9 @@ PlatformRegisterFvBootOption ( if (OptionIndex == -1) { Status = EfiBootManagerAddLoadOptionVariable (&NewOption, MAX_UINTN); ASSERT_EFI_ERROR (Status); + Status = EfiBootManagerAddKeyOptionVariable (NULL, + (UINT16)NewOption.OptionNumber, 0, Key, NULL); + ASSERT (Status == EFI_SUCCESS || Status == EFI_ALREADY_STARTED); } EfiBootManagerFreeLoadOption (&NewOption); EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount); @@ -721,6 +725,7 @@ PlatformBootManagerAfterConsole ( UINTN FirmwareVerLength; UINTN PosX; UINTN PosY; + EFI_INPUT_KEY Key; FirmwareVerLength = StrLen (PcdGetPtr (PcdFirmwareVersionString)); @@ -770,8 +775,10 @@ PlatformBootManagerAfterConsole ( // // Register UEFI Shell // + Key.ScanCode = SCAN_NULL; + Key.UnicodeChar = L's'; PlatformRegisterFvBootOption ( - &gUefiShellFileGuid, L"UEFI Shell", LOAD_OPTION_ACTIVE + &gUefiShellFileGuid, L"UEFI Shell", LOAD_OPTION_ACTIVE, &Key ); } -- 2.17.1