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/vpd/vpd.h>
13 enum cb_err
ipmi_get_pcie_config(uint8_t *pcie_config
)
16 struct ipmi_config_rsp
{
20 struct ipmi_config_rsp rsp
;
22 ret
= ipmi_message(CONFIG_BMC_KCS_BASE
, IPMI_NETFN_OEM
, 0x0,
23 IPMI_OEM_GET_PCIE_CONFIG
, NULL
, 0, (unsigned char *)&rsp
,
26 if (ret
< sizeof(struct ipmi_rsp
) || rsp
.resp
.completion_code
) {
27 printk(BIOS_ERR
, "IPMI: %s command failed (ret=%d resp=0x%x)\n",
28 __func__
, ret
, rsp
.resp
.completion_code
);
31 *pcie_config
= rsp
.config
;
36 enum cb_err
ipmi_get_slot_id(uint8_t *slot_id
)
39 struct ipmi_config_rsp
{
44 uint8_t slot_config_id
;
46 struct ipmi_config_rsp rsp
;
48 ret
= ipmi_message(CONFIG_BMC_KCS_BASE
, IPMI_NETFN_OEM
, 0x0, IPMI_OEM_GET_BOARD_ID
,
49 NULL
, 0, (unsigned char *)&rsp
, sizeof(rsp
));
51 if (ret
< sizeof(struct ipmi_rsp
) || rsp
.resp
.completion_code
) {
52 printk(BIOS_ERR
, "IPMI: %s command failed (ret=%d resp=0x%x)\n",
53 __func__
, ret
, rsp
.resp
.completion_code
);
56 *slot_id
= rsp
.slot_id
;
61 void init_frb2_wdt(void)
64 int action
, countdown
;
66 if (vpd_get_bool(FRB2_TIMER
, VPD_RW_THEN_RO
, &enable
)) {
67 printk(BIOS_DEBUG
, "Got VPD %s value: %d\n", FRB2_TIMER
, enable
);
69 printk(BIOS_INFO
, "Not able to get VPD %s, default set to %d\n", FRB2_TIMER
,
71 enable
= FRB2_TIMER_DEFAULT
;
75 if (vpd_get_int(FRB2_COUNTDOWN
, VPD_RW_THEN_RO
, &countdown
)) {
76 printk(BIOS_DEBUG
, "FRB2 timer countdown set to: %d ms\n",
79 printk(BIOS_DEBUG
, "FRB2 timer use default value: %d ms\n",
80 FRB2_COUNTDOWN_DEFAULT
* 100);
81 countdown
= FRB2_COUNTDOWN_DEFAULT
;
84 if (vpd_get_int(FRB2_ACTION
, VPD_RW_THEN_RO
, &action
)) {
85 printk(BIOS_DEBUG
, "FRB2 timer action set to: %d\n", action
);
87 printk(BIOS_DEBUG
, "FRB2 timer action use default value: %d\n",
89 action
= FRB2_ACTION_DEFAULT
;
91 ipmi_init_and_start_bmc_wdt(CONFIG_BMC_KCS_BASE
, (uint16_t)countdown
,
94 printk(BIOS_DEBUG
, "Disable FRB2 timer\n");
95 ipmi_stop_bmc_wdt(CONFIG_BMC_KCS_BASE
);