summaryrefslogtreecommitdiff
path: root/dmi.c
diff options
context:
space:
mode:
authorhailfinger <hailfinger@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2010-06-23 23:14:44 +0000
committerhailfinger <hailfinger@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2010-06-23 23:14:44 +0000
commit15e2365555707d221bb9131a51a623c0148bb5a5 (patch)
tree39108a90e8f265d2bcae5f03707472bb6fecc3ce /dmi.c
parent3f52c8813d2846effdcfcd3abef9d0f53240a56b (diff)
downloadflashrom-15e2365555707d221bb9131a51a623c0148bb5a5.tar.gz
If flashrom is standalone and has no OS below, it can't call dmidecode.
Provide empty DMI stubs for that case until someone implements our own dmidecode subset. Tested by Patrick Georgi on top of libpayload. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Patrick Georgi <patrick.georgi@coresystems.de> git-svn-id: https://code.coreboot.org/svn/flashrom/trunk@1058 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'dmi.c')
-rw-r--r--dmi.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/dmi.c b/dmi.c
index cde11a5..40ca85c 100644
--- a/dmi.c
+++ b/dmi.c
@@ -24,6 +24,26 @@
#include "flash.h"
+int has_dmi_support = 0;
+
+#if STANDALONE
+
+/* Stub to indicate missing DMI functionality.
+ * has_dmi_support is 0 by default, so nothing to do here.
+ * Because dmidecode is not available on all systems, the goal is to implement
+ * the DMI subset we need directly in this file.
+ */
+void dmi_init(void)
+{
+}
+
+int dmi_match(const char *pattern)
+{
+ return 0;
+}
+
+#else /* STANDALONE */
+
const char *dmidecode_names[] = {
"system-manufacturer",
"system-product-name",
@@ -36,7 +56,6 @@ const char *dmidecode_names[] = {
#define DMI_COMMAND_LEN_MAX 260
const char *dmidecode_command = "dmidecode";
-int has_dmi_support = 0;
char *dmistrings[ARRAY_SIZE(dmidecode_names)];
/* Strings longer than 4096 in DMI are just insane. */
@@ -172,3 +191,5 @@ int dmi_match(const char *pattern)
return 0;
}
+
+#endif /* STANDALONE */