summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorJett Rink <jettrink@chromium.org>2018-09-24 10:48:33 -0600
committerchrome-bot <chrome-bot@chromium.org>2018-09-28 13:34:32 -0700
commitc6c0d021d16eb686254bde767264f7f3151df7f2 (patch)
tree5a38b1178189ffb0ad3ba0754a0b775399c928a7 /common
parent64c792829c2fd6bda4985e2add424cce41c5cfd9 (diff)
downloadchrome-ec-c6c0d021d16eb686254bde767264f7f3151df7f2.tar.gz
pdchipinfo: add min firmware version to pdchipinfo
Add a new field to the pdchipinfo host command that exposes the minimum required firmware version that we know about. This will allow factory tests or automated test to compare this version to the current version and fail. BRANCH=none BUG=b:116068318 TEST=with corresponding ectool change, min value is reported correctly Change-Id: Idf338795c3fd6f9f95e51471d0f6a7a422901d52 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1240457 Reviewed-by: Justin TerAvest <teravest@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/usb_pd_protocol.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index aa9313a9ad..966d89bb57 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -2531,7 +2531,7 @@ void pd_task(void *u)
this_state = res ? PD_STATE_SUSPENDED : PD_DEFAULT_STATE(port);
#ifndef CONFIG_USB_PD_TCPC
if (!res) {
- struct ec_response_pd_chip_info *info;
+ struct ec_response_pd_chip_info_v1 *info;
if (tcpm_get_chip_info(port, 0, &info) == EC_SUCCESS) {
CPRINTS("TCPC p%d VID:0x%x PID:0x%x DID:0x%x FWV:0x%lx",
@@ -4773,7 +4773,7 @@ DECLARE_HOST_COMMAND(EC_CMD_USB_PD_DEV_INFO,
static int hc_remote_pd_chip_info(struct host_cmd_handler_args *args)
{
const struct ec_params_pd_chip_info *p = args->params;
- struct ec_response_pd_chip_info *r = args->response, *info;
+ struct ec_response_pd_chip_info_v1 *info;
if (p->port >= CONFIG_USB_PD_PORT_COUNT)
return EC_RES_INVALID_PARAM;
@@ -4781,14 +4781,21 @@ static int hc_remote_pd_chip_info(struct host_cmd_handler_args *args)
if (tcpm_get_chip_info(p->port, p->renew, &info))
return EC_RES_ERROR;
- memcpy(r, info, sizeof(*r));
- args->response_size = sizeof(*r);
+ /*
+ * Take advantage of the fact that v0 and v1 structs have the
+ * same layout for v0 data. (v1 just appends data)
+ */
+ args->response_size =
+ args->version ? sizeof(struct ec_response_pd_chip_info_v1)
+ : sizeof(struct ec_response_pd_chip_info);
+
+ memcpy(args->response, info, args->response_size);
return EC_RES_SUCCESS;
}
DECLARE_HOST_COMMAND(EC_CMD_PD_CHIP_INFO,
hc_remote_pd_chip_info,
- EC_VER_MASK(0));
+ EC_VER_MASK(0) | EC_VER_MASK(1));
#endif
#endif