[PATCH] Rework watchdog-free mode

2 views
Skip to first unread message

Jan Kiszka

unread,
Mar 21, 2022, 7:00:17 AM3/21/22
to efibootguard-dev, Christian Storm
From: Jan Kiszka <jan.k...@siemens.com>

This allows to start on platforms that have no drivers with out issuing
a warning. We now fail if there are no drivers, AND a non-zero timeout
was specified.

If we have drivers and the timeout is set to zero, we keep on issueing a
warning.

Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
main.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/main.c b/main.c
index a50bd05..4787c86 100644
--- a/main.c
+++ b/main.c
@@ -33,8 +33,15 @@ extern CHAR16 *boot_medium_path;
static EFI_STATUS probe_watchdogs(EFI_LOADED_IMAGE *loaded_image, UINTN timeout)
{
if (init_array_end - init_array_start == 0) {
- WARNING(L"No watchdog drivers registered.\n");
- return EFI_NOT_FOUND;
+ if (timeout > 0) {
+ ERROR(L"No watchdog drivers registered, but timeout is non-zero.\n");
+ return EFI_UNSUPPORTED;
+ }
+ return EFI_SUCCESS;
+ }
+ if (timeout == 0) {
+ WARNING(L"Watchdog is disabled.\n");
+ return EFI_SUCCESS;
}

UINTN handle_count = 0;
@@ -164,13 +171,9 @@ EFI_STATUS efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *system_table)
WARNING(L"Cannot close volumes.\n", status);
}

- if (bg_loader_params.timeout == 0) {
- WARNING(L"Watchdog is disabled.\n");
- } else {
- status = probe_watchdogs(loaded_image, bg_loader_params.timeout);
- if (EFI_ERROR(status)) {
- error_exit(L"Cannot probe watchdog", status);
- }
+ status = probe_watchdogs(loaded_image, bg_loader_params.timeout);
+ if (EFI_ERROR(status)) {
+ error_exit(L"Cannot probe watchdog", status);
}

/* Load and start image */
--
2.34.1
Reply all
Reply to author
Forward
0 new messages