1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 #include <console/console.h>
4 #include <drivers/ipmi/ipmi_if.h>
5 #include <drivers/ipmi/ipmi_ops.h>
6 #include <drivers/ipmi/ocp/ipmi_ocp.h>
7 #include <drivers/ocp/include/vpd.h>
8 #include <drivers/vpd/vpd.h>
13 enum cb_err
ipmi_get_slot_id(uint8_t *slot_id
)
16 struct ipmi_config_rsp
{
21 uint8_t slot_config_id
;
23 struct ipmi_config_rsp rsp
;
25 ret
= ipmi_message(CONFIG_BMC_KCS_BASE
, IPMI_NETFN_OEM
, 0x0, IPMI_OEM_GET_BOARD_ID
, NULL
, 0, (unsigned char *)&rsp
, sizeof(rsp
));
27 if (ret
< sizeof(struct ipmi_rsp
) || rsp
.resp
.completion_code
) {
28 printk(BIOS_ERR
, "IPMI: %s command failed (ret=%d resp=0x%x)\n", __func__
, ret
, rsp
.resp
.completion_code
);
31 *slot_id
= rsp
.slot_id
;
35 void init_frb2_wdt(void)
38 int action
, countdown
;
40 if (vpd_get_bool(FRB2_TIMER
, VPD_RW_THEN_RO
, &enable
)) {
41 printk(BIOS_DEBUG
, "Got VPD %s value: %d\n", FRB2_TIMER
, enable
);
43 printk(BIOS_INFO
, "Not able to get VPD %s, default set to %d\n", FRB2_TIMER
,
45 enable
= FRB2_TIMER_DEFAULT
;
49 if (vpd_get_int(FRB2_COUNTDOWN
, VPD_RW_THEN_RO
, &countdown
)) {
50 printk(BIOS_DEBUG
, "FRB2 timer countdown set to: %d ms\n",
53 printk(BIOS_DEBUG
, "FRB2 timer use default value: %d ms\n",
54 FRB2_COUNTDOWN_DEFAULT
* 100);
55 countdown
= FRB2_COUNTDOWN_DEFAULT
;
58 if (vpd_get_int(FRB2_ACTION
, VPD_RW_THEN_RO
, &action
)) {
59 printk(BIOS_DEBUG
, "FRB2 timer action set to: %d\n", action
);
61 printk(BIOS_DEBUG
, "FRB2 timer action use default value: %d\n",
63 action
= FRB2_ACTION_DEFAULT
;
65 ipmi_init_and_start_bmc_wdt(CONFIG_BMC_KCS_BASE
, (uint16_t)countdown
,
68 printk(BIOS_DEBUG
, "Disable FRB2 timer\n");
69 ipmi_stop_bmc_wdt(CONFIG_BMC_KCS_BASE
);