diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2018-01-10 11:09:50 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-01-12 03:27:08 -0800 |
commit | b946052a56318dc1f4f04e6f0205d93cd66f2851 (patch) | |
tree | 38be9277831e4b0458638515dcf5fa28dbff258a /common/ccd_config.c | |
parent | bb1c9631d286ae1e0161f75157eef1287c83ac38 (diff) | |
download | chrome-ec-b946052a56318dc1f4f04e6f0205d93cd66f2851.tar.gz |
ccd: refactor to allow clear indication of CCD command being in progress
We want to be able to tell between cases when a CCD command executed
on the TPM vendor command context was invoked through CLI or received
over /dev/tpm0.
Let's add a flag set for the duration of execution of the CLI command.
BRANCH=cr50
BUG=b:62537474
TEST=none, this is not used yet.
Change-Id: I309b4364285816a5f54522b00c93a4bf5025e2c4
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/860913
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'common/ccd_config.c')
-rw-r--r-- | common/ccd_config.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/common/ccd_config.c b/common/ccd_config.c index bbf3b10f67..bb535dea06 100644 --- a/common/ccd_config.c +++ b/common/ccd_config.c @@ -152,6 +152,7 @@ static struct ccd_config config; static uint8_t ccd_config_loaded; static uint8_t force_disabled; static struct mutex ccd_config_mutex; +static uint8_t ccd_console_active; /* CCD console command is in progress. */ /******************************************************************************/ /* Raw config accessors */ @@ -1163,7 +1164,7 @@ static int command_ccd_help(void) /** * Case closed debugging config command. */ -static int command_ccd(int argc, char **argv) +static int command_ccd_body(int argc, char **argv) { /* If no args or 'get', print info */ if (argc < 2 || !strcasecmp(argv[1], "get")) @@ -1205,6 +1206,17 @@ static int command_ccd(int argc, char **argv) /* Anything else (including "help") prints help */ return command_ccd_help(); } + +static int command_ccd(int argc, char **argv) +{ + int rv; + + ccd_console_active = 1; + rv = command_ccd_body(argc, argv); + ccd_console_active = 0; + + return rv; +} DECLARE_SAFE_CONSOLE_COMMAND(ccd, command_ccd, "[help | ...]", "Configure case-closed debugging"); |