summaryrefslogtreecommitdiff
path: root/src/drivers/ipmi
diff options
context:
space:
mode:
authorwanghao11 <wanghao11@inspur.com>2022-07-25 10:08:43 +0800
committerFelix Held <felix-coreboot@felixheld.de>2022-12-06 15:20:18 +0000
commitf38992e608fe972f687a0d80b3654209efbf3c1d (patch)
treebeb4c85a56f1ea77e6d9f1cbe7229d0672061748 /src/drivers/ipmi
parent9c4ae9131ce5f391c97f9ce4f78fce0e1697d9b1 (diff)
drivers/ipmi: Retry ipmi_get_device_id in ipmi_kcs_init
Add retry up to 10 seconds maximal in ipmi_get_device_id. Without this retry, on OCP Craterlake with BMC version v2022.28.1, there's a chance that ipmi_get_device_id failed then ipmi device won't be enabled. Change-Id: I2b972c905fb0f8223570212432a4a10bd715f3f7 Signed-off-by: Yiwei Tang <tangyiwei.2022@bytedance.com> Signed-off-by: Johnny Lin <johnny_lin@wiwynn.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/69310 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Jonathan Zhang <jonzhang@fb.com>
Diffstat (limited to 'src/drivers/ipmi')
-rw-r--r--src/drivers/ipmi/ipmi_kcs_ops.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/src/drivers/ipmi/ipmi_kcs_ops.c b/src/drivers/ipmi/ipmi_kcs_ops.c
index 28ced49f53..2e5378f07a 100644
--- a/src/drivers/ipmi/ipmi_kcs_ops.c
+++ b/src/drivers/ipmi/ipmi_kcs_ops.c
@@ -28,6 +28,8 @@
#include "ipmi_supermicro_oem.h"
#include "chip.h"
+#define IPMI_GET_DID_RETRY_MS 10000
+
/* 4 bit encoding */
static u8 ipmi_revision_major = 0x1;
static u8 ipmi_revision_minor = 0x0;
@@ -112,35 +114,34 @@ static void ipmi_kcs_init(struct device *dev)
}
}
- if (ipmi_process_self_test_result(dev))
+ if (ipmi_process_self_test_result(dev)) {
/* Don't write tables if communication failed */
dev->enabled = 0;
+ return;
+ }
- if (!ipmi_get_device_id(dev, &rsp)) {
- /* Queried the IPMI revision from BMC */
- ipmi_revision_minor = IPMI_IPMI_VERSION_MINOR(rsp.ipmi_version);
- ipmi_revision_major = IPMI_IPMI_VERSION_MAJOR(rsp.ipmi_version);
+ if (!wait_ms(IPMI_GET_DID_RETRY_MS, !ipmi_get_device_id(dev, &rsp))) {
+ printk(BIOS_ERR, "IPMI: BMC does not respond to get device id even "
+ "after %d ms.\n", IPMI_GET_DID_RETRY_MS);
+ dev->enabled = 0;
+ return;
+ }
- bmc_revision_major = rsp.fw_rev1;
- bmc_revision_minor = rsp.fw_rev2;
+ /* Queried the IPMI revision from BMC */
+ ipmi_revision_minor = IPMI_IPMI_VERSION_MINOR(rsp.ipmi_version);
+ ipmi_revision_major = IPMI_IPMI_VERSION_MAJOR(rsp.ipmi_version);
- memcpy(&man_id, rsp.manufacturer_id,
- sizeof(rsp.manufacturer_id));
+ bmc_revision_major = rsp.fw_rev1;
+ bmc_revision_minor = rsp.fw_rev2;
- memcpy(&prod_id, rsp.product_id, sizeof(rsp.product_id));
+ memcpy(&man_id, rsp.manufacturer_id, sizeof(rsp.manufacturer_id));
- printk(BIOS_INFO, "IPMI: Found man_id 0x%06x, prod_id 0x%04x\n",
- man_id, prod_id);
+ memcpy(&prod_id, rsp.product_id, sizeof(rsp.product_id));
- printk(BIOS_INFO, "IPMI: Version %01x.%01x\n",
- ipmi_revision_major, ipmi_revision_minor);
- } else {
- /* Don't write tables if communication failed */
- dev->enabled = 0;
- }
+ printk(BIOS_INFO, "IPMI: Found man_id 0x%06x, prod_id 0x%04x\n", man_id, prod_id);
- if (!dev->enabled)
- return;
+ printk(BIOS_INFO, "IPMI: Version %01x.%01x\n", ipmi_revision_major,
+ ipmi_revision_minor);
if (CONFIG(DRIVERS_IPMI_SUPERMICRO_OEM))
supermicro_ipmi_oem(dev->path.pnp.port);