diff options
author | Johnny Lin <johnny_lin@wiwynn.com> | 2020-06-18 11:04:41 +0800 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2020-07-08 07:24:22 +0000 |
commit | 3d44c9925ff7ee20116f696a873770769feb27f6 (patch) | |
tree | d27c0480690b81f4558e2994b3411cd70d45efe0 /src/mainboard/ocp/deltalake/ipmi.c | |
parent | cef108cc906b8276efdd005fc51fb1b180fb272b (diff) | |
download | coreboot-3d44c9925ff7ee20116f696a873770769feb27f6.tar.xz |
mb/ocp/deltalake: Configure IPMI FRB2 watchdog timer via VPD variables in romstage
Add VPD variables for enabling/disabling FRB2 watchdog timer and setting
the timer countdown value. By default it would start the timer and
trigger hard reset when it's expired. The timer is expected to be
stopped later by payload or OS.
Tested on OCP Delta Lake.
Change-Id: I3ce3bdc24a41d27eb1877655b3148ba02f7f5497
Signed-off-by: Johnny Lin <johnny_lin@wiwynn.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/42495
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jonathan Zhang <jonzhang@fb.com>
Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com>
Diffstat (limited to 'src/mainboard/ocp/deltalake/ipmi.c')
-rw-r--r-- | src/mainboard/ocp/deltalake/ipmi.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/mainboard/ocp/deltalake/ipmi.c b/src/mainboard/ocp/deltalake/ipmi.c index f60abf2e5c..19a85d567c 100644 --- a/src/mainboard/ocp/deltalake/ipmi.c +++ b/src/mainboard/ocp/deltalake/ipmi.c @@ -3,8 +3,11 @@ #include <console/console.h> #include <drivers/ipmi/ipmi_kcs.h> #include <drivers/ipmi/ipmi_ops.h> +#include <drivers/vpd/vpd.h> +#include <string.h> #include "ipmi.h" +#include "vpd.h" enum cb_err ipmi_set_ppin(struct ppin_req *req) { @@ -71,3 +74,33 @@ enum cb_err ipmi_get_slot_id(uint8_t *slot_id) return CB_SUCCESS; } + +void init_frb2_wdt(void) +{ + + char val[VPD_LEN]; + /* Enable FRB2 timer by default. */ + u8 enable = 1; + uint16_t countdown; + + if (vpd_get_bool(FRB2_TIMER, VPD_RW_THEN_RO, &enable)) { + if (!enable) { + printk(BIOS_DEBUG, "Disable FRB2 timer\n"); + ipmi_stop_bmc_wdt(CONFIG_BMC_KCS_BASE); + return; + } + } + if (enable) { + if (vpd_gets(FRB2_COUNTDOWN, val, VPD_LEN, VPD_RW_THEN_RO)) { + countdown = (uint16_t)atol(val); + printk(BIOS_DEBUG, "FRB2 timer countdown set to: %d ms\n", + countdown * 100); + } else { + printk(BIOS_DEBUG, "FRB2 timer use default value: %d ms\n", + DEFAULT_COUNTDOWN * 100); + countdown = DEFAULT_COUNTDOWN; + } + ipmi_init_and_start_bmc_wdt(CONFIG_BMC_KCS_BASE, countdown, + TIMEOUT_HARD_RESET); + } +} |