From bd4012d9abbb7b79f537e7adba9627bcd4a50a72 Mon Sep 17 00:00:00 2001 From: Jett Rink Date: Tue, 16 Apr 2019 12:43:58 -0600 Subject: tasks: convert TASK_EVENT_CUSTOM macro to bit We should ensure that all custom task definition are non-zero and fit with the globally defined events. Add compile time check and change semantics to specify bit number (instead of making all callers use the BIT macro). This also fixes an error with TASK_EVENT_PHY_TX_DONE for ITE being 0. The bug that made that happen hasn't landed on any firmware branches that use it though. BRANCH=none BUG=none TEST=builds Cq-Depend:chrome-internal:1178968,chrome-internal:1178952 Change-Id: I5e1d1312382d200280c548e9128e53f4eddd3e61 Signed-off-by: Jett Rink Reviewed-on: https://chromium-review.googlesource.com/1570607 Commit-Ready: ChromeOS CL Exonerator Bot --- common/fpsensor.c | 4 ++-- common/host_command.c | 2 +- common/host_command_pd.c | 4 ++-- common/lightbar.c | 2 +- common/rwsig.c | 4 ++-- common/tpm_registers.c | 6 +++--- 6 files changed, 11 insertions(+), 11 deletions(-) (limited to 'common') diff --git a/common/fpsensor.c b/common/fpsensor.c index d30d13ca40..703c1f0984 100644 --- a/common/fpsensor.c +++ b/common/fpsensor.c @@ -89,8 +89,8 @@ static int fp_tpm_seed_is_set; #endif /* Events for the FPSENSOR task */ -#define TASK_EVENT_SENSOR_IRQ TASK_EVENT_CUSTOM(1) -#define TASK_EVENT_UPDATE_CONFIG TASK_EVENT_CUSTOM(2) +#define TASK_EVENT_SENSOR_IRQ TASK_EVENT_CUSTOM_BIT(0) +#define TASK_EVENT_UPDATE_CONFIG TASK_EVENT_CUSTOM_BIT(1) #define FP_MODE_ANY_CAPTURE (FP_MODE_CAPTURE | FP_MODE_ENROLL_IMAGE | \ FP_MODE_MATCH) diff --git a/common/host_command.c b/common/host_command.c index cad9fd94a9..2be24277ac 100644 --- a/common/host_command.c +++ b/common/host_command.c @@ -23,7 +23,7 @@ #define CPRINTF(format, args...) cprintf(CC_HOSTCMD, format, ## args) #define CPRINTS(format, args...) cprints(CC_HOSTCMD, format, ## args) -#define TASK_EVENT_CMD_PENDING TASK_EVENT_CUSTOM(1) +#define TASK_EVENT_CMD_PENDING TASK_EVENT_CUSTOM_BIT(0) /* Maximum delay to skip printing repeated host command debug output */ #define HCDEBUG_MAX_REPEAT_DELAY (50 * MSEC) diff --git a/common/host_command_pd.c b/common/host_command_pd.c index a21ee33b94..fbb4b8c9df 100644 --- a/common/host_command_pd.c +++ b/common/host_command_pd.c @@ -22,8 +22,8 @@ #define CPRINTS(format, args...) cprints(CC_PD_HOST_CMD, format, ## args) -#define TASK_EVENT_EXCHANGE_PD_STATUS TASK_EVENT_CUSTOM(1) -#define TASK_EVENT_HIBERNATING TASK_EVENT_CUSTOM(2) +#define TASK_EVENT_EXCHANGE_PD_STATUS TASK_EVENT_CUSTOM_BIT(0) +#define TASK_EVENT_HIBERNATING TASK_EVENT_CUSTOM_BIT(1) /* Define local option for if we are a TCPM with an off chip TCPC */ #if defined(CONFIG_USB_POWER_DELIVERY) && !defined(CONFIG_USB_PD_TCPM_STUB) diff --git a/common/lightbar.c b/common/lightbar.c index 11fe41a5aa..bbce184c95 100644 --- a/common/lightbar.c +++ b/common/lightbar.c @@ -418,7 +418,7 @@ static inline int cycle_010(uint8_t i) * the latest one. */ static uint32_t pending_msg; /* And here's the task event that we use to trigger delivery. */ -#define PENDING_MSG TASK_EVENT_CUSTOM(BIT(0)) +#define PENDING_MSG TASK_EVENT_CUSTOM_BIT(0) /* Interruptible delay. */ #define WAIT_OR_RET(A) \ diff --git a/common/rwsig.c b/common/rwsig.c index 0e19f06914..0170884937 100644 --- a/common/rwsig.c +++ b/common/rwsig.c @@ -241,8 +241,8 @@ out: } #ifdef HAS_TASK_RWSIG -#define TASK_EVENT_ABORT TASK_EVENT_CUSTOM(1) -#define TASK_EVENT_CONTINUE TASK_EVENT_CUSTOM(2) +#define TASK_EVENT_ABORT TASK_EVENT_CUSTOM_BIT(0) +#define TASK_EVENT_CONTINUE TASK_EVENT_CUSTOM_BIT(1) static enum rwsig_status rwsig_status; diff --git a/common/tpm_registers.c b/common/tpm_registers.c index 947a3b089a..6a0e7e6ac7 100644 --- a/common/tpm_registers.c +++ b/common/tpm_registers.c @@ -675,9 +675,9 @@ static void call_extension_command(struct tpm_cmd_header *tpmh, * Events used on the TPM task context. Make sure there is no collision with * event(s) defined in chip/g/dcrypto/dcrypto_runtime.c */ -#define TPM_EVENT_RESET TASK_EVENT_CUSTOM(BIT(1)) -#define TPM_EVENT_COMMIT TASK_EVENT_CUSTOM(BIT(2)) -#define TPM_EVENT_ALT_EXTENSION TASK_EVENT_CUSTOM(BIT(3)) +#define TPM_EVENT_RESET TASK_EVENT_CUSTOM_BIT(1) +#define TPM_EVENT_COMMIT TASK_EVENT_CUSTOM_BIT(2) +#define TPM_EVENT_ALT_EXTENSION TASK_EVENT_CUSTOM_BIT(3) /* * Result of executing of the TPM command on the alternative path, could have -- cgit v1.2.1