From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8565EC433EF for ; Sun, 13 Feb 2022 00:05:04 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5A99883095; Sun, 13 Feb 2022 01:05:01 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="i3bMSzaR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 967C481980; Sun, 13 Feb 2022 01:04:59 +0100 (CET) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 93A1881980 for ; Sun, 13 Feb 2022 01:04:56 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0576FB8077C; Sun, 13 Feb 2022 00:04:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8047AC340EF; Sun, 13 Feb 2022 00:04:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644710694; bh=1hTKVdzA9KEYRap64dLkkqLvb5CqHbk0M8XNUHzQtZk=; h=From:To:Cc:Subject:Date:From; b=i3bMSzaRQccdgmMaIloT4aXxrmJDMOGpYOTOTE4Oueqm7sAyL2hUXhbppafYyvTwv 67wi8RiPJUFF4s5+4r3kWq1GBcdY+ZEO9c8JtX2b2NRxj1mvhyqO4I0R73JCmLXO/i k2se/HGwGptgS7iRnJK/YNWrjEnumxLo0i9PHvH3366uglbIvNU08xChQSKMlN9jDW 96CQeK0Ap8kvDLipkGVJMnq0FxzsdgEf2p0fDSzwU9xJrQW/UUuL3Pvx4ynYPjrFKI K2Pd8JVKxUWyOZPpiM5lReaQEb3ob1QTlcWIZ9C3wi4K036yMkC+S9Q7nP98O+bCED N+1WYLc9nqnyA== Received: by pali.im (Postfix) id AC56DAA6; Sun, 13 Feb 2022 01:04:51 +0100 (CET) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Stefan Roese Cc: =?UTF-8?q?Marek=20Beh=C3=BAn?= , Tony Dinh , u-boot@lists.denx.de Subject: [PATCH] tools: kwbimage: Fix dumping DATA registers for v0 images Date: Sun, 13 Feb 2022 01:04:33 +0100 Message-Id: <20220213000433.16131-1-pali@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean 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 Reported-by: Tony Dinh Tested-by: Tony Dinh --- 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