summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/ccd_config.c25
-rw-r--r--extra/usb_updater/gsctool.c5
-rw-r--r--include/ccd_config.h14
3 files changed, 41 insertions, 3 deletions
diff --git a/common/ccd_config.c b/common/ccd_config.c
index fa7c1cb133..c6946522c5 100644
--- a/common/ccd_config.c
+++ b/common/ccd_config.c
@@ -193,6 +193,23 @@ static void raw_set_cap(enum ccd_capability cap,
}
/**
+ * Check CCD configuration is reset to default value.
+ *
+ * @return 1 if it is in default mode.
+ * 0 otherwise.
+ */
+static int raw_check_all_caps_default(void)
+{
+ uint32_t i;
+
+ for (i = 0; i < CCD_CAP_COUNT; i++)
+ if (raw_get_cap(i, 0) != CCD_CAP_STATE_DEFAULT)
+ return 0;
+
+ return 1;
+}
+
+/**
* Check if a password is set.
* @return 1 if password is set, 0 if it's not
*/
@@ -693,6 +710,9 @@ static int command_ccd_info(void)
board_fwmp_allows_unlock() ? "" : " fwmp_lock",
board_vboot_dev_mode_enabled() ? " dev_mode" : "");
+ ccprintf("Capabilities are %s.\n", raw_check_all_caps_default() ?
+ "default" : "modified");
+
ccputs("Use 'ccd help' to print subcommands\n");
return EC_SUCCESS;
}
@@ -1327,7 +1347,10 @@ static enum vendor_cmd_rc ccd_get_info(struct vendor_cmd_params *p)
response.ccd_flags = htobe32(raw_get_flags());
response.ccd_state = ccd_get_state();
- response.ccd_has_password = raw_has_password();
+ response.ccd_indicator_bitmap = raw_has_password() ?
+ CCD_INDICATOR_BIT_HAS_PASSWORD : 0;
+ response.ccd_indicator_bitmap |= raw_check_all_caps_default() ?
+ CCD_INDICATOR_BIT_ALL_CAPS_DEFAULT : 0;
response.ccd_force_disabled = force_disabled;
for (i = 0; i < ARRAY_SIZE(response.ccd_caps_current); i++) {
response.ccd_caps_current[i] =
diff --git a/extra/usb_updater/gsctool.c b/extra/usb_updater/gsctool.c
index 66b859f675..577998aaf4 100644
--- a/extra/usb_updater/gsctool.c
+++ b/extra/usb_updater/gsctool.c
@@ -1522,7 +1522,8 @@ static void print_ccd_info(void *response, size_t response_size)
/* Now report CCD state on the console. */
printf("State: %s\n", ccd_info.ccd_state > ARRAY_SIZE(state_names) ?
"Error" : state_names[ccd_info.ccd_state]);
- printf("Password: %s\n", ccd_info.ccd_has_password ? "Set" : "None");
+ printf("Password: %s\n", (ccd_info.ccd_indicator_bitmap &
+ CCD_INDICATOR_BIT_HAS_PASSWORD) ? "Set" : "None");
printf("Flags: %#06x\n", ccd_info.ccd_flags);
printf("Capabilities, current and default:\n");
for (i = 0; i < CCD_CAP_COUNT; i++) {
@@ -1572,6 +1573,8 @@ static void print_ccd_info(void *response, size_t response_size)
caps_bitmap |= (1 << i);
}
printf("CCD caps bitmap: %#x\n", caps_bitmap);
+ printf("Capabilities are %s.\n", (ccd_info.ccd_indicator_bitmap &
+ CCD_INDICATOR_BIT_ALL_CAPS_DEFAULT) ? "default" : "modified");
}
static void process_ccd_state(struct transfer_descriptor *td, int ccd_unlock,
diff --git a/include/ccd_config.h b/include/ccd_config.h
index 4cc84ae770..5f21479cef 100644
--- a/include/ccd_config.h
+++ b/include/ccd_config.h
@@ -206,9 +206,21 @@ struct ccd_info_response {
uint32_t ccd_flags;
uint8_t ccd_state;
uint8_t ccd_force_disabled;
- uint8_t ccd_has_password;
+ /*
+ * A bitmap indicating ccd internal state.
+ * See "enum ccd_indicator_bits" below.
+ */
+ uint8_t ccd_indicator_bitmap;
} __packed;
+enum ccd_indicator_bits {
+ /* has_password? */
+ CCD_INDICATOR_BIT_HAS_PASSWORD = (1 << 0),
+
+ /* Are CCD capabilities in CCD_CAP_STATE_DEFAULT */
+ CCD_INDICATOR_BIT_ALL_CAPS_DEFAULT = (1 << 1),
+};
+
/**
* Initialize CCD configuration at boot.
*