From patchwork Tue Nov 23 18:48:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joakim Tjernlund X-Patchwork-Id: 72717 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 E5E26B70AF for ; Wed, 24 Nov 2010 05:49:30 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3B9082821F; Tue, 23 Nov 2010 19:49:16 +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 5NyCH+hQsa4t; Tue, 23 Nov 2010 19:49:15 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 895B228207; Tue, 23 Nov 2010 19:49:03 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 26DDE281DA for ; Tue, 23 Nov 2010 19:49:01 +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 7XpJJrx--g3g for ; Tue, 23 Nov 2010 19:49:00 +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 gw1.transmode.se (gw1.transmode.se [213.115.205.20]) by theia.denx.de (Postfix) with ESMTPS id C35C1281CD for ; Tue, 23 Nov 2010 19:49:00 +0100 (CET) Received: from sesr04.transmode.se (sesr04.transmode.se [192.168.201.15]) by gw1.transmode.se (Postfix) with ESMTP id 42F0D650005 for ; Tue, 23 Nov 2010 19:49:00 +0100 (CET) Received: from gentoo-jocke.transmode.se ([192.168.1.15]) by sesr04.transmode.se (Lotus Domino Release 8.5.2 HF88) with ESMTP id 2010112319490017-51199 ; Tue, 23 Nov 2010 19:49:00 +0100 Received: from gentoo-jocke.transmode.se (gentoo-jocke.transmode.se [127.0.0.1]) by gentoo-jocke.transmode.se (8.14.4/8.14.0) with ESMTP id oANImxek012435; Tue, 23 Nov 2010 19:48:59 +0100 Received: (from jocke@localhost) by gentoo-jocke.transmode.se (8.14.4/8.14.4/Submit) id oANImxWR012434; Tue, 23 Nov 2010 19:48:59 +0100 From: Joakim Tjernlund To: "u-boot@lists.denx.de" Date: Tue, 23 Nov 2010 19:48:47 +0100 Message-Id: <1290538131-12383-3-git-send-email-Joakim.Tjernlund@transmode.se> X-Mailer: git-send-email 1.7.2.2 In-Reply-To: <1290538131-12383-1-git-send-email-Joakim.Tjernlund@transmode.se> References: <1290538131-12383-1-git-send-email-Joakim.Tjernlund@transmode.se> X-MIMETrack: Itemize by SMTP Server on sesr04/Transmode(Release 8.5.2 HF88|October 08, 2010) at 2010-11-23 19:49:00, Serialize by Router on sesr04/Transmode(Release 8.5.2 HF88|October 08, 2010) at 2010-11-23 19:49:00, Serialize complete at 2010-11-23 19:49:00 Cc: Joakim Tjernlund Subject: [U-Boot] [PATCH 2/6] mpc83xx: Make start.S true PIC X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Remove dependencies on link address. Use GOT and add an new function to calculate the actual address. --- arch/powerpc/cpu/mpc83xx/start.S | 36 ++++++++++++++++++++++++++++-------- 1 files changed, 28 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/cpu/mpc83xx/start.S b/arch/powerpc/cpu/mpc83xx/start.S index 09c5eac..3cac147 100644 --- a/arch/powerpc/cpu/mpc83xx/start.S +++ b/arch/powerpc/cpu/mpc83xx/start.S @@ -69,12 +69,12 @@ */ START_GOT GOT_ENTRY(_GOT2_TABLE_) + GOT_ENTRY(_start) GOT_ENTRY(__bss_start) GOT_ENTRY(_end) #ifndef CONFIG_NAND_SPL GOT_ENTRY(_FIXUP_TABLE_) - GOT_ENTRY(_start) GOT_ENTRY(_start_of_vectors) GOT_ENTRY(_end_of_vectors) GOT_ENTRY(transfer_to_handler) @@ -240,10 +240,12 @@ boot_warm: /* time t 5 */ /* there and deflate the flash size back to minimal size */ /*------------------------------------------------------------*/ bl map_flash_by_law1 - lis r4, (CONFIG_SYS_MONITOR_BASE)@h - ori r4, r4, (CONFIG_SYS_MONITOR_BASE)@l - addi r5, r4, in_flash - _start + EXC_OFF_SYS_RESET - mtlr r5 + + bl 1f +1: mflr r3 /* get current address */ + addi r3, r3, in_flash - 1b + bl add_flash_base + mtlr r3 blr in_flash: #if 1 /* Remapping flash with LAW0. */ @@ -833,10 +835,12 @@ relocate_code: mr r10, r5 /* Save copy of Destination Address */ GET_GOT - mr r3, r5 /* Destination Address */ - lis r4, CONFIG_SYS_MONITOR_BASE@h /* Source Address */ - ori r4, r4, CONFIG_SYS_MONITOR_BASE@l + + lwz r4, GOT(_start) /* Source Address */ + addi r4, r4, -EXC_OFF_SYS_RESET lwz r5, GOT(__bss_start) + mr r3, r10 /* Destination Address */ + sub r5, r5, r4 li r6, CONFIG_SYS_CACHELINE_SIZE /* Cache Line Size */ @@ -1128,6 +1132,21 @@ unlock_ram_in_cache: #endif /* CONFIG_SYS_INIT_RAM_LOCK */ #ifdef CONFIG_SYS_FLASHBOOT + +add_flash_base: + /* Check if already inside flash address space. */ + /* if so, do not add CONFIG_SYS_FLASH_BASE */ + lis r4, (CONFIG_SYS_FLASH_BASE)@h + ori r4, r4, (CONFIG_SYS_FLASH_BASE)@l + cmplw cr0, r3, r4 + ble cr0, 2f /* r3 < r4 ? */ + lis r6, (CONFIG_SYS_FLASH_BASE+(CONFIG_SYS_FLASH_SIZE*1024*1024-1))@h + ori r6, r6, (CONFIG_SYS_FLASH_BASE+(CONFIG_SYS_FLASH_SIZE*1024*1024-1))@l + cmplw cr0, r3, r6 + blelr cr0 /* r3 < r6 ? */ +2: add r3,r3,r4 + blr + map_flash_by_law1: /* When booting from ROM (Flash or EPROM), clear the */ /* Address Mask in OR0 so ROM appears everywhere */ @@ -1179,6 +1198,7 @@ map_flash_by_law1: */ remap_flash_by_law0: /* Initialize the BR0 with the boot ROM starting address. */ + lis r3, (CONFIG_SYS_IMMR)@h /* r3 <= CONFIG_SYS_IMMR */ lwz r4, BR0(r3) li r5, 0x7FFF and r4, r4, r5