efi_loader: update the timing of enabling and disabling EFI watchdog
authorMasahisa Kojima <masahisa.kojima@linaro.org>
Tue, 22 Feb 2022 00:58:30 +0000 (09:58 +0900)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Sat, 26 Feb 2022 06:37:01 +0000 (07:37 +0100)
commit3fa9ed9ae3b30dd6e7f5e887c76d183ad72a44a2
treeb446ed1c80e146970e790f2cb6455e68c7a69cef
parent3e6f81000672e6d0d88fde9c7ad5b01414eccf86
efi_loader: update the timing of enabling and disabling EFI watchdog

UEFI specification requires that 5 minutes watchdog timer is
armed before the firmware's boot manager invokes an EFI boot option.
This watchdog timer is updated as follows, according to the
UEFI specification.

 1) The EFI Image may reset or disable the watchdog timer as needed.
 2) If control is returned to the firmware's boot manager,
    the watchdog timer must be disabled.
 3) On successful completion of EFI_BOOT_SERVICES.ExitBootServices()
    the watchdog timer is disabled.

1) is up to the EFI image, and 3) is already implemented in U-Boot.
This patch implements 2), the watchdog is disabled when control is
returned to U-Boot.

In addition, current implementation arms the EFI watchdog at only
the first "bootefi" invocation. The EFI watchdog must be armed
in every EFI boot option invocation.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
cmd/bootefi.c
lib/efi_loader/efi_watchdog.c