From: "Laszlo Ersek" <lersek@redhat.com>
To: devel@edk2.groups.io, leif@nuviainc.com, ard.biesheuvel@arm.com
Cc: jon@solid-run.com
Subject: Re: [edk2-devel] [PATCH 2/5] ArmPkg/PlatformBootManagerLib: fall back to the UiApp on boot failure
Date: Wed, 27 May 2020 17:34:13 +0200 [thread overview]
Message-ID: <89a08f27-cda1-a144-bccc-80aecc7751f0@redhat.com> (raw)
In-Reply-To: <20200526212453.GT1923@vanye>
Hi Leif,
On 05/26/20 23:24, Leif Lindholm wrote:
> On Tue, May 26, 2020 at 18:13:56 +0200, Ard Biesheuvel wrote:
>> As a last resort, drop into the UiApp application when no active boot
>> options could be started. Doing so will connect all devices, and so
>> it will allow the user to enter the Boot Manager submenu and pick a
>> network or removable disk option. With the right UiApp library added
>> in, the UiApp also gives access to the UEFI Shell.
>>
>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
>> ---
>> ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c | 16 +++++++++++++++-
>> 1 file changed, 15 insertions(+), 1 deletion(-)
>>
>> diff --git a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c
>> index 23c925bbdb9c..f91f7cd09ca1 100644
>> --- a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c
>> +++ b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c
>> @@ -830,5 +830,19 @@ PlatformBootManagerUnableToBoot (
>> VOID
>> )
>> {
>> - return;
>> + EFI_STATUS Status;
>> + EFI_BOOT_MANAGER_LOAD_OPTION BootManagerMenu;
>> +
>> + //
>> + // BootManagerMenu doesn't contain the correct information when return status
>> + // is EFI_NOT_FOUND.
>> + //
>> + Status = EfiBootManagerGetBootManagerMenu (&BootManagerMenu);
>> + if (EFI_ERROR (Status)) {
>
> Nitpick: comment explicitly mentions EFI_NOT_FOUND, but code checks
> for any EFI_ERROR match. Since there are various other error codes
> that could be returned, change the comment to "when return status is
> not EFI_SUCCESS"?
I agree the (likely) original code (see commit 5f66615bb504,
"OvmfPkg/PlatformBds: Implement PlatformBootManagerUnableToBoot",
2018-07-27) is a bit confusing.
Namely, both the comment and the subsequent error check are correct. The
problem is that there is not much connection between the comment and the
subsequent check. In other words, the comment does not *explain* the
check.
The EfiBootManagerGetBootManagerMenu() function in
"MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c" is documented like
this:
> /**
> Return the boot option corresponding to the Boot Manager Menu.
> It may automatically create one if the boot option hasn't been created yet.
>
> @param BootOption Return the Boot Manager Menu.
>
> @retval EFI_SUCCESS The Boot Manager Menu is successfully returned.
> @retval EFI_NOT_FOUND The Boot Manager Menu cannot be found.
> @retval others Return status of gRT->SetVariable (). BootOption still points
> to the Boot Manager Menu even the Status is not EFI_SUCCESS
> and EFI_NOT_FOUND.
> **/
So the comment change you're proposing wouldn't be technically correct,
I believe.
I think at best we should drop the comment altogether. If
EfiBootManagerGetBootManagerMenu() fails due to EFI_NOT_FOUND, then
"BootManagerMenu" is indeterminate, so we need to bail. If
EfiBootManagerGetBootManagerMenu() fails with something else, then
"BootManagerMenu" is set, but we *still* need to bail (as much as I
understand from the EfiBootManagerGetBootManagerMenu() documentation).
And that seems to mean we should simply not highlight EFI_NOT_FOUND with
a comment.
Thanks
Laszlo
next prev parent reply other threads:[~2020-05-27 15:34 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-26 16:13 [PATCH 0/5] ArmPkg/PlatformBootManagerLib: play nice without ConnectAll() Ard Biesheuvel
2020-05-26 16:13 ` [PATCH 1/5] ArmPkg/PlatformBootManagerLib: register 's' as UEFI Shell hotkey Ard Biesheuvel
2020-05-27 15:24 ` [edk2-devel] " Laszlo Ersek
2020-05-26 16:13 ` [PATCH 2/5] ArmPkg/PlatformBootManagerLib: fall back to the UiApp on boot failure Ard Biesheuvel
2020-05-26 21:24 ` [edk2-devel] " Leif Lindholm
2020-05-27 15:34 ` Laszlo Ersek [this message]
2020-05-27 17:39 ` Leif Lindholm
2020-05-27 15:25 ` Laszlo Ersek
2020-05-26 16:13 ` [PATCH 3/5] ArmPkg/PlatformBootManagerLib: hide UEFI Shell as a regular boot option Ard Biesheuvel
2020-05-26 21:27 ` [edk2-devel] " Leif Lindholm
2020-05-27 15:40 ` Laszlo Ersek
2020-05-26 16:13 ` [PATCH 4/5] ArmPkg/PlatformBootManagerLib: don't connect all devices on each boot Ard Biesheuvel
2020-05-27 15:49 ` [edk2-devel] " Laszlo Ersek
2020-05-26 16:13 ` [PATCH 5/5] ShellPkg: add BootManager library to add UEFI Shell menu option Ard Biesheuvel
2020-05-27 15:57 ` [edk2-devel] " Laszlo Ersek
2020-05-27 17:22 ` Ard Biesheuvel
2020-05-28 19:55 ` Laszlo Ersek
2020-05-26 22:01 ` [PATCH 0/5] ArmPkg/PlatformBootManagerLib: play nice without ConnectAll() Leif Lindholm
2020-05-27 5:35 ` [edk2-devel] " Ard Biesheuvel
2020-05-27 10:43 ` Leif Lindholm
2020-05-27 10:50 ` Ard Biesheuvel
2020-05-27 13:41 ` Leif Lindholm
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=89a08f27-cda1-a144-bccc-80aecc7751f0@redhat.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox