drivers/pc80/rtc: Remove duplicate cmos_chksum_valid()

Change-Id: I5a4b86921876c24cd1d310b674119b960c3d2fd6
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/38194
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Kyösti Mälkki
2020-01-04 18:04:39 +02:00
parent 3838701c84
commit 2a0e3b25ea
4 changed files with 13 additions and 23 deletions

View File

@@ -19,27 +19,14 @@
#if CONFIG(USE_OPTION_TABLE)
#include <option_table.h>
int cmos_chksum_valid(void)
int cmos_lb_cks_valid(void)
{
unsigned char addr;
u16 sum, old_sum;
sum = 0;
/* Compute the cmos checksum */
for (addr = LB_CKS_RANGE_START; addr <= LB_CKS_RANGE_END; addr++)
sum += cmos_read(addr);
/* Read the stored checksum */
old_sum = cmos_read(LB_CKS_LOC) << 8;
old_sum |= cmos_read(LB_CKS_LOC + 1);
return sum == old_sum;
return cmos_checksum_valid(LB_CKS_RANGE_START, LB_CKS_RANGE_END, LB_CKS_LOC);
}
void sanitize_cmos(void)
{
if (cmos_error() || !cmos_chksum_valid() ||
CONFIG(STATIC_OPTION_TABLE)) {
if (cmos_error() || !cmos_lb_cks_valid() || CONFIG(STATIC_OPTION_TABLE)) {
size_t length = 128;
const unsigned char *cmos_default =
cbfs_boot_map_with_leak("cmos.default",
@@ -83,7 +70,7 @@ int do_normal_boot(void)
{
unsigned char byte;
if (!CONFIG(USE_OPTION_TABLE) || cmos_error() || !cmos_chksum_valid()) {
if (!CONFIG(USE_OPTION_TABLE) || cmos_error() || !cmos_lb_cks_valid()) {
/* Invalid CMOS checksum detected!
* Force fallback boot...
*/