diff options
Diffstat (limited to 'drivers/char/tpm/tpm.c')
-rw-r--r-- | drivers/char/tpm/tpm.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index b6c4a320cfde..9bd4668e2855 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c | |||
@@ -611,15 +611,31 @@ duration: | |||
611 | } | 611 | } |
612 | EXPORT_SYMBOL_GPL(tpm_get_timeouts); | 612 | EXPORT_SYMBOL_GPL(tpm_get_timeouts); |
613 | 613 | ||
614 | void tpm_continue_selftest(struct tpm_chip *chip) | 614 | #define TPM_ORD_CONTINUE_SELFTEST 83 |
615 | #define CONTINUE_SELFTEST_RESULT_SIZE 10 | ||
616 | |||
617 | static struct tpm_input_header continue_selftest_header = { | ||
618 | .tag = TPM_TAG_RQU_COMMAND, | ||
619 | .length = cpu_to_be32(10), | ||
620 | .ordinal = cpu_to_be32(TPM_ORD_CONTINUE_SELFTEST), | ||
621 | }; | ||
622 | |||
623 | /** | ||
624 | * tpm_continue_selftest -- run TPM's selftest | ||
625 | * @chip: TPM chip to use | ||
626 | * | ||
627 | * Returns 0 on success, < 0 in case of fatal error or a value > 0 representing | ||
628 | * a TPM error code. | ||
629 | */ | ||
630 | int tpm_continue_selftest(struct tpm_chip *chip) | ||
615 | { | 631 | { |
616 | u8 data[] = { | 632 | int rc; |
617 | 0, 193, /* TPM_TAG_RQU_COMMAND */ | 633 | struct tpm_cmd_t cmd; |
618 | 0, 0, 0, 10, /* length */ | ||
619 | 0, 0, 0, 83, /* TPM_ORD_ContinueSelfTest */ | ||
620 | }; | ||
621 | 634 | ||
622 | tpm_transmit(chip, data, sizeof(data)); | 635 | cmd.header.in = continue_selftest_header; |
636 | rc = transmit_cmd(chip, &cmd, CONTINUE_SELFTEST_RESULT_SIZE, | ||
637 | "continue selftest"); | ||
638 | return rc; | ||
623 | } | 639 | } |
624 | EXPORT_SYMBOL_GPL(tpm_continue_selftest); | 640 | EXPORT_SYMBOL_GPL(tpm_continue_selftest); |
625 | 641 | ||