[PATCH] efi_loader: support EFI_OS_INDICATIONS_BOOT_TO_FW_UI

Heinrich Schuchardt xypron.glpk at gmx.de
Sat Apr 11 15:43:32 CEST 2026


Am 3. April 2026 18:31:14 MESZ schrieb Simon Glass <sjg at chromium.org>:
>Hi Gary,
>
>On Fri, 3 Apr 2026 at 09:41, Gary Guo <gary at garyguo.net> wrote:
>>
>> On Fri Apr 3, 2026 at 2:22 PM BST, Simon Glass wrote:
>> > Hi Gary,
>> >
>> > On 2026-03-31T19:18:51, Gary Guo <gary at garyguo.net> wrote:
>> >> efi_loader: support EFI_OS_INDICATIONS_BOOT_TO_FW_UI
>> >>
>> >> EFI variable OsIndications have a bit EFI_OS_INDICATIONS_BOOT_TO_FW_UI
>> >> indicating that the OS (or next stage bootloader) requests booting into
>> >> firmware UI instead of continuing autoboot process.
>> >>
>> >> Support it by having autoboot.c asking EFI bootmgr if boot should continue,
>> >> which checks and clear the bit (so the next boot continue as normal).
>> >>
>> >> With this change, systemd-boot will show a "Reboot Into Firmware Interface"
>> >> option which will be able to drop back to u-boot. This can be useful if
>> >> bootdelay is configured to be -2.
>> >>
>> >> Signed-off-by: Gary Guo <gary at garyguo.net>
>> >
>> >> diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c
>> >> @@ -1290,6 +1290,51 @@ out:
>> >> +bool efi_should_abort_autoboot(void)
>> >> +{
>> >> +     efi_status_t ret;
>> >> +     u64 os_indications = 0x0;
>> >> +     efi_uintn_t size;
>> >> +     efi_status_t r;
>> >
>> > (I'm leaving the proper review to Ilias & Heinrich, this is just a few
>> > nits and a though)
>> >
>> > Please can you use a single variable name for both efi_status_t variables.
>>
>> Ah, I think I copied the init part from somewhere else and forget to merge the
>> variable names.
>>
>> I'll adjust the variable name in the next version after receiving more reviews.
>>
>> >
>> >> +     ret = efi_init_obj_list();
>> >> +     if (ret != EFI_SUCCESS) {
>> >> +             log_err("Error: Cannot initialize UEFI sub-system, r = %lu\n",
>> >> +                     ret &

The return value does not help anybody to understand what went wrong as there are a lot of different failure modes.

We should write specific messages inside the routine and not a message in the caller.

It might make sense to have a generic translation of EFI return codes to a string message in vsprintf.c. Which end user would know what error 14 is?

Best regards

Heinrich

 ~EFI_ERROR_MASK);
>> >
>> > The log message says "r = " but prints ret. The similar message in
>> > efi_bootmgr_run() just prints the value without a prefix.
>>
>> Sorry, what do you mean by "without a prefix"? I think the code is identical to
>> the one in `efi_bootmgr_run`?
>
>I mean you don't need r = in the message. You could say (err %lu) perhaps?
>
>>
>> >
>> > I would also like to see the code which adjusts the variable placed in
>> > a function.
>>
>> You mean the bit clearing part? What benefit does that provide, considering that
>> this is just a single function call?
>
>There is reading and write. Being able to control that could end up in
>a command at some point. It is a useful feature. Up to you though.
>
>Regards,
>Simon



More information about the U-Boot mailing list