Re: [U-Boot] [PATCH v2 07/19] tpm: add possible traces to analyze buffers returned by the TPM

2018-04-28 Thread Miquel Raynal
Hi Simon,

On Fri, 30 Mar 2018 06:42:10 +0800, Simon Glass 
wrote:

> On 29 March 2018 at 15:43, Miquel Raynal  wrote:
> > When debugging, it is welcome to get more information about what the TPM
> > returns. Add the possibility to print the packets received to show their
> > exact content.
> >
> > Signed-off-by: Miquel Raynal 
> > ---
> >  lib/tpm.c | 12 +++-
> >  1 file changed, 11 insertions(+), 1 deletion(-)  
> 
> Reviewed-by: Simon Glass 
> 
> You might consider using the new logging support for this? See log.h

Ok, I used log() instead of debug().

Thanks,
Miquèl

> 
> - Simon



-- 
Miquel Raynal, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 07/19] tpm: add possible traces to analyze buffers returned by the TPM

2018-03-29 Thread Simon Glass
On 29 March 2018 at 15:43, Miquel Raynal  wrote:
> When debugging, it is welcome to get more information about what the TPM
> returns. Add the possibility to print the packets received to show their
> exact content.
>
> Signed-off-by: Miquel Raynal 
> ---
>  lib/tpm.c | 12 +++-
>  1 file changed, 11 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass 

You might consider using the new logging support for this? See log.h

- Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 07/19] tpm: add possible traces to analyze buffers returned by the TPM

2018-03-29 Thread Miquel Raynal
When debugging, it is welcome to get more information about what the TPM
returns. Add the possibility to print the packets received to show their
exact content.

Signed-off-by: Miquel Raynal 
---
 lib/tpm.c | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/lib/tpm.c b/lib/tpm.c
index 2b329145be..aa46ec1693 100644
--- a/lib/tpm.c
+++ b/lib/tpm.c
@@ -249,6 +249,7 @@ static uint32_t tpm_sendrecv_command(const void *command,
int err, ret;
uint8_t response_buffer[COMMAND_BUFFER_SIZE];
size_t response_length;
+   int i;
 
if (response) {
response_length = *size_ptr;
@@ -260,15 +261,24 @@ static uint32_t tpm_sendrecv_command(const void *command,
ret = uclass_first_device_err(UCLASS_TPM, );
if (ret)
return ret;
+
err = tpm_xfer(dev, command, tpm_command_size(command),
   response, _length);
 
if (err < 0)
return TPM_LIB_ERROR;
+
if (size_ptr)
*size_ptr = response_length;
 
-   return tpm_return_code(response);
+   ret = tpm_return_code(response);
+
+   debug("TPM response [ret:%d]: ", ret);
+   for (i = 0; i < response_length; i++)
+   debug("%02x ", ((u8 *)response)[i]);
+   debug("\n");
+
+   return ret;
 }
 
 int tpm_set_specification(int version)
-- 
2.14.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot