From b4d311df6dccb367678ce18f02d68724fd2e3c4f Mon Sep 17 00:00:00 2001 From: Filip Brozovic Date: Sat, 26 Oct 2024 19:26:41 +0200 Subject: [PATCH] soc/intel/cmn/block/smbus: Keep TCO WDT timeout flag if ACPI_WDAT_WDT=y MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The TCO SMI handler clears the watchdog timeout flag unconditionally. Since the system is only rebooted if the flag is already set and the watchdog timer expires again, this means that the reboot never occurs. This change preserves the timeout flag if CONFIG_ACPI_WDAT_WDT is enabled, otherwise the behavior remains unchanged. TEST=Build CB with CONFIG_ACPI_WDAT_WDT=y and CONFIG_USE_PM_ACPI_TIMER=y, trigger the watchdog under Linux with "wdctl -s 5 && cat > /dev/watchdog" and wait approximately 10 seconds (two watchdog periods) for the watchdog to reboot the system. Change-Id: I2d35a8f8bcbcc3aaaadcc936fab028641dfd6e2c Signed-off-by: Filip Brozovic Reviewed-on: https://review.coreboot.org/c/coreboot/+/84875 Reviewed-by: Jérémy Compostella Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- src/soc/intel/common/block/smbus/tco.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/soc/intel/common/block/smbus/tco.c b/src/soc/intel/common/block/smbus/tco.c index ef7ef07d3f..b7c9922590 100644 --- a/src/soc/intel/common/block/smbus/tco.c +++ b/src/soc/intel/common/block/smbus/tco.c @@ -70,6 +70,15 @@ uint32_t tco_reset_status(void) /* TCO Status 1 register */ tco1_sts = tco_read_reg(TCO1_STS); + + /* + * Don't reset the TIMEOUT status bit in case the WDAT + * table is enabled, otherwise the watchdog will never + * reboot the system. + */ + if (CONFIG(ACPI_WDAT_WDT)) + tco1_sts &= ~TCO1_STS_TIMEOUT; + tco_write_reg(TCO1_STS, tco1_sts); /* TCO Status 2 register */