summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mainboard/ocp/deltalake/ipmi.c33
-rw-r--r--src/mainboard/ocp/deltalake/ipmi.h1
-rw-r--r--src/mainboard/ocp/deltalake/romstage.c6
-rw-r--r--src/mainboard/ocp/deltalake/vpd.h14
4 files changed, 54 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);
+ }
+}
diff --git a/src/mainboard/ocp/deltalake/ipmi.h b/src/mainboard/ocp/deltalake/ipmi.h
index 039c576847..840f999990 100644
--- a/src/mainboard/ocp/deltalake/ipmi.h
+++ b/src/mainboard/ocp/deltalake/ipmi.h
@@ -28,4 +28,5 @@ struct ppin_req {
enum cb_err ipmi_set_ppin(struct ppin_req *req);
enum cb_err ipmi_get_pcie_config(uint8_t *config);
enum cb_err ipmi_get_slot_id(uint8_t *slot_id);
+void init_frb2_wdt(void);
#endif
diff --git a/src/mainboard/ocp/deltalake/romstage.c b/src/mainboard/ocp/deltalake/romstage.c
index 68ff113474..3389e6efbe 100644
--- a/src/mainboard/ocp/deltalake/romstage.c
+++ b/src/mainboard/ocp/deltalake/romstage.c
@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <console/console.h>
+#include <drivers/ipmi/ipmi_kcs.h>
#include <fsp/api.h>
#include <FspmUpd.h>
#include <soc/romstage.h>
@@ -60,6 +61,11 @@ static void mainboard_config_iio(FSPM_UPD *mupd)
void mainboard_memory_init_params(FSPM_UPD *mupd)
{
+ /* Since it's the first IPMI command, it's better to run get BMC
+ selftest result first */
+ if (ipmi_kcs_premem_init(CONFIG_BMC_KCS_BASE, 0) == CB_SUCCESS)
+ init_frb2_wdt();
+
mainboard_config_gpios(mupd);
mainboard_config_iio(mupd);
}
diff --git a/src/mainboard/ocp/deltalake/vpd.h b/src/mainboard/ocp/deltalake/vpd.h
new file mode 100644
index 0000000000..65aae72895
--- /dev/null
+++ b/src/mainboard/ocp/deltalake/vpd.h
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#ifndef DELTALAKE_VPD_H
+#define DELTALAKE_VPD_H
+
+/* VPD variable for enabling/disabling FRB2 timer. */
+#define FRB2_TIMER "frb2_timer"
+/* VPD variable for setting FRB2 timer countdown value. */
+#define FRB2_COUNTDOWN "frb2_countdown"
+#define VPD_LEN 10
+/* Default countdown is 15 minutes. */
+#define DEFAULT_COUNTDOWN 9000
+
+#endif