From a1ca00d1574bf8eba48fd118dada4d7914bef8d1 Mon Sep 17 00:00:00 2001 From: Carl Hamilton Date: Tue, 10 Jan 2017 08:20:53 -0800 Subject: [PATCH] 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 Tested-by: Carl Hamilton Reviewed-by: Randall Spangler Reviewed-by: Shawn N --- include/ec_commands.h | 7 +++++++ include/host_command.h | 15 ++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/include/ec_commands.h b/include/ec_commands.h index 6ea1a74c15..b63ae327fd 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -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 diff --git a/include/host_command.h b/include/host_command.h index 101e73c693..acaa2a4f6b 100644 --- a/include/host_command.h +++ b/include/host_command.h @@ -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 /**