Patchwork New patch to review: 4189bff X60/T60: set CMOS defaults

login
register
about
Submitter gerrit@coreboot.org
Date 2011-06-12 13:39:01
Message ID <E1QVksX-0007bE-Kv@ra.coresystems.de>
Download mbox | patch
Permalink /patch/3116/
State New, archived
Headers show

Comments

gerrit@coreboot.org - 2011-06-12 13:39:01
Sven Schnelle (svens@stackframe.org) just uploaded a new patch set to gerrit, which you can find at
http://review.coreboot.org/26

-gerrit

Patch

commit 4189bff26a409f2359ff6d5f686994105091c5ef
Author: Sven Schnelle <svens@stackframe.org>
Date:   Sun Jun 12 15:08:58 2011 +0200

    X60/T60: set CMOS defaults
    
    Change-Id: I5789a03898cdbade67887c0389aab5c773f867d9
    Signed-off-by: Sven Schnelle <svens@stackframe.org>

diff --git a/src/mainboard/lenovo/t60/mainboard.c b/src/mainboard/lenovo/t60/mainboard.c
index 7751453..2e11cdb 100644
--- a/src/mainboard/lenovo/t60/mainboard.c
+++ b/src/mainboard/lenovo/t60/mainboard.c
@@ -34,10 +34,12 @@ 
 #include <ec/acpi/ec.h>
 #include <ec/lenovo/h8/h8.h>
 #include <northbridge/intel/i945/i945.h>
+#include <pc80/mc146818rtc.h>
 
 static void mainboard_enable(device_t dev)
 {
 	device_t dev0, idedev;
+	u8 defaults_loaded = 0;
 
 	/* enable Audio */
 	h8_set_audio_mute(0);
@@ -57,6 +59,18 @@  static void mainboard_enable(device_t dev)
 		pmh7_ultrabay_power_enable(0);
 		ec_write(0x0c, 0x04);
 	}
+
+	if (get_option(&defaults_loaded, "cmos_defaults_loaded") < 0) {
+		printk(BIOS_INFO, "failed to get cmos_defaults_loaded");
+		defaults_loaded = 0;
+	}
+
+	if (!defaults_loaded) {
+		printk(BIOS_INFO, "Restoring CMOS defaults\n");
+		set_option("tft_brightness", &(u8[]){ 0xff });
+		set_option("volume", &(u8[]){ 0x03 });
+		set_option("cmos_defaults_loaded", &(u8[]){ 0x01 });
+	}
 }
 
 struct chip_operations mainboard_ops = {
diff --git a/src/mainboard/lenovo/x60/mainboard.c b/src/mainboard/lenovo/x60/mainboard.c
index f7bcb61..d5c9d95 100644
--- a/src/mainboard/lenovo/x60/mainboard.c
+++ b/src/mainboard/lenovo/x60/mainboard.c
@@ -34,11 +34,13 @@ 
 #include <ec/acpi/ec.h>
 #include <ec/lenovo/h8/h8.h>
 #include <northbridge/intel/i945/i945.h>
+#include <pc80/mc146818rtc.h>
 #include "dock.h"
 
 static void mainboard_enable(device_t dev)
 {
 	device_t dev0, idedev;
+	u8 defaults_loaded = 0;
 
 	/* enable Audio */
 	h8_set_audio_mute(0);
@@ -60,6 +62,18 @@  static void mainboard_enable(device_t dev)
 		outb(inb(0x1628) & ~0x01, 0x1628);
 		ec_write(0x0c, 0x04);
 	}
+
+	if (get_option(&defaults_loaded, "cmos_defaults_loaded") < 0) {
+		printk(BIOS_INFO, "failed to get cmos_defaults_loaded");
+		defaults_loaded = 0;
+	}
+
+	if (!defaults_loaded) {
+		printk(BIOS_INFO, "Restoring CMOS defaults\n");
+		set_option("tft_brightness", &(u8[]){ 0xff });
+		set_option("volume", &(u8[]){ 0x03 });
+		set_option("cmos_defaults_loaded", &(u8[]){ 0x01 });
+	}
 }
 
 struct chip_operations mainboard_ops = {