Fix our CMOS checksum algorithm so it matches what /dev/nvram expects
authorStefan Reinauer <reinauer@chromium.org>
Fri, 14 Oct 2011 22:24:03 +0000 (15:24 -0700)
committerStefan Reinauer <stefan.reinauer@coreboot.org>
Mon, 17 Oct 2011 15:51:52 +0000 (17:51 +0200)
Our cmos checksum is inverted to what the Linux /dev/nvram device expects (and
BIOSes use). This makes it impossible to use /dev/nvram with coreboot. Fix it!

Change-Id: I239f7e3aca05d3691aee16490dd801df2ccaefd1
Signed-off-by: Vadim Bendebury <vbendeb@google.com>
Signed-off-by: Stefan Reinauer <reinauer@google.com>
Reviewed-on: http://review.coreboot.org/279
Tested-by: build bot (Jenkins)
Reviewed-by: Marc Jones <marcj303@gmail.com>
src/pc80/mc146818rtc.c

index f3bee9bdceed1b1b4ecfee09698fa7db4ac515a4..034957acf56ab2e42b6db8af957ce0948f73b845 100644 (file)
@@ -98,7 +98,6 @@ static void rtc_set_checksum(int range_start, int range_end, int cks_loc)
        for(i = range_start; i <= range_end; i++) {
                sum += cmos_read(i);
        }
-       sum = ~(sum & 0x0ffff);
        cmos_write(((sum >> 8) & 0x0ff), cks_loc);
        cmos_write(((sum >> 0) & 0x0ff), cks_loc+1);
 }