bootblock: Guard CMOS rewrite in disable/enable RTC

This ensures that there's only one disable/enable cycle for
the entire rewrite instead for every single byte.

Change-Id: Ic06e6dcb08976d158ff784660838c0fbad875176
Signed-off-by: Patrick Georgi <patrick.georgi@secunet.com>
Reviewed-on: http://review.coreboot.org/1869
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Patrick Georgi 2012-11-15 14:57:27 +01:00 committed by Patrick Georgi
parent f943901777
commit d8e6d4085f
1 changed files with 2 additions and 0 deletions

View File

@ -27,9 +27,11 @@ static void sanitize_cmos(void)
unsigned char *cmos_default = (unsigned char*)walkcbfs("cmos.default"); unsigned char *cmos_default = (unsigned char*)walkcbfs("cmos.default");
if (cmos_default) { if (cmos_default) {
int i; int i;
cmos_disable_rtc();
for (i = 14; i < 128; i++) { for (i = 14; i < 128; i++) {
cmos_write(cmos_default[i], i); cmos_write(cmos_default[i], i);
} }
cmos_enable_rtc();
} }
} }
} }