2 * linux/arch/m68k/sun3/sun3ints.c -- Sun-3 Linux interrupt handling code
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file COPYING in the main directory of this archive
9 #include <linux/config.h>
10 #include <linux/types.h>
11 #include <linux/kernel.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/segment.h>
16 #include <asm/intersil.h>
17 #include <asm/oplib.h>
18 #include <asm/sun3ints.h>
20 extern void sun3_leds (unsigned char);
22 void sun3_disable_interrupts(void)
27 void sun3_enable_interrupts(void)
32 int led_pattern
[8] = {
39 unsigned char* sun3_intreg
;
41 void sun3_init_IRQ(void)
45 void sun3_insert_irq(irq_node_t
**list
, irq_node_t
*node
)
49 void sun3_delete_irq(irq_node_t
**list
, void *dev_id
)
53 void sun3_free_irq(unsigned int irq
, void *dev_id
)
57 void sun3_enable_irq(unsigned int irq
)
59 *sun3_intreg
|= (1<<irq
);
62 void sun3_disable_irq(unsigned int irq
)
64 *sun3_intreg
&= ~(1<<irq
);
67 inline void sun3_do_irq(int irq
, struct pt_regs
*fp
)
69 kstat
.irqs
[0][SYS_IRQS
+ irq
]++;
70 *sun3_intreg
&= ~(1<<irq
);
71 *sun3_intreg
|= (1<<irq
);
74 int sun3_get_irq_list(char *buf
)
79 static void sun3_int5(int irq
, void *dev_id
, struct pt_regs
*fp
)
81 kstat
.irqs
[0][SYS_IRQS
+ irq
]++;
82 *sun3_intreg
&= ~(1<<irq
);
84 *sun3_intreg
|= (1<<irq
);
86 if(!(kstat
.irqs
[0][SYS_IRQS
+ irq
] % 20))
87 sun3_leds(led_pattern
[(kstat
.irqs
[0][SYS_IRQS
+irq
]%160)
91 static void sun3_int7(int irq
, void *dev_id
, struct pt_regs
*fp
)
94 if(!(kstat
.irqs
[0][SYS_IRQS
+ irq
] % 2000))
95 sun3_leds(led_pattern
[(kstat
.irqs
[0][SYS_IRQS
+irq
]%16000)/2000]);
98 /* handle requested ints, excepting 5 and 7, which always do the same
100 static void *dev_ids
[SYS_IRQS
];
101 static void (*inthandler
[SYS_IRQS
])(int, void *, struct pt_regs
*) = {
102 NULL
, NULL
, NULL
, NULL
, NULL
, sun3_int5
, NULL
, sun3_int7
105 static void sun3_inthandle(int irq
, void *dev_id
, struct pt_regs
*fp
)
107 if(inthandler
[irq
] == NULL
)
108 panic ("bad interrupt %d received (id %p)\n",irq
, dev_id
);
110 kstat
.irqs
[0][SYS_IRQS
+ irq
]++;
111 *sun3_intreg
&= ~(1<<irq
);
113 inthandler
[irq
](irq
, dev_ids
[irq
], fp
);
116 void (*sun3_default_handler
[SYS_IRQS
])(int, void *, struct pt_regs
*) = {
117 sun3_inthandle
, sun3_inthandle
, sun3_inthandle
, sun3_inthandle
,
118 sun3_inthandle
, sun3_int5
, sun3_inthandle
, sun3_int7
121 int sun3_request_irq(unsigned int irq
, void (*handler
)(int, void *, struct pt_regs
*),
122 unsigned long flags
, const char *devname
, void *dev_id
)
124 if(inthandler
[irq
] != NULL
)
127 inthandler
[irq
] = handler
;
128 dev_ids
[irq
] = dev_id
;