diff options
author | Keith Short <keithshort@chromium.org> | 2019-01-22 16:59:13 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-01-30 13:06:41 -0800 |
commit | 54c06033f3813013296c9945d6ed13cd258a1db8 (patch) | |
tree | 36ab20ac4690c825e2d024c5b96047fd3ab92099 /board/cr50 | |
parent | cc98aa2569f249071d75b435ac400a4c060c43fb (diff) | |
download | chrome-ec-54c06033f3813013296c9945d6ed13cd258a1db8.tar.gz |
cr50: Add VENDOR_CC_GET_PWR_BTN to query power button
Add the new TPM command VENDOR_CC_GET_PWR_BTN used to query whether
there has been a recent (within 10 seconds) power button press by the
user. This is used by coreboot on Sarien/Arcada to confirm user
presence prior to enabling developer mode and prior to launching closed
source diagnostics.
BUG=b:119346609
BRANCH=cr50
TEST=make buildall. Tested power button query from coreboot recovery
screen screen on Arcada and Sarien platforms.
Change-Id: I20f91204fe30dda27b0d14b755bcd357938029f5
Signed-off-by: Keith Short <keithshort@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1432313
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
Diffstat (limited to 'board/cr50')
-rw-r--r-- | board/cr50/power_button.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/board/cr50/power_button.c b/board/cr50/power_button.c index c939d7b980..aff6bc305c 100644 --- a/board/cr50/power_button.c +++ b/board/cr50/power_button.c @@ -4,6 +4,7 @@ */ #include "console.h" +#include "extension.h" #include "gpio.h" #include "hooks.h" #include "physical_presence.h" @@ -13,6 +14,7 @@ #include "system_chip.h" #include "task.h" #include "timer.h" +#include "u2f_impl.h" #define CPRINTS(format, args...) cprints(CC_RBOX, format, ## args) #define CPRINTF(format, args...) cprintf(CC_RBOX, format, ## args) @@ -125,3 +127,22 @@ static int command_powerbtn(int argc, char **argv) } DECLARE_CONSOLE_COMMAND(powerbtn, command_powerbtn, "", "get the state of the power button"); + +/* + * Perform a user presence check using the power button. + */ +static enum vendor_cmd_rc vc_get_pwr_btn(enum vendor_cmd_cc code, + void *buf, + size_t input_size, + size_t *response_size) +{ + if (pop_check_presence(1) == POP_TOUCH_YES) + *(uint8_t *)buf = 1; + else + *(uint8_t *)buf = 0; + *response_size = 1; + + return VENDOR_RC_SUCCESS; +} +DECLARE_VENDOR_COMMAND(VENDOR_CC_GET_PWR_BTN, vc_get_pwr_btn); + |