Linux Audio

Check our new training course

Loading...
v6.8
  1/*
  2 * linux/arch/m68k/kernel/ints.c -- Linux/m68k general interrupt handling code
  3 *
  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
  6 * for more details.
  7 */
  8
  9#include <linux/module.h>
 10#include <linux/types.h>
 11#include <linux/sched.h>
 12#include <linux/interrupt.h>
 
 13#include <linux/errno.h>
 14#include <linux/init.h>
 15#include <linux/irq.h>
 16
 17#include <asm/setup.h>
 18#include <asm/irq.h>
 19#include <asm/traps.h>
 20#include <asm/page.h>
 21#include <asm/machdep.h>
 22#include <asm/cacheflush.h>
 23#include <asm/irq_regs.h>
 24
 25#ifdef CONFIG_Q40
 26#include <asm/q40ints.h>
 27#endif
 28
 29#include "ints.h"
 30
 31extern u32 auto_irqhandler_fixup[];
 32extern u16 user_irqvec_fixup[];
 33
 34static int m68k_first_user_vec;
 35
 36static struct irq_chip auto_irq_chip = {
 37	.name		= "auto",
 38	.irq_startup	= m68k_irq_startup,
 39	.irq_shutdown	= m68k_irq_shutdown,
 40};
 41
 42static struct irq_chip user_irq_chip = {
 43	.name		= "user",
 44	.irq_startup	= m68k_irq_startup,
 45	.irq_shutdown	= m68k_irq_shutdown,
 46};
 47
 48/*
 49 * void init_IRQ(void)
 50 *
 51 * Parameters:	None
 52 *
 53 * Returns:	Nothing
 54 *
 55 * This function should be called during kernel startup to initialize
 56 * the IRQ handling routines.
 57 */
 58
 59void __init init_IRQ(void)
 60{
 61	int i;
 62
 
 
 
 
 
 
 63	for (i = IRQ_AUTO_1; i <= IRQ_AUTO_7; i++)
 64		irq_set_chip_and_handler(i, &auto_irq_chip, handle_simple_irq);
 65
 66	mach_init_IRQ();
 67}
 68
 69/**
 70 * m68k_setup_auto_interrupt
 71 * @handler: called from auto vector interrupts
 72 *
 73 * setup the handler to be called from auto vector interrupts instead of the
 74 * standard do_IRQ(), it will be called with irq numbers in the range
 75 * from IRQ_AUTO_1 - IRQ_AUTO_7.
 76 */
 77void __init m68k_setup_auto_interrupt(void (*handler)(unsigned int, struct pt_regs *))
 78{
 79	if (handler)
 80		*auto_irqhandler_fixup = (u32)handler;
 81	flush_icache();
 82}
 83
 84/**
 85 * m68k_setup_user_interrupt
 86 * @vec: first user vector interrupt to handle
 87 * @cnt: number of active user vector interrupts
 88 *
 89 * setup user vector interrupts, this includes activating the specified range
 90 * of interrupts, only then these interrupts can be requested (note: this is
 91 * different from auto vector interrupts).
 92 */
 93void __init m68k_setup_user_interrupt(unsigned int vec, unsigned int cnt)
 94{
 95	int i;
 96
 97	BUG_ON(IRQ_USER + cnt > NR_IRQS);
 98	m68k_first_user_vec = vec;
 99	for (i = 0; i < cnt; i++)
100		irq_set_chip_and_handler(i, &user_irq_chip, handle_simple_irq);
101	*user_irqvec_fixup = vec - IRQ_USER;
102	flush_icache();
103}
104
105/**
106 * m68k_setup_irq_controller
107 * @chip: irq chip which controls specified irq
108 * @handle: flow handler which handles specified irq
109 * @irq: first irq to be managed by the controller
110 * @cnt: number of irqs to be managed by the controller
111 *
112 * Change the controller for the specified range of irq, which will be used to
113 * manage these irq. auto/user irq already have a default controller, which can
114 * be changed as well, but the controller probably should use m68k_irq_startup/
115 * m68k_irq_shutdown.
116 */
117void m68k_setup_irq_controller(struct irq_chip *chip,
118			       irq_flow_handler_t handle, unsigned int irq,
119			       unsigned int cnt)
120{
121	int i;
122
123	for (i = 0; i < cnt; i++) {
124		irq_set_chip(irq + i, chip);
125		if (handle)
126			irq_set_handler(irq + i, handle);
127	}
128}
129
130unsigned int m68k_irq_startup_irq(unsigned int irq)
131{
132	if (irq <= IRQ_AUTO_7)
133		vectors[VEC_SPUR + irq] = auto_inthandler;
134	else
135		vectors[m68k_first_user_vec + irq - IRQ_USER] = user_inthandler;
136	return 0;
137}
138
139unsigned int m68k_irq_startup(struct irq_data *data)
140{
141	return m68k_irq_startup_irq(data->irq);
142}
143
144void m68k_irq_shutdown(struct irq_data *data)
145{
146	unsigned int irq = data->irq;
147
148	if (irq <= IRQ_AUTO_7)
149		vectors[VEC_SPUR + irq] = bad_inthandler;
150	else
151		vectors[m68k_first_user_vec + irq - IRQ_USER] = bad_inthandler;
152}
153
154
155unsigned int irq_canonicalize(unsigned int irq)
156{
157#ifdef CONFIG_Q40
158	if (MACH_IS_Q40 && irq == 11)
159		irq = 10;
160#endif
161	return irq;
162}
163
164EXPORT_SYMBOL(irq_canonicalize);
165
166
167asmlinkage void handle_badint(struct pt_regs *regs)
168{
169	atomic_inc(&irq_err_count);
170	pr_warn("unexpected interrupt from %u\n", regs->vector);
171}
v3.5.6
  1/*
  2 * linux/arch/m68k/kernel/ints.c -- Linux/m68k general interrupt handling code
  3 *
  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
  6 * for more details.
  7 */
  8
  9#include <linux/module.h>
 10#include <linux/types.h>
 11#include <linux/sched.h>
 12#include <linux/interrupt.h>
 13#include <linux/kernel_stat.h>
 14#include <linux/errno.h>
 15#include <linux/init.h>
 
 16
 17#include <asm/setup.h>
 18#include <asm/irq.h>
 19#include <asm/traps.h>
 20#include <asm/page.h>
 21#include <asm/machdep.h>
 22#include <asm/cacheflush.h>
 23#include <asm/irq_regs.h>
 24
 25#ifdef CONFIG_Q40
 26#include <asm/q40ints.h>
 27#endif
 28
 
 
 29extern u32 auto_irqhandler_fixup[];
 30extern u16 user_irqvec_fixup[];
 31
 32static int m68k_first_user_vec;
 33
 34static struct irq_chip auto_irq_chip = {
 35	.name		= "auto",
 36	.irq_startup	= m68k_irq_startup,
 37	.irq_shutdown	= m68k_irq_shutdown,
 38};
 39
 40static struct irq_chip user_irq_chip = {
 41	.name		= "user",
 42	.irq_startup	= m68k_irq_startup,
 43	.irq_shutdown	= m68k_irq_shutdown,
 44};
 45
 46/*
 47 * void init_IRQ(void)
 48 *
 49 * Parameters:	None
 50 *
 51 * Returns:	Nothing
 52 *
 53 * This function should be called during kernel startup to initialize
 54 * the IRQ handling routines.
 55 */
 56
 57void __init init_IRQ(void)
 58{
 59	int i;
 60
 61	/* assembly irq entry code relies on this... */
 62	if (HARDIRQ_MASK != 0x00ff0000) {
 63		extern void hardirq_mask_is_broken(void);
 64		hardirq_mask_is_broken();
 65	}
 66
 67	for (i = IRQ_AUTO_1; i <= IRQ_AUTO_7; i++)
 68		irq_set_chip_and_handler(i, &auto_irq_chip, handle_simple_irq);
 69
 70	mach_init_IRQ();
 71}
 72
 73/**
 74 * m68k_setup_auto_interrupt
 75 * @handler: called from auto vector interrupts
 76 *
 77 * setup the handler to be called from auto vector interrupts instead of the
 78 * standard do_IRQ(), it will be called with irq numbers in the range
 79 * from IRQ_AUTO_1 - IRQ_AUTO_7.
 80 */
 81void __init m68k_setup_auto_interrupt(void (*handler)(unsigned int, struct pt_regs *))
 82{
 83	if (handler)
 84		*auto_irqhandler_fixup = (u32)handler;
 85	flush_icache();
 86}
 87
 88/**
 89 * m68k_setup_user_interrupt
 90 * @vec: first user vector interrupt to handle
 91 * @cnt: number of active user vector interrupts
 92 *
 93 * setup user vector interrupts, this includes activating the specified range
 94 * of interrupts, only then these interrupts can be requested (note: this is
 95 * different from auto vector interrupts).
 96 */
 97void __init m68k_setup_user_interrupt(unsigned int vec, unsigned int cnt)
 98{
 99	int i;
100
101	BUG_ON(IRQ_USER + cnt > NR_IRQS);
102	m68k_first_user_vec = vec;
103	for (i = 0; i < cnt; i++)
104		irq_set_chip(IRQ_USER + i, &user_irq_chip);
105	*user_irqvec_fixup = vec - IRQ_USER;
106	flush_icache();
107}
108
109/**
110 * m68k_setup_irq_controller
111 * @chip: irq chip which controls specified irq
112 * @handle: flow handler which handles specified irq
113 * @irq: first irq to be managed by the controller
114 * @cnt: number of irqs to be managed by the controller
115 *
116 * Change the controller for the specified range of irq, which will be used to
117 * manage these irq. auto/user irq already have a default controller, which can
118 * be changed as well, but the controller probably should use m68k_irq_startup/
119 * m68k_irq_shutdown.
120 */
121void m68k_setup_irq_controller(struct irq_chip *chip,
122			       irq_flow_handler_t handle, unsigned int irq,
123			       unsigned int cnt)
124{
125	int i;
126
127	for (i = 0; i < cnt; i++) {
128		irq_set_chip(irq + i, chip);
129		if (handle)
130			irq_set_handler(irq + i, handle);
131	}
132}
133
134unsigned int m68k_irq_startup_irq(unsigned int irq)
135{
136	if (irq <= IRQ_AUTO_7)
137		vectors[VEC_SPUR + irq] = auto_inthandler;
138	else
139		vectors[m68k_first_user_vec + irq - IRQ_USER] = user_inthandler;
140	return 0;
141}
142
143unsigned int m68k_irq_startup(struct irq_data *data)
144{
145	return m68k_irq_startup_irq(data->irq);
146}
147
148void m68k_irq_shutdown(struct irq_data *data)
149{
150	unsigned int irq = data->irq;
151
152	if (irq <= IRQ_AUTO_7)
153		vectors[VEC_SPUR + irq] = bad_inthandler;
154	else
155		vectors[m68k_first_user_vec + irq - IRQ_USER] = bad_inthandler;
156}
157
158
159unsigned int irq_canonicalize(unsigned int irq)
160{
161#ifdef CONFIG_Q40
162	if (MACH_IS_Q40 && irq == 11)
163		irq = 10;
164#endif
165	return irq;
166}
167
168EXPORT_SYMBOL(irq_canonicalize);
169
170
171asmlinkage void handle_badint(struct pt_regs *regs)
172{
173	atomic_inc(&irq_err_count);
174	pr_warn("unexpected interrupt from %u\n", regs->vector);
175}