Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/35484 )
Change subject: util/smc: Add and use new tool smcbiosinfo ......................................................................
util/smc: Add and use new tool smcbiosinfo
The BMC and tools interacting with it depend on metadata placed inside the ROM in order the flash the BIOS.
Add a new tool smcbiosinfo, integrate it into the build system, and generate a 128byte metadata file called smcbiosinfo.bin on build.
You need to provide the BoardID for every SMC mainboard through a new Kconfig symbol: SUPERMICRO_BOARDID
Some fields are unknown, but it's sufficient to flash it using SMC vendor tools.
Tested on Supermicro X11SSH: * Flashing using the WebUI works * Flashing using SMCIPMITool works
No further validation is done on the firmware.
Change-Id: Id608c2ce78614b45a2fd0b26d97d666f02223998 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M src/mainboard/supermicro/x11ssh/Kconfig M src/vendorcode/Makefile.inc A src/vendorcode/smc/Makefile.inc A util/smc/smcbiosinfo/Makefile A util/smc/smcbiosinfo/description.md A util/smc/smcbiosinfo/smcbiosinfo.c 6 files changed, 237 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/84/35484/1
diff --git a/src/mainboard/supermicro/x11ssh/Kconfig b/src/mainboard/supermicro/x11ssh/Kconfig index e6f342d..8ee47b8 100644 --- a/src/mainboard/supermicro/x11ssh/Kconfig +++ b/src/mainboard/supermicro/x11ssh/Kconfig @@ -76,4 +76,8 @@ int default 512
+config SUPERMICRO_BOARDID + string + default "089C" + endif # BOARD_SUPERMICRO_BASEBOARD_X11SSH diff --git a/src/vendorcode/Makefile.inc b/src/vendorcode/Makefile.inc index 8ccb0d0..d79fb0b 100644 --- a/src/vendorcode/Makefile.inc +++ b/src/vendorcode/Makefile.inc @@ -4,3 +4,4 @@ subdirs-y += siemens subdirs-y += cavium subdirs-y += eltan +subdirs-y += smc diff --git a/src/vendorcode/smc/Makefile.inc b/src/vendorcode/smc/Makefile.inc new file mode 100644 index 0000000..f1ac3a6 --- /dev/null +++ b/src/vendorcode/smc/Makefile.inc @@ -0,0 +1,19 @@ +ifeq ($(CONFIG_VENDOR_SUPERMICRO),y) +ifneq ($(CONFIG_SUPERMICRO_BOARDID), "") + +SMCBIOSINFOTOOL:=util/smc/smcbiosinfo/smcbiosinfo +cbfs-files-y += smcbiosinfo.bin + +smcbiosinfo.bin-file := $(obj)/mainboard/$(MAINBOARDDIR)/smcbiosinfo.bin +smcbiosinfo.bin-type := raw +smcbiosinfo.bin-compression := none + +$(SMCBIOSINFOTOOL): util/smc/smcbiosinfo/smcbiosinfo.c + printf " MAKE Creating SMCBIOSINFO tool\n" + $(MAKE) -C util/smc/smcbiosinfo + +$(obj)/mainboard/$(MAINBOARDDIR)/smcbiosinfo.bin: util/smc/smcbiosinfo/smcbiosinfo + printf " TOOL Creating SMC BIOSINFO metadata\n" + $(SMCBIOSINFOTOOL) -b $(CONFIG_SUPERMICRO_BOARDID) -o $(top)/$@ +endif +endif diff --git a/util/smc/smcbiosinfo/Makefile b/util/smc/smcbiosinfo/Makefile new file mode 100644 index 0000000..a0901bb --- /dev/null +++ b/util/smc/smcbiosinfo/Makefile @@ -0,0 +1,9 @@ +HOSTCC ?= cc + +smcbiosinfo: smcbiosinfo.c + $(HOSTCC) smcbiosinfo.c -I$(top)/$(obj)/ -o smcbiosinfo + +all: smcbiosinfo + +clean: + @rm -f smcbiosinfo diff --git a/util/smc/smcbiosinfo/description.md b/util/smc/smcbiosinfo/description.md new file mode 100644 index 0000000..21170eb --- /dev/null +++ b/util/smc/smcbiosinfo/description.md @@ -0,0 +1 @@ +Generates SMC biosinfo for BMC BIOS updates `C` diff --git a/util/smc/smcbiosinfo/smcbiosinfo.c b/util/smc/smcbiosinfo/smcbiosinfo.c new file mode 100644 index 0000000..a892b19 --- /dev/null +++ b/util/smc/smcbiosinfo/smcbiosinfo.c @@ -0,0 +1,203 @@ +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2019 9elements Agency GmbH patrick.rudolph@9elements.com + * + * 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 <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <stdint.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <getopt.h> +#include <errno.h> +#include <stdarg.h> +#include "build.h" + +/* Place the following struct somewhere in the ROM: */ +struct SMC_BIOS_Update { + uint32_t magic0; // always 0xaa00b1ed + char magic1[4]; // always $FID + uint16_t magic2; // always 0x7804 + uint8_t space0; // always zero + // SMCinfotool doesn't care for the first letter + // The BMC webinterface does + char boardid[9]; // "100000000" + uint8_t space1[15]; // unknown data + uint8_t space2; // always 0x1f + char ukn_majorVer[2]; + uint8_t space3; // always zero + char ukn_minorVer[2]; + uint8_t space4; // always zero + char majorVer[3]; + char minorVer[2]; + uint8_t space5; // always zero + uint16_t year; + uint8_t month; + uint8_t day; + uint32_t space6; // unknown data + uint8_t space7; // all ones + char str[15]; // "SUPERMSMCI--MB1" + uint8_t space8[3]; // always zero + uint64_t space9[6]; // all ones +} __packed; + +// Unused values: CDEPqR +static const char *optstring = "o:b:h"; + +static struct option long_options[] = { + {"output", required_argument, 0, 'o' }, + {"boardid", required_argument, 0, 'b' }, + {"help", no_argument, 0, 'h' }, +}; + +static void usage(void) +{ + printf("smcbiosinfo: Create BIOSInfo for BMC BIOS updates\n"); + printf("Usage: smcbiosinfo [options] -b <boardid> -o <filename>\n"); + printf("-o | --output <FILE> The file to generate\n"); + printf("-b | --boardid <id> The board ID\n"); + printf("-h | --help Print this help\n"); +} + +static int bcd2int(int hex) +{ + return ((hex & 0xF0) >> 4) * 10 + (hex & 0x0F); +} + +int main(int argc, char **argv) +{ + int c; + int ret = 0; + char *boardid = NULL; + char *filename = NULL; + + while (1) { + int optindex = 0; + + c = getopt_long(argc, argv, optstring, long_options, &optindex); + + if (c == -1) + break; + + switch (c) { + case 'o': + filename = strdup(optarg); + break; + case 'b': + boardid = strdup(optarg); + break; + case 'h': + usage(); + goto out; + default: + break; + } + } + if (!filename) { + fprintf(stderr, "E: Must specify a destination filename\n"); + ret = 1; + goto out; + } + + if (!boardid) { + fprintf(stderr, "E: Must specify a board ID\n"); + ret = 1; + goto out; + } else if (strlen(boardid) > 8) { + fprintf(stderr, "E: Board ID must be less than 8 characters\n"); + ret = 1; + goto out; + } + + // generate the table + + struct SMC_BIOS_Update sbu = { + 0xaa00b1ed, + "$FID", + 0x7804, + 0, // space + "100000000", //boardid + {}, // unknown data + 0x1f, // space + "05", + 0, // zero + "06", + 0, // zero + "000", // major, MSB first + "00", // minor + 0, // zero + bcd2int(COREBOOT_BUILD_YEAR_BCD) + 2000, // year + bcd2int(COREBOOT_BUILD_MONTH_BCD), // month + bcd2int(COREBOOT_BUILD_DAY_BCD), //day + 0, // zero + 0xff, // space + "SUPERMSMCI--MB1", + {0, 0, 0}, // all zero + {~0, ~0, ~0, ~0, ~0, ~0}, // all ones + }; + + if (COREBOOT_MAJOR_VERSION < 999) { + char tmp[4]; + snprintf(tmp, sizeof(tmp), "%03d", COREBOOT_MAJOR_VERSION); + memcpy(&sbu.majorVer, &tmp, sizeof(sbu.majorVer)); + } else { + fprintf(stderr, "E: Unsupported coreboot major version\n"); + ret = 1; + goto out; + } + + if (COREBOOT_MINOR_VERSION < 99) { + char tmp[3]; + snprintf(tmp, sizeof(tmp), "%02d", COREBOOT_MINOR_VERSION); + memcpy(&sbu.minorVer, &tmp, sizeof(sbu.minorVer)); + } else { + fprintf(stderr, "E: Unsupported coreboot minor version\n"); + ret = 1; + goto out; + } + memcpy(&sbu.boardid[1], boardid, strlen(boardid)); + + // write the table + + FILE *fd = fopen(filename, "wb"); + + if (!fd) { + fprintf(stderr, "%s open failed: %s\n", filename, strerror(errno)); + ret = 1; + goto out; + } + + if (fwrite(&sbu, 1, sizeof(sbu), fd) != sizeof(sbu)) { + fprintf(stderr, "%s write failed: %s\n", filename, strerror(errno)); + fclose(fd); + ret = 1; + goto out; + } + + if (fclose(fd)) { + fprintf(stderr, "%s close failed: %s\n", filename, strerror(errno)); + ret = 1; + goto out; + } + +out: + if (boardid) + free(boardid); + if (filename) + free(filename); + + return ret; +}
Hello build bot (Jenkins), Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/35484
to look at the new patch set (#2).
Change subject: util/smc: Add and use new tool smcbiosinfo ......................................................................
util/smc: Add and use new tool smcbiosinfo
The BMC and tools interacting with it depend on metadata placed inside the ROM in order the flash the BIOS.
Add a new tool smcbiosinfo, integrate it into the build system, and generate a 128byte metadata file called smcbiosinfo.bin on build.
You need to provide the BoardID for every SMC mainboard through a new Kconfig symbol: SUPERMICRO_BOARDID
Some fields are unknown, but it's sufficient to flash it using SMC vendor tools.
Tested on Supermicro X11SSH: * Flashing using the WebUI works * Flashing using SMCIPMITool works
No further validation is done on the firmware.
Change-Id: Id608c2ce78614b45a2fd0b26d97d666f02223998 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M Documentation/mainboard/index.md A Documentation/mainboard/supermicro/flashing_on_vendorbmc.md M src/mainboard/supermicro/x11ssh/Kconfig M src/vendorcode/Makefile.inc A src/vendorcode/smc/Makefile.inc A util/smc/smcbiosinfo/Makefile A util/smc/smcbiosinfo/description.md A util/smc/smcbiosinfo/smcbiosinfo.c 8 files changed, 261 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/84/35484/2
Hello build bot (Jenkins), Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/35484
to look at the new patch set (#3).
Change subject: util/smc: Add and use new tool smcbiosinfo ......................................................................
util/smc: Add and use new tool smcbiosinfo
The BMC and tools interacting with it depend on metadata placed inside the ROM in order the flash the BIOS.
Add a new tool smcbiosinfo, integrate it into the build system, and generate a 128byte metadata file called smcbiosinfo.bin on build.
You need to provide the BoardID for every SMC mainboard through a new Kconfig symbol: SUPERMICRO_BOARDID
Some fields are unknown, but it's sufficient to flash it using SMC vendor tools.
Tested on Supermicro X11SSH: * Flashing using the WebUI works * Flashing using SMCIPMITool works
No further validation is done on the firmware.
Change-Id: Id608c2ce78614b45a2fd0b26d97d666f02223998 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M Documentation/mainboard/index.md A Documentation/mainboard/supermicro/flashing_on_vendorbmc.md M src/mainboard/supermicro/x11ssh/Kconfig M src/vendorcode/Makefile.inc A src/vendorcode/smc/Makefile.inc A util/smc/smcbiosinfo/Makefile A util/smc/smcbiosinfo/description.md A util/smc/smcbiosinfo/smcbiosinfo.c 8 files changed, 261 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/84/35484/3
Hello build bot (Jenkins), Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/35484
to look at the new patch set (#4).
Change subject: util/smc: Add and use new tool smcbiosinfo ......................................................................
util/smc: Add and use new tool smcbiosinfo
The BMC and tools interacting with it depend on metadata placed inside the ROM in order the flash the BIOS.
Add a new tool smcbiosinfo, integrate it into the build system, and generate a 128byte metadata file called smcbiosinfo.bin on build.
You need to provide the BoardID for every SMC mainboard through a new Kconfig symbol: SUPERMICRO_BOARDID
Some fields are unknown, but it's sufficient to flash it using SMC vendor tools.
Tested on Supermicro X11SSH: * Flashing using the WebUI works * Flashing using SMCIPMITool works
No further validation is done on the firmware.
Change-Id: Id608c2ce78614b45a2fd0b26d97d666f02223998 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M Documentation/mainboard/index.md A Documentation/mainboard/supermicro/flashing_on_vendorbmc.md M src/mainboard/supermicro/x11ssh/Kconfig M src/vendorcode/Makefile.inc A src/vendorcode/smc/Makefile.inc A util/smc/smcbiosinfo/description.md A util/smc/smcbiosinfo/smcbiosinfo.c 7 files changed, 252 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/84/35484/4
Hello build bot (Jenkins), Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/35484
to look at the new patch set (#5).
Change subject: util/smc: Add and use new tool smcbiosinfo ......................................................................
util/smc: Add and use new tool smcbiosinfo
The BMC and tools interacting with it depend on metadata placed inside the ROM in order the flash the BIOS.
Add a new tool smcbiosinfo, integrate it into the build system, and generate a 128byte metadata file called smcbiosinfo.bin on build.
You need to provide the BoardID for every SMC mainboard through a new Kconfig symbol: SUPERMICRO_BOARDID
Some fields are unknown, but it's sufficient to flash it using SMC vendor tools.
Tested on Supermicro X11SSH: * Flashing using the WebUI works * Flashing using SMCIPMITool works
No further validation is done on the firmware.
Change-Id: Id608c2ce78614b45a2fd0b26d97d666f02223998 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M Documentation/mainboard/index.md A Documentation/mainboard/supermicro/flashing_on_vendorbmc.md M src/mainboard/supermicro/x11ssh/Kconfig M src/vendorcode/Makefile.inc A src/vendorcode/smc/Makefile.inc A util/smc/smcbiosinfo/description.md A util/smc/smcbiosinfo/smcbiosinfo.c 7 files changed, 252 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/84/35484/5
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35484 )
Change subject: util/smc: Add and use new tool smcbiosinfo ......................................................................
Patch Set 5:
(5 comments)
https://review.coreboot.org/c/coreboot/+/35484/5/util/smc/smcbiosinfo/smcbio... File util/smc/smcbiosinfo/smcbiosinfo.c:
https://review.coreboot.org/c/coreboot/+/35484/5/util/smc/smcbiosinfo/smcbio... PS5, Line 71: printf("-b | --boardid <id> The board ID\n"); If the tool is compiled for a single version anyway, would it make sense to get this from `config.h` instead?
https://review.coreboot.org/c/coreboot/+/35484/5/util/smc/smcbiosinfo/smcbio... PS5, Line 102: case 'h': '?': for invalid arguments?
https://review.coreboot.org/c/coreboot/+/35484/5/util/smc/smcbiosinfo/smcbio... PS5, Line 103: usage(); set `ret`?
https://review.coreboot.org/c/coreboot/+/35484/5/util/smc/smcbiosinfo/smcbio... PS5, Line 196: out: most paths leading here set `ret = 1`, so it would save some lines to initialize is that way and only set `ret = 0` directly above the `out:`
https://review.coreboot.org/c/coreboot/+/35484/5/util/smc/smcbiosinfo/smcbio... PS5, Line 197: if (boardid) No need for that, free() is supposed to check / support NULL.
Patrick Georgi has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35484 )
Change subject: util/smc: Add and use new tool smcbiosinfo ......................................................................
Patch Set 5:
(2 comments)
https://review.coreboot.org/c/coreboot/+/35484/5/src/vendorcode/smc/Makefile... File src/vendorcode/smc/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/35484/5/src/vendorcode/smc/Makefile... PS5, Line 11: $(build_h) consider passing the data into the tool through command line arguments
https://review.coreboot.org/c/coreboot/+/35484/5/src/vendorcode/smc/Makefile... PS5, Line 11: $(SMCBIOSINFOTOOL): util/smc/smcbiosinfo/smcbiosinfo.c $(build_h) put that stuff in util/**/Makefile.inc
Hello build bot (Jenkins), Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/35484
to look at the new patch set (#6).
Change subject: util/smc: Add and use new tool smcbiosinfo ......................................................................
util/smc: Add and use new tool smcbiosinfo
The BMC and tools interacting with it depend on metadata placed inside the ROM in order the flash the BIOS.
Add a new tool smcbiosinfo, integrate it into the build system, and generate a 128byte metadata file called smcbiosinfo.bin on build.
You need to provide the BoardID for every SMC mainboard through a new Kconfig symbol: SUPERMICRO_BOARDID
Some fields are unknown, but it's sufficient to flash it using SMC vendor tools.
Tested on Supermicro X11SSH: * Flashing using the WebUI works * Flashing using SMCIPMITool works
No further validation is done on the firmware.
Change-Id: Id608c2ce78614b45a2fd0b26d97d666f02223998 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M Documentation/mainboard/index.md A Documentation/mainboard/supermicro/flashing_on_vendorbmc.md M src/mainboard/supermicro/x11ssh/Kconfig M src/vendorcode/Makefile.inc A src/vendorcode/smc/Makefile.inc A util/smc/smcbiosinfo/description.md A util/smc/smcbiosinfo/smcbiosinfo.c 7 files changed, 248 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/84/35484/6
Hello build bot (Jenkins), Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/35484
to look at the new patch set (#7).
Change subject: util/smc: Add and use new tool smcbiosinfo ......................................................................
util/smc: Add and use new tool smcbiosinfo
The BMC and tools interacting with it depend on metadata placed inside the ROM in order the flash the BIOS.
Add a new tool smcbiosinfo, integrate it into the build system, and generate a 128byte metadata file called smcbiosinfo.bin on build.
You need to provide the BoardID for every SMC mainboard through a new Kconfig symbol: SUPERMICRO_BOARDID
Some fields are unknown, but it's sufficient to flash it using SMC vendor tools.
Tested on Supermicro X11SSH: * Flashing using the WebUI works * Flashing using SMCIPMITool works
No further validation is done on the firmware.
Change-Id: Id608c2ce78614b45a2fd0b26d97d666f02223998 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M Documentation/mainboard/index.md A Documentation/mainboard/supermicro/flashing_on_vendorbmc.md M src/mainboard/supermicro/x11ssh/Kconfig M src/vendorcode/Makefile.inc A src/vendorcode/smc/Makefile.inc A util/smc/smcbiosinfo/description.md A util/smc/smcbiosinfo/smcbiosinfo.c 7 files changed, 248 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/84/35484/7
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35484 )
Change subject: util/smc: Add and use new tool smcbiosinfo ......................................................................
Patch Set 7:
(5 comments)
https://review.coreboot.org/c/coreboot/+/35484/5/util/smc/smcbiosinfo/smcbio... File util/smc/smcbiosinfo/smcbiosinfo.c:
https://review.coreboot.org/c/coreboot/+/35484/5/util/smc/smcbiosinfo/smcbio... PS5, Line 71: printf("-b | --boardid <id> The board ID\n");
If the tool is compiled for a single version anyway, would it make sense […]
Done
https://review.coreboot.org/c/coreboot/+/35484/5/util/smc/smcbiosinfo/smcbio... PS5, Line 102: case 'h':
'?': for invalid arguments?
Done
https://review.coreboot.org/c/coreboot/+/35484/5/util/smc/smcbiosinfo/smcbio... PS5, Line 103: usage();
set `ret`?
Done
https://review.coreboot.org/c/coreboot/+/35484/5/util/smc/smcbiosinfo/smcbio... PS5, Line 196: out:
most paths leading here set `ret = 1`, so it would save some lines to […]
Done
https://review.coreboot.org/c/coreboot/+/35484/5/util/smc/smcbiosinfo/smcbio... PS5, Line 197: if (boardid)
No need for that, free() is supposed to check / support NULL.
Done
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35484 )
Change subject: util/smc: Add and use new tool smcbiosinfo ......................................................................
Patch Set 7: Code-Review+1
(3 comments)
https://review.coreboot.org/c/coreboot/+/35484/7/Documentation/mainboard/sup... File Documentation/mainboard/supermicro/flashing_on_vendorbmc.md:
https://review.coreboot.org/c/coreboot/+/35484/7/Documentation/mainboard/sup... PS7, Line 8: Bytes bytes
https://review.coreboot.org/c/coreboot/+/35484/7/Documentation/mainboard/sup... PS7, Line 9: Besides the *BoardID* it contains the *firmware version* and *build date*. Please do not wrap the line.
https://review.coreboot.org/c/coreboot/+/35484/7/Documentation/mainboard/sup... PS7, Line 12: it's not. Fits on one line?
Hello Paul Menzel, build bot (Jenkins), Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/35484
to look at the new patch set (#8).
Change subject: util/smc: Add and use new tool smcbiosinfo ......................................................................
util/smc: Add and use new tool smcbiosinfo
The BMC and tools interacting with it depend on metadata placed inside the ROM in order the flash the BIOS.
Add a new tool smcbiosinfo, integrate it into the build system, and generate a 128byte metadata file called smcbiosinfo.bin on build.
You need to provide the BoardID for every SMC mainboard through a new Kconfig symbol: SUPERMICRO_BOARDID
Some fields are unknown, but it's sufficient to flash it using SMC vendor tools.
Tested on Supermicro X11SSH: * Flashing using the WebUI works * Flashing using SMCIPMITool works
No further validation is done on the firmware.
Change-Id: Id608c2ce78614b45a2fd0b26d97d666f02223998 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M Documentation/mainboard/index.md A Documentation/mainboard/supermicro/flashing_on_vendorbmc.md M Makefile.inc M src/mainboard/supermicro/x11ssh/Kconfig M src/vendorcode/Makefile.inc A src/vendorcode/smc/Makefile.inc A util/smc/Makefile.inc A util/smc/smcbiosinfo/description.md A util/smc/smcbiosinfo/smcbiosinfo.c 9 files changed, 250 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/84/35484/8
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35484 )
Change subject: util/smc: Add and use new tool smcbiosinfo ......................................................................
Patch Set 8:
(5 comments)
https://review.coreboot.org/c/coreboot/+/35484/7/Documentation/mainboard/sup... File Documentation/mainboard/supermicro/flashing_on_vendorbmc.md:
https://review.coreboot.org/c/coreboot/+/35484/7/Documentation/mainboard/sup... PS7, Line 8: Bytes
bytes
Done
https://review.coreboot.org/c/coreboot/+/35484/7/Documentation/mainboard/sup... PS7, Line 9: Besides the *BoardID* it contains the *firmware version* and *build date*.
Please do not wrap the line.
Done
https://review.coreboot.org/c/coreboot/+/35484/7/Documentation/mainboard/sup... PS7, Line 12: it's not.
Fits on one line?
Done
https://review.coreboot.org/c/coreboot/+/35484/5/src/vendorcode/smc/Makefile... File src/vendorcode/smc/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/35484/5/src/vendorcode/smc/Makefile... PS5, Line 11: $(SMCBIOSINFOTOOL): util/smc/smcbiosinfo/smcbiosinfo.c $(build_h)
put that stuff in util/**/Makefile. […]
Done
https://review.coreboot.org/c/coreboot/+/35484/5/src/vendorcode/smc/Makefile... PS5, Line 11: $(build_h)
consider passing the data into the tool through command line arguments
doesn't work. Those information are only present in build.h
Hello Paul Menzel, build bot (Jenkins), Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/35484
to look at the new patch set (#9).
Change subject: util/smc: Add and use new tool smcbiosinfo ......................................................................
util/smc: Add and use new tool smcbiosinfo
The BMC and tools interacting with it depend on metadata placed inside the ROM in order the flash the BIOS.
Add a new tool smcbiosinfo, integrate it into the build system, and generate a 128byte metadata file called smcbiosinfo.bin on build.
You need to provide the BoardID for every SMC mainboard through a new Kconfig symbol: SUPERMICRO_BOARDID
Some fields are unknown, but it's sufficient to flash it using SMC vendor tools.
Tested on Supermicro X11SSH: * Flashing using the WebUI works * Flashing using SMCIPMITool works
No further validation is done on the firmware.
Change-Id: Id608c2ce78614b45a2fd0b26d97d666f02223998 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M Documentation/mainboard/index.md A Documentation/mainboard/supermicro/flashing_on_vendorbmc.md M Makefile.inc M src/mainboard/supermicro/x11ssh/Kconfig M src/vendorcode/Makefile.inc A src/vendorcode/smc/Makefile.inc A util/smc/Makefile.inc A util/smc/smcbiosinfo/description.md A util/smc/smcbiosinfo/smcbiosinfo.c 9 files changed, 249 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/84/35484/9
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35484 )
Change subject: util/smc: Add and use new tool smcbiosinfo ......................................................................
Patch Set 9:
(2 comments)
I'm puzzled by the file in `vendorcode/`, isn't that usually code written by the vendor? Can't we just move everything into `util/smc/Makefile.inc`?
https://review.coreboot.org/c/coreboot/+/35484/9/util/smc/smcbiosinfo/smcbio... File util/smc/smcbiosinfo/smcbiosinfo.c:
https://review.coreboot.org/c/coreboot/+/35484/9/util/smc/smcbiosinfo/smcbio... PS9, Line 100: ret = 0; Usually it counts as failure, 0 should only be returned if the tool did it's job.
https://review.coreboot.org/c/coreboot/+/35484/9/util/smc/smcbiosinfo/smcbio... PS9, Line 164: memcpy(&sbu.boardid[1], CONFIG_SUPERMICRO_BOARDID, strlen(CONFIG_SUPERMICRO_BOARDID)); this can overflow, how about MIN(sizeof(sbu.boardid) - 1, ...)
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35484 )
Change subject: util/smc: Add and use new tool smcbiosinfo ......................................................................
Patch Set 9:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35484/7/Documentation/mainboard/sup... File Documentation/mainboard/supermicro/flashing_on_vendorbmc.md:
https://review.coreboot.org/c/coreboot/+/35484/7/Documentation/mainboard/sup... PS7, Line 12: it's not.
Done
NB. This is no code, I would generally prefer shorter lines in text blocks.
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35484 )
Change subject: util/smc: Add and use new tool smcbiosinfo ......................................................................
Patch Set 9:
(2 comments)
https://review.coreboot.org/c/coreboot/+/35484/9/util/smc/smcbiosinfo/smcbio... File util/smc/smcbiosinfo/smcbiosinfo.c:
https://review.coreboot.org/c/coreboot/+/35484/9/util/smc/smcbiosinfo/smcbio... PS9, Line 100: ret = 0;
Usually it counts as failure, 0 should only be returned if the tool did it's job.
isn't printing a helpmessage doing it's job?
https://review.coreboot.org/c/coreboot/+/35484/9/util/smc/smcbiosinfo/smcbio... PS9, Line 164: memcpy(&sbu.boardid[1], CONFIG_SUPERMICRO_BOARDID, strlen(CONFIG_SUPERMICRO_BOARDID));
this can overflow, how about MIN(sizeof(sbu.boardid) - 1, ... […]
check is on line 115
Hello Paul Menzel, build bot (Jenkins), Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/35484
to look at the new patch set (#10).
Change subject: util/smc: Add and use new tool smcbiosinfo ......................................................................
util/smc: Add and use new tool smcbiosinfo
The BMC and tools interacting with it depend on metadata placed inside the ROM in order the flash the BIOS.
Add a new tool smcbiosinfo, integrate it into the build system, and generate a 128byte metadata file called smcbiosinfo.bin on build.
You need to provide the BoardID for every SMC mainboard through a new Kconfig symbol: SUPERMICRO_BOARDID
Some fields are unknown, but it's sufficient to flash it using SMC vendor tools.
Tested on Supermicro X11SSH: * Flashing using the WebUI works * Flashing using SMCIPMITool works
No further validation is done on the firmware.
Change-Id: Id608c2ce78614b45a2fd0b26d97d666f02223998 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M Documentation/mainboard/index.md A Documentation/mainboard/supermicro/flashing_on_vendorbmc.md M Makefile.inc M src/mainboard/supermicro/x11-lga1151-series/Kconfig M src/vendorcode/Makefile.inc A util/smc/Makefile.inc A util/smc/smcbiosinfo/description.md A util/smc/smcbiosinfo/smcbiosinfo.c 8 files changed, 331 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/84/35484/10
Hello Paul Menzel, build bot (Jenkins), Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/35484
to look at the new patch set (#11).
Change subject: util/smc: Add and use new tool smcbiosinfo ......................................................................
util/smc: Add and use new tool smcbiosinfo
The BMC and tools interacting with it depend on metadata placed inside the ROM in order the flash the BIOS.
Add a new tool smcbiosinfo, integrate it into the build system, and generate a 128byte metadata file called smcbiosinfo.bin on build.
You need to provide the BoardID for every SMC mainboard through a new Kconfig symbol: SUPERMICRO_BOARDID
Some fields are unknown, but it's sufficient to flash it using SMC vendor tools.
Tested on Supermicro X11SSH: * Flashing using the WebUI works * Flashing using SMCIPMITool works
No further validation is done on the firmware.
Change-Id: Id608c2ce78614b45a2fd0b26d97d666f02223998 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M Documentation/mainboard/index.md A Documentation/mainboard/supermicro/flashing_on_vendorbmc.md M Makefile.inc M src/mainboard/supermicro/x11-lga1151-series/Kconfig A util/smc/Makefile.inc A util/smc/smcbiosinfo/description.md A util/smc/smcbiosinfo/smcbiosinfo.c 7 files changed, 330 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/84/35484/11
Philipp Deppenwiese has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35484 )
Change subject: util/smc: Add and use new tool smcbiosinfo ......................................................................
Patch Set 11: Code-Review+2
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35484 )
Change subject: util/smc: Add and use new tool smcbiosinfo ......................................................................
Patch Set 11:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35484/9/util/smc/smcbiosinfo/smcbio... File util/smc/smcbiosinfo/smcbiosinfo.c:
https://review.coreboot.org/c/coreboot/+/35484/9/util/smc/smcbiosinfo/smcbio... PS9, Line 164: memcpy(&sbu.boardid[1], CONFIG_SUPERMICRO_BOARDID, strlen(CONFIG_SUPERMICRO_BOARDID));
check is on line 115
Done
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35484 )
Change subject: util/smc: Add and use new tool smcbiosinfo ......................................................................
Patch Set 11:
(3 comments)
https://review.coreboot.org/c/coreboot/+/35484/11/Documentation/mainboard/su... File Documentation/mainboard/supermicro/flashing_on_vendorbmc.md:
https://review.coreboot.org/c/coreboot/+/35484/11/Documentation/mainboard/su... PS11, Line 18: build built
https://review.coreboot.org/c/coreboot/+/35484/11/Documentation/mainboard/su... PS11, Line 19: and build timestamp and board config. Some parts fit on the line above?
https://review.coreboot.org/c/coreboot/+/35484/11/Documentation/mainboard/su... PS11, Line 19: and Comma instead?
Hello Paul Menzel, 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/+/35484
to look at the new patch set (#12).
Change subject: util/smc: Add and use new tool smcbiosinfo ......................................................................
util/smc: Add and use new tool smcbiosinfo
The BMC and tools interacting with it depend on metadata placed inside the ROM in order the flash the BIOS.
Add a new tool smcbiosinfo, integrate it into the build system, and generate a 128byte metadata file called smcbiosinfo.bin on build.
You need to provide the BoardID for every SMC mainboard through a new Kconfig symbol: SUPERMICRO_BOARDID
Some fields are unknown, but it's sufficient to flash it using SMC vendor tools.
Tested on Supermicro X11SSH: * Flashing using the WebUI works * Flashing using SMCIPMITool works
No further validation is done on the firmware.
Change-Id: Id608c2ce78614b45a2fd0b26d97d666f02223998 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M Documentation/mainboard/index.md A Documentation/mainboard/supermicro/flashing_on_vendorbmc.md M Makefile.inc M src/mainboard/supermicro/x11-lga1151-series/Kconfig A util/smc/Makefile.inc A util/smc/smcbiosinfo/description.md A util/smc/smcbiosinfo/smcbiosinfo.c 7 files changed, 330 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/84/35484/12
Hello Paul Menzel, 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/+/35484
to look at the new patch set (#13).
Change subject: util/smc: Add and use new tool smcbiosinfo ......................................................................
util/smc: Add and use new tool smcbiosinfo
The BMC and tools interacting with it depend on metadata placed inside the ROM in order the flash the BIOS.
Add a new tool smcbiosinfo, integrate it into the build system, and generate a 128byte metadata file called smcbiosinfo.bin on build.
You need to provide the BoardID for every SMC mainboard through a new Kconfig symbol: SUPERMICRO_BOARDID
Some fields are unknown, but it's sufficient to flash it using SMC vendor tools.
Tested on Supermicro X11SSH: * Flashing using the WebUI works * Flashing using SMCIPMITool works
No further validation is done on the firmware.
Change-Id: Id608c2ce78614b45a2fd0b26d97d666f02223998 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M Documentation/mainboard/index.md A Documentation/mainboard/supermicro/flashing_on_vendorbmc.md M Makefile.inc M src/mainboard/supermicro/x11-lga1151-series/Kconfig A util/smc/Makefile.inc A util/smc/smcbiosinfo/description.md A util/smc/smcbiosinfo/smcbiosinfo.c 7 files changed, 331 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/84/35484/13
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35484 )
Change subject: util/smc: Add and use new tool smcbiosinfo ......................................................................
Patch Set 13:
(4 comments)
https://review.coreboot.org/c/coreboot/+/35484/11/Documentation/mainboard/su... File Documentation/mainboard/supermicro/flashing_on_vendorbmc.md:
https://review.coreboot.org/c/coreboot/+/35484/11/Documentation/mainboard/su... PS11, Line 18: build
built
Done
https://review.coreboot.org/c/coreboot/+/35484/11/Documentation/mainboard/su... PS11, Line 19: and
Comma instead?
Done
https://review.coreboot.org/c/coreboot/+/35484/11/Documentation/mainboard/su... PS11, Line 19: and build timestamp and board config.
Some parts fit on the line above?
Done
https://review.coreboot.org/c/coreboot/+/35484/9/util/smc/smcbiosinfo/smcbio... File util/smc/smcbiosinfo/smcbiosinfo.c:
https://review.coreboot.org/c/coreboot/+/35484/9/util/smc/smcbiosinfo/smcbio... PS9, Line 100: ret = 0;
isn't printing a helpmessage doing it's job?
Done
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35484 )
Change subject: util/smc: Add and use new tool smcbiosinfo ......................................................................
Patch Set 13:
(1 comment)
There might be a name clash with
https://review.coreboot.org/c/coreboot/+/35484/13//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/35484/13//COMMIT_MSG@7 PS13, Line 7: smc This abbreviation of "Supermicro" confused me. "SMC" also refers to the "System Management Controller" on Apple hardware. Maybe rename the `util/smc/` directory to `util/supermicro/` instead? The tool names are fine as-is.
Hello Paul Menzel, 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/+/35484
to look at the new patch set (#14).
Change subject: util/smc: Add and use new tool smcbiosinfo ......................................................................
util/smc: Add and use new tool smcbiosinfo
The BMC and tools interacting with it depend on metadata placed inside the ROM in order the flash the BIOS.
Add a new tool smcbiosinfo, integrate it into the build system, and generate a 128byte metadata file called smcbiosinfo.bin on build.
You need to provide the BoardID for every SMC mainboard through a new Kconfig symbol: SUPERMICRO_BOARDID
Some fields are unknown, but it's sufficient to flash it using SMC vendor tools.
Tested on Supermicro X11SSH: * Flashing using the WebUI works * Flashing using SMCIPMITool works
No further validation is done on the firmware.
Change-Id: Id608c2ce78614b45a2fd0b26d97d666f02223998 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M Documentation/mainboard/index.md A Documentation/mainboard/supermicro/flashing_on_vendorbmc.md M Makefile.inc M src/mainboard/supermicro/x11-lga1151-series/Kconfig A util/supermicro/Makefile.inc A util/supermicro/smcbiosinfo/description.md A util/supermicro/smcbiosinfo/smcbiosinfo.c 7 files changed, 331 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/84/35484/14
Hello Paul Menzel, 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/+/35484
to look at the new patch set (#15).
Change subject: util/supermicro: Add and use new tool smcbiosinfo ......................................................................
util/supermicro: Add and use new tool smcbiosinfo
The BMC and tools interacting with it depend on metadata placed inside the ROM in order the flash the BIOS.
Add a new tool smcbiosinfo, integrate it into the build system, and generate a 128byte metadata file called smcbiosinfo.bin on build.
You need to provide the BoardID for every SMC mainboard through a new Kconfig symbol: SUPERMICRO_BOARDID
Some fields are unknown, but it's sufficient to flash it using SMC vendor tools.
Tested on Supermicro X11SSH: * Flashing using the WebUI works * Flashing using SMCIPMITool works
No further validation is done on the firmware.
Change-Id: Id608c2ce78614b45a2fd0b26d97d666f02223998 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M Documentation/mainboard/index.md A Documentation/mainboard/supermicro/flashing_on_vendorbmc.md M Makefile.inc M src/mainboard/supermicro/x11-lga1151-series/Kconfig A util/supermicro/Makefile.inc A util/supermicro/smcbiosinfo/description.md A util/supermicro/smcbiosinfo/smcbiosinfo.c 7 files changed, 331 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/84/35484/15
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35484 )
Change subject: util/supermicro: Add and use new tool smcbiosinfo ......................................................................
Patch Set 15:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35484/13//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/35484/13//COMMIT_MSG@7 PS13, Line 7: smc
This abbreviation of "Supermicro" confused me. […]
Done
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35484 )
Change subject: util/supermicro: Add and use new tool smcbiosinfo ......................................................................
Patch Set 15: Code-Review+1
(5 comments)
https://review.coreboot.org/c/coreboot/+/35484/9/util/smc/smcbiosinfo/smcbio... File util/smc/smcbiosinfo/smcbiosinfo.c:
https://review.coreboot.org/c/coreboot/+/35484/9/util/smc/smcbiosinfo/smcbio... PS9, Line 100: ret = 0;
isn't printing a helpmessage doing it's job?
Yeah, right, I forgot how the code originally looked like. I'd say it's a success in case of 'h' but a failure in case of '?'.
https://review.coreboot.org/c/coreboot/+/35484/13/util/smc/smcbiosinfo/smcbi... File util/smc/smcbiosinfo/smcbiosinfo.c:
https://review.coreboot.org/c/coreboot/+/35484/13/util/smc/smcbiosinfo/smcbi... PS13, Line 113: ret = strtol(s, NULL, 0); No check if it could be parsed?
I think the easiest way is to provide `endptr` and check that `**endptr == '\0'` after the call. Oh, and check that `*s != '\0'`, i.e. non-empty string.
https://review.coreboot.org/c/coreboot/+/35484/15/util/supermicro/Makefile.i... File util/supermicro/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/35484/15/util/supermicro/Makefile.i... PS15, Line 4: SMCBIOSINFOTOOL:= $(obj)/smcbiosinfo We also have an $(objutil) but, meh, I don't know when to use it...
https://review.coreboot.org/c/coreboot/+/35484/15/util/supermicro/Makefile.i... PS15, Line 6: util/supermicro/smcbiosinfo This could be $(dir), IIRC.
https://review.coreboot.org/c/coreboot/+/35484/15/util/supermicro/Makefile.i... PS15, Line 7: MAKE s/MAKE /HOSTCC/ ?
Hello Paul Menzel, Philipp Deppenwiese, build bot (Jenkins), Nico Huber, Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/35484
to look at the new patch set (#16).
Change subject: util/supermicro: Add and use new tool smcbiosinfo ......................................................................
util/supermicro: Add and use new tool smcbiosinfo
The BMC and tools interacting with it depend on metadata placed inside the ROM in order the flash the BIOS.
Add a new tool smcbiosinfo, integrate it into the build system, and generate a 128byte metadata file called smcbiosinfo.bin on build.
You need to provide the BoardID for every SMC mainboard through a new Kconfig symbol: SUPERMICRO_BOARDID
Some fields are unknown, but it's sufficient to flash it using SMC vendor tools.
Tested on Supermicro X11SSH: * Flashing using the WebUI works * Flashing using SMCIPMITool works
No further validation is done on the firmware.
Change-Id: Id608c2ce78614b45a2fd0b26d97d666f02223998 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M Documentation/mainboard/index.md A Documentation/mainboard/supermicro/flashing_on_vendorbmc.md M Makefile.inc M src/mainboard/supermicro/x11-lga1151-series/Kconfig A util/supermicro/Makefile.inc A util/supermicro/smcbiosinfo/description.md A util/supermicro/smcbiosinfo/smcbiosinfo.c 7 files changed, 343 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/84/35484/16
Hello Paul Menzel, Philipp Deppenwiese, build bot (Jenkins), Nico Huber, Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/35484
to look at the new patch set (#17).
Change subject: util/supermicro: Add and use new tool smcbiosinfo ......................................................................
util/supermicro: Add and use new tool smcbiosinfo
The BMC and tools interacting with it depend on metadata placed inside the ROM in order the flash the BIOS.
Add a new tool smcbiosinfo, integrate it into the build system, and generate a 128byte metadata file called smcbiosinfo.bin on build.
You need to provide the BoardID for every SMC mainboard through a new Kconfig symbol: SUPERMICRO_BOARDID
Some fields are unknown, but it's sufficient to flash it using SMC vendor tools.
Tested on Supermicro X11SSH: * Flashing using the WebUI works * Flashing using SMCIPMITool works
No further validation is done on the firmware.
Change-Id: Id608c2ce78614b45a2fd0b26d97d666f02223998 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M Documentation/mainboard/index.md A Documentation/mainboard/supermicro/flashing_on_vendorbmc.md M Makefile.inc M src/mainboard/supermicro/x11-lga1151-series/Kconfig A util/supermicro/Makefile.inc A util/supermicro/smcbiosinfo/description.md A util/supermicro/smcbiosinfo/smcbiosinfo.c 7 files changed, 342 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/84/35484/17
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35484 )
Change subject: util/supermicro: Add and use new tool smcbiosinfo ......................................................................
Patch Set 16:
(4 comments)
https://review.coreboot.org/c/coreboot/+/35484/13/util/smc/smcbiosinfo/smcbi... File util/smc/smcbiosinfo/smcbiosinfo.c:
https://review.coreboot.org/c/coreboot/+/35484/13/util/smc/smcbiosinfo/smcbi... PS13, Line 113: ret = strtol(s, NULL, 0);
No check if it could be parsed? […]
Done
https://review.coreboot.org/c/coreboot/+/35484/15/util/supermicro/Makefile.i... File util/supermicro/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/35484/15/util/supermicro/Makefile.i... PS15, Line 4: SMCBIOSINFOTOOL:= $(obj)/smcbiosinfo
We also have an $(objutil) but, meh, I don't know when to use it...
Done
https://review.coreboot.org/c/coreboot/+/35484/15/util/supermicro/Makefile.i... PS15, Line 6: util/supermicro/smcbiosinfo
This could be $(dir), IIRC.
Done
https://review.coreboot.org/c/coreboot/+/35484/15/util/supermicro/Makefile.i... PS15, Line 7: MAKE
s/MAKE /HOSTCC/ ?
Done
Philipp Deppenwiese has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35484 )
Change subject: util/supermicro: Add and use new tool smcbiosinfo ......................................................................
Patch Set 17: Code-Review+2
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35484 )
Change subject: util/supermicro: Add and use new tool smcbiosinfo ......................................................................
Patch Set 17: Code-Review+2
Nico Huber has submitted this change. ( https://review.coreboot.org/c/coreboot/+/35484 )
Change subject: util/supermicro: Add and use new tool smcbiosinfo ......................................................................
util/supermicro: Add and use new tool smcbiosinfo
The BMC and tools interacting with it depend on metadata placed inside the ROM in order the flash the BIOS.
Add a new tool smcbiosinfo, integrate it into the build system, and generate a 128byte metadata file called smcbiosinfo.bin on build.
You need to provide the BoardID for every SMC mainboard through a new Kconfig symbol: SUPERMICRO_BOARDID
Some fields are unknown, but it's sufficient to flash it using SMC vendor tools.
Tested on Supermicro X11SSH: * Flashing using the WebUI works * Flashing using SMCIPMITool works
No further validation is done on the firmware.
Change-Id: Id608c2ce78614b45a2fd0b26d97d666f02223998 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/35484 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Philipp Deppenwiese zaolin.daisuki@gmail.com Reviewed-by: Nico Huber nico.h@gmx.de --- M Documentation/mainboard/index.md A Documentation/mainboard/supermicro/flashing_on_vendorbmc.md M Makefile.inc M src/mainboard/supermicro/x11-lga1151-series/Kconfig A util/supermicro/Makefile.inc A util/supermicro/smcbiosinfo/description.md A util/supermicro/smcbiosinfo/smcbiosinfo.c 7 files changed, 342 insertions(+), 1 deletion(-)
Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved Philipp Deppenwiese: Looks good to me, approved
diff --git a/Documentation/mainboard/index.md b/Documentation/mainboard/index.md index 038689d..3e6a985 100644 --- a/Documentation/mainboard/index.md +++ b/Documentation/mainboard/index.md @@ -126,6 +126,7 @@
- [X10SLM+-F](supermicro/x10slm-f.md) - [X11 LGA1151 series](supermicro/x11-lga1151-series/x11-lga1151-series.md) +- [Flashing using the BMC](supermicro/flashing_on_vendorbmc.md)
## UP
diff --git a/Documentation/mainboard/supermicro/flashing_on_vendorbmc.md b/Documentation/mainboard/supermicro/flashing_on_vendorbmc.md new file mode 100644 index 0000000..e02c57b --- /dev/null +++ b/Documentation/mainboard/supermicro/flashing_on_vendorbmc.md @@ -0,0 +1,32 @@ +# Flashing coreboot using SMC IPMI (BMC) firmware + +## Metadata +In order to flash anything to the "BIOS" IC, it needs to contain a valid +BIOSINFO struct. + +The BIOSINFO struct contains a `$FID` marker at the beginning and is +128 bytes in total. Besides the *BoardID* it contains the *firmware version* +and *build date*. The BMC verifies that the BoardID is correct and refuses to +flash if it's not. + +The struct has no checksum or cryptographic protection. + +## The smcinfobios tool + +The smcbiosinfo tool can be found in `util/supermicro/smcbiosinfo`. + +It parses the `build/build.h` header to get the current coreboot version and +build timestamp. +The *board ID* is passed as command line argument. + +It will place a file in CBFS called `smcbiosinfo.bin`, which is then found +by the vendor tools. The file contains the struct described above. + +## Flashing using SMCIPMItool + +You can use the *SMCIPMITool* to remotely flash the BIOS: + +`SMCIPMITool <remote BMC IP> <user> <password> bios update build/coreboot.rom` + +Make sure that the ME isn't in recovery mode, otherwise you get an error +message on updating the BIOS. diff --git a/Makefile.inc b/Makefile.inc index 82adc1d..a54e57b 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -94,7 +94,7 @@ subdirs-y += $(wildcard src/drivers/*) $(wildcard src/drivers/*/*) subdirs-y += src/cpu src/vendorcode subdirs-y += util/cbfstool util/sconfig util/nvramtool util/pgtblgen -subdirs-y += util/futility util/marvell util/bincfg +subdirs-y += util/futility util/marvell util/bincfg util/supermicro subdirs-y += $(wildcard src/arch/*) subdirs-y += src/mainboard/$(MAINBOARDDIR) subdirs-y += src/security diff --git a/src/mainboard/supermicro/x11-lga1151-series/Kconfig b/src/mainboard/supermicro/x11-lga1151-series/Kconfig index 5a99f7a..02c9c86 100644 --- a/src/mainboard/supermicro/x11-lga1151-series/Kconfig +++ b/src/mainboard/supermicro/x11-lga1151-series/Kconfig @@ -86,4 +86,8 @@ int default 512
+config SUPERMICRO_BOARDID + string + default "089C" + endif # BOARD_SUPERMICRO_BASEBOARD_X11_LGA1151_SERIES diff --git a/util/supermicro/Makefile.inc b/util/supermicro/Makefile.inc new file mode 100644 index 0000000..e71cfbd --- /dev/null +++ b/util/supermicro/Makefile.inc @@ -0,0 +1,21 @@ +ifeq ($(CONFIG_VENDOR_SUPERMICRO),y) +ifneq ($(call strip_quotes, $(CONFIG_SUPERMICRO_BOARDID)),) + +SMCBIOSINFOTOOL:= $(objutil)/supermicro/smcbiosinfo + +$(SMCBIOSINFOTOOL): $(dir)/smcbiosinfo/smcbiosinfo.c + printf " HOSTCC Creating SMCBIOSINFO tool\n" + mkdir -p $(objutil)/supermicro + $(HOSTCC) $< -o $@ + +cbfs-files-y += smcbiosinfo.bin + +smcbiosinfo.bin-file := $(obj)/mainboard/$(MAINBOARDDIR)/smcbiosinfo.bin +smcbiosinfo.bin-type := raw +smcbiosinfo.bin-compression := none + +$(obj)/mainboard/$(MAINBOARDDIR)/smcbiosinfo.bin: $(SMCBIOSINFOTOOL) $(build_h) + printf " TOOL Creating SMC BIOSINFO metadata\n" + $(SMCBIOSINFOTOOL) -i $(build_h) -b $(CONFIG_SUPERMICRO_BOARDID) -o $@ +endif +endif diff --git a/util/supermicro/smcbiosinfo/description.md b/util/supermicro/smcbiosinfo/description.md new file mode 100644 index 0000000..21170eb --- /dev/null +++ b/util/supermicro/smcbiosinfo/description.md @@ -0,0 +1 @@ +Generates SMC biosinfo for BMC BIOS updates `C` diff --git a/util/supermicro/smcbiosinfo/smcbiosinfo.c b/util/supermicro/smcbiosinfo/smcbiosinfo.c new file mode 100644 index 0000000..ae2a17b --- /dev/null +++ b/util/supermicro/smcbiosinfo/smcbiosinfo.c @@ -0,0 +1,282 @@ +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2019 9elements Agency GmbH patrick.rudolph@9elements.com + * + * 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 <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <stdint.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <getopt.h> +#include <errno.h> +#include <stdarg.h> + +/* Place the following struct somewhere in the ROM: */ +struct SMC_BIOS_Update { + uint8_t magic0[4]; // always 0xaa00b1ed + char magic1[4]; // always $FID + uint8_t magic2[2]; // always 0x7804 + uint8_t space0; // always zero + // SMCinfotool doesn't care for the first letter + // The BMC webinterface does. + char boardid[9]; // "100000000" + uint8_t space1[15]; // unknown data + uint8_t space2; // always 0x1f + char ukn_majorVer[2];// unknown + uint8_t space3; // always zero + char ukn_minorVer[2];// unknown + uint8_t space4; // always zero + char majorVer[3]; // BIOS major version + char minorVer[2]; // BIOS minor version + uint8_t space5; // always zero + uint16_t year; // year + uint8_t month; // month + uint8_t day; // day + uint32_t space6; // unknown data + uint8_t space7; // all ones + char str[15]; // "SUPERMSMCI--MB1" + uint8_t space8[3]; // always zero + uint64_t space9[6]; // all ones +} __packed; + +static const char *optstring = "b:i:o:h"; + +static struct option long_options[] = { + {"boardid", required_argument, 0, 'b' }, + {"input", required_argument, 0, 'i' }, + {"output", required_argument, 0, 'o' }, + {"help", no_argument, 0, 'h' }, +}; + +static void usage(void) +{ + printf("smcbiosinfo: Create BIOSInfo for BMC BIOS updates\n"); + printf("Usage: smcbiosinfo [options] -i build.h -b <boardid> -o <filename>\n"); + printf("-b | --boardid <ID> The board ID assigned by SMC\n"); + printf("-i | --input <FILE> The build.h file to parse\n"); + printf("-o | --output <FILE> The file to generate\n"); + printf("-h | --help Print this help\n"); +} + +static int bcd2int(int hex) +{ + if (hex > 0xff) + return -1; + return ((hex & 0xF0) >> 4) * 10 + (hex & 0x0F); +} + +static char *get_line(char *fn, char *match) +{ + ssize_t read; + char *line = NULL; + char *ret = NULL; + size_t len = 0; + + FILE *fp = fopen(fn, "r"); + if (fp == NULL) { + fprintf(stderr, "E: Couldn't open file '%s'\n", fn); + return NULL; + } + + while ((read = getline(&line, &len, fp)) != -1) { + if (strstr(line, match) != NULL) { + ret = strdup(strstr(line, match) + strlen(match)); + break; + } + } + + if (!ret) + fprintf(stderr, "E: %s not found in %s\n", match, fn); + + fclose(fp); + return ret; +} + +static int get_line_as_int(char *fn, char *match, int bcd) +{ + int ret = -1; + char *s = get_line(fn, match); + if (s && strlen(s) > 0) { + char *endptr; + ret = strtol(s, &endptr, 0); + if (*endptr != '\0' && *endptr != '\n') { + fprintf(stderr, "E: Couldn't parse number for key '%s'\n", match); + return -1; + } + if (bcd) + ret = bcd2int(ret); + free(s); + } else { + fprintf(stderr, "E: Got invalid line for key '%s'\n", match); + } + + return ret; +} + +int main(int argc, char **argv) +{ + int c; + int ret = 1; + char *filename = NULL; + char *inputfilename = NULL; + char *boardid = NULL; + int num; + + while (1) { + int optindex = 0; + + c = getopt_long(argc, argv, optstring, long_options, &optindex); + + if (c == -1) + break; + + switch (c) { + case 'b': + boardid = strdup(optarg); + break; + case 'i': + inputfilename = strdup(optarg); + break; + case 'o': + filename = strdup(optarg); + break; + case 'h': + ret = 0; /* fallthrough */ + case '?': + usage(); + goto out; + default: + break; + } + } + + if (!inputfilename) { + fprintf(stderr, "E: Must specify build.h filename\n"); + goto out; + } + if (!filename) { + fprintf(stderr, "E: Must specify a destination filename\n"); + goto out; + } + + if (!boardid || strlen(boardid) == 0) { + fprintf(stderr, "E: Board ID must be set\n"); + goto out; + } + if (strlen(boardid) > 8) { + fprintf(stderr, "E: Board ID must be less than 8 characters\n"); + goto out; + } + + // generate the table + + struct SMC_BIOS_Update sbu = { + {0xed, 0xb1, 0x00, 0xaa}, + "$FID", + {0x04, 0x78}, + 0, // space + "100000000", // boardid + {}, // unknown data + 0x1f, // space + "05", // unknown data + 0, // zero + "06", // unknown data + 0, // zero + "000", // major + "00", // minor + 0, // zero + 0, // year + 0, // month + 0, //day + 0, // unknown data + 0xff, // space + "SUPERMSMCI--MB1", + {0, 0, 0}, // all zero + {~0, ~0, ~0, ~0, ~0, ~0}, // all ones + }; + + num = get_line_as_int(inputfilename, "COREBOOT_MAJOR_VERSION", 0); + if (num < 0) + goto out; + + if (num < 999) { + char tmp[4]; + snprintf(tmp, sizeof(tmp), "%03d", num); + memcpy(&sbu.majorVer, &tmp, sizeof(sbu.majorVer)); + } else { + fprintf(stderr, "E: Unsupported coreboot major version\n"); + goto out; + } + + num = get_line_as_int(inputfilename, "COREBOOT_MINOR_VERSION", 0); + if (num < 0) + goto out; + + if (num < 99) { + char tmp[3]; + snprintf(tmp, sizeof(tmp), "%02d", num); + memcpy(&sbu.minorVer, &tmp, sizeof(sbu.minorVer)); + } else { + fprintf(stderr, "E: Unsupported coreboot minor version\n"); + goto out; + } + + num = get_line_as_int(inputfilename, "COREBOOT_BUILD_YEAR_BCD", 1); + if (num < 0) + goto out; + sbu.year = 2000 + num; + + num = get_line_as_int(inputfilename, "COREBOOT_BUILD_MONTH_BCD", 1); + if (num < 0) + goto out; + sbu.month = num; + + num = get_line_as_int(inputfilename, "COREBOOT_BUILD_DAY_BCD", 1); + if (num < 0) + goto out; + sbu.day = num; + + memcpy(&sbu.boardid[1], boardid, strlen(boardid)); + + // write the table + FILE *fd = fopen(filename, "wb"); + if (!fd) { + fprintf(stderr, "E: %s open failed: %s\n", filename, strerror(errno)); + goto out; + } + + if (fwrite(&sbu, 1, sizeof(sbu), fd) != sizeof(sbu)) { + fprintf(stderr, "E: %s write failed: %s\n", filename, strerror(errno)); + fclose(fd); + goto out; + } + + if (fclose(fd)) { + fprintf(stderr, "E: %s close failed: %s\n", filename, strerror(errno)); + goto out; + } + + ret = 0; +out: + if (ret > 0) + fprintf(stderr, "E: Error creating '%s'\n", filename); + + free(filename); + + exit(ret); + + return 0; +}