diff options
Diffstat (limited to 'firmware/2lib/2misc.c')
-rw-r--r-- | firmware/2lib/2misc.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/firmware/2lib/2misc.c b/firmware/2lib/2misc.c index 29fcde75..f2c6bb41 100644 --- a/firmware/2lib/2misc.c +++ b/firmware/2lib/2misc.c @@ -375,7 +375,7 @@ vb2_error_t vb2_select_fw_slot(struct vb2_context *ctx) return VB2_SUCCESS; } -void vb2_enable_developer_mode(struct vb2_context *ctx) +void vb2api_enable_developer_mode(struct vb2_context *ctx) { uint32_t flags; @@ -391,8 +391,25 @@ void vb2_enable_developer_mode(struct vb2_context *ctx) VB2_DEBUG("Mode change will take effect on next reboot\n"); } +vb2_error_t vb2api_disable_developer_mode(struct vb2_context *ctx) +{ + if (vb2api_gbb_get_flags(ctx) & VB2_GBB_FLAG_FORCE_DEV_SWITCH_ON) { + VB2_DEBUG("ERROR: dev mode forced by GBB flag\n"); + return VB2_ERROR_API_DISABLE_DEV_NOT_ALLOWED; + } + + VB2_DEBUG("Leaving dev mode\n"); + vb2_nv_set(ctx, VB2_NV_DISABLE_DEV_REQUEST, 1); + return VB2_SUCCESS; +} + +void vb2api_request_diagnostics(struct vb2_context *ctx) { + vb2_nv_set(ctx, VB2_NV_DIAG_REQUEST, 1); + VB2_DEBUG("Diagnostics requested\n"); +} + test_mockable -int vb2_allow_recovery(struct vb2_context *ctx) +int vb2api_allow_recovery(struct vb2_context *ctx) { if (ctx->flags & VB2_CONTEXT_NO_BOOT) return 0; @@ -432,7 +449,7 @@ void vb2_clear_recovery(struct vb2_context *ctx) /* But stow recovery reason as subcode for non-manual recovery. */ if ((ctx->flags & VB2_CONTEXT_RECOVERY_MODE) && - !vb2_allow_recovery(ctx)) { + !vb2api_allow_recovery(ctx)) { VB2_DEBUG("Stow recovery reason as subcode (%#x)\n", sd->recovery_reason); vb2_nv_set(ctx, VB2_NV_RECOVERY_SUBCODE, sd->recovery_reason); |