From ef7dd5d54df9137b8167e86838270a7c812b21f3 Mon Sep 17 00:00:00 2001 From: Sergii Dmytruk Date: Fri, 22 Oct 2021 01:02:32 +0300 Subject: drivers/ipmi: prepare for adding more interfaces De-duplicate common initialization code (self-test and device identification) and put it in a new ipmi_if.c unit, which is supposed to work with any underlying IPMI interface. Change-Id: Ia99da6fb63adb7bf556d3d6f7964b34831be8a2f Signed-off-by: Sergii Dmytruk Reviewed-on: https://review.coreboot.org/c/coreboot/+/67056 Tested-by: build bot (Jenkins) Reviewed-by: Krystian Hebel --- src/drivers/ipmi/ocp/ipmi_ocp.c | 7 ++++--- src/drivers/ipmi/ocp/ipmi_ocp_romstage.c | 24 ++++++++++++------------ 2 files changed, 16 insertions(+), 15 deletions(-) (limited to 'src/drivers/ipmi/ocp') diff --git a/src/drivers/ipmi/ocp/ipmi_ocp.c b/src/drivers/ipmi/ocp/ipmi_ocp.c index 11161a8ae4..9f583be934 100644 --- a/src/drivers/ipmi/ocp/ipmi_ocp.c +++ b/src/drivers/ipmi/ocp/ipmi_ocp.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include @@ -28,8 +28,9 @@ static enum cb_err ipmi_set_ppin(struct device *dev) req.cpu1_lo = xeon_sp_ppin[1].lo; req.cpu1_hi = xeon_sp_ppin[1].hi; } - ret = ipmi_kcs_message(dev->path.pnp.port, IPMI_NETFN_OEM, 0x0, IPMI_OEM_SET_PPIN, - (const unsigned char *) &req, sizeof(req), (unsigned char *) &rsp, sizeof(rsp)); + ret = ipmi_message(dev->path.pnp.port, IPMI_NETFN_OEM, 0x0, IPMI_OEM_SET_PPIN, + (const unsigned char *) &req, sizeof(req), + (unsigned char *) &rsp, sizeof(rsp)); if (ret < sizeof(struct ipmi_rsp) || rsp.completion_code) { printk(BIOS_ERR, "IPMI: %s command failed (ret=%d resp=0x%x)\n", diff --git a/src/drivers/ipmi/ocp/ipmi_ocp_romstage.c b/src/drivers/ipmi/ocp/ipmi_ocp_romstage.c index 8e43d8d159..7b0b9ea036 100644 --- a/src/drivers/ipmi/ocp/ipmi_ocp_romstage.c +++ b/src/drivers/ipmi/ocp/ipmi_ocp_romstage.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ #include -#include +#include #include "ipmi_ocp.h" @@ -10,9 +10,9 @@ enum cb_err ipmi_set_post_start(const int port) int ret; struct ipmi_rsp rsp; - ret = ipmi_kcs_message(port, IPMI_NETFN_OEM, 0x0, - IPMI_BMC_SET_POST_START, NULL, 0, (u8 *) &rsp, - sizeof(rsp)); + ret = ipmi_message(port, IPMI_NETFN_OEM, 0x0, + IPMI_BMC_SET_POST_START, NULL, 0, (u8 *) &rsp, + sizeof(rsp)); if (ret < sizeof(struct ipmi_rsp) || rsp.completion_code) { printk(BIOS_ERR, "IPMI: %s command failed (ret=%d rsp=0x%x)\n", @@ -42,10 +42,10 @@ enum cb_err ipmi_set_cmos_clear(void) /* IPMI OEM get bios boot order command to check if the valid bit and the CMOS clear bit are both set from the response BootMode byte. */ - ret = ipmi_kcs_message(CONFIG_BMC_KCS_BASE, IPMI_NETFN_OEM, 0x0, - IPMI_OEM_GET_BIOS_BOOT_ORDER, - NULL, 0, - (unsigned char *) &rsp, sizeof(rsp)); + ret = ipmi_message(CONFIG_BMC_KCS_BASE, IPMI_NETFN_OEM, 0x0, + IPMI_OEM_GET_BIOS_BOOT_ORDER, + NULL, 0, + (unsigned char *) &rsp, sizeof(rsp)); if (ret < sizeof(struct ipmi_rsp) || rsp.resp.completion_code) { printk(BIOS_ERR, "IPMI: %s command failed (read ret=%d resp=0x%x)\n", @@ -56,10 +56,10 @@ enum cb_err ipmi_set_cmos_clear(void) if (!IS_CMOS_AND_VALID_BIT(rsp.data.boot_mode)) { req = rsp.data; SET_CMOS_AND_VALID_BIT(req.boot_mode); - ret = ipmi_kcs_message(CONFIG_BMC_KCS_BASE, IPMI_NETFN_OEM, 0x0, - IPMI_OEM_SET_BIOS_BOOT_ORDER, - (const unsigned char *) &req, sizeof(req), - (unsigned char *) &rsp, sizeof(rsp)); + ret = ipmi_message(CONFIG_BMC_KCS_BASE, IPMI_NETFN_OEM, 0x0, + IPMI_OEM_SET_BIOS_BOOT_ORDER, + (const unsigned char *) &req, sizeof(req), + (unsigned char *) &rsp, sizeof(rsp)); if (ret < sizeof(struct ipmi_rsp) || rsp.resp.completion_code) { printk(BIOS_ERR, "IPMI: %s command failed (sent ret=%d resp=0x%x)\n", -- cgit v1.2.3