[SPARC64]: Implement pci_resource_to_user()
[safe/jmp/linux-2.6] / arch / blackfin / mach-common / interrupt.S
1 /*
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/linkage.h>
34 #include <asm/entry.h>
35 #include <asm/asm-offsets.h>
36 #include <asm/trace.h>
37
38 #include <asm/mach-common/context.S>
39
40 #ifdef CONFIG_I_ENTRY_L1
41 .section .l1.text
42 #else
43 .text
44 #endif
45
46 .align 4        /* just in case */
47
48 /* Common interrupt entry code.  First we do CLI, then push
49  * RETI, to keep interrupts disabled, but to allow this state to be changed
50  * by local_bh_enable.
51  * R0 contains the interrupt number, while R1 may contain the value of IPEND,
52  * or garbage if IPEND won't be needed by the ISR.  */
53 __common_int_entry:
54         [--sp] = fp;
55         [--sp] = usp;
56
57         [--sp] = i0;
58         [--sp] = i1;
59         [--sp] = i2;
60         [--sp] = i3;
61
62         [--sp] = m0;
63         [--sp] = m1;
64         [--sp] = m2;
65         [--sp] = m3;
66
67         [--sp] = l0;
68         [--sp] = l1;
69         [--sp] = l2;
70         [--sp] = l3;
71
72         [--sp] = b0;
73         [--sp] = b1;
74         [--sp] = b2;
75         [--sp] = b3;
76         [--sp] = a0.x;
77         [--sp] = a0.w;
78         [--sp] = a1.x;
79         [--sp] = a1.w;
80
81         [--sp] = LC0;
82         [--sp] = LC1;
83         [--sp] = LT0;
84         [--sp] = LT1;
85         [--sp] = LB0;
86         [--sp] = LB1;
87
88         [--sp] = ASTAT;
89
90         [--sp] = r0;    /* Skip reserved */
91         [--sp] = RETS;
92         r2 = RETI;
93         [--sp] = r2;
94         [--sp] = RETX;
95         [--sp] = RETN;
96         [--sp] = RETE;
97         [--sp] = SEQSTAT;
98         [--sp] = r1;    /* IPEND - R1 may or may not be set up before jumping here. */
99
100         /* Switch to other method of keeping interrupts disabled.  */
101 #ifdef CONFIG_DEBUG_HWERR
102         r1 = 0x3f;
103         sti r1;
104 #else
105         cli r1;
106 #endif
107         [--sp] = RETI;  /* orig_pc */
108         /* Clear all L registers.  */
109         r1 = 0 (x);
110         l0 = r1;
111         l1 = r1;
112         l2 = r1;
113         l3 = r1;
114 #ifdef CONFIG_FRAME_POINTER
115         fp = 0;
116 #endif
117
118 #if ANOMALY_05000283 || ANOMALY_05000315
119         cc = r7 == r7;
120         p5.h = 0xffc0;
121         p5.l = 0x0014;
122         if cc jump 1f;
123         r7.l = W[p5];
124 1:
125 #endif
126         r1 =  sp;
127         SP += -12;
128         call _do_irq;
129         SP += 12;
130         call _return_from_int;
131 .Lcommon_restore_context:
132         RESTORE_CONTEXT
133         rti;
134
135 /* interrupt routine for ivhw - 5 */
136 ENTRY(_evt_ivhw)
137         SAVE_CONTEXT
138 #ifdef CONFIG_FRAME_POINTER
139         fp = 0;
140 #endif
141 #if ANOMALY_05000283
142         cc = r7 == r7;
143         p5.h = 0xffc0;
144         p5.l = 0x0014;
145         if cc jump 1f;
146         r7.l = W[p5];
147 1:
148 #endif
149
150         trace_buffer_stop(p0, r0);
151
152         r0 = IRQ_HWERR;
153         r1 = sp;
154
155 #ifdef CONFIG_HARDWARE_PM
156         r7 = SEQSTAT;
157         r7 = r7 >>> 0xe;
158         r6 = 0x1F;
159         r7 = r7 & r6;
160         r5 = 0x12;
161         cc = r7 == r5;
162         if cc jump .Lcall_do_ovf; /* deal with performance counter overflow */
163 #endif
164
165         SP += -12;
166         call _irq_panic;
167         SP += 12;
168         rti;
169 #ifdef CONFIG_HARDWARE_PM
170 .Lcall_do_ovf:
171
172         SP += -12;
173         call _pm_overflow;
174         SP += 12;
175
176         jump .Lcommon_restore_context;
177 #endif
178
179 /* Interrupt routine for evt2 (NMI).
180  * We don't actually use this, so just return.
181  * For inner circle type details, please see:
182  * http://docs.blackfin.uclinux.org/doku.php?id=linux:nmi
183  */
184 ENTRY(_evt_nmi)
185 .weak _evt_nmi
186         rtn;
187 ENDPROC(_evt_nmi)
188
189 /* interrupt routine for core timer - 6 */
190 ENTRY(_evt_timer)
191         TIMER_INTERRUPT_ENTRY(EVT_IVTMR_P)
192
193 /* interrupt routine for evt7 - 7 */
194 ENTRY(_evt_evt7)
195         INTERRUPT_ENTRY(EVT_IVG7_P)
196 ENTRY(_evt_evt8)
197         INTERRUPT_ENTRY(EVT_IVG8_P)
198 ENTRY(_evt_evt9)
199         INTERRUPT_ENTRY(EVT_IVG9_P)
200 ENTRY(_evt_evt10)
201         INTERRUPT_ENTRY(EVT_IVG10_P)
202 ENTRY(_evt_evt11)
203         INTERRUPT_ENTRY(EVT_IVG11_P)
204 ENTRY(_evt_evt12)
205         INTERRUPT_ENTRY(EVT_IVG12_P)
206 ENTRY(_evt_evt13)
207         INTERRUPT_ENTRY(EVT_IVG13_P)
208
209
210  /* interrupt routine for system_call - 15 */
211 ENTRY(_evt_system_call)
212         SAVE_CONTEXT_SYSCALL
213 #ifdef CONFIG_FRAME_POINTER
214         fp = 0;
215 #endif
216         call _system_call;
217         jump .Lcommon_restore_context;
218 ENDPROC(_evt_system_call)