aboutsummaryrefslogtreecommitdiffstats
path: root/src/hw/tpm_drivers.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/hw/tpm_drivers.c')
-rw-r--r--src/hw/tpm_drivers.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/hw/tpm_drivers.c b/src/hw/tpm_drivers.c
index ed58bf58..7e6a96a4 100644
--- a/src/hw/tpm_drivers.c
+++ b/src/hw/tpm_drivers.c
@@ -374,12 +374,22 @@ static u32 tis_waitrespready(enum tpmDurationType to_t)
return rc;
}
+#define CRB_STATE_VALID_STS 0b10000000
+#define CRB_STATE_LOC_ASSIGNED 0x00000010
+#define CRB_STATE_READY_MASK (CRB_STATE_VALID_STS | CRB_STATE_LOC_ASSIGNED)
+
/* if device is not there, return '0', '1' otherwise */
static u32 crb_probe(void)
{
if (!CONFIG_TCGBIOS)
return 0;
+ /* Wait for the interface to report it's ready */
+ u32 rc = crb_wait_reg(0, CRB_REG_LOC_STATE, TIS2_DEFAULT_TIMEOUT_D,
+ CRB_STATE_READY_MASK, CRB_STATE_VALID_STS);
+ if (rc)
+ return 0;
+
u32 ifaceid = readl(CRB_REG(0, CRB_REG_INTF_ID));
if ((ifaceid & 0xf) != 0xf) {