diff options
author | Aaron Massey <aaronmassey@google.com> | 2022-10-20 08:28:45 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-10-20 18:58:53 +0000 |
commit | f929d22fd28231183a9d318492a81e24997c401f (patch) | |
tree | 3903611ce4f1deb6744856090ca07b2f4cbcc0ad | |
parent | 804fd201145d1c8011ce10f416e39087611394ee (diff) | |
download | chrome-ec-f929d22fd28231183a9d318492a81e24997c401f.tar.gz |
host_command: Remove EC_CMD_READ_TEST
The EC_CMD_READ_TEST expected "response_size" to be explicitly set by
the host as greater than zero. This is not how the host commands are
used and there is not a single other host command that behaves in this
way. This expectation resulted in a return value of EC_RES_ERROR every
time the host command was invoked. It's been broken in this way for
about 4 years, which indicates the host command is not used.
Remove the EC_CMD_READ_TEST to gain a bit of flash space back.
BRANCH=none
BUG=b:254534089
TEST=zmake build herobrine image report
TEST=ectool without removal of host command
TEST=CQ
Signed-off-by: Aaron Massey <aaronmassey@google.com>
Change-Id: I2a6cfd4352fb9da1890463a7fadfd0e08c1fb989
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3967307
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Reviewed-by: Diana Z <dzigterman@chromium.org>
Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r-- | common/host_command.c | 21 | ||||
-rw-r--r-- | extra/ftdi_hostcmd/test_cmds.c | 1 | ||||
-rw-r--r-- | include/ec_commands.h | 20 | ||||
-rw-r--r-- | util/ectool.cc | 67 |
4 files changed, 1 insertions, 108 deletions
diff --git a/common/host_command.c b/common/host_command.c index 89a835a1aa..c66a2b91d2 100644 --- a/common/host_command.c +++ b/common/host_command.c @@ -492,27 +492,6 @@ static enum ec_status host_command_hello(struct host_cmd_handler_args *args) } DECLARE_HOST_COMMAND(EC_CMD_HELLO, host_command_hello, EC_VER_MASK(0)); -static enum ec_status host_command_read_test(struct host_cmd_handler_args *args) -{ - const struct ec_params_read_test *p = args->params; - struct ec_response_read_test *r = args->response; - - int offset = p->offset; - int size = p->size / sizeof(uint32_t); - int i; - - if (size > ARRAY_SIZE(r->data) || p->size > args->response_size) - return EC_RES_ERROR; - - for (i = 0; i < size; i++) - r->data[i] = offset + i; - - args->response_size = size * sizeof(uint32_t); - - return EC_RES_SUCCESS; -} -DECLARE_HOST_COMMAND(EC_CMD_READ_TEST, host_command_read_test, EC_VER_MASK(0)); - #ifndef CONFIG_HOSTCMD_X86 /* * Host command to read memory map is not needed on LPC, because LPC can diff --git a/extra/ftdi_hostcmd/test_cmds.c b/extra/ftdi_hostcmd/test_cmds.c index 7bd3413032..748b862b56 100644 --- a/extra/ftdi_hostcmd/test_cmds.c +++ b/extra/ftdi_hostcmd/test_cmds.c @@ -378,7 +378,6 @@ static struct lookup cmd_table[] = { { 0x00, "EC_CMD_PROTO_VERSION" }, { 0x01, "EC_CMD_HELLO" }, { 0x02, "EC_CMD_GET_VERSION" }, - { 0x03, "EC_CMD_READ_TEST" }, { 0x04, "EC_CMD_GET_BUILD_INFO" }, { 0x05, "EC_CMD_GET_CHIP_INFO" }, { 0x06, "EC_CMD_GET_BOARD_VERSION" }, diff --git a/include/ec_commands.h b/include/ec_commands.h index acb502ca99..ebabf1f304 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -1253,27 +1253,9 @@ struct ec_response_get_version_v1 { char cros_fwid_rw[32]; /* Added in version 1 */ } __ec_align4; -/* Read test */ +/* Read test - DEPRECATED */ #define EC_CMD_READ_TEST 0x0003 -/** - * struct ec_params_read_test - Parameters for the read test command. - * @offset: Starting value for read buffer. - * @size: Size to read in bytes. - */ -struct ec_params_read_test { - uint32_t offset; - uint32_t size; -} __ec_align4; - -/** - * struct ec_response_read_test - Response to the read test command. - * @data: Data returned by the read test command. - */ -struct ec_response_read_test { - uint32_t data[32]; -} __ec_align4; - /* * Get build information * diff --git a/util/ectool.cc b/util/ectool.cc index c116b35fcc..844fa15ac6 100644 --- a/util/ectool.cc +++ b/util/ectool.cc @@ -273,8 +273,6 @@ const char help_str[] = " Set 16 bit duty cycle of given PWM\n" " rand <num_bytes>\n" " generate <num_bytes> of random numbers\n" - " readtest <patternoffset> <size>\n" - " Reads a pattern from the EC via LPC\n" " reboot_ec <RO|RW|cold|hibernate|hibernate-clear-ap-off|disable-jump|cold-ap-off>" " [at-shutdown|switch-slot]\n" " Reboot EC to RO or RW\n" @@ -1228,70 +1226,6 @@ exit: return rv; } -int cmd_read_test(int argc, char *argv[]) -{ - struct ec_params_read_test p; - struct ec_response_read_test r; - int offset, size; - int errors = 0; - int rv; - int i; - char *e; - char *buf; - uint32_t *b; - - if (argc < 3) { - fprintf(stderr, "Usage: %s <pattern_offset> <size>\n", argv[0]); - return -1; - } - offset = strtol(argv[1], &e, 0); - size = strtol(argv[2], &e, 0); - if ((e && *e) || size <= 0 || size > MAX_FLASH_SIZE) { - fprintf(stderr, "Bad size.\n"); - return -1; - } - printf("Reading %d bytes with pattern offset 0x%x...\n", size, offset); - - buf = (char *)malloc(size); - if (!buf) { - fprintf(stderr, "Unable to allocate buffer.\n"); - return -1; - } - - /* Read data in chunks */ - for (i = 0; i < size; i += sizeof(r.data)) { - p.offset = offset + i / sizeof(uint32_t); - p.size = MIN(size - i, sizeof(r.data)); - rv = ec_command(EC_CMD_READ_TEST, 0, &p, sizeof(p), &r, - sizeof(r)); - if (rv < 0) { - fprintf(stderr, "Read error at offset %d\n", i); - free(buf); - return rv; - } - memcpy(buf + i, r.data, p.size); - } - - /* Check data */ - for (i = 0, b = (uint32_t *)buf; i < size / 4; i++, b++) { - if (*b != i + offset) { - printf("Mismatch at byte offset 0x%x: " - "expected 0x%08x, got 0x%08x\n", - (int)(i * sizeof(uint32_t)), i + offset, *b); - errors++; - } - } - - free(buf); - if (errors) { - printf("Found %d errors\n", errors); - return -1; - } - - printf("done.\n"); - return 0; -} - int cmd_reboot_ec(int argc, char *argv[]) { struct ec_params_reboot_ec p; @@ -11002,7 +10936,6 @@ const struct command commands[] = { { "pwmsetkblight", cmd_pwm_set_keyboard_backlight }, { "pwmsetduty", cmd_pwm_set_duty }, { "rand", cmd_rand }, - { "readtest", cmd_read_test }, { "reboot_ec", cmd_reboot_ec }, { "rgbkbd", cmd_rgbkbd }, { "rollbackinfo", cmd_rollback_info }, |