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