]> git.baikalelectronics.ru Git - uboot.git/commitdiff
tools: kwbimage: Fix dumping DATA registers for v0 images
authorPali Rohár <pali@kernel.org>
Sun, 13 Feb 2022 00:04:33 +0000 (01:04 +0100)
committerStefan Roese <sr@denx.de>
Thu, 17 Feb 2022 13:17:07 +0000 (14:17 +0100)
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: 7a800b3de2da ("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>
tools/kwbimage.c

index 9b63ce80ff4e42bd14239a56ff1a7fb017be2a79..99d38cd1cfb231528acbcf6f2c22281beaea2448 100644 (file)
@@ -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");
                }
        }