vboot: save whether developer mode is enabled

Save whether or not vboot has selected developer mode as a flag
in vboot_working_data.  Other coreboot code may access this flag
without needing to consult vboot_handoff (which is in the process
of being deprecated).

BUG=b:124141368, b:124192753
TEST=make clean && make test-abuild
BRANCH=none

Change-Id: Ieb6ac4937c943aea78ddc762595a05387d2b8114
Signed-off-by: Joel Kitching <kitching@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/32843
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
Joel Kitching 2019-05-17 14:26:01 +08:00 committed by Patrick Georgi
parent fc46ad8a8b
commit 7576bd7f42
5 changed files with 9 additions and 12 deletions

View File

@ -164,10 +164,8 @@ int vboot_recovery_mode_memory_retrain(void)
int vboot_developer_mode_enabled(void) int vboot_developer_mode_enabled(void)
{ {
if (cbmem_possibly_online() && vboot_handoff_check_developer_flag()) return cbmem_possibly_online() &&
return 1; vboot_get_working_data()->flags & VBOOT_WD_FLAG_DEVELOPER_MODE;
return 0;
} }
#if CONFIG(VBOOT_NO_BOARD_SUPPORT) #if CONFIG(VBOOT_NO_BOARD_SUPPORT)

View File

@ -47,6 +47,8 @@ struct vboot_working_data {
*/ */
/* vboot requests display initialization from coreboot. */ /* vboot requests display initialization from coreboot. */
#define VBOOT_WD_FLAG_DISPLAY_INIT (1 << 0) #define VBOOT_WD_FLAG_DISPLAY_INIT (1 << 0)
/* vboot has selected developer mode. */
#define VBOOT_WD_FLAG_DEVELOPER_MODE (1 << 1)
/* /*
* Source: security/vboot/common.c * Source: security/vboot/common.c

View File

@ -88,11 +88,6 @@ static int vboot_get_handoff_flag(uint32_t flag)
return !!(vbho->out_flags & flag); return !!(vbho->out_flags & flag);
} }
int vboot_handoff_check_developer_flag(void)
{
return vboot_get_handoff_flag(VB_INIT_OUT_ENABLE_DEVELOPER);
}
int vboot_handoff_check_recovery_flag(void) int vboot_handoff_check_recovery_flag(void)
{ {
return vboot_get_handoff_flag(VB_INIT_OUT_ENABLE_RECOVERY); return vboot_get_handoff_flag(VB_INIT_OUT_ENABLE_RECOVERY);

View File

@ -62,7 +62,6 @@ int vboot_get_handoff_info(void **addr, uint32_t *size);
* Returns value read for other fields * Returns value read for other fields
*/ */
int vboot_handoff_check_recovery_flag(void); int vboot_handoff_check_recovery_flag(void);
int vboot_handoff_check_developer_flag(void);
int vboot_handoff_get_recovery_reason(void); int vboot_handoff_get_recovery_reason(void);
/* ============================ VBOOT REBOOT ============================== */ /* ============================ VBOOT REBOOT ============================== */

View File

@ -364,10 +364,13 @@ void verstage_main(void)
vboot_reboot(); vboot_reboot();
} }
/* Is vboot declaring that display is available? If so, we should mark /* Jot down some information from vboot which may be required later on
it down, so that the mainboard/SoC knows to initialize display. */ in coreboot boot flow. */
if (ctx.flags & VB2_CONTEXT_DISPLAY_INIT) if (ctx.flags & VB2_CONTEXT_DISPLAY_INIT)
/* Mainboard/SoC should initialize display. */
vboot_get_working_data()->flags |= VBOOT_WD_FLAG_DISPLAY_INIT; vboot_get_working_data()->flags |= VBOOT_WD_FLAG_DISPLAY_INIT;
if (ctx.flags & VB2_CONTEXT_DEVELOPER_MODE)
vboot_get_working_data()->flags |= VBOOT_WD_FLAG_DEVELOPER_MODE;
/* Determine which firmware slot to boot (based on NVRAM) */ /* Determine which firmware slot to boot (based on NVRAM) */
printk(BIOS_INFO, "Phase 2\n"); printk(BIOS_INFO, "Phase 2\n");