Message ID | 20210206212343.3567308-4-sjg@chromium.org |
---|---|
State | Accepted |
Commit | 1a39ab87b7684824de83985726a2bfe535223ef1 |
Delegated to: | Tom Rini |
Headers | show |
Series | tpm: Support using TPM1 and TPM2 from a single API | expand |
On Sat, Feb 06, 2021 at 02:23:34PM -0700, Simon Glass wrote: > 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> Applied to u-boot/next, thanks!
diff --git a/lib/tpm-common.c b/lib/tpm-common.c index e4af87f76aa..4277846fdd0 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;
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> --- Changes in v4: - Use uint type for size and explain it in the commit message lib/tpm-common.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)