[coreboot] New patch to review for coreboot: b26658a Set SMBIOS mainboard version based on i2c eeprom

Christian Gmeiner (christian.gmeiner@gmail.com) gerrit at coreboot.org
Fri Sep 14 16:22:40 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/1512

-gerrit

commit b26658aa0e3116ff29ef6d801ea2da9065e953c3
Author: Christian Gmeiner <christian.gmeiner at gmail.com>
Date:   Fri Sep 14 16:29:10 2012 +0200

    Set SMBIOS mainboard version based on i2c eeprom
    
    In the field there are different hardware revisions and some
    of them have problems with UDMA as a resistor is missing. We can
    detect this situation in coreboot and e.g. the linux kernel
    can take this knowledge and disable UDMA.
    
    Change-Id: Ib75cad7acedbc1dc65378bb9bfc3f353cbe21427
    Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
---
 src/mainboard/bachmann/ot200/mainboard.c | 52 ++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/src/mainboard/bachmann/ot200/mainboard.c b/src/mainboard/bachmann/ot200/mainboard.c
index 76b3c53..74555b6 100644
--- a/src/mainboard/bachmann/ot200/mainboard.c
+++ b/src/mainboard/bachmann/ot200/mainboard.c
@@ -18,7 +18,59 @@
  */
 
 #include <device/device.h>
+#include <device/smbus.h>
+#include <smbios.h>
+#include <console/console.h>
+
+/* overwrite a weak function to fill SMBIOS table with a custom value */
+static u8 hw_rev = 0;
+static char mb_rev_str[2] = { '0' };
+
+const char *smbios_mainboard_version(void)
+{
+	/* UDMA is not working on all supported devices */
+	if (hw_rev < 113) {
+		mb_rev_str[0] = '1';
+	} else {
+		mb_rev_str[0] = '2';
+	}
+
+	return mb_rev_str;
+}
+
+static void init(struct device *dev)
+{
+	unsigned int i;
+	u32 chksum = 0;
+	char block[20];
+	device_t eeprom_dev = dev_find_slot_on_smbus(1, 0x52);
+
+	if (eeprom_dev == 0) {
+		printk(BIOS_WARNING, "eeprom not found\n");
+		return;
+	}
+
+	/* read the whole block and check if checksum is okay */
+	for (i = 0; i < 20; i++) {
+		block[i] = smbus_read_byte(eeprom_dev, i);
+		chksum += block[i];
+	}
+
+	if (chksum != 0) {
+		printk(BIOS_WARNING, "wrong checksum: 0x%0x\n", chksum);
+	}
+
+	hw_rev = block[5];
+
+	printk(BIOS_DEBUG, "hw revision: %u\n", hw_rev);
+}
+
+static void enable_dev(struct device *dev)
+{
+	dev->ops->init = init;
+}
 
 struct chip_operations mainboard_ops = {
 	CHIP_NAME(CONFIG_MAINBOARD_VENDOR " " CONFIG_MAINBOARD_PART_NUMBER)
+	.enable_dev = enable_dev,
 };




More information about the coreboot mailing list