From a313e2fe2c78de8c2270483a1654ebd0f6530ccd Mon Sep 17 00:00:00 2001 From: Namyoon Woo Date: Tue, 9 Oct 2018 18:23:09 -0700 Subject: cr50: CCD Info indicates whether all CCD capabilities are default. CR50 provides whether CCD capabilities are default or not. Factory process can utilize this value instead of CCD cap bitmap information. Users can use either 'gsctool -I' or CR50 console command 'ccd'. BRANCH=cr50_tools BUG=b:117200472 TEST=manually set and clear the password using gsctool -a -F and check the result of gsctool -I. Change-Id: Ic6be2ce880476c3a73150fe0e29007dd6a7e328f Signed-off-by: Namyoon Woo Reviewed-on: https://chromium-review.googlesource.com/1272190 Reviewed-by: Randall Spangler --- common/ccd_config.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'common/ccd_config.c') 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 @@ -192,6 +192,23 @@ static void raw_set_cap(enum ccd_capability cap, config.capabilities[index] |= (state & CCD_CAP_BITMASK) << shift; } +/** + * 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] = -- cgit v1.2.1