coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
ipmi.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <console/console.h>
7 #include <drivers/vpd/vpd.h>
8 #include <string.h>
9 
10 #include "ipmi.h"
11 #include "vpd.h"
12 
13 void init_frb2_wdt(void)
14 {
15  char val[VPD_LEN];
16  /* Enable FRB2 timer by default. */
17  u8 enable = 1;
18  uint16_t countdown;
19 
20  if (vpd_get_bool(FRB2_TIMER, VPD_RW_THEN_RO, &enable)) {
21  if (!enable) {
22  printk(BIOS_DEBUG, "Disable FRB2 timer\n");
23  ipmi_stop_bmc_wdt(CONFIG_BMC_KCS_BASE);
24  return;
25  }
26  }
27  if (enable) {
29  countdown = (uint16_t)atol(val);
30  printk(BIOS_DEBUG, "FRB2 timer countdown set to: %d ms\n",
31  countdown * 100);
32  } else {
33  printk(BIOS_DEBUG, "FRB2 timer use default value: %d ms\n",
34  DEFAULT_COUNTDOWN * 100);
35  countdown = DEFAULT_COUNTDOWN;
36  }
37  ipmi_init_and_start_bmc_wdt(CONFIG_BMC_KCS_BASE, countdown,
39  }
40 }
#define printk(level,...)
Definition: stdlib.h:16
void init_frb2_wdt(void)
Definition: ipmi.c:60
@ VPD_RW_THEN_RO
Definition: vpd.h:14
enum cb_err ipmi_init_and_start_bmc_wdt(const int port, uint16_t countdown, uint8_t action)
Definition: ipmi_ops.c:8
enum cb_err ipmi_stop_bmc_wdt(const int port)
Definition: ipmi_ops.c:51
@ TIMEOUT_HARD_RESET
Definition: ipmi_ops.h:16
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
Definition: loglevel.h:128
#define FRB2_COUNTDOWN
Definition: vpd.h:11
#define FRB2_TIMER
Definition: vpd.h:7
#define VPD_LEN
Definition: vpd.h:10
#define DEFAULT_COUNTDOWN
Definition: vpd.h:12
unsigned short uint16_t
Definition: stdint.h:11
uint8_t u8
Definition: stdint.h:45
long atol(const char *str)
Definition: string.c:200
u8 val
Definition: sys.c:300
char * vpd_gets(const char *key, char *buffer, int size, enum vpd_region region)
Definition: vpd.c:229
bool vpd_get_bool(const char *key, enum vpd_region region, uint8_t *val)
Definition: vpd.c:252