[PATCH] WIP: TPM additions

Ilias Apalodimas ilias.apalodimas at linaro.org
Mon Feb 20 17:48:22 CET 2023


Hi Simon,

> + * @dev		TPM device
> + * Return: TPM2_RC_SUCCESS, on success, or when the TPM returns
> + * TPM_INVALID_POSTINIT; TPM_FAILEDSELFTEST, if the TPM is in failure state
> + */
> +u32 tpm1_auto_start(struct udevice *dev);
> +
>  #endif /* __TPM_V1_H */
> diff --git a/lib/tpm-v1.c b/lib/tpm-v1.c
> index d0e3ab1b21d..884b8ddbac9 100644
> --- a/lib/tpm-v1.c
> +++ b/lib/tpm-v1.c
> @@ -69,6 +69,17 @@ u32 tpm1_continue_self_test(struct udevice *dev)
>  	return tpm_sendrecv_command(dev, command, NULL, NULL);
>  }
>
> +u32 tpm1_auto_start(struct udevice *dev)
> +{
> +	u32 rc;
> +
> +	rc = tpm1_startup(dev, TPM_ST_CLEAR);
> +	if (rc == TPM_INVALID_POSTINIT)
> +		rc = 0;

I am not an expert in 1.2 devices by any means, but don't you need to start
auto tests here as well similarly to what 2.0 does?
Looking at the kernel code it does something along the lines of

rc= tpm1_self_test_full(dev);
if (rc == TPM_FAILEDSELFTEST) {
.....
}


> +
> +	return rc;
> -	  * -EBUSY return code internally.

[...]

> -	  */
>  	ut_assertok(tpm_auto_start(dev));
>
>  	ut_assert(tpm_report_state(dev, buf, sizeof(buf)));
> @@ -36,4 +123,4 @@ static int dm_test_tpm(struct unit_test_state *uts)
>
>  	return 0;
>  }
> -DM_TEST(dm_test_tpm, UT_TESTF_SCAN_FDT);
> +DM_TEST(dm_test_tpm_report_state, UT_TESTF_SCAN_FDT);
> --
> 2.39.2.637.g21b0678d19-goog
>



Other than that, this looks ok to me

Cheers
/Ilias


More information about the U-Boot mailing list