Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Disable watchdog with extra debug #95

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Platform/NVIDIA/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,9 @@ menu "Watchdog settings"
int "Boot watchdog timeout"
default 5
help
Time in minutes to reboot system before boot options are processed
Time in minutes to reboot system before boot options are processed.
This may be customized based on changes in the boot.
For example changing the debug print level may impact boot time.

config ARM_WATCHDOG
bool "Use ARM watchdog instead of timer"
Expand Down
2 changes: 2 additions & 0 deletions Platform/NVIDIA/NVIDIA.common.dsc.inc
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,8 @@ CONFIG_ARM_WATCHDOG_INTERRUPT=0
# DEBUG_VERBOSE 0x00400000 // Detailed debug messages that may
# // significantly impact boot performance
# DEBUG_ERROR 0x80000000 // Error
#
# If this is changed the boot watchdog value should be reevaluated.
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8000000F

gNVIDIATokenSpaceGuid.PcdAssertResetTimeoutValue|5
Expand Down
8 changes: 7 additions & 1 deletion Silicon/NVIDIA/Drivers/BootWatchdog/BootWatchdog.c
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/** @file
This driver registers a 5 minute watchdog between when it starts and ReadyToBoot.

SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
SPDX-FileCopyrightText: Copyright (c) 2023-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent
**/

#include <PiDxe.h>
#include <Library/DebugLib.h>
#include <Library/DebugPrintErrorLevelLib.h>
#include <Library/DtPlatformDtbLoaderLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
Expand Down Expand Up @@ -56,6 +57,11 @@ WatchDogTimerReady (
WatchdogTimout = PcdGet16 (PcdBootWatchdogTime) * 60;
}

if ((GetDebugPrintErrorLevel () & ~PcdGet32 (PcdDebugPrintErrorLevel)) != 0) {
DEBUG ((DEBUG_ERROR, "%a: watchdog disabled as extra debug is enabled\r\n", __FUNCTION__));
WatchdogTimout = 0;
}

Status = gBS->SetWatchdogTimer (WatchdogTimout, 0x0001, 0, NULL);
if (!EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a: %d minute boot watchdog installed\r\n", __FUNCTION__, WatchdogTimout / 60));
Expand Down
4 changes: 3 additions & 1 deletion Silicon/NVIDIA/Drivers/BootWatchdog/BootWatchdog.inf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## @file
# This driver registers a 5 minute watchdog between when it starts and ReadyToBoot.
#
# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-FileCopyrightText: Copyright (c) 2023-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
Expand All @@ -27,6 +27,7 @@
UefiBootServicesTableLib
UefiDriverEntryPoint
DebugLib
DebugPrintErrorLevelLib
DtPlatformDtbLoaderLib
DxeServicesLib
FdtLib
Expand All @@ -35,6 +36,7 @@

[Pcd]
gNVIDIATokenSpaceGuid.PcdBootWatchdogTime
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel ## CONSUMES

[Protocols]
gEfiWatchdogTimerArchProtocolGuid
Expand Down
Loading