mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
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: I04116881a30001e35e989e51ec1567263f9149a6 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/356542 Reviewed-by: Andrey Pronin <apronin@chromium.org>
This commit is contained in:
parent
63a224d6f4
commit
3111537e7b
1 changed files with 5 additions and 4 deletions
|
@ -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");
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue