summaryrefslogtreecommitdiff
path: root/common/tpm_registers.c
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2019-03-11 15:57:52 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-03-26 04:42:55 -0700
commitbb266fc26fc05d4ab22de6ad7bce5b477c9f9140 (patch)
treef6ada087f62246c3a9547e649ac8846b0ed6d5ab /common/tpm_registers.c
parent0bfc511527cf2aebfa163c63a1d028419ca0b0c3 (diff)
downloadchrome-ec-bb266fc26fc05d4ab22de6ad7bce5b477c9f9140.tar.gz
common: replace 1 << digits, with BIT(digits)
Requested for linux integration, use BIT instead of 1 << First step replace bit operation with operand containing only digits. Fix an error in motion_lid try to set bit 31 of a signed integer. BUG=None BRANCH=None TEST=compile Change-Id: Ie843611f2f68e241f0f40d4067f7ade726951d29 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1518659 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'common/tpm_registers.c')
-rw-r--r--common/tpm_registers.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/common/tpm_registers.c b/common/tpm_registers.c
index 823f9c7513..fe6ffffc75 100644
--- a/common/tpm_registers.c
+++ b/common/tpm_registers.c
@@ -118,27 +118,27 @@ static struct {
/* Bit definitions for some TPM registers. */
enum tpm_access_bits {
- tpm_reg_valid_sts = (1 << 7),
- active_locality = (1 << 5),
- request_use = (1 << 1),
- tpm_establishment = (1 << 0),
+ tpm_reg_valid_sts = BIT(7),
+ active_locality = BIT(5),
+ request_use = BIT(1),
+ tpm_establishment = BIT(0),
};
enum tpm_sts_bits {
tpm_family_shift = 26,
- tpm_family_mask = ((1 << 2) - 1), /* 2 bits wide */
+ tpm_family_mask = (BIT(2) - 1), /* 2 bits wide */
tpm_family_tpm2 = 1,
- reset_establishment_bit = (1 << 25),
- command_cancel = (1 << 24),
+ reset_establishment_bit = BIT(25),
+ command_cancel = BIT(24),
burst_count_shift = 8,
- burst_count_mask = ((1 << 16) - 1), /* 16 bits wide */
- sts_valid = (1 << 7),
- command_ready = (1 << 6),
- tpm_go = (1 << 5),
- data_avail = (1 << 4),
- expect = (1 << 3),
- self_test_done = (1 << 2),
- response_retry = (1 << 1),
+ burst_count_mask = (BIT(16) - 1), /* 16 bits wide */
+ sts_valid = BIT(7),
+ command_ready = BIT(6),
+ tpm_go = BIT(5),
+ data_avail = BIT(4),
+ expect = BIT(3),
+ self_test_done = BIT(2),
+ response_retry = BIT(1),
};
/* Used to count bytes read in version string */
@@ -676,9 +676,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(1 << 1)
-#define TPM_EVENT_COMMIT TASK_EVENT_CUSTOM(1 << 2)
-#define TPM_EVENT_ALT_EXTENSION TASK_EVENT_CUSTOM(1 << 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