diff options
author | Randall Spangler <rspangler@chromium.org> | 2012-07-11 16:08:15 -0700 |
---|---|---|
committer | Randall Spangler <rspangler@chromium.org> | 2012-07-12 14:48:50 -0700 |
commit | c171fbe3dcc2c9982b7de5ff7d2b5df6dcee542c (patch) | |
tree | 55b7960053545e341a689a27d9315c7ef2be1a08 /util | |
parent | 02f0ad7ea8b955d456e1e692e6e6e1a7199f2de1 (diff) | |
download | chrome-ec-c171fbe3dcc2c9982b7de5ff7d2b5df6dcee542c.tar.gz |
Map 256 bytes of data for host command args/params
And retain compatibility for old requests.
BUG=chrome-os-partner:11275
TEST=from u-boot prompt, 'mkbp hash'
from root shell, 'ectool flashread 0 68084 /tmp/foo'
then compare to first 68084 bytes of ec.bin
Change-Id: Id82068773703543febde79fc820af7486502e01f
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27226
Diffstat (limited to 'util')
-rw-r--r-- | util/burn_my_ec.c | 4 | ||||
-rw-r--r-- | util/comm-lpc.c | 27 | ||||
-rw-r--r-- | util/ectool.c | 6 |
3 files changed, 20 insertions, 17 deletions
diff --git a/util/burn_my_ec.c b/util/burn_my_ec.c index f0b2a569b6..5af1a8e63a 100644 --- a/util/burn_my_ec.c +++ b/util/burn_my_ec.c @@ -20,7 +20,7 @@ static const char * const part_name[] = {"unknown", "RO", "A", "B"}; enum ec_current_image get_version(enum ec_current_image *version_ptr) { struct ec_response_get_version r; - char build_info[EC_PARAM_SIZE]; + char build_info[EC_HOST_PARAM_SIZE]; int res; res = ec_command(EC_CMD_GET_VERSION, NULL, 0, &r, sizeof(r)); @@ -59,7 +59,7 @@ int flash_partition(enum ec_current_image part, const uint8_t *payload, struct ec_params_flash_erase er_req; struct ec_params_flash_write wr_req; struct ec_params_flash_read rd_req; - uint8_t rd_resp[EC_PARAM_SIZE]; + uint8_t rd_resp[EC_OLD_PARAM_SIZE]; int res; uint32_t i; enum ec_current_image current = EC_IMAGE_UNKNOWN; diff --git a/util/comm-lpc.c b/util/comm-lpc.c index d91a8a2cc6..54686dbcbb 100644 --- a/util/comm-lpc.c +++ b/util/comm-lpc.c @@ -34,15 +34,15 @@ int comm_init(void) * byte, since we don't support ACPI burst mode and thus bit 4 should * be 0. */ - byte &= inb(EC_LPC_ADDR_USER_CMD); - byte &= inb(EC_LPC_ADDR_USER_DATA); - for (i = 0; i < EC_PARAM_SIZE && byte == 0xff; ++i) - byte &= inb(EC_LPC_ADDR_USER_PARAM + i); + byte &= inb(EC_LPC_ADDR_HOST_CMD); + byte &= inb(EC_LPC_ADDR_HOST_DATA); + for (i = 0; i < EC_OLD_PARAM_SIZE && byte == 0xff; ++i) + byte &= inb(EC_LPC_ADDR_OLD_PARAM + i); if (byte == 0xff) { fprintf(stderr, "Port 0x%x,0x%x,0x%x-0x%x are all 0xFF.\n", - EC_LPC_ADDR_USER_CMD, EC_LPC_ADDR_USER_DATA, - EC_LPC_ADDR_USER_PARAM, - EC_LPC_ADDR_USER_PARAM + EC_PARAM_SIZE - 1); + EC_LPC_ADDR_HOST_CMD, EC_LPC_ADDR_HOST_DATA, + EC_LPC_ADDR_OLD_PARAM, + EC_LPC_ADDR_OLD_PARAM + EC_OLD_PARAM_SIZE - 1); fprintf(stderr, "Very likely this board doesn't have a Chromium EC.\n"); return -4; @@ -86,16 +86,19 @@ int ec_command(int command, const void *indata, int insize, uint8_t *d; int i; - /* TODO: add command line option to use kernel command/param window */ - int cmd_addr = EC_LPC_ADDR_USER_CMD; - int data_addr = EC_LPC_ADDR_USER_DATA; - int param_addr = EC_LPC_ADDR_USER_PARAM; + int cmd_addr = EC_LPC_ADDR_HOST_CMD; + int data_addr = EC_LPC_ADDR_HOST_DATA; + int param_addr = EC_LPC_ADDR_OLD_PARAM; - if (insize > EC_PARAM_SIZE || outsize > EC_PARAM_SIZE) { + if (insize > EC_OLD_PARAM_SIZE) { fprintf(stderr, "Data size too big\n"); return -EC_RES_ERROR; } + /* Clip output buffer to the size we can actually use */ + if (outsize > EC_OLD_PARAM_SIZE) + outsize = EC_OLD_PARAM_SIZE; + if (wait_for_ec(cmd_addr, 1000000)) { fprintf(stderr, "Timeout waiting for EC ready\n"); return -EC_RES_ERROR; diff --git a/util/ectool.c b/util/ectool.c index 9e3efec836..74ed7d9d70 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -270,7 +270,7 @@ int cmd_version(int argc, char *argv[]) { static const char * const fw_copies[] = {"unknown", "RO", "A", "B"}; struct ec_response_get_version r; - char build_string[EC_PARAM_SIZE]; + char build_string[EC_HOST_PARAM_SIZE]; int rv; rv = ec_command(EC_CMD_GET_VERSION, NULL, 0, &r, sizeof(r)); @@ -432,7 +432,7 @@ int cmd_flash_info(int argc, char *argv[]) int cmd_flash_read(int argc, char *argv[]) { struct ec_params_flash_read p; - uint8_t rdata[EC_PARAM_SIZE]; + uint8_t rdata[EC_OLD_PARAM_SIZE]; int offset, size; int rv; int i; @@ -1166,7 +1166,7 @@ int cmd_pstore_info(int argc, char *argv[]) int cmd_pstore_read(int argc, char *argv[]) { struct ec_params_pstore_read p; - uint8_t rdata[EC_PARAM_SIZE]; + uint8_t rdata[EC_PSTORE_SIZE_MAX]; int offset, size; int rv; int i; |