mb/google/nissa/var/rull: add ssd timing and modify ssd GPIO pins of rtd3
[coreboot2.git] / src / mainboard / inventec / transformers / ipmi.c
blobfd46ff443daf8187fb3af8e53c26835d49b91cf2
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>
9 #include <types.h>
11 #include "ipmi.h"
13 enum cb_err ipmi_get_slot_id(uint8_t *slot_id)
15 int ret;
16 struct ipmi_config_rsp {
17 struct ipmi_rsp resp;
18 uint8_t board_sku_id;
19 uint8_t board_rev_id;
20 uint8_t slot_id;
21 uint8_t slot_config_id;
22 } __packed;
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);
29 return CB_ERR;
31 *slot_id = rsp.slot_id;
32 return CB_SUCCESS;
35 void init_frb2_wdt(void)
37 uint8_t enable;
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);
42 } else {
43 printk(BIOS_INFO, "Not able to get VPD %s, default set to %d\n", FRB2_TIMER,
44 FRB2_TIMER_DEFAULT);
45 enable = FRB2_TIMER_DEFAULT;
48 if (enable) {
49 if (vpd_get_int(FRB2_COUNTDOWN, VPD_RW_THEN_RO, &countdown)) {
50 printk(BIOS_DEBUG, "FRB2 timer countdown set to: %d ms\n",
51 countdown * 100);
52 } else {
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);
60 } else {
61 printk(BIOS_DEBUG, "FRB2 timer action use default value: %d\n",
62 FRB2_ACTION_DEFAULT);
63 action = FRB2_ACTION_DEFAULT;
65 ipmi_init_and_start_bmc_wdt(CONFIG_BMC_KCS_BASE, (uint16_t)countdown,
66 (uint8_t)action);
67 } else {
68 printk(BIOS_DEBUG, "Disable FRB2 timer\n");
69 ipmi_stop_bmc_wdt(CONFIG_BMC_KCS_BASE);