[PATCH 1/8 v6] tpm: refactor function names and macros for infineon v1.2 TPM

Ilias Apalodimas ilias.apalodimas at linaro.org
Mon Nov 8 17:28:29 CET 2021


Hi Heinrich

On Mon, 8 Nov 2021 at 17:55, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
>
>
> On 11/7/21 22:33, Ilias Apalodimas wrote:
> > With the upcoming TPM2 API, some of the function names are part of the new
> > header file.  So switch conflicting driver defined function names and
> > defines.
> >
> > Signed-off-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>
> > ---
> >   drivers/tpm/tpm_tis_infineon.c | 34 +++++++++++++++++-----------------
> >   1 file changed, 17 insertions(+), 17 deletions(-)
> >
> > diff --git a/drivers/tpm/tpm_tis_infineon.c b/drivers/tpm/tpm_tis_infineon.c
> > index f414e5657db9..aa66e931bada 100644
> > --- a/drivers/tpm/tpm_tis_infineon.c
> > +++ b/drivers/tpm/tpm_tis_infineon.c
> > @@ -50,10 +50,10 @@ static const char * const chip_name[] = {
> >       [UNKNOWN] = "unknown/fallback to slb9635",
> >   };
> >
> > -#define      TPM_ACCESS(l)                   (0x0000 | ((l) << 4))
> > -#define      TPM_STS(l)                      (0x0001 | ((l) << 4))
> > -#define      TPM_DATA_FIFO(l)                (0x0005 | ((l) << 4))
> > -#define      TPM_DID_VID(l)                  (0x0006 | ((l) << 4))
> > +#define      TPM1_ACCESS(l)                  (0x0000 | ((l) << 4))
> > +#define      TPM1_STS(l)                     (0x0001 | ((l) << 4))
> > +#define      TPM1_DATA_FIFO(l)               (0x0005 | ((l) << 4))
> > +#define      TPM1_DID_VID(l)                 (0x0006 | ((l) << 4))
>
> To what does '1' relate here?
>
> * Do you mean TPMv1?

Yea that was the intention

> * Or are the constants Infenion specific?

I think so.  I can't find that definition in any of the TCG specs [1]
[2] (search for 0f04 to get to the description table).

>
> If the constants are TPMv1 specific, they should be in a header file.
> If the constants are Infineon specific we could put _INFINEON_ into the
> constant name.

Ok I'll swap 1 with INFINEON

>
> Linux has resolved the conflict by putting the TPMv2 TIS constants into
> drivers/char/tpm/tpm_tis_core.h which is not included by
> drivers/char/tpm/tpm_i2c_infineon.c.

Yea and they still define them differently into that infineon TPM.

[1] https://trustedcomputinggroup.org/wp-content/uploads/TCG_PCClientTPMInterfaceSpecification_TIS__1-3_27_03212013.pdf
[2] https://trustedcomputinggroup.org/wp-content/uploads/PC-Client-Specific-Platform-TPM-Profile-for-TPM-2-0-v1-03-22-170516_final.pdf

Thanks
/Ilias
>
> Best regards
>
> Heinrich
>
> >

[...]


More information about the U-Boot mailing list