diff options
-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, }; |