summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/2lib/2kernel.c3
-rw-r--r--firmware/2lib/2misc.c11
-rw-r--r--firmware/2lib/2ui_screens.c2
-rw-r--r--firmware/2lib/include/2api.h10
-rw-r--r--firmware/2lib/include/2secdata.h14
5 files changed, 31 insertions, 9 deletions
diff --git a/firmware/2lib/2kernel.c b/firmware/2lib/2kernel.c
index 3155d189..dd91ec83 100644
--- a/firmware/2lib/2kernel.c
+++ b/firmware/2lib/2kernel.c
@@ -143,9 +143,10 @@ vb2_error_t vb2api_kernel_phase1(struct vb2_context *ctx)
return rv;
}
- /* Enable phone recovery */
+ /* Enable phone recovery while disabling the UI */
secdata_flags = vb2_secdata_kernel_get(ctx, VB2_SECDATA_KERNEL_FLAGS);
secdata_flags &= ~VB2_SECDATA_KERNEL_FLAG_PHONE_RECOVERY_DISABLED;
+ secdata_flags |= VB2_SECDATA_KERNEL_FLAG_PHONE_RECOVERY_UI_DISABLED;
vb2_secdata_kernel_set(ctx, VB2_SECDATA_KERNEL_FLAGS, secdata_flags);
/* Read kernel version from secdata. */
diff --git a/firmware/2lib/2misc.c b/firmware/2lib/2misc.c
index eaab89d9..86b866de 100644
--- a/firmware/2lib/2misc.c
+++ b/firmware/2lib/2misc.c
@@ -506,6 +506,17 @@ int vb2api_phone_recovery_enabled(struct vb2_context *ctx)
VB2_SECDATA_KERNEL_FLAG_PHONE_RECOVERY_DISABLED);
}
+int vb2api_phone_recovery_ui_enabled(struct vb2_context *ctx)
+{
+ /*
+ * When phone recovery functionality is disabled, return 0 even if
+ * PHONE_RECOVERY_UI_DISABLED is not set.
+ */
+ return vb2api_phone_recovery_enabled(ctx) &&
+ !(vb2_secdata_kernel_get(ctx, VB2_SECDATA_KERNEL_FLAGS) &
+ VB2_SECDATA_KERNEL_FLAG_PHONE_RECOVERY_UI_DISABLED);
+}
+
enum vb2_dev_default_boot_target vb2api_get_dev_default_boot_target(
struct vb2_context *ctx)
{
diff --git a/firmware/2lib/2ui_screens.c b/firmware/2lib/2ui_screens.c
index b41146d7..042d6d4c 100644
--- a/firmware/2lib/2ui_screens.c
+++ b/firmware/2lib/2ui_screens.c
@@ -196,7 +196,7 @@ static const struct vb2_screen_info advanced_options_screen = {
vb2_error_t recovery_select_init(struct vb2_ui_context *ui)
{
ui->state.selected_item = RECOVERY_SELECT_ITEM_PHONE;
- if (!vb2api_phone_recovery_enabled(ui->ctx)) {
+ if (!vb2api_phone_recovery_ui_enabled(ui->ctx)) {
VB2_DEBUG("WARNING: Phone recovery not available\n");
ui->state.disabled_item_mask |=
1 << RECOVERY_SELECT_ITEM_PHONE;
diff --git a/firmware/2lib/include/2api.h b/firmware/2lib/include/2api.h
index 1696289a..9131dea0 100644
--- a/firmware/2lib/include/2api.h
+++ b/firmware/2lib/include/2api.h
@@ -854,13 +854,21 @@ uint32_t vb2api_get_recovery_reason(struct vb2_context *ctx);
uint32_t vb2api_get_locale_id(struct vb2_context *ctx);
/**
- * Whether phone recovery is enabled or not.
+ * Whether phone recovery functionality is enabled or not.
*
* @param ctx Vboot context
* @return 1 if enabled, 0 if disabled.
*/
int vb2api_phone_recovery_enabled(struct vb2_context *ctx);
+/**
+ * Whether phone recovery instructions in recovery UI are enabled or not.
+ *
+ * @param ctx Vboot context
+ * @return 1 if enabled, 0 if disabled.
+ */
+int vb2api_phone_recovery_ui_enabled(struct vb2_context *ctx);
+
/* Default boot target in developer mode. */
enum vb2_dev_default_boot_target {
/* Default to boot from internal disk. */
diff --git a/firmware/2lib/include/2secdata.h b/firmware/2lib/include/2secdata.h
index 56ebb3b2..3b2fa3ca 100644
--- a/firmware/2lib/include/2secdata.h
+++ b/firmware/2lib/include/2secdata.h
@@ -89,15 +89,17 @@ enum vb2_secdata_kernel_param {
/* Flags for kernel space */
enum vb2_secdata_kernel_flags {
/*
- * Phone recovery is disabled.
+ * Phone recovery functionality is disabled.
*
- * RW firmware currently sets this flag to disable phone recovery on
- * first boot (see function vb2api_kernel_phase1()). A future RW update
- * will flip this flag back to 0 when phone recovery is ready. In the
- * case that there are TPM communication issues, phone recovery is
- * enabled by the default value of 0. See b/147744345 for details.
+ * RW firmware currently clears this flag to enable phone recovery on
+ * first boot (see function vb2api_kernel_phase1()). In the case that
+ * there are TPM communication issues, phone recovery is enabled by the
+ * default value of 0. See b/147744345 for details.
*/
VB2_SECDATA_KERNEL_FLAG_PHONE_RECOVERY_DISABLED = (1 << 0),
+
+ /* Phone recovery instructions in recovery UI are disabled. */
+ VB2_SECDATA_KERNEL_FLAG_PHONE_RECOVERY_UI_DISABLED = (1 << 1),
};
/**