summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2019-07-15 00:52:53 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2019-07-15 00:52:53 +0000
commitc7c615108118742a345f07500f19ab61746797e6 (patch)
tree271e83379d026f57a26f13503bca812141278e71 /sys
parent3e2357525e6b3441d5d202b02f3dbfceef78670d (diff)
Add dmi functions used by drm_panel_orientation_quirks.c and enable
CONFIG_DMI path. ok mlarkin@ kettenis@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/drm/drm_linux.c30
-rw-r--r--sys/dev/pci/drm/include/linux/dmi.h2
-rw-r--r--sys/dev/pci/drm/include/linux/kconfig.h4
-rw-r--r--sys/dev/pci/drm/include/linux/mod_devicetable.h7
4 files changed, 39 insertions, 4 deletions
diff --git a/sys/dev/pci/drm/drm_linux.c b/sys/dev/pci/drm/drm_linux.c
index 7724d827bea..b6fa9799da9 100644
--- a/sys/dev/pci/drm/drm_linux.c
+++ b/sys/dev/pci/drm/drm_linux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: drm_linux.c,v 1.44 2019/07/12 13:56:27 solene Exp $ */
+/* $OpenBSD: drm_linux.c,v 1.45 2019/07/15 00:52:52 jsg Exp $ */
/*
* Copyright (c) 2013 Jonathan Gray <jsg@openbsd.org>
* Copyright (c) 2015, 2016 Mark Kettenis <kettenis@openbsd.org>
@@ -394,6 +394,34 @@ dmi_found(const struct dmi_system_id *dsi)
return true;
}
+const struct dmi_system_id *
+dmi_first_match(const struct dmi_system_id *sysid)
+{
+ const struct dmi_system_id *dsi;
+
+ for (dsi = sysid; dsi->matches[0].slot != 0 ; dsi++) {
+ if (dmi_found(dsi))
+ return dsi;
+ }
+
+ return NULL;
+}
+
+#ifdef CONFIG_DMI
+extern char smbios_bios_date[];
+#endif
+
+const char *
+dmi_get_system_info(int slot)
+{
+ WARN_ON(slot != DMI_BIOS_DATE);
+#ifdef CONFIG_DMI
+ if (slot == DMI_BIOS_DATE)
+ return smbios_bios_date;
+#endif
+ return NULL;
+}
+
int
dmi_check_system(const struct dmi_system_id *sysid)
{
diff --git a/sys/dev/pci/drm/include/linux/dmi.h b/sys/dev/pci/drm/include/linux/dmi.h
index 1e55ca6a8ab..49d51c41942 100644
--- a/sys/dev/pci/drm/include/linux/dmi.h
+++ b/sys/dev/pci/drm/include/linux/dmi.h
@@ -8,5 +8,7 @@
int dmi_check_system(const struct dmi_system_id *);
bool dmi_match(int, const char *);
+const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *);
+const char *dmi_get_system_info(int);
#endif
diff --git a/sys/dev/pci/drm/include/linux/kconfig.h b/sys/dev/pci/drm/include/linux/kconfig.h
index 10f0b7582d2..060c00bb5ab 100644
--- a/sys/dev/pci/drm/include/linux/kconfig.h
+++ b/sys/dev/pci/drm/include/linux/kconfig.h
@@ -36,4 +36,8 @@
#define CONFIG_AGP 1
#endif
+#if defined(__amd64__) || defined(__i386__)
+#define CONFIG_DMI 1
+#endif
+
#endif
diff --git a/sys/dev/pci/drm/include/linux/mod_devicetable.h b/sys/dev/pci/drm/include/linux/mod_devicetable.h
index 1a7bef7dc37..173f3107763 100644
--- a/sys/dev/pci/drm/include/linux/mod_devicetable.h
+++ b/sys/dev/pci/drm/include/linux/mod_devicetable.h
@@ -32,9 +32,10 @@ struct dmi_strmatch {
};
struct dmi_system_id {
- int (*callback)(const struct dmi_system_id *);
- const char *ident;
- struct dmi_strmatch matches[4];
+ int (*callback)(const struct dmi_system_id *);
+ const char *ident;
+ struct dmi_strmatch matches[4];
+ void *driver_data;
};
#define DMI_MATCH(a, b) {(a), (b)}
#define DMI_EXACT_MATCH(a, b) {(a), (b)}