diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2015-03-27 10:06:01 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-03-28 00:58:06 +0000 |
commit | fe293908edbac37396d1c205dde7ba1a9adff011 (patch) | |
tree | 45844875c136fa6d18109a1009f992ed81f05f06 | |
parent | bf931b2cced0fac2f2810999ac672a3344b0849b (diff) | |
download | chrome-ec-fe293908edbac37396d1c205dde7ba1a9adff011.tar.gz |
ectool: Revert: Do not increase buffer size after probe max size from ec
Not needed with kernel fix:
Commands are currenly limited to 252 bytes. Even if EC support protocol
v3, ectool would only limit the command sizes, never go beyond 252
bytes.
This reverts commit be0bd9b83538427cc350ad38d64b821dfcad82a0.
It also remove a TODO.
CQ-DEPEND=CL:262870
TEST=With proper kernel, and firmware supporting commands > 252 bytes,
check that ectool console does not crash anymore.
/usr/sbin/ectool --name cros_sh console
returns more character than before.
Check ectool version as well.
/usr/sbin/ectool --name cros_sh version
BUG=chromium:399057,chromium:454324,chrome-os-partner:31989,chrome-os-partner:23823
BRANCH=none
Change-Id: I058ab0e6df96196a0fae186d1ffedcfa16e5dc3b
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/262885
Reviewed-by: Puthikorn Voravootivat <puthik@chromium.org>
-rw-r--r-- | util/comm-dev.c | 6 | ||||
-rw-r--r-- | util/comm-host.c | 22 |
2 files changed, 7 insertions, 21 deletions
diff --git a/util/comm-dev.c b/util/comm-dev.c index cdbbbdf48e..4fdef31cb5 100644 --- a/util/comm-dev.c +++ b/util/comm-dev.c @@ -144,11 +144,7 @@ int comm_init_dev(const char *device_name) ec_readmem = ec_readmem_dev; /* - * TODO(crosbug.com/p/23823): Need a way to get this from the driver - * and EC. For now, pick a magic lowest common denominator value. The - * ec_max_outsize is set to handle v3 EC protocol. The ec_max_insize - * needs to be set to the largest value that can be returned from the - * EC, EC_PROTO2_MAX_PARAM_SIZE. + * Set temporary size, will be updated later. */ ec_max_outsize = EC_PROTO2_MAX_PARAM_SIZE - 8; ec_max_insize = EC_PROTO2_MAX_PARAM_SIZE; diff --git a/util/comm-host.c b/util/comm-host.c index b5cd51adfe..7da86316fb 100644 --- a/util/comm-host.c +++ b/util/comm-host.c @@ -78,7 +78,6 @@ int ec_command(int command, int version, int comm_init(int interfaces, const char *device_name) { struct ec_response_get_protocol_info info; - int new_size; /* Default memmap access */ ec_readmem = fake_readmem; @@ -109,25 +108,16 @@ int comm_init(int interfaces, const char *device_name) return 1; } - /* - * read max request / response size from ec and reduce buffer size - * if the size supported by ec is less than the default value. - */ + /* read max request / response size from ec for protocol v3+ */ if (ec_command(EC_CMD_GET_PROTOCOL_INFO, 0, NULL, 0, &info, sizeof(info)) == sizeof(info)) { - new_size = info.max_request_packet_size - - sizeof(struct ec_host_request); - if (ec_max_outsize > new_size) { - ec_max_outsize = new_size; - ec_outbuf = realloc(ec_outbuf, ec_max_outsize); - } - new_size = info.max_response_packet_size - + ec_max_outsize = info.max_request_packet_size - + sizeof(struct ec_host_request); + ec_max_insize = info.max_response_packet_size - sizeof(struct ec_host_response); - if (ec_max_insize > new_size) { - ec_max_insize = new_size; - ec_inbuf = realloc(ec_inbuf, ec_max_insize); - } + ec_outbuf = realloc(ec_outbuf, ec_max_outsize); + ec_inbuf = realloc(ec_inbuf, ec_max_insize); if (!ec_outbuf || !ec_inbuf) { fprintf(stderr, "Unable to reallocate buffers\n"); |