summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorJoel Kitching <kitching@google.com>2020-02-14 15:38:37 +0800
committerJoel Kitching <kitching@chromium.org>2020-02-18 05:54:31 +0000
commit462a2efd2fb2f0effcb56580f3e6e7c14a17d23a (patch)
treeb2e1cb0bd93db1507fecebeba1c3623b92a801de /firmware
parent4f614777db430bcf50c3ee945bc4170bba8cdaa9 (diff)
downloadvboot-462a2efd2fb2f0effcb56580f3e6e7c14a17d23a.tar.gz
vboot: implement vb2api_get_recovery_reason
This API function should be used rather than directly accessing vb2_shared_data.recovery_reason. BUG=b:124141368, chromium:1038260, chromium:957880 TEST=make clean && make runtests BRANCH=none Change-Id: I92c8f9a654400be69885a691b39c4b9e4e2031c1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2055662 Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org>
Diffstat (limited to 'firmware')
-rw-r--r--firmware/2lib/2misc.c5
-rw-r--r--firmware/2lib/include/2api.h10
2 files changed, 15 insertions, 0 deletions
diff --git a/firmware/2lib/2misc.c b/firmware/2lib/2misc.c
index b289f315..76062f89 100644
--- a/firmware/2lib/2misc.c
+++ b/firmware/2lib/2misc.c
@@ -443,3 +443,8 @@ int vb2api_need_reboot_for_display(struct vb2_context *ctx)
}
return 0;
}
+
+uint32_t vb2api_get_recovery_reason(struct vb2_context *ctx)
+{
+ return vb2_get_sd(ctx)->recovery_reason;
+}
diff --git a/firmware/2lib/include/2api.h b/firmware/2lib/include/2api.h
index 2a87ab12..0ad10bd7 100644
--- a/firmware/2lib/include/2api.h
+++ b/firmware/2lib/include/2api.h
@@ -765,6 +765,16 @@ int vb2api_is_developer_signed(struct vb2_context *ctx);
*/
int vb2api_need_reboot_for_display(struct vb2_context *ctx);
+/**
+ * Get the current recovery reason.
+ *
+ * See enum vb2_nv_recovery in 2recovery_reasons.h.
+ *
+ * @param ctx Vboot context
+ * @return Current recovery reason.
+ */
+uint32_t vb2api_get_recovery_reason(struct vb2_context *ctx);
+
/*****************************************************************************/
/* APIs provided by the caller to verified boot */