tpm: allow TPM_FW_VER register to return arbitrary number of bytes

As the version string grows longer, reading it in 4 byte chunks
becomes more and more expensive, the overhead of setting up a separate
SPI transaction per very chunk is just too much.

There is no reason not to allow the host to read as many bytes at a
time as it requires (limiting it by the maximum version string buffer
size of course).

BRANCH=none
BUG=chrome-os-partner:55558
TEST=verified that the version string is still read properly by the
     TPM driver on Kevin

Change-Id: Ib76cd151e8dc32374f87135af36266b4ec725a56
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/364831
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
This commit is contained in:
Vadim Bendebury
2016-07-30 17:45:31 -07:00
committed by chrome-bot
parent 45e7be2213
commit 6b24cff09b

View File

@@ -464,8 +464,6 @@ void tpm_register_get(uint32_t regaddr, uint8_t *dest, uint32_t data_size)
fifo_reg_read(dest, data_size);
break;
case TPM_FW_VER:
/* Make sure no more than 4 bytes are read */
data_size = MIN(4, data_size);
for (i = 0; i < data_size; i++) {
/*
* Only read while the index remains less than the