summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2018-01-10 11:09:50 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2018-02-01 00:48:14 +0000
commite3fbbaa8c7681d5698efc8346790e8dffc7caadc (patch)
tree1c46b63cd0b4ae0e8315b47f66110b39cdcfea72
parent7094d02b1afb139bad7db11bcf1c09d0c34889d5 (diff)
downloadchrome-ec-e3fbbaa8c7681d5698efc8346790e8dffc7caadc.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> (cherry picked from commit b946052a56318dc1f4f04e6f0205d93cd66f2851) Reviewed-on: https://chromium-review.googlesource.com/896758
-rw-r--r--common/ccd_config.c14
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");