trunksd: do not disable platform hierarchy on startup

Currently trunksd examines at startup the state of the TPM and
proceeds to disable Platform Hierarchy in case it was not disabled by
the firmware.

But the only case Platform Hierarchy is not disabled by the firmware
is when the device is booted in recovery mode, and TPM needs to be
available to recovering.

Let's not invoke TpmUtilityImpl::InitializeTpm() in the course of
trunksd initialization, introduce instead a function which would check
current state of the TPM and report warnings as appropriate.

Separate driver initialization and some basic checks into a private
function to be used by both InitializeTpm() and CheckState().

The only reason to report the state failure is failure to initialize
the driver.

BUG=chrome-os-partner:55210
BUG=b:71884828
TEST=verified that it is now possible to write into firmware and
     kernel spaces after stopping trunksd in recovery mode. It is
     still not possible to write into the spaces in normal and
     developer modes.

     It is still possible to login to a reef device running this new
     trunksd.

Change-Id: I12114439d061a5419a63329871cb8027b1d89bbd
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/407538
Reviewed-by: Darren Krahn <dkrahn@chromium.org>
Reviewed-by: Andrey Pronin <apronin@chromium.org>
(cherry picked from commit c06b57117c840a15e93dbe5cd34ce6c44f477ada)
6 files changed