From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
To: Simon Glass <sjg@chromium.org>
Cc: U-Boot Mailing List <u-boot@lists.denx.de>,
Sughosh Ganu <sughosh.ganu@linaro.org>
Subject: Re: [PATCH 2/2] tpm: Implement tpm_auto_start() for TPMv1.2
Date: Tue, 21 Feb 2023 15:03:37 +0200 [thread overview]
Message-ID: <Y/TBKUnVDHQCo5pl@hera> (raw)
In-Reply-To: <20230220212736.885114-2-sjg@chromium.org>
Hi Simon,
On Mon, Feb 20, 2023 at 02:27:36PM -0700, Simon Glass wrote:
> Add an implementation of this, moving the common call to tpm_init() up
> into the common API implementation.
>
> Add a test.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> include/tpm-common.h | 2 +-
> include/tpm-v1.h | 11 +++++++++++
> lib/tpm-v1.c | 16 ++++++++++++++++
> lib/tpm-v2.c | 8 --------
> lib/tpm_api.c | 19 ++++++++++++++++---
> test/dm/tpm.c | 45 ++++++++++++++++++++++++++++++++++++++++++++
> 6 files changed, 89 insertions(+), 12 deletions(-)
>
> diff --git a/include/tpm-common.h b/include/tpm-common.h
> index b2c5404430f..1ba81386ce1 100644
> --- a/include/tpm-common.h
> +++ b/include/tpm-common.h
> @@ -94,7 +94,7 @@ struct tpm_ops {
> * close().
> *
> * @dev: Device to open
> - * @return 0 ok OK, -ve on error
> + * @return 0 ok OK, -EBUSY if already opened, other -ve on other error
> */
> int (*open)(struct udevice *dev);
>
> diff --git a/include/tpm-v1.h b/include/tpm-v1.h
> index 33d53fb695e..60b71e2a4b6 100644
> --- a/include/tpm-v1.h
> +++ b/include/tpm-v1.h
> @@ -591,4 +591,15 @@ u32 tpm_set_global_lock(struct udevice *dev);
> */
> u32 tpm1_resume(struct udevice *dev);
>
> +/**
> + * tpm1_auto_start() - start up the TPM
> + *
> + * This does not do a self test.
> + *
> + * @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..ea3833549bc 100644
> --- a/lib/tpm-v1.c
> +++ b/lib/tpm-v1.c
> @@ -69,6 +69,22 @@ 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);
> + /* continue on if the TPM is already inited */
> + if (rc && rc != TPM_INVALID_POSTINIT)
> + return rc;
> +
> + rc = tpm1_self_test_full(dev);
> + if (rc)
> + return rc;
Mind if I remove this if before merging?
> +
> + return rc;
> +}
> +
> {
[...]
> +
> + return 0;
> +}
> +DM_TEST(dm_test_tpm_autostart_reinit, UT_TESTF_SCAN_FDT);
> --
> 2.39.2.637.g21b0678d19-goog
>
Other than that
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
next prev parent reply other threads:[~2023-02-21 13:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-20 21:27 [PATCH 1/2] tpm: Separate out the TPM tests for v1 and v2 Simon Glass
2023-02-20 21:27 ` [PATCH 2/2] tpm: Implement tpm_auto_start() for TPMv1.2 Simon Glass
2023-02-21 13:03 ` Ilias Apalodimas [this message]
2023-02-21 13:08 ` Simon Glass
2023-02-21 13:10 ` Ilias Apalodimas
2023-02-21 13:17 ` Simon Glass
2023-02-21 13:04 ` [PATCH 1/2] tpm: Separate out the TPM tests for v1 and v2 Ilias Apalodimas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y/TBKUnVDHQCo5pl@hera \
--to=ilias.apalodimas@linaro.org \
--cc=sjg@chromium.org \
--cc=sughosh.ganu@linaro.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox