From patchwork Sun Nov 25 11:13:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Henrik_Nordstr=C3=B6m?= X-Patchwork-Id: 201515 X-Patchwork-Delegate: albert.aribaud@free.fr Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id C5F1D2C007E for ; Sun, 25 Nov 2012 22:13:52 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 27FA04A026; Sun, 25 Nov 2012 12:13:48 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UGgCE47d+qir; Sun, 25 Nov 2012 12:13:47 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4DDA74A027; Sun, 25 Nov 2012 12:13:46 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4C37E4A027 for ; Sun, 25 Nov 2012 12:13:43 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WgYc5HevS1pw for ; Sun, 25 Nov 2012 12:13:42 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from vps1.hno.se (vps1.hno.se [31.192.227.87]) by theia.denx.de (Postfix) with ESMTPS id C3C5B4A026 for ; Sun, 25 Nov 2012 12:13:39 +0100 (CET) Received: from home.hno.se (home.hno.se [IPv6:2001:470:df90::1]) (authenticated bits=128) by vps1.hno.se (8.14.4/8.14.4) with ESMTP id qAPBDZ70014170 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 25 Nov 2012 12:13:37 +0100 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by home.hno.se (8.14.5/8.14.5) with ESMTP id qAPBDV1e012458 for ; Sun, 25 Nov 2012 12:13:31 +0100 Message-ID: <1353842010.17518.3.camel@home.hno.se> From: Henrik =?ISO-8859-1?Q?Nordstr=F6m?= To: U-Boot Mailing List Date: Sun, 25 Nov 2012 12:13:30 +0100 X-Mailer: Evolution 3.2.3 (3.2.3-3.fc16) Mime-Version: 1.0 Subject: [U-Boot] [PATCH] ARM v7: Flush icache when executing a program with go X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de ARM v7 runs with icache enabled. For reliable results the go command needs to flush the icache before jumping or it may risk running cached instructions that differ from what currently is in memory. --- arch/arm/cpu/armv7/Makefile | 1 + arch/arm/cpu/armv7/cmd_boot.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 0 deletions(-) create mode 100644 arch/arm/cpu/armv7/cmd_boot.c diff --git a/arch/arm/cpu/armv7/Makefile b/arch/arm/cpu/armv7/Makefile index 4fdbee4..da1b5e8 100644 --- a/arch/arm/cpu/armv7/Makefile +++ b/arch/arm/cpu/armv7/Makefile @@ -31,6 +31,7 @@ COBJS += cache_v7.o COBJS += cpu.o COBJS += syslib.o +COBJS += cmd_boot.o ifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TEGRA20),) SOBJS += lowlevel_init.o diff --git a/arch/arm/cpu/armv7/cmd_boot.c b/arch/arm/cpu/armv7/cmd_boot.c new file mode 100644 index 0000000..6758a55 --- /dev/null +++ b/arch/arm/cpu/armv7/cmd_boot.c @@ -0,0 +1,37 @@ +/* + * (C) Copyright 2000-2003 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +/* + * Misc boot support + */ +#include +#include + +#ifdef CONFIG_CMD_GO +unsigned long do_go_exec(ulong (*entry)(int, char * const []), int argc, + char * const argv[]) +{ + invalidate_icache_all(); + return entry(argc, argv); +} +#endif