From ea9787a6b29821e95aa382e1df1ba397cf3da9e9 Mon Sep 17 00:00:00 2001 From: Morgan Jang Date: Thu, 9 Apr 2020 13:50:43 +0800 Subject: drivers/ipmi: Implement the function for logging system events into BMC Implemented for functions that need to log system events into BMC, the information of system events can be specific. TEST=Use ipmitool and execute "ipmitool sel list" command to check if SEL is added into BMC. Change-Id: I38f3acb958d12c196d33d34fd5cfa0b784f403b7 Signed-off-by: Morgan Jang Reviewed-on: https://review.coreboot.org/c/coreboot/+/40286 Tested-by: build bot (Jenkins) Reviewed-by: Andrey Petrov Reviewed-by: Paul Menzel --- src/drivers/ipmi/ipmi_ops.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/drivers/ipmi/ipmi_ops.c') diff --git a/src/drivers/ipmi/ipmi_ops.c b/src/drivers/ipmi/ipmi_ops.c index 25bf077aef..2a52ba0ec3 100644 --- a/src/drivers/ipmi/ipmi_ops.c +++ b/src/drivers/ipmi/ipmi_ops.c @@ -118,3 +118,25 @@ enum cb_err ipmi_get_system_guid(const int port, uint8_t *uuid) memcpy(uuid, rsp.data, 16); return CB_SUCCESS; } + +enum cb_err ipmi_add_sel(const int port, struct sel_event_record *sel) +{ + int ret; + struct ipmi_add_sel_rsp rsp; + + if (sel == NULL) { + printk(BIOS_ERR, "%s failed, system evnt log is not present.\n", __func__); + return CB_ERR; + } + + ret = ipmi_kcs_message(port, IPMI_NETFN_STORAGE, 0x0, + IPMI_ADD_SEL_ENTRY, (const unsigned char *) sel, + 16, (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; + } + return CB_SUCCESS; +} -- cgit v1.2.3