diff options
Diffstat (limited to 'src/vendorcode/google')
-rw-r--r-- | src/vendorcode/google/chromeos/chromeos.h | 1 | ||||
-rw-r--r-- | src/vendorcode/google/chromeos/vbnv_cmos.c | 16 | ||||
-rw-r--r-- | src/vendorcode/google/chromeos/vboot_common.c | 15 | ||||
-rw-r--r-- | src/vendorcode/google/chromeos/vboot_common.h | 2 |
4 files changed, 34 insertions, 0 deletions
diff --git a/src/vendorcode/google/chromeos/chromeos.h b/src/vendorcode/google/chromeos/chromeos.h index caf18946bf..9dbb68129d 100644 --- a/src/vendorcode/google/chromeos/chromeos.h +++ b/src/vendorcode/google/chromeos/chromeos.h @@ -29,6 +29,7 @@ void save_chromeos_gpios(void); /* functions implemented in vbnv.c: */ int get_recovery_mode_from_vbnv(void); +void set_recovery_mode_into_vbnv(int recovery_reason); int vboot_wants_oprom(void); void read_vbnv(uint8_t *vbnv_copy); diff --git a/src/vendorcode/google/chromeos/vbnv_cmos.c b/src/vendorcode/google/chromeos/vbnv_cmos.c index d7850b6796..27f7f0a211 100644 --- a/src/vendorcode/google/chromeos/vbnv_cmos.c +++ b/src/vendorcode/google/chromeos/vbnv_cmos.c @@ -104,6 +104,22 @@ static void vbnv_setup(void) car_set_var(vbnv_initialized, 1); } +void set_recovery_mode_into_vbnv(int recovery_reason) +{ + uint8_t vbnv_copy[CONFIG_VBNV_SIZE]; + uint8_t crc_val; + + read_vbnv(vbnv_copy); + + vbnv_copy[RECOVERY_OFFSET] = recovery_reason; + + crc_val = crc8(vbnv_copy, CRC_OFFSET); + + vbnv_copy[CRC_OFFSET] = crc_val; + + save_vbnv(vbnv_copy); +} + int get_recovery_mode_from_vbnv(void) { if (!is_vbnv_initialized()) diff --git a/src/vendorcode/google/chromeos/vboot_common.c b/src/vendorcode/google/chromeos/vboot_common.c index ac16382186..448aad6db0 100644 --- a/src/vendorcode/google/chromeos/vboot_common.c +++ b/src/vendorcode/google/chromeos/vboot_common.c @@ -77,6 +77,21 @@ int vboot_enable_recovery(void) return vboot_handoff_flag(VB_INIT_OUT_ENABLE_RECOVERY); } +int vboot_recovery_reason(void) +{ + struct vboot_handoff *vbho; + VbSharedDataHeader *sd; + + vbho = cbmem_find(CBMEM_ID_VBOOT_HANDOFF); + + if (vbho == NULL) + return 0; + + sd = (VbSharedDataHeader *)vbho->shared_data; + + return sd->recovery_reason; +} + void vboot_reboot(void) { if (IS_ENABLED(CONFIG_CONSOLE_CBMEM_DUMP_TO_UART)) diff --git a/src/vendorcode/google/chromeos/vboot_common.h b/src/vendorcode/google/chromeos/vboot_common.h index cc79fa5efd..fbffc29d54 100644 --- a/src/vendorcode/google/chromeos/vboot_common.h +++ b/src/vendorcode/google/chromeos/vboot_common.h @@ -42,6 +42,8 @@ int vboot_skip_display_init(void); int vboot_enable_recovery(void); int vboot_enable_developer(void); +int vboot_recovery_reason(void); + void vboot_reboot(void); /* Main logic for verified boot. verstage() is the stage entry point |