diff options
-rw-r--r-- | src/vendorcode/google/chromeos/vbnv.h | 1 | ||||
-rw-r--r-- | src/vendorcode/google/chromeos/vbnv_cmos.c | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/vendorcode/google/chromeos/vbnv.h b/src/vendorcode/google/chromeos/vbnv.h index 3d88507a85..5d21cc8481 100644 --- a/src/vendorcode/google/chromeos/vbnv.h +++ b/src/vendorcode/google/chromeos/vbnv.h @@ -29,6 +29,7 @@ int vboot_wants_oprom(void); /* CMOS backend */ void read_vbnv_cmos(uint8_t *vbnv_copy); void save_vbnv_cmos(const uint8_t *vbnv_copy); +void init_vbnv_cmos(int rtc_fail); /* Flash backend */ void read_vbnv_flash(uint8_t *vbnv_copy); diff --git a/src/vendorcode/google/chromeos/vbnv_cmos.c b/src/vendorcode/google/chromeos/vbnv_cmos.c index 6dfc74cc09..da0d3005fd 100644 --- a/src/vendorcode/google/chromeos/vbnv_cmos.c +++ b/src/vendorcode/google/chromeos/vbnv_cmos.c @@ -51,6 +51,19 @@ void save_vbnv_cmos(const uint8_t *vbnv_copy) cmos_write(vbnv_copy[i], CONFIG_VBNV_OFFSET + 14 + i); } +void init_vbnv_cmos(int rtc_fail) +{ + uint8_t vbnv[VBNV_BLOCK_SIZE]; + + if (rtc_fail) + read_vbnv_cmos(vbnv); + + cmos_init(rtc_fail); + + if (rtc_fail) + save_vbnv_cmos(vbnv); +} + #if IS_ENABLED(CONFIG_CHROMEOS_VBNV_CMOS_BACKUP_TO_FLASH) static void back_up_vbnv_cmos(void *unused) { |