sysinfo: Provide a default driver to set SMBIOS values
authorSimon Glass <sjg@chromium.org>
Thu, 5 Nov 2020 13:32:11 +0000 (06:32 -0700)
committerBin Meng <bmeng.cn@gmail.com>
Fri, 6 Nov 2020 02:18:20 +0000 (10:18 +0800)
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@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
drivers/sysinfo/Kconfig
drivers/sysinfo/Makefile
drivers/sysinfo/smbios.c [new file with mode: 0644]
lib/Kconfig

index 3914150..85c1e81 100644 (file)
@@ -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 manufacturer 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
index aecf0b0..6d04fcb 100644 (file)
@@ -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 (file)
index 0000000..80ebd19
--- /dev/null
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2020 Google LLC
+ * Written by Simon Glass <sjg@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,
+};
index 8f48753..fdc35a9 100644 (file)
@@ -658,6 +658,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