diff options
author | Simon Glass <sjg@chromium.org> | 2021-02-06 14:23:34 -0700 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-03-02 11:26:27 -0500 |
commit | 63d499cee0ad2810d64908bba5feb5d19461edbc (patch) | |
tree | 9c21254963d325f13fdbb9cda48f3b8efcf33d30 | |
parent | 7efb1f5a4b92e9c3331c2dce4b76a26986e01c5e (diff) | |
download | u-boot-63d499cee0ad2810d64908bba5feb5d19461edbc.zip u-boot-63d499cee0ad2810d64908bba5feb5d19461edbc.tar.gz u-boot-63d499cee0ad2810d64908bba5feb5d19461edbc.tar.bz2 |
tpm: Add debugging of request in tpm_sendrecv_command()
The response is shown but not the request. Update the code to show both
if debugging is enabled.
Use a 'uint' type for size so it matches the register-word size on both
32- and 64-bit machines.
Signed-off-by: Simon Glass <sjg@chromium.org>
-rw-r--r-- | lib/tpm-common.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/tpm-common.c b/lib/tpm-common.c index e4af87f..4277846 100644 --- a/lib/tpm-common.c +++ b/lib/tpm-common.c @@ -166,6 +166,7 @@ u32 tpm_sendrecv_command(struct udevice *dev, const void *command, u8 response_buffer[COMMAND_BUFFER_SIZE]; size_t response_length; int i; + uint size; if (response) { response_length = *size_ptr; @@ -174,8 +175,13 @@ u32 tpm_sendrecv_command(struct udevice *dev, const void *command, response_length = sizeof(response_buffer); } - err = tpm_xfer(dev, command, tpm_command_size(command), - response, &response_length); + size = tpm_command_size(command); + log_debug("TPM request [size:%d]: ", size); + for (i = 0; i < size; i++) + log_debug("%02x ", ((u8 *)command)[i]); + log_debug("\n"); + + err = tpm_xfer(dev, command, size, response, &response_length); if (err < 0) return err; |