Johnny Lin has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/41760 )
Change subject: mb/ocp/deltalake: Add FSP version to coreboot table for cbmem to display ......................................................................
mb/ocp/deltalake: Add FSP version to coreboot table for cbmem to display
Overwrite FSP version to coreboot table LB_TAG_EXTRA_VERSION.
Tested=On OCP Delta Lake LinuxBoot, u-root shell cbmem can see "LB_TAG_EXTRA_VERSION": "FSPv2.1-0.0.1.120"
Change-Id: I579fa87028b9ed0734b2fac206daf43ecae311be Signed-off-by: Johnny Lin johnny_lin@wiwynn.com --- M src/mainboard/ocp/deltalake/ramstage.c 1 file changed, 40 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/60/41760/1
diff --git a/src/mainboard/ocp/deltalake/ramstage.c b/src/mainboard/ocp/deltalake/ramstage.c index 0acef91..d0baca4 100644 --- a/src/mainboard/ocp/deltalake/ramstage.c +++ b/src/mainboard/ocp/deltalake/ramstage.c @@ -1,13 +1,18 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* This file is part of the coreboot project. */
+#include <boot/coreboot_tables.h> #include <console/console.h> #include <drivers/ipmi/ipmi_ops.h> #include <drivers/ocp/dmi/ocp_dmi.h> +#include <fsp/util.h> #include <soc/ramstage.h> +#include <string.h>
#include "ipmi.h"
+#define FSP_VER_LEN 30 + extern struct fru_info_str fru_strings;
static void dl_oem_smbios_strings(struct device *dev, struct smbios_type11 *t) @@ -67,6 +72,41 @@ printk(BIOS_ERR, "ipmi_set_ppin failed\n"); }
+static void get_fsp_version(char *buf) +{ + /* FSP header has been read and validated at this stage */ + struct fsp_header *hdr = &fsps_hdr; + union { + uint32_t val; + struct { + uint8_t bld_num; + uint8_t revision; + uint8_t minor; + uint8_t major; + } rev; + } revision; + + revision.val = hdr->fsp_revision; + snprintf(buf, FSP_VER_LEN, "FSPv%u.%u-%u.%u.%u.%u", (hdr->spec_version >> 4), + hdr->spec_version & 0xf, revision.rev.major, + revision.rev.minor, revision.rev.revision, revision.rev.bld_num); +} + +/* Overwrite FSP version to coreboot table LB_TAG_EXTRA_VERSION */ +void lb_board(struct lb_header *header) +{ + struct lb_string *rec; + size_t len; + char fsp_version[FSP_VER_LEN] = {0}; + + get_fsp_version(fsp_version); + rec = (struct lb_string *)lb_new_record(header); + rec->tag = LB_TAG_EXTRA_VERSION; + len = strlen(fsp_version); + rec->size = ALIGN_UP(sizeof(*rec) + len + 1, 8); + memcpy(rec->string, fsp_version, len+1); +} + struct chip_operations mainboard_ops = { .enable_dev = mainboard_enable, .final = mainboard_final,