trunks: ftdi: implement SendAndWait
To send a command to the TPM FIFO the master is supposed to first
inform the TPM about the incoming command. The spec states that the
TPM *may* reply to this with setting the .Expect bit in the status
register. The Infineon device this code was tested with does not set
this bit, so its polling is not implemented.
TPM status register also allows to check when the device has finished
processing the command and the response is ready in the FIFO register.
This patch adds the code which follows this protocol: sends a command
to the TPM and then expects the response by polling the status
register. A method is being added to poll the status register for a
certain state, and a bug in ReadTpmSts() is fixed.
BUG=chromium:498861
TEST=after connecting the TPM2 setup using the USB-FTDI-SPI dongle run
the following commands inside chroot:
$ sudo emerge trunks
# suppressed portage output here....
$ sudo trunks_client --ftdi --startup
Connected to device vid:did:rid of 15d1:001b:10
$
Change-Id: I315f2b873d87d6c4730aa0d3e13ebaa124ce58ff
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/277318
Reviewed-by: Utkarsh Sanghi <usanghi@chromium.org>
Commit-Queue: Bill Richardson <wfrichar@chromium.org>
Trybot-Ready: Bill Richardson <wfrichar@chromium.org>
2 files changed