diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-09-24 14:34:28 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-09-24 14:34:28 -0400 |
commit | 1436ab068d6b0309a73849dc239399399621decd (patch) | |
tree | a9ed8e3cb1a7005b68b46a2300d24b0a9fd4d24d | |
parent | cd4175b11685b11c40e31a03e05084cc212b0649 (diff) | |
parent | fb154e0e0a95249459df054241a9e8f4cca56062 (diff) |
Merge branch 'next-tpm' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
Pull TPM updates from James Morris:
"Here are the TPM updates from Jarkko for v4.14, which I've placed in
their own branch (next-tpm). I ended up cherry-picking them as other
changes had been made in Jarkko's branch after he sent me his original
pull request.
I plan on maintaining a separate branch for TPM (and other security
subsystems) from now on.
From Jarkko: 'Not much this time except a few fixes'"
* 'next-tpm' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security:
tpm: ibmvtpm: simplify crq initialization and document crq format
tpm: replace msleep() with usleep_range() in TPM 1.2/2.0 generic drivers
Documentation: tpm: add powered-while-suspended binding documentation
tpm: tpm_crb: constify acpi_device_id.
tpm: vtpm: constify vio_device_id
-rw-r--r-- | Documentation/devicetree/bindings/security/tpm/tpm-i2c.txt | 6 | ||||
-rw-r--r-- | drivers/char/tpm/tpm-interface.c | 10 | ||||
-rw-r--r-- | drivers/char/tpm/tpm.h | 9 | ||||
-rw-r--r-- | drivers/char/tpm/tpm2-cmd.c | 2 | ||||
-rw-r--r-- | drivers/char/tpm/tpm_crb.c | 2 | ||||
-rw-r--r-- | drivers/char/tpm/tpm_ibmvtpm.c | 98 | ||||
-rw-r--r-- | drivers/char/tpm/tpm_infineon.c | 6 | ||||
-rw-r--r-- | drivers/char/tpm/tpm_tis_core.c | 8 |
8 files changed, 89 insertions, 52 deletions
diff --git a/Documentation/devicetree/bindings/security/tpm/tpm-i2c.txt b/Documentation/devicetree/bindings/security/tpm/tpm-i2c.txt index 3eca6de6369d..a65d7b71e81a 100644 --- a/Documentation/devicetree/bindings/security/tpm/tpm-i2c.txt +++ b/Documentation/devicetree/bindings/security/tpm/tpm-i2c.txt | |||
@@ -8,6 +8,12 @@ Required properties: | |||
8 | the firmware event log | 8 | the firmware event log |
9 | - linux,sml-size : size of the memory allocated for the firmware event log | 9 | - linux,sml-size : size of the memory allocated for the firmware event log |
10 | 10 | ||
11 | Optional properties: | ||
12 | |||
13 | - powered-while-suspended: present when the TPM is left powered on between | ||
14 | suspend and resume (makes the suspend/resume | ||
15 | callbacks do nothing). | ||
16 | |||
11 | Example (for OpenPower Systems with Nuvoton TPM 2.0 on I2C) | 17 | Example (for OpenPower Systems with Nuvoton TPM 2.0 on I2C) |
12 | ---------------------------------------------------------- | 18 | ---------------------------------------------------------- |
13 | 19 | ||
diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c index fe597e6c55c4..1d6729be4cd6 100644 --- a/drivers/char/tpm/tpm-interface.c +++ b/drivers/char/tpm/tpm-interface.c | |||
@@ -455,7 +455,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space, | |||
455 | goto out; | 455 | goto out; |
456 | } | 456 | } |
457 | 457 | ||
458 | msleep(TPM_TIMEOUT); /* CHECK */ | 458 | tpm_msleep(TPM_TIMEOUT); |
459 | rmb(); | 459 | rmb(); |
460 | } while (time_before(jiffies, stop)); | 460 | } while (time_before(jiffies, stop)); |
461 | 461 | ||
@@ -970,7 +970,7 @@ int tpm_do_selftest(struct tpm_chip *chip) | |||
970 | dev_info( | 970 | dev_info( |
971 | &chip->dev, HW_ERR | 971 | &chip->dev, HW_ERR |
972 | "TPM command timed out during continue self test"); | 972 | "TPM command timed out during continue self test"); |
973 | msleep(delay_msec); | 973 | tpm_msleep(delay_msec); |
974 | continue; | 974 | continue; |
975 | } | 975 | } |
976 | 976 | ||
@@ -985,7 +985,7 @@ int tpm_do_selftest(struct tpm_chip *chip) | |||
985 | } | 985 | } |
986 | if (rc != TPM_WARN_DOING_SELFTEST) | 986 | if (rc != TPM_WARN_DOING_SELFTEST) |
987 | return rc; | 987 | return rc; |
988 | msleep(delay_msec); | 988 | tpm_msleep(delay_msec); |
989 | } while (--loops > 0); | 989 | } while (--loops > 0); |
990 | 990 | ||
991 | return rc; | 991 | return rc; |
@@ -1085,7 +1085,7 @@ again: | |||
1085 | } | 1085 | } |
1086 | } else { | 1086 | } else { |
1087 | do { | 1087 | do { |
1088 | msleep(TPM_TIMEOUT); | 1088 | tpm_msleep(TPM_TIMEOUT); |
1089 | status = chip->ops->status(chip); | 1089 | status = chip->ops->status(chip); |
1090 | if ((status & mask) == mask) | 1090 | if ((status & mask) == mask) |
1091 | return 0; | 1091 | return 0; |
@@ -1150,7 +1150,7 @@ int tpm_pm_suspend(struct device *dev) | |||
1150 | */ | 1150 | */ |
1151 | if (rc != TPM_WARN_RETRY) | 1151 | if (rc != TPM_WARN_RETRY) |
1152 | break; | 1152 | break; |
1153 | msleep(TPM_TIMEOUT_RETRY); | 1153 | tpm_msleep(TPM_TIMEOUT_RETRY); |
1154 | } | 1154 | } |
1155 | 1155 | ||
1156 | if (rc) | 1156 | if (rc) |
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h index 04fbff2edbf3..2d5466a72e40 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h | |||
@@ -50,7 +50,8 @@ enum tpm_const { | |||
50 | 50 | ||
51 | enum tpm_timeout { | 51 | enum tpm_timeout { |
52 | TPM_TIMEOUT = 5, /* msecs */ | 52 | TPM_TIMEOUT = 5, /* msecs */ |
53 | TPM_TIMEOUT_RETRY = 100 /* msecs */ | 53 | TPM_TIMEOUT_RETRY = 100, /* msecs */ |
54 | TPM_TIMEOUT_RANGE_US = 300 /* usecs */ | ||
54 | }; | 55 | }; |
55 | 56 | ||
56 | /* TPM addresses */ | 57 | /* TPM addresses */ |
@@ -527,6 +528,12 @@ int tpm_pm_resume(struct device *dev); | |||
527 | int wait_for_tpm_stat(struct tpm_chip *chip, u8 mask, unsigned long timeout, | 528 | int wait_for_tpm_stat(struct tpm_chip *chip, u8 mask, unsigned long timeout, |
528 | wait_queue_head_t *queue, bool check_cancel); | 529 | wait_queue_head_t *queue, bool check_cancel); |
529 | 530 | ||
531 | static inline void tpm_msleep(unsigned int delay_msec) | ||
532 | { | ||
533 | usleep_range(delay_msec * 1000, | ||
534 | (delay_msec * 1000) + TPM_TIMEOUT_RANGE_US); | ||
535 | }; | ||
536 | |||
530 | struct tpm_chip *tpm_chip_find_get(int chip_num); | 537 | struct tpm_chip *tpm_chip_find_get(int chip_num); |
531 | __must_check int tpm_try_get_ops(struct tpm_chip *chip); | 538 | __must_check int tpm_try_get_ops(struct tpm_chip *chip); |
532 | void tpm_put_ops(struct tpm_chip *chip); | 539 | void tpm_put_ops(struct tpm_chip *chip); |
diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c index f7f34b2aa981..e1a41b788f08 100644 --- a/drivers/char/tpm/tpm2-cmd.c +++ b/drivers/char/tpm/tpm2-cmd.c | |||
@@ -899,7 +899,7 @@ static int tpm2_do_selftest(struct tpm_chip *chip) | |||
899 | if (rc != TPM2_RC_TESTING) | 899 | if (rc != TPM2_RC_TESTING) |
900 | break; | 900 | break; |
901 | 901 | ||
902 | msleep(delay_msec); | 902 | tpm_msleep(delay_msec); |
903 | } | 903 | } |
904 | 904 | ||
905 | return rc; | 905 | return rc; |
diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c index a4ac63a21d8a..8f0a98dea327 100644 --- a/drivers/char/tpm/tpm_crb.c +++ b/drivers/char/tpm/tpm_crb.c | |||
@@ -665,7 +665,7 @@ static const struct dev_pm_ops crb_pm = { | |||
665 | SET_RUNTIME_PM_OPS(crb_pm_runtime_suspend, crb_pm_runtime_resume, NULL) | 665 | SET_RUNTIME_PM_OPS(crb_pm_runtime_suspend, crb_pm_runtime_resume, NULL) |
666 | }; | 666 | }; |
667 | 667 | ||
668 | static struct acpi_device_id crb_device_ids[] = { | 668 | static const struct acpi_device_id crb_device_ids[] = { |
669 | {"MSFT0101", 0}, | 669 | {"MSFT0101", 0}, |
670 | {"", 0}, | 670 | {"", 0}, |
671 | }; | 671 | }; |
diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c index f01d083eced2..25f6e2665385 100644 --- a/drivers/char/tpm/tpm_ibmvtpm.c +++ b/drivers/char/tpm/tpm_ibmvtpm.c | |||
@@ -32,26 +32,70 @@ | |||
32 | 32 | ||
33 | static const char tpm_ibmvtpm_driver_name[] = "tpm_ibmvtpm"; | 33 | static const char tpm_ibmvtpm_driver_name[] = "tpm_ibmvtpm"; |
34 | 34 | ||
35 | static struct vio_device_id tpm_ibmvtpm_device_table[] = { | 35 | static const struct vio_device_id tpm_ibmvtpm_device_table[] = { |
36 | { "IBM,vtpm", "IBM,vtpm"}, | 36 | { "IBM,vtpm", "IBM,vtpm"}, |
37 | { "", "" } | 37 | { "", "" } |
38 | }; | 38 | }; |
39 | MODULE_DEVICE_TABLE(vio, tpm_ibmvtpm_device_table); | 39 | MODULE_DEVICE_TABLE(vio, tpm_ibmvtpm_device_table); |
40 | 40 | ||
41 | /** | 41 | /** |
42 | * | ||
43 | * ibmvtpm_send_crq_word - Send a CRQ request | ||
44 | * @vdev: vio device struct | ||
45 | * @w1: pre-constructed first word of tpm crq (second word is reserved) | ||
46 | * | ||
47 | * Return: | ||
48 | * 0 - Success | ||
49 | * Non-zero - Failure | ||
50 | */ | ||
51 | static int ibmvtpm_send_crq_word(struct vio_dev *vdev, u64 w1) | ||
52 | { | ||
53 | return plpar_hcall_norets(H_SEND_CRQ, vdev->unit_address, w1, 0); | ||
54 | } | ||
55 | |||
56 | /** | ||
57 | * | ||
42 | * ibmvtpm_send_crq - Send a CRQ request | 58 | * ibmvtpm_send_crq - Send a CRQ request |
43 | * | 59 | * |
44 | * @vdev: vio device struct | 60 | * @vdev: vio device struct |
45 | * @w1: first word | 61 | * @valid: Valid field |
46 | * @w2: second word | 62 | * @msg: Type field |
63 | * @len: Length field | ||
64 | * @data: Data field | ||
65 | * | ||
66 | * The ibmvtpm crq is defined as follows: | ||
67 | * | ||
68 | * Byte | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | ||
69 | * ----------------------------------------------------------------------- | ||
70 | * Word0 | Valid | Type | Length | Data | ||
71 | * ----------------------------------------------------------------------- | ||
72 | * Word1 | Reserved | ||
73 | * ----------------------------------------------------------------------- | ||
74 | * | ||
75 | * Which matches the following structure (on bigendian host): | ||
76 | * | ||
77 | * struct ibmvtpm_crq { | ||
78 | * u8 valid; | ||
79 | * u8 msg; | ||
80 | * __be16 len; | ||
81 | * __be32 data; | ||
82 | * __be64 reserved; | ||
83 | * } __attribute__((packed, aligned(8))); | ||
84 | * | ||
85 | * However, the value is passed in a register so just compute the numeric value | ||
86 | * to load into the register avoiding byteswap altogether. Endian only affects | ||
87 | * memory loads and stores - registers are internally represented the same. | ||
47 | * | 88 | * |
48 | * Return: | 89 | * Return: |
49 | * 0 -Sucess | 90 | * 0 (H_SUCCESS) - Success |
50 | * Non-zero - Failure | 91 | * Non-zero - Failure |
51 | */ | 92 | */ |
52 | static int ibmvtpm_send_crq(struct vio_dev *vdev, u64 w1, u64 w2) | 93 | static int ibmvtpm_send_crq(struct vio_dev *vdev, |
94 | u8 valid, u8 msg, u16 len, u32 data) | ||
53 | { | 95 | { |
54 | return plpar_hcall_norets(H_SEND_CRQ, vdev->unit_address, w1, w2); | 96 | u64 w1 = ((u64)valid << 56) | ((u64)msg << 48) | ((u64)len << 32) | |
97 | (u64)data; | ||
98 | return ibmvtpm_send_crq_word(vdev, w1); | ||
55 | } | 99 | } |
56 | 100 | ||
57 | /** | 101 | /** |
@@ -109,8 +153,6 @@ static int tpm_ibmvtpm_recv(struct tpm_chip *chip, u8 *buf, size_t count) | |||
109 | static int tpm_ibmvtpm_send(struct tpm_chip *chip, u8 *buf, size_t count) | 153 | static int tpm_ibmvtpm_send(struct tpm_chip *chip, u8 *buf, size_t count) |
110 | { | 154 | { |
111 | struct ibmvtpm_dev *ibmvtpm = dev_get_drvdata(&chip->dev); | 155 | struct ibmvtpm_dev *ibmvtpm = dev_get_drvdata(&chip->dev); |
112 | struct ibmvtpm_crq crq; | ||
113 | __be64 *word = (__be64 *)&crq; | ||
114 | int rc, sig; | 156 | int rc, sig; |
115 | 157 | ||
116 | if (!ibmvtpm->rtce_buf) { | 158 | if (!ibmvtpm->rtce_buf) { |
@@ -137,10 +179,6 @@ static int tpm_ibmvtpm_send(struct tpm_chip *chip, u8 *buf, size_t count) | |||
137 | spin_lock(&ibmvtpm->rtce_lock); | 179 | spin_lock(&ibmvtpm->rtce_lock); |
138 | ibmvtpm->res_len = 0; | 180 | ibmvtpm->res_len = 0; |
139 | memcpy((void *)ibmvtpm->rtce_buf, (void *)buf, count); | 181 | memcpy((void *)ibmvtpm->rtce_buf, (void *)buf, count); |
140 | crq.valid = (u8)IBMVTPM_VALID_CMD; | ||
141 | crq.msg = (u8)VTPM_TPM_COMMAND; | ||
142 | crq.len = cpu_to_be16(count); | ||
143 | crq.data = cpu_to_be32(ibmvtpm->rtce_dma_handle); | ||
144 | 182 | ||
145 | /* | 183 | /* |
146 | * set the processing flag before the Hcall, since we may get the | 184 | * set the processing flag before the Hcall, since we may get the |
@@ -148,8 +186,9 @@ static int tpm_ibmvtpm_send(struct tpm_chip *chip, u8 *buf, size_t count) | |||
148 | */ | 186 | */ |
149 | ibmvtpm->tpm_processing_cmd = true; | 187 | ibmvtpm->tpm_processing_cmd = true; |
150 | 188 | ||
151 | rc = ibmvtpm_send_crq(ibmvtpm->vdev, be64_to_cpu(word[0]), | 189 | rc = ibmvtpm_send_crq(ibmvtpm->vdev, |
152 | be64_to_cpu(word[1])); | 190 | IBMVTPM_VALID_CMD, VTPM_TPM_COMMAND, |
191 | count, ibmvtpm->rtce_dma_handle); | ||
153 | if (rc != H_SUCCESS) { | 192 | if (rc != H_SUCCESS) { |
154 | dev_err(ibmvtpm->dev, "tpm_ibmvtpm_send failed rc=%d\n", rc); | 193 | dev_err(ibmvtpm->dev, "tpm_ibmvtpm_send failed rc=%d\n", rc); |
155 | rc = 0; | 194 | rc = 0; |
@@ -182,15 +221,10 @@ static u8 tpm_ibmvtpm_status(struct tpm_chip *chip) | |||
182 | */ | 221 | */ |
183 | static int ibmvtpm_crq_get_rtce_size(struct ibmvtpm_dev *ibmvtpm) | 222 | static int ibmvtpm_crq_get_rtce_size(struct ibmvtpm_dev *ibmvtpm) |
184 | { | 223 | { |
185 | struct ibmvtpm_crq crq; | ||
186 | u64 *buf = (u64 *) &crq; | ||
187 | int rc; | 224 | int rc; |
188 | 225 | ||
189 | crq.valid = (u8)IBMVTPM_VALID_CMD; | 226 | rc = ibmvtpm_send_crq(ibmvtpm->vdev, |
190 | crq.msg = (u8)VTPM_GET_RTCE_BUFFER_SIZE; | 227 | IBMVTPM_VALID_CMD, VTPM_GET_RTCE_BUFFER_SIZE, 0, 0); |
191 | |||
192 | rc = ibmvtpm_send_crq(ibmvtpm->vdev, cpu_to_be64(buf[0]), | ||
193 | cpu_to_be64(buf[1])); | ||
194 | if (rc != H_SUCCESS) | 228 | if (rc != H_SUCCESS) |
195 | dev_err(ibmvtpm->dev, | 229 | dev_err(ibmvtpm->dev, |
196 | "ibmvtpm_crq_get_rtce_size failed rc=%d\n", rc); | 230 | "ibmvtpm_crq_get_rtce_size failed rc=%d\n", rc); |
@@ -210,15 +244,10 @@ static int ibmvtpm_crq_get_rtce_size(struct ibmvtpm_dev *ibmvtpm) | |||
210 | */ | 244 | */ |
211 | static int ibmvtpm_crq_get_version(struct ibmvtpm_dev *ibmvtpm) | 245 | static int ibmvtpm_crq_get_version(struct ibmvtpm_dev *ibmvtpm) |
212 | { | 246 | { |
213 | struct ibmvtpm_crq crq; | ||
214 | u64 *buf = (u64 *) &crq; | ||
215 | int rc; | 247 | int rc; |
216 | 248 | ||
217 | crq.valid = (u8)IBMVTPM_VALID_CMD; | 249 | rc = ibmvtpm_send_crq(ibmvtpm->vdev, |
218 | crq.msg = (u8)VTPM_GET_VERSION; | 250 | IBMVTPM_VALID_CMD, VTPM_GET_VERSION, 0, 0); |
219 | |||
220 | rc = ibmvtpm_send_crq(ibmvtpm->vdev, cpu_to_be64(buf[0]), | ||
221 | cpu_to_be64(buf[1])); | ||
222 | if (rc != H_SUCCESS) | 251 | if (rc != H_SUCCESS) |
223 | dev_err(ibmvtpm->dev, | 252 | dev_err(ibmvtpm->dev, |
224 | "ibmvtpm_crq_get_version failed rc=%d\n", rc); | 253 | "ibmvtpm_crq_get_version failed rc=%d\n", rc); |
@@ -238,7 +267,7 @@ static int ibmvtpm_crq_send_init_complete(struct ibmvtpm_dev *ibmvtpm) | |||
238 | { | 267 | { |
239 | int rc; | 268 | int rc; |
240 | 269 | ||
241 | rc = ibmvtpm_send_crq(ibmvtpm->vdev, INIT_CRQ_COMP_CMD, 0); | 270 | rc = ibmvtpm_send_crq_word(ibmvtpm->vdev, INIT_CRQ_COMP_CMD); |
242 | if (rc != H_SUCCESS) | 271 | if (rc != H_SUCCESS) |
243 | dev_err(ibmvtpm->dev, | 272 | dev_err(ibmvtpm->dev, |
244 | "ibmvtpm_crq_send_init_complete failed rc=%d\n", rc); | 273 | "ibmvtpm_crq_send_init_complete failed rc=%d\n", rc); |
@@ -258,7 +287,7 @@ static int ibmvtpm_crq_send_init(struct ibmvtpm_dev *ibmvtpm) | |||
258 | { | 287 | { |
259 | int rc; | 288 | int rc; |
260 | 289 | ||
261 | rc = ibmvtpm_send_crq(ibmvtpm->vdev, INIT_CRQ_CMD, 0); | 290 | rc = ibmvtpm_send_crq_word(ibmvtpm->vdev, INIT_CRQ_CMD); |
262 | if (rc != H_SUCCESS) | 291 | if (rc != H_SUCCESS) |
263 | dev_err(ibmvtpm->dev, | 292 | dev_err(ibmvtpm->dev, |
264 | "ibmvtpm_crq_send_init failed rc=%d\n", rc); | 293 | "ibmvtpm_crq_send_init failed rc=%d\n", rc); |
@@ -340,15 +369,10 @@ static int tpm_ibmvtpm_suspend(struct device *dev) | |||
340 | { | 369 | { |
341 | struct tpm_chip *chip = dev_get_drvdata(dev); | 370 | struct tpm_chip *chip = dev_get_drvdata(dev); |
342 | struct ibmvtpm_dev *ibmvtpm = dev_get_drvdata(&chip->dev); | 371 | struct ibmvtpm_dev *ibmvtpm = dev_get_drvdata(&chip->dev); |
343 | struct ibmvtpm_crq crq; | ||
344 | u64 *buf = (u64 *) &crq; | ||
345 | int rc = 0; | 372 | int rc = 0; |
346 | 373 | ||
347 | crq.valid = (u8)IBMVTPM_VALID_CMD; | 374 | rc = ibmvtpm_send_crq(ibmvtpm->vdev, |
348 | crq.msg = (u8)VTPM_PREPARE_TO_SUSPEND; | 375 | IBMVTPM_VALID_CMD, VTPM_PREPARE_TO_SUSPEND, 0, 0); |
349 | |||
350 | rc = ibmvtpm_send_crq(ibmvtpm->vdev, cpu_to_be64(buf[0]), | ||
351 | cpu_to_be64(buf[1])); | ||
352 | if (rc != H_SUCCESS) | 376 | if (rc != H_SUCCESS) |
353 | dev_err(ibmvtpm->dev, | 377 | dev_err(ibmvtpm->dev, |
354 | "tpm_ibmvtpm_suspend failed rc=%d\n", rc); | 378 | "tpm_ibmvtpm_suspend failed rc=%d\n", rc); |
diff --git a/drivers/char/tpm/tpm_infineon.c b/drivers/char/tpm/tpm_infineon.c index 3b1b9f9322d5..d8f10047fbba 100644 --- a/drivers/char/tpm/tpm_infineon.c +++ b/drivers/char/tpm/tpm_infineon.c | |||
@@ -191,7 +191,7 @@ static int wait(struct tpm_chip *chip, int wait_for_bit) | |||
191 | /* check the status-register if wait_for_bit is set */ | 191 | /* check the status-register if wait_for_bit is set */ |
192 | if (status & 1 << wait_for_bit) | 192 | if (status & 1 << wait_for_bit) |
193 | break; | 193 | break; |
194 | msleep(TPM_MSLEEP_TIME); | 194 | tpm_msleep(TPM_MSLEEP_TIME); |
195 | } | 195 | } |
196 | if (i == TPM_MAX_TRIES) { /* timeout occurs */ | 196 | if (i == TPM_MAX_TRIES) { /* timeout occurs */ |
197 | if (wait_for_bit == STAT_XFE) | 197 | if (wait_for_bit == STAT_XFE) |
@@ -226,7 +226,7 @@ static void tpm_wtx(struct tpm_chip *chip) | |||
226 | wait_and_send(chip, TPM_CTRL_WTX); | 226 | wait_and_send(chip, TPM_CTRL_WTX); |
227 | wait_and_send(chip, 0x00); | 227 | wait_and_send(chip, 0x00); |
228 | wait_and_send(chip, 0x00); | 228 | wait_and_send(chip, 0x00); |
229 | msleep(TPM_WTX_MSLEEP_TIME); | 229 | tpm_msleep(TPM_WTX_MSLEEP_TIME); |
230 | } | 230 | } |
231 | 231 | ||
232 | static void tpm_wtx_abort(struct tpm_chip *chip) | 232 | static void tpm_wtx_abort(struct tpm_chip *chip) |
@@ -237,7 +237,7 @@ static void tpm_wtx_abort(struct tpm_chip *chip) | |||
237 | wait_and_send(chip, 0x00); | 237 | wait_and_send(chip, 0x00); |
238 | wait_and_send(chip, 0x00); | 238 | wait_and_send(chip, 0x00); |
239 | number_of_wtx = 0; | 239 | number_of_wtx = 0; |
240 | msleep(TPM_WTX_MSLEEP_TIME); | 240 | tpm_msleep(TPM_WTX_MSLEEP_TIME); |
241 | } | 241 | } |
242 | 242 | ||
243 | static int tpm_inf_recv(struct tpm_chip *chip, u8 * buf, size_t count) | 243 | static int tpm_inf_recv(struct tpm_chip *chip, u8 * buf, size_t count) |
diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c index b617b2eeb080..63bc6c3b949e 100644 --- a/drivers/char/tpm/tpm_tis_core.c +++ b/drivers/char/tpm/tpm_tis_core.c | |||
@@ -51,7 +51,7 @@ static int wait_startup(struct tpm_chip *chip, int l) | |||
51 | 51 | ||
52 | if (access & TPM_ACCESS_VALID) | 52 | if (access & TPM_ACCESS_VALID) |
53 | return 0; | 53 | return 0; |
54 | msleep(TPM_TIMEOUT); | 54 | tpm_msleep(TPM_TIMEOUT); |
55 | } while (time_before(jiffies, stop)); | 55 | } while (time_before(jiffies, stop)); |
56 | return -1; | 56 | return -1; |
57 | } | 57 | } |
@@ -117,7 +117,7 @@ again: | |||
117 | do { | 117 | do { |
118 | if (check_locality(chip, l)) | 118 | if (check_locality(chip, l)) |
119 | return l; | 119 | return l; |
120 | msleep(TPM_TIMEOUT); | 120 | tpm_msleep(TPM_TIMEOUT); |
121 | } while (time_before(jiffies, stop)); | 121 | } while (time_before(jiffies, stop)); |
122 | } | 122 | } |
123 | return -1; | 123 | return -1; |
@@ -164,7 +164,7 @@ static int get_burstcount(struct tpm_chip *chip) | |||
164 | burstcnt = (value >> 8) & 0xFFFF; | 164 | burstcnt = (value >> 8) & 0xFFFF; |
165 | if (burstcnt) | 165 | if (burstcnt) |
166 | return burstcnt; | 166 | return burstcnt; |
167 | msleep(TPM_TIMEOUT); | 167 | tpm_msleep(TPM_TIMEOUT); |
168 | } while (time_before(jiffies, stop)); | 168 | } while (time_before(jiffies, stop)); |
169 | return -EBUSY; | 169 | return -EBUSY; |
170 | } | 170 | } |
@@ -396,7 +396,7 @@ static int tpm_tis_send(struct tpm_chip *chip, u8 *buf, size_t len) | |||
396 | priv->irq = irq; | 396 | priv->irq = irq; |
397 | chip->flags |= TPM_CHIP_FLAG_IRQ; | 397 | chip->flags |= TPM_CHIP_FLAG_IRQ; |
398 | if (!priv->irq_tested) | 398 | if (!priv->irq_tested) |
399 | msleep(1); | 399 | tpm_msleep(1); |
400 | if (!priv->irq_tested) | 400 | if (!priv->irq_tested) |
401 | disable_interrupts(chip); | 401 | disable_interrupts(chip); |
402 | priv->irq_tested = true; | 402 | priv->irq_tested = true; |