summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2013-04-11 10:01:38 -0700
committerChromeBot <chrome-bot@google.com>2013-04-11 11:29:38 -0700
commit08f8c6857f28a71ca549a9d490717a6d44517c75 (patch)
tree17b243a454aa840e0dcbaf2a2ecf4a51d4a5ca46
parent4adcb45f2c067292b470a1c9506968e8cf7ac23a (diff)
downloadchrome-ec-08f8c6857f28a71ca549a9d490717a6d44517c75.tar.gz
Strip out old LPC command protocol
Nothing has used this since link EVT, so it's just dead code at this point. BUG=chrome-os-partner:13213 BRANCH=none TEST=manual - Update ectool but leave old firmware - ectool version -> works - ectool flashread 0 0x10000 foo -> puts the first 64KB of EC flash into foo - Update firmware - ectool version -> works - ectool flashread 0 0x10000 foo -> puts the first 64KB of EC flash into foo - power+esc+refresh -> recovery mode Change-Id: Ib25a705bcd8280d5295c8e7890969d796542b6c9 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47866 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r--chip/lm4/lpc.c56
-rw-r--r--include/ec_commands.h4
-rw-r--r--util/burn_my_ec.c4
-rw-r--r--util/comm-lpc.c80
-rw-r--r--util/ectool.c2
5 files changed, 33 insertions, 113 deletions
diff --git a/chip/lm4/lpc.c b/chip/lm4/lpc.c
index 86b6c34cd7..fa221fd71e 100644
--- a/chip/lm4/lpc.c
+++ b/chip/lm4/lpc.c
@@ -43,8 +43,6 @@ static int init_done;
static uint8_t * const cmd_params = (uint8_t *)LPC_POOL_CMD_DATA +
EC_LPC_ADDR_HOST_PARAM - EC_LPC_ADDR_HOST_ARGS;
-static uint8_t * const old_params = (uint8_t *)LPC_POOL_CMD_DATA +
- EC_LPC_ADDR_OLD_PARAM - EC_LPC_ADDR_HOST_ARGS;
static struct ec_lpc_host_args * const lpc_host_args =
(struct ec_lpc_host_args *)LPC_POOL_CMD_DATA;
@@ -145,7 +143,8 @@ static void lpc_send_response(struct host_cmd_handler_args *args)
{
uint8_t *out;
int size = args->response_size;
- int max_size;
+ int csum;
+ int i;
/* Ignore in-progress on LPC since interface is synchronous anyway */
if (args->result == EC_RES_IN_PROGRESS)
@@ -157,41 +156,27 @@ static void lpc_send_response(struct host_cmd_handler_args *args)
size = 0;
}
- if (args->flags & EC_HOST_ARGS_FLAG_FROM_HOST) {
- /* New-style response */
- int csum;
- int i;
-
- lpc_host_args->flags =
- (args->flags & ~EC_HOST_ARGS_FLAG_FROM_HOST) |
- EC_HOST_ARGS_FLAG_TO_HOST;
-
- lpc_host_args->data_size = size;
+ /* New-style response */
+ lpc_host_args->flags =
+ (args->flags & ~EC_HOST_ARGS_FLAG_FROM_HOST) |
+ EC_HOST_ARGS_FLAG_TO_HOST;
- csum = args->command + lpc_host_args->flags +
- lpc_host_args->command_version +
- lpc_host_args->data_size;
+ lpc_host_args->data_size = size;
- for (i = 0, out = (uint8_t *)args->response; i < size;
- i++, out++)
- csum += *out;
+ csum = args->command + lpc_host_args->flags +
+ lpc_host_args->command_version +
+ lpc_host_args->data_size;
- lpc_host_args->checksum = (uint8_t)csum;
+ for (i = 0, out = (uint8_t *)args->response; i < size; i++, out++)
+ csum += *out;
- out = cmd_params;
- max_size = EC_HOST_PARAM_SIZE;
- } else {
- /* Old-style response */
- lpc_host_args->flags = 0;
- out = old_params;
- max_size = EC_OLD_PARAM_SIZE;
- }
+ lpc_host_args->checksum = (uint8_t)csum;
/* Fail if response doesn't fit in the param buffer */
- if (size > max_size)
+ if (size > EC_HOST_PARAM_SIZE)
args->result = EC_RES_INVALID_RESPONSE;
- else if (host_cmd_args.response != out)
- memcpy(out, args->response, size);
+ else if (host_cmd_args.response != cmd_params)
+ memcpy(cmd_params, args->response, size);
/*
* Write result to the data byte. This sets the TOH bit in the
@@ -510,13 +495,8 @@ static void handle_host_write(int is_cmd)
host_cmd_args.result = EC_RES_INVALID_CHECKSUM;
}
} else {
- /* Old style command */
- host_cmd_args.version = 0;
- host_cmd_args.params = old_params;
- host_cmd_args.params_size = EC_OLD_PARAM_SIZE;
- host_cmd_args.response = old_params;
- host_cmd_args.response_max = EC_OLD_PARAM_SIZE;
- host_cmd_args.response_size = 0;
+ /* Old style command, now unsupported */
+ host_cmd_args.result = EC_RES_INVALID_COMMAND;
}
/* Hand off to host command handler */
diff --git a/include/ec_commands.h b/include/ec_commands.h
index caa0bcd3ee..a8944cb719 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -46,10 +46,6 @@
#define EC_LPC_ADDR_HOST_PARAM 0x804
#define EC_HOST_PARAM_SIZE 0x0fc /* Size of param area in bytes */
-/* I/O addresses for host command params, old interface */
-#define EC_LPC_ADDR_OLD_PARAM 0x880
-#define EC_OLD_PARAM_SIZE 0x080 /* Size of param area in bytes */
-
/* EC command register bit functions */
#define EC_LPC_CMDR_DATA (1 << 0) /* Data ready for host to read */
#define EC_LPC_CMDR_PENDING (1 << 1) /* Write pending to EC */
diff --git a/util/burn_my_ec.c b/util/burn_my_ec.c
index 35de5b04ec..337abf7e96 100644
--- a/util/burn_my_ec.c
+++ b/util/burn_my_ec.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -57,7 +57,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_OLD_PARAM_SIZE];
+ uint8_t rd_resp[EC_HOST_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 23c92e3b22..dbae5a7ecc 100644
--- a/util/comm-lpc.c
+++ b/util/comm-lpc.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -14,8 +14,6 @@
#define INITIAL_UDELAY 5 /* 5 us */
#define MAXIMUM_UDELAY 10000 /* 10 ms */
-static int lpc_cmd_args_supported;
-
int comm_init(void)
{
int i;
@@ -38,13 +36,13 @@ int comm_init(void)
*/
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);
+ for (i = 0; i < EC_HOST_PARAM_SIZE && byte == 0xff; ++i)
+ byte &= inb(EC_LPC_ADDR_HOST_PARAM + i);
if (byte == 0xff) {
fprintf(stderr, "Port 0x%x,0x%x,0x%x-0x%x are all 0xFF.\n",
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);
+ EC_LPC_ADDR_HOST_PARAM,
+ EC_LPC_ADDR_HOST_PARAM + EC_HOST_PARAM_SIZE - 1);
fprintf(stderr,
"Very likely this board doesn't have a Chromium EC.\n");
return -4;
@@ -58,11 +56,13 @@ int comm_init(void)
* seeing whether the EC sets the EC_HOST_ARGS_FLAG_FROM_HOST flag
* in args when it responds.
*/
- if (inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_ID) == 'E' &&
- inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_ID + 1) == 'C' &&
- (inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_HOST_CMD_FLAGS) &
- EC_HOST_CMD_FLAG_LPC_ARGS_SUPPORTED))
- lpc_cmd_args_supported = 1;
+ if (inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_ID) != 'E' ||
+ inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_ID + 1) != 'C' ||
+ !(inb(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_HOST_CMD_FLAGS) &
+ EC_HOST_CMD_FLAG_LPC_ARGS_SUPPORTED)) {
+ fprintf(stderr, "EC doesn't support command args.\n");
+ return -5;
+ }
return 0;
}
@@ -97,57 +97,6 @@ static int wait_for_ec(int status_addr, int timeout_usec)
return -1; /* Timeout */
}
-/* Old-style command interface, without args */
-static int ec_command_old(int command, const void *indata, int insize,
- void *outdata, int outsize) {
- uint8_t *d;
- int i;
-
- 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(EC_LPC_ADDR_HOST_CMD, 1000000)) {
- fprintf(stderr, "Timeout waiting for EC ready\n");
- return -EC_RES_ERROR;
- }
-
- /* Write data, if any */
- /* TODO: optimized copy using outl() */
- for (i = 0, d = (uint8_t *)indata; i < insize; i++, d++)
- outb(*d, EC_LPC_ADDR_OLD_PARAM + i);
-
- outb(command, EC_LPC_ADDR_HOST_CMD);
-
- if (wait_for_ec(EC_LPC_ADDR_HOST_CMD, 1000000)) {
- fprintf(stderr, "Timeout waiting for EC response\n");
- return -EC_RES_ERROR;
- }
-
- /* Check result */
- i = inb(EC_LPC_ADDR_HOST_DATA);
- if (i) {
- fprintf(stderr, "EC returned error result code %d\n", i);
- return -i;
- }
-
- /* Read data, if any */
- /* TODO: optimized copy using outl() */
- for (i = 0, d = (uint8_t *)outdata; i < outsize; i++, d++)
- *d = inb(EC_LPC_ADDR_OLD_PARAM + i);
-
- /*
- * LPC protocol doesn't have a way to communicate the true output
- * size, so assume we got everything we asked for.
- */
- return outsize;
-}
-
int ec_command(int command, int version, const void *indata, int insize,
void *outdata, int outsize) {
@@ -157,11 +106,6 @@ int ec_command(int command, int version, const void *indata, int insize,
int csum;
int i;
- /* Fall back to old-style command interface if args aren't supported */
- if (!lpc_cmd_args_supported)
- return ec_command_old(command, indata, insize,
- outdata, outsize);
-
/* Fill in args */
args.flags = EC_HOST_ARGS_FLAG_FROM_HOST;
args.command_version = version;
diff --git a/util/ectool.c b/util/ectool.c
index 09166b4ae3..b1115aefcd 100644
--- a/util/ectool.c
+++ b/util/ectool.c
@@ -478,7 +478,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_OLD_PARAM_SIZE];
+ uint8_t rdata[EC_HOST_PARAM_SIZE];
int offset, size;
int rv;
int i;