vboot: use out_flags to indicate recovery mode

In order to make the proper decision on loading the
option rom or not the recovery mode setting needs to be
known.  Normally this is detected by asking the EC,
but if recovery is requested with crossystem then the EC
does not know about it.  Instead we need to check the
output flags from VbInit().

Change-Id: I09358e6fd979b4af6b37a13115ac34db3d98b09d
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57474
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/4223
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Tested-by: build bot (Jenkins)
This commit is contained in:
Duncan Laurie 2013-06-04 10:14:42 -07:00 committed by Alexandru Gagniuc
parent eec8e33ecd
commit 199e196005
1 changed files with 26 additions and 4 deletions

View File

@ -41,8 +41,21 @@ static int vboot_enable_developer(void)
return !!(vbho->init_params.out_flags & VB_INIT_OUT_ENABLE_DEVELOPER); return !!(vbho->init_params.out_flags & VB_INIT_OUT_ENABLE_DEVELOPER);
} }
static int vboot_enable_recovery(void)
{
struct vboot_handoff *vbho;
vbho = cbmem_find(CBMEM_ID_VBOOT_HANDOFF);
if (vbho == NULL)
return 0;
return !!(vbho->init_params.out_flags & VB_INIT_OUT_ENABLE_RECOVERY);
}
#else #else
static inline int vboot_enable_developer(void) { return 0; } static inline int vboot_enable_developer(void) { return 0; }
static inline int vboot_enable_recovery(void) { return 0; }
#endif #endif
int developer_mode_enabled(void) int developer_mode_enabled(void)
@ -52,11 +65,20 @@ int developer_mode_enabled(void)
int recovery_mode_enabled(void) int recovery_mode_enabled(void)
{ {
/* TODO(reinauer): get information from VbInit. /*
* the recovery mode switch is not the only reason to go * This is called in multiple places and has to detect
* to recovery mode. * recovery mode triggered from the EC and via shared
* recovery reason set with crossystem.
*
* If shared recovery reason is set:
* - before VbInit then get_recovery_mode_from_vbnv() is true
* - after VbInit then vboot_enable_recovery() is true
*
* Otherwise the mainboard handler for get_recovery_mode_switch()
* will detect recovery mode initiated by the EC.
*/ */
return get_recovery_mode_switch() || get_recovery_mode_from_vbnv(); return get_recovery_mode_switch() || get_recovery_mode_from_vbnv() ||
vboot_enable_recovery();
} }
#if CONFIG_VBOOT_VERIFY_FIRMWARE #if CONFIG_VBOOT_VERIFY_FIRMWARE