summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohnny Lin <johnny_lin@wiwynn.com>2019-11-14 14:55:04 +0800
committerPatrick Georgi <pgeorgi@google.com>2019-11-28 10:51:08 +0000
commit556630336244941efcaa6750d954da6dbb0ce72d (patch)
tree531fd24306a33378418654b221681d80aac8fc5b
parent9ede3d51e59e6affff28a77168cb9a4c65bba51c (diff)
downloadcoreboot-556630336244941efcaa6750d954da6dbb0ce72d.tar.gz
coreboot-556630336244941efcaa6750d954da6dbb0ce72d.tar.bz2
coreboot-556630336244941efcaa6750d954da6dbb0ce72d.zip
drivers/ipmi: Add IPMI get system GUID support
Tested on OCP Mono Lake. Change-Id: I541a23341ccce3d45239babb3f0a8a8c8542b226 Signed-off-by: Johnny Lin <johnny_lin@wiwynn.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/37085 Reviewed-by: David Hendricks <david.hendricks@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r--src/drivers/ipmi/ipmi_ops.c26
-rw-r--r--src/drivers/ipmi/ipmi_ops.h8
2 files changed, 34 insertions, 0 deletions
diff --git a/src/drivers/ipmi/ipmi_ops.c b/src/drivers/ipmi/ipmi_ops.c
index 784daeb1fb00..8a189bdbe1aa 100644
--- a/src/drivers/ipmi/ipmi_ops.c
+++ b/src/drivers/ipmi/ipmi_ops.c
@@ -16,6 +16,7 @@
#include <console/console.h>
#include "ipmi_ops.h"
+#include <string.h>
enum cb_err ipmi_init_and_start_bmc_wdt(const int port, uint16_t countdown,
uint8_t action)
@@ -104,3 +105,28 @@ enum cb_err ipmi_stop_bmc_wdt(const int port)
return CB_SUCCESS;
}
+
+enum cb_err ipmi_get_system_guid(const int port, uint8_t *uuid)
+{
+ int ret;
+ struct ipmi_get_system_guid_rsp rsp;
+
+ if (uuid == NULL) {
+ printk(BIOS_ERR, "%s failed, null pointer parameter\n",
+ __func__);
+ return CB_ERR;
+ }
+
+ ret = ipmi_kcs_message(port, IPMI_NETFN_APPLICATION, 0x0,
+ IPMI_BMC_GET_SYSTEM_GUID, NULL, 0,
+ (unsigned char *) &rsp, sizeof(rsp));
+
+ if (ret < sizeof(struct ipmi_rsp) || rsp.resp.completion_code) {
+ printk(BIOS_ERR, "IPMI: %s command failed (ret=%d resp=0x%x)\n",
+ __func__, ret, rsp.resp.completion_code);
+ return CB_ERR;
+ }
+
+ memcpy(uuid, rsp.data, 16);
+ return CB_SUCCESS;
+}
diff --git a/src/drivers/ipmi/ipmi_ops.h b/src/drivers/ipmi/ipmi_ops.h
index f293075e90f1..77fc727cc84c 100644
--- a/src/drivers/ipmi/ipmi_ops.h
+++ b/src/drivers/ipmi/ipmi_ops.h
@@ -21,6 +21,7 @@
#define IPMI_BMC_RESET_WDG_TIMER 0x22
#define IPMI_BMC_SET_WDG_TIMER 0x24
#define IPMI_BMC_GET_WDG_TIMER 0x25
+#define IPMI_BMC_GET_SYSTEM_GUID 0x37
/* BMC watchdog timeout action */
enum ipmi_bmc_timeout_action_type {
@@ -44,6 +45,10 @@ struct ipmi_wdt_rsp {
uint16_t present_countdown_val;
} __packed;
+struct ipmi_get_system_guid_rsp {
+ struct ipmi_rsp resp;
+ uint8_t data[16];
+} __packed;
/*
* Initialize and start BMC FRB2 watchdog timer with the
* provided timer countdown and action values.
@@ -54,4 +59,7 @@ enum cb_err ipmi_init_and_start_bmc_wdt(const int port, uint16_t countdown,
/* Returns CB_SUCCESS on success and CB_ERR if an error occurred */
enum cb_err ipmi_stop_bmc_wdt(const int port);
+/* IPMI get BMC system GUID and store it to parameter uuid.
+ * Returns CB_SUCCESS on success and CB_ERR if an error occurred */
+enum cb_err ipmi_get_system_guid(const int port, uint8_t *uuid);
#endif