From 21d4a85042ced5574333e94083d9ee58480b52a9 Mon Sep 17 00:00:00 2001 From: Duncan Laurie Date: Mon, 15 Jul 2013 10:38:12 -0700 Subject: [PATCH] chromeos: Check for recovery reason code in shared data When using RW firmware path the proper recovery reason can be retrieved from the shared data region. This will result in the actual reason being logged instead of the default "recovery button pressed" reason. 1) build and boot on falco 2) crossystem recovery_request=193 3) reboot into recovery mode, check reason with 4) reboot back into chromeos 5) check event log entry for previous recovery mode: 25 | 2013-07-15 10:34:23 | Chrome OS Recovery Mode | Test from User Mode Change-Id: I6f9dfed501f06881e9cf4392724ad28b97521305 Signed-off-by: Duncan Laurie Reviewed-on: https://gerrit.chromium.org/gerrit/61906 Reviewed-by: Aaron Durbin Reviewed-on: http://review.coreboot.org/4368 Reviewed-by: Patrick Georgi Tested-by: build bot (Jenkins) --- src/vendorcode/google/chromeos/gnvs.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/vendorcode/google/chromeos/gnvs.c b/src/vendorcode/google/chromeos/gnvs.c index 5ee366598a..9f510973e8 100644 --- a/src/vendorcode/google/chromeos/gnvs.c +++ b/src/vendorcode/google/chromeos/gnvs.c @@ -29,6 +29,7 @@ #include "gnvs.h" #if CONFIG_VBOOT_VERIFY_FIRMWARE #include "vboot_handoff.h" +#include #endif chromeos_acpi_t *vboot_data = NULL; @@ -60,6 +61,13 @@ void chromeos_init_vboot(chromeos_acpi_t *chromeos) elog_add_event(ELOG_TYPE_CROS_DEVELOPER_MODE); if (recovery_mode_enabled()) { int reason = get_recovery_mode_from_vbnv(); +#if CONFIG_VBOOT_VERIFY_FIRMWARE + if (vboot_handoff && !reason) { + VbSharedDataHeader *sd = (VbSharedDataHeader *) + vboot_handoff->shared_data; + reason = sd->recovery_reason; + } +#endif elog_add_event_byte(ELOG_TYPE_CROS_RECOVERY_MODE, reason ? reason : ELOG_CROS_RECOVERY_MODE_BUTTON); }