blob: 88a4cc250b4c5466d8fb0555333cf9a11c4e5b20 [file] [log] [blame]
wdenkc6097192002-11-03 00:24:07 +00001/*
Marek Vasutb9091622011-10-31 14:12:39 +01002 * armboot - Startup Code for XScale CPU-core
wdenkc6097192002-11-03 00:24:07 +00003 *
4 * Copyright (C) 1998 Dan Malek <dmalek@jlc.net>
5 * Copyright (C) 1999 Magnus Damm <kieraypc01.p.y.kie.era.ericsson.se>
6 * Copyright (C) 2000 Wolfgang Denk <wd@denx.de>
wdenkc0aa5c52003-12-06 19:49:23 +00007 * Copyright (C) 2001 Alex Zuepke <azu@sysgo.de>
Marek Vasutb9091622011-10-31 14:12:39 +01008 * Copyright (C) 2001 Marius Groger <mag@sysgo.de>
9 * Copyright (C) 2002 Alex Zupke <azu@sysgo.de>
10 * Copyright (C) 2002 Gary Jennejohn <garyj@denx.de>
wdenk1fe2c702003-03-06 21:55:29 +000011 * Copyright (C) 2002 Kyle Harris <kharris@nexus-tech.net>
Wolfgang Denk61ccd1d2006-03-06 23:18:48 +010012 * Copyright (C) 2003 Kai-Uwe Bloem <kai-uwe.bloem@auerswald.de>
Marek Vasutb9091622011-10-31 14:12:39 +010013 * Copyright (C) 2003 Kshitij <kshitij@ti.com>
14 * Copyright (C) 2003 Richard Woodruff <r-woodruff2@ti.com>
15 * Copyright (C) 2003 Robert Schwebel <r.schwebel@pengutronix.de>
16 * Copyright (C) 2004 Texas Instruments <r-woodruff2@ti.com>
17 * Copyright (C) 2010 Marek Vasut <marek.vasut@gmail.com>
wdenkc6097192002-11-03 00:24:07 +000018 *
19 * See file CREDITS for list of people who contributed to this
20 * project.
21 *
22 * This program is free software; you can redistribute it and/or
23 * modify it under the terms of the GNU General Public License as
24 * published by the Free Software Foundation; either version 2 of
25 * the License, or (at your option) any later version.
26 *
27 * This program is distributed in the hope that it will be useful,
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of
wdenk384ae022002-11-05 00:17:55 +000029 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
wdenkc6097192002-11-03 00:24:07 +000030 * GNU General Public License for more details.
31 *
32 * You should have received a copy of the GNU General Public License
33 * along with this program; if not, write to the Free Software
34 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
35 * MA 02111-1307 USA
36 */
37
Wolfgang Denk0191e472010-10-26 14:34:52 +020038#include <asm-offsets.h>
wdenkc6097192002-11-03 00:24:07 +000039#include <config.h>
40#include <version.h>
wdenkc6097192002-11-03 00:24:07 +000041.globl _start
wdenk384ae022002-11-05 00:17:55 +000042_start: b reset
Aneesh V552a3192011-07-13 05:11:07 +000043#ifdef CONFIG_SPL_BUILD
Marek Vasutc13685c2010-07-06 02:48:35 +020044 ldr pc, _hang
45 ldr pc, _hang
46 ldr pc, _hang
47 ldr pc, _hang
48 ldr pc, _hang
49 ldr pc, _hang
50 ldr pc, _hang
51
52_hang:
53 .word do_hang
54 .word 0x12345678
55 .word 0x12345678
56 .word 0x12345678
57 .word 0x12345678
58 .word 0x12345678
59 .word 0x12345678
60 .word 0x12345678 /* now 16*4=64 */
61#else
wdenkc6097192002-11-03 00:24:07 +000062 ldr pc, _undefined_instruction
63 ldr pc, _software_interrupt
64 ldr pc, _prefetch_abort
65 ldr pc, _data_abort
66 ldr pc, _not_used
67 ldr pc, _irq
68 ldr pc, _fiq
69
wdenk384ae022002-11-05 00:17:55 +000070_undefined_instruction: .word undefined_instruction
wdenkc6097192002-11-03 00:24:07 +000071_software_interrupt: .word software_interrupt
72_prefetch_abort: .word prefetch_abort
73_data_abort: .word data_abort
74_not_used: .word not_used
75_irq: .word irq
76_fiq: .word fiq
Marek Vasutb9091622011-10-31 14:12:39 +010077_pad: .word 0x12345678 /* now 16*4=64 */
Aneesh V552a3192011-07-13 05:11:07 +000078#endif /* CONFIG_SPL_BUILD */
Marek Vasutb9091622011-10-31 14:12:39 +010079.global _end_vect
80_end_vect:
wdenkc6097192002-11-03 00:24:07 +000081
82 .balignl 16,0xdeadbeef
wdenkc6097192002-11-03 00:24:07 +000083/*
Marek Vasutb9091622011-10-31 14:12:39 +010084 *************************************************************************
85 *
wdenkc6097192002-11-03 00:24:07 +000086 * Startup Code (reset vector)
87 *
Marek Vasutb9091622011-10-31 14:12:39 +010088 * do important init only if we don't start from memory!
89 * setup Memory and board specific bits prior to relocation.
90 * relocate armboot to ram
91 * setup stack
92 *
93 *************************************************************************
wdenkc6097192002-11-03 00:24:07 +000094 */
95
Heiko Schocher3d8f5fa2010-09-17 13:10:46 +020096.globl _TEXT_BASE
wdenkc6097192002-11-03 00:24:07 +000097_TEXT_BASE:
Marek Vasutb9091622011-10-31 14:12:39 +010098#ifdef CONFIG_SPL_BUILD
99 .word CONFIG_SPL_TEXT_BASE
100#else
Wolfgang Denk0708bc62010-10-07 21:51:12 +0200101 .word CONFIG_SYS_TEXT_BASE
Marek Vasutb9091622011-10-31 14:12:39 +0100102#endif
wdenkc6097192002-11-03 00:24:07 +0000103
wdenkc6097192002-11-03 00:24:07 +0000104/*
wdenk927034e2004-02-08 19:38:38 +0000105 * These are defined in the board-specific linker script.
Marek Vasutb9091622011-10-31 14:12:39 +0100106 * Subtracting _start from them lets the linker put their
107 * relative position in the executable instead of leaving
108 * them null.
wdenkcc1e2562003-03-06 13:39:27 +0000109 */
Marek Vasutf29c11b2010-10-20 19:36:39 +0200110.globl _bss_start_ofs
111_bss_start_ofs:
112 .word __bss_start - _start
wdenkcc1e2562003-03-06 13:39:27 +0000113
Marek Vasutf29c11b2010-10-20 19:36:39 +0200114.globl _bss_end_ofs
115_bss_end_ofs:
Po-Yu Chuangcedbf4b2011-03-01 22:59:59 +0000116 .word __bss_end__ - _start
wdenkcc1e2562003-03-06 13:39:27 +0000117
Po-Yu Chuang1864b002011-03-01 23:02:04 +0000118.globl _end_ofs
119_end_ofs:
120 .word _end - _start
121
wdenkc6097192002-11-03 00:24:07 +0000122#ifdef CONFIG_USE_IRQ
123/* IRQ stack memory (calculated at run-time) */
124.globl IRQ_STACK_START
125IRQ_STACK_START:
126 .word 0x0badc0de
127
128/* IRQ stack memory (calculated at run-time) */
129.globl FIQ_STACK_START
130FIQ_STACK_START:
131 .word 0x0badc0de
Marek Vasutb9091622011-10-31 14:12:39 +0100132#endif
wdenkc6097192002-11-03 00:24:07 +0000133
Heiko Schocher3d8f5fa2010-09-17 13:10:46 +0200134/* IRQ stack memory (calculated at run-time) + 8 bytes */
135.globl IRQ_STACK_START_IN
136IRQ_STACK_START_IN:
137 .word 0x0badc0de
138
Heiko Schocher3d8f5fa2010-09-17 13:10:46 +0200139/*
140 * the actual reset code
141 */
142
143reset:
144 /*
145 * set the cpu to SVC32 mode
146 */
147 mrs r0,cpsr
148 bic r0,r0,#0x1f
149 orr r0,r0,#0xd3
150 msr cpsr,r0
151
Marek Vasutb9091622011-10-31 14:12:39 +0100152#ifndef CONFIG_SKIP_LOWLEVEL_INIT
153 bl cpu_init_crit
154#endif
Heiko Schocher3d8f5fa2010-09-17 13:10:46 +0200155
156/* Set stackpointer in internal RAM to call board_init_f */
157call_board_init_f:
158 ldr sp, =(CONFIG_SYS_INIT_SP_ADDR)
Heiko Schocher17f288a2010-11-12 07:53:55 +0100159 bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
Marek Vasutb9091622011-10-31 14:12:39 +0100160 ldr r0, =0x00000000
Heiko Schocher3d8f5fa2010-09-17 13:10:46 +0200161 bl board_init_f
162
163/*------------------------------------------------------------------------------*/
Marek Vasutb9091622011-10-31 14:12:39 +0100164#ifndef CONFIG_SPL_BUILD
Heiko Schocher3d8f5fa2010-09-17 13:10:46 +0200165/*
166 * void relocate_code (addr_sp, gd, addr_moni)
167 *
168 * This "function" does not return, instead it continues in RAM
169 * after relocating the monitor code.
170 *
171 */
172 .globl relocate_code
173relocate_code:
174 mov r4, r0 /* save addr_sp */
175 mov r5, r1 /* save addr of gd */
176 mov r6, r2 /* save addr of destination */
Heiko Schocher3d8f5fa2010-09-17 13:10:46 +0200177
178 /* Set up the stack */
179stack_setup:
180 mov sp, r4
181
182 adr r0, _start
Andreas Bießmann007b38f2010-12-01 00:58:34 +0100183 cmp r0, r6
184 beq clear_bss /* skip relocation */
Andreas Bießmann8cfbda92010-12-01 00:58:33 +0100185 mov r1, r6 /* r1 <- scratch for copy_loop */
Marek Vasutf29c11b2010-10-20 19:36:39 +0200186 ldr r3, _bss_start_ofs
187 add r2, r0, r3 /* r2 <- source end address */
Heiko Schocher3d8f5fa2010-09-17 13:10:46 +0200188
Heiko Schocher3d8f5fa2010-09-17 13:10:46 +0200189copy_loop:
Marek Vasutb9091622011-10-31 14:12:39 +0100190 ldmia r0!, {r9-r10} /* copy from source address [r0] */
191 stmia r1!, {r9-r10} /* copy to target address [r1] */
Albert Aribaud0668d162010-10-05 16:06:39 +0200192 cmp r0, r2 /* until source end address [r2] */
193 blo copy_loop
Heiko Schocher3d8f5fa2010-09-17 13:10:46 +0200194
Aneesh V552a3192011-07-13 05:11:07 +0000195#ifndef CONFIG_SPL_BUILD
Marek Vasutf29c11b2010-10-20 19:36:39 +0200196 /*
197 * fix .rel.dyn relocations
198 */
199 ldr r0, _TEXT_BASE /* r0 <- Text base */
Andreas Bießmann8cfbda92010-12-01 00:58:33 +0100200 sub r9, r6, r0 /* r9 <- relocation offset */
Marek Vasutf29c11b2010-10-20 19:36:39 +0200201 ldr r10, _dynsym_start_ofs /* r10 <- sym table ofs */
202 add r10, r10, r0 /* r10 <- sym table in FLASH */
203 ldr r2, _rel_dyn_start_ofs /* r2 <- rel dyn start ofs */
204 add r2, r2, r0 /* r2 <- rel dyn start in FLASH */
205 ldr r3, _rel_dyn_end_ofs /* r3 <- rel dyn end ofs */
206 add r3, r3, r0 /* r3 <- rel dyn end in FLASH */
Heiko Schocher3d8f5fa2010-09-17 13:10:46 +0200207fixloop:
Marek Vasutb9091622011-10-31 14:12:39 +0100208 ldr r0, [r2] /* r0 <- location to fix up, IN FLASH! */
209 add r0, r0, r9 /* r0 <- location to fix up in RAM */
Marek Vasutf29c11b2010-10-20 19:36:39 +0200210 ldr r1, [r2, #4]
Andreas Bießmann318cea12010-12-01 00:58:35 +0100211 and r7, r1, #0xff
Marek Vasutb9091622011-10-31 14:12:39 +0100212 cmp r7, #23 /* relative fixup? */
Marek Vasutf29c11b2010-10-20 19:36:39 +0200213 beq fixrel
Marek Vasutb9091622011-10-31 14:12:39 +0100214 cmp r7, #2 /* absolute fixup? */
Marek Vasutf29c11b2010-10-20 19:36:39 +0200215 beq fixabs
216 /* ignore unknown type of fixup */
217 b fixnext
218fixabs:
219 /* absolute fix: set location to (offset) symbol value */
220 mov r1, r1, LSR #4 /* r1 <- symbol index in .dynsym */
221 add r1, r10, r1 /* r1 <- address of symbol in table */
222 ldr r1, [r1, #4] /* r1 <- symbol value */
Wolfgang Denk899cdd12010-12-09 11:26:24 +0100223 add r1, r1, r9 /* r1 <- relocated sym addr */
Marek Vasutf29c11b2010-10-20 19:36:39 +0200224 b fixnext
225fixrel:
226 /* relative fix: increase location by offset */
227 ldr r1, [r0]
228 add r1, r1, r9
229fixnext:
230 str r1, [r0]
Marek Vasutb9091622011-10-31 14:12:39 +0100231 add r2, r2, #8 /* each rel.dyn entry is 8 bytes */
Heiko Schocher3d8f5fa2010-09-17 13:10:46 +0200232 cmp r2, r3
Marek Vasutf29c11b2010-10-20 19:36:39 +0200233 blo fixloop
Marek Vasutb9091622011-10-31 14:12:39 +0100234#endif
Heiko Schocher3d8f5fa2010-09-17 13:10:46 +0200235
236clear_bss:
Aneesh V552a3192011-07-13 05:11:07 +0000237#ifndef CONFIG_SPL_BUILD
Marek Vasutf29c11b2010-10-20 19:36:39 +0200238 ldr r0, _bss_start_ofs
239 ldr r1, _bss_end_ofs
Andreas Bießmann8cfbda92010-12-01 00:58:33 +0100240 mov r4, r6 /* reloc addr */
Heiko Schocher3d8f5fa2010-09-17 13:10:46 +0200241 add r0, r0, r4
Heiko Schocher3d8f5fa2010-09-17 13:10:46 +0200242 add r1, r1, r4
243 mov r2, #0x00000000 /* clear */
244
245clbss_l:str r2, [r0] /* clear loop... */
246 add r0, r0, #4
247 cmp r0, r1
248 bne clbss_l
Aneesh V552a3192011-07-13 05:11:07 +0000249#endif /* #ifndef CONFIG_SPL_BUILD */
Heiko Schocher3d8f5fa2010-09-17 13:10:46 +0200250
251/*
252 * We are done. Do not return, instead branch to second part of board
253 * initialization, now running from RAM.
254 */
Marek Vasutb9091622011-10-31 14:12:39 +0100255#ifdef CONFIG_ONENAND_SPL
256 ldr r0, _onenand_boot_ofs
Marek Vasutf29c11b2010-10-20 19:36:39 +0200257 mov pc, r0
Heiko Schocher3d8f5fa2010-09-17 13:10:46 +0200258
Marek Vasutb9091622011-10-31 14:12:39 +0100259_onenand_boot_ofs:
260 .word onenand_boot
Heiko Schocher3d8f5fa2010-09-17 13:10:46 +0200261#else
Marek Vasutb9091622011-10-31 14:12:39 +0100262jump_2_ram:
Marek Vasutf29c11b2010-10-20 19:36:39 +0200263 ldr r0, _board_init_r_ofs
Marek Vasutb9091622011-10-31 14:12:39 +0100264 ldr r1, _TEXT_BASE
Darius Augulis50a0a9c2010-10-25 13:45:35 +0300265 add lr, r0, r1
Darius Augulis50a0a9c2010-10-25 13:45:35 +0300266 add lr, lr, r9
Heiko Schocher3d8f5fa2010-09-17 13:10:46 +0200267 /* setup parameters for board_init_r */
268 mov r0, r5 /* gd_t */
Andreas Bießmann8cfbda92010-12-01 00:58:33 +0100269 mov r1, r6 /* dest_addr */
Heiko Schocher3d8f5fa2010-09-17 13:10:46 +0200270 /* jump to it ... */
Heiko Schocher3d8f5fa2010-09-17 13:10:46 +0200271 mov pc, lr
272
Marek Vasutf29c11b2010-10-20 19:36:39 +0200273_board_init_r_ofs:
274 .word board_init_r - _start
Marek Vasutb9091622011-10-31 14:12:39 +0100275#endif
Heiko Schocher3d8f5fa2010-09-17 13:10:46 +0200276
Marek Vasutf29c11b2010-10-20 19:36:39 +0200277_rel_dyn_start_ofs:
278 .word __rel_dyn_start - _start
279_rel_dyn_end_ofs:
280 .word __rel_dyn_end - _start
281_dynsym_start_ofs:
282 .word __dynsym_start - _start
Marek Vasutb9b8ea32010-09-28 15:44:10 +0200283#endif
Marek Vasutb9091622011-10-31 14:12:39 +0100284/*
285 *************************************************************************
286 *
287 * CPU_init_critical registers
288 *
289 * setup important registers
290 * setup memory timing
291 *
292 *************************************************************************
293 */
294#ifndef CONFIG_SKIP_LOWLEVEL_INIT
295cpu_init_crit:
296 /*
297 * flush v4 I/D caches
298 */
299 mov r0, #0
300 mcr p15, 0, r0, c7, c7, 0 /* Invalidate I+D+BTB caches */
301 mcr p15, 0, r0, c8, c7, 0 /* Invalidate Unified TLB */
Markus Klotzbücherd5dfcf92006-02-28 23:11:07 +0100302
Marek Vasutb9091622011-10-31 14:12:39 +0100303 /*
304 * disable MMU stuff and caches
305 */
306 mrc p15, 0, r0, c1, c0, 0
307 bic r0, r0, #0x00002300 @ clear bits 13, 9:8 (--V- --RS)
308 bic r0, r0, #0x00000087 @ clear bits 7, 2:0 (B--- -CAM)
309 orr r0, r0, #0x00000002 @ set bit 2 (A) Align
310 orr r0, r0, #0x00001000 @ set bit 12 (I) I-Cache
311 mcr p15, 0, r0, c1, c0, 0
wdenk1fe2c702003-03-06 21:55:29 +0000312
Marek Vasutb9091622011-10-31 14:12:39 +0100313 mov pc, lr /* back to my caller */
314#endif /* CONFIG_SKIP_LOWLEVEL_INIT */
wdenkc6097192002-11-03 00:24:07 +0000315
Aneesh V552a3192011-07-13 05:11:07 +0000316#ifndef CONFIG_SPL_BUILD
Marek Vasutb9091622011-10-31 14:12:39 +0100317/*
318 *************************************************************************
319 *
320 * Interrupt handling
321 *
322 *************************************************************************
323 */
324@
325@ IRQ stack frame.
326@
wdenkc6097192002-11-03 00:24:07 +0000327#define S_FRAME_SIZE 72
328
329#define S_OLD_R0 68
330#define S_PSR 64
331#define S_PC 60
332#define S_LR 56
333#define S_SP 52
334
335#define S_IP 48
336#define S_FP 44
337#define S_R10 40
338#define S_R9 36
339#define S_R8 32
340#define S_R7 28
341#define S_R6 24
342#define S_R5 20
343#define S_R4 16
344#define S_R3 12
345#define S_R2 8
346#define S_R1 4
347#define S_R0 0
348
349#define MODE_SVC 0x13
Marek Vasutb9091622011-10-31 14:12:39 +0100350#define I_BIT 0x80
wdenkc6097192002-11-03 00:24:07 +0000351
Marek Vasutb9091622011-10-31 14:12:39 +0100352/*
353 * use bad_save_user_regs for abort/prefetch/undef/swi ...
354 * use irq_save_user_regs / irq_restore_user_regs for IRQ/FIQ handling
355 */
wdenkc6097192002-11-03 00:24:07 +0000356
357 .macro bad_save_user_regs
Marek Vasutb9091622011-10-31 14:12:39 +0100358 sub sp, sp, #S_FRAME_SIZE @ carve out a frame on current user stack
359 stmia sp, {r0 - r12} @ Save user registers (now in svc mode) r0-r12
wdenkc6097192002-11-03 00:24:07 +0000360
Marek Vasutb9091622011-10-31 14:12:39 +0100361 ldr r2, IRQ_STACK_START_IN @ set base 2 words into abort stack
362 ldmia r2, {r2 - r3} @ get values for "aborted" pc and cpsr (into parm regs)
363 add r0, sp, #S_FRAME_SIZE @ grab pointer to old stack
wdenkc6097192002-11-03 00:24:07 +0000364
365 add r5, sp, #S_SP
366 mov r1, lr
Marek Vasutb9091622011-10-31 14:12:39 +0100367 stmia r5, {r0 - r3} @ save sp_SVC, lr_SVC, pc, cpsr
368 mov r0, sp @ save current stack into r0 (param register)
wdenkc6097192002-11-03 00:24:07 +0000369 .endm
370
wdenkc6097192002-11-03 00:24:07 +0000371 .macro irq_save_user_regs
372 sub sp, sp, #S_FRAME_SIZE
Marek Vasutb9091622011-10-31 14:12:39 +0100373 stmia sp, {r0 - r12} @ Calling r0-r12
374 add r8, sp, #S_PC @ !!!! R8 NEEDS to be saved !!!! a reserved stack spot would be good.
375 stmdb r8, {sp, lr}^ @ Calling SP, LR
376 str lr, [r8, #0] @ Save calling PC
wdenk384ae022002-11-05 00:17:55 +0000377 mrs r6, spsr
Marek Vasutb9091622011-10-31 14:12:39 +0100378 str r6, [r8, #4] @ Save CPSR
379 str r0, [r8, #8] @ Save OLD_R0
wdenkc6097192002-11-03 00:24:07 +0000380 mov r0, sp
381 .endm
382
383 .macro irq_restore_user_regs
384 ldmia sp, {r0 - lr}^ @ Calling r0 - lr
385 mov r0, r0
386 ldr lr, [sp, #S_PC] @ Get PC
387 add sp, sp, #S_FRAME_SIZE
388 subs pc, lr, #4 @ return & move spsr_svc into cpsr
389 .endm
390
391 .macro get_bad_stack
Marek Vasutb9091622011-10-31 14:12:39 +0100392 ldr r13, IRQ_STACK_START_IN @ setup our mode stack (enter in banked mode)
wdenkc6097192002-11-03 00:24:07 +0000393
Marek Vasutb9091622011-10-31 14:12:39 +0100394 str lr, [r13] @ save caller lr in position 0 of saved stack
395 mrs lr, spsr @ get the spsr
396 str lr, [r13, #4] @ save spsr in position 1 of saved stack
wdenkc6097192002-11-03 00:24:07 +0000397
398 mov r13, #MODE_SVC @ prepare SVC-Mode
Marek Vasutb9091622011-10-31 14:12:39 +0100399 @ msr spsr_c, r13
400 msr spsr, r13 @ switch modes, make sure moves will execute
401 mov lr, pc @ capture return pc
402 movs pc, lr @ jump to next instruction & switch modes.
403 .endm
404
405 .macro get_bad_stack_swi
406 sub r13, r13, #4 @ space on current stack for scratch reg.
407 str r0, [r13] @ save R0's value.
408 ldr r0, IRQ_STACK_START_IN @ get data regions start
409 str lr, [r0] @ save caller lr in position 0 of saved stack
410 mrs r0, spsr @ get the spsr
411 str lr, [r0, #4] @ save spsr in position 1 of saved stack
412 ldr r0, [r13] @ restore r0
413 add r13, r13, #4 @ pop stack entry
wdenkc6097192002-11-03 00:24:07 +0000414 .endm
415
416 .macro get_irq_stack @ setup IRQ stack
417 ldr sp, IRQ_STACK_START
418 .endm
419
420 .macro get_fiq_stack @ setup FIQ stack
421 ldr sp, FIQ_STACK_START
422 .endm
Marek Vasutb9091622011-10-31 14:12:39 +0100423#endif /* CONFIG_SPL_BUILD */
wdenkc6097192002-11-03 00:24:07 +0000424
Marek Vasutb9091622011-10-31 14:12:39 +0100425/*
426 * exception handlers
427 */
Aneesh V552a3192011-07-13 05:11:07 +0000428#ifdef CONFIG_SPL_BUILD
Marek Vasutc13685c2010-07-06 02:48:35 +0200429 .align 5
430do_hang:
Marek Vasutb9091622011-10-31 14:12:39 +0100431 ldr sp, _TEXT_BASE /* use 32 words about stack */
Marek Vasutc13685c2010-07-06 02:48:35 +0200432 bl hang /* hang and never return */
Marek Vasutb9091622011-10-31 14:12:39 +0100433#else /* !CONFIG_SPL_BUILD */
wdenk384ae022002-11-05 00:17:55 +0000434 .align 5
wdenkc6097192002-11-03 00:24:07 +0000435undefined_instruction:
436 get_bad_stack
437 bad_save_user_regs
wdenk384ae022002-11-05 00:17:55 +0000438 bl do_undefined_instruction
wdenkc6097192002-11-03 00:24:07 +0000439
440 .align 5
441software_interrupt:
Marek Vasutb9091622011-10-31 14:12:39 +0100442 get_bad_stack_swi
wdenkc6097192002-11-03 00:24:07 +0000443 bad_save_user_regs
wdenk384ae022002-11-05 00:17:55 +0000444 bl do_software_interrupt
wdenkc6097192002-11-03 00:24:07 +0000445
446 .align 5
447prefetch_abort:
448 get_bad_stack
449 bad_save_user_regs
wdenk384ae022002-11-05 00:17:55 +0000450 bl do_prefetch_abort
wdenkc6097192002-11-03 00:24:07 +0000451
452 .align 5
453data_abort:
454 get_bad_stack
455 bad_save_user_regs
wdenk384ae022002-11-05 00:17:55 +0000456 bl do_data_abort
wdenkc6097192002-11-03 00:24:07 +0000457
458 .align 5
459not_used:
460 get_bad_stack
461 bad_save_user_regs
wdenk384ae022002-11-05 00:17:55 +0000462 bl do_not_used
wdenkc6097192002-11-03 00:24:07 +0000463
464#ifdef CONFIG_USE_IRQ
465
466 .align 5
467irq:
468 get_irq_stack
469 irq_save_user_regs
wdenk384ae022002-11-05 00:17:55 +0000470 bl do_irq
wdenkc6097192002-11-03 00:24:07 +0000471 irq_restore_user_regs
472
473 .align 5
474fiq:
475 get_fiq_stack
Marek Vasutb9091622011-10-31 14:12:39 +0100476 /* someone ought to write a more effiction fiq_save_user_regs */
477 irq_save_user_regs
478 bl do_fiq
wdenkc6097192002-11-03 00:24:07 +0000479 irq_restore_user_regs
480
Marek Vasutb9091622011-10-31 14:12:39 +0100481#else
wdenkc6097192002-11-03 00:24:07 +0000482
483 .align 5
484irq:
485 get_bad_stack
486 bad_save_user_regs
wdenk384ae022002-11-05 00:17:55 +0000487 bl do_irq
wdenkc6097192002-11-03 00:24:07 +0000488
489 .align 5
490fiq:
491 get_bad_stack
492 bad_save_user_regs
wdenk384ae022002-11-05 00:17:55 +0000493 bl do_fiq
wdenk384ae022002-11-05 00:17:55 +0000494
Marek Vasutb9091622011-10-31 14:12:39 +0100495#endif
496 .align 5
Aneesh V552a3192011-07-13 05:11:07 +0000497#endif /* CONFIG_SPL_BUILD */