drivers/pc80/rtc: Refactor some USE_OPTION_TABLE
Change-Id: I3a5004db021af6127de2f058bec9d84a985bae67 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/38183 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Patrick Rudolph <siro@das-labor.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
@@ -15,13 +15,12 @@
|
|||||||
#include <cbfs.h>
|
#include <cbfs.h>
|
||||||
#include <pc80/mc146818rtc.h>
|
#include <pc80/mc146818rtc.h>
|
||||||
#include <fallback.h>
|
#include <fallback.h>
|
||||||
|
|
||||||
#if CONFIG(USE_OPTION_TABLE)
|
#if CONFIG(USE_OPTION_TABLE)
|
||||||
#include <option_table.h>
|
#include <option_table.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
int cmos_chksum_valid(void)
|
int cmos_chksum_valid(void)
|
||||||
{
|
{
|
||||||
#if CONFIG(USE_OPTION_TABLE)
|
|
||||||
unsigned char addr;
|
unsigned char addr;
|
||||||
u16 sum, old_sum;
|
u16 sum, old_sum;
|
||||||
|
|
||||||
@@ -35,12 +34,8 @@ int cmos_chksum_valid(void)
|
|||||||
old_sum |= cmos_read(LB_CKS_LOC + 1);
|
old_sum |= cmos_read(LB_CKS_LOC + 1);
|
||||||
|
|
||||||
return sum == old_sum;
|
return sum == old_sum;
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG(USE_OPTION_TABLE)
|
|
||||||
void sanitize_cmos(void)
|
void sanitize_cmos(void)
|
||||||
{
|
{
|
||||||
if (cmos_error() || !cmos_chksum_valid() ||
|
if (cmos_error() || !cmos_chksum_valid() ||
|
||||||
@@ -88,7 +83,7 @@ int do_normal_boot(void)
|
|||||||
{
|
{
|
||||||
unsigned char byte;
|
unsigned char byte;
|
||||||
|
|
||||||
if (cmos_error() || !cmos_chksum_valid()) {
|
if (!CONFIG(USE_OPTION_TABLE) || cmos_error() || !cmos_chksum_valid()) {
|
||||||
/* Invalid CMOS checksum detected!
|
/* Invalid CMOS checksum detected!
|
||||||
* Force fallback boot...
|
* Force fallback boot...
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user