Jonathan Zhang has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/42022 )
Change subject: mb/facebook/watson: support firmware version ......................................................................
mb/facebook/watson: support firmware version
SMBIOS type 0 has a field for overall firmware version. This version is the semantic version of the entire host firmware, with coreboot being part of it.
In build/release process, overall firmware version is expected to be updated into version variable in VPD_RO flash region.
If "version" key is found in VPD_RO flash region, use its value to fill in SMBIOS type 0. Otherwise, generate a BIOS_ERR message, concatenate "cb_ver:" and coreboot_version to fill in SMBIOS type 0.
Signed-off-by: Jonathan Zhang jonzhang@fb.com Change-Id: I831fe7019ddd75beb6824b8e09445f339bf7cc8d --- M src/mainboard/facebook/watson/Makefile.inc A src/mainboard/facebook/watson/ramstage.c 2 files changed, 46 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/22/42022/1
diff --git a/src/mainboard/facebook/watson/Makefile.inc b/src/mainboard/facebook/watson/Makefile.inc index f1384f7..17a5918 100644 --- a/src/mainboard/facebook/watson/Makefile.inc +++ b/src/mainboard/facebook/watson/Makefile.inc @@ -14,5 +14,6 @@ ##
ramstage-y += irqroute.c +ramstage-y += ramstage.c
CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/include diff --git a/src/mainboard/facebook/watson/ramstage.c b/src/mainboard/facebook/watson/ramstage.c new file mode 100644 index 0000000..f844d03 --- /dev/null +++ b/src/mainboard/facebook/watson/ramstage.c @@ -0,0 +1,45 @@ +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2013 Google Inc. + * Copyright (C) 2015 Intel Corp. + * Copyright (C) 2020 Facebook Inc. + * + * 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 <console/console.h> +#include <drivers/vpd/vpd.h> +#include <smbios.h> +#include <version.h> +#include <string.h> + +#define VER_LEN 20 + +/* + * If "version" key is found in VPD_RO, use its value as overall + * firmware version; otherwise use coreboot_version as overall + * firmware version. + */ +const char *smbios_mainboard_bios_version(void) +{ + static char version[VER_LEN] = {0}; + + if (vpd_gets("version", version, VER_LEN, VPD_RO)) { + printk(BIOS_DEBUG, "Got version from VPD: %s\n", version); + } else { + static char cb_ver[] = "cb_ver:"; + strcpy(version, cb_ver); + strncpy(version + strlen(cb_ver), coreboot_version, + VER_LEN - strlen(cb_ver) - 1); + printk(BIOS_ERR, "Unable to get version from VPD, use %s\n", version); + } + return version; +}