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 73D57C61DA3 for ; Tue, 21 Feb 2023 20:27:36 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8877980BA2; Tue, 21 Feb 2023 21:23:37 +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="TZhGbrXb"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DC7B685A5A; Tue, 21 Feb 2023 21:22:57 +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 3898385A89 for ; Tue, 21 Feb 2023 21:22:33 +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 0CA79B810C3; Tue, 21 Feb 2023 20:22:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68EEBC433AE; Tue, 21 Feb 2023 20:22:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1677010951; bh=wDb+mPZhs4QwSTF4gAUakj6PCsI08GoVRPIhySksTaY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TZhGbrXbwf7uJXljqvDZApvl/LsJWqJEF6SFnrLWlJCVmCOTWdSWX/vhKzqjRifb1 kGKtiywKsNb7pPjOGlFRcezuXuU81AIC0SM8GLgqOXj/WkYp4DiNKo7kZOSajW5Sjk mKE4znlIerhnir69PS8FF1N7AdvhM44X5dp6/vd8BfHjoELFFuxBQLwHcV1rDauPW7 JhXgXKhgp9ed+0DmabNw3Ugt+jC55THsSdgo61Q+XumSGYuIMNgqcioRCofw8HsEht Tb8iBs3ArJ3/oa+nMzIpKlhCUgV3cEAduqrutRD/KawHCrd6dyw0LJI7rGtUpGOSNc LD67IOeGHF4TA== Received: by pali.im (Postfix) id 225722B8B; Tue, 21 Feb 2023 21:22:30 +0100 (CET) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: u-boot@lists.denx.de Cc: Stefan Roese , Tony Dinh , Josua Mayer Subject: [PATCH RFC u-boot-mvebu 18/59] tools: kwboot: Fix patching of SPI/NOR XIP images Date: Tue, 21 Feb 2023 21:18:44 +0100 Message-Id: <20230221201925.9644-19-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230221201925.9644-1-pali@kernel.org> References: <20230221201925.9644-1-pali@kernel.org> 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.6 at phobos.denx.de X-Virus-Status: Clean Marvell BootROM interprets execaddr of SPI/NOR XIP images as relative byte offset from the from the beginning of the flash device. So if data image offset and execute offset are not same then it is needed to adjust them also in DDR RAM. Fixes: f2c644e0b8bc ("tools: kwboot: Patch destination address to DDR area for SPI image") Signed-off-by: Pali Rohár --- tools/kwboot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/kwboot.c b/tools/kwboot.c index f624edc7798f..cb31d5b858ce 100644 --- a/tools/kwboot.c +++ b/tools/kwboot.c @@ -2022,8 +2022,8 @@ kwboot_img_patch(void *img, size_t *size, int baudrate) case IBR_HDR_SPI_ID: if (hdr->destaddr == cpu_to_le32(0xFFFFFFFF)) { kwboot_printv("Patching destination and execution addresses from SPI/NOR XIP area to DDR area 0x00800000\n"); - hdr->destaddr = cpu_to_le32(0x00800000); - hdr->execaddr = cpu_to_le32(0x00800000); + hdr->destaddr = cpu_to_le32(0x00800000 + le32_to_cpu(hdr->srcaddr)); + hdr->execaddr = cpu_to_le32(0x00800000 + le32_to_cpu(hdr->execaddr)); } break; } -- 2.20.1