diff options
author | Patrick Georgi <patrick.georgi@secunet.com> | 2012-11-15 14:55:52 +0100 |
---|---|---|
committer | Patrick Georgi <patrick@georgi-clan.de> | 2012-11-19 22:06:55 +0100 |
commit | 0d8267464d093dfddda56e8095c455a8ee96d3e5 (patch) | |
tree | 2b3b47ab7e7513885ebaf78af46459ad096261a6 /src | |
parent | d8e6d4085ffd10d399551a2ec75a57fd1f594fec (diff) | |
download | coreboot-0d8267464d093dfddda56e8095c455a8ee96d3e5.tar.xz |
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@secunet.com>
Reviewed-on: http://review.coreboot.org/1870
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/mainboard/siemens/sitemp_g1p1/romstage.c | 125 |
1 files changed, 0 insertions, 125 deletions
diff --git a/src/mainboard/siemens/sitemp_g1p1/romstage.c b/src/mainboard/siemens/sitemp_g1p1/romstage.c index 141b0fae7f..b87f19f425 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, }; |