drivers/ipmi: Add CONFIG_IPMI_KCS_TIMEOUT_MS for IPMI KCS timeout value

With the current timeout of 1000 cycles of 100 microsecond would see
timeout occurs on OCP Delta Lake if the log level is set to values
smaller than 8. Because the prink(BIOS_SPEW, ..) in ipmi_kcs_status()
creates delay and avoid the problem, but after setting the log level
to 4 we see some timeout occurs.

The unit is millisecond and the default value is set to 5000 according
to IPMI spec v2.0 rev 1.1 Sec. 9.15, a five-second timeout or greater
is recommended.

Tested=On OCP Delta Lake, with log level 4 cannot observe timeout
occurs.

Original-Change-Id: I42ede1d9200bb5d0dbb455d2ff66e2816f10e86b
Original-Signed-off-by: Johnny Lin <johnny_lin@wiwynn.com>
Original-Reviewed-on: https://review.coreboot.org/c/coreboot/+/45103
Original-Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Original-Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Original-Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Original-Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
(cherry picked from commit d04c06b472)

Change-Id: I7046467d41e1feddb07081964466c8189321cb1d
Signed-off-by: Marc Jones <marcj303@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/55769
Reviewed-by: Martin Roth <martinroth@google.com>
Reviewed-by: Jay Talbott <JayTalbott@sysproconsulting.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Johnny Lin 2020-09-04 17:05:58 +08:00 committed by Werner Zeh
parent e7a126fbc2
commit 2953527a67
2 changed files with 22 additions and 18 deletions

View File

@ -18,3 +18,12 @@ config IPMI_FRU_SINGLE_RW_SZ
IPMB messages are limited to 32-bytes total. When the IPMB messages are limited to 32-bytes total. When the
data size is larger than this value, IPMI can complete data size is larger than this value, IPMI can complete
reading/writing the data over multiple commands. reading/writing the data over multiple commands.
config IPMI_KCS_TIMEOUT_MS
int
default 5000
depends on IPMI_KCS
help
The time unit is millisecond for each IPMI KCS transfer.
IPMI spec v2.0 rev 1.1 Sec. 9.15, a five-second timeout or
greater is recommended.

View File

@ -15,7 +15,7 @@
#include <console/console.h> #include <console/console.h>
#include <device/device.h> #include <device/device.h>
#include <arch/io.h> #include <arch/io.h>
#include <delay.h> #include <timer.h>
#include "ipmi_kcs.h" #include "ipmi_kcs.h"
#define IPMI_KCS_STATE(_x) ((_x) >> 6) #define IPMI_KCS_STATE(_x) ((_x) >> 6)
@ -48,27 +48,22 @@ static unsigned char ipmi_kcs_status(int port)
static int wait_ibf_timeout(int port) static int wait_ibf_timeout(int port)
{ {
int timeout = 1000; if (!wait_ms(CONFIG_IPMI_KCS_TIMEOUT_MS, !(ipmi_kcs_status(port) & IPMI_KCS_IBF))) {
do {
if (!(ipmi_kcs_status(port) & IPMI_KCS_IBF))
return 0;
udelay(100);
} while (timeout--);
printk(BIOS_ERR, "wait_ibf timeout!\n"); printk(BIOS_ERR, "wait_ibf timeout!\n");
return timeout; return 1;
} else {
return 0;
}
} }
static int wait_obf_timeout(int port) static int wait_obf_timeout(int port)
{ {
int timeout = 1000; if (!wait_ms(CONFIG_IPMI_KCS_TIMEOUT_MS, (ipmi_kcs_status(port) & IPMI_KCS_OBF))) {
do {
if ((ipmi_kcs_status(port) & IPMI_KCS_OBF))
return 0;
udelay(100);
} while (timeout--);
printk(BIOS_ERR, "wait_obf timeout!\n"); printk(BIOS_ERR, "wait_obf timeout!\n");
return timeout; return 1;
} else {
return 0;
}
} }