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 X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68044C4338F for ; Fri, 6 Aug 2021 04:45:21 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id A17C1611C6 for ; Fri, 6 Aug 2021 04:45:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A17C1611C6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E607082D93; Fri, 6 Aug 2021 06:45:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1628225119; bh=uVLUirjlGWop1Pcn6LAeo/Khx8voR78UIzQypFxP//U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ONiNZjeUR6RKH8qEgzJhPabvsk4OWBevQZ6S1XgCetGjvbsUuanKkcqdwTmuE4C/M bkzhD1j2iEFXWmBbeG6GAw503CGdvUxUZ4sjsbl+q8IBsSfvJo5ssiZ/A0sQCAXWE0 QHg+LUyJteW9QqGOqyrPJpIrz1kgB3kvC9j2Xj9GGor/GSZwGkJxm5sxkCMfHbWf2X n2OVzbrGvl6WvDiCp+/h8kFMrgdh5K6yxJzh+U1Kl8HX2dW5moJ4kaMrByTHgdznNj c6HpdmmbTBXSTn6+NbDvYIiT0nkd3NgwOcFZbhDPHeSgddTu1X0h6Q8KrAbzvzJhbj gi1ae0nGsYq2A== Received: from mail-internal.denx.de (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: noc@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id B540A829E2 for ; Fri, 6 Aug 2021 06:45:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1628225116; bh=uVLUirjlGWop1Pcn6LAeo/Khx8voR78UIzQypFxP//U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m5cnpFb4r6hvFN+Sq8aFC0c0RaOoJ/g5Z+18C4Q6F4tWNjU8uoBfFoJJX8eQ1JIt3 p9KAFUSd8rMzPOkmPKwFFMDoXX6XMRbKYRaorgJdsSDCXRjm0QUwgyAFhsfQJdwoG/ jpQJbDcPkSAXHBkOLD0Z3h7qdFwxHViQGYkcaRQngwvtcIkABxnHcuiDZymUKJaDc1 mUXIVbDU1cT2IrBlUXmtLqVZ3RDEtR6S27AevqyF9jeIGyH4iw/lAPwKkiBg+9rH3k IBF3x/AdPda0u3thJluTtDlA63jNeMJVriMoPRiKJl+9Dl5Rn9Kj3IuNeX8OG97zOU GwJPPo2X/yJVw== Received: from pollux.denx.de (pollux [192.168.1.1]) by mail-internal.denx.de (Postfix) with ESMTP id 59A19187392; Fri, 6 Aug 2021 06:44:34 +0200 (CEST) Received: by pollux.denx.de (Postfix, from userid 515) id 6AFCD1A009F; Fri, 6 Aug 2021 06:44:32 +0200 (CEST) From: Heiko Schocher To: u-boot@lists.denx.de, Stefano Babic Cc: Tim Harvey , Heiko Schocher , Fabio Estevam , "NXP i.MX U-Boot Team" Subject: [PATCH v1 2/2] imx: spl: implement spl_load_simple_fit_fix_load Date: Fri, 6 Aug 2021 06:44:27 +0200 Message-Id: <20210806044427.1958686-3-hs@denx.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210806044427.1958686-1-hs@denx.de> References: <20210806044427.1958686-1-hs@denx.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean read the address where the IVT header must sit from IVT image header, loaded from SPL into an malloced buffer and copy the IVT header to this address May make this dependend on SoC ? Signed-off-by: Heiko Schocher --- arch/arm/mach-imx/spl.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c index 36033d611c..cc29f337d7 100644 --- a/arch/arm/mach-imx/spl.c +++ b/arch/arm/mach-imx/spl.c @@ -345,3 +345,36 @@ int dram_init_banksize(void) return 0; } #endif + +/* + * read the address where the IVT header must sit + * from IVT image header, loaded from SPL into + * an malloced buffer and copy the IVT header + * to this address + */ +void *spl_load_simple_fit_fix_load(void *fit) +{ + struct ivt *ivt; + unsigned long new; + unsigned long offset; + unsigned long size; + u8 *tmp = (u8 *)fit; + + offset = ALIGN(fdt_totalsize(fit), 0x1000); + size = ALIGN(fdt_totalsize(fit), 4); + size = board_spl_fit_size_align(size); + tmp += offset; + ivt = (struct ivt *)tmp; + if (ivt->hdr.magic != IVT_HEADER_MAGIC) { + debug("no IVT header found\n"); + return fit; + } + debug("%s: ivt: %p offset: %lx size: %lx\n", __func__, ivt, offset, size); + debug("%s: ivt self: %x\n", __func__, ivt->self); + new = ivt->self; + new -= offset; + debug("%s: new %lx\n", __func__, new); + memcpy((void *)new, fit, size); + + return (void *)new; +} -- 2.31.1