[PATCH v3 05/11] tpm: Switch TPMv1 over to use the new API
Simon Glass
sjg at chromium.org
Sun Feb 7 15:37:20 CET 2021
Hi Ilias,
On Mon, 25 Jan 2021 at 01:32, Ilias Apalodimas
<ilias.apalodimas at linaro.org> wrote:
>
> On Sat, Jan 23, 2021 at 10:26:01AM -0700, Simon Glass wrote:
> > Take over the plain 'tpm_...' functions for use by the new TPM API. Rename
> > all the TPMv1 functions so they are called from the API.
> >
> > Update the TPMv1 functions so that they are called from the API. Change
> > existing users to use the tpm1_ prefix so they don't need to go through
> > the API, which might introduce uncertainty.
> >
> > Signed-off-by: Simon Glass <sjg at chromium.org>
> > ---
> >
> > (no changes since v1)
> >
> > board/gdsys/a38x/controlcenterdc.c | 4 +-
> > board/gdsys/a38x/hre.c | 28 +++----
> > board/gdsys/a38x/keyprogram.c | 8 +-
> > board/gdsys/mpc8308/gazerbeam.c | 4 +-
> > board/gdsys/p1022/controlcenterd-id.c | 36 ++++----
> > cmd/tpm-v1.c | 25 +++---
> > cmd/tpm_test.c | 40 +++++----
> > include/tpm-v1.h | 76 ++++++++---------
> > lib/Makefile | 1 +
> > lib/tpm-v1.c | 115 ++++++++++++--------------
> > 10 files changed, 168 insertions(+), 169 deletions(-)
> >
> > diff --git a/board/gdsys/a38x/controlcenterdc.c b/board/gdsys/a38x/controlcenterdc.c
> > index a2287f9deb1..187ac8c4f9f 100644
> > --- a/board/gdsys/a38x/controlcenterdc.c
> > +++ b/board/gdsys/a38x/controlcenterdc.c
> > @@ -286,8 +286,8 @@ int last_stage_init(void)
> > ccdc_eth_init();
> > #endif
> > ret = get_tpm(&tpm);
> > - if (ret || tpm_init(tpm) || tpm_startup(tpm, TPM_ST_CLEAR) ||
> > - tpm_continue_self_test(tpm)) {
> > + if (ret || tpm_init(tpm) || tpm1_startup(tpm, TPM_ST_CLEAR) ||
> > + tpm1_continue_self_test(tpm)) {
> > return 1;
> > }
> >
> > diff --git a/board/gdsys/a38x/hre.c b/board/gdsys/a38x/hre.c
> > index 699241b3e62..de5411a6b93 100644
> > --- a/board/gdsys/a38x/hre.c
> > +++ b/board/gdsys/a38x/hre.c
> > @@ -107,8 +107,8 @@ static int get_tpm_nv_size(struct udevice *tpm, uint32_t index, uint32_t *size)
> > uint8_t *ptr;
> > uint16_t v16;
> >
> > - err = tpm_get_capability(tpm, TPM_CAP_NV_INDEX, index,
> > - info, sizeof(info));
> > + err = tpm1_get_capability(tpm, TPM_CAP_NV_INDEX, index, info,
> > + sizeof(info));
>
> For all subsequent usage, can't we use tpm_get_capability() etc? Why do we
> need to explicitly use the tpm1_get_capability() since we now have a common
> API?
I mention this in the commit message. It is really just that I don't
want to risk breaking the board code.
+Mario Six what do you think?
Regards,
Simon
More information about the U-Boot
mailing list