summaryrefslogtreecommitdiffstats
path: root/src/drivers/ipmi/ipmi_ops.h
diff options
context:
space:
mode:
authorJohnny Lin <johnny_lin@wiwynn.com>2019-10-21 09:54:36 +0800
committerPatrick Georgi <pgeorgi@google.com>2019-10-24 15:47:40 +0000
commitf4abe51b74a593962c72bbecd3ff1d95a81c82d6 (patch)
tree8c5d6dcfef0e559f9874567c7dab219e66e2e2d2 /src/drivers/ipmi/ipmi_ops.h
parent5c18db1ca81b4273b76dcef5e7e22a33efd18dd8 (diff)
downloadcoreboot-f4abe51b74a593962c72bbecd3ff1d95a81c82d6.tar.gz
coreboot-f4abe51b74a593962c72bbecd3ff1d95a81c82d6.tar.bz2
coreboot-f4abe51b74a593962c72bbecd3ff1d95a81c82d6.zip
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 <johnny_lin@wiwynn.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/36179 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Rudolph <siro@das-labor.org>
Diffstat (limited to 'src/drivers/ipmi/ipmi_ops.h')
-rw-r--r--src/drivers/ipmi/ipmi_ops.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/drivers/ipmi/ipmi_ops.h b/src/drivers/ipmi/ipmi_ops.h
new file mode 100644
index 000000000000..f293075e90f1
--- /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 <types.h>
+#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