1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-27 23:22:37 +02:00

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.

Corresponding to flashrom svn r1058.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Patrick Georgi <patrick.georgi@coresystems.de>
This commit is contained in:
Carl-Daniel Hailfinger 2010-06-23 23:14:44 +00:00
parent dcef67e468
commit e1fdff4472

23
dmi.c
View File

@ -24,6 +24,26 @@
#include "flash.h" #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[] = { const char *dmidecode_names[] = {
"system-manufacturer", "system-manufacturer",
"system-product-name", "system-product-name",
@ -36,7 +56,6 @@ const char *dmidecode_names[] = {
#define DMI_COMMAND_LEN_MAX 260 #define DMI_COMMAND_LEN_MAX 260
const char *dmidecode_command = "dmidecode"; const char *dmidecode_command = "dmidecode";
int has_dmi_support = 0;
char *dmistrings[ARRAY_SIZE(dmidecode_names)]; char *dmistrings[ARRAY_SIZE(dmidecode_names)];
/* Strings longer than 4096 in DMI are just insane. */ /* Strings longer than 4096 in DMI are just insane. */
@ -172,3 +191,5 @@ int dmi_match(const char *pattern)
return 0; return 0;
} }
#endif /* STANDALONE */