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 | * |
| 4 | * Copyright (c) 2005 blackfin.uclinux.org |
| 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 |
| 38 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 39 | * MA 02111-1307 USA |
| 40 | */ |
| 41 | |
| 42 | #define ASSEMBLY |
| 43 | |
| 44 | #include <asm/hw_irq.h> |
| 45 | #include <asm/entry.h> |
| 46 | #include <asm/blackfin_defs.h> |
| 47 | #include <asm/cpu/bf533_irq.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 | [--sp] = r0; |
| 81 | [--sp] = r1; |
| 82 | [--sp] = p0; |
| 83 | [--sp] = p1; |
| 84 | [--sp] = astat; |
| 85 | r0 = seqstat; |
| 86 | R0 <<= 26; |
| 87 | R0 >>= 26; |
| 88 | p0 = r0; |
| 89 | p1.l = EVTABLE; |
| 90 | p1.h = EVTABLE; |
| 91 | p0 = p1 + (p0 << 1); |
| 92 | r1 = W[p0] (Z); |
| 93 | p1 = r1; |
| 94 | jump (pc + p1); |
| 95 | |
| 96 | .global _EVENT1 |
| 97 | _EVENT1: |
| 98 | RAISE 14; |
| 99 | JUMP.S _EXIT; |
| 100 | |
| 101 | .global _EVENT2 |
| 102 | _EVENT2: |
| 103 | RAISE 14; |
| 104 | JUMP.S _EXIT; |
| 105 | |
| 106 | .global _EVENT3 |
| 107 | _EVENT3: |
| 108 | RAISE 14; |
| 109 | JUMP.S _EXIT; |
| 110 | |
| 111 | .global _EVENT4 |
| 112 | _EVENT4: |
| 113 | RAISE 14; |
| 114 | JUMP.S _EXIT; |
| 115 | |
| 116 | .global _EVENT5 |
| 117 | _EVENT5: |
| 118 | RAISE 14; |
| 119 | JUMP.S _EXIT; |
| 120 | |
| 121 | .global _EVENT6 |
| 122 | _EVENT6: |
| 123 | RAISE 14; |
| 124 | JUMP.S _EXIT; |
| 125 | |
| 126 | .global _EVENT7 |
| 127 | _EVENT7: |
| 128 | RAISE 15; |
| 129 | JUMP.S _EXIT; |
| 130 | |
| 131 | .global _EVENT8 |
| 132 | _EVENT8: |
| 133 | RAISE 14; |
| 134 | JUMP.S _EXIT; |
| 135 | |
| 136 | .global _EVENT9 |
| 137 | _EVENT9: |
| 138 | RAISE 14; |
| 139 | JUMP.S _EXIT; |
| 140 | |
| 141 | .global _EVENT10 |
| 142 | _EVENT10: |
| 143 | RAISE 14; |
| 144 | JUMP.S _EXIT; |
| 145 | |
| 146 | .global _EVENT11 |
| 147 | _EVENT11: |
| 148 | RAISE 14; |
| 149 | JUMP.S _EXIT; |
| 150 | |
| 151 | .global _EVENT12 |
| 152 | _EVENT12: |
| 153 | RAISE 14; |
| 154 | JUMP.S _EXIT; |
| 155 | |
| 156 | .global _EVENT13 |
| 157 | _EVENT13: |
| 158 | RAISE 14; |
| 159 | JUMP.S _EXIT; |
| 160 | |
| 161 | .global _EVENT14 |
| 162 | _EVENT14: |
| 163 | /* RAISE 14; */ |
| 164 | CALL _cplb_hdr; |
| 165 | JUMP.S _EXIT; |
| 166 | |
| 167 | .global _EVENT19 |
| 168 | _EVENT19: |
| 169 | RAISE 14; |
| 170 | JUMP.S _EXIT; |
| 171 | |
| 172 | .global _EVENT20 |
| 173 | _EVENT20: |
| 174 | RAISE 14; |
| 175 | JUMP.S _EXIT; |
| 176 | |
| 177 | .global _EVENT21 |
| 178 | _EVENT21: |
| 179 | RAISE 14; |
| 180 | JUMP.S _EXIT; |
| 181 | |
| 182 | .global _EXIT |
| 183 | _EXIT: |
| 184 | ASTAT = [sp++]; |
| 185 | p1 = [sp++]; |
| 186 | p0 = [sp++]; |
| 187 | r1 = [sp++]; |
| 188 | r0 = [sp++]; |
| 189 | RTX; |
| 190 | |
| 191 | EVTABLE: |
| 192 | .byte2 0x0000; |
| 193 | .byte2 0x0000; |
| 194 | .byte2 0x0000; |
| 195 | .byte2 0x0000; |
| 196 | .byte2 0x0000; |
| 197 | .byte2 0x0000; |
| 198 | .byte2 0x0000; |
| 199 | .byte2 0x0000; |
| 200 | .byte2 0x0000; |
| 201 | .byte2 0x0000; |
| 202 | .byte2 0x0000; |
| 203 | .byte2 0x0000; |
| 204 | .byte2 0x0000; |
| 205 | .byte2 0x0000; |
| 206 | .byte2 0x0000; |
| 207 | .byte2 0x0000; |
| 208 | .byte2 0x003E; |
| 209 | .byte2 0x0042; |
| 210 | .byte4 0x0000; |
| 211 | .byte4 0x0000; |
| 212 | .byte4 0x0000; |
| 213 | .byte4 0x0000; |
| 214 | .byte4 0x0000; |
| 215 | .byte4 0x0000; |
| 216 | .byte4 0x0000; |
| 217 | .byte2 0x0000; |
| 218 | .byte2 0x001E; |
| 219 | .byte2 0x0022; |
| 220 | .byte2 0x0032; |
| 221 | .byte2 0x002e; |
| 222 | .byte2 0x0002; |
| 223 | .byte2 0x0036; |
| 224 | .byte2 0x002A; |
| 225 | .byte2 0x001A; |
| 226 | .byte2 0x0016; |
| 227 | .byte2 0x000A; |
| 228 | .byte2 0x000E; |
| 229 | .byte2 0x0012; |
| 230 | .byte2 0x0006; |
| 231 | .byte2 0x0026; |
| 232 | |
| 233 | .global evt_rst |
| 234 | evt_rst: |
| 235 | SAVE_CONTEXT |
| 236 | r0 = IRQ_RST; |
| 237 | r1 = RETN; |
| 238 | sp += -12; |
| 239 | call do_reset; |
| 240 | sp += 12; |
| 241 | |
| 242 | _evt_rst_exit: |
Wolfgang Denk | 2bad868 | 2006-03-12 02:55:22 +0100 | [diff] [blame] | 243 | rtn; |
Wolfgang Denk | 97caf67 | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 244 | |
| 245 | irq_panic: |
| 246 | r0 = IRQ_EVX; |
| 247 | r1 = sp; |
| 248 | sp += -12; |
| 249 | call blackfin_irq_panic; |
| 250 | sp += 12; |
| 251 | |
| 252 | .global evt_ivhw |
| 253 | evt_ivhw: |
| 254 | SAVE_CONTEXT |
| 255 | RAISE 14; |
| 256 | |
| 257 | _evt_ivhw_exit: |
| 258 | rti; |
| 259 | |
| 260 | .global evt_timer |
| 261 | evt_timer: |
| 262 | SAVE_CONTEXT |
| 263 | r0 = IRQ_CORETMR; |
| 264 | sp += -12; |
| 265 | /* Polling method used now. */ |
| 266 | /* call timer_int; */ |
| 267 | sp += 12; |
| 268 | RESTORE_CONTEXT |
| 269 | rti; |
| 270 | nop; |
| 271 | |
| 272 | .global evt_evt7 |
| 273 | evt_evt7: |
| 274 | SAVE_CONTEXT |
| 275 | r0 = 7; |
| 276 | sp += -12; |
| 277 | call process_int; |
| 278 | sp += 12; |
| 279 | |
| 280 | evt_evt7_exit: |
| 281 | RESTORE_CONTEXT |
Wolfgang Denk | 2bad868 | 2006-03-12 02:55:22 +0100 | [diff] [blame] | 282 | rti; |
Wolfgang Denk | 97caf67 | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 283 | |
| 284 | .global evt_evt8 |
| 285 | evt_evt8: |
| 286 | SAVE_CONTEXT |
| 287 | r0 = 8; |
| 288 | sp += -12; |
| 289 | call process_int; |
| 290 | sp += 12; |
| 291 | |
| 292 | evt_evt8_exit: |
| 293 | RESTORE_CONTEXT |
| 294 | rti; |
| 295 | |
| 296 | .global evt_evt9 |
| 297 | evt_evt9: |
| 298 | SAVE_CONTEXT |
| 299 | r0 = 9; |
| 300 | sp += -12; |
| 301 | call process_int; |
| 302 | sp += 12; |
| 303 | |
| 304 | evt_evt9_exit: |
| 305 | RESTORE_CONTEXT |
| 306 | rti; |
| 307 | |
| 308 | .global evt_evt10 |
| 309 | evt_evt10: |
| 310 | SAVE_CONTEXT |
| 311 | r0 = 10; |
| 312 | sp += -12; |
| 313 | call process_int; |
| 314 | sp += 12; |
| 315 | |
| 316 | evt_evt10_exit: |
| 317 | RESTORE_CONTEXT |
| 318 | rti; |
| 319 | |
| 320 | .global evt_evt11 |
| 321 | evt_evt11: |
| 322 | SAVE_CONTEXT |
| 323 | r0 = 11; |
| 324 | sp += -12; |
| 325 | call process_int; |
| 326 | sp += 12; |
| 327 | |
| 328 | evt_evt11_exit: |
| 329 | RESTORE_CONTEXT |
| 330 | rti; |
| 331 | |
| 332 | .global evt_evt12 |
| 333 | evt_evt12: |
| 334 | SAVE_CONTEXT |
| 335 | r0 = 12; |
| 336 | sp += -12; |
| 337 | call process_int; |
| 338 | sp += 12; |
| 339 | evt_evt12_exit: |
| 340 | RESTORE_CONTEXT |
| 341 | rti; |
| 342 | |
| 343 | .global evt_evt13 |
| 344 | evt_evt13: |
| 345 | SAVE_CONTEXT |
| 346 | r0 = 13; |
| 347 | sp += -12; |
| 348 | call process_int; |
| 349 | sp += 12; |
| 350 | |
| 351 | evt_evt13_exit: |
| 352 | RESTORE_CONTEXT |
| 353 | rti; |
| 354 | |
| 355 | .global evt_system_call |
| 356 | evt_system_call: |
| 357 | [--sp] = r0; |
| 358 | [--SP] = RETI; |
| 359 | r0 = [sp++]; |
| 360 | r0 += 2; |
| 361 | [--sp] = r0; |
| 362 | RETI = [SP++]; |
| 363 | r0 = [SP++]; |
| 364 | SAVE_CONTEXT |
| 365 | sp += -12; |
| 366 | call display_excp; |
| 367 | sp += 12; |
| 368 | RESTORE_CONTEXT |
| 369 | RTI; |
| 370 | |
| 371 | evt_system_call_exit: |
| 372 | rti; |
| 373 | |
| 374 | .global evt_soft_int1 |
| 375 | evt_soft_int1: |
| 376 | [--sp] = r0; |
| 377 | [--SP] = RETI; |
| 378 | r0 = [sp++]; |
| 379 | r0 += 2; |
| 380 | [--sp] = r0; |
| 381 | RETI = [SP++]; |
| 382 | r0 = [SP++]; |
| 383 | SAVE_CONTEXT |
| 384 | sp += -12; |
| 385 | call display_excp; |
| 386 | sp += 12; |
| 387 | RESTORE_CONTEXT |
| 388 | RTI; |
| 389 | |
| 390 | evt_soft_int1_exit: |
| 391 | rti; |