summaryrefslogtreecommitdiff
path: root/include/ccd_config.h
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2018-04-05 19:05:24 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-04-10 16:29:16 -0700
commitc3077e63e5848176253bb4ab856c2d5f8d5d13e1 (patch)
treebc79e3d76ebfba5734bc5602a0f62d1b69f8c7f3 /include/ccd_config.h
parent33e91c211f0d5331d5b0dda1297f3a7c42c46a26 (diff)
downloadchrome-ec-c3077e63e5848176253bb4ab856c2d5f8d5d13e1.tar.gz
cr50: add vendor CCD subcommand to report CCD information
It is important for the OS to be able to find out the state of CCD and current capabilities settings of the device. This patch defines a structure to use to report information about CCD state from Cr50 to the host and adds a CCD vendor subcommand to allow to retrieve the information from Cr50. Some structure and variable definitions had to be moved into the .h file to make it possible to share them between Cr50 and gsctool. BRANCH=cr50, cr50-mp BUG=b:72718383 TEST=with the following patch applied verified that CCD info is properly reported. Also verified that other CCD subcommands still work as advertised. Change-Id: I4a783e6817ed364b9e64522ebbe968d4a657a84c Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/999825 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'include/ccd_config.h')
-rw-r--r--include/ccd_config.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/include/ccd_config.h b/include/ccd_config.h
index c7243ecbb8..a71db37bba 100644
--- a/include/ccd_config.h
+++ b/include/ccd_config.h
@@ -7,6 +7,9 @@
#ifndef __CROS_EC_CCD_CONFIG_H
#define __CROS_EC_CCD_CONFIG_H
+#include <common.h>
+#include <stdint.h>
+
/* Case-closed debugging state */
enum ccd_state {
CCD_STATE_LOCKED = 0,
@@ -101,6 +104,58 @@ enum ccd_capability {
CCD_CAP_COUNT
};
+/* Capability states */
+enum ccd_capability_state {
+ /* Default value */
+ CCD_CAP_STATE_DEFAULT = 0,
+
+ /* Always available (state >= CCD_STATE_LOCKED) */
+ CCD_CAP_STATE_ALWAYS = 1,
+
+ /* Unless locked (state >= CCD_STATE_UNLOCKED) */
+ CCD_CAP_STATE_UNLESS_LOCKED = 2,
+
+ /* Only if opened (state >= CCD_STATE_OPENED) */
+ CCD_CAP_STATE_IF_OPENED = 3,
+
+ /* Number of capability states */
+ CCD_CAP_STATE_COUNT
+};
+
+struct ccd_capability_info {
+ /* Capability name */
+ const char *name;
+
+ /* Default state, if config set to CCD_CAP_STATE_DEFAULT */
+ enum ccd_capability_state default_state;
+};
+
+#define CAP_INFO_DATA { \
+ {"UartGscRxAPTx", CCD_CAP_STATE_ALWAYS}, \
+ {"UartGscTxAPRx", CCD_CAP_STATE_ALWAYS}, \
+ {"UartGscRxECTx", CCD_CAP_STATE_ALWAYS}, \
+ {"UartGscTxECRx", CCD_CAP_STATE_IF_OPENED}, \
+ \
+ {"FlashAP", CCD_CAP_STATE_IF_OPENED}, \
+ {"FlashEC", CCD_CAP_STATE_IF_OPENED}, \
+ {"OverrideWP", CCD_CAP_STATE_IF_OPENED}, \
+ {"RebootECAP", CCD_CAP_STATE_IF_OPENED}, \
+ \
+ {"GscFullConsole", CCD_CAP_STATE_IF_OPENED}, \
+ {"UnlockNoReboot", CCD_CAP_STATE_ALWAYS}, \
+ {"UnlockNoShortPP", CCD_CAP_STATE_ALWAYS}, \
+ {"OpenNoTPMWipe", CCD_CAP_STATE_IF_OPENED}, \
+ \
+ {"OpenNoLongPP", CCD_CAP_STATE_IF_OPENED}, \
+ {"BatteryBypassPP", CCD_CAP_STATE_ALWAYS}, \
+ {"UpdateNoTPMWipe", CCD_CAP_STATE_ALWAYS}, \
+ {"I2C", CCD_CAP_STATE_IF_OPENED}, \
+ {"FlashRead", CCD_CAP_STATE_ALWAYS}, \
+ }
+
+#define CCD_STATE_NAMES { "Locked", "Unlocked", "Opened" }
+#define CCD_CAP_STATE_NAMES { "Default", "Always", "UnlessLocked", "IfOpened" }
+
/*
* Subcommand code, used to pass different CCD commands using the same TPM
* vendor command.
@@ -112,6 +167,7 @@ enum ccd_vendor_subcommands {
CCDV_LOCK = 3,
CCDV_PP_POLL_UNLOCK = 4,
CCDV_PP_POLL_OPEN = 5,
+ CCDV_GET_INFO = 6
};
enum ccd_pp_state {
@@ -121,6 +177,17 @@ enum ccd_pp_state {
CCD_PP_DONE = 3
};
+/* Structure to communicate information about CCD state. */
+#define CCD_CAPS_WORDS ((CCD_CAP_COUNT * 2 + 31)/32)
+struct ccd_info_response {
+ uint32_t ccd_caps_current[CCD_CAPS_WORDS];
+ uint32_t ccd_caps_defaults[CCD_CAPS_WORDS];
+ uint32_t ccd_flags;
+ uint8_t ccd_state;
+ uint8_t ccd_force_disabled;
+ uint8_t ccd_has_password;
+} __packed;
+
/**
* Initialize CCD configuration at boot.
*