aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/boot/compressed/head.S
diff options
context:
space:
mode:
authorJoachim Eastwood <manabian@gmail.com>2015-03-25 03:47:18 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2015-03-28 12:54:53 -0400
commitc20611df13c3e3070607c267cf781ba8645a185e (patch)
treeedd0917670e155eb71a8192556843286aa45e8a8 /arch/arm/boot/compressed/head.S
parenta092aedb8115c16cb49bc64dd09cb20471ff942b (diff)
ARM: 8327/1: zImage: add support for ARMv7-M
This patch makes it possible to enter zImage in Thumb mode for ARMv7-M (Cortex-M) CPUs that do not support ARM mode. The kernel entry is also made in Thumb mode. [ukl: fix spelling in commit log, return early in call_cache_fn] Signed-off-by: Joachim Eastwood <manabian@gmail.com> Tested-by: Stefan Agner <stefan@agner.ch> Tested-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Tested-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/boot/compressed/head.S')
-rw-r--r--arch/arm/boot/compressed/head.S33
1 files changed, 27 insertions, 6 deletions
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index 55a353243a90..2c45b5709fa4 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -10,8 +10,11 @@
10 */ 10 */
11#include <linux/linkage.h> 11#include <linux/linkage.h>
12#include <asm/assembler.h> 12#include <asm/assembler.h>
13#include <asm/v7m.h>
14
15 AR_CLASS( .arch armv7-a )
16 M_CLASS( .arch armv7-m )
13 17
14 .arch armv7-a
15/* 18/*
16 * Debugging stuff 19 * Debugging stuff
17 * 20 *
@@ -114,7 +117,12 @@
114 * sort out different calling conventions 117 * sort out different calling conventions
115 */ 118 */
116 .align 119 .align
117 .arm @ Always enter in ARM state 120 /*
121 * Always enter in ARM state for CPUs that support the ARM ISA.
122 * As of today (2014) that's exactly the members of the A and R
123 * classes.
124 */
125 AR_CLASS( .arm )
118start: 126start:
119 .type start,#function 127 .type start,#function
120 .rept 7 128 .rept 7
@@ -132,14 +140,15 @@ start:
132 140
133 THUMB( .thumb ) 141 THUMB( .thumb )
1341: 1421:
135 ARM_BE8( setend be ) @ go BE8 if compiled for BE8 143 ARM_BE8( setend be ) @ go BE8 if compiled for BE8
136 mrs r9, cpsr 144 AR_CLASS( mrs r9, cpsr )
137#ifdef CONFIG_ARM_VIRT_EXT 145#ifdef CONFIG_ARM_VIRT_EXT
138 bl __hyp_stub_install @ get into SVC mode, reversibly 146 bl __hyp_stub_install @ get into SVC mode, reversibly
139#endif 147#endif
140 mov r7, r1 @ save architecture ID 148 mov r7, r1 @ save architecture ID
141 mov r8, r2 @ save atags pointer 149 mov r8, r2 @ save atags pointer
142 150
151#ifndef CONFIG_CPU_V7M
143 /* 152 /*
144 * Booting from Angel - need to enter SVC mode and disable 153 * Booting from Angel - need to enter SVC mode and disable
145 * FIQs/IRQs (numeric definitions from angel arm.h source). 154 * FIQs/IRQs (numeric definitions from angel arm.h source).
@@ -155,6 +164,7 @@ not_angel:
155 safe_svcmode_maskall r0 164 safe_svcmode_maskall r0
156 msr spsr_cxsf, r9 @ Save the CPU boot mode in 165 msr spsr_cxsf, r9 @ Save the CPU boot mode in
157 @ SPSR 166 @ SPSR
167#endif
158 /* 168 /*
159 * Note that some cache flushing and other stuff may 169 * Note that some cache flushing and other stuff may
160 * be needed here - is there an Angel SWI call for this? 170 * be needed here - is there an Angel SWI call for this?
@@ -827,6 +837,16 @@ __common_mmu_cache_on:
827call_cache_fn: adr r12, proc_types 837call_cache_fn: adr r12, proc_types
828#ifdef CONFIG_CPU_CP15 838#ifdef CONFIG_CPU_CP15
829 mrc p15, 0, r9, c0, c0 @ get processor ID 839 mrc p15, 0, r9, c0, c0 @ get processor ID
840#elif defined(CONFIG_CPU_V7M)
841 /*
842 * On v7-M the processor id is located in the V7M_SCB_CPUID
843 * register, but as cache handling is IMPLEMENTATION DEFINED on
844 * v7-M (if existant at all) we just return early here.
845 * If V7M_SCB_CPUID were used the cpu ID functions (i.e.
846 * __armv7_mmu_cache_{on,off,flush}) would be selected which
847 * use cp15 registers that are not implemented on v7-M.
848 */
849 bx lr
830#else 850#else
831 ldr r9, =CONFIG_PROCESSOR_ID 851 ldr r9, =CONFIG_PROCESSOR_ID
832#endif 852#endif
@@ -1327,8 +1347,9 @@ __hyp_reentry_vectors:
1327 1347
1328__enter_kernel: 1348__enter_kernel:
1329 mov r0, #0 @ must be 0 1349 mov r0, #0 @ must be 0
1330 ARM( mov pc, r4 ) @ call kernel 1350 ARM( mov pc, r4 ) @ call kernel
1331 THUMB( bx r4 ) @ entry point is always ARM 1351 M_CLASS( add r4, r4, #1 ) @ enter in Thumb mode for M class
1352 THUMB( bx r4 ) @ entry point is always ARM for A/R classes
1332 1353
1333reloc_code_end: 1354reloc_code_end:
1334 1355