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