blob: c6b32fe0f6e9f0b2cc12ebcaa3fd28e4e6ed89ef [file] [log] [blame]
Bryan Wu1394f032007-05-06 14:50:22 -07001/*
2 * File: arch/blackfin/mach-common/interrupt.S
3 * Based on:
4 * Author: D. Jeff Dionne <jeff@ryeham.ee.ryerson.ca>
5 * Kenneth Albanowski <kjahds@kjahds.com>
6 *
7 * Created: ?
8 * Description: Interrupt Entries
9 *
10 * Modified:
11 * Copyright 2004-2006 Analog Devices Inc.
12 *
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, see the file COPYING, or write
27 * to the Free Software Foundation, Inc.,
28 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 */
30
31#include <asm/blackfin.h>
32#include <asm/mach/irq.h>
33#include <linux/autoconf.h>
34#include <linux/linkage.h>
35#include <asm/entry.h>
36#include <asm/asm-offsets.h>
Robin Getz669b7922007-06-21 16:34:08 +080037#include <asm/trace.h>
Bryan Wu1394f032007-05-06 14:50:22 -070038
39#include <asm/mach-common/context.S>
40
41#ifdef CONFIG_I_ENTRY_L1
42.section .l1.text
43#else
44.text
45#endif
46
47.align 4 /* just in case */
48
Bryan Wu1394f032007-05-06 14:50:22 -070049/* Common interrupt entry code. First we do CLI, then push
50 * RETI, to keep interrupts disabled, but to allow this state to be changed
51 * by local_bh_enable.
52 * R0 contains the interrupt number, while R1 may contain the value of IPEND,
53 * or garbage if IPEND won't be needed by the ISR. */
54__common_int_entry:
55 [--sp] = fp;
56 [--sp] = usp;
57
58 [--sp] = i0;
59 [--sp] = i1;
60 [--sp] = i2;
61 [--sp] = i3;
62
63 [--sp] = m0;
64 [--sp] = m1;
65 [--sp] = m2;
66 [--sp] = m3;
67
68 [--sp] = l0;
69 [--sp] = l1;
70 [--sp] = l2;
71 [--sp] = l3;
72
73 [--sp] = b0;
74 [--sp] = b1;
75 [--sp] = b2;
76 [--sp] = b3;
77 [--sp] = a0.x;
78 [--sp] = a0.w;
79 [--sp] = a1.x;
80 [--sp] = a1.w;
81
82 [--sp] = LC0;
83 [--sp] = LC1;
84 [--sp] = LT0;
85 [--sp] = LT1;
86 [--sp] = LB0;
87 [--sp] = LB1;
88
89 [--sp] = ASTAT;
90
91 [--sp] = r0; /* Skip reserved */
92 [--sp] = RETS;
93 r2 = RETI;
94 [--sp] = r2;
95 [--sp] = RETX;
96 [--sp] = RETN;
97 [--sp] = RETE;
98 [--sp] = SEQSTAT;
99 [--sp] = r1; /* IPEND - R1 may or may not be set up before jumping here. */
100
101 /* Switch to other method of keeping interrupts disabled. */
102#ifdef CONFIG_DEBUG_HWERR
103 r1 = 0x3f;
104 sti r1;
105#else
106 cli r1;
107#endif
108 [--sp] = RETI; /* orig_pc */
109 /* Clear all L registers. */
110 r1 = 0 (x);
111 l0 = r1;
112 l1 = r1;
113 l2 = r1;
114 l3 = r1;
115#ifdef CONFIG_FRAME_POINTER
116 fp = 0;
117#endif
118
Mike Frysinger1aafd902007-07-25 11:19:14 +0800119#if ANOMALY_05000283 || ANOMALY_05000315
Bryan Wu1394f032007-05-06 14:50:22 -0700120 cc = r7 == r7;
121 p5.h = 0xffc0;
122 p5.l = 0x0014;
123 if cc jump 1f;
124 r7.l = W[p5];
1251:
126#endif
127 r1 = sp;
128 SP += -12;
129 call _do_irq;
130 SP += 12;
131 call _return_from_int;
132.Lcommon_restore_context:
133 RESTORE_CONTEXT
134 rti;
135
136/* interrupt routine for ivhw - 5 */
137ENTRY(_evt_ivhw)
138 SAVE_CONTEXT
139#ifdef CONFIG_FRAME_POINTER
140 fp = 0;
141#endif
Mike Frysinger1aafd902007-07-25 11:19:14 +0800142#if ANOMALY_05000283
Bryan Wu1394f032007-05-06 14:50:22 -0700143 cc = r7 == r7;
144 p5.h = 0xffc0;
145 p5.l = 0x0014;
146 if cc jump 1f;
147 r7.l = W[p5];
1481:
149#endif
Robin Getz669b7922007-06-21 16:34:08 +0800150
151 trace_buffer_stop(p0, r0);
152
Bryan Wu1394f032007-05-06 14:50:22 -0700153 r0 = IRQ_HWERR;
154 r1 = sp;
155
156#ifdef CONFIG_HARDWARE_PM
157 r7 = SEQSTAT;
158 r7 = r7 >>> 0xe;
159 r6 = 0x1F;
160 r7 = r7 & r6;
161 r5 = 0x12;
162 cc = r7 == r5;
163 if cc jump .Lcall_do_ovf; /* deal with performance counter overflow */
164#endif
165
166 SP += -12;
167 call _irq_panic;
168 SP += 12;
169 rti;
170#ifdef CONFIG_HARDWARE_PM
171.Lcall_do_ovf:
172
173 SP += -12;
174 call _pm_overflow;
175 SP += 12;
176
177 jump .Lcommon_restore_context;
178#endif
179
Mike Frysingerf0b5d122007-08-05 17:03:59 +0800180/* Interrupt routine for evt2 (NMI).
181 * We don't actually use this, so just return.
182 * For inner circle type details, please see:
183 * http://docs.blackfin.uclinux.org/doku.php?id=linux:nmi
184 */
185ENTRY(_evt_nmi)
186.weak _evt_nmi
Bryan Wu1394f032007-05-06 14:50:22 -0700187 rtn;
Mike Frysingerf0b5d122007-08-05 17:03:59 +0800188ENDPROC(_evt_nmi)
Bryan Wu1394f032007-05-06 14:50:22 -0700189
190/* interrupt routine for core timer - 6 */
191ENTRY(_evt_timer)
192 TIMER_INTERRUPT_ENTRY(EVT_IVTMR_P)
193
194/* interrupt routine for evt7 - 7 */
195ENTRY(_evt_evt7)
196 INTERRUPT_ENTRY(EVT_IVG7_P)
197ENTRY(_evt_evt8)
198 INTERRUPT_ENTRY(EVT_IVG8_P)
199ENTRY(_evt_evt9)
200 INTERRUPT_ENTRY(EVT_IVG9_P)
201ENTRY(_evt_evt10)
202 INTERRUPT_ENTRY(EVT_IVG10_P)
203ENTRY(_evt_evt11)
204 INTERRUPT_ENTRY(EVT_IVG11_P)
205ENTRY(_evt_evt12)
206 INTERRUPT_ENTRY(EVT_IVG12_P)
207ENTRY(_evt_evt13)
208 INTERRUPT_ENTRY(EVT_IVG13_P)
209
210
211 /* interrupt routine for system_call - 15 */
212ENTRY(_evt_system_call)
213 SAVE_CONTEXT_SYSCALL
214#ifdef CONFIG_FRAME_POINTER
215 fp = 0;
216#endif
217 call _system_call;
218 jump .Lcommon_restore_context;
Mike Frysinger51be24c2007-06-11 15:31:30 +0800219ENDPROC(_evt_system_call)