[coreboot-gerrit] New patch to review for coreboot: tpm: use 4 byte quantities when retrieving firmware version
Martin Roth (martinroth@google.com)
gerrit at coreboot.org
Fri Jul 8 00:28:03 CEST 2016
Martin Roth (martinroth at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15580
-gerrit
commit 500837c19b2e49d87798aee54af3df10e8e32705
Author: Vadim Bendebury <vbendeb at chromium.org>
Date: Mon Jun 27 19:05:41 2016 -0700
tpm: use 4 byte quantities when retrieving firmware version
The CR50 device is capable of reporting its firmware version in 4 byte
quantities, but the recently introduced code retrieves the version one
byte at a time.
With this fix the version is retrieved in 4 byte chunks.
BRANCH=none
BUG=none
TEST=the version is still reported properly, as reported by the AP
firmware console log:
localhost ~ # grep cr50 /sys/firmware/log
Firmware version: cr50_v1.1.4804-c64cf24
localhost ~ #
Change-Id: Ia7461b758be2287e69a1ba6f038c257f50338199
Signed-off-by: Martin Roth <martinroth at chromium.org>
Original-Commit-Id: 3111537e7b66d8507b6608ef665e4cde76403818
Original-Change-Id: I04116881a30001e35e989e51ec1567263f9149a6
Original-Signed-off-by: Vadim Bendebury <vbendeb at chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/356542
Original-Reviewed-by: Andrey Pronin <apronin at chromium.org>
---
src/drivers/spi/tpm/tpm.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/drivers/spi/tpm/tpm.c b/src/drivers/spi/tpm/tpm.c
index 1b43bfb..4de62d9 100644
--- a/src/drivers/spi/tpm/tpm.c
+++ b/src/drivers/spi/tpm/tpm.c
@@ -359,7 +359,8 @@ int tpm2_init(struct spi_slave *spi_if)
/* Let's report device FW version if available. */
if (tpm_info.vendor_id == 0x1ae0) {
int chunk_count = 0;
- char vstr[sizeof(cmd) + 1]; /* room for 4 chars + zero */
+ uint32_t chunk = 0;
+ char vstr[sizeof(chunk) + 1]; /* room for 4 chars + zero */
printk(BIOS_INFO, "Firmware version: ");
@@ -367,12 +368,12 @@ int tpm2_init(struct spi_slave *spi_if)
* Does not really matter what's written, this just makes sure
* the version is reported from the beginning.
*/
- tpm2_write_reg(TPM_FW_VER, &cmd, sizeof(cmd));
+ tpm2_write_reg(TPM_FW_VER, &chunk, sizeof(chunk));
/* Print it out in 4 byte chunks. */
vstr[sizeof(vstr) - 1] = 0;
do {
- tpm2_read_reg(TPM_FW_VER, vstr, sizeof(cmd));
+ tpm2_read_reg(TPM_FW_VER, vstr, sizeof(chunk));
printk(BIOS_INFO, "%s", vstr);
/*
@@ -381,7 +382,7 @@ int tpm2_init(struct spi_slave *spi_if)
* This is likely result in one extra printk()
* invocation with an empty string, not a big deal.
*/
- } while (vstr[0] && (chunk_count++ < (200 / sizeof(cmd))));
+ } while (vstr[0] && (chunk_count++ < (200 / sizeof(chunk))));
printk(BIOS_INFO, "\n");
}
More information about the coreboot-gerrit
mailing list