blob: f329fab64452ae0d967ba87c67ee93b57ad1112e [file] [log] [blame]
Michael Karcher6701ee82010-01-20 14:14:11 +00001/*
2 * This file is part of the flashrom project.
3 *
Sean Nelson4c6d3a42013-09-11 23:35:03 +00004 * Copyright (C) 2000-2002 Alan Cox <alan@redhat.com>
5 * Copyright (C) 2002-2010 Jean Delvare <khali@linux-fr.org>
Michael Karcher6701ee82010-01-20 14:14:11 +00006 * Copyright (C) 2009,2010 Michael Karcher
Sean Nelson4c6d3a42013-09-11 23:35:03 +00007 * Copyright (C) 2011-2013 Stefan Tauner
Michael Karcher6701ee82010-01-20 14:14:11 +00008 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
Carl-Daniel Hailfinger1c6d2ff2012-08-27 00:44:42 +000024#include <strings.h>
Michael Karcher6701ee82010-01-20 14:14:11 +000025#include <string.h>
Stefan Tauner9972d152014-07-13 12:52:15 +000026#include <ctype.h>
Michael Karcher6701ee82010-01-20 14:14:11 +000027#include <stdio.h>
28#include <stdlib.h>
29
30#include "flash.h"
Carl-Daniel Hailfinger5b997c32010-07-27 22:41:39 +000031#include "programmer.h"
Michael Karcher6701ee82010-01-20 14:14:11 +000032
Sean Nelson4c6d3a42013-09-11 23:35:03 +000033#if defined(__i386__) || defined(__x86_64__)
34
35/* Enable SMBIOS decoding. Currently legacy DMI decoding is enough. */
36#define SM_SUPPORT 0
37
38/* Strings longer than 4096 in DMI are just insane. */
39#define DMI_MAX_ANSWER_LEN 4096
40
Carl-Daniel Hailfingere1fdff42010-06-23 23:14:44 +000041int has_dmi_support = 0;
42
Sean Nelson4c6d3a42013-09-11 23:35:03 +000043static struct {
44 const char *const keyword;
45 const uint8_t type;
46 const uint8_t offset;
47 char *value;
48} dmi_strings[] = {
49 { "system-manufacturer", 1, 0x04, NULL },
50 { "system-product-name", 1, 0x05, NULL },
51 { "system-version", 1, 0x06, NULL },
52 { "baseboard-manufacturer", 2, 0x04, NULL },
53 { "baseboard-product-name", 2, 0x05, NULL },
54 { "baseboard-version", 2, 0x06, NULL },
Michael Karcher6701ee82010-01-20 14:14:11 +000055};
56
Stefan Taunera34d7192011-07-26 00:54:42 +000057/* This list is used to identify supposed laptops. The is_laptop field has the
58 * following meaning:
59 * - 0: in all likelihood not a laptop
60 * - 1: in all likelihood a laptop
61 * - 2: chassis-type is not specific enough
62 * A full list of chassis types can be found in the System Management BIOS
Carl-Daniel Hailfingercb3eb052010-09-26 21:43:53 +000063 * (SMBIOS) Reference Specification 2.7.0 section 7.4.1 "Chassis Types" at
64 * http://www.dmtf.org/sites/default/files/standards/documents/DSP0134_2.7.0.pdf
65 * The types below are the most common ones.
66 */
67static const struct {
Sean Nelson4c6d3a42013-09-11 23:35:03 +000068 uint8_t type;
69 uint8_t is_laptop;
70 char *name;
Carl-Daniel Hailfingercb3eb052010-09-26 21:43:53 +000071} dmi_chassis_types[] = {
Stefan Taunera34d7192011-07-26 00:54:42 +000072 {0x01, 2, "Other"},
73 {0x02, 2, "Unknown"},
Stefan Tauner4c5665f2012-02-17 20:03:37 +000074 {0x03, 0, "Desktop"},
75 {0x04, 0, "Low Profile Desktop"},
Stefan Taunera34d7192011-07-26 00:54:42 +000076 {0x06, 0, "Mini Tower"},
77 {0x07, 0, "Tower"},
Carl-Daniel Hailfingercb3eb052010-09-26 21:43:53 +000078 {0x08, 1, "Portable"},
79 {0x09, 1, "Laptop"},
80 {0x0a, 1, "Notebook"},
81 {0x0b, 1, "Hand Held"},
82 {0x0e, 1, "Sub Notebook"},
Stefan Taunera34d7192011-07-26 00:54:42 +000083 {0x11, 0, "Main Server Chassis"},
84 {0x17, 0, "Rack Mount Chassis"},
Sylvain "ythier" Hitier3093f8f2011-09-03 11:22:27 +000085 {0x18, 0, "Sealed-case PC"}, /* used by Supermicro (X8SIE) */
Carl-Daniel Hailfingercb3eb052010-09-26 21:43:53 +000086};
87
Sean Nelson4c6d3a42013-09-11 23:35:03 +000088#if CONFIG_INTERNAL_DMI == 1
89#ifdef __DJGPP__ /* There is no strnlen in DJGPP. FIXME: Move this to a common utility file. */
90size_t strnlen(const char *str, size_t n)
91{
92 size_t i;
93 for (i = 0; i < n && str[i] != '\0'; i++)
94 ;
95 return i;
96}
97#endif
98
99static bool dmi_checksum(const uint8_t * const buf, size_t len)
100{
101 uint8_t sum = 0;
102 size_t a;
103
104 for (a = 0; a < len; a++)
105 sum += buf[a];
106 return (sum == 0);
107}
108
Stefan Tauner9972d152014-07-13 12:52:15 +0000109/** Retrieve a DMI string.
110 *
111 * See SMBIOS spec. section 6.1.3 "Text strings".
112 * The table will be unmapped ASAP, hence return a duplicated & sanitized string that needs to be freed later.
113 *
114 * \param buf the buffer to search through (usually appended directly to a DMI structure)
115 * \param string_id index of the string to look for
116 * \param limit pointer to the first byte beyond \em buf
117 */
118static char *dmi_string(const char *buf, uint8_t string_id, const char *limit)
Sean Nelson4c6d3a42013-09-11 23:35:03 +0000119{
120 size_t i, len;
121
122 if (string_id == 0)
123 return "Not Specified";
124
125 while (string_id > 1 && string_id--) {
Stefan Tauner9972d152014-07-13 12:52:15 +0000126 if (buf >= limit) {
Sean Nelson4c6d3a42013-09-11 23:35:03 +0000127 msg_perr("DMI table is broken (string portion out of bounds)!\n");
128 return "<OUT OF BOUNDS>";
129 }
Stefan Tauner9972d152014-07-13 12:52:15 +0000130 buf += strnlen(buf, limit - buf) + 1;
Sean Nelson4c6d3a42013-09-11 23:35:03 +0000131 }
132
133 if (!*buf) /* as long as the current byte we're on isn't null */
134 return "<BAD INDEX>";
135
Stefan Tauner9972d152014-07-13 12:52:15 +0000136 len = strnlen(buf, limit - buf);
137 char *newbuf = malloc(len + 1);
138 if (newbuf == NULL) {
139 msg_perr("Out of memory!\n");
140 return NULL;
141 }
Sean Nelson4c6d3a42013-09-11 23:35:03 +0000142
143 /* fix junk bytes in the string */
Stefan Tauner9972d152014-07-13 12:52:15 +0000144 for (i = 0; i < len && buf[i] != '\0'; i++) {
145 if (isprint(buf[i]))
146 newbuf[i] = buf[i];
147 else
148 newbuf[i] = ' ';
149 }
150 newbuf[i] = '\0';
Sean Nelson4c6d3a42013-09-11 23:35:03 +0000151
Stefan Tauner9972d152014-07-13 12:52:15 +0000152 return newbuf;
Sean Nelson4c6d3a42013-09-11 23:35:03 +0000153}
154
155static void dmi_chassis_type(uint8_t code)
156{
157 int i;
158 code &= 0x7f; /* bits 6:0 are chassis type, 7th bit is the lock bit */
159 is_laptop = 2;
160 for (i = 0; i < ARRAY_SIZE(dmi_chassis_types); i++) {
161 if (code == dmi_chassis_types[i].type) {
162 msg_pdbg("DMI string chassis-type: \"%s\"\n", dmi_chassis_types[i].name);
163 is_laptop = dmi_chassis_types[i].is_laptop;
164 break;
165 }
166 }
167}
168
169static void dmi_table(uint32_t base, uint16_t len, uint16_t num)
170{
171 int i = 0, j = 0;
172
Carl-Daniel Hailfinger43eac032014-03-05 00:16:16 +0000173 uint8_t *dmi_table_mem = physmap_ro("DMI Table", base, len);
Sean Nelson4c6d3a42013-09-11 23:35:03 +0000174 if (dmi_table_mem == NULL) {
175 msg_perr("Unable to access DMI Table\n");
176 return;
177 }
178
179 uint8_t *data = dmi_table_mem;
180 uint8_t *limit = dmi_table_mem + len;
181
182 /* SMBIOS structure header is always 4 B long and contains:
183 * - uint8_t type; // see dmi_chassis_types's type
184 * - uint8_t length; // data section w/ header w/o strings
185 * - uint16_t handle;
186 */
Stefan Tauner9972d152014-07-13 12:52:15 +0000187 while (i < num && data + 4 < limit) {
Sean Nelson4c6d3a42013-09-11 23:35:03 +0000188 /* - If a short entry is found (less than 4 bytes), not only it
189 * is invalid, but we cannot reliably locate the next entry.
190 * - If the length value indicates that this structure spreads
191 * accross the table border, something is fishy too.
192 * Better stop at this point, and let the user know his/her
193 * table is broken.
194 */
Stefan Tauner9972d152014-07-13 12:52:15 +0000195 if (data[1] < 4 || data + data[1] >= limit) {
Sean Nelson4c6d3a42013-09-11 23:35:03 +0000196 msg_perr("DMI table is broken (bogus header)!\n");
197 break;
198 }
199
200 if(data[0] == 3) {
Stefan Tauner9972d152014-07-13 12:52:15 +0000201 if (data + 5 < limit)
Sean Nelson4c6d3a42013-09-11 23:35:03 +0000202 dmi_chassis_type(data[5]);
Stefan Tauner9972d152014-07-13 12:52:15 +0000203 else /* the table is broken, but laptop detection is optional, hence continue. */
204 msg_pwarn("DMI table is broken (chassis_type out of bounds)!\n");
Sean Nelson4c6d3a42013-09-11 23:35:03 +0000205 } else
206 for (j = 0; j < ARRAY_SIZE(dmi_strings); j++) {
207 uint8_t offset = dmi_strings[j].offset;
208 uint8_t type = dmi_strings[j].type;
209
210 if (data[0] != type)
211 continue;
212
Stefan Tauner9972d152014-07-13 12:52:15 +0000213 if (data[1] <= offset || data + offset >= limit) {
Sean Nelson4c6d3a42013-09-11 23:35:03 +0000214 msg_perr("DMI table is broken (offset out of bounds)!\n");
215 goto out;
216 }
217
Stefan Tauner9972d152014-07-13 12:52:15 +0000218 dmi_strings[j].value = dmi_string((const char *)(data + data[1]), data[offset],
219 (const char *)limit);
Sean Nelson4c6d3a42013-09-11 23:35:03 +0000220 }
221 /* Find next structure by skipping data and string sections */
222 data += data[1];
223 while (data + 1 <= limit) {
224 if (data[0] == 0 && data[1] == 0)
225 break;
226 data++;
227 }
228 data += 2;
229 i++;
230 }
231out:
232 physunmap(dmi_table_mem, len);
233}
234
235#if SM_SUPPORT
236static int smbios_decode(uint8_t *buf)
237{
238 /* TODO: other checks mentioned in the conformance guidelines? */
239 if (!dmi_checksum(buf, buf[0x05]) ||
240 (memcmp(buf + 0x10, "_DMI_", 5) != 0) ||
241 !dmi_checksum(buf + 0x10, 0x0F))
242 return 0;
243
244 dmi_table(mmio_readl(buf + 0x18), mmio_readw(buf + 0x16), mmio_readw(buf + 0x1C));
245
246 return 1;
247}
248#endif
249
250static int legacy_decode(uint8_t *buf)
251{
252 if (!dmi_checksum(buf, 0x0F))
253 return 1;
254
255 dmi_table(mmio_readl(buf + 0x08), mmio_readw(buf + 0x06), mmio_readw(buf + 0x0C));
256
257 return 0;
258}
259
260int dmi_fill(void)
261{
262 size_t fp;
263 uint8_t *dmi_mem;
264 int ret = 1;
265
266 msg_pdbg("Using Internal DMI decoder.\n");
267 /* There are two ways specified to gain access to the SMBIOS table:
268 * - EFI's configuration table contains a pointer to the SMBIOS table. On linux it can be obtained from
269 * sysfs. EFI's SMBIOS GUID is: {0xeb9d2d31,0x2d88,0x11d3,0x9a,0x16,0x0,0x90,0x27,0x3f,0xc1,0x4d}
270 * - Scanning physical memory address range 0x000F0000h to 0x000FFFFF for the anchor-string(s). */
Niklas Söderlund5d307202013-09-14 09:02:27 +0000271 dmi_mem = physmap_ro("DMI", 0xF0000, 0x10000);
272 if (dmi_mem == ERROR_PTR)
Sean Nelson4c6d3a42013-09-11 23:35:03 +0000273 return ret;
274
275 for (fp = 0; fp <= 0xFFF0; fp += 16) {
276#if SM_SUPPORT
277 if (memcmp(dmi_mem + fp, "_SM_", 4) == 0 && fp <= 0xFFE0) {
278 if (smbios_decode(dmi_mem + fp)) // FIXME: length check
279 goto out;
280 } else
281#endif
282 if (memcmp(dmi_mem + fp, "_DMI_", 5) == 0)
283 if (legacy_decode(dmi_mem + fp) == 0) {
284 ret = 0;
285 goto out;
286 }
287 }
288 msg_pinfo("No DMI table found.\n");
289out:
290 physunmap(dmi_mem, 0x10000);
291 return ret;
292}
293
294#else /* CONFIG_INTERNAL_DMI */
295
296#define DMI_COMMAND_LEN_MAX 300
Carl-Daniel Hailfingerad3cc552010-07-03 11:02:10 +0000297static const char *dmidecode_command = "dmidecode";
Michael Karcher6701ee82010-01-20 14:14:11 +0000298
Michael Karcher0d7fb7c2010-02-26 09:51:16 +0000299static char *get_dmi_string(const char *string_name)
Michael Karcher6701ee82010-01-20 14:14:11 +0000300{
301 FILE *dmidecode_pipe;
Michael Karcher0d7fb7c2010-02-26 09:51:16 +0000302 char *result;
303 char answerbuf[DMI_MAX_ANSWER_LEN];
Sean Nelson4c6d3a42013-09-11 23:35:03 +0000304 char commandline[DMI_COMMAND_LEN_MAX];
Uwe Hermann43959702010-03-13 17:28:29 +0000305
Michael Karcher0d7fb7c2010-02-26 09:51:16 +0000306 snprintf(commandline, sizeof(commandline),
307 "%s -s %s", dmidecode_command, string_name);
308 dmidecode_pipe = popen(commandline, "r");
309 if (!dmidecode_pipe) {
Stefan Taunerc6fa32d2013-01-04 22:54:07 +0000310 msg_perr("Opening DMI pipe failed!\n");
Michael Karcher0d7fb7c2010-02-26 09:51:16 +0000311 return NULL;
Michael Karcher6701ee82010-01-20 14:14:11 +0000312 }
Michael Karcherd9f266d2010-08-08 21:56:52 +0000313
314 /* Kill lines starting with '#', as recent dmidecode versions
Uwe Hermann91f4afa2011-07-28 08:13:25 +0000315 * have the quirk to emit a "# SMBIOS implementations newer..."
316 * message even on "-s" if the SMBIOS declares a
317 * newer-than-supported version number, while it *should* only print
318 * the requested string.
319 */
Michael Karcherd9f266d2010-08-08 21:56:52 +0000320 do {
321 if (!fgets(answerbuf, DMI_MAX_ANSWER_LEN, dmidecode_pipe)) {
Uwe Hermann91f4afa2011-07-28 08:13:25 +0000322 if (ferror(dmidecode_pipe)) {
Michael Karcherd9f266d2010-08-08 21:56:52 +0000323 msg_perr("DMI pipe read error\n");
324 pclose(dmidecode_pipe);
325 return NULL;
326 } else {
327 answerbuf[0] = 0; /* Hit EOF */
328 }
Michael Karcher45f79cb2010-03-24 17:55:04 +0000329 }
Uwe Hermann91f4afa2011-07-28 08:13:25 +0000330 } while (answerbuf[0] == '#');
Michael Karcherd9f266d2010-08-08 21:56:52 +0000331
Stefan Taunerc6fa32d2013-01-04 22:54:07 +0000332 /* Discard all output exceeding DMI_MAX_ANSWER_LEN to prevent deadlock on pclose. */
Michael Karcher0d7fb7c2010-02-26 09:51:16 +0000333 while (!feof(dmidecode_pipe))
334 getc(dmidecode_pipe);
335 if (pclose(dmidecode_pipe) != 0) {
Stefan Taunerc6fa32d2013-01-04 22:54:07 +0000336 msg_pwarn("dmidecode execution unsuccessful - continuing without DMI info\n");
Michael Karcher0d7fb7c2010-02-26 09:51:16 +0000337 return NULL;
338 }
Michael Karcher6701ee82010-01-20 14:14:11 +0000339
Uwe Hermann43959702010-03-13 17:28:29 +0000340 /* Chomp trailing newline. */
Uwe Hermann91f4afa2011-07-28 08:13:25 +0000341 if (answerbuf[0] != 0 && answerbuf[strlen(answerbuf) - 1] == '\n')
Michael Karcher0d7fb7c2010-02-26 09:51:16 +0000342 answerbuf[strlen(answerbuf) - 1] = 0;
Michael Karcher0d7fb7c2010-02-26 09:51:16 +0000343
344 result = strdup(answerbuf);
Sean Nelson4c6d3a42013-09-11 23:35:03 +0000345 if (result == NULL)
Stefan Taunerc6fa32d2013-01-04 22:54:07 +0000346 msg_pwarn("Warning: Out of memory - DMI support fails");
Michael Karcher0d7fb7c2010-02-26 09:51:16 +0000347
348 return result;
349}
350
Sean Nelson4c6d3a42013-09-11 23:35:03 +0000351int dmi_fill(void)
Michael Karcher0d7fb7c2010-02-26 09:51:16 +0000352{
353 int i;
Michael Karcher8c1df282010-02-26 09:51:20 +0000354 char *chassis_type;
Uwe Hermann43959702010-03-13 17:28:29 +0000355
Sean Nelson4c6d3a42013-09-11 23:35:03 +0000356 msg_pdbg("Using External DMI decoder.\n");
357 for (i = 0; i < ARRAY_SIZE(dmi_strings); i++) {
358 dmi_strings[i].value = get_dmi_string(dmi_strings[i].keyword);
359 if (dmi_strings[i].value == NULL)
360 return 1;
Michael Karcher0d7fb7c2010-02-26 09:51:16 +0000361 }
Michael Karcher8c1df282010-02-26 09:51:20 +0000362
363 chassis_type = get_dmi_string("chassis-type");
Stefan Taunera34d7192011-07-26 00:54:42 +0000364 if (chassis_type == NULL)
Sean Nelson4c6d3a42013-09-11 23:35:03 +0000365 return 0; /* chassis-type handling is optional anyway */
Stefan Taunera34d7192011-07-26 00:54:42 +0000366
Sean Nelson4c6d3a42013-09-11 23:35:03 +0000367 msg_pdbg("DMI string chassis-type: \"%s\"\n", chassis_type);
Stefan Taunera34d7192011-07-26 00:54:42 +0000368 is_laptop = 2;
369 for (i = 0; i < ARRAY_SIZE(dmi_chassis_types); i++) {
370 if (strcasecmp(chassis_type, dmi_chassis_types[i].name) == 0) {
371 is_laptop = dmi_chassis_types[i].is_laptop;
372 break;
Carl-Daniel Hailfingercb3eb052010-09-26 21:43:53 +0000373 }
Michael Karcher8c1df282010-02-26 09:51:20 +0000374 }
Sean Nelson4c6d3a42013-09-11 23:35:03 +0000375 free(chassis_type);
376 return 0;
377}
378
379#endif /* CONFIG_INTERNAL_DMI */
380
381static int dmi_shutdown(void *data)
382{
383 int i;
384 for (i = 0; i < ARRAY_SIZE(dmi_strings); i++) {
385 free(dmi_strings[i].value);
386 dmi_strings[i].value = NULL;
387 }
388 return 0;
389}
390
391void dmi_init(void)
392{
393 /* Register shutdown function before we allocate anything. */
394 if (register_shutdown(dmi_shutdown, NULL)) {
395 msg_pwarn("Warning: Could not register DMI shutdown function - continuing without DMI info.\n");
396 return;
397 }
398
399 /* dmi_fill fills the dmi_strings array, and if possible sets the global is_laptop variable. */
400 if (dmi_fill() != 0)
401 return;
Stefan Taunera34d7192011-07-26 00:54:42 +0000402
403 switch (is_laptop) {
404 case 1:
405 msg_pdbg("Laptop detected via DMI.\n");
406 break;
407 case 2:
408 msg_pdbg("DMI chassis-type is not specific enough.\n");
409 break;
410 }
Sean Nelson4c6d3a42013-09-11 23:35:03 +0000411
412 has_dmi_support = 1;
413 int i;
414 for (i = 0; i < ARRAY_SIZE(dmi_strings); i++) {
415 msg_pdbg("DMI string %s: \"%s\"\n", dmi_strings[i].keyword,
416 (dmi_strings[i].value == NULL) ? "" : dmi_strings[i].value);
417 }
Michael Karcher6701ee82010-01-20 14:14:11 +0000418}
419
420/**
421 * Does an substring/prefix/postfix/whole-string match.
422 *
423 * The pattern is matched as-is. The only metacharacters supported are '^'
424 * at the beginning and '$' at the end. So you can look for "^prefix",
425 * "suffix$", "substring" or "^complete string$".
426 *
Stefan Taunerd1045d82013-10-29 01:38:45 +0000427 * @param value The non-NULL string to check.
428 * @param pattern The non-NULL pattern.
Michael Karcher6701ee82010-01-20 14:14:11 +0000429 * @return Nonzero if pattern matches.
430 */
431static int dmi_compare(const char *value, const char *pattern)
432{
Carl-Daniel Hailfinger082c8b52011-08-15 19:54:20 +0000433 int anchored = 0;
434 int patternlen;
Uwe Hermann43959702010-03-13 17:28:29 +0000435
Sean Nelson316a29f2010-05-07 20:09:04 +0000436 msg_pspew("matching %s against %s\n", value, pattern);
Uwe Hermann43959702010-03-13 17:28:29 +0000437 /* The empty string is part of all strings! */
Michael Karcher6701ee82010-01-20 14:14:11 +0000438 if (pattern[0] == 0)
439 return 1;
440
441 if (pattern[0] == '^') {
442 anchored = 1;
443 pattern++;
444 }
445
446 patternlen = strlen(pattern);
447 if (pattern[patternlen - 1] == '$') {
448 int valuelen = strlen(value);
449 patternlen--;
Uwe Hermann43959702010-03-13 17:28:29 +0000450 if (patternlen > valuelen)
Michael Karcher6701ee82010-01-20 14:14:11 +0000451 return 0;
452
453 /* full string match: require same length */
Uwe Hermann43959702010-03-13 17:28:29 +0000454 if (anchored && (valuelen != patternlen))
Michael Karcher6701ee82010-01-20 14:14:11 +0000455 return 0;
456
457 /* start character to make ends match */
458 value += valuelen - patternlen;
459 anchored = 1;
460 }
461
462 if (anchored)
463 return strncmp(value, pattern, patternlen) == 0;
464 else
465 return strstr(value, pattern) != NULL;
466}
467
468int dmi_match(const char *pattern)
469{
470 int i;
Uwe Hermann43959702010-03-13 17:28:29 +0000471
Michael Karcher6701ee82010-01-20 14:14:11 +0000472 if (!has_dmi_support)
473 return 0;
474
Stefan Taunerd1045d82013-10-29 01:38:45 +0000475 for (i = 0; i < ARRAY_SIZE(dmi_strings); i++) {
476 if (dmi_strings[i].value == NULL)
477 continue;
478
Sean Nelson4c6d3a42013-09-11 23:35:03 +0000479 if (dmi_compare(dmi_strings[i].value, pattern))
Michael Karcher4dfa0932010-02-12 05:44:18 +0000480 return 1;
Stefan Taunerd1045d82013-10-29 01:38:45 +0000481 }
Michael Karcher6701ee82010-01-20 14:14:11 +0000482
483 return 0;
484}
Carl-Daniel Hailfingere1fdff42010-06-23 23:14:44 +0000485
Sean Nelson4c6d3a42013-09-11 23:35:03 +0000486#endif // defined(__i386__) || defined(__x86_64__)