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