From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ilias Apalodimas Date: Mon, 25 Jan 2021 10:28:38 +0200 Subject: [PATCH v3 03/11] tpm: Add debugging of request in tpm_sendrecv_command() In-Reply-To: <20210123172607.2879600-4-sjg@chromium.org> References: <20210123172607.2879600-1-sjg@chromium.org> <20210123172607.2879600-4-sjg@chromium.org> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Sat, Jan 23, 2021 at 10:25:59AM -0700, Simon Glass wrote: > The response is shown but not the request. Update the code to show both > if debugging is enabled. > > Signed-off-by: Simon Glass > --- > > (no changes since v1) > > lib/tpm-common.c | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/lib/tpm-common.c b/lib/tpm-common.c > index e4af87f76aa..0255d3bd9cf 100644 > --- a/lib/tpm-common.c > +++ b/lib/tpm-common.c > @@ -165,7 +165,7 @@ u32 tpm_sendrecv_command(struct udevice *dev, const void *command, > int err, ret; > u8 response_buffer[COMMAND_BUFFER_SIZE]; > size_t response_length; > - int i; > + int i, size; > > if (response) { > response_length = *size_ptr; > @@ -174,8 +174,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); tpm_command_size is u32. Is there a the declaration here is int for size? > + 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; > -- > 2.30.0.280.ga3ce27912f-goog >