From 0ecfe96c7e6473bbf40f868f014e5aaec96e81d7 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 15 Aug 2012 13:47:17 -0700 Subject: 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 Reviewed-on: https://gerrit.chromium.org/gerrit/30468 Reviewed-by: David Hendricks Reviewed-by: Randall Spangler --- common/host_command.c | 9 +++++++-- common/system_common.c | 2 +- include/host_command.h | 10 ++++++++++ 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 @@ -113,6 +113,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. */ -- cgit v1.2.1