From 6b24cff09b236394f1cd616618c3548c8aa9655e Mon Sep 17 00:00:00 2001 From: Vadim Bendebury Date: Sat, 30 Jul 2016 17:45:31 -0700 Subject: [PATCH] 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 Reviewed-on: https://chromium-review.googlesource.com/364831 Reviewed-by: Bill Richardson --- common/tpm_registers.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/common/tpm_registers.c b/common/tpm_registers.c index b7ae24edde..3236c7d8a5 100644 --- a/common/tpm_registers.c +++ b/common/tpm_registers.c @@ -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