diff options
author | Jett Rink <jettrink@chromium.org> | 2018-09-24 10:48:33 -0600 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2018-12-08 02:40:57 +0000 |
commit | 874ed0887f235588dc384404bbee5ca448eafbec (patch) | |
tree | 8e0a1a5708eecb2574049890d4a82bddf28ee78d | |
parent | 38d322fa67f46e0b4c2f37b32f08d8421a2c5c71 (diff) | |
download | chrome-ec-874ed0887f235588dc384404bbee5ca448eafbec.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>
Reviewed-on: https://chromium-review.googlesource.com/c/1364316
Reviewed-by: YH Lin <yueherngl@chromium.org>
Commit-Queue: YH Lin <yueherngl@chromium.org>
Tested-by: YH Lin <yueherngl@chromium.org>
-rw-r--r-- | include/ec_commands.h | 14 | ||||
-rw-r--r-- | util/ectool.c | 23 |
2 files changed, 29 insertions, 8 deletions
diff --git a/include/ec_commands.h b/include/ec_commands.h index 05d7f435e3..df5288a377 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -4701,6 +4701,20 @@ struct __ec_align2 ec_response_pd_chip_info { }; }; +struct __ec_align2 ec_response_pd_chip_info_v1 { + uint16_t vendor_id; + uint16_t product_id; + uint16_t device_id; + union { + uint8_t fw_version_string[8]; + uint64_t fw_version_number; + }; + union { + uint8_t min_req_fw_version_string[8]; + uint64_t min_req_fw_version_number; + }; +}; + /* Run RW signature verification and get status */ #define EC_CMD_RWSIG_CHECK_STATUS 0x011C diff --git a/util/ectool.c b/util/ectool.c index 8cb2b50a6a..3471d3406c 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -7729,9 +7729,10 @@ int cmd_pd_control(int argc, char *argv[]) int cmd_pd_chip_info(int argc, char *argv[]) { struct ec_params_pd_chip_info p; - struct ec_response_pd_chip_info r; + struct ec_response_pd_chip_info_v1 r; char *e; int rv; + int cmdver = 1; if (argc < 2 || 3 < argc) { fprintf(stderr, "Usage: %s <port> [renew(on/off)]\n", argv[0]); @@ -7754,7 +7755,11 @@ int cmd_pd_chip_info(int argc, char *argv[]) p.renew = val; } - rv = ec_command(EC_CMD_PD_CHIP_INFO, 0, &p, sizeof(p), &r, sizeof(r)); + if (!ec_cmd_version_supported(EC_CMD_PD_CHIP_INFO, cmdver)) + cmdver = 0; + + rv = ec_command(EC_CMD_PD_CHIP_INFO, cmdver, &p, sizeof(p), &r, + sizeof(r)); if (rv < 0) return rv; @@ -7762,14 +7767,16 @@ int cmd_pd_chip_info(int argc, char *argv[]) printf("product_id: 0x%x\n", r.product_id); printf("device_id: 0x%x\n", r.device_id); - switch (r.vendor_id) { - case ANX74XX_VENDOR_ID: - case PS8XXX_VENDOR_ID: + if (r.fw_version_number != -1) printf("fw_version: 0x%" PRIx64 "\n", r.fw_version_number); - break; - default: + else printf("fw_version: UNSUPPORTED\n"); - } + + if (cmdver >= 1) + printf("min_req_fw_version: 0x%" PRIx64 "\n", + r.min_req_fw_version_number); + else + printf("min_req_fw_version: UNSUPPORTED\n"); return 0; } |