summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMulin Chao <mlchao@nuvoton.com>2016-12-20 11:43:42 +0800
committerchrome-bot <chrome-bot@chromium.org>2016-12-20 21:55:56 -0800
commit68ce71d642e7c8fa612b03799a91e3982e8c9854 (patch)
tree0cd9848ebe88192f003da02c68a2c511ac09a03c
parent38282956e06a13a7e0371907bd43e8a22c44ae4c (diff)
downloadchrome-ec-68ce71d642e7c8fa612b03799a91e3982e8c9854.tar.gz
npcx: lpc: Remove unsupport old-style host command.
Since ec doesn't support old-style host command, this CL removes unsupported parts in npcx's lpc driver and lets the hand-shaking mechanism between host and ec as easy as possible. It makes sure only following conditions that ec can clear processing bit of host command. 1. Received LRESET signal. 2. In lpc_init() initialization function caused by sysjump. 3. If command is valid, it will be cleared in lpc_send_response_packet() called by host command task. 4. If command is invalid, it will be cleared in lpc_send_response() after the response package is ready. BRANCH=none BUG=chrome-os-partner:34346 TEST=make BOARD=wheatley; do stress test on wheatley. Change-Id: I53d17fd9e09b7fb080e4bf71437392bf43db6258 Signed-off-by: Mulin Chao <mlchao@nuvoton.com> Reviewed-on: https://chromium-review.googlesource.com/422707 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--chip/npcx/lpc.c45
1 files changed, 1 insertions, 44 deletions
diff --git a/chip/npcx/lpc.c b/chip/npcx/lpc.c
index 3a916356f8..547e662818 100644
--- a/chip/npcx/lpc.c
+++ b/chip/npcx/lpc.c
@@ -518,52 +518,9 @@ static void handle_host_write(int is_cmd)
host_packet_receive(&lpc_packet);
return;
- } else if (host_cmd_flags & EC_HOST_ARGS_FLAG_FROM_HOST) {
- /* Version 2 (link) style command */
- int size = lpc_host_args->data_size;
- int csum, i;
-
- /* Clear processing flag */
- CLEAR_BIT(NPCX_HIPMST(PMC_HOST_CMD), NPCX_HIPMST_F0);
-
- host_cmd_args.version = lpc_host_args->command_version;
- host_cmd_args.params = params_copy;
- host_cmd_args.params_size = size;
- host_cmd_args.response = cmd_params;
- host_cmd_args.response_max = EC_PROTO2_MAX_PARAM_SIZE;
- host_cmd_args.response_size = 0;
-
- /* Verify params size */
- if (size > EC_PROTO2_MAX_PARAM_SIZE) {
- host_cmd_args.result = EC_RES_INVALID_PARAM;
- } else {
- const uint8_t *src = cmd_params;
- uint8_t *copy = params_copy;
-
- /*
- * Verify checksum and copy params out of LPC space.
- * This ensures the data acted on by the host command
- * handler can't be changed by host writes after the
- * checksum is verified.
- */
- csum = host_cmd_args.command +
- host_cmd_flags +
- host_cmd_args.version +
- host_cmd_args.params_size;
-
- for (i = 0; i < size; i++) {
- csum += *src;
- *(copy++) = *(src++);
- }
-
- if ((uint8_t)csum != lpc_host_args->checksum)
- host_cmd_args.result = EC_RES_INVALID_CHECKSUM;
- }
} else {
/* Old style command, now unsupported */
host_cmd_args.result = EC_RES_INVALID_COMMAND;
- /* Clear processing flag */
- CLEAR_BIT(NPCX_HIPMST(PMC_HOST_CMD), NPCX_HIPMST_F0);
}
/* Hand off to host command handler */
@@ -1097,7 +1054,7 @@ static int lpc_get_protocol_info(struct host_cmd_handler_args *args)
struct ec_response_get_protocol_info *r = args->response;
memset(r, 0, sizeof(*r));
- r->protocol_versions = (1 << 2) | (1 << 3);
+ r->protocol_versions = (1 << 3);
r->max_request_packet_size = EC_LPC_HOST_PACKET_SIZE;
r->max_response_packet_size = EC_LPC_HOST_PACKET_SIZE;
r->flags = 0;