Linux-2.6.12-rc2
[linux-flexiantxendom0-natty.git] / arch / m68knommu / platform / 5307 / vectors.c
1 /***************************************************************************/
2
3 /*
4  *      linux/arch/m68knommu/platform/5307/vectors.c
5  *
6  *      Copyright (C) 1999-2003, Greg Ungerer <gerg@snapgear.com>
7  */
8
9 /***************************************************************************/
10
11 #include <linux/config.h>
12 #include <linux/kernel.h>
13 #include <linux/sched.h>
14 #include <linux/param.h>
15 #include <linux/init.h>
16 #include <linux/unistd.h>
17 #include <linux/delay.h>
18 #include <asm/irq.h>
19 #include <asm/dma.h>
20 #include <asm/traps.h>
21 #include <asm/machdep.h>
22 #include <asm/coldfire.h>
23 #include <asm/mcftimer.h>
24 #include <asm/mcfsim.h>
25 #include <asm/mcfdma.h>
26 #include <asm/mcfwdebug.h>
27
28 /***************************************************************************/
29
30 #ifdef TRAP_DBG_INTERRUPT
31
32 asmlinkage void dbginterrupt_c(struct frame *fp)
33 {
34         extern void dump(struct pt_regs *fp);
35         printk(KERN_DEBUG "%s(%d): BUS ERROR TRAP\n", __FILE__, __LINE__);
36         dump((struct pt_regs *) fp);
37         asm("halt");
38 }
39
40 #endif
41
42 /***************************************************************************/
43
44 extern e_vector *_ramvec;
45
46 void set_evector(int vecnum, void (*handler)(void))
47 {
48         if (vecnum >= 0 && vecnum <= 255)
49                 _ramvec[vecnum] = handler;
50 }
51
52 /***************************************************************************/
53
54 /* Assembler routines */
55 asmlinkage void buserr(void);
56 asmlinkage void trap(void);
57 asmlinkage void system_call(void);
58 asmlinkage void inthandler(void);
59
60 void __init coldfire_trap_init(void)
61 {
62         int i;
63
64         /*
65          *      There is a common trap handler and common interrupt
66          *      handler that handle almost every vector. We treat
67          *      the system call and bus error special, they get their
68          *      own first level handlers.
69          */
70         for (i = 3; (i <= 23); i++)
71                 _ramvec[i] = trap;
72         for (i = 33; (i <= 63); i++)
73                 _ramvec[i] = trap;
74         for (i = 24; (i <= 31); i++)
75                 _ramvec[i] = inthandler;
76         for (i = 64; (i < 255); i++)
77                 _ramvec[i] = inthandler;
78         _ramvec[255] = 0;
79
80         _ramvec[2] = buserr;
81         _ramvec[32] = system_call;
82
83 #ifdef TRAP_DBG_INTERRUPT
84         _ramvec[12] = dbginterrupt;
85 #endif
86 }
87
88 /***************************************************************************/
89
90 void coldfire_reset(void)
91 {
92         HARD_RESET_NOW();
93 }
94
95 /***************************************************************************/