Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 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> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 33 | #include <linux/linkage.h> |
| 34 | #include <asm/entry.h> |
| 35 | #include <asm/asm-offsets.h> |
Robin Getz | 669b792 | 2007-06-21 16:34:08 +0800 | [diff] [blame] | 36 | #include <asm/trace.h> |
Robin Getz | 13fe24f | 2008-01-27 15:38:56 +0800 | [diff] [blame] | 37 | #include <asm/traps.h> |
| 38 | #include <asm/thread_info.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 39 | |
| 40 | #include <asm/mach-common/context.S> |
| 41 | |
Robin Getz | 13fe24f | 2008-01-27 15:38:56 +0800 | [diff] [blame] | 42 | .extern _ret_from_exception |
| 43 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 44 | #ifdef CONFIG_I_ENTRY_L1 |
| 45 | .section .l1.text |
| 46 | #else |
| 47 | .text |
| 48 | #endif |
| 49 | |
| 50 | .align 4 /* just in case */ |
| 51 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 52 | /* Common interrupt entry code. First we do CLI, then push |
| 53 | * RETI, to keep interrupts disabled, but to allow this state to be changed |
| 54 | * by local_bh_enable. |
| 55 | * R0 contains the interrupt number, while R1 may contain the value of IPEND, |
| 56 | * or garbage if IPEND won't be needed by the ISR. */ |
| 57 | __common_int_entry: |
| 58 | [--sp] = fp; |
| 59 | [--sp] = usp; |
| 60 | |
| 61 | [--sp] = i0; |
| 62 | [--sp] = i1; |
| 63 | [--sp] = i2; |
| 64 | [--sp] = i3; |
| 65 | |
| 66 | [--sp] = m0; |
| 67 | [--sp] = m1; |
| 68 | [--sp] = m2; |
| 69 | [--sp] = m3; |
| 70 | |
| 71 | [--sp] = l0; |
| 72 | [--sp] = l1; |
| 73 | [--sp] = l2; |
| 74 | [--sp] = l3; |
| 75 | |
| 76 | [--sp] = b0; |
| 77 | [--sp] = b1; |
| 78 | [--sp] = b2; |
| 79 | [--sp] = b3; |
| 80 | [--sp] = a0.x; |
| 81 | [--sp] = a0.w; |
| 82 | [--sp] = a1.x; |
| 83 | [--sp] = a1.w; |
| 84 | |
| 85 | [--sp] = LC0; |
| 86 | [--sp] = LC1; |
| 87 | [--sp] = LT0; |
| 88 | [--sp] = LT1; |
| 89 | [--sp] = LB0; |
| 90 | [--sp] = LB1; |
| 91 | |
| 92 | [--sp] = ASTAT; |
| 93 | |
| 94 | [--sp] = r0; /* Skip reserved */ |
| 95 | [--sp] = RETS; |
| 96 | r2 = RETI; |
| 97 | [--sp] = r2; |
| 98 | [--sp] = RETX; |
| 99 | [--sp] = RETN; |
| 100 | [--sp] = RETE; |
| 101 | [--sp] = SEQSTAT; |
| 102 | [--sp] = r1; /* IPEND - R1 may or may not be set up before jumping here. */ |
| 103 | |
| 104 | /* Switch to other method of keeping interrupts disabled. */ |
| 105 | #ifdef CONFIG_DEBUG_HWERR |
| 106 | r1 = 0x3f; |
| 107 | sti r1; |
| 108 | #else |
| 109 | cli r1; |
| 110 | #endif |
| 111 | [--sp] = RETI; /* orig_pc */ |
| 112 | /* Clear all L registers. */ |
| 113 | r1 = 0 (x); |
| 114 | l0 = r1; |
| 115 | l1 = r1; |
| 116 | l2 = r1; |
| 117 | l3 = r1; |
| 118 | #ifdef CONFIG_FRAME_POINTER |
| 119 | fp = 0; |
| 120 | #endif |
| 121 | |
Mike Frysinger | 1aafd90 | 2007-07-25 11:19:14 +0800 | [diff] [blame] | 122 | #if ANOMALY_05000283 || ANOMALY_05000315 |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 123 | cc = r7 == r7; |
Robin Getz | 0626d79 | 2007-12-21 17:46:33 +0800 | [diff] [blame] | 124 | p5.h = HI(CHIPID); |
| 125 | p5.l = LO(CHIPID); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 126 | if cc jump 1f; |
| 127 | r7.l = W[p5]; |
| 128 | 1: |
| 129 | #endif |
| 130 | r1 = sp; |
| 131 | SP += -12; |
| 132 | call _do_irq; |
| 133 | SP += 12; |
| 134 | call _return_from_int; |
| 135 | .Lcommon_restore_context: |
| 136 | RESTORE_CONTEXT |
| 137 | rti; |
| 138 | |
| 139 | /* interrupt routine for ivhw - 5 */ |
| 140 | ENTRY(_evt_ivhw) |
Robin Getz | 13fe24f | 2008-01-27 15:38:56 +0800 | [diff] [blame] | 141 | SAVE_ALL_SYS |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 142 | #ifdef CONFIG_FRAME_POINTER |
| 143 | fp = 0; |
| 144 | #endif |
Robin Getz | 13fe24f | 2008-01-27 15:38:56 +0800 | [diff] [blame] | 145 | |
Mike Frysinger | 1aafd90 | 2007-07-25 11:19:14 +0800 | [diff] [blame] | 146 | #if ANOMALY_05000283 |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 147 | cc = r7 == r7; |
Robin Getz | 0626d79 | 2007-12-21 17:46:33 +0800 | [diff] [blame] | 148 | p5.h = HI(CHIPID); |
| 149 | p5.l = LO(CHIPID); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 150 | if cc jump 1f; |
| 151 | r7.l = W[p5]; |
| 152 | 1: |
| 153 | #endif |
Robin Getz | 669b792 | 2007-06-21 16:34:08 +0800 | [diff] [blame] | 154 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 155 | #ifdef CONFIG_HARDWARE_PM |
Robin Getz | 13fe24f | 2008-01-27 15:38:56 +0800 | [diff] [blame] | 156 | r7 = [sp + PT_SEQSTAT]; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 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 |
Robin Getz | 13fe24f | 2008-01-27 15:38:56 +0800 | [diff] [blame] | 164 | # We are going to dump something out, so make sure we print IPEND properly |
| 165 | p2.l = lo(IPEND); |
| 166 | p2.h = hi(IPEND); |
| 167 | r0 = [p2]; |
| 168 | [sp + PT_IPEND] = r0; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 169 | |
Robin Getz | 13fe24f | 2008-01-27 15:38:56 +0800 | [diff] [blame] | 170 | /* set the EXCAUSE to HWERR for trap_c */ |
| 171 | r0 = [sp + PT_SEQSTAT]; |
| 172 | R1.L = LO(VEC_HWERR); |
| 173 | R1.H = HI(VEC_HWERR); |
| 174 | R0 = R0 | R1; |
| 175 | [sp + PT_SEQSTAT] = R0; |
| 176 | |
| 177 | r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 178 | SP += -12; |
Robin Getz | 13fe24f | 2008-01-27 15:38:56 +0800 | [diff] [blame] | 179 | call _trap_c; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 180 | SP += 12; |
Robin Getz | 13fe24f | 2008-01-27 15:38:56 +0800 | [diff] [blame] | 181 | |
| 182 | call _ret_from_exception; |
| 183 | .Lcommon_restore_all_sys: |
| 184 | RESTORE_ALL_SYS |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 185 | rti; |
Robin Getz | 13fe24f | 2008-01-27 15:38:56 +0800 | [diff] [blame] | 186 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 187 | #ifdef CONFIG_HARDWARE_PM |
| 188 | .Lcall_do_ovf: |
| 189 | |
| 190 | SP += -12; |
| 191 | call _pm_overflow; |
| 192 | SP += 12; |
| 193 | |
Robin Getz | 13fe24f | 2008-01-27 15:38:56 +0800 | [diff] [blame] | 194 | jump .Lcommon_restore_all_sys; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 195 | #endif |
| 196 | |
Robin Getz | 13fe24f | 2008-01-27 15:38:56 +0800 | [diff] [blame] | 197 | ENDPROC(_evt_ivhw) |
| 198 | |
Mike Frysinger | f0b5d12 | 2007-08-05 17:03:59 +0800 | [diff] [blame] | 199 | /* Interrupt routine for evt2 (NMI). |
| 200 | * We don't actually use this, so just return. |
| 201 | * For inner circle type details, please see: |
| 202 | * http://docs.blackfin.uclinux.org/doku.php?id=linux:nmi |
| 203 | */ |
| 204 | ENTRY(_evt_nmi) |
| 205 | .weak _evt_nmi |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 206 | rtn; |
Mike Frysinger | f0b5d12 | 2007-08-05 17:03:59 +0800 | [diff] [blame] | 207 | ENDPROC(_evt_nmi) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 208 | |
| 209 | /* interrupt routine for core timer - 6 */ |
| 210 | ENTRY(_evt_timer) |
| 211 | TIMER_INTERRUPT_ENTRY(EVT_IVTMR_P) |
| 212 | |
| 213 | /* interrupt routine for evt7 - 7 */ |
| 214 | ENTRY(_evt_evt7) |
| 215 | INTERRUPT_ENTRY(EVT_IVG7_P) |
| 216 | ENTRY(_evt_evt8) |
| 217 | INTERRUPT_ENTRY(EVT_IVG8_P) |
| 218 | ENTRY(_evt_evt9) |
| 219 | INTERRUPT_ENTRY(EVT_IVG9_P) |
| 220 | ENTRY(_evt_evt10) |
| 221 | INTERRUPT_ENTRY(EVT_IVG10_P) |
| 222 | ENTRY(_evt_evt11) |
| 223 | INTERRUPT_ENTRY(EVT_IVG11_P) |
| 224 | ENTRY(_evt_evt12) |
| 225 | INTERRUPT_ENTRY(EVT_IVG12_P) |
| 226 | ENTRY(_evt_evt13) |
| 227 | INTERRUPT_ENTRY(EVT_IVG13_P) |
| 228 | |
| 229 | |
| 230 | /* interrupt routine for system_call - 15 */ |
| 231 | ENTRY(_evt_system_call) |
| 232 | SAVE_CONTEXT_SYSCALL |
| 233 | #ifdef CONFIG_FRAME_POINTER |
| 234 | fp = 0; |
| 235 | #endif |
| 236 | call _system_call; |
| 237 | jump .Lcommon_restore_context; |
Mike Frysinger | 51be24c | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 238 | ENDPROC(_evt_system_call) |