]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
efi: Call bootm_disable_interrupts earlier in efi_exit_boot_services
authorTom Rini <trini@konsulko.com>
Fri, 19 Nov 2021 21:33:04 +0000 (16:33 -0500)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Fri, 26 Nov 2021 20:30:59 +0000 (21:30 +0100)
If we look at the path that bootm/booti take when preparing to boot the
OS, we see that as part of (or prior to calling do_bootm_states,
explicitly) the process, bootm_disable_interrupts() is called prior to
announce_and_cleanup() which is where udc_disconnect() /
board_quiesce_devices() / dm_remove_devices_flags() are called from.  In
the EFI path, these are called afterwards.  In efi_exit_boot_services()
however we have been calling bootm_disable_interrupts() after the above
functions, as part of ensuring that we disable interrupts as required
by the spec.  However, bootm_disable_interrupts() is also where we go
and call usb_stop().  While this has been fine before, on the TI J721E
platform this leads us to an exception.  This exception seems likely to
be the case that we're trying to stop devices that we have already
disabled clocks for.  The most direct way to handle this particular
problem is to make EFI behave like the do_bootm_states() process and
ensure we call bootm_disable_interrupts() prior to ending up in
usb_stop().

Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Simon Glass <sjg@chromium.org>
Suggested-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
lib/efi_loader/efi_boottime.c

index 6fdd0ef77a91fc60e1d9ba524db34ee8fe40264f..8492b732f38400bbc8a92c3c4a06c295393c545d 100644 (file)
@@ -2167,6 +2167,7 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
        }
 
        if (!efi_st_keep_devices) {
+               bootm_disable_interrupts();
                if (IS_ENABLED(CONFIG_USB_DEVICE))
                        udc_disconnect();
                board_quiesce_devices();
@@ -2179,9 +2180,6 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
        /* Fix up caches for EFI payloads if necessary */
        efi_exit_caches();
 
-       /* This stops all lingering devices */
-       bootm_disable_interrupts();
-
        /* Disable boot time services */
        systab.con_in_handle = NULL;
        systab.con_in = NULL;