aboutsummaryrefslogtreecommitdiff
path: root/drivers/sysinfo/sysinfo-uclass.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2020-11-06 08:41:49 -0500
committerTom Rini <trini@konsulko.com>2020-11-06 09:46:43 -0500
commitd062c1344cefb6c368b96efea4c2a20e63657b8d (patch)
tree56dcc373217bbcb248c35f7253c9478c1ba7e715 /drivers/sysinfo/sysinfo-uclass.c
parent71d3fa7efa4fc07e6f161c742397ddbe4466c631 (diff)
parente4f8e543f1a905857a753a1d411997a81f4f52aa (diff)
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-x86
- Add a new SMBIOS parser and enable it when booting from coreboot - Fix up various driver names to avoid dtoc warnings - Fully enable ACPI support on Google Chromebook Coral - Add a way to set SMBIOS properties using the devicetree - Update existing boards to use devicetree for SMBIOS using a new default sysinfo driver
Diffstat (limited to 'drivers/sysinfo/sysinfo-uclass.c')
-rw-r--r--drivers/sysinfo/sysinfo-uclass.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/drivers/sysinfo/sysinfo-uclass.c b/drivers/sysinfo/sysinfo-uclass.c
new file mode 100644
index 0000000000..6df58fe160
--- /dev/null
+++ b/drivers/sysinfo/sysinfo-uclass.c
@@ -0,0 +1,71 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2017
+ * Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <sysinfo.h>
+
+int sysinfo_get(struct udevice **devp)
+{
+ return uclass_first_device_err(UCLASS_SYSINFO, devp);
+}
+
+int sysinfo_detect(struct udevice *dev)
+{
+ struct sysinfo_ops *ops = sysinfo_get_ops(dev);
+
+ if (!ops->detect)
+ return -ENOSYS;
+
+ return ops->detect(dev);
+}
+
+int sysinfo_get_fit_loadable(struct udevice *dev, int index, const char *type,
+ const char **strp)
+{
+ struct sysinfo_ops *ops = sysinfo_get_ops(dev);
+
+ if (!ops->get_fit_loadable)
+ return -ENOSYS;
+
+ return ops->get_fit_loadable(dev, index, type, strp);
+}
+
+int sysinfo_get_bool(struct udevice *dev, int id, bool *val)
+{
+ struct sysinfo_ops *ops = sysinfo_get_ops(dev);
+
+ if (!ops->get_bool)
+ return -ENOSYS;
+
+ return ops->get_bool(dev, id, val);
+}
+
+int sysinfo_get_int(struct udevice *dev, int id, int *val)
+{
+ struct sysinfo_ops *ops = sysinfo_get_ops(dev);
+
+ if (!ops->get_int)
+ return -ENOSYS;
+
+ return ops->get_int(dev, id, val);
+}
+
+int sysinfo_get_str(struct udevice *dev, int id, size_t size, char *val)
+{
+ struct sysinfo_ops *ops = sysinfo_get_ops(dev);
+
+ if (!ops->get_str)
+ return -ENOSYS;
+
+ return ops->get_str(dev, id, size, val);
+}
+
+UCLASS_DRIVER(sysinfo) = {
+ .id = UCLASS_SYSINFO,
+ .name = "sysinfo",
+ .post_bind = dm_scan_fdt_dev,
+};