summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-11-06 15:21:23 -0700
committerSimon Glass <sjg@chromium.org>2018-11-20 19:14:22 -0700
commit04488c4d15189a05674962eba890396b498731cc (patch)
tree33e3588ae333135cd60b98dccea3d4186cd4df33
parent72ef8bfd6dd83412577f9c5da8a5b6bec5c22182 (diff)
sandbox: tpm: Allow debugging of data packages
This is not normally useful, so change the code to avoid writing out every data package. This can be enabled with #define DEBUG. Signed-off-by: Simon Glass <sjg@chromium.org>
-rw-r--r--drivers/tpm/tpm_tis_sandbox.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/tpm/tpm_tis_sandbox.c b/drivers/tpm/tpm_tis_sandbox.c
index 79517f015a..3336f559e5 100644
--- a/drivers/tpm/tpm_tis_sandbox.c
+++ b/drivers/tpm/tpm_tis_sandbox.c
@@ -187,9 +187,11 @@ static int sandbox_tpm_xfer(struct udevice *dev, const uint8_t *sendbuf,
code = get_unaligned_be32(sendbuf + sizeof(uint16_t) +
sizeof(uint32_t));
+#ifdef DEBUG
printf("tpm: %zd bytes, recv_len %zd, cmd = %x\n", send_size,
*recv_len, code);
print_buffer(0, sendbuf, 1, send_size, 0);
+#endif
switch (code) {
case TPM_CMD_GET_CAPABILITY:
type = get_unaligned_be32(sendbuf + 14);
@@ -306,6 +308,10 @@ static int sandbox_tpm_xfer(struct udevice *dev, const uint8_t *sendbuf,
printf("Unknown tpm command %02x\n", code);
return -ENOSYS;
}
+#ifdef DEBUG
+ printf("tpm: rx recv_len %zd\n", *recv_len);
+ print_buffer(0, recvbuf, 1, *recv_len, 0);
+#endif
return 0;
}