summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-02-04 21:17:20 -0700
committerBin Meng <bmeng.cn@gmail.com>2021-02-06 19:20:27 +0800
commite9adaa75bb38ded5cf4e460270315afd891d141c (patch)
tree95791c1205f994c551d1042a61f8e255c0cfb6af /include
parentfd3b826da8faabdf288de8e4ff8ce020cf6d9391 (diff)
downloadu-boot-e9adaa75bb38ded5cf4e460270315afd891d141c.tar.gz
u-boot-e9adaa75bb38ded5cf4e460270315afd891d141c.tar.xz
u-boot-e9adaa75bb38ded5cf4e460270315afd891d141c.zip
smbios: Add more options for the BIOS version string
At present the version string is obtained from PLAIN_VERSION. Some boards may want to configure this using the device tree, since the build system can more easily insert things there after U-Boot itself is built. Add this option to the code. Also in some cases the version needs to be generated programmatically, such as when it is stored elsewhere in the ROM and must be read first. To handle this, keep a pointer around so that it can be updated later. This works by storing the last string in the context, since it is easier than passing out a little-used extra parameter. Provide a function to update the version string. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'include')
-rw-r--r--include/asm-generic/global_data.h6
-rw-r--r--include/smbios.h12
2 files changed, 18 insertions, 0 deletions
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index 998beb0176..b6a9991fc9 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -447,6 +447,12 @@ struct global_data {
*/
struct acpi_ctx *acpi_ctx;
#endif
+#if CONFIG_IS_ENABLED(GENERATE_SMBIOS_TABLE)
+ /**
+ * @smbios_version: Points to SMBIOS type 0 version
+ */
+ char *smbios_version;
+#endif
};
/**
diff --git a/include/smbios.h b/include/smbios.h
index 1cbeabf952..ecc4fd1de3 100644
--- a/include/smbios.h
+++ b/include/smbios.h
@@ -257,4 +257,16 @@ const struct smbios_header *smbios_header(const struct smbios_entry *entry, int
*/
const char *smbios_string(const struct smbios_header *header, int index);
+/**
+ * smbios_update_version() - Update the version string
+ *
+ * This can be called after the SMBIOS tables are written (e.g. after the U-Boot
+ * main loop has started) to update the BIOS version string (SMBIOS table 0).
+ *
+ * @version: New version string to use
+ * @return 0 if OK, -ENOENT if no version string was previously written,
+ * -ENOSPC if the new string is too large to fit
+ */
+int smbios_update_version(const char *version);
+
#endif /* _SMBIOS_H_ */