From 87d3707f62c14376f9c5013e455544bf32d0fb33 Mon Sep 17 00:00:00 2001 From: Vincent Palatin Date: Thu, 10 May 2012 22:47:11 +0000 Subject: Slightly update the host commands API Preparatory work to use common host command code between ARM and x86. Every command sends back explicitly the size of the response payload. The size of the response defaults to 0 ond can be updated. Add a protocol version number returned as command 0x00 to help with backward compatibility. move a couple of function from lpc specific header to host commands to be able to implement them for the I2C link. Signed-off-by: Vincent Palatin BUG=chrome-os-partner:9614 TEST=make BOARD=link Change-Id: I6a28edf02996ddf6b7f32a3831d07d5f0271848f --- common/host_event_commands.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'common/host_event_commands.c') diff --git a/common/host_event_commands.c b/common/host_event_commands.c index 3590966fd2..d009d5df65 100644 --- a/common/host_event_commands.c +++ b/common/host_event_commands.c @@ -60,43 +60,46 @@ DECLARE_CONSOLE_COMMAND(hostevent, command_host_event); /*****************************************************************************/ /* Host commands */ -static enum lpc_status host_event_get_smi_mask(uint8_t *data) +static int host_event_get_smi_mask(uint8_t *data, int *resp_size) { struct lpc_response_host_event_mask *r = (struct lpc_response_host_event_mask *)data; r->mask = lpc_get_host_event_mask(LPC_HOST_EVENT_SMI); + *resp_size = sizeof(struct lpc_response_host_event_mask); return EC_LPC_RESULT_SUCCESS; } DECLARE_HOST_COMMAND(EC_LPC_COMMAND_HOST_EVENT_GET_SMI_MASK, host_event_get_smi_mask); -static enum lpc_status host_event_get_sci_mask(uint8_t *data) +static int host_event_get_sci_mask(uint8_t *data, int *resp_size) { struct lpc_response_host_event_mask *r = (struct lpc_response_host_event_mask *)data; r->mask = lpc_get_host_event_mask(LPC_HOST_EVENT_SCI); + *resp_size = sizeof(struct lpc_response_host_event_mask); return EC_LPC_RESULT_SUCCESS; } DECLARE_HOST_COMMAND(EC_LPC_COMMAND_HOST_EVENT_GET_SCI_MASK, host_event_get_sci_mask); -static enum lpc_status host_event_get_wake_mask(uint8_t *data) +static int host_event_get_wake_mask(uint8_t *data, int *resp_size) { struct lpc_response_host_event_mask *r = (struct lpc_response_host_event_mask *)data; r->mask = lpc_get_host_event_mask(LPC_HOST_EVENT_WAKE); + *resp_size = sizeof(struct lpc_response_host_event_mask); return EC_LPC_RESULT_SUCCESS; } DECLARE_HOST_COMMAND(EC_LPC_COMMAND_HOST_EVENT_GET_WAKE_MASK, host_event_get_wake_mask); -static enum lpc_status host_event_set_smi_mask(uint8_t *data) +static int host_event_set_smi_mask(uint8_t *data, int *resp_size) { const struct lpc_params_host_event_mask *p = (const struct lpc_params_host_event_mask *)data; @@ -108,7 +111,7 @@ DECLARE_HOST_COMMAND(EC_LPC_COMMAND_HOST_EVENT_SET_SMI_MASK, host_event_set_smi_mask); -static enum lpc_status host_event_set_sci_mask(uint8_t *data) +static int host_event_set_sci_mask(uint8_t *data, int *resp_size) { const struct lpc_params_host_event_mask *p = (const struct lpc_params_host_event_mask *)data; @@ -120,7 +123,7 @@ DECLARE_HOST_COMMAND(EC_LPC_COMMAND_HOST_EVENT_SET_SCI_MASK, host_event_set_sci_mask); -static enum lpc_status host_event_set_wake_mask(uint8_t *data) +static int host_event_set_wake_mask(uint8_t *data, int *resp_size) { const struct lpc_params_host_event_mask *p = (const struct lpc_params_host_event_mask *)data; @@ -132,7 +135,7 @@ DECLARE_HOST_COMMAND(EC_LPC_COMMAND_HOST_EVENT_SET_WAKE_MASK, host_event_set_wake_mask); -static enum lpc_status host_event_clear(uint8_t *data) +static int host_event_clear(uint8_t *data, int *resp_size) { const struct lpc_params_host_event_mask *p = (const struct lpc_params_host_event_mask *)data; -- cgit v1.2.1