summaryrefslogtreecommitdiff
path: root/util/comm-lpc.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-07-11 16:08:15 -0700
committerRandall Spangler <rspangler@chromium.org>2012-07-12 14:48:50 -0700
commitc171fbe3dcc2c9982b7de5ff7d2b5df6dcee542c (patch)
tree55b7960053545e341a689a27d9315c7ef2be1a08 /util/comm-lpc.c
parent02f0ad7ea8b955d456e1e692e6e6e1a7199f2de1 (diff)
downloadchrome-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/comm-lpc.c')
-rw-r--r--util/comm-lpc.c27
1 files changed, 15 insertions, 12 deletions
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;