Johnny Lin has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/42495 )
Change subject: mb/ocp/deltalake: Configure IPMI FRB2 watchdog timer via VPD variables in romstage ......................................................................
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 --- M src/mainboard/ocp/deltalake/ipmi.c M src/mainboard/ocp/deltalake/ipmi.h M src/mainboard/ocp/deltalake/romstage.c 3 files changed, 47 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/95/42495/1
diff --git a/src/mainboard/ocp/deltalake/ipmi.c b/src/mainboard/ocp/deltalake/ipmi.c index dd81bfd..23328f8 100644 --- a/src/mainboard/ocp/deltalake/ipmi.c +++ b/src/mainboard/ocp/deltalake/ipmi.c @@ -3,9 +3,19 @@ #include <console/console.h> #include <drivers/ipmi/ipmi_kcs.h> #include <drivers/ocp/dmi/ocp_dmi.h> +#include <drivers/vpd/vpd.h> +#include <string.h>
#include "ipmi.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 + enum cb_err ipmi_set_ppin(struct ppin_req *req) { int ret; @@ -70,3 +80,33 @@
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, &enable)) { + if (!enable) { + printk(BIOS_DEBUG, "Disable FRB2 timer\n"); + ipmi_stop_bmc_wdt(BMC_KCS_BASE); + return; + } + } + if (enable) { + if (vpd_gets(FRB2_COUNTDOWN, val, VPD_LEN, VPD_RW)) { + 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(BMC_KCS_BASE, countdown, + TIMEOUT_HARD_RESET); + } +} diff --git a/src/mainboard/ocp/deltalake/ipmi.h b/src/mainboard/ocp/deltalake/ipmi.h index b167473..52f5db9 100644 --- a/src/mainboard/ocp/deltalake/ipmi.h +++ b/src/mainboard/ocp/deltalake/ipmi.h @@ -26,4 +26,5 @@ 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 2199494..0f0ee24 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/ocp/dmi/ocp_dmi.h> #include <fsp/api.h> #include <FspmUpd.h> #include <soc/romstage.h> @@ -104,6 +105,11 @@
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(BMC_KCS_BASE, 0) == CB_SUCCESS) + init_frb2_wdt(); + mainboard_config_gpios(mupd); mainboard_config_iio(mupd); }
Hello build bot (Jenkins), Jonathan Zhang, Jingle Hsu, Morgan Jang, Patrick Rudolph,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/42495
to look at the new patch set (#6).
Change subject: mb/ocp/deltalake: Configure IPMI FRB2 watchdog timer via VPD variables in romstage ......................................................................
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 --- M src/mainboard/ocp/deltalake/ipmi.c M src/mainboard/ocp/deltalake/ipmi.h M src/mainboard/ocp/deltalake/romstage.c 3 files changed, 47 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/95/42495/6
Jonathan Zhang has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/42495 )
Change subject: mb/ocp/deltalake: Configure IPMI FRB2 watchdog timer via VPD variables in romstage ......................................................................
Patch Set 11:
(1 comment)
LGTM
https://review.coreboot.org/c/coreboot/+/42495/11/src/mainboard/ocp/deltalak... File src/mainboard/ocp/deltalake/ipmi.c:
https://review.coreboot.org/c/coreboot/+/42495/11/src/mainboard/ocp/deltalak... PS11, Line 12: #define FRB2_TIMER "FRB2_TIMER" For VPD key names, let's use lower characters by default, unless the VPD key is for FSP UPD variable, in such case FSP UPD variable name is used as-is.
Hello Philipp Deppenwiese, build bot (Jenkins), Jonathan Zhang, Christian Walter, Jingle Hsu, Morgan Jang, Patrick Rudolph,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/42495
to look at the new patch set (#12).
Change subject: mb/ocp/deltalake: Configure IPMI FRB2 watchdog timer via VPD variables in romstage ......................................................................
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 --- M src/mainboard/ocp/deltalake/ipmi.c M src/mainboard/ocp/deltalake/ipmi.h M src/mainboard/ocp/deltalake/romstage.c A src/mainboard/ocp/deltalake/vpd.h 4 files changed, 54 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/95/42495/12
Johnny Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/42495 )
Change subject: mb/ocp/deltalake: Configure IPMI FRB2 watchdog timer via VPD variables in romstage ......................................................................
Patch Set 12:
(1 comment)
https://review.coreboot.org/c/coreboot/+/42495/11/src/mainboard/ocp/deltalak... File src/mainboard/ocp/deltalake/ipmi.c:
https://review.coreboot.org/c/coreboot/+/42495/11/src/mainboard/ocp/deltalak... PS11, Line 12: #define FRB2_TIMER "FRB2_TIMER"
For VPD key names, let's use lower characters by default, unless the VPD key is for FSP UPD variable […]
Done
Jonathan Zhang has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/42495 )
Change subject: mb/ocp/deltalake: Configure IPMI FRB2 watchdog timer via VPD variables in romstage ......................................................................
Patch Set 12: Code-Review+1
LGTM
Philipp Deppenwiese has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/42495 )
Change subject: mb/ocp/deltalake: Configure IPMI FRB2 watchdog timer via VPD variables in romstage ......................................................................
Patch Set 12: Code-Review+2
Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/42495 )
Change subject: mb/ocp/deltalake: Configure IPMI FRB2 watchdog timer via VPD variables in romstage ......................................................................
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 --- M src/mainboard/ocp/deltalake/ipmi.c M src/mainboard/ocp/deltalake/ipmi.h M src/mainboard/ocp/deltalake/romstage.c A src/mainboard/ocp/deltalake/vpd.h 4 files changed, 54 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Philipp Deppenwiese: Looks good to me, approved Jonathan Zhang: Looks good to me, but someone else must approve
diff --git a/src/mainboard/ocp/deltalake/ipmi.c b/src/mainboard/ocp/deltalake/ipmi.c index f60abf2..19a85d5 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 @@
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 039c576..840f999 100644 --- a/src/mainboard/ocp/deltalake/ipmi.h +++ b/src/mainboard/ocp/deltalake/ipmi.h @@ -28,4 +28,5 @@ 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 68ff113..3389e6e 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 @@
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 0000000..65aae72 --- /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