[SeaBIOS] [PATCH 1/3] tpm: Wait for tpmRegValidSts flags on CRQ interface before probing
Stefan Berger
stefanb at linux.vnet.ibm.com
Wed Mar 14 18:42:41 CET 2018
Wait for the tpmRegValidSts flag on the TPM_LOC_STATE_x register.
Since it's not quite clear when this flag may become valid, we request
access to the interace on locality 0, which must then make it valid.
Signed-off-by: Stefan Berger <stefanb at linux.vnet.ibm.com>
---
src/hw/tpm_drivers.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/hw/tpm_drivers.c b/src/hw/tpm_drivers.c
index ed58bf5..ad97f67 100644
--- a/src/hw/tpm_drivers.c
+++ b/src/hw/tpm_drivers.c
@@ -374,12 +374,23 @@ static u32 tis_waitrespready(enum tpmDurationType to_t)
return rc;
}
+#define CRB_STATE_VALID_STS 0b10000000
+
/* if device is not there, return '0', '1' otherwise */
static u32 crb_probe(void)
{
if (!CONFIG_TCGBIOS)
return 0;
+ /* request access -- this must cause a valid STS flag */
+ writeb(CRB_REG(0, CRB_REG_LOC_CTRL), 1);
+
+ /* Wait for the interface to report it's ready */
+ u32 rc = crb_wait_reg(0, CRB_REG_LOC_STATE, TIS2_DEFAULT_TIMEOUT_A,
+ CRB_STATE_VALID_STS, CRB_STATE_VALID_STS);
+ if (rc)
+ return 0;
+
u32 ifaceid = readl(CRB_REG(0, CRB_REG_INTF_ID));
if ((ifaceid & 0xf) != 0xf) {
--
2.5.5
More information about the SeaBIOS
mailing list