diff options
Diffstat (limited to 'src/drivers/tpm/cr50.c')
-rw-r--r-- | src/drivers/tpm/cr50.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/drivers/tpm/cr50.c b/src/drivers/tpm/cr50.c index 887cf767b7..1724b8d0f6 100644 --- a/src/drivers/tpm/cr50.c +++ b/src/drivers/tpm/cr50.c @@ -3,6 +3,7 @@ #include <drivers/spi/tpm/tpm.h> #include <security/tpm/tis.h> #include <string.h> +#include <timer.h> #include <types.h> #define CR50_DID_VID 0x00281ae0L @@ -234,3 +235,18 @@ success: *version = cr50_firmware_version; return CB_SUCCESS; } + +enum cb_err cr50_wait_tpm_ready(void) +{ + struct stopwatch sw; + + stopwatch_init_msecs_expire(&sw, CONFIG_GOOGLE_TPM_IRQ_TIMEOUT_MS); + + while (!tis_plat_irq_status()) + if (stopwatch_expired(&sw)) { + printk(BIOS_ERR, "Cr50 TPM IRQ timeout!\n"); + return CB_ERR; + } + + return CB_SUCCESS; +} |