Some versions of u-boot don't start the TPM. We want
the probe to fail in this case. We could start the TPM
here, but then we would have to set it up compatibly
with what vboot does (including one-time initializations),
or we would hit more confusing errors along the way.
Note: this is tested with non-vboot firmware. I will try
to test it with vboot firmware as well, but I might hit
snags at this point and might give up.
BUG=chrome-os-partner:8921
TEST=booted with non-vboot u-boot and noted that /dev/tpm0 does not exist
Change-Id: Iea04be737891eb67f428e4627f669301b936cb9e
Reviewed-on: https://gerrit-int.chromium.org/18683
Tested-by: Luigi Semenzato <semenzato@google.com>
Reviewed-by: Jonathan Kliegman <kliegs@google.com>
Reviewed-by: Olof Johansson <olofj@google.com>
Commit-Ready: Luigi Semenzato <semenzato@google.com>
u32 vendor;
int rc = 0;
struct tpm_chip *chip;
- extern void tpm_continue_selftest(struct tpm_chip *);
chip = tpm_register_hardware(dev, &tpm_tis_i2c);
if (!chip) {
INIT_LIST_HEAD(&chip->vendor.list);
tpm_dev.chip = chip;
- tpm_get_timeouts(chip);
- tpm_continue_selftest(chip);
+ if (tpm_get_timeouts(chip)) {
+ dev_err(dev, "Could not get TPM timeouts and durations\n");
+ rc = -ENODEV;
+ goto out_release;
+ }
+
+ if (tpm_do_selftest(chip)) {
+ dev_err(dev, "TPM self test failed\n");
+ rc = -ENODEV;
+ goto out_release;
+ }
return 0;