summaryrefslogtreecommitdiff
path: root/firmware/2lib/2api.c
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2014-10-29 15:08:39 -0500
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-11-03 23:41:02 +0000
commit941e25fa59816cf6ae32a585b013f671eccbd813 (patch)
tree92cd71ba208ce89e08a22854317d62ab6c26fb40 /firmware/2lib/2api.c
parent42f02139d522cc787630ee95ecf654f4410175e5 (diff)
downloadvboot-941e25fa59816cf6ae32a585b013f671eccbd813.tar.gz
vb2: parse dev mode in phase1
The rest of the system software expects dev mode to be orthogonal to recovery mode. However, vb2_fw_phase1() was only checking recovery mode. The caller would then not call vb2_fw_phase2() which checked the developer mode settings. Fix this by doing the necessary steps in vb2_fw_phase1(). BUG=chrome-os-partner:33264 BRANCH=None TEST=None yet. Change-Id: I06da388c3ca33754ddb5937a2877fbc287946490 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://chromium-review.googlesource.com/225906 Tested-by: Furquan Shaikh <furquan@chromium.org> Commit-Queue: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Benson Leung <bleung@chromium.org> Tested-by: Benson Leung <bleung@chromium.org>
Diffstat (limited to 'firmware/2lib/2api.c')
-rw-r--r--firmware/2lib/2api.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/firmware/2lib/2api.c b/firmware/2lib/2api.c
index 5070d21f..a01c7f57 100644
--- a/firmware/2lib/2api.c
+++ b/firmware/2lib/2api.c
@@ -35,7 +35,6 @@ void vb2api_fail(struct vb2_context *ctx, uint8_t reason, uint8_t subcode)
int vb2api_fw_phase1(struct vb2_context *ctx)
{
- struct vb2_shared_data *sd = vb2_get_sd(ctx);
int rv;
/* Initialize the vboot context if it hasn't been yet */
@@ -47,7 +46,17 @@ int vb2api_fw_phase1(struct vb2_context *ctx)
/* Initialize secure data */
rv = vb2_secdata_init(ctx);
if (rv)
- sd->recovery_reason = VB2_RECOVERY_SECDATA_INIT;
+ vb2_fail(ctx, VB2_RECOVERY_SECDATA_INIT, rv);
+
+ /* Load and parse the GBB header */
+ rv = vb2_fw_parse_gbb(ctx);
+ if (rv)
+ vb2_fail(ctx, VB2_RECOVERY_GBB_HEADER, rv);
+
+ /* Check for dev switch */
+ rv = vb2_check_dev_switch(ctx);
+ if (rv)
+ vb2_fail(ctx, VB2_RECOVERY_DEV_SWITCH, rv);
/*
* Check for recovery. Note that this function returns void, since
@@ -70,20 +79,6 @@ int vb2api_fw_phase2(struct vb2_context *ctx)
{
int rv;
- /* Load and parse the GBB header */
- rv = vb2_fw_parse_gbb(ctx);
- if (rv) {
- vb2_fail(ctx, VB2_RECOVERY_GBB_HEADER, rv);
- return rv;
- }
-
- /* Check for dev switch */
- rv = vb2_check_dev_switch(ctx);
- if (rv) {
- vb2_fail(ctx, VB2_RECOVERY_DEV_SWITCH, rv);
- return rv;
- }
-
/* Always clear RAM when entering developer mode */
if (ctx->flags & VB2_CONTEXT_DEVELOPER_MODE)
ctx->flags |= VB2_CONTEXT_CLEAR_RAM;