blob: 7556ec9fbd043f14b04cdc32e0509ec992c8fb31 [file] [log] [blame]
Wolfgang Denk97caf672006-03-12 02:12:27 +01001/*
2 * U-boot - interrupt.S Processing of interrupts and exception handling
3 *
Aubrey Li314d22f2007-04-05 18:31:18 +08004 * Copyright (c) 2005-2007 Analog Devices Inc.
Wolfgang Denk97caf672006-03-12 02:12:27 +01005 *
6 * (C) Copyright 2000-2004
7 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
8 *
9 * This file is based on interrupt.S
10 *
11 * Copyright (C) 2003 Metrowerks, Inc. <mwaddel@metrowerks.com>
12 * Copyright (C) 2002 Arcturus Networks Ltd. Ted Ma <mated@sympatico.ca>
13 * Copyright (C) 1998 D. Jeff Dionne <jeff@ryeham.ee.ryerson.ca>,
14 * Kenneth Albanowski <kjahds@kjahds.com>,
15 * The Silver Hammer Group, Ltd.
16 *
17 * (c) 1995, Dionne & Associates
18 * (c) 1995, DKG Display Tech.
19 *
20 * This file is also based on exception.asm
21 * (C) Copyright 2001-2005 - Analog Devices, Inc. All rights reserved.
22 *
23 * See file CREDITS for list of people who contributed to this
24 * project.
25 *
26 * This program is free software; you can redistribute it and/or
27 * modify it under the terms of the GNU General Public License as
28 * published by the Free Software Foundation; either version 2 of
29 * the License, or (at your option) any later version.
30 *
31 * This program is distributed in the hope that it will be useful,
32 * but WITHOUT ANY WARRANTY; without even the implied warranty of
33 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34 * GNU General Public License for more details.
35 *
36 * You should have received a copy of the GNU General Public License
37 * along with this program; if not, write to the Free Software
Aubrey Li314d22f2007-04-05 18:31:18 +080038 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
39 * MA 02110-1301 USA
Wolfgang Denk97caf672006-03-12 02:12:27 +010040 */
41
42#define ASSEMBLY
Aubrey.Li9da597f2007-03-09 13:38:44 +080043#include <config.h>
44#include <asm/blackfin.h>
Wolfgang Denk97caf672006-03-12 02:12:27 +010045#include <asm/entry.h>
Wolfgang Denk97caf672006-03-12 02:12:27 +010046
Aubrey.Li9da597f2007-03-09 13:38:44 +080047.global _blackfin_irq_panic;
Wolfgang Denk97caf672006-03-12 02:12:27 +010048
49.text
50.align 2
51
52#ifndef CONFIG_KGDB
Aubrey.Li9da597f2007-03-09 13:38:44 +080053.global _evt_emulation
54_evt_emulation:
Wolfgang Denk97caf672006-03-12 02:12:27 +010055 SAVE_CONTEXT
Mike Frysinger66c4cf42008-02-04 19:26:55 -050056 r0 = 0;
Wolfgang Denk97caf672006-03-12 02:12:27 +010057 r1 = seqstat;
58 sp += -12;
Aubrey.Li9da597f2007-03-09 13:38:44 +080059 call _blackfin_irq_panic;
Wolfgang Denk97caf672006-03-12 02:12:27 +010060 sp += 12;
61 rte;
62#endif
63
Aubrey.Li9da597f2007-03-09 13:38:44 +080064.global _evt_nmi
65_evt_nmi:
Wolfgang Denk97caf672006-03-12 02:12:27 +010066 SAVE_CONTEXT
Mike Frysinger66c4cf42008-02-04 19:26:55 -050067 r0 = 2;
Wolfgang Denk97caf672006-03-12 02:12:27 +010068 r1 = RETN;
69 sp += -12;
Aubrey.Li9da597f2007-03-09 13:38:44 +080070 call _blackfin_irq_panic;
Wolfgang Denk97caf672006-03-12 02:12:27 +010071 sp += 12;
72
73_evt_nmi_exit:
74 rtn;
75
Aubrey.Li9da597f2007-03-09 13:38:44 +080076.global _trap
77_trap:
78 SAVE_ALL_SYS
79 r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */
80 sp += -12;
81 call _trap_c
82 sp += 12;
83 RESTORE_ALL_SYS
84 rtx;
Wolfgang Denk97caf672006-03-12 02:12:27 +010085
Aubrey.Li9da597f2007-03-09 13:38:44 +080086.global _evt_rst
87_evt_rst:
Wolfgang Denk97caf672006-03-12 02:12:27 +010088 SAVE_CONTEXT
Mike Frysinger66c4cf42008-02-04 19:26:55 -050089 r0 = 1;
Wolfgang Denk97caf672006-03-12 02:12:27 +010090 r1 = RETN;
91 sp += -12;
Aubrey.Li9da597f2007-03-09 13:38:44 +080092 call _do_reset;
Wolfgang Denk97caf672006-03-12 02:12:27 +010093 sp += 12;
94
95_evt_rst_exit:
Aubrey Lif83a65c2007-03-10 23:49:29 +080096 rtn;
Wolfgang Denk97caf672006-03-12 02:12:27 +010097
98irq_panic:
Mike Frysinger66c4cf42008-02-04 19:26:55 -050099 r0 = 3;
Wolfgang Denk97caf672006-03-12 02:12:27 +0100100 r1 = sp;
101 sp += -12;
Aubrey.Li9da597f2007-03-09 13:38:44 +0800102 call _blackfin_irq_panic;
Wolfgang Denk97caf672006-03-12 02:12:27 +0100103 sp += 12;
104
Aubrey.Li9da597f2007-03-09 13:38:44 +0800105.global _evt_ivhw
106_evt_ivhw:
Wolfgang Denk97caf672006-03-12 02:12:27 +0100107 SAVE_CONTEXT
108 RAISE 14;
109
110_evt_ivhw_exit:
111 rti;
112
Aubrey.Li9da597f2007-03-09 13:38:44 +0800113.global _evt_timer
114_evt_timer:
Wolfgang Denk97caf672006-03-12 02:12:27 +0100115 SAVE_CONTEXT
Mike Frysinger66c4cf42008-02-04 19:26:55 -0500116 r0 = 6;
Wolfgang Denk97caf672006-03-12 02:12:27 +0100117 sp += -12;
118 /* Polling method used now. */
119 /* call timer_int; */
120 sp += 12;
121 RESTORE_CONTEXT
122 rti;
123 nop;
124
Aubrey.Li9da597f2007-03-09 13:38:44 +0800125.global _evt_evt7
126_evt_evt7:
Wolfgang Denk97caf672006-03-12 02:12:27 +0100127 SAVE_CONTEXT
128 r0 = 7;
129 sp += -12;
Aubrey.Li9da597f2007-03-09 13:38:44 +0800130 call _process_int;
Wolfgang Denk97caf672006-03-12 02:12:27 +0100131 sp += 12;
132
133evt_evt7_exit:
134 RESTORE_CONTEXT
Aubrey Lif83a65c2007-03-10 23:49:29 +0800135 rti;
Wolfgang Denk97caf672006-03-12 02:12:27 +0100136
Aubrey.Li9da597f2007-03-09 13:38:44 +0800137.global _evt_evt8
138_evt_evt8:
Wolfgang Denk97caf672006-03-12 02:12:27 +0100139 SAVE_CONTEXT
140 r0 = 8;
141 sp += -12;
Aubrey.Li9da597f2007-03-09 13:38:44 +0800142 call _process_int;
Wolfgang Denk97caf672006-03-12 02:12:27 +0100143 sp += 12;
144
145evt_evt8_exit:
146 RESTORE_CONTEXT
147 rti;
148
Aubrey.Li9da597f2007-03-09 13:38:44 +0800149.global _evt_evt9
150_evt_evt9:
Wolfgang Denk97caf672006-03-12 02:12:27 +0100151 SAVE_CONTEXT
152 r0 = 9;
153 sp += -12;
Aubrey.Li9da597f2007-03-09 13:38:44 +0800154 call _process_int;
Wolfgang Denk97caf672006-03-12 02:12:27 +0100155 sp += 12;
156
157evt_evt9_exit:
158 RESTORE_CONTEXT
159 rti;
160
Aubrey.Li9da597f2007-03-09 13:38:44 +0800161.global _evt_evt10
162_evt_evt10:
Wolfgang Denk97caf672006-03-12 02:12:27 +0100163 SAVE_CONTEXT
164 r0 = 10;
165 sp += -12;
Aubrey.Li9da597f2007-03-09 13:38:44 +0800166 call _process_int;
Wolfgang Denk97caf672006-03-12 02:12:27 +0100167 sp += 12;
168
169evt_evt10_exit:
170 RESTORE_CONTEXT
171 rti;
172
Aubrey.Li9da597f2007-03-09 13:38:44 +0800173.global _evt_evt11
174_evt_evt11:
Wolfgang Denk97caf672006-03-12 02:12:27 +0100175 SAVE_CONTEXT
176 r0 = 11;
177 sp += -12;
Aubrey.Li9da597f2007-03-09 13:38:44 +0800178 call _process_int;
Wolfgang Denk97caf672006-03-12 02:12:27 +0100179 sp += 12;
180
181evt_evt11_exit:
182 RESTORE_CONTEXT
183 rti;
184
Aubrey.Li9da597f2007-03-09 13:38:44 +0800185.global _evt_evt12
186_evt_evt12:
Wolfgang Denk97caf672006-03-12 02:12:27 +0100187 SAVE_CONTEXT
188 r0 = 12;
189 sp += -12;
Aubrey.Li9da597f2007-03-09 13:38:44 +0800190 call _process_int;
Wolfgang Denk97caf672006-03-12 02:12:27 +0100191 sp += 12;
192evt_evt12_exit:
193 RESTORE_CONTEXT
194 rti;
195
Aubrey.Li9da597f2007-03-09 13:38:44 +0800196.global _evt_evt13
197_evt_evt13:
Wolfgang Denk97caf672006-03-12 02:12:27 +0100198 SAVE_CONTEXT
199 r0 = 13;
200 sp += -12;
Aubrey.Li9da597f2007-03-09 13:38:44 +0800201 call _process_int;
Wolfgang Denk97caf672006-03-12 02:12:27 +0100202 sp += 12;
203
204evt_evt13_exit:
205 RESTORE_CONTEXT
206 rti;
207
Aubrey.Li9da597f2007-03-09 13:38:44 +0800208.global _evt_system_call
209_evt_system_call:
Wolfgang Denk97caf672006-03-12 02:12:27 +0100210 [--sp] = r0;
211 [--SP] = RETI;
212 r0 = [sp++];
213 r0 += 2;
214 [--sp] = r0;
215 RETI = [SP++];
216 r0 = [SP++];
217 SAVE_CONTEXT
218 sp += -12;
Aubrey.Li9da597f2007-03-09 13:38:44 +0800219 call _exception_handle;
Wolfgang Denk97caf672006-03-12 02:12:27 +0100220 sp += 12;
221 RESTORE_CONTEXT
222 RTI;
223
224evt_system_call_exit:
225 rti;
226
Aubrey.Li9da597f2007-03-09 13:38:44 +0800227.global _evt_soft_int1
228_evt_soft_int1:
Wolfgang Denk97caf672006-03-12 02:12:27 +0100229 [--sp] = r0;
230 [--SP] = RETI;
231 r0 = [sp++];
232 r0 += 2;
233 [--sp] = r0;
234 RETI = [SP++];
235 r0 = [SP++];
236 SAVE_CONTEXT
237 sp += -12;
Aubrey.Li9da597f2007-03-09 13:38:44 +0800238 call _exception_handle;
Wolfgang Denk97caf672006-03-12 02:12:27 +0100239 sp += 12;
240 RESTORE_CONTEXT
241 RTI;
242
243evt_soft_int1_exit:
244 rti;