Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/38002 )
Change subject: drivers/ipmi: Add Supermicro OEM commands ......................................................................
drivers/ipmi: Add Supermicro OEM commands
Add a new driver for OEM commands an select if from x11-lga1151-series.
The driver communicates the BIOS version and date to the BMC using OEM commands. The command should be supported on all X11 series, but might work with older BMC, too.
Tested on X11SSH-TF: The BIOS version strings are updated on boot and are visible in the BMC web UI.
Change-Id: I51c22f83383affb70abb0efbcdc33ea925b5ff9f Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M src/drivers/ipmi/Kconfig M src/drivers/ipmi/Makefile.inc M src/drivers/ipmi/ipmi_kcs_ops.c A src/drivers/ipmi/ipmi_supermicro_oem.h A src/drivers/ipmi/supermicro_oem.c M src/mainboard/supermicro/x11-lga1151-series/Kconfig 6 files changed, 121 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/02/38002/1
diff --git a/src/drivers/ipmi/Kconfig b/src/drivers/ipmi/Kconfig index 0f7152d..e098bc8 100644 --- a/src/drivers/ipmi/Kconfig +++ b/src/drivers/ipmi/Kconfig @@ -8,3 +8,14 @@ depends on IPMI_KCS help KCS status and command register IO port address spacing + +config DRIVER_SUPERMICRO_IPMI_OEM + bool "Supermicro IPMI OEM BMC support" + depends on IPMI_KCS + default n + help + Tested on X11SSH only. Different BMCs might have different OEM + commands. + The following features are implemented: + * Communicates the BIOS version to the BMC + * Communicates the BIOS date to the BMC diff --git a/src/drivers/ipmi/Makefile.inc b/src/drivers/ipmi/Makefile.inc index 9d5b3d4..9fccccf 100644 --- a/src/drivers/ipmi/Makefile.inc +++ b/src/drivers/ipmi/Makefile.inc @@ -1,3 +1,4 @@ ramstage-$(CONFIG_IPMI_KCS) += ipmi_kcs.c ramstage-$(CONFIG_IPMI_KCS) += ipmi_kcs_ops.c ramstage-$(CONFIG_IPMI_KCS) += ipmi_ops.c +ramstage-$(CONFIG_DRIVER_SUPERMICRO_IPMI_OEM) += supermicro_oem.c diff --git a/src/drivers/ipmi/ipmi_kcs_ops.c b/src/drivers/ipmi/ipmi_kcs_ops.c index 5cb8995..ba8487f 100644 --- a/src/drivers/ipmi/ipmi_kcs_ops.c +++ b/src/drivers/ipmi/ipmi_kcs_ops.c @@ -34,6 +34,7 @@ #include <delay.h> #include <timer.h> #include "ipmi_kcs.h" +#include "ipmi_supermicro_oem.h" #include "chip.h"
/* 4 bit encoding */ @@ -170,6 +171,12 @@ /* Don't write tables if communication failed */ dev->enabled = 0; } + + if (!dev->enabled) + return; + + if (CONFIG(DRIVER_SUPERMICRO_IPMI_OEM)) + supermicro_ipmi_oem(dev->path.pnp.port); }
#if CONFIG(HAVE_ACPI_TABLES) diff --git a/src/drivers/ipmi/ipmi_supermicro_oem.h b/src/drivers/ipmi/ipmi_supermicro_oem.h new file mode 100644 index 0000000..742b97d --- /dev/null +++ b/src/drivers/ipmi/ipmi_supermicro_oem.h @@ -0,0 +1,20 @@ +/* + * This file is part of the coreboot project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; version 2 of + * the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef __IPMI_SUPERMICRO_OEM_H +#define __IPMI_SUPERMICRO_OEM_H + +void supermicro_ipmi_oem(const uint16_t kcs_port); + +#endif /* __IPMI_SUPERMICRO_OEM_H */ diff --git a/src/drivers/ipmi/supermicro_oem.c b/src/drivers/ipmi/supermicro_oem.c new file mode 100644 index 0000000..ea01fef --- /dev/null +++ b/src/drivers/ipmi/supermicro_oem.c @@ -0,0 +1,81 @@ +/* + * This file is part of the coreboot project. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <types.h> + +#include <console/console.h> +#include <drivers/ipmi/ipmi_kcs.h> +#include <string.h> +#include <build.h> +#include "ipmi_supermicro_oem.h" + +#define IPMI_NETFN_OEM 0x30 +#define IPMI_LUN0_AC_SET_BIOS_VER 0x100 +#define IPMI_LUN0_AC_SET_BIOS_DATE 0x101 +#define IPMI_LUN0_SET_BIOS_STRING 0xac + +struct ipmi_oem_set_bios_str { + uint16_t ver; + char str[16]; // NULL terminated string +} __packed; + +static void set_coreboot_ver(const uint16_t kcs_port) +{ + const char *coreboot_ver = COREBOOT_VERSION; + struct ipmi_oem_set_bios_str bios_ver; + struct ipmi_rsp rsp; + int ret; + size_t i; + + /* Only 8 charactars are visible in UI. Cut of on first dash */ + for (i = 0; i < 15; i++) { + if (coreboot_ver[i] == '-') + break; + bios_ver.str[i] = coreboot_ver[i]; + } + bios_ver.str[i] = 0; + bios_ver.ver = IPMI_LUN0_AC_SET_BIOS_VER; + + ret = ipmi_kcs_message(kcs_port, IPMI_NETFN_OEM, 0, IPMI_LUN0_SET_BIOS_STRING, + (const unsigned char *) &bios_ver, sizeof(bios_ver), + (unsigned char *) &rsp, sizeof(rsp)); + if (ret < sizeof(rsp) || rsp.completion_code) { + printk(BIOS_ERR, "BMC_IPMI: %s command failed (ret=%d resp=0x%x)\n", + __func__, ret, rsp.completion_code); + } +} + +static void set_coreboot_date(const uint16_t kcs_port) +{ + struct ipmi_oem_set_bios_str bios_ver; + struct ipmi_rsp rsp; + int ret; + + strncpy(bios_ver.str, COREBOOT_DMI_DATE, 15); + bios_ver.str[15] = 0; + bios_ver.ver = IPMI_LUN0_AC_SET_BIOS_DATE; + + ret = ipmi_kcs_message(kcs_port, IPMI_NETFN_OEM, 0, IPMI_LUN0_SET_BIOS_STRING, + (const unsigned char *) &bios_ver, sizeof(bios_ver), + (unsigned char *) &rsp, sizeof(rsp)); + if (ret < sizeof(rsp) || rsp.completion_code) { + printk(BIOS_ERR, "BMC_IPMI: %s command failed (ret=%d resp=0x%x)\n", + __func__, ret, rsp.completion_code); + } +} + +void supermicro_ipmi_oem(const uint16_t kcs_port) +{ + set_coreboot_ver(kcs_port); + set_coreboot_date(kcs_port); +} diff --git a/src/mainboard/supermicro/x11-lga1151-series/Kconfig b/src/mainboard/supermicro/x11-lga1151-series/Kconfig index 5a99f7a..53ae398 100644 --- a/src/mainboard/supermicro/x11-lga1151-series/Kconfig +++ b/src/mainboard/supermicro/x11-lga1151-series/Kconfig @@ -12,6 +12,7 @@ select SUPERIO_ASPEED_AST2400 select GENERATE_SMBIOS_TABLES select IPMI_KCS + select DRIVER_SUPERMICRO_IPMI_OEM select MAINBOARD_NO_FSP_GOP select SUPERIO_ASPEED_HAS_UART_DELAY_WORKAROUND select NO_FADT_8042
HAOUAS Elyes has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38002 )
Change subject: drivers/ipmi: Add Supermicro OEM commands ......................................................................
Patch Set 1:
(1 comment)
https://review.coreboot.org/c/coreboot/+/38002/1/src/drivers/ipmi/ipmi_super... File src/drivers/ipmi/ipmi_supermicro_oem.h:
https://review.coreboot.org/c/coreboot/+/38002/1/src/drivers/ipmi/ipmi_super... PS1, Line 18: uint16_t <stdint.h> ?
Michael Niewöhner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38002 )
Change subject: drivers/ipmi: Add Supermicro OEM commands ......................................................................
Patch Set 1:
(1 comment)
https://review.coreboot.org/c/coreboot/+/38002/1/src/mainboard/supermicro/x1... File src/mainboard/supermicro/x11-lga1151-series/Kconfig:
https://review.coreboot.org/c/coreboot/+/38002/1/src/mainboard/supermicro/x1... PS1, Line 15: select DRIVER_SUPERMICRO_IPMI_OEM not sure if that should be a user selectable option. there are people using openbmc/u-bmc/...
Hello Michael Niewöhner, Christian Walter, build bot (Jenkins), Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/38002
to look at the new patch set (#2).
Change subject: drivers/ipmi: Add Supermicro OEM commands ......................................................................
drivers/ipmi: Add Supermicro OEM commands
Add a new driver for OEM commands and select it from x11-lga1151-series.
The driver communicates the BIOS version and date to the BMC using OEM commands. The command should be supported on all X11 series mainboards, but might work with older BMC, too.
Tested on X11SSH-TF: The BIOS version strings are updated on boot and are visible in the BMC web UI.
Change-Id: I51c22f83383affb70abb0efbcdc33ea925b5ff9f Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M src/drivers/ipmi/Kconfig M src/drivers/ipmi/Makefile.inc M src/drivers/ipmi/ipmi_kcs_ops.c A src/drivers/ipmi/ipmi_supermicro_oem.h A src/drivers/ipmi/supermicro_oem.c M src/mainboard/supermicro/x11-lga1151-series/Kconfig 6 files changed, 124 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/02/38002/2
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38002 )
Change subject: drivers/ipmi: Add Supermicro OEM commands ......................................................................
Patch Set 2:
(1 comment)
https://review.coreboot.org/c/coreboot/+/38002/1/src/mainboard/supermicro/x1... File src/mainboard/supermicro/x11-lga1151-series/Kconfig:
https://review.coreboot.org/c/coreboot/+/38002/1/src/mainboard/supermicro/x1... PS1, Line 15: select DRIVER_SUPERMICRO_IPMI_OEM
not sure if that should be a user selectable option. there are people using openbmc/u-bmc/...
I would expect openbmc/u-bmc would implement the same interface to be compatible with all host firmwares out there.
Made it user selectable.
Philipp Deppenwiese has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38002 )
Change subject: drivers/ipmi: Add Supermicro OEM commands ......................................................................
Patch Set 2: Code-Review+2
Michael Niewöhner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38002 )
Change subject: drivers/ipmi: Add Supermicro OEM commands ......................................................................
Patch Set 2: Code-Review+1
Hello Michael Niewöhner, Christian Walter, Philipp Deppenwiese, build bot (Jenkins), Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/38002
to look at the new patch set (#3).
Change subject: drivers/ipmi: Add Supermicro OEM commands ......................................................................
drivers/ipmi: Add Supermicro OEM commands
Add a new driver for OEM commands and select it from x11-lga1151-series.
The driver communicates the BIOS version and date to the BMC using OEM commands. The command should be supported on all X11 series mainboards, but might work with older BMC, too.
Tested on X11SSH-TF: The BIOS version strings are updated on boot and are visible in the BMC web UI.
Change-Id: I51c22f83383affb70abb0efbcdc33ea925b5ff9f Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M src/drivers/ipmi/Kconfig M src/drivers/ipmi/Makefile.inc M src/drivers/ipmi/ipmi_kcs_ops.c A src/drivers/ipmi/ipmi_supermicro_oem.h A src/drivers/ipmi/supermicro_oem.c M src/mainboard/supermicro/x11-lga1151-series/Kconfig 6 files changed, 126 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/02/38002/3
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38002 )
Change subject: drivers/ipmi: Add Supermicro OEM commands ......................................................................
Patch Set 3:
(1 comment)
https://review.coreboot.org/c/coreboot/+/38002/1/src/drivers/ipmi/ipmi_super... File src/drivers/ipmi/ipmi_supermicro_oem.h:
https://review.coreboot.org/c/coreboot/+/38002/1/src/drivers/ipmi/ipmi_super... PS1, Line 18: uint16_t
<stdint. […]
Done
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38002 )
Change subject: drivers/ipmi: Add Supermicro OEM commands ......................................................................
Patch Set 3:
(1 comment)
https://review.coreboot.org/c/coreboot/+/38002/3/src/drivers/ipmi/Kconfig File src/drivers/ipmi/Kconfig:
https://review.coreboot.org/c/coreboot/+/38002/3/src/drivers/ipmi/Kconfig@17 PS3, Line 17: this these
Michael Niewöhner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38002 )
Change subject: drivers/ipmi: Add Supermicro OEM commands ......................................................................
Patch Set 3: Code-Review+1
Christian Walter has uploaded a new patch set (#4) to the change originally created by Patrick Rudolph. ( https://review.coreboot.org/c/coreboot/+/38002 )
Change subject: drivers/ipmi: Add Supermicro OEM commands ......................................................................
drivers/ipmi: Add Supermicro OEM commands
Add a new driver for OEM commands and select it from x11-lga1151-series.
The driver communicates the BIOS version and date to the BMC using OEM commands. The command should be supported on all X11 series mainboards, but might work with older BMC, too.
Tested on X11SSH-TF: The BIOS version strings are updated on boot and are visible in the BMC web UI.
Change-Id: I51c22f83383affb70abb0efbcdc33ea925b5ff9f Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com Signed-off-by: Christian Walter christian.walter@9elements.com --- M src/drivers/ipmi/Kconfig M src/drivers/ipmi/Makefile.inc M src/drivers/ipmi/ipmi_kcs_ops.c A src/drivers/ipmi/ipmi_supermicro_oem.h A src/drivers/ipmi/supermicro_oem.c M src/mainboard/supermicro/x11-lga1151-series/Kconfig 6 files changed, 126 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/02/38002/4
Christian Walter has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38002 )
Change subject: drivers/ipmi: Add Supermicro OEM commands ......................................................................
Patch Set 4:
(1 comment)
https://review.coreboot.org/c/coreboot/+/38002/3/src/drivers/ipmi/Kconfig File src/drivers/ipmi/Kconfig:
https://review.coreboot.org/c/coreboot/+/38002/3/src/drivers/ipmi/Kconfig@17 PS3, Line 17: this
these
Ack
Michael Niewöhner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38002 )
Change subject: drivers/ipmi: Add Supermicro OEM commands ......................................................................
Patch Set 4: Code-Review+2
(1 comment)
https://review.coreboot.org/c/coreboot/+/38002/4/src/drivers/ipmi/Kconfig File src/drivers/ipmi/Kconfig:
https://review.coreboot.org/c/coreboot/+/38002/4/src/drivers/ipmi/Kconfig@22 PS4, Line 22: DRIVERS_SUPERMICRO_IPMI_OEM we should rename that to IPMI_SUPERMICRO_OEM or IPMI_OEM_SUPERMICRO
Jonathan Zhang has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38002 )
Change subject: drivers/ipmi: Add Supermicro OEM commands ......................................................................
Patch Set 4: Code-Review-1
The functionality of sending host firmware version and date to OpenBMC is not supermicro specific, it is also needed on other servers, such as OCP Delta Lake server. Because the IPMI command is OEM specific, so the LUN#, cmd/rsp format could be different between supermicro server and OCP servers. This patch as-is is good, but I suppose we could do even better. Let's find a design to support both.
Tim, could you reply back with OCP Delta Lake IPMI OEM command details for sending host firmware version and date? Also test the (revised) patch on Delta Lake? Note that in our case, BIOS version is set through [CB:42029].
Tim, please also check the comments for [CB:41605].
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38002 )
Change subject: drivers/ipmi: Add Supermicro OEM commands ......................................................................
Patch Set 4:
(1 comment)
https://review.coreboot.org/c/coreboot/+/38002/4/src/drivers/ipmi/Kconfig File src/drivers/ipmi/Kconfig:
https://review.coreboot.org/c/coreboot/+/38002/4/src/drivers/ipmi/Kconfig@22 PS4, Line 22: DRIVERS_SUPERMICRO_IPMI_OEM
we should rename that to IPMI_SUPERMICRO_OEM or IPMI_OEM_SUPERMICRO
DRIVERS_IPMI_SUPERMICRO_OEM
Tim Chu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38002 )
Change subject: drivers/ipmi: Add Supermicro OEM commands ......................................................................
Patch Set 4:
Patch Set 4: Code-Review-1
The functionality of sending host firmware version and date to OpenBMC is not supermicro specific, it is also needed on other servers, such as OCP Delta Lake server. Because the IPMI command is OEM specific, so the LUN#, cmd/rsp format could be different between supermicro server and OCP servers. This patch as-is is good, but I suppose we could do even better. Let's find a design to support both.
Tim, could you reply back with OCP Delta Lake IPMI OEM command details for sending host firmware version and date? Also test the (revised) patch on Delta Lake? Note that in our case, BIOS version is set through [CB:42029].
Tim, please also check the comments for [CB:41605].
I think this patch can do like I've done in [CB:41605 and CB:42242]. Not put supermicro specific function with common function together but divide them into two parts.
Jonathan, you mean adding new function to send host firmware version and date in deltalake?
Jonathan Zhang has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38002 )
Change subject: drivers/ipmi: Add Supermicro OEM commands ......................................................................
Patch Set 4: Code-Review+1
Patch Set 4:
Patch Set 4: Code-Review-1
The functionality of sending host firmware version and date to OpenBMC is not supermicro specific, it is also needed on other servers, such as OCP Delta Lake server. Because the IPMI command is OEM specific, so the LUN#, cmd/rsp format could be different between supermicro server and OCP servers. This patch as-is is good, but I suppose we could do even better. Let's find a design to support both.
Tim, could you reply back with OCP Delta Lake IPMI OEM command details for sending host firmware version and date? Also test the (revised) patch on Delta Lake? Note that in our case, BIOS version is set through [CB:42029].
Tim, please also check the comments for [CB:41605].
I think this patch can do like I've done in [CB:41605 and CB:42242]. Not put supermicro specific function with common function together but divide them into two parts.
Jonathan, you mean adding new function to send host firmware version and date in deltalake?
I take my comment back. For OCP server OSF design, one principal is to make coreboot as slim as possible, any functionality that can be done in Linuxboot is supported in Linuxboot. This includes the IPMI command to send FW version and build date to BMC.
Michael Niewöhner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38002 )
Change subject: drivers/ipmi: Add Supermicro OEM commands ......................................................................
Patch Set 4:
(1 comment)
https://review.coreboot.org/c/coreboot/+/38002/4/src/drivers/ipmi/Kconfig File src/drivers/ipmi/Kconfig:
https://review.coreboot.org/c/coreboot/+/38002/4/src/drivers/ipmi/Kconfig@22 PS4, Line 22: DRIVERS_SUPERMICRO_IPMI_OEM
DRIVERS_IPMI_SUPERMICRO_OEM
well, then the others should get adapted in a follow-up probably (IPMI_KCS -> DRIVERS_IPMI_KCS)
Hello Philipp Deppenwiese, build bot (Jenkins), Martin Roth, Jonathan Zhang, Tristan Corrick, Jonathan Kollasch, Johnny Lin, Christian Walter, Michael Niewöhner, Tim Chu,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/38002
to look at the new patch set (#5).
Change subject: drivers/ipmi: Add Supermicro OEM commands ......................................................................
drivers/ipmi: Add Supermicro OEM commands
Add a new driver for OEM commands and select it from x11-lga1151-series.
The driver communicates the BIOS version and date to the BMC using OEM commands. The command should be supported on all X11 series mainboards, but might work with older BMC, too.
Tested on X11SSH-TF: The BIOS version strings are updated on boot and are visible in the BMC web UI.
Change-Id: I51c22f83383affb70abb0efbcdc33ea925b5ff9f Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com Signed-off-by: Christian Walter christian.walter@9elements.com --- M src/drivers/ipmi/Kconfig M src/drivers/ipmi/Makefile.inc M src/drivers/ipmi/ipmi_kcs_ops.c A src/drivers/ipmi/ipmi_supermicro_oem.h A src/drivers/ipmi/supermicro_oem.c M src/mainboard/supermicro/x11-lga1151-series/Kconfig 6 files changed, 103 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/02/38002/5
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38002 )
Change subject: drivers/ipmi: Add Supermicro OEM commands ......................................................................
Patch Set 5:
(1 comment)
https://review.coreboot.org/c/coreboot/+/38002/4/src/drivers/ipmi/Kconfig File src/drivers/ipmi/Kconfig:
https://review.coreboot.org/c/coreboot/+/38002/4/src/drivers/ipmi/Kconfig@22 PS4, Line 22: DRIVERS_SUPERMICRO_IPMI_OEM
well, then the others should get adapted in a follow-up probably (IPMI_KCS -> DRIVERS_IPMI_KCS)
Done
Michael Niewöhner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38002 )
Change subject: drivers/ipmi: Add Supermicro OEM commands ......................................................................
Patch Set 5: Code-Review+2
Hung-Te Lin has submitted this change. ( https://review.coreboot.org/c/coreboot/+/38002 )
Change subject: drivers/ipmi: Add Supermicro OEM commands ......................................................................
drivers/ipmi: Add Supermicro OEM commands
Add a new driver for OEM commands and select it from x11-lga1151-series.
The driver communicates the BIOS version and date to the BMC using OEM commands. The command should be supported on all X11 series mainboards, but might work with older BMC, too.
Tested on X11SSH-TF: The BIOS version strings are updated on boot and are visible in the BMC web UI.
Change-Id: I51c22f83383affb70abb0efbcdc33ea925b5ff9f Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com Signed-off-by: Christian Walter christian.walter@9elements.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/38002 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Michael Niewöhner foss@mniewoehner.de --- M src/drivers/ipmi/Kconfig M src/drivers/ipmi/Makefile.inc M src/drivers/ipmi/ipmi_kcs_ops.c A src/drivers/ipmi/ipmi_supermicro_oem.h A src/drivers/ipmi/supermicro_oem.c M src/mainboard/supermicro/x11-lga1151-series/Kconfig 6 files changed, 103 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Michael Niewöhner: Looks good to me, approved
diff --git a/src/drivers/ipmi/Kconfig b/src/drivers/ipmi/Kconfig index 1137dcf..012f678 100644 --- a/src/drivers/ipmi/Kconfig +++ b/src/drivers/ipmi/Kconfig @@ -42,3 +42,14 @@ 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. + +config DRIVERS_IPMI_SUPERMICRO_OEM + bool "Supermicro IPMI OEM BMC support" + depends on IPMI_KCS + default n + help + Tested on X11SSH only. Different BMCs might not support these OEM + commands. + The following features are implemented: + * Communicates the BIOS version to the BMC + * Communicates the BIOS date to the BMC diff --git a/src/drivers/ipmi/Makefile.inc b/src/drivers/ipmi/Makefile.inc index 06a3433..e4bcf31 100644 --- a/src/drivers/ipmi/Makefile.inc +++ b/src/drivers/ipmi/Makefile.inc @@ -2,6 +2,7 @@ ramstage-$(CONFIG_IPMI_KCS) += ipmi_kcs_ops.c ramstage-$(CONFIG_IPMI_KCS) += ipmi_ops.c ramstage-$(CONFIG_IPMI_KCS) += ipmi_fru.c +ramstage-$(CONFIG_DRIVERS_IPMI_SUPERMICRO_OEM) += supermicro_oem.c romstage-$(CONFIG_IPMI_KCS_ROMSTAGE) += ipmi_kcs_ops_premem.c romstage-$(CONFIG_IPMI_KCS_ROMSTAGE) += ipmi_kcs.c romstage-$(CONFIG_IPMI_KCS_ROMSTAGE) += ipmi_ops.c diff --git a/src/drivers/ipmi/ipmi_kcs_ops.c b/src/drivers/ipmi/ipmi_kcs_ops.c index 640bfa1..38311ee 100644 --- a/src/drivers/ipmi/ipmi_kcs_ops.c +++ b/src/drivers/ipmi/ipmi_kcs_ops.c @@ -23,6 +23,7 @@ #include <delay.h> #include <timer.h> #include "ipmi_kcs.h" +#include "ipmi_supermicro_oem.h" #include "chip.h"
/* 4 bit encoding */ @@ -167,6 +168,12 @@ /* Don't write tables if communication failed */ dev->enabled = 0; } + + if (!dev->enabled) + return; + + if (CONFIG(DRIVERS_IPMI_SUPERMICRO_OEM)) + supermicro_ipmi_oem(dev->path.pnp.port); }
#if CONFIG(HAVE_ACPI_TABLES) diff --git a/src/drivers/ipmi/ipmi_supermicro_oem.h b/src/drivers/ipmi/ipmi_supermicro_oem.h new file mode 100644 index 0000000..5babadb --- /dev/null +++ b/src/drivers/ipmi/ipmi_supermicro_oem.h @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef __IPMI_SUPERMICRO_OEM_H +#define __IPMI_SUPERMICRO_OEM_H + +#include <stdint.h> + +void supermicro_ipmi_oem(const uint16_t kcs_port); + +#endif /* __IPMI_SUPERMICRO_OEM_H */ diff --git a/src/drivers/ipmi/supermicro_oem.c b/src/drivers/ipmi/supermicro_oem.c new file mode 100644 index 0000000..87b7fe2 --- /dev/null +++ b/src/drivers/ipmi/supermicro_oem.c @@ -0,0 +1,70 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <types.h> + +#include <console/console.h> +#include <drivers/ipmi/ipmi_kcs.h> +#include <string.h> +#include <build.h> +#include "ipmi_supermicro_oem.h" + +#define IPMI_NETFN_OEM 0x30 +#define IPMI_LUN0_AC_SET_BIOS_VER 0x100 +#define IPMI_LUN0_AC_SET_BIOS_DATE 0x101 +#define IPMI_LUN0_SET_BIOS_STRING 0xac + +struct ipmi_oem_set_bios_str { + uint16_t ver; + char str[16]; // NULL terminated string +} __packed; + +static void set_coreboot_ver(const uint16_t kcs_port) +{ + const char *coreboot_ver = COREBOOT_VERSION; + struct ipmi_oem_set_bios_str bios_ver; + struct ipmi_rsp rsp; + int ret; + size_t i; + + /* Only 8 charactars are visible in UI. Cut of on first dash */ + for (i = 0; i < 15; i++) { + if (coreboot_ver[i] == '-') + break; + bios_ver.str[i] = coreboot_ver[i]; + } + bios_ver.str[i] = 0; + bios_ver.ver = IPMI_LUN0_AC_SET_BIOS_VER; + + ret = ipmi_kcs_message(kcs_port, IPMI_NETFN_OEM, 0, IPMI_LUN0_SET_BIOS_STRING, + (const unsigned char *) &bios_ver, sizeof(bios_ver), + (unsigned char *) &rsp, sizeof(rsp)); + if (ret < sizeof(rsp) || rsp.completion_code) { + printk(BIOS_ERR, "BMC_IPMI: %s command failed (ret=%d resp=0x%x)\n", + __func__, ret, rsp.completion_code); + } +} + +static void set_coreboot_date(const uint16_t kcs_port) +{ + struct ipmi_oem_set_bios_str bios_ver; + struct ipmi_rsp rsp; + int ret; + + strncpy(bios_ver.str, COREBOOT_DMI_DATE, 15); + bios_ver.str[15] = 0; + bios_ver.ver = IPMI_LUN0_AC_SET_BIOS_DATE; + + ret = ipmi_kcs_message(kcs_port, IPMI_NETFN_OEM, 0, IPMI_LUN0_SET_BIOS_STRING, + (const unsigned char *) &bios_ver, sizeof(bios_ver), + (unsigned char *) &rsp, sizeof(rsp)); + if (ret < sizeof(rsp) || rsp.completion_code) { + printk(BIOS_ERR, "BMC_IPMI: %s command failed (ret=%d resp=0x%x)\n", + __func__, ret, rsp.completion_code); + } +} + +void supermicro_ipmi_oem(const uint16_t kcs_port) +{ + set_coreboot_ver(kcs_port); + set_coreboot_date(kcs_port); +} diff --git a/src/mainboard/supermicro/x11-lga1151-series/Kconfig b/src/mainboard/supermicro/x11-lga1151-series/Kconfig index 5e9b645..533899d 100644 --- a/src/mainboard/supermicro/x11-lga1151-series/Kconfig +++ b/src/mainboard/supermicro/x11-lga1151-series/Kconfig @@ -63,6 +63,10 @@ string default "src/mainboard/$(CONFIG_MAINBOARD_DIR)/vboot-ro-rwab.fmd" if VBOOT_SLOTS_RW_AB
+config DRIVERS_IPMI_SUPERMICRO_OEM + bool + default y + config CBFS_SIZE hex default 0xb00000