diff options
author | Matt Delco <delco@google.com> | 2019-02-13 12:31:09 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-03-16 05:23:59 -0700 |
commit | fa656b63a573c50f62ebdce46f70ee2fa2acbd23 (patch) | |
tree | 36808a7fdc6a2ad5250b6e7c99e8e62066f8136e /firmware | |
parent | 26f9bf2e1b2ebc0b9fb76281f22db6ac99db5d7e (diff) | |
download | vboot-fa656b63a573c50f62ebdce46f70ee2fa2acbd23.tar.gz |
vboot: add power button query functionality
The primary purpose of this change is to add a flag to VbExGetSwitches()
so the current user physical presence (via the status of the power button)
can be queried.
The flags have also been renamed from the historical _INIT_ use to
_SWITCH_ to reflect the current/actual API they're used with.
BUG=b:124358784
BRANCH=none
TEST=Locally built and flashed. Confirmed that the power button status
can be queried when the power button is disabled.
CQ-DEPEND=CL:1470273
Change-Id: I579ebe657ae35fb866eb30b466e8e8c16f54e584
Signed-off-by: Matt Delco <delco@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1471190
Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/include/vboot_api.h | 9 | ||||
-rw-r--r-- | firmware/lib/vboot_ui.c | 7 | ||||
-rw-r--r-- | firmware/lib/vboot_ui_menu.c | 2 |
3 files changed, 10 insertions, 8 deletions
diff --git a/firmware/include/vboot_api.h b/firmware/include/vboot_api.h index 6e738dc4..8dc3f962 100644 --- a/firmware/include/vboot_api.h +++ b/firmware/include/vboot_api.h @@ -203,11 +203,12 @@ typedef struct VbCommonParams { /* Flags for VbExGetSwitches() */ /* Recovery button was pressed at boot time. */ -#define VB_INIT_FLAG_REC_BUTTON_PRESSED 0x00000002 +#define VB_SWITCH_FLAG_REC_BUTTON_PRESSED 0x00000002 +/* Report if user is currently present (typically via power button) */ +#define VB_SWITCH_FLAG_PHYS_PRESENCE_PRESSED 0x00000004 /* Allow USB boot on transition to dev */ -#define VB_INIT_FLAG_ALLOW_USB_BOOT 0x00004000 -/* Mask of deprecated flags */ -#define VB_INIT_FLAG_DEPRECATED 0x0000BFFD +#define VB_SWITCH_FLAG_ALLOW_USB_BOOT 0x00004000 + /* * Output flags for VbInitParams.out_flags. Used to indicate potential boot diff --git a/firmware/lib/vboot_ui.c b/firmware/lib/vboot_ui.c index 3fb2ce63..274bf978 100644 --- a/firmware/lib/vboot_ui.c +++ b/firmware/lib/vboot_ui.c @@ -144,7 +144,8 @@ int VbUserConfirms(struct vb2_context *ctx, uint32_t confirm_flags) /* If the recovery button is physical, and is pressed, * this is also a YES, but must wait for release. */ - btn = VbExGetSwitches(VB_INIT_FLAG_REC_BUTTON_PRESSED); + btn = VbExGetSwitches( + VB_SWITCH_FLAG_REC_BUTTON_PRESSED); if (!(shared->flags & VBSD_BOOT_REC_SWITCH_VIRTUAL)) { if (btn) { VB2_DEBUG("Rec button pressed\n"); @@ -740,7 +741,7 @@ static VbError_t recovery_ui(struct vb2_context *ctx) if (!(shared->flags & VBSD_BOOT_REC_SWITCH_VIRTUAL) && VbExGetSwitches( - VB_INIT_FLAG_REC_BUTTON_PRESSED)) { + VB_SWITCH_FLAG_REC_BUTTON_PRESSED)) { /* * Is the recovery button stuck? In * any case we don't like this. Beep @@ -768,7 +769,7 @@ static VbError_t recovery_ui(struct vb2_context *ctx) VB2_DEBUG("Reboot so it will take " "effect\n"); if (VbExGetSwitches - (VB_INIT_FLAG_ALLOW_USB_BOOT)) + (VB_SWITCH_FLAG_ALLOW_USB_BOOT)) VbAllowUsbBoot(ctx); return VBERROR_EC_REBOOT_TO_RO_REQUIRED; case -1: diff --git a/firmware/lib/vboot_ui_menu.c b/firmware/lib/vboot_ui_menu.c index a15c8562..17c1137e 100644 --- a/firmware/lib/vboot_ui_menu.c +++ b/firmware/lib/vboot_ui_menu.c @@ -366,7 +366,7 @@ static VbError_t to_dev_action(struct vb2_context *ctx) return VBERROR_TPM_SET_BOOT_MODE_STATE; /* This was meant for headless devices, shouldn't really matter here. */ - if (VbExGetSwitches(VB_INIT_FLAG_ALLOW_USB_BOOT)) + if (VbExGetSwitches(VB_SWITCH_FLAG_ALLOW_USB_BOOT)) vb2_nv_set(ctx, VB2_NV_DEV_BOOT_USB, 1); VB2_DEBUG("Reboot so it will take effect\n"); |