summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/pc80/mc146818rtc.c6
-rw-r--r--src/pc80/mc146818rtc_early.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/src/pc80/mc146818rtc.c b/src/pc80/mc146818rtc.c
index 034957acf5..99d670de42 100644
--- a/src/pc80/mc146818rtc.c
+++ b/src/pc80/mc146818rtc.c
@@ -1,3 +1,4 @@
+#include <stdint.h>
#include <console/console.h>
#include <pc80/mc146818rtc.h>
#include <boot/coreboot_tables.h>
@@ -80,12 +81,11 @@
static int rtc_checksum_valid(int range_start, int range_end, int cks_loc)
{
int i;
- unsigned sum, old_sum;
+ u16 sum, old_sum;
sum = 0;
for(i = range_start; i <= range_end; i++) {
sum += cmos_read(i);
}
- sum = (~sum)&0x0ffff;
old_sum = ((cmos_read(cks_loc)<<8) | cmos_read(cks_loc+1))&0x0ffff;
return sum == old_sum;
}
@@ -93,7 +93,7 @@ static int rtc_checksum_valid(int range_start, int range_end, int cks_loc)
static void rtc_set_checksum(int range_start, int range_end, int cks_loc)
{
int i;
- unsigned sum;
+ u16 sum;
sum = 0;
for(i = range_start; i <= range_end; i++) {
sum += cmos_read(i);
diff --git a/src/pc80/mc146818rtc_early.c b/src/pc80/mc146818rtc_early.c
index abddf87661..0652f27c47 100644
--- a/src/pc80/mc146818rtc_early.c
+++ b/src/pc80/mc146818rtc_early.c
@@ -1,3 +1,4 @@
+#include <stdint.h>
#include <pc80/mc146818rtc.h>
#include <fallback.h>
#if CONFIG_USE_OPTION_TABLE
@@ -23,13 +24,12 @@ static int cmos_chksum_valid(void)
{
#if CONFIG_USE_OPTION_TABLE
unsigned char addr;
- unsigned long sum, old_sum;
+ u16 sum, old_sum;
sum = 0;
- /* Comput the cmos checksum */
+ /* Compute the cmos checksum */
for(addr = LB_CKS_RANGE_START; addr <= LB_CKS_RANGE_END; addr++) {
sum += cmos_read(addr);
}
- sum = (sum & 0xffff) ^ 0xffff;
/* Read the stored checksum */
old_sum = cmos_read(LB_CKS_LOC) << 8;