If a device reports 0xf in the InterfaceType field of the TPM_INTERFACE_ID,
then the rest of the fields are invalid, and the InterfaceVersion field of
the TPM_INTF_CAPABILITY register must be checked instead.
Signed-off-by: Stephen Douthit <stephend@silicom-usa.com>
---
src/hw/tpm_drivers.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/src/hw/tpm_drivers.c b/src/hw/tpm_drivers.c
index da8bb63..ed58bf5 100644
--- a/src/hw/tpm_drivers.c
+++ b/src/hw/tpm_drivers.c
@@ -142,13 +142,23 @@ static u32 tis_probe(void)
static TPMVersion tis_get_tpm_version(void)
{
- /* TPM 2 has an interface register */
- u32 ifaceid = readl(TIS_REG(0, TIS_REG_IFACE_ID));
-
- if ((ifaceid & 0xf) == 0) {
- /* TPM 2 */
+ u32 reg = readl(TIS_REG(0, TIS_REG_IFACE_ID));
+
+ /*
+ * FIFO interface as defined in TIS1.3 is active
+ * Interface capabilities are defined in TIS_REG_INTF_CAPABILITY
+ */
+ if ((reg & 0xf) == 0xf) {
+ reg = readl(TIS_REG(0, TIS_REG_INTF_CAPABILITY));
+ /* Interface 1.3 for TPM 2.0 */
+ if (((reg >> 28) & 0x7) == 3)
+ return TPM_VERSION_2;
+ }
+ /* FIFO interface as defined in PTP for TPM 2.0 is active */
+ else if ((reg & 0xf) == 0) {
return TPM_VERSION_2;
}
+
return TPM_VERSION_1_2;
}
--
2.14.3
_______________________________________________
SeaBIOS mailing list
SeaBIOS@seabios.org
https://mail.coreboot.org/mailman/listinfo/seabios
On 02/27/2018 02:17 PM, Stephen Douthit wrote: > If a device reports 0xf in the InterfaceType field of the TPM_INTERFACE_ID, > then the rest of the fields are invalid, and the InterfaceVersion field of > the TPM_INTF_CAPABILITY register must be checked instead. > > Signed-off-by: Stephen Douthit <stephend@silicom-usa.com> > --- > src/hw/tpm_drivers.c | 20 +++++++++++++++----- > 1 file changed, 15 insertions(+), 5 deletions(-) > > diff --git a/src/hw/tpm_drivers.c b/src/hw/tpm_drivers.c > index da8bb63..ed58bf5 100644 > --- a/src/hw/tpm_drivers.c > +++ b/src/hw/tpm_drivers.c > @@ -142,13 +142,23 @@ static u32 tis_probe(void) > > static TPMVersion tis_get_tpm_version(void) > { > - /* TPM 2 has an interface register */ > - u32 ifaceid = readl(TIS_REG(0, TIS_REG_IFACE_ID)); > - > - if ((ifaceid & 0xf) == 0) { > - /* TPM 2 */ > + u32 reg = readl(TIS_REG(0, TIS_REG_IFACE_ID)); > + > + /* > + * FIFO interface as defined in TIS1.3 is active > + * Interface capabilities are defined in TIS_REG_INTF_CAPABILITY > + */ > + if ((reg & 0xf) == 0xf) { > + reg = readl(TIS_REG(0, TIS_REG_INTF_CAPABILITY)); > + /* Interface 1.3 for TPM 2.0 */ > + if (((reg >> 28) & 0x7) == 3) > + return TPM_VERSION_2; > + } > + /* FIFO interface as defined in PTP for TPM 2.0 is active */ > + else if ((reg & 0xf) == 0) { > return TPM_VERSION_2; > } > + > return TPM_VERSION_1_2; > } > Tested it with QEMU TPM 2 and TPM 1.2: Tested-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com> _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios
© 2016 - 2025 Red Hat, Inc.