diff options
author | Andrey Pronin <apronin@google.com> | 2016-07-22 19:33:07 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-07-26 23:54:27 -0700 |
commit | c37f0f82056adca65de7b99419663dff437365c1 (patch) | |
tree | 85b1d7a8539aeea78b463357dea24ee7cdf0b4fc /utility | |
parent | 98263a1b17397032b3f7d747d48f8fd914217237 (diff) | |
download | vboot-c37f0f82056adca65de7b99419663dff437365c1.tar.gz |
tlcl: automatically detect if platform hierarchy is disabled
Instead of passing a special flag when 'tpmc' starts, auto-detect
if platform hierarchy is disabled in TlclLibInit(). See discussion
in https://chromium-review.googlesource.com/#/c/362520/.
BRANCH=none
BUG=chrome-os-partner:55210
BUG=chrome-os-partner:55250
TEST=boot on kevin, verify that 'tpmc read 0x1008 0xd' works
Change-Id: Id94e7faadf835f7ea58a944e914163d6849e85c1
Reviewed-on: https://chromium-review.googlesource.com/362771
Commit-Ready: Andrey Pronin <apronin@chromium.org>
Tested-by: Andrey Pronin <apronin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'utility')
-rw-r--r-- | utility/tpmc.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/utility/tpmc.c b/utility/tpmc.c index f621661e..beb739f9 100644 --- a/utility/tpmc.c +++ b/utility/tpmc.c @@ -491,6 +491,8 @@ static int n_commands = sizeof(command_table) / sizeof(command_table[0]); int main(int argc, char* argv[]) { char *progname; + uint32_t result; + progname = strrchr(argv[0], '/'); if (progname) progname++; @@ -515,8 +517,11 @@ int main(int argc, char* argv[]) { return 0; } - TlclLibInit(); - TlclLibAccessAsUser(); + result = TlclLibInit(); + if (result) { + fprintf(stderr, "initialization failed with code %d\n", result); + return result > OTHER_ERROR ? OTHER_ERROR : result; + } for (c = command_table; c < command_table + n_commands; c++) { if (strcmp(cmd, c->name) == 0 || strcmp(cmd, c->abbr) == 0) { |