Received: from list by lists.gnu.org with archive (Exim 4.71) id 1UZgpy-00043R-86 for mharc-grub-devel@gnu.org; Tue, 07 May 2013 08:17:42 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48127) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZgpu-00043H-Ab for grub-devel@gnu.org; Tue, 07 May 2013 08:17:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UZgpp-0005W2-LJ for grub-devel@gnu.org; Tue, 07 May 2013 08:17:38 -0400 Received: from mail-ee0-f51.google.com ([74.125.83.51]:62751) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZgpp-0005Vm-F2 for grub-devel@gnu.org; Tue, 07 May 2013 08:17:33 -0400 Received: by mail-ee0-f51.google.com with SMTP id c1so270011eek.24 for ; Tue, 07 May 2013 05:17:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent:x-gm-message-state; bh=9jo67AaazcHl+2LO2Iw3idyMPrUm3OqsRof8RnhQwpg=; b=dp0SDRb7HnPfCROOJ0o5J7ZpEdrTQQoyp5GLwGCrGaN20yV50bapeLIzNlNyY20pI7 rAJxlptoDOamlIYyFsZy0Hj7jK+aNe4znkqtJBPS9fUSSH22i7ZF6+GaYYfOPGAGfawW Hof2cekiz6xoIN0kmwHXyJICwnVv4N4XiFpvq9TGtZKHJZHldRxX2AlmTHCNJ5iDtfBp wPAASPLcQJTU+xqF5meibtWb8txymJCgHdE9ehNSp/cjkQ54ItMPk2aND2igX5089+qV 9xcUIvkSFRt2J+3dRBFHEMAdl1xjBKKJ9ShAnvAcH63sZaP/K0JrQuwX/exWsRg28whz 34dg== X-Received: by 10.14.3.137 with SMTP id 9mr5034831eeh.0.1367929052601; Tue, 07 May 2013 05:17:32 -0700 (PDT) Received: from rocoto.smurfnet.nu ([2001:4b98:dc0:41:216:3eff:fea7:75f3]) by mx.google.com with ESMTPSA id w43sm32519070eeg.14.2013.05.07.05.17.30 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 07 May 2013 05:17:31 -0700 (PDT) Date: Tue, 7 May 2013 12:18:05 +0000 From: Leif Lindholm To: Francesco Lavra Subject: Re: ARM branch Message-ID: <20130507121805.GF28516@rocoto.smurfnet.nu> References: <51684561.1040002@gmail.com> <20130501183258.GB28516@rocoto.smurfnet.nu> <51854A4A.2030401@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="RpqchZ26BWispMcB" Content-Disposition: inline In-Reply-To: <51854A4A.2030401@gmail.com> User-Agent: Mutt/1.5.20 (2009-06-14) X-Gm-Message-State: ALoCoQk+tmgZZMkirN+/DMlvrjuFw0StENk5Rh/MxXReuvZuYDsQyCa90H3hI1uEb7H5A8W1N4ah X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 74.125.83.51 Cc: The development of GNU GRUB , phcoder@gmail.com X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 May 2013 12:17:41 -0000 --RpqchZ26BWispMcB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sat, May 04, 2013 at 07:50:02PM +0200, Francesco Lavra wrote: > > I have attached a patch (against this branch) that contains build > > system fixes and changes to the assembly files in order to permit the > > same target-platform combination to build correctly on both ARMv6 and > > ARMv7, with no special options required. [...] > Unfortunately, in ARMv6 there are no such things as CLIDR, CSSELR and > CCSIDR. Doh! On the plus side, there is a magic "clean/invalidate the whole D-cache" instruction... I have no ARMv6 platform handy, but attached is a conditionalised version, including some additional changes, that _should_ work on ARMv6. Could someone give it a go? / Leif --RpqchZ26BWispMcB Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="armv6_cache_support.patch" === modified file 'grub-core/kern/arm/cache.S' --- grub-core/kern/arm/cache.S 2013-04-28 20:47:19 +0000 +++ grub-core/kern/arm/cache.S 2013-05-07 11:51:37 +0000 @@ -51,7 +51,11 @@ and r0, r0, r3 1: cmp r0, r1 bge 2f +#if (__ARM_ARCH_6__ == 1) + mcr p15, 0, r0, c7, c10, 1 @ Clean data cache line by MVA +#else mcr p15, 0, r0, c7, c11, 1 @ DCCMVAU +#endif add r0, r0, r2 @ Next line b 1b 2: DSB @@ -77,37 +81,47 @@ bx lr sync_caches: - DMB DSB - push {r4-r6, lr} + push {r0-r1, r4-r6, lr} ldr r2, probed @ If first call, probe cache sizes cmp r2, #0 - bleq probe_caches @ This call corrupts r3 - mov r4, r0 - mov r5, r1 + bleq probe_caches + ldrdeq r0, r1, [sp] bl clean_dcache_range - mov r0, r4 - mov r1, r5 + pop {r0, r1} bl invalidate_icache_range pop {r4-r6, pc} probe_caches: push {r4-r6, lr} - mrc p15, 0, r4, c0, c0, 1 @ Read Cache Type Register - mov r5, #1 - lsr r6, r4, #16 @ Extract min D-cache num word log2 - and r6, r6, #0xf - add r6, r6, #2 @ words->bytes - lsl r6, r5, r6 @ Convert to num bytes + mrc p15, 0, r0, c0, c0, 1 @ Read Cache Type Register + mov r1, #1 +@ Cache Type Register format changed in ARMv7 +@ r5 - dlinesz +@ r6 - ilinesz +#if (__ARM_ARCH_6__ == 1) + lsl r2, r0, #12 + and r2, r2, #3 @ Dsize 'len' + lsl r2, r1, r2 @ Convert to num 8-byte blocks + lsl r5, r2, #3 @ Convert to num bytes + and r2, r0, #3 @ Isize 'len' + lsl r2, r1, r2 @ Convert to num 8-byte blocks + lsl r6, r2, #3 @ Convert to num bytes +#else + lsr r2, r0, #16 @ Extract min D-cache num word log2 + and r2, r2, #0xf + add r2, r2, #2 @ words->bytes + lsl r5, r1, r2 @ Convert to num bytes + and r2, r0, #0xf @ Extract min I-cache num word log2 + add r2, r2, #2 @ words->bytes + lsl r6, r1, r2 @ Convert to num bytes +#endif ldr r3, =dlinesz - str r6, [r3] - and r6, r4, #0xf @ Extract min I-cache num word log2 - add r6, r6, #2 @ words->bytes - lsl r6, r5, r6 @ Convert to num bytes + str r5, [r3] ldr r3, =ilinesz str r6, [r3] ldr r3, =probed @ Flag cache probing done - str r5, [r3] + str r1, [r3] pop {r4-r6, pc} .align 3 @@ -135,6 +149,10 @@ @ r10 - scratch @ r11 - scratch clean_invalidate_dcache: +#if (__ARM_ARCH_6__ == 1) + mcr p15, 0, r0, c7, c14, 0 @ Clean/Invalidate D-cache + bx lr +#elif (__ARM_ARCH_7A__ == 1) push {r4-r12, lr} mrc p15, 1, r0, c0, c0, 1 @ Read CLIDR lsr r1, r0, #24 @ Extract LoC @@ -204,6 +222,7 @@ 6: DSB ISB pop {r4-r12, pc} +#endif FUNCTION(grub_arm_disable_caches_mmu) push {r4, lr} --RpqchZ26BWispMcB--