summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2012-08-15 13:47:17 -0700
committerGerrit <chrome-bot@google.com>2012-08-16 12:44:02 -0700
commit0ecfe96c7e6473bbf40f868f014e5aaec96e81d7 (patch)
tree61a0a56fbd2f5c0aaace0ffa3245851b0abad5f6
parentcd55d3afaf5317eeec099338b7e79f5a1c78aa84 (diff)
downloadchrome-ec-0ecfe96c7e6473bbf40f868f014e5aaec96e81d7.tar.gz
host_command: Add host_send_response() to send responses
Rather than have the send_response() handler called willy nilly from around the EC code, provide an official function for doing this step. BUG=chrome-os-partner:12685 BRANCH=snow,link TEST=manual build and boot to kernel on snow Tried 'mkbp reset' command on snow but it did not seem to work properly Unable to test on link at present Change-Id: I8d9146639efb2af482d80563b403771cee961942 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/30468 Reviewed-by: David Hendricks <dhendrix@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--common/host_command.c9
-rw-r--r--common/system_common.c2
-rw-r--r--include/host_command.h10
3 files changed, 18 insertions, 3 deletions
diff --git a/common/host_command.c b/common/host_command.c
index 088f8e8521..c7fabeef3f 100644
--- a/common/host_command.c
+++ b/common/host_command.c
@@ -39,6 +39,11 @@ uint8_t *host_get_memmap(int offset)
#endif
}
+void host_send_response(struct host_cmd_handler_args *args)
+{
+ args->send_response(args);
+}
+
void host_command_received(struct host_cmd_handler_args *args)
{
/* TODO: should warn if we already think we're in a command */
@@ -56,7 +61,7 @@ void host_command_received(struct host_cmd_handler_args *args)
/* If the driver has signalled an error, send the response now */
if (args->result) {
- args->send_response(args);
+ host_send_response(args);
} else {
/* Save the command */
pending_args = args;
@@ -237,7 +242,7 @@ void host_command_task(void)
if ((evt & TASK_EVENT_CMD_PENDING) && pending_args) {
pending_args->result =
host_command_process(pending_args);
- pending_args->send_response(pending_args);
+ host_send_response(pending_args);
}
}
}
diff --git a/common/system_common.c b/common/system_common.c
index e2dcddc342..60bb888726 100644
--- a/common/system_common.c
+++ b/common/system_common.c
@@ -829,7 +829,7 @@ int host_command_reboot(struct host_cmd_handler_args *args)
#ifdef CONFIG_TASK_HOSTCMD
/* Clean busy bits on host */
args->result = EC_RES_SUCCESS;
- args->send_response(args);
+ host_send_response(args);
#endif
CPRINTF("[%T Executing host reboot command %d]\n", p.cmd);
diff --git a/include/host_command.h b/include/host_command.h
index 5313277cab..6218d17ebc 100644
--- a/include/host_command.h
+++ b/include/host_command.h
@@ -114,6 +114,16 @@ void host_clear_events(uint32_t mask);
uint32_t host_get_events(void);
/**
+ * Send a response to the relevent driver for transmission
+ *
+ * Once command processing is complete, this is used to send a response
+ * back to the host.
+ *
+ * @param args Contains response to send
+ */
+void host_send_response(struct host_cmd_handler_args *args);
+
+/**
* Called by host interface module when a command is received.
*/
void host_command_received(struct host_cmd_handler_args *args);