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>
This commit is contained in:
Simon Glass
2012-08-15 13:47:17 -07:00
committed by Gerrit
parent cd55d3afaf
commit 0ecfe96c7e
3 changed files with 18 additions and 3 deletions

View File

@@ -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);
}
}
}

View File

@@ -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);

View File

@@ -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.
*/