[coreboot] New patch to review for coreboot: 0cd6e0f Extend smbios api to allow runtime change of mainboard serial and version

Christian Gmeiner (christian.gmeiner@gmail.com) gerrit at coreboot.org
Tue Jul 17 14:08:31 CEST 2012


Christian Gmeiner (christian.gmeiner at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1232

-gerrit

commit 0cd6e0f0227748e8a04c6431b2d658f4eeda3cd3
Author: Christian Gmeiner <christian.gmeiner at gmail.com>
Date:   Tue Jul 17 14:06:25 2012 +0200

    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 at gmail.com>
---
 src/arch/x86/boot/smbios.c |   17 +++++++++++++++--
 src/include/smbios.h       |    2 ++
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/arch/x86/boot/smbios.c b/src/arch/x86/boot/smbios.c
index 3b9e5a1..becc003 100644
--- a/src/arch/x86/boot/smbios.c
+++ b/src/arch/x86/boot/smbios.c
@@ -162,6 +162,19 @@ static int smbios_write_type0(unsigned long *current, int handle)
 	return len;
 }
 
+static const char *mainboard_serial_number = CONFIG_MAINBOARD_SERIAL_NUMBER;
+static const char *mainboard_version = CONFIG_MAINBOARD_VERSION;
+
+void smbios_set_mainboard_serial(const char *serial)
+{
+	mainboard_serial_number = serial;
+}
+
+void smbios_set_mainboard_version(const char *version)
+{
+	mainboard_version= version;
+}
+
 static int smbios_write_type1(unsigned long *current, int handle)
 {
 	struct smbios_type1 *t = (struct smbios_type1 *)*current;
@@ -173,8 +186,8 @@ static int smbios_write_type1(unsigned long *current, int handle)
 	t->length = len - 2;
 	t->manufacturer = smbios_add_string(t->eos, CONFIG_MAINBOARD_VENDOR);
 	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->version = smbios_add_string(t->eos, CONFIG_MAINBOARD_VERSION);
+	t->serial_number = smbios_add_string(t->eos, mainboard_serial_number);
+	t->version = smbios_add_string(t->eos, mainboard_version);
 	len = t->length + smbios_string_table_len(t->eos);
 	*current += len;
 	return len;
diff --git a/src/include/smbios.h b/src/include/smbios.h
index 7912ba1..9b4455d 100644
--- a/src/include/smbios.h
+++ b/src/include/smbios.h
@@ -6,6 +6,8 @@
 unsigned long smbios_write_tables(unsigned long start);
 int smbios_add_string(char *start, const char *str);
 int smbios_string_table_len(char *start);
+void smbios_set_mainboard_serial(const char *serial);
+void smbios_set_mainboard_version(const char *version);
 
 #define BIOS_CHARACTERISTICS_PCI_SUPPORTED  (1 << 7)
 #define BIOS_CHARACTERISTICS_PC_CARD  (1 << 8)




More information about the coreboot mailing list