From patchwork Fri Dec 17 15:41:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 1570128 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=denx.de header.i=@denx.de header.a=rsa-sha256 header.s=phobos-20191101 header.b=pVPP4VJP; dkim=pass (2048-bit key) header.d=denx.de header.i=@denx.de header.a=rsa-sha256 header.s=phobos-20191101 header.b=P+D++rAP; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JFtWs3LPsz9sR4 for ; Sat, 18 Dec 2021 02:42:01 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B208F8305D; Fri, 17 Dec 2021 16:41:55 +0100 (CET) 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=1639755715; bh=S1+lkeHFveWV8t4riKhUqSgIAw+J2a5diJA7C5ngfN0=; h=From:To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=pVPP4VJPu24DDtk+Cf1ei64C0QCE3ENMcIZIvas/PxlqjBmGGRl/LNuipRUHy68wf 3RwT0vtrBI08KS5Hr7NcvVjsriyckF4IkVhDxe0Xx6OLuU45UVUv65lOxzA8UTNQIa tYiOf3biW/vBc/DGTbKcw6uTYzYf7aPyAklSBSlb1GY7bmXoWG66qyPCZctjVfHDjH +aAiL7ws1ymQ6amREPEVZmP3w5rABpn6XgCEBU7ce7Cvr3/WB4h1h7hhNMLbDLfdVW bI6nZNBqsyg4xT5Ni0lnAkQBA5KGLkaYtGiL8J9vjAKqpzVFG2aqO3BlK2MGlAsr0r H354Vu2MJw3lg== Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: lukma@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 152A68304A; Fri, 17 Dec 2021 16:41:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1639755714; bh=S1+lkeHFveWV8t4riKhUqSgIAw+J2a5diJA7C5ngfN0=; h=From:To:Cc:Subject:Date:From; b=P+D++rAP2iC0Ly13k0SVdO10WMoY6S6GC2dW0pl7UypHNODII5v06UDcQuHBnHMqa ZGe6i5/1Z4m239oTx2TDTPLfeET113WK0u+fxl0aDSfY4Y7PAaWLdHv/MSZRxMx3Cu O8CwzaBJYu0OY85rneDqpmtk31uPe+hl5Av0BjhpF1QDZ6XSw7lPzMDgs3UVZSoUZX KMZMm8GYkVXMZJ/6n8dMgoAZS5UnRXKik/XR/b12/og637cA8AMsAqOx/5Nc6r00Hd UK4r3MNygo8MdtMK3MH0BUNUK7bx8D7PiWKFHzI7uK50lD5JkSe4JSGR1YuEHngd3H YeLZwHVluWh9Q== From: Lukasz Majewski To: Stefano Babic Cc: u-boot@lists.denx.de, Lukasz Majewski Subject: [PATCH] spl: Provide more space to be used for storing SPL on imx28 OCRAM Date: Fri, 17 Dec 2021 16:41:25 +0100 Message-Id: <20211217154125.32294-1-lukma@denx.de> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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 With the current configuration provided in mxsimage{-spl}.mx28.cfg the size of SPL binary has been constrained to 32 KiB, due to "LOAD IVT" command with 0x8000 offset. The problem was that, the imx28 ROM takes the u-boot.sb and then extracts from it the IVT header and places it on the 0x8000 OCRAM offset overwriting any valid (i.e. loaded from eMMC or SPI-NOR) SPL code. This bug was unnoticed as the overwrite size was just 32 bytes, so the probability that some important code is altered was low. However, in the XEA board (where the SPL size is ~39KiB), the overwritten data was `(struct dm_spi_ops *) 0x800c `, which is used during the boot process. As a result the SPL execution code hanged with "undefined instruction" abort as callbacks (with wrong addresses) from it were called. The fix is to change the OCRAM's offset where IVT is loaded to 0xE000, so the SPL can grow up to ~57KiB (the maximal size of OCRAM memory available is 0xE3FC). Signed-off-by: Lukasz Majewski --- arch/arm/cpu/arm926ejs/mxs/mxsimage-spl.mx28.cfg | 4 ++-- arch/arm/cpu/arm926ejs/mxs/mxsimage.mx28.cfg | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/arm/cpu/arm926ejs/mxs/mxsimage-spl.mx28.cfg b/arch/arm/cpu/arm926ejs/mxs/mxsimage-spl.mx28.cfg index 0d95064ff7f..fd09780303e 100644 --- a/arch/arm/cpu/arm926ejs/mxs/mxsimage-spl.mx28.cfg +++ b/arch/arm/cpu/arm926ejs/mxs/mxsimage-spl.mx28.cfg @@ -2,5 +2,5 @@ DISPLAYPROGRESS SECTION 0x0 BOOTABLE TAG LAST LOAD 0x1000 spl/u-boot-spl.bin - LOAD IVT 0x8000 0x1000 - CALL HAB 0x8000 0x0 + LOAD IVT 0xE000 0x1000 + CALL HAB 0xE000 0x0 diff --git a/arch/arm/cpu/arm926ejs/mxs/mxsimage.mx28.cfg b/arch/arm/cpu/arm926ejs/mxs/mxsimage.mx28.cfg index 3f7bf599248..f0f3dd7d6b1 100644 --- a/arch/arm/cpu/arm926ejs/mxs/mxsimage.mx28.cfg +++ b/arch/arm/cpu/arm926ejs/mxs/mxsimage.mx28.cfg @@ -2,8 +2,8 @@ DISPLAYPROGRESS SECTION 0x0 BOOTABLE TAG LAST LOAD 0x1000 spl/u-boot-spl.bin - LOAD IVT 0x8000 0x1000 - CALL HAB 0x8000 0x0 + LOAD IVT 0xE000 0x1000 + CALL HAB 0xE000 0x0 LOAD 0x40002000 u-boot.bin - LOAD IVT 0x8000 0x40002000 - CALL HAB 0x8000 0x0 + LOAD IVT 0xE000 0x40002000 + CALL HAB 0xE000 0x0