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 <werner.zeh@siemens.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/61177
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
This commit is contained in:
Werner Zeh 2022-01-18 12:31:08 +01:00 committed by Felix Held
parent 964055d74f
commit 0099832cda
2 changed files with 19 additions and 0 deletions

View File

@ -251,4 +251,14 @@ config SOC_INTEL_ELKHARTLAKE_DEBUG_CONSENT
config PRERAM_CBMEM_CONSOLE_SIZE config PRERAM_CBMEM_CONSOLE_SIZE
hex hex
default 0x1400 default 0x1400
config SOC_INTEL_ELKHARTLAKE_TCO_NO_REBOOT_EN
bool "Disable reset on second TCO expiration"
depends on SOC_INTEL_COMMON_BLOCK_TCO
default n
help
Setting this option will prevent a host reset if the TCO timer expires
for the second time. Since this feature is not exposed to the OS in the
standard TCO interface, this setting can be enabled on firmware level.
This might be useful depending on the TCO policy.
endif endif

View File

@ -1,10 +1,12 @@
/* SPDX-License-Identifier: GPL-2.0-only */ /* SPDX-License-Identifier: GPL-2.0-only */
#include <bootblock_common.h> #include <bootblock_common.h>
#include <console/console.h>
#include <intelblocks/fast_spi.h> #include <intelblocks/fast_spi.h>
#include <intelblocks/systemagent.h> #include <intelblocks/systemagent.h>
#include <intelblocks/tco.h> #include <intelblocks/tco.h>
#include <intelblocks/uart.h> #include <intelblocks/uart.h>
#include <intelpch/smbus.h>
#include <soc/bootblock.h> #include <soc/bootblock.h>
asmlinkage void bootblock_c_entry(uint64_t base_timestamp) 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 */ /* Programming TCO_BASE_ADDRESS and TCO Timer Halt */
tco_configure(); 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");
}
} }