From f4abe51b74a593962c72bbecd3ff1d95a81c82d6 Mon Sep 17 00:00:00 2001 From: Johnny Lin Date: Mon, 21 Oct 2019 09:54:36 +0800 Subject: drivers/ipmi: Add IPMI BMC FRB2 watchdog timer support Add a function for initializing and starting FRB2 timer with the provided countdown and action values, and a stop function for stopping the timer. Tested on OCP Monolake. Change-Id: Ic91905e5f01b962473b6b3a9616266d2d95b1d6b Signed-off-by: Johnny Lin Reviewed-on: https://review.coreboot.org/c/coreboot/+/36179 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Rudolph --- src/drivers/ipmi/ipmi_ops.h | 57 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/drivers/ipmi/ipmi_ops.h (limited to 'src/drivers/ipmi/ipmi_ops.h') diff --git a/src/drivers/ipmi/ipmi_ops.h b/src/drivers/ipmi/ipmi_ops.h new file mode 100644 index 0000000000..f293075e90 --- /dev/null +++ b/src/drivers/ipmi/ipmi_ops.h @@ -0,0 +1,57 @@ +#ifndef __IPMI_OPS_H +#define __IPMI_OPS_H +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2019 Wiwynn Corp. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; version 2 of + * the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include "ipmi_kcs.h" +#define IPMI_BMC_RESET_WDG_TIMER 0x22 +#define IPMI_BMC_SET_WDG_TIMER 0x24 +#define IPMI_BMC_GET_WDG_TIMER 0x25 + +/* BMC watchdog timeout action */ +enum ipmi_bmc_timeout_action_type { + TIMEOUT_NO_ACTION = 0x00, + TIMEOUT_HARD_RESET = 0x01, + TIMEOUT_POWER_DOWN = 0x02, + TIMEOUT_POWER_CYCLE = 0x03, +}; +/* BMC Watchdog timer */ +struct ipmi_wdt_req { + uint8_t timer_use; + uint8_t timer_actions; + uint8_t pretimeout_interval; + uint8_t timer_use_expiration_flags_clr; + uint16_t initial_countdown_val; +} __packed; + +struct ipmi_wdt_rsp { + struct ipmi_rsp resp; + struct ipmi_wdt_req data; + uint16_t present_countdown_val; +} __packed; + +/* + * Initialize and start BMC FRB2 watchdog timer with the + * provided timer countdown and action values. + * Returns CB_SUCCESS on success and CB_ERR if an error occurred + */ +enum cb_err ipmi_init_and_start_bmc_wdt(const int port, uint16_t countdown, + uint8_t action); +/* Returns CB_SUCCESS on success and CB_ERR if an error occurred */ +enum cb_err ipmi_stop_bmc_wdt(const int port); + +#endif -- cgit v1.2.3