From c171fbe3dcc2c9982b7de5ff7d2b5df6dcee542c Mon Sep 17 00:00:00 2001 From: Randall Spangler Date: Wed, 11 Jul 2012 16:08:15 -0700 Subject: 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 Reviewed-on: https://gerrit.chromium.org/gerrit/27226 --- util/comm-lpc.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'util/comm-lpc.c') 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; -- cgit v1.2.1