All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools: kwbimage: Fix dumping DATA registers for v0 images
@ 2022-02-13  0:04 Pali Rohár
  2022-02-15 11:07 ` Stefan Roese
  2022-02-17 15:36 ` Stefan Roese
  0 siblings, 2 replies; 3+ messages in thread
From: Pali Rohár @ 2022-02-13  0:04 UTC (permalink / raw)
  To: Stefan Roese; +Cc: Marek Behún, Tony Dinh, u-boot

End of DATA register section is indicated by zero value in both raddr and
rdata.

So do not stop dumping registers with non-zero address and zero value.
And also print end of DATA registers section.

Fixes: 1a8e6b63e24f ("tools: kwbimage: Dump kwbimage config file on '-p -1' option")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reported-by: Tony Dinh <mibodhi@gmail.com>
Tested-by: Tony Dinh <mibodhi@gmail.com>
---
 tools/kwbimage.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/kwbimage.c b/tools/kwbimage.c
index 9b63ce80ff4e..99d38cd1cfb2 100644
--- a/tools/kwbimage.c
+++ b/tools/kwbimage.c
@@ -2226,11 +2226,13 @@ static int kwbimage_generate_config(void *ptr, struct image_tool_params *params)
 		ehdr0 = (struct ext_hdr_v0 *)(mhdr0 + 1);
 		if (ehdr0->offset) {
 			for (regdata = (struct ext_hdr_v0_reg *)((uint8_t *)ptr + ehdr0->offset);
-			     (uint8_t *)regdata < (uint8_t *)ptr + header_size && regdata->raddr &&
-			     regdata->rdata;
+			     (uint8_t *)regdata < (uint8_t *)ptr + header_size &&
+			     (regdata->raddr || regdata->rdata);
 			     regdata++)
 				fprintf(f, "DATA 0x%08x 0x%08x\n", le32_to_cpu(regdata->raddr),
 					le32_to_cpu(regdata->rdata));
+			if ((uint8_t *)regdata != (uint8_t *)ptr + ehdr0->offset)
+				fprintf(f, "DATA 0x0 0x0\n");
 		}
 	}
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] tools: kwbimage: Fix dumping DATA registers for v0 images
  2022-02-13  0:04 [PATCH] tools: kwbimage: Fix dumping DATA registers for v0 images Pali Rohár
@ 2022-02-15 11:07 ` Stefan Roese
  2022-02-17 15:36 ` Stefan Roese
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Roese @ 2022-02-15 11:07 UTC (permalink / raw)
  To: Pali Rohár; +Cc: Marek Behún, Tony Dinh, u-boot

On 2/13/22 01:04, Pali Rohár wrote:
> End of DATA register section is indicated by zero value in both raddr and
> rdata.
> 
> So do not stop dumping registers with non-zero address and zero value.
> And also print end of DATA registers section.
> 
> Fixes: 1a8e6b63e24f ("tools: kwbimage: Dump kwbimage config file on '-p -1' option")
> Signed-off-by: Pali Rohár <pali@kernel.org>
> Reported-by: Tony Dinh <mibodhi@gmail.com>
> Tested-by: Tony Dinh <mibodhi@gmail.com>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
>   tools/kwbimage.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/kwbimage.c b/tools/kwbimage.c
> index 9b63ce80ff4e..99d38cd1cfb2 100644
> --- a/tools/kwbimage.c
> +++ b/tools/kwbimage.c
> @@ -2226,11 +2226,13 @@ static int kwbimage_generate_config(void *ptr, struct image_tool_params *params)
>   		ehdr0 = (struct ext_hdr_v0 *)(mhdr0 + 1);
>   		if (ehdr0->offset) {
>   			for (regdata = (struct ext_hdr_v0_reg *)((uint8_t *)ptr + ehdr0->offset);
> -			     (uint8_t *)regdata < (uint8_t *)ptr + header_size && regdata->raddr &&
> -			     regdata->rdata;
> +			     (uint8_t *)regdata < (uint8_t *)ptr + header_size &&
> +			     (regdata->raddr || regdata->rdata);
>   			     regdata++)
>   				fprintf(f, "DATA 0x%08x 0x%08x\n", le32_to_cpu(regdata->raddr),
>   					le32_to_cpu(regdata->rdata));
> +			if ((uint8_t *)regdata != (uint8_t *)ptr + ehdr0->offset)
> +				fprintf(f, "DATA 0x0 0x0\n");
>   		}
>   	}
>   

Viele Grüße,
Stefan Roese

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] tools: kwbimage: Fix dumping DATA registers for v0 images
  2022-02-13  0:04 [PATCH] tools: kwbimage: Fix dumping DATA registers for v0 images Pali Rohár
  2022-02-15 11:07 ` Stefan Roese
@ 2022-02-17 15:36 ` Stefan Roese
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Roese @ 2022-02-17 15:36 UTC (permalink / raw)
  To: Pali Rohár; +Cc: Marek Behún, Tony Dinh, u-boot

On 2/13/22 01:04, Pali Rohár wrote:
> End of DATA register section is indicated by zero value in both raddr and
> rdata.
> 
> So do not stop dumping registers with non-zero address and zero value.
> And also print end of DATA registers section.
> 
> Fixes: 1a8e6b63e24f ("tools: kwbimage: Dump kwbimage config file on '-p -1' option")
> Signed-off-by: Pali Rohár <pali@kernel.org>
> Reported-by: Tony Dinh <mibodhi@gmail.com>
> Tested-by: Tony Dinh <mibodhi@gmail.com>

Applied to u-boot-marvell/master

Thanks,
Stefan

> ---
>   tools/kwbimage.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/kwbimage.c b/tools/kwbimage.c
> index 9b63ce80ff4e..99d38cd1cfb2 100644
> --- a/tools/kwbimage.c
> +++ b/tools/kwbimage.c
> @@ -2226,11 +2226,13 @@ static int kwbimage_generate_config(void *ptr, struct image_tool_params *params)
>   		ehdr0 = (struct ext_hdr_v0 *)(mhdr0 + 1);
>   		if (ehdr0->offset) {
>   			for (regdata = (struct ext_hdr_v0_reg *)((uint8_t *)ptr + ehdr0->offset);
> -			     (uint8_t *)regdata < (uint8_t *)ptr + header_size && regdata->raddr &&
> -			     regdata->rdata;
> +			     (uint8_t *)regdata < (uint8_t *)ptr + header_size &&
> +			     (regdata->raddr || regdata->rdata);
>   			     regdata++)
>   				fprintf(f, "DATA 0x%08x 0x%08x\n", le32_to_cpu(regdata->raddr),
>   					le32_to_cpu(regdata->rdata));
> +			if ((uint8_t *)regdata != (uint8_t *)ptr + ehdr0->offset)
> +				fprintf(f, "DATA 0x0 0x0\n");
>   		}
>   	}
>   

Viele Grüße,
Stefan Roese

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-17 15:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-13  0:04 [PATCH] tools: kwbimage: Fix dumping DATA registers for v0 images Pali Rohár
2022-02-15 11:07 ` Stefan Roese
2022-02-17 15:36 ` Stefan Roese

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.