Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 1 | /* |
| 2 | * U-boot - interrupt.S Processing of interrupts and exception handling |
| 3 | * |
Aubrey Li | 155fd76 | 2007-04-05 18:31:18 +0800 | [diff] [blame] | 4 | * Copyright (c) 2005-2007 Analog Devices Inc. |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 5 | * |
| 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 Li | 155fd76 | 2007-04-05 18:31:18 +0800 | [diff] [blame] | 38 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
| 39 | * MA 02110-1301 USA |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 40 | */ |
| 41 | |
| 42 | #define ASSEMBLY |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 43 | #include <config.h> |
| 44 | #include <asm/blackfin.h> |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 45 | #include <asm/hw_irq.h> |
| 46 | #include <asm/entry.h> |
| 47 | #include <asm/blackfin_defs.h> |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 48 | |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 49 | .global _blackfin_irq_panic; |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 50 | |
| 51 | .text |
| 52 | .align 2 |
| 53 | |
| 54 | #ifndef CONFIG_KGDB |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 55 | .global _evt_emulation |
| 56 | _evt_emulation: |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 57 | SAVE_CONTEXT |
| 58 | r0 = IRQ_EMU; |
| 59 | r1 = seqstat; |
| 60 | sp += -12; |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 61 | call _blackfin_irq_panic; |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 62 | sp += 12; |
| 63 | rte; |
| 64 | #endif |
| 65 | |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 66 | .global _evt_nmi |
| 67 | _evt_nmi: |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 68 | SAVE_CONTEXT |
| 69 | r0 = IRQ_NMI; |
| 70 | r1 = RETN; |
| 71 | sp += -12; |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 72 | call _blackfin_irq_panic; |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 73 | sp += 12; |
| 74 | |
| 75 | _evt_nmi_exit: |
| 76 | rtn; |
| 77 | |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 78 | .global _trap |
| 79 | _trap: |
| 80 | SAVE_ALL_SYS |
| 81 | r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */ |
| 82 | sp += -12; |
| 83 | call _trap_c |
| 84 | sp += 12; |
| 85 | RESTORE_ALL_SYS |
| 86 | rtx; |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 87 | |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 88 | .global _evt_rst |
| 89 | _evt_rst: |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 90 | SAVE_CONTEXT |
| 91 | r0 = IRQ_RST; |
| 92 | r1 = RETN; |
| 93 | sp += -12; |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 94 | call _do_reset; |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 95 | sp += 12; |
| 96 | |
| 97 | _evt_rst_exit: |
Aubrey Li | 8db13d6 | 2007-03-10 23:49:29 +0800 | [diff] [blame] | 98 | rtn; |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 99 | |
| 100 | irq_panic: |
| 101 | r0 = IRQ_EVX; |
| 102 | r1 = sp; |
| 103 | sp += -12; |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 104 | call _blackfin_irq_panic; |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 105 | sp += 12; |
| 106 | |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 107 | .global _evt_ivhw |
| 108 | _evt_ivhw: |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 109 | SAVE_CONTEXT |
| 110 | RAISE 14; |
| 111 | |
| 112 | _evt_ivhw_exit: |
| 113 | rti; |
| 114 | |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 115 | .global _evt_timer |
| 116 | _evt_timer: |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 117 | SAVE_CONTEXT |
| 118 | r0 = IRQ_CORETMR; |
| 119 | sp += -12; |
| 120 | /* Polling method used now. */ |
| 121 | /* call timer_int; */ |
| 122 | sp += 12; |
| 123 | RESTORE_CONTEXT |
| 124 | rti; |
| 125 | nop; |
| 126 | |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 127 | .global _evt_evt7 |
| 128 | _evt_evt7: |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 129 | SAVE_CONTEXT |
| 130 | r0 = 7; |
| 131 | sp += -12; |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 132 | call _process_int; |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 133 | sp += 12; |
| 134 | |
| 135 | evt_evt7_exit: |
| 136 | RESTORE_CONTEXT |
Aubrey Li | 8db13d6 | 2007-03-10 23:49:29 +0800 | [diff] [blame] | 137 | rti; |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 138 | |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 139 | .global _evt_evt8 |
| 140 | _evt_evt8: |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 141 | SAVE_CONTEXT |
| 142 | r0 = 8; |
| 143 | sp += -12; |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 144 | call _process_int; |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 145 | sp += 12; |
| 146 | |
| 147 | evt_evt8_exit: |
| 148 | RESTORE_CONTEXT |
| 149 | rti; |
| 150 | |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 151 | .global _evt_evt9 |
| 152 | _evt_evt9: |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 153 | SAVE_CONTEXT |
| 154 | r0 = 9; |
| 155 | sp += -12; |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 156 | call _process_int; |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 157 | sp += 12; |
| 158 | |
| 159 | evt_evt9_exit: |
| 160 | RESTORE_CONTEXT |
| 161 | rti; |
| 162 | |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 163 | .global _evt_evt10 |
| 164 | _evt_evt10: |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 165 | SAVE_CONTEXT |
| 166 | r0 = 10; |
| 167 | sp += -12; |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 168 | call _process_int; |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 169 | sp += 12; |
| 170 | |
| 171 | evt_evt10_exit: |
| 172 | RESTORE_CONTEXT |
| 173 | rti; |
| 174 | |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 175 | .global _evt_evt11 |
| 176 | _evt_evt11: |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 177 | SAVE_CONTEXT |
| 178 | r0 = 11; |
| 179 | sp += -12; |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 180 | call _process_int; |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 181 | sp += 12; |
| 182 | |
| 183 | evt_evt11_exit: |
| 184 | RESTORE_CONTEXT |
| 185 | rti; |
| 186 | |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 187 | .global _evt_evt12 |
| 188 | _evt_evt12: |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 189 | SAVE_CONTEXT |
| 190 | r0 = 12; |
| 191 | sp += -12; |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 192 | call _process_int; |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 193 | sp += 12; |
| 194 | evt_evt12_exit: |
| 195 | RESTORE_CONTEXT |
| 196 | rti; |
| 197 | |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 198 | .global _evt_evt13 |
| 199 | _evt_evt13: |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 200 | SAVE_CONTEXT |
| 201 | r0 = 13; |
| 202 | sp += -12; |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 203 | call _process_int; |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 204 | sp += 12; |
| 205 | |
| 206 | evt_evt13_exit: |
| 207 | RESTORE_CONTEXT |
| 208 | rti; |
| 209 | |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 210 | .global _evt_system_call |
| 211 | _evt_system_call: |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 212 | [--sp] = r0; |
| 213 | [--SP] = RETI; |
| 214 | r0 = [sp++]; |
| 215 | r0 += 2; |
| 216 | [--sp] = r0; |
| 217 | RETI = [SP++]; |
| 218 | r0 = [SP++]; |
| 219 | SAVE_CONTEXT |
| 220 | sp += -12; |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 221 | call _exception_handle; |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 222 | sp += 12; |
| 223 | RESTORE_CONTEXT |
| 224 | RTI; |
| 225 | |
| 226 | evt_system_call_exit: |
| 227 | rti; |
| 228 | |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 229 | .global _evt_soft_int1 |
| 230 | _evt_soft_int1: |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 231 | [--sp] = r0; |
| 232 | [--SP] = RETI; |
| 233 | r0 = [sp++]; |
| 234 | r0 += 2; |
| 235 | [--sp] = r0; |
| 236 | RETI = [SP++]; |
| 237 | r0 = [SP++]; |
| 238 | SAVE_CONTEXT |
| 239 | sp += -12; |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 240 | call _exception_handle; |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 241 | sp += 12; |
| 242 | RESTORE_CONTEXT |
| 243 | RTI; |
| 244 | |
| 245 | evt_soft_int1_exit: |
| 246 | rti; |