diff options
author | Johnny Lin <johnny_lin@wiwynn.com> | 2021-01-08 15:24:25 +0800 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2021-02-01 08:47:48 +0000 |
commit | 3acea5c51abd09bb578cfb35952b9dbd96be21fe (patch) | |
tree | 9b7536e003e98cd200b18ef3ae7010087131172d /src/mainboard/ocp/deltalake/ipmi.c | |
parent | 86846439113a370b0eab341b50dcd4cf1679b7ec (diff) |
ipmi/ocp: Move common OCP/Facebook IPMI OEM codes into drivers/ipmi/ocp
1. These are common OCP/Facebook IPMI OEM commands, move from mainboard
into drivers/ipmi/ocp to avoid code duplication and provide better
reusability.
2. OCP Tioga Pass enables IPMI_OCP driver.
Tested=On OCP Delta Lake and Tioga Pass verify the commands still work
correctly.
Change-Id: Idd116a89239273fd5cc7b06c7768146085a3ed69
Signed-off-by: Johnny Lin <johnny_lin@wiwynn.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/49235
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Marc Jones <marc@marcjonesconsulting.com>
Diffstat (limited to 'src/mainboard/ocp/deltalake/ipmi.c')
-rw-r--r-- | src/mainboard/ocp/deltalake/ipmi.c | 90 |
1 files changed, 1 insertions, 89 deletions
diff --git a/src/mainboard/ocp/deltalake/ipmi.c b/src/mainboard/ocp/deltalake/ipmi.c index 7adbcf2444..90222157e3 100644 --- a/src/mainboard/ocp/deltalake/ipmi.c +++ b/src/mainboard/ocp/deltalake/ipmi.c @@ -3,30 +3,13 @@ #include <console/console.h> #include <drivers/ipmi/ipmi_kcs.h> #include <drivers/ipmi/ipmi_ops.h> +#include <drivers/ipmi/ocp/ipmi_ocp.h> #include <drivers/vpd/vpd.h> #include <string.h> #include "ipmi.h" #include "vpd.h" -enum cb_err ipmi_set_ppin(struct ppin_req *req) -{ - int ret; - struct ipmi_rsp rsp; - - ret = ipmi_kcs_message(CONFIG_BMC_KCS_BASE, 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", - __func__, ret, rsp.completion_code); - return CB_ERR; - } - - return CB_SUCCESS; -} - enum cb_err ipmi_get_pcie_config(uint8_t *pcie_config) { int ret; @@ -75,29 +58,6 @@ enum cb_err ipmi_get_slot_id(uint8_t *slot_id) return CB_SUCCESS; } -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)); - - if (ret < sizeof(struct ipmi_rsp) || rsp.completion_code) { - printk(BIOS_ERR, "IPMI: %s command failed (ret=%d rsp=0x%x)\n", - __func__, ret, rsp.completion_code); - return CB_ERR; - } - if (ret != sizeof(rsp)) { - printk(BIOS_ERR, "IPMI: %s response truncated\n", __func__); - return CB_ERR; - } - - printk(BIOS_DEBUG, "IPMI BMC POST is started\n"); - return CB_SUCCESS; -} - void init_frb2_wdt(void) { uint8_t enable; @@ -135,51 +95,3 @@ void init_frb2_wdt(void) ipmi_stop_bmc_wdt(CONFIG_BMC_KCS_BASE); } } - -enum cb_err ipmi_set_cmos_clear(void) -{ - int ret; - - struct ipmi_oem_rsp { - struct ipmi_rsp resp; - struct boot_order data; - } __packed; - - struct ipmi_oem_rsp rsp; - struct boot_order req; - - /* 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)); - - if (ret < sizeof(struct ipmi_rsp) || rsp.resp.completion_code) { - printk(BIOS_ERR, "IPMI: %s command failed (read ret=%d resp=0x%x)\n", - __func__, ret, rsp.resp.completion_code); - return CB_ERR; - } - - 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)); - - if (ret < sizeof(struct ipmi_rsp) || rsp.resp.completion_code) { - printk(BIOS_ERR, "IPMI: %s command failed (sent ret=%d resp=0x%x)\n", - __func__, ret, rsp.resp.completion_code); - return CB_ERR; - } - - printk(BIOS_INFO, "IPMI CMOS clear requested because CMOS data is invalid.\n"); - - return CB_SUCCESS; - } - - return CB_SUCCESS; -} |