[PATCH v5 07/13] sysinfo: Provide a default driver to set SMBIOS values

Simon Glass sjg at chromium.org
Wed Nov 4 16:19:47 CET 2020


Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg at chromium.org>
Reviewed-by: Bin Meng <bmeng.cn at gmail.com>
---

Changes in v5:
- Fix 'manuafacture' typo in commit message

 drivers/sysinfo/Kconfig  |  8 ++++++++
 drivers/sysinfo/Makefile |  1 +
 drivers/sysinfo/smbios.c | 24 ++++++++++++++++++++++++
 lib/Kconfig              |  3 +++
 4 files changed, 36 insertions(+)
 create mode 100644 drivers/sysinfo/smbios.c

diff --git a/drivers/sysinfo/Kconfig b/drivers/sysinfo/Kconfig
index 39141500a05..ee55b6206f4 100644
--- a/drivers/sysinfo/Kconfig
+++ b/drivers/sysinfo/Kconfig
@@ -22,4 +22,12 @@ config SYSINFO_SANDBOX
 	help
 	  Support querying device information for the Sandbox boards.
 
+config SYSINFO_SMBIOS
+	bool "Provide a default sysinfo driver for SMBIOS information"
+	help
+	  Some boards want to specify the manuafacture or product name but do
+	  not need to have their own sysinfo driver. This includes a default
+	  one which provides a way to specify this SMBIOS information in the
+	  devicetree, without needing any board-specific functionality.
+
 endif
diff --git a/drivers/sysinfo/Makefile b/drivers/sysinfo/Makefile
index aecf0b0d47c..6d04fcba1d1 100644
--- a/drivers/sysinfo/Makefile
+++ b/drivers/sysinfo/Makefile
@@ -5,3 +5,4 @@
 obj-y += sysinfo-uclass.o
 obj-$(CONFIG_SYSINFO_GAZERBEAM) += gazerbeam.o
 obj-$(CONFIG_SYSINFO_SANDBOX) += sandbox.o
+obj-$(CONFIG_SYSINFO_SMBIOS) += smbios.o
diff --git a/drivers/sysinfo/smbios.c b/drivers/sysinfo/smbios.c
new file mode 100644
index 00000000000..80ebd1921d8
--- /dev/null
+++ b/drivers/sysinfo/smbios.c
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2020 Google LLC
+ * Written by Simon Glass <sjg at chromium.org>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <sysinfo.h>
+
+static const struct udevice_id sysinfo_smbios_ids[] = {
+	{ .compatible = "u-boot,sysinfo-smbios" },
+	{ /* sentinel */ }
+};
+
+static const struct sysinfo_ops sysinfo_smbios_ops = {
+};
+
+U_BOOT_DRIVER(sysinfo_smbios) = {
+	.name           = "sysinfo_smbios",
+	.id             = UCLASS_SYSINFO,
+	.of_match       = sysinfo_smbios_ids,
+	.ops		= &sysinfo_smbios_ops,
+};
diff --git a/lib/Kconfig b/lib/Kconfig
index 79651eaad19..c4dc2bbf8e5 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -649,6 +649,9 @@ config GENERATE_SMBIOS_TABLE
 
 	  Check http://www.dmtf.org/standards/smbios for details.
 
+	  See also SMBIOS_SYSINFO which allows SMBIOS values to be provided in
+	  the devicetree.
+
 config SMBIOS_MANUFACTURER
 	string "SMBIOS Manufacturer"
 	depends on GENERATE_SMBIOS_TABLE
-- 
2.29.1.341.ge80a0c044ae-goog



More information about the U-Boot mailing list