From 0099832cdab2337da5d3efc92fdd9b7a4f645cc1 Mon Sep 17 00:00:00 2001 From: Werner Zeh Date: Tue, 18 Jan 2022 12:31:08 +0100 Subject: soc/intel/ehl: Add Kconfig option to disable reset on TCO expiration The TCO timer is the default watchdog of an x86 host and can reset the system once it has expired for the second time. There are applications where this reset is not acceptable while the TCO is used. In these applications the TCO expire event generates an interrupt and software takes care. There is a bit in the TCO1_CNT register on Elkhart Lake to prevent this reset on expiration (called NO_REBOOT, see doc #636722 ). This bit can either be strapped on hardware or set in this register to avoid the reset on expiration. While the hardware strap cannot be overridden in software, the pure software solution is more flexible. Unfortunately, the location for this bit differs among the different platforms. This is why it has to be handled on soc level rather than on TCO common code level. This commit adds a Kconfig option where NO_REBOOT can be enabled. This makes it easy to reach this feature over to the mainboard where it can be selected if needed. Change-Id: Iaa81bfbe688edd717aa02db86f0a93fecdfcd16b Signed-off-by: Werner Zeh Reviewed-on: https://review.coreboot.org/c/coreboot/+/61177 Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber --- src/soc/intel/elkhartlake/bootblock/bootblock.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/soc/intel/elkhartlake/bootblock/bootblock.c') diff --git a/src/soc/intel/elkhartlake/bootblock/bootblock.c b/src/soc/intel/elkhartlake/bootblock/bootblock.c index b8086a42ab..cc0bb8f0c4 100644 --- a/src/soc/intel/elkhartlake/bootblock/bootblock.c +++ b/src/soc/intel/elkhartlake/bootblock/bootblock.c @@ -1,10 +1,12 @@ /* SPDX-License-Identifier: GPL-2.0-only */ #include +#include #include #include #include #include +#include #include asmlinkage void bootblock_c_entry(uint64_t base_timestamp) @@ -30,4 +32,11 @@ void bootblock_soc_init(void) /* Programming TCO_BASE_ADDRESS and TCO Timer Halt */ tco_configure(); + if (CONFIG(SOC_INTEL_ELKHARTLAKE_TCO_NO_REBOOT_EN)) { + uint16_t reg = tco_read_reg(TCO1_CNT); + /* NO_REBOOT is enabled via bit 0 in TCO1_CNT. */ + reg |= 0x01; + tco_write_reg(TCO1_CNT, reg); + printk(BIOS_DEBUG, "TCO: Disable reset on second expiration.\n"); + } } -- cgit v1.2.3