Extend smbios api to allow runtime change of mainboard serial and version

This patch extends the current smbios api to allow changing mainboard
serial and version during coreboot runtime. This is helpful if you
have an EEPROM etc. to access these informations and want to add
some quirks for broken hardware revision for the linux kernel.
This could be done via DMI_MATCH marco.

Change-Id: I1924a56073084e965a23e47873d9f8542070423c
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-on: http://review.coreboot.org/1232
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
This commit is contained in:
Christian Gmeiner 2012-07-25 13:42:40 +02:00 committed by Patrick Georgi
parent 594473d75a
commit ac3aa096c9
2 changed files with 15 additions and 2 deletions

View File

@ -163,6 +163,16 @@ static int smbios_write_type0(unsigned long *current, int handle)
return len; return len;
} }
const char *__attribute__((weak)) smbios_mainboard_serial_number(void)
{
return CONFIG_MAINBOARD_SERIAL_NUMBER;
}
const char *__attribute__((weak)) smbios_mainboard_version(void)
{
return CONFIG_MAINBOARD_VERSION;
}
static int smbios_write_type1(unsigned long *current, int handle) static int smbios_write_type1(unsigned long *current, int handle)
{ {
struct smbios_type1 *t = (struct smbios_type1 *)*current; struct smbios_type1 *t = (struct smbios_type1 *)*current;
@ -174,8 +184,8 @@ static int smbios_write_type1(unsigned long *current, int handle)
t->length = len - 2; t->length = len - 2;
t->manufacturer = smbios_add_string(t->eos, CONFIG_MAINBOARD_VENDOR); t->manufacturer = smbios_add_string(t->eos, CONFIG_MAINBOARD_VENDOR);
t->product_name = smbios_add_string(t->eos, CONFIG_MAINBOARD_PART_NUMBER); t->product_name = smbios_add_string(t->eos, CONFIG_MAINBOARD_PART_NUMBER);
t->serial_number = smbios_add_string(t->eos, CONFIG_MAINBOARD_SERIAL_NUMBER); t->serial_number = smbios_add_string(t->eos, smbios_mainboard_serial_number());
t->version = smbios_add_string(t->eos, CONFIG_MAINBOARD_VERSION); t->version = smbios_add_string(t->eos, smbios_mainboard_version());
len = t->length + smbios_string_table_len(t->eos); len = t->length + smbios_string_table_len(t->eos);
*current += len; *current += len;
return len; return len;

View File

@ -7,6 +7,9 @@ unsigned long smbios_write_tables(unsigned long start);
int smbios_add_string(char *start, const char *str); int smbios_add_string(char *start, const char *str);
int smbios_string_table_len(char *start); int smbios_string_table_len(char *start);
const char *smbios_mainboard_serial_number(void);
const char *smbios_mainboard_version(void);
#define BIOS_CHARACTERISTICS_PCI_SUPPORTED (1 << 7) #define BIOS_CHARACTERISTICS_PCI_SUPPORTED (1 << 7)
#define BIOS_CHARACTERISTICS_PC_CARD (1 << 8) #define BIOS_CHARACTERISTICS_PC_CARD (1 << 8)
#define BIOS_CHARACTERISTICS_PNP (1 << 9) #define BIOS_CHARACTERISTICS_PNP (1 << 9)