diff options
Diffstat (limited to 'firmware/2lib/2kernel.c')
-rw-r--r-- | firmware/2lib/2kernel.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/firmware/2lib/2kernel.c b/firmware/2lib/2kernel.c index 8d17ff53..bec9c507 100644 --- a/firmware/2lib/2kernel.c +++ b/firmware/2lib/2kernel.c @@ -242,6 +242,21 @@ vb2_error_t vb2api_kernel_phase2(struct vb2_context *ctx) */ vb2_clear_recovery(ctx); + /* + * Clear the diagnostic request flag and commit nvdata to prevent + * booting back into diagnostic mode when a forced system reset occurs. + */ + if (vb2_nv_get(ctx, VB2_NV_DIAG_REQUEST)) { + vb2_nv_set(ctx, VB2_NV_DIAG_REQUEST, 0); + /* + * According to current FAFT design (firmware_MiniDiag), we + * need an AP reset after MiniDiag test items to preserve the + * CBMEM console logs. So we need to commit nvdata immediately + * to prevent booting back to VB2_BOOT_MODE_DIAGNOSTICS. + */ + vb2ex_commit_data(ctx); + } + /* Select boot path */ switch (ctx->boot_mode) { case VB2_BOOT_MODE_MANUAL_RECOVERY: @@ -260,14 +275,6 @@ vb2_error_t vb2api_kernel_phase2(struct vb2_context *ctx) vb2ex_commit_data(ctx); break; case VB2_BOOT_MODE_DIAGNOSTICS: - /* - * Need to clear the request flag and commit nvdata changes - * immediately to avoid booting back into diagnostic tool when a - * forced system reset occurs. - */ - vb2_nv_set(ctx, VB2_NV_DIAG_REQUEST, 0); - vb2ex_commit_data(ctx); - break; case VB2_BOOT_MODE_DEVELOPER: case VB2_BOOT_MODE_NORMAL: break; |