ec: Minor cleanup of private host command macros.

* Rename PRIVATE_HOST_COMMAND_VALUE to EC_PRIVATE_HOST_COMMAND_VALUE to
  make it clear it is part of EC and reduce the likelihood of collisions.

* Move PRIVATE_HOST_COMMAND_VALUE macro to ec_commands.h. This reduces the
  transitive dependencies required to determine the value of a private host
  command. This is beneficial for code outside of the ChromiumOS build
  environment that needs to send private commands to an EC.

* Define DECLARE_PRIVATE_HOST_COMMAND when there is no host command task.
  This will prevent builds with private commands from failing when the host
  command task is not configured.

BUG=chromium:570895
BRANCH=none
TEST=make -j buildall

Change-Id: Iad938cb6a1521b65e4f893439d592ef375caace9
Reviewed-on: https://chromium-review.googlesource.com/426737
Commit-Ready: Carl Hamilton <carlh@chromium.org>
Tested-by: Carl Hamilton <carlh@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
This commit is contained in:
Carl Hamilton
2017-01-10 08:20:53 -08:00
committed by chrome-bot
parent dabc580d7e
commit a1ca00d157
2 changed files with 13 additions and 9 deletions

View File

@@ -4022,6 +4022,13 @@ struct __ec_align1 ec_response_usb_pd_mux_info {
#define EC_CMD_BOARD_SPECIFIC_BASE 0x3E00
#define EC_CMD_BOARD_SPECIFIC_LAST 0x3FFF
/*
* Given the private host command offset, calculate the true private host
* command value.
*/
#define EC_PRIVATE_HOST_COMMAND_VALUE(command) \
(EC_CMD_BOARD_SPECIFIC_BASE + (command))
/*****************************************************************************/
/*
* Passthru commands

View File

@@ -218,18 +218,15 @@ void host_packet_receive(struct host_packet *pkt);
EXPAND(EC_CMD_BOARD_SPECIFIC_BASE, command) \
__attribute__((section(".rodata.hcmds."\
EXPANDSTR(EC_CMD_BOARD_SPECIFIC_BASE, command)))) \
= {routine, EC_CMD_BOARD_SPECIFIC_BASE + command, version_mask}
/*
* Given the private host command offset, calculate
* the true private host command value.
*/
#define PRIVATE_HOST_COMMAND_VALUE(command) \
(EC_CMD_BOARD_SPECIFIC_BASE + command)
= {routine, EC_PRIVATE_HOST_COMMAND_VALUE(command), \
version_mask}
#else
#define DECLARE_HOST_COMMAND(command, routine, version_mask) \
int (routine)(struct host_cmd_handler_args *args) \
__attribute__((unused))
__attribute__((unused))
#define DECLARE_PRIVATE_HOST_COMMAND(command, routine, version_mask) \
DECLARE_HOST_COMMAND(command, routine, version_mask)
#endif
/**