Bill XIE has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/39906 )
Change subject: drivers/pc80/rtc: Always load cmos.default to satisfy measured boot ......................................................................
drivers/pc80/rtc: Always load cmos.default to satisfy measured boot
cmos.default used to be loaded only when cmos is needed to be reset, but conditional loading of CBFS files may break measured boot if measurement is hooked on each loading.
In order to resolve this, loadings should be made unconditional, but the use of loaded data remains conditional, so cmos.default should always be loaded (with cbfs_boot_map_with_leak() which is further hooked with measurement), but cmos resetting remains conditional.
Change-Id: If6ea0d1cbaa7d96f7dea7e77b7548ca2b30efe9e Signed-off-by: Bill XIE persmule@hardenedlinux.org --- M src/drivers/pc80/rtc/option.c 1 file changed, 7 insertions(+), 11 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/06/39906/1
diff --git a/src/drivers/pc80/rtc/option.c b/src/drivers/pc80/rtc/option.c index bb697df..5bf2fc9 100644 --- a/src/drivers/pc80/rtc/option.c +++ b/src/drivers/pc80/rtc/option.c @@ -239,7 +239,7 @@ return cmos_checksum_valid(LB_CKS_RANGE_START, LB_CKS_RANGE_END, LB_CKS_LOC); }
-static void cmos_load_defaults(void) +void sanitize_cmos(void) { size_t length = 128; size_t i; @@ -250,14 +250,10 @@ if (!cmos_default) return;
- u8 control_state = cmos_disable_rtc(); - for (i = 14; i < MIN(128, length); i++) - cmos_write_inner(cmos_default[i], i); - cmos_restore_rtc(control_state); -} - -void sanitize_cmos(void) -{ - if (cmos_error() || !cmos_lb_cks_valid() || CONFIG(STATIC_OPTION_TABLE)) - cmos_load_defaults(); + if (cmos_error() || !cmos_lb_cks_valid() || CONFIG(STATIC_OPTION_TABLE)) { + u8 control_state = cmos_disable_rtc(); + for (i = 14; i < MIN(128, length); i++) + cmos_write_inner(cmos_default[i], i); + cmos_restore_rtc(control_state); + } }