Kyösti Mälkki has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/38185 )
Change subject: drivers/pc80/rtc: Refactor clear_cmos variable ......................................................................
drivers/pc80/rtc: Refactor clear_cmos variable
After refactoring it is more a status variable rather than a request.
Change-Id: I50b8099a08b556129416cea50f0ce6fafe6c14cc Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- M src/drivers/pc80/rtc/mc146818rtc.c 1 file changed, 6 insertions(+), 10 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/85/38185/1
diff --git a/src/drivers/pc80/rtc/mc146818rtc.c b/src/drivers/pc80/rtc/mc146818rtc.c index f151910..c8ba568 100644 --- a/src/drivers/pc80/rtc/mc146818rtc.c +++ b/src/drivers/pc80/rtc/mc146818rtc.c @@ -96,7 +96,7 @@ { bool cmos_invalid; bool checksum_invalid = false; - bool clear_cmos; + bool cleared_cmos = false; size_t i; uint8_t x;
@@ -119,22 +119,19 @@ /* See if there is a CMOS checksum error */ checksum_invalid = !cmos_checksum_valid(PC_CKS_RANGE_START, PC_CKS_RANGE_END, PC_CKS_LOC); - - clear_cmos = false; - } else { - clear_cmos = true; }
if (cmos_invalid || invalid) cmos_write(cmos_read(RTC_CONTROL) | RTC_SET, RTC_CONTROL);
if (invalid || cmos_invalid || checksum_invalid) { - if (clear_cmos) { + if (!CONFIG(USE_OPTION_TABLE)) { cmos_write(0, 0x01); cmos_write(0, 0x03); cmos_write(0, 0x05); for (i = 10; i < 128; i++) cmos_write(0, i); + cleared_cmos = true; }
if (cmos_invalid || invalid) @@ -144,9 +141,8 @@ invalid ? " Clear requested":"", cmos_invalid ? " Power Problem":"", checksum_invalid ? " Checksum invalid":"", - clear_cmos ? " zeroing cmos":""); - } else - clear_cmos = false; + cleared_cmos ? " zeroing cmos":""); + }
/* Setup the real time clock */ cmos_write(RTC_CONTROL_DEFAULT, RTC_CONTROL); @@ -169,7 +165,7 @@ /* Clear any pending interrupts */ cmos_read(RTC_INTR_FLAGS);
- return clear_cmos; + return cleared_cmos; }
static void cmos_init_vbnv(bool invalid)
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38185 )
Change subject: drivers/pc80/rtc: Refactor clear_cmos variable ......................................................................
Patch Set 5: Code-Review+2
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38185 )
Change subject: drivers/pc80/rtc: Refactor clear_cmos variable ......................................................................
Patch Set 5: Code-Review+1
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38185 )
Change subject: drivers/pc80/rtc: Refactor clear_cmos variable ......................................................................
Patch Set 6: Code-Review+2
Kyösti Mälkki has submitted this change. ( https://review.coreboot.org/c/coreboot/+/38185 )
Change subject: drivers/pc80/rtc: Refactor clear_cmos variable ......................................................................
drivers/pc80/rtc: Refactor clear_cmos variable
After refactoring it is more a status variable rather than a request.
Change-Id: I50b8099a08b556129416cea50f0ce6fafe6c14cc Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/38185 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 --- M src/drivers/pc80/rtc/mc146818rtc.c 1 file changed, 6 insertions(+), 10 deletions(-)
Approvals: build bot (Jenkins): Verified Paul Menzel: Looks good to me, but someone else must approve Patrick Rudolph: Looks good to me, approved Angel Pons: Looks good to me, approved
diff --git a/src/drivers/pc80/rtc/mc146818rtc.c b/src/drivers/pc80/rtc/mc146818rtc.c index 1d2fc97..b870da2 100644 --- a/src/drivers/pc80/rtc/mc146818rtc.c +++ b/src/drivers/pc80/rtc/mc146818rtc.c @@ -94,7 +94,7 @@ { bool cmos_invalid; bool checksum_invalid = false; - bool clear_cmos; + bool cleared_cmos = false; size_t i;
/* @@ -115,22 +115,19 @@ /* See if there is a CMOS checksum error */ checksum_invalid = !cmos_checksum_valid(PC_CKS_RANGE_START, PC_CKS_RANGE_END, PC_CKS_LOC); - - clear_cmos = false; - } else { - clear_cmos = true; }
if (cmos_invalid || invalid) cmos_disable_rtc();
if (invalid || cmos_invalid || checksum_invalid) { - if (clear_cmos) { + if (!CONFIG(USE_OPTION_TABLE)) { cmos_write(0, 0x01); cmos_write(0, 0x03); cmos_write(0, 0x05); for (i = 10; i < 128; i++) cmos_write(0, i); + cleared_cmos = true; }
if (cmos_invalid || invalid) @@ -140,9 +137,8 @@ invalid ? " Clear requested":"", cmos_invalid ? " Power Problem":"", checksum_invalid ? " Checksum invalid":"", - clear_cmos ? " zeroing cmos":""); - } else - clear_cmos = false; + cleared_cmos ? " zeroing cmos":""); + }
/* Setup the real time clock */ cmos_write(RTC_CONTROL_DEFAULT, RTC_CONTROL); @@ -165,7 +161,7 @@ /* Clear any pending interrupts */ cmos_read(RTC_INTR_FLAGS);
- return clear_cmos; + return cleared_cmos; }
static void cmos_init_vbnv(bool invalid)