aboutsummaryrefslogtreecommitdiff
path: root/lib/tpm_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tpm_api.c')
-rw-r--r--lib/tpm_api.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/tpm_api.c b/lib/tpm_api.c
index 7e8df87..3ef5e81 100644
--- a/lib/tpm_api.c
+++ b/lib/tpm_api.c
@@ -35,6 +35,27 @@ u32 tpm_startup(struct udevice *dev, enum tpm_startup_type mode)
}
}
+u32 tpm_auto_start(struct udevice *dev)
+{
+ u32 rc;
+
+ /*
+ * the tpm_init() will return -EBUSY if the init has already happened
+ * The selftest and startup code can run multiple times with no side
+ * effects
+ */
+ rc = tpm_init(dev);
+ if (rc && rc != -EBUSY)
+ return rc;
+
+ if (tpm_is_v1(dev))
+ return tpm1_auto_start(dev);
+ else if (tpm_is_v2(dev))
+ return tpm2_auto_start(dev);
+ else
+ return -ENOSYS;
+}
+
u32 tpm_resume(struct udevice *dev)
{
if (tpm_is_v1(dev))