Fix our CMOS checksum algorithm so it matches what /dev/nvram expects

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>
This commit is contained in:
Stefan Reinauer 2011-10-14 15:24:03 -07:00 committed by Stefan Reinauer
parent 1babddb202
commit d87dfc0c38
1 changed files with 0 additions and 1 deletions

View 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++) { for(i = range_start; i <= range_end; i++) {
sum += cmos_read(i); sum += cmos_read(i);
} }
sum = ~(sum & 0x0ffff);
cmos_write(((sum >> 8) & 0x0ff), cks_loc); cmos_write(((sum >> 8) & 0x0ff), cks_loc);
cmos_write(((sum >> 0) & 0x0ff), cks_loc+1); cmos_write(((sum >> 0) & 0x0ff), cks_loc+1);
} }