summaryrefslogtreecommitdiff
path: root/firmware/2lib/include/2misc.h
diff options
context:
space:
mode:
authorHsuan Ting Chen <roccochen@chromium.org>2021-06-07 16:54:47 +0800
committerCommit Bot <commit-bot@chromium.org>2021-10-01 15:48:34 +0000
commit2cf76574dbf57c70da3a835f2a45d5619dc058f5 (patch)
tree9c88955ba9f7ae2b129fd6fa18c903e1b4dbe35a /firmware/2lib/include/2misc.h
parent7c73bb07fd3ca45ce650b993a9c6a5850ddb2707 (diff)
downloadvboot-factory-ambassador-14265.B.tar.gz
2api: Add vb2_boot_mode in vb2_context denoted the current boot modestabilize-14267.Bfactory-ambassador-14265.B
Add enum vb2_boot_mode which denotes the most relevant boot mode between normal, manual recovery, broken recovery, diagnostic, and developer. The boot mode constant stores in vb2_context, is exposed externally, and decided in vb2api_fw_phase1. Split out the logic of manual recovery and broken screen. (The broken recovery is a recovery boot with !vb2api_allow_recovery) Add the fifth boot mode, diagnostic boot mode A boot could match more the one boot mode, this api will pick the most relevant boot mode based on the following order: 1. Manual recovery boot 2. Broken recovery boot 3. Diagnostics boot 4. Developer boot 5. Normal boot This constant is used in: * lib/vboot_api_kernel.c: VbSelectAndLoadKernel() * lib/vboot_kernel.c: replace the original vb2_boot_mode * coreboot/bootmode for adding elogs Also bump the vb2sd minor version from 0 to 1. BUG=b:185551931, b:177196147, b:181931817 BRANCH=none TEST=CC=x86_64-pc-linux-gnu-clang; make clean && make runtests TEST=emerge coreboot vboot_reference depthcharge Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org> Change-Id: I421e4d51c261ba2bdec996a5fb2ebccb33513fa4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2944250 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
Diffstat (limited to 'firmware/2lib/include/2misc.h')
-rw-r--r--firmware/2lib/include/2misc.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/firmware/2lib/include/2misc.h b/firmware/2lib/include/2misc.h
index b36e1270..3d292872 100644
--- a/firmware/2lib/include/2misc.h
+++ b/firmware/2lib/include/2misc.h
@@ -191,4 +191,19 @@ void vb2_clear_recovery(struct vb2_context *ctx);
*/
void vb2_fill_dev_boot_flags(struct vb2_context *ctx);
+/**
+ * Determine and set a mutually exclusive boot mode in the vboot context.
+ *
+ * Determine the most relevant boot mode for current boot, store into
+ * ctx->boot_mode, which is a ctx field introduced in struct version 3.1.
+ *
+ * This function should be only called by vb2api_fw_phase1.
+ * The vb2api_fw_phase1 should call this function at its end phase once and all
+ * the following steps should directly access ctx->boot_mode to retrieve the
+ * most relevant boot mode.
+ *
+ * @param ctx Vboot context.
+ */
+void vb2_set_boot_mode(struct vb2_context *ctx);
+
#endif /* VBOOT_REFERENCE_2MISC_H_ */