mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-04-21 23:47:56 +07:00
tpm: use tpm_pcr_read_dev() in tpm_do_selftest()
Instead of a ad-hoc protocol message construction it is better to call tpm_pcr_read_dev(). Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
This commit is contained in:
parent
ae7e190a3e
commit
0c54133223
@ -782,7 +782,7 @@ int tpm_do_selftest(struct tpm_chip *chip)
|
|||||||
unsigned int loops;
|
unsigned int loops;
|
||||||
unsigned int delay_msec = 100;
|
unsigned int delay_msec = 100;
|
||||||
unsigned long duration;
|
unsigned long duration;
|
||||||
struct tpm_cmd_t cmd;
|
u8 dummy[TPM_DIGEST_SIZE];
|
||||||
|
|
||||||
duration = tpm_calc_ordinal_duration(chip, TPM_ORD_CONTINUE_SELFTEST);
|
duration = tpm_calc_ordinal_duration(chip, TPM_ORD_CONTINUE_SELFTEST);
|
||||||
|
|
||||||
@ -797,9 +797,8 @@ int tpm_do_selftest(struct tpm_chip *chip)
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
/* Attempt to read a PCR value */
|
/* Attempt to read a PCR value */
|
||||||
cmd.header.in = pcrread_header;
|
rc = tpm_pcr_read_dev(chip, 0, dummy);
|
||||||
cmd.params.pcrread_in.pcr_idx = cpu_to_be32(0);
|
|
||||||
rc = tpm_transmit(chip, (u8 *) &cmd, READ_PCR_RESULT_SIZE, 0);
|
|
||||||
/* Some buggy TPMs will not respond to tpm_tis_ready() for
|
/* Some buggy TPMs will not respond to tpm_tis_ready() for
|
||||||
* around 300ms while the self test is ongoing, keep trying
|
* around 300ms while the self test is ongoing, keep trying
|
||||||
* until the self test duration expires. */
|
* until the self test duration expires. */
|
||||||
@ -814,7 +813,6 @@ int tpm_do_selftest(struct tpm_chip *chip)
|
|||||||
if (rc < TPM_HEADER_SIZE)
|
if (rc < TPM_HEADER_SIZE)
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
rc = be32_to_cpu(cmd.header.out.return_code);
|
|
||||||
if (rc == TPM_ERR_DISABLED || rc == TPM_ERR_DEACTIVATED) {
|
if (rc == TPM_ERR_DISABLED || rc == TPM_ERR_DEACTIVATED) {
|
||||||
dev_info(&chip->dev,
|
dev_info(&chip->dev,
|
||||||
"TPM is disabled/deactivated (0x%X)\n", rc);
|
"TPM is disabled/deactivated (0x%X)\n", rc);
|
||||||
|
Loading…
Reference in New Issue
Block a user