aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Berger <stefanb@linux.vnet.ibm.com>2011-11-11 12:57:03 -0500
committerRajiv Andrade <srajiv@linux.vnet.ibm.com>2011-11-16 06:42:57 -0500
commitd97c6ade5926afb6d52df36c33a3491d62cd0dc0 (patch)
tree128f8b39c5d976149f6eb167ea8b03b59d3b40d8
parent2b30a90f6c358714b9d6e628ac92e514917f93a1 (diff)
tpm: Cleanup tpm_continue_selftest
Cleanup the tpm_continue_selftest function. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
-rw-r--r--drivers/char/tpm/tpm.c30
-rw-r--r--drivers/char/tpm/tpm.h2
2 files changed, 24 insertions, 8 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}
612EXPORT_SYMBOL_GPL(tpm_get_timeouts); 612EXPORT_SYMBOL_GPL(tpm_get_timeouts);
613 613
614void tpm_continue_selftest(struct tpm_chip *chip) 614#define TPM_ORD_CONTINUE_SELFTEST 83
615#define CONTINUE_SELFTEST_RESULT_SIZE 10
616
617static 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 */
630int 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}
624EXPORT_SYMBOL_GPL(tpm_continue_selftest); 640EXPORT_SYMBOL_GPL(tpm_continue_selftest);
625 641
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index 4747b68c0c1b..5d2be8ae1b48 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -281,7 +281,7 @@ ssize_t tpm_getcap(struct device *, __be32, cap_t *, const char *);
281 281
282extern int tpm_get_timeouts(struct tpm_chip *); 282extern int tpm_get_timeouts(struct tpm_chip *);
283extern void tpm_gen_interrupt(struct tpm_chip *); 283extern void tpm_gen_interrupt(struct tpm_chip *);
284extern void tpm_continue_selftest(struct tpm_chip *); 284extern int tpm_continue_selftest(struct tpm_chip *);
285extern unsigned long tpm_calc_ordinal_duration(struct tpm_chip *, u32); 285extern unsigned long tpm_calc_ordinal_duration(struct tpm_chip *, u32);
286extern struct tpm_chip* tpm_register_hardware(struct device *, 286extern struct tpm_chip* tpm_register_hardware(struct device *,
287 const struct tpm_vendor_specific *); 287 const struct tpm_vendor_specific *);