diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2016-07-30 17:40:45 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-08-01 20:02:04 -0700 |
commit | 7fbac79e9473a7766c38e682f4b0212d0aec553b (patch) | |
tree | 650aa3392cbb9fa772fd3df232b1ed83f41e327e | |
parent | b4a9135ffc66b44f60051d1fbc2d487ffff3948e (diff) | |
download | chrome-ec-7fbac79e9473a7766c38e682f4b0212d0aec553b.tar.gz |
tpm: make TPM_FW_VER register return both build and version strings
Both build string (which includes status of all firmware components of
the running image) and the firmware version string (which show
versions of various objects in the flash) are important to the user.
Let's include both of these strings into the TPM_FW_VER register
output. Buffer storing the string needs to be increased accordingly.
BRANCH=none
BUG=chrome-os-partner:55558
TEST=verified the contents of the AP firmware console log:
localhost ~ # grep cr50 /sys/firmware/log
Firmware version: RO_A: 0.0.1/84e2dde7 RO_B:* 0.0.2/13eda43f RW_A: ...
cr50_v1.1.5003-af11829+ private-cr51:v0.0.66-bd9a0fe tpm2:v0.0.259-8f3d735...
Change-Id: I67df3e810bd07053d0b7d8b6fac350253ca06bb0
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/364830
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r-- | common/tpm_registers.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/common/tpm_registers.c b/common/tpm_registers.c index 3236c7d8a5..da8b75c023 100644 --- a/common/tpm_registers.c +++ b/common/tpm_registers.c @@ -109,7 +109,13 @@ enum tpm_sts_bits { /* Used to count bytes read in version string */ static int tpm_fw_ver_index; -static uint8_t tpm_fw_ver[180]; +/* + * Used to store the full version string, which includes version of the two RO + * and two RW regions in the flash as well as the version string of the four + * cr50 image components. The number is somewhat arbitrary, calculated for the + * worst case scenario when all compontent trees are 'dirty'. + */ +static uint8_t tpm_fw_ver[260]; /* * We need to be able to report firmware version to the host, both RO and RW @@ -155,6 +161,12 @@ static void set_version_string(void) " RW_B:%s %s", (active_rw == SYSTEM_IMAGE_RW_B ? "*" : ""), system_get_version(SYSTEM_IMAGE_RW_B)); + offset = strlen(tpm_fw_ver); + if (offset == sizeof(tpm_fw_ver) - 1) + return; + + snprintf(tpm_fw_ver + offset, sizeof(tpm_fw_ver) - offset, + "\n%s", system_get_build_info()); } static void set_tpm_state(enum tpm_states state) |