[coreboot] New patch to review for coreboot: d17f2ed siemens/sitemp_g1p1: Drop copy of cmos checksum calculation

Patrick Georgi (patrick@georgi-clan.de) gerrit at coreboot.org
Fri Nov 16 10:41:19 CET 2012


Patrick Georgi (patrick at georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1870

-gerrit

commit d17f2eda552f176aa758f1d8f0216bd7b2803e63
Author: Patrick Georgi <patrick.georgi at secunet.com>
Date:   Thu Nov 15 14:55:52 2012 +0100

    siemens/sitemp_g1p1: Drop copy of cmos checksum calculation
    
    This code used a special case for checksum calculation to
    prevent the century byte from messing things up, since
    writes "sometimes" didn't happen.
    
    That should be stable now, so the special case isn't necessary.
    Downside: On century rollovers (ie. 1999-12-31, 2099-12-31)
    CMOS will be reset to the defaults.
    
    Change-Id: Ibe589a1ec953b7b3ba39be30cebd9fc2b27326ae
    Signed-off-by: Patrick Georgi <patrick.georgi at secunet.com>
---
 src/mainboard/siemens/sitemp_g1p1/romstage.c | 125 ---------------------------
 1 file changed, 125 deletions(-)

diff --git a/src/mainboard/siemens/sitemp_g1p1/romstage.c b/src/mainboard/siemens/sitemp_g1p1/romstage.c
index 141b0fa..b87f19f 100644
--- a/src/mainboard/siemens/sitemp_g1p1/romstage.c
+++ b/src/mainboard/siemens/sitemp_g1p1/romstage.c
@@ -88,131 +88,6 @@ static inline int spd_read_byte(u32 device, u32 address)
 #define __DEBUG__(fmt, arg...) do_printk(BIOS_DEBUG ,fmt, ##arg)
 #define __INFO__(fmt, arg...) do_printk(BIOS_INFO ,fmt, ##arg)
 
-#if CONFIG_USE_OPTION_TABLE
-#define DUMP_CMOS_RAM 0
-static inline int cmos_error(void) {
-	unsigned char reg_d;
-	/* See if the cmos error condition has been flagged */
-	outb(0xd, 0x72);
-	reg_d = inb(0x73);
-#if DUMP_CMOS_RAM
-	__DEBUG__("RTC_VRT = %x\n", reg_d & RTC_VRT);
-#endif
-	return (reg_d & RTC_VRT) == 0;
-}
-
-static inline void set_chksum(int range_start, int range_end, int cks_loc)
-{
-	int addr;
-	unsigned sum;
-	sum = 0;
-	for( addr = range_start; addr <= range_end; addr++) {
-		outb(addr, 0x72);
-		sum += inb(0x73);
-	}
-	sum = ~(sum & 0x0ffff);
-	outb(cks_loc, 0x72);
-	outb(((sum >> 8) & 0x0ff),0x73);
-	outb(cks_loc+1,0x72);
-	outb((sum & 0x0ff),0x73);
-}
-
-static inline int cmos_chksum_valid(void) {
-	unsigned char addr, val;
-	unsigned long sum, old_sum;
-
-#if DUMP_CMOS_RAM
-	u8 i;
-	/* Compute the cmos checksum */
-	for (addr = 14, i = 0; addr < LB_CKS_RANGE_START; addr++,i++) {
-		outb(addr, 0x72);
-		val = inb(0x73);
-		if( i%16 == 0 ) __DEBUG__("%02x:", addr);
-		__DEBUG__(" %02x",val);
-		if( i%16 == 15 ) __DEBUG__("\n");
-	}
-#endif
-	sum = 0;
-	for(addr = LB_CKS_RANGE_START; addr <= LB_CKS_RANGE_END; addr++) {
-		outb(addr, 0x72);
-		val = inb(0x73);
-#if DUMP_CMOS_RAM
-		if( i%16 == 0 ) __DEBUG__("%02x:", addr);
-		__DEBUG__(" %02x",val);
-		if( i%16 == 15 ) __DEBUG__("\n");
-		i++;
-#endif
-		sum += val;
-	}
-#if DUMP_CMOS_RAM
-	__DEBUG__("\n");
-#endif
-	sum = (sum & 0xffff);
-
-	/* Read the stored checksum */
-	outb(LB_CKS_LOC, 0x72);
-	old_sum = inb(0x73) << 8;
-	outb(LB_CKS_LOC+1, 0x72);
-	old_sum |=  inb(0x73);
-#if DUMP_CMOS_RAM
-	__DEBUG__("CMOS checksum: old = %lx, new = %lx\n", old_sum, sum);
-#endif
-	return sum == old_sum;
-}
-
-#include <cbfs.h>
-static inline void check_cmos( void ) {
-
-	char *cmos_default = NULL;
-	int i;
-#if DUMP_CMOS_RAM
-	u8 c = 0;
-#endif
-	if (cmos_error() || !cmos_chksum_valid()) {
-		cmos_default = cbfs_find_file("cmos.default", 0xaa);
-		if (cmos_default) {
-#if DUMP_CMOS_RAM
-			__DEBUG__("Write cmos default ...\n");
-#endif
-			outb(0x0a,0x72);
-			i = inb(0x73);
-			i &= ~(1 << 4);
-			outb(i,0x73);
-
-			for (i = 14; i < 128; i++) {
-#if DUMP_CMOS_RAM
-				if( c%16 == 0 ) __DEBUG__("%02x:", i);
-				__DEBUG__(" %02x", (u8)cmos_default[i]);
-				if( c%16 == 15 ) __DEBUG__("\n");
-				c++;
-#endif
-				outb(i,0x72);
-				outb(cmos_default[i],0x73);
-			}
-
-#if DUMP_CMOS_RAM
-			__DEBUG__("\n");
-#endif
-			if( !cmos_chksum_valid() )
-				__DEBUG__("CMOS CHECKSUM ERROR\n");
-			/* Now reboot to run with default cmos. */
-			outb(0x06, 0xcf9);
-			for (;;) asm("hlt"); /* Wait for reset! */
-		}
-	}
-
-	// update altcentury
-	outb(0x32, 0x72);
-	i = inb(0x73);
-	if ( i != 0x20 ) {
-		outb(0x20,0x73);
-		set_chksum(LB_CKS_RANGE_START, LB_CKS_RANGE_END, LB_CKS_LOC);
-	}
-
-}
-
-#endif
-
 void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
 {
 	static const u16 spd_addr[] = { DIMM0, 0, 0, 0, DIMM1, 0, 0, 0, };




More information about the coreboot mailing list