summaryrefslogtreecommitdiff
path: root/src/lib/tlcl.c
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@chromium.org>2016-11-10 09:49:05 -0800
committerMartin Roth <martinroth@google.com>2016-11-11 22:15:57 +0100
commit8b5d04e1abd1d7c3b9447385b043b0d902d22a54 (patch)
treee59984f678eeefd2632667988a19bcd73478ddc9 /src/lib/tlcl.c
parentffae746c373e6e213636daaf704e619926798841 (diff)
lib/tlcl: Ensure tlcl library is initialized only once
Since tlcl library is used other than just vboot driver, ensure that the library is initialized only once per stage. BUG=chrome-os-partner:59355 BRANCH=None TEST=Verified in recovery mode on reef, tlcl library is initialized only once in romstage. Change-Id: I6245fe9ed34f5c174341b7eea8db456b45113287 Signed-off-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://review.coreboot.org/17364 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Diffstat (limited to 'src/lib/tlcl.c')
-rw-r--r--src/lib/tlcl.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lib/tlcl.c b/src/lib/tlcl.c
index ccf4e8004b..0a4706b164 100644
--- a/src/lib/tlcl.c
+++ b/src/lib/tlcl.c
@@ -14,6 +14,7 @@
* time.
*/
+#include <arch/early_variables.h>
#include <assert.h>
#include <string.h>
#include <tpm_lite/tlcl.h>
@@ -139,11 +140,20 @@ static uint32_t send(const uint8_t* command) {
/* Exported functions. */
+static uint8_t tlcl_init_done CAR_GLOBAL;
+
uint32_t tlcl_lib_init(void) {
+ uint8_t done = car_get_var(tlcl_init_done);
+ if (done)
+ return VB2_SUCCESS;
+
if (tis_init())
return VB2_ERROR_UNKNOWN;
if (tis_open())
return VB2_ERROR_UNKNOWN;
+
+ car_set_var(tlcl_init_done, 1);
+
return VB2_SUCCESS;
}