summaryrefslogtreecommitdiffstats
path: root/arch/m68k
diff options
context:
space:
mode:
Diffstat (limited to 'arch/m68k')
-rw-r--r--arch/m68k/amiga/amiga_ksyms.c3
-rw-r--r--arch/m68k/amiga/amiints.c386
-rw-r--r--arch/m68k/amiga/amisound.c1
-rw-r--r--arch/m68k/amiga/chipram.c1
-rw-r--r--arch/m68k/amiga/cia.c156
-rw-r--r--arch/m68k/amiga/config.c16
-rw-r--r--arch/m68k/apollo/Makefile2
-rw-r--r--arch/m68k/apollo/config.c25
-rw-r--r--arch/m68k/apollo/dn_ints.c137
-rw-r--r--arch/m68k/atari/ataints.c278
-rw-r--r--arch/m68k/atari/config.c12
-rw-r--r--arch/m68k/atari/debug.c1
-rw-r--r--arch/m68k/atari/hades-pci.c1
-rw-r--r--arch/m68k/atari/stram.c1
-rw-r--r--arch/m68k/bvme6000/Makefile2
-rw-r--r--arch/m68k/bvme6000/bvmeints.c160
-rw-r--r--arch/m68k/bvme6000/config.c21
-rw-r--r--arch/m68k/hp300/Makefile2
-rw-r--r--arch/m68k/hp300/config.c12
-rw-r--r--arch/m68k/hp300/ints.c175
-rw-r--r--arch/m68k/hp300/ints.h9
-rw-r--r--arch/m68k/hp300/time.c3
-rw-r--r--arch/m68k/kernel/Makefile4
-rw-r--r--arch/m68k/kernel/bios32.c1
-rw-r--r--arch/m68k/kernel/dma.c129
-rw-r--r--arch/m68k/kernel/entry.S105
-rw-r--r--arch/m68k/kernel/head.S1
-rw-r--r--arch/m68k/kernel/ints.c383
-rw-r--r--arch/m68k/kernel/m68k_ksyms.c3
-rw-r--r--arch/m68k/kernel/process.c1
-rw-r--r--arch/m68k/kernel/ptrace.c1
-rw-r--r--arch/m68k/kernel/semaphore.c1
-rw-r--r--arch/m68k/kernel/setup.c4
-rw-r--r--arch/m68k/kernel/signal.c2
-rw-r--r--arch/m68k/kernel/traps.c189
-rw-r--r--arch/m68k/kernel/vmlinux.lds.S1
-rw-r--r--arch/m68k/lib/Makefile4
-rw-r--r--arch/m68k/lib/uaccess.c222
-rw-r--r--arch/m68k/mac/baboon.c2
-rw-r--r--arch/m68k/mac/config.c34
-rw-r--r--arch/m68k/mac/debug.c1
-rw-r--r--arch/m68k/mac/iop.c3
-rw-r--r--arch/m68k/mac/macints.c504
-rw-r--r--arch/m68k/mac/misc.c1
-rw-r--r--arch/m68k/mac/oss.c14
-rw-r--r--arch/m68k/mac/psc.c10
-rw-r--r--arch/m68k/mac/via.c33
-rw-r--r--arch/m68k/math-emu/fp_entry.S1
-rw-r--r--arch/m68k/math-emu/fp_util.S1
-rw-r--r--arch/m68k/mm/init.c1
-rw-r--r--arch/m68k/mm/kmap.c7
-rw-r--r--arch/m68k/mm/memory.c7
-rw-r--r--arch/m68k/mm/motorola.c13
-rw-r--r--arch/m68k/mm/sun3mmu.c5
-rw-r--r--arch/m68k/mvme147/147ints.c145
-rw-r--r--arch/m68k/mvme147/Makefile2
-rw-r--r--arch/m68k/mvme147/config.c22
-rw-r--r--arch/m68k/mvme16x/16xints.c149
-rw-r--r--arch/m68k/mvme16x/Makefile2
-rw-r--r--arch/m68k/mvme16x/config.c23
-rw-r--r--arch/m68k/q40/config.c14
-rw-r--r--arch/m68k/q40/q40ints.c481
-rw-r--r--arch/m68k/sun3/config.c9
-rw-r--r--arch/m68k/sun3/prom/init.c1
-rw-r--r--arch/m68k/sun3/prom/printf.c1
-rw-r--r--arch/m68k/sun3/sun3dvma.c7
-rw-r--r--arch/m68k/sun3/sun3ints.c209
-rw-r--r--arch/m68k/sun3x/config.c8
68 files changed, 1337 insertions, 2828 deletions
diff --git a/arch/m68k/amiga/amiga_ksyms.c b/arch/m68k/amiga/amiga_ksyms.c
index b7bd84c73ea..7fdcf6bf3ad 100644
--- a/arch/m68k/amiga/amiga_ksyms.c
+++ b/arch/m68k/amiga/amiga_ksyms.c
@@ -1,4 +1,3 @@
-#include <linux/config.h>
#include <linux/module.h>
#include <linux/types.h>
#include <asm/ptrace.h>
@@ -23,8 +22,6 @@ EXPORT_SYMBOL(amiga_chip_avail);
EXPORT_SYMBOL(amiga_chip_size);
EXPORT_SYMBOL(amiga_audio_period);
EXPORT_SYMBOL(amiga_audio_min_period);
-EXPORT_SYMBOL(amiga_do_irq);
-EXPORT_SYMBOL(amiga_do_irq_list);
#ifdef CONFIG_AMIGA_PCMCIA
EXPORT_SYMBOL(pcmcia_reset);
diff --git a/arch/m68k/amiga/amiints.c b/arch/m68k/amiga/amiints.c
index b0aa61bf870..96c79d840cf 100644
--- a/arch/m68k/amiga/amiints.c
+++ b/arch/m68k/amiga/amiints.c
@@ -22,7 +22,7 @@
*
* 07/08/99: rewamp of the interrupt handling - we now have two types of
* interrupts, normal and fast handlers, fast handlers being
- * marked with SA_INTERRUPT and runs with all other interrupts
+ * marked with IRQF_DISABLED and runs with all other interrupts
* disabled. Normal interrupts disable their own source but
* run with all other interrupt sources enabled.
* PORTS and EXTER interrupts are always shared even if the
@@ -35,61 +35,30 @@
* /Jes
*/
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/kernel_stat.h>
#include <linux/init.h>
+#include <linux/interrupt.h>
#include <linux/errno.h>
-#include <linux/seq_file.h>
-#include <asm/system.h>
#include <asm/irq.h>
#include <asm/traps.h>
#include <asm/amigahw.h>
#include <asm/amigaints.h>
#include <asm/amipcmcia.h>
-extern int cia_request_irq(struct ciabase *base,int irq,
- irqreturn_t (*handler)(int, void *, struct pt_regs *),
- unsigned long flags, const char *devname, void *dev_id);
-extern void cia_free_irq(struct ciabase *base, unsigned int irq, void *dev_id);
-extern void cia_init_IRQ(struct ciabase *base);
-extern int cia_get_irq_list(struct ciabase *base, struct seq_file *p);
-
-/* irq node variables for amiga interrupt sources */
-static irq_node_t *ami_irq_list[AMI_STD_IRQS];
-
-static unsigned short amiga_intena_vals[AMI_STD_IRQS] = {
- [IRQ_AMIGA_VERTB] = IF_VERTB,
- [IRQ_AMIGA_COPPER] = IF_COPER,
- [IRQ_AMIGA_AUD0] = IF_AUD0,
- [IRQ_AMIGA_AUD1] = IF_AUD1,
- [IRQ_AMIGA_AUD2] = IF_AUD2,
- [IRQ_AMIGA_AUD3] = IF_AUD3,
- [IRQ_AMIGA_BLIT] = IF_BLIT,
- [IRQ_AMIGA_DSKSYN] = IF_DSKSYN,
- [IRQ_AMIGA_DSKBLK] = IF_DSKBLK,
- [IRQ_AMIGA_RBF] = IF_RBF,
- [IRQ_AMIGA_TBE] = IF_TBE,
- [IRQ_AMIGA_SOFT] = IF_SOFT,
- [IRQ_AMIGA_PORTS] = IF_PORTS,
- [IRQ_AMIGA_EXTER] = IF_EXTER
-};
-static const unsigned char ami_servers[AMI_STD_IRQS] = {
- [IRQ_AMIGA_VERTB] = 1,
- [IRQ_AMIGA_PORTS] = 1,
- [IRQ_AMIGA_EXTER] = 1
+static void amiga_enable_irq(unsigned int irq);
+static void amiga_disable_irq(unsigned int irq);
+static irqreturn_t ami_int1(int irq, void *dev_id, struct pt_regs *fp);
+static irqreturn_t ami_int3(int irq, void *dev_id, struct pt_regs *fp);
+static irqreturn_t ami_int4(int irq, void *dev_id, struct pt_regs *fp);
+static irqreturn_t ami_int5(int irq, void *dev_id, struct pt_regs *fp);
+
+static struct irq_controller amiga_irq_controller = {
+ .name = "amiga",
+ .lock = SPIN_LOCK_UNLOCKED,
+ .enable = amiga_enable_irq,
+ .disable = amiga_disable_irq,
};
-static short ami_ablecount[AMI_IRQS];
-
-static irqreturn_t ami_badint(int irq, void *dev_id, struct pt_regs *fp)
-{
- num_spurious += 1;
- return IRQ_NONE;
-}
-
/*
* void amiga_init_IRQ(void)
*
@@ -103,23 +72,12 @@ static irqreturn_t ami_badint(int irq, void *dev_id, struct pt_regs *fp)
void __init amiga_init_IRQ(void)
{
- int i;
+ request_irq(IRQ_AUTO_1, ami_int1, 0, "int1", NULL);
+ request_irq(IRQ_AUTO_3, ami_int3, 0, "int3", NULL);
+ request_irq(IRQ_AUTO_4, ami_int4, 0, "int4", NULL);
+ request_irq(IRQ_AUTO_5, ami_int5, 0, "int5", NULL);
- /* initialize handlers */
- for (i = 0; i < AMI_STD_IRQS; i++) {
- if (ami_servers[i]) {
- ami_irq_list[i] = NULL;
- } else {
- ami_irq_list[i] = new_irq_node();
- ami_irq_list[i]->handler = ami_badint;
- ami_irq_list[i]->flags = 0;
- ami_irq_list[i]->dev_id = NULL;
- ami_irq_list[i]->devname = NULL;
- ami_irq_list[i]->next = NULL;
- }
- }
- for (i = 0; i < AMI_IRQS; i++)
- ami_ablecount[i] = 0;
+ m68k_setup_irq_controller(&amiga_irq_controller, IRQ_USER, AMI_STD_IRQS);
/* turn off PCMCIA interrupts */
if (AMIGAHW_PRESENT(PCMCIA))
@@ -134,249 +92,21 @@ void __init amiga_init_IRQ(void)
cia_init_IRQ(&ciab_base);
}
-static inline int amiga_insert_irq(irq_node_t **list, irq_node_t *node)
-{
- unsigned long flags;
- irq_node_t *cur;
-
- if (!node->dev_id)
- printk("%s: Warning: dev_id of %s is zero\n",
- __FUNCTION__, node->devname);
-
- local_irq_save(flags);
-
- cur = *list;
-
- if (node->flags & SA_INTERRUPT) {
- if (node->flags & SA_SHIRQ)
- return -EBUSY;
- /*
- * There should never be more than one
- */
- while (cur && cur->flags & SA_INTERRUPT) {
- list = &cur->next;
- cur = cur->next;
- }
- } else {
- while (cur) {
- list = &cur->next;
- cur = cur->next;
- }
- }
-
- node->next = cur;
- *list = node;
-
- local_irq_restore(flags);
- return 0;
-}
-
-static inline void amiga_delete_irq(irq_node_t **list, void *dev_id)
-{
- unsigned long flags;
- irq_node_t *node;
-
- local_irq_save(flags);
-
- for (node = *list; node; list = &node->next, node = *list) {
- if (node->dev_id == dev_id) {
- *list = node->next;
- /* Mark it as free. */
- node->handler = NULL;
- local_irq_restore(flags);
- return;
- }
- }
- local_irq_restore(flags);
- printk ("%s: tried to remove invalid irq\n", __FUNCTION__);
-}
-
-/*
- * amiga_request_irq : add an interrupt service routine for a particular
- * machine specific interrupt source.
- * If the addition was successful, it returns 0.
- */
-
-int amiga_request_irq(unsigned int irq,
- irqreturn_t (*handler)(int, void *, struct pt_regs *),
- unsigned long flags, const char *devname, void *dev_id)
-{
- irq_node_t *node;
- int error = 0;
-
- if (irq >= AMI_IRQS) {
- printk ("%s: Unknown IRQ %d from %s\n", __FUNCTION__,
- irq, devname);
- return -ENXIO;
- }
-
- if (irq >= IRQ_AMIGA_AUTO)
- return cpu_request_irq(irq - IRQ_AMIGA_AUTO, handler,
- flags, devname, dev_id);
-
- if (irq >= IRQ_AMIGA_CIAB)
- return cia_request_irq(&ciab_base, irq - IRQ_AMIGA_CIAB,
- handler, flags, devname, dev_id);
-
- if (irq >= IRQ_AMIGA_CIAA)
- return cia_request_irq(&ciaa_base, irq - IRQ_AMIGA_CIAA,
- handler, flags, devname, dev_id);
-
- /*
- * IRQ_AMIGA_PORTS & IRQ_AMIGA_EXTER defaults to shared,
- * we could add a check here for the SA_SHIRQ flag but all drivers
- * should be aware of sharing anyway.
- */
- if (ami_servers[irq]) {
- if (!(node = new_irq_node()))
- return -ENOMEM;
- node->handler = handler;
- node->flags = flags;
- node->dev_id = dev_id;
- node->devname = devname;
- node->next = NULL;
- error = amiga_insert_irq(&ami_irq_list[irq], node);
- } else {
- ami_irq_list[irq]->handler = handler;
- ami_irq_list[irq]->flags = flags;
- ami_irq_list[irq]->dev_id = dev_id;
- ami_irq_list[irq]->devname = devname;
- }
-
- /* enable the interrupt */
- if (irq < IRQ_AMIGA_PORTS && !ami_ablecount[irq])
- amiga_custom.intena = IF_SETCLR | amiga_intena_vals[irq];
-
- return error;
-}
-
-void amiga_free_irq(unsigned int irq, void *dev_id)
-{
- if (irq >= AMI_IRQS) {
- printk ("%s: Unknown IRQ %d\n", __FUNCTION__, irq);
- return;
- }
-
- if (irq >= IRQ_AMIGA_AUTO)
- cpu_free_irq(irq - IRQ_AMIGA_AUTO, dev_id);
-
- if (irq >= IRQ_AMIGA_CIAB) {
- cia_free_irq(&ciab_base, irq - IRQ_AMIGA_CIAB, dev_id);
- return;
- }
-
- if (irq >= IRQ_AMIGA_CIAA) {
- cia_free_irq(&ciaa_base, irq - IRQ_AMIGA_CIAA, dev_id);
- return;
- }
-
- if (ami_servers[irq]) {
- amiga_delete_irq(&ami_irq_list[irq], dev_id);
- /* if server list empty, disable the interrupt */
- if (!ami_irq_list[irq] && irq < IRQ_AMIGA_PORTS)
- amiga_custom.intena = amiga_intena_vals[irq];
- } else {
- if (ami_irq_list[irq]->dev_id != dev_id)
- printk("%s: removing probably wrong IRQ %d from %s\n",
- __FUNCTION__, irq, ami_irq_list[irq]->devname);
- ami_irq_list[irq]->handler = ami_badint;
- ami_irq_list[irq]->flags = 0;
- ami_irq_list[irq]->dev_id = NULL;
- ami_irq_list[irq]->devname = NULL;
- amiga_custom.intena = amiga_intena_vals[irq];
- }
-}
-
/*
* Enable/disable a particular machine specific interrupt source.
* Note that this may affect other interrupts in case of a shared interrupt.
* This function should only be called for a _very_ short time to change some
* internal data, that may not be changed by the interrupt at the same time.
- * ami_(enable|disable)_irq calls may also be nested.
*/
-void amiga_enable_irq(unsigned int irq)
-{
- if (irq >= AMI_IRQS) {
- printk("%s: Unknown IRQ %d\n", __FUNCTION__, irq);
- return;
- }
-
- if (--ami_ablecount[irq])
- return;
-
- /* No action for auto-vector interrupts */
- if (irq >= IRQ_AMIGA_AUTO){
- printk("%s: Trying to enable auto-vector IRQ %i\n",
- __FUNCTION__, irq - IRQ_AMIGA_AUTO);
- return;
- }
-
- if (irq >= IRQ_AMIGA_CIAB) {
- cia_set_irq(&ciab_base, (1 << (irq - IRQ_AMIGA_CIAB)));
- cia_able_irq(&ciab_base, CIA_ICR_SETCLR |
- (1 << (irq - IRQ_AMIGA_CIAB)));
- return;
- }
-
- if (irq >= IRQ_AMIGA_CIAA) {
- cia_set_irq(&ciaa_base, (1 << (irq - IRQ_AMIGA_CIAA)));
- cia_able_irq(&ciaa_base, CIA_ICR_SETCLR |
- (1 << (irq - IRQ_AMIGA_CIAA)));
- return;
- }
-
- /* enable the interrupt */
- amiga_custom.intena = IF_SETCLR | amiga_intena_vals[irq];
-}
-
-void amiga_disable_irq(unsigned int irq)
-{
- if (irq >= AMI_IRQS) {
- printk("%s: Unknown IRQ %d\n", __FUNCTION__, irq);
- return;
- }
-
- if (ami_ablecount[irq]++)
- return;
-
- /* No action for auto-vector interrupts */
- if (irq >= IRQ_AMIGA_AUTO) {
- printk("%s: Trying to disable auto-vector IRQ %i\n",
- __FUNCTION__, irq - IRQ_AMIGA_AUTO);
- return;
- }
-
- if (irq >= IRQ_AMIGA_CIAB) {
- cia_able_irq(&ciab_base, 1 << (irq - IRQ_AMIGA_CIAB));
- return;
- }
-
- if (irq >= IRQ_AMIGA_CIAA) {
- cia_able_irq(&ciaa_base, 1 << (irq - IRQ_AMIGA_CIAA));
- return;
- }
-
- /* disable the interrupt */
- amiga_custom.intena = amiga_intena_vals[irq];
-}
-
-inline void amiga_do_irq(int irq, struct pt_regs *fp)
+static void amiga_enable_irq(unsigned int irq)
{
- kstat_cpu(0).irqs[SYS_IRQS + irq]++;
- ami_irq_list[irq]->handler(irq, ami_irq_list[irq]->dev_id, fp);
+ amiga_custom.intena = IF_SETCLR | (1 << (irq - IRQ_USER));
}
-void amiga_do_irq_list(int irq, struct pt_regs *fp)
+static void amiga_disable_irq(unsigned int irq)
{
- irq_node_t *node;
-
- kstat_cpu(0).irqs[SYS_IRQS + irq]++;
-
- amiga_custom.intreq = amiga_intena_vals[irq];
-
- for (node = ami_irq_list[irq]; node; node = node->next)
- node->handler(irq, node->dev_id, fp);
+ amiga_custom.intena = 1 << (irq - IRQ_USER);
}
/*
@@ -390,19 +120,19 @@ static irqreturn_t ami_int1(int irq, void *dev_id, struct pt_regs *fp)
/* if serial transmit buffer empty, interrupt */
if (ints & IF_TBE) {
amiga_custom.intreq = IF_TBE;
- amiga_do_irq(IRQ_AMIGA_TBE, fp);
+ m68k_handle_int(IRQ_AMIGA_TBE, fp);
}
/* if floppy disk transfer complete, interrupt */
if (ints & IF_DSKBLK) {
amiga_custom.intreq = IF_DSKBLK;
- amiga_do_irq(IRQ_AMIGA_DSKBLK, fp);
+ m68k_handle_int(IRQ_AMIGA_DSKBLK, fp);
}
/* if software interrupt set, interrupt */
if (ints & IF_SOFT) {
amiga_custom.intreq = IF_SOFT;
- amiga_do_irq(IRQ_AMIGA_SOFT, fp);
+ m68k_handle_int(IRQ_AMIGA_SOFT, fp);
}
return IRQ_HANDLED;
}
@@ -414,18 +144,20 @@ static irqreturn_t ami_int3(int irq, void *dev_id, struct pt_regs *fp)
/* if a blitter interrupt */
if (ints & IF_BLIT) {
amiga_custom.intreq = IF_BLIT;
- amiga_do_irq(IRQ_AMIGA_BLIT, fp);
+ m68k_handle_int(IRQ_AMIGA_BLIT, fp);
}
/* if a copper interrupt */
if (ints & IF_COPER) {
amiga_custom.intreq = IF_COPER;
- amiga_do_irq(IRQ_AMIGA_COPPER, fp);
+ m68k_handle_int(IRQ_AMIGA_COPPER, fp);
}
/* if a vertical blank interrupt */
- if (ints & IF_VERTB)
- amiga_do_irq_list(IRQ_AMIGA_VERTB, fp);
+ if (ints & IF_VERTB) {
+ amiga_custom.intreq = IF_VERTB;
+ m68k_handle_int(IRQ_AMIGA_VERTB, fp);
+ }
return IRQ_HANDLED;
}
@@ -436,25 +168,25 @@ static irqreturn_t ami_int4(int irq, void *dev_id, struct pt_regs *fp)
/* if audio 0 interrupt */
if (ints & IF_AUD0) {
amiga_custom.intreq = IF_AUD0;
- amiga_do_irq(IRQ_AMIGA_AUD0, fp);
+ m68k_handle_int(IRQ_AMIGA_AUD0, fp);
}
/* if audio 1 interrupt */
if (ints & IF_AUD1) {
amiga_custom.intreq = IF_AUD1;
- amiga_do_irq(IRQ_AMIGA_AUD1, fp);
+ m68k_handle_int(IRQ_AMIGA_AUD1, fp);
}
/* if audio 2 interrupt */
if (ints & IF_AUD2) {
amiga_custom.intreq = IF_AUD2;
- amiga_do_irq(IRQ_AMIGA_AUD2, fp);
+ m68k_handle_int(IRQ_AMIGA_AUD2, fp);
}
/* if audio 3 interrupt */
if (ints & IF_AUD3) {
amiga_custom.intreq = IF_AUD3;
- amiga_do_irq(IRQ_AMIGA_AUD3, fp);
+ m68k_handle_int(IRQ_AMIGA_AUD3, fp);
}
return IRQ_HANDLED;
}
@@ -466,55 +198,13 @@ static irqreturn_t ami_int5(int irq, void *dev_id, struct pt_regs *fp)
/* if serial receive buffer full interrupt */
if (ints & IF_RBF) {
/* acknowledge of IF_RBF must be done by the serial interrupt */
- amiga_do_irq(IRQ_AMIGA_RBF, fp);
+ m68k_handle_int(IRQ_AMIGA_RBF, fp);
}
/* if a disk sync interrupt */
if (ints & IF_DSKSYN) {
amiga_custom.intreq = IF_DSKSYN;
- amiga_do_irq(IRQ_AMIGA_DSKSYN, fp);
+ m68k_handle_int(IRQ_AMIGA_DSKSYN, fp);
}
return IRQ_HANDLED;
}
-
-static irqreturn_t ami_int7(int irq, void *dev_id, struct pt_regs *fp)
-{
- panic ("level 7 interrupt received\n");
-}
-
-irqreturn_t (*amiga_default_handler[SYS_IRQS])(int, void *, struct pt_regs *) = {
- [0] = ami_badint,
- [1] = ami_int1,
- [2] = ami_badint,
- [3] = ami_int3,
- [4] = ami_int4,
- [5] = ami_int5,
- [6] = ami_badint,
- [7] = ami_int7
-};
-
-int show_amiga_interrupts(struct seq_file *p, void *v)
-{
- int i;
- irq_node_t *node;
-
- for (i = 0; i < AMI_STD_IRQS; i++) {
- if (!(node = ami_irq_list[i]))
- continue;
- seq_printf(p, "ami %2d: %10u ", i,
- kstat_cpu(0).irqs[SYS_IRQS + i]);
- do {
- if (node->flags & SA_INTERRUPT)
- seq_puts(p, "F ");
- else
- seq_puts(p, " ");
- seq_printf(p, "%s\n", node->devname);
- if ((node = node->next))
- seq_puts(p, " ");
- } while (node);
- }
-
- cia_get_irq_list(&ciaa_base, p);
- cia_get_irq_list(&ciab_base, p);
- return 0;
-}
diff --git a/arch/m68k/amiga/amisound.c b/arch/m68k/amiga/amisound.c
index ae94db5d93b..1f5bfb58429 100644
--- a/arch/m68k/amiga/amisound.c
+++ b/arch/m68k/amiga/amisound.c
@@ -8,7 +8,6 @@
* for more details.
*/
-#include <linux/config.h>
#include <linux/jiffies.h>
#include <linux/timer.h>
#include <linux/init.h>
diff --git a/arch/m68k/amiga/chipram.c b/arch/m68k/amiga/chipram.c
index 558d5fd2d2b..de1304c9111 100644
--- a/arch/m68k/amiga/chipram.c
+++ b/arch/m68k/amiga/chipram.c
@@ -7,7 +7,6 @@
** Rewritten 15/9/2000 by Geert to use resource management
*/
-#include <linux/config.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/init.h>
diff --git a/arch/m68k/amiga/cia.c b/arch/m68k/amiga/cia.c
index 9476eb9440f..dbad3005472 100644
--- a/arch/m68k/amiga/cia.c
+++ b/arch/m68k/amiga/cia.c
@@ -29,21 +29,18 @@ struct ciabase {
unsigned short int_mask;
int handler_irq, cia_irq, server_irq;
char *name;
- irq_handler_t irq_list[CIA_IRQS];
} ciaa_base = {
.cia = &ciaa,
.int_mask = IF_PORTS,
- .handler_irq = IRQ_AMIGA_AUTO_2,
+ .handler_irq = IRQ_AMIGA_PORTS,
.cia_irq = IRQ_AMIGA_CIAA,
- .server_irq = IRQ_AMIGA_PORTS,
- .name = "CIAA handler"
+ .name = "CIAA"
}, ciab_base = {
.cia = &ciab,
.int_mask = IF_EXTER,
- .handler_irq = IRQ_AMIGA_AUTO_6,
+ .handler_irq = IRQ_AMIGA_EXTER,
.cia_irq = IRQ_AMIGA_CIAB,
- .server_irq = IRQ_AMIGA_EXTER,
- .name = "CIAB handler"
+ .name = "CIAB"
};
/*
@@ -66,13 +63,11 @@ unsigned char cia_set_irq(struct ciabase *base, unsigned char mask)
/*
* Enable or disable CIA interrupts, return old interrupt mask,
- * interrupts will only be enabled if a handler exists
*/
unsigned char cia_able_irq(struct ciabase *base, unsigned char mask)
{
- unsigned char old, tmp;
- int i;
+ unsigned char old;
old = base->icr_mask;
base->icr_data |= base->cia->icr;
@@ -82,99 +77,104 @@ unsigned char cia_able_irq(struct ciabase *base, unsigned char mask)
else
base->icr_mask &= ~mask;
base->icr_mask &= CIA_ICR_ALL;
- for (i = 0, tmp = 1; i < CIA_IRQS; i++, tmp <<= 1) {
- if ((tmp & base->icr_mask) && !base->irq_list[i].handler) {
- base->icr_mask &= ~tmp;
- base->cia->icr = tmp;
- }
- }
if (base->icr_data & base->icr_mask)
amiga_custom.intreq = IF_SETCLR | base->int_mask;
return old;
}
-int cia_request_irq(struct ciabase *base, unsigned int irq,
- irqreturn_t (*handler)(int, void *, struct pt_regs *),
- unsigned long flags, const char *devname, void *dev_id)
-{
- unsigned char mask;
-
- base->irq_list[irq].handler = handler;
- base->irq_list[irq].flags = flags;
- base->irq_list[irq].dev_id = dev_id;
- base->irq_list[irq].devname = devname;
-
- /* enable the interrupt */
- mask = 1 << irq;
- cia_set_irq(base, mask);
- cia_able_irq(base, CIA_ICR_SETCLR | mask);
- return 0;
-}
-
-void cia_free_irq(struct ciabase *base, unsigned int irq, void *dev_id)
-{
- if (base->irq_list[irq].dev_id != dev_id)
- printk("%s: removing probably wrong IRQ %i from %s\n",
- __FUNCTION__, base->cia_irq + irq,
- base->irq_list[irq].devname);
-
- base->irq_list[irq].handler = NULL;
- base->irq_list[irq].flags = 0;
-
- cia_able_irq(base, 1 << irq);
-}
-
static irqreturn_t cia_handler(int irq, void *dev_id, struct pt_regs *fp)
{
struct ciabase *base = (struct ciabase *)dev_id;
- int mach_irq, i;
+ int mach_irq;
unsigned char ints;
mach_irq = base->cia_irq;
- irq = SYS_IRQS + mach_irq;
ints = cia_set_irq(base, CIA_ICR_ALL);
amiga_custom.intreq = base->int_mask;
- for (i = 0; i < CIA_IRQS; i++, irq++, mach_irq++) {
- if (ints & 1) {
- kstat_cpu(0).irqs[irq]++;
- base->irq_list[i].handler(mach_irq, base->irq_list[i].dev_id, fp);
- }
- ints >>= 1;
+ for (; ints; mach_irq++, ints >>= 1) {
+ if (ints & 1)
+ m68k_handle_int(mach_irq, fp);
}
- amiga_do_irq_list(base->server_irq, fp);
return IRQ_HANDLED;
}
-void __init cia_init_IRQ(struct ciabase *base)
+static void cia_enable_irq(unsigned int irq)
{
- int i;
+ unsigned char mask;
- /* init isr handlers */
- for (i = 0; i < CIA_IRQS; i++) {
- base->irq_list[i].handler = NULL;
- base->irq_list[i].flags = 0;
+ if (irq >= IRQ_AMIGA_CIAB) {
+ mask = 1 << (irq - IRQ_AMIGA_CIAB);
+ cia_set_irq(&ciab_base, mask);
+ cia_able_irq(&ciab_base, CIA_ICR_SETCLR | mask);
+ } else {
+ mask = 1 << (irq - IRQ_AMIGA_CIAA);
+ cia_set_irq(&ciaa_base, mask);
+ cia_able_irq(&ciaa_base, CIA_ICR_SETCLR | mask);
}
+}
- /* clear any pending interrupt and turn off all interrupts */
- cia_set_irq(base, CIA_ICR_ALL);
- cia_able_irq(base, CIA_ICR_ALL);
+static void cia_disable_irq(unsigned int irq)
+{
+ if (irq >= IRQ_AMIGA_CIAB)
+ cia_able_irq(&ciab_base, 1 << (irq - IRQ_AMIGA_CIAB));
+ else
+ cia_able_irq(&ciaa_base, 1 << (irq - IRQ_AMIGA_CIAA));
+}
- /* install CIA handler */
- request_irq(base->handler_irq, cia_handler, 0, base->name, base);
+static struct irq_controller cia_irq_controller = {
+ .name = "cia",
+ .lock = SPIN_LOCK_UNLOCKED,
+ .enable = cia_enable_irq,
+ .disable = cia_disable_irq,
+};
+
+/*
+ * Override auto irq 2 & 6 and use them as general chain
+ * for external interrupts, we link the CIA interrupt sources
+ * into this chain.
+ */
- amiga_custom.intena = IF_SETCLR | base->int_mask;
+static void auto_enable_irq(unsigned int irq)
+{
+ switch (irq) {
+ case IRQ_AUTO_2:
+ amiga_custom.intena = IF_SETCLR | IF_PORTS;
+ break;
+ case IRQ_AUTO_6:
+ amiga_custom.intena = IF_SETCLR | IF_EXTER;
+ break;
+ }
}
-int cia_get_irq_list(struct ciabase *base, struct seq_file *p)
+static void auto_disable_irq(unsigned int irq)
{
- int i, j;
-
- j = base->cia_irq;
- for (i = 0; i < CIA_IRQS; i++) {
- seq_printf(p, "cia %2d: %10d ", j + i,
- kstat_cpu(0).irqs[SYS_IRQS + j + i]);
- seq_puts(p, " ");
- seq_printf(p, "%s\n", base->irq_list[i].devname);
+ switch (irq) {
+ case IRQ_AUTO_2:
+ amiga_custom.intena = IF_PORTS;
+ break;
+ case IRQ_AUTO_6:
+ amiga_custom.intena = IF_EXTER;
+ break;
}
- return 0;
+}
+
+static struct irq_controller auto_irq_controller = {
+ .name = "auto",
+ .lock = SPIN_LOCK_UNLOCKED,
+ .enable = auto_enable_irq,
+ .disable = auto_disable_irq,
+};
+
+void __init cia_init_IRQ(struct ciabase *base)
+{
+ m68k_setup_irq_controller(&cia_irq_controller, base->cia_irq, CIA_IRQS);
+
+ /* clear any pending interrupt and turn off all interrupts */
+ cia_set_irq(base, CIA_ICR_ALL);
+ cia_able_irq(base, CIA_ICR_ALL);
+
+ /* override auto int and install CIA handler */
+ m68k_setup_irq_controller(&auto_irq_controller, base->handler_irq, 1);
+ m68k_irq_startup(base->handler_irq);
+ request_irq(base->handler_irq, cia_handler, IRQF_SHARED, base->name, base);
}
diff --git a/arch/m68k/amiga/config.c b/arch/m68k/amiga/config.c
index 12e3706fe02..092e50d2cb1 100644
--- a/arch/m68k/amiga/config.c
+++ b/arch/m68k/amiga/config.c
@@ -12,7 +12,6 @@
* Miscellaneous Amiga stuff
*/
-#include <linux/config.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/mm.h>
@@ -87,17 +86,8 @@ extern char m68k_debug_device[];
static void amiga_sched_init(irqreturn_t (*handler)(int, void *, struct pt_regs *));
/* amiga specific irq functions */
extern void amiga_init_IRQ (void);
-extern irqreturn_t (*amiga_default_handler[]) (int, void *, struct pt_regs *);
-extern int amiga_request_irq (unsigned int irq,
- irqreturn_t (*handler)(int, void *, struct pt_regs *),
- unsigned long flags, const char *devname,
- void *dev_id);
-extern void amiga_free_irq (unsigned int irq, void *dev_id);
-extern void amiga_enable_irq (unsigned int);
-extern void amiga_disable_irq (unsigned int);
static void amiga_get_model(char *model);
static int amiga_get_hardware_list(char *buffer);
-extern int show_amiga_interrupts (struct seq_file *, void *);
/* amiga specific timer functions */
static unsigned long amiga_gettimeoffset (void);
static int a3000_hwclk (int, struct rtc_time *);
@@ -392,14 +382,8 @@ void __init config_amiga(void)
mach_sched_init = amiga_sched_init;
mach_init_IRQ = amiga_init_IRQ;
- mach_default_handler = &amiga_default_handler;
- mach_request_irq = amiga_request_irq;
- mach_free_irq = amiga_free_irq;
- enable_irq = amiga_enable_irq;
- disable_irq = amiga_disable_irq;
mach_get_model = amiga_get_model;
mach_get_hardware_list = amiga_get_hardware_list;
- mach_get_irq_list = show_amiga_interrupts;
mach_gettimeoffset = amiga_gettimeoffset;
if (AMIGAHW_PRESENT(A3000_CLK)){
mach_hwclk = a3000_hwclk;
diff --git a/arch/m68k/apollo/Makefile b/arch/m68k/apollo/Makefile
index 39264f3b6ad..76a057962c3 100644
--- a/arch/m68k/apollo/Makefile
+++ b/arch/m68k/apollo/Makefile
@@ -2,4 +2,4 @@
# Makefile for Linux arch/m68k/amiga source directory
#
-obj-y := config.o dn_ints.o dma.o
+obj-y := config.o dn_ints.o
diff --git a/arch/m68k/apollo/config.c b/arch/m68k/apollo/config.c
index d401962d9b2..6f4581575fb 100644
--- a/arch/m68k/apollo/config.c
+++ b/arch/m68k/apollo/config.c
@@ -1,4 +1,3 @@
-#include <linux/config.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/mm.h>
@@ -28,11 +27,6 @@ u_long apollo_model;
extern void dn_sched_init(irqreturn_t (*handler)(int,void *,struct pt_regs *));
extern void dn_init_IRQ(void);
-extern int dn_request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *), unsigned long flags, const char *devname, void *dev_id);
-extern void dn_free_irq(unsigned int irq, void *dev_id);
-extern void dn_enable_irq(unsigned int);
-extern void dn_disable_irq(unsigned int);
-extern int show_dn_interrupts(struct seq_file *, void *);
extern unsigned long dn_gettimeoffset(void);
extern int dn_dummy_hwclk(int, struct rtc_time *);
extern int dn_dummy_set_clock_mmss(unsigned long);
@@ -40,13 +34,11 @@ extern void dn_dummy_reset(void);
extern void dn_dummy_waitbut(void);
extern struct fb_info *dn_fb_init(long *);
extern void dn_dummy_debug_init(void);
-extern void dn_dummy_video_setup(char *,int *);
extern irqreturn_t dn_process_int(int irq, struct pt_regs *fp);
#ifdef CONFIG_HEARTBEAT
static void dn_heartbeat(int on);
#endif
static irqreturn_t dn_timer_int(int irq,void *, struct pt_regs *);
-static irqreturn_t (*sched_timer_handler)(int, void *, struct pt_regs *)=NULL;
static void dn_get_model(char *model);
static const char *apollo_models[] = {
[APOLLO_DN3000-APOLLO_DN3000] = "DN3000 (Otter)",
@@ -164,17 +156,10 @@ void config_apollo(void) {
mach_sched_init=dn_sched_init; /* */
mach_init_IRQ=dn_init_IRQ;
- mach_default_handler=NULL;
- mach_request_irq = dn_request_irq;
- mach_free_irq = dn_free_irq;
- enable_irq = dn_enable_irq;
- disable_irq = dn_disable_irq;
- mach_get_irq_list = show_dn_interrupts;
mach_gettimeoffset = dn_gettimeoffset;
mach_max_dma_address = 0xffffffff;
mach_hwclk = dn_dummy_hwclk; /* */
mach_set_clock_mmss = dn_dummy_set_clock_mmss; /* */
- mach_process_int = dn_process_int;
mach_reset = dn_dummy_reset; /* */
#ifdef CONFIG_HEARTBEAT
mach_heartbeat = dn_heartbeat;
@@ -189,11 +174,13 @@ void config_apollo(void) {
}
-irqreturn_t dn_timer_int(int irq, void *dev_id, struct pt_regs *fp) {
+irqreturn_t dn_timer_int(int irq, void *dev_id, struct pt_regs *fp)
+{
+ irqreturn_t (*timer_handler)(int, void *, struct pt_regs *) = dev_id;
volatile unsigned char x;
- sched_timer_handler(irq,dev_id,fp);
+ timer_handler(irq, dev_id, fp);
x=*(volatile unsigned char *)(timer+3);
x=*(volatile unsigned char *)(timer+5);
@@ -217,9 +204,7 @@ void dn_sched_init(irqreturn_t (*timer_routine)(int, void *, struct pt_regs *))
printk("*(0x10803) %02x\n",*(volatile unsigned char *)(timer+0x3));
#endif
- sched_timer_handler=timer_routine;
- request_irq(0,dn_timer_int,0,NULL,NULL);
-
+ request_irq(IRQ_APOLLO, dn_timer_int, 0, "time", timer_routine);
}
unsigned long dn_gettimeoffset(void) {
diff --git a/arch/m68k/apollo/dn_ints.c b/arch/m68k/apollo/dn_ints.c
index a31259359a1..9fe07803797 100644
--- a/arch/m68k/apollo/dn_ints.c
+++ b/arch/m68k/apollo/dn_ints.c
@@ -1,125 +1,44 @@
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/jiffies.h>
-#include <linux/kernel_stat.h>
-#include <linux/timer.h>
+#include <linux/interrupt.h>
-#include <asm/system.h>
#include <asm/irq.h>
#include <asm/traps.h>
-#include <asm/page.h>
-#include <asm/machdep.h>
#include <asm/apollohw.h>
-#include <asm/errno.h>
-static irq_handler_t dn_irqs[16];
-
-irqreturn_t dn_process_int(int irq, struct pt_regs *fp)
+void dn_process_int(unsigned int irq, struct pt_regs *fp)
{
- irqreturn_t res = IRQ_NONE;
-
- if(dn_irqs[irq-160].handler) {
- res = dn_irqs[irq-160].handler(irq,dn_irqs[irq-160].dev_id,fp);
- } else {
- printk("spurious irq %d occurred\n",irq);
- }
-
- *(volatile unsigned char *)(pica)=0x20;
- *(volatile unsigned char *)(picb)=0x20;
-
- return res;
-}
-
-void dn_init_IRQ(void) {
-
- int i;
-
- for(i=0;i<16;i++) {
- dn_irqs[i].handler=NULL;
- dn_irqs[i].flags=IRQ_FLG_STD;
- dn_irqs[i].dev_id=NULL;
- dn_irqs[i].devname=NULL;
- }
-
-}
-
-int dn_request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *), unsigned long flags, const char *devname, void *dev_id) {
-
- if((irq<0) || (irq>15)) {
- printk("Trying to request invalid IRQ\n");
- return -ENXIO;
- }
-
- if(!dn_irqs[irq].handler) {
- dn_irqs[irq].handler=handler;
- dn_irqs[irq].flags=IRQ_FLG_STD;
- dn_irqs[irq].dev_id=dev_id;
- dn_irqs[irq].devname=devname;
- if(irq<8)
- *(volatile unsigned char *)(pica+1)&=~(1<<irq);
- else
- *(volatile unsigned char *)(picb+1)&=~(1<<(irq-8));
-
- return 0;
- }
- else {
- printk("Trying to request already assigned irq %d\n",irq);
- return -ENXIO;
- }
-
-}
-
-void dn_free_irq(unsigned int irq, void *dev_id) {
-
- if((irq<0) || (irq>15)) {
- printk("Trying to free invalid IRQ\n");
- return ;
- }
-
- if(irq<8)
- *(volatile unsigned char *)(pica+1)|=(1<<irq);
- else
- *(volatile unsigned char *)(picb+1)|=(1<<(irq-8));
-
- dn_irqs[irq].handler=NULL;
- dn_irqs[irq].flags=IRQ_FLG_STD;
- dn_irqs[irq].dev_id=NULL;
- dn_irqs[irq].devname=NULL;
-
- return ;
-
-}
-
-void dn_enable_irq(unsigned int irq) {
-
- printk("dn enable irq\n");
-
-}
-
-void dn_disable_irq(unsigned int irq) {
-
- printk("dn disable irq\n");
+ m68k_handle_int(irq, fp);
+ *(volatile unsigned char *)(pica)=0x20;
+ *(volatile unsigned char *)(picb)=0x20;
}
-int show_dn_interrupts(struct seq_file *p, void *v) {
-
- printk("dn get irq list\n");
-
- return 0;
-
+int apollo_irq_startup(unsigned int irq)
+{
+ if (irq < 8)
+ *(volatile unsigned char *)(pica+1) &= ~(1 << irq);
+ else
+ *(volatile unsigned char *)(picb+1) &= ~(1 << (irq - 8));
+ return 0;
}
-struct fb_info *dn_dummy_fb_init(long *mem_start) {
-
- printk("fb init\n");
-
- return NULL;
-
+void apollo_irq_shutdown(unsigned int irq)
+{
+ if (irq < 8)
+ *(volatile unsigned char *)(pica+1) |= (1 << irq);
+ else
+ *(volatile unsigned char *)(picb+1) |= (1 << (irq - 8));
}
-void dn_dummy_video_setup(char *options,int *ints) {
+static struct irq_controller apollo_irq_controller = {
+ .name = "apollo",
+ .lock = SPIN_LOCK_UNLOCKED,
+ .startup = apollo_irq_startup,
+ .shutdown = apollo_irq_shutdown,
+};
- printk("no video yet\n");
+void dn_init_IRQ(void)
+{
+ m68k_setup_user_interrupt(VEC_USER + 96, 16, dn_process_int);
+ m68k_setup_irq_controller(&apollo_irq_controller, IRQ_APOLLO, 16);
}
diff --git a/arch/m68k/atari/ataints.c b/arch/m68k/atari/ataints.c
index 076f4791784..ece13cbf995 100644
--- a/arch/m68k/atari/ataints.c
+++ b/arch/m68k/atari/ataints.c
@@ -104,6 +104,7 @@
* the sr copy in the frame.
*/
+#if 0
#define NUM_INT_SOURCES (8 + NUM_ATARI_SOURCES)
@@ -133,13 +134,6 @@ static struct irqhandler irq_handler[NUM_INT_SOURCES];
*/
static struct irqparam irq_param[NUM_INT_SOURCES];
-/*
- * Bitmap for free interrupt vector numbers
- * (new vectors starting from 0x70 can be allocated by
- * atari_register_vme_int())
- */
-static int free_vme_vec_bitmap;
-
/* check for valid int number (complex, sigh...) */
#define IS_VALID_INTNO(n) \
((n) > 0 && \
@@ -301,6 +295,14 @@ __asm__ (__ALIGN_STR "\n"
);
for (;;);
}
+#endif
+
+/*
+ * Bitmap for free interrupt vector numbers
+ * (new vectors starting from 0x70 can be allocated by
+ * atari_register_vme_int())
+ */
+static int free_vme_vec_bitmap;
/* GK:
* HBL IRQ handler for Falcon. Nobody needs it :-)
@@ -313,13 +315,34 @@ __ALIGN_STR "\n\t"
"orw #0x200,%sp@\n\t" /* set saved ipl to 2 */
"rte");
-/* Defined in entry.S; only increments 'num_spurious' */
-asmlinkage void bad_interrupt(void);
-
-extern void atari_microwire_cmd( int cmd );
+extern void atari_microwire_cmd(int cmd);
extern int atari_SCC_reset_done;
+static int atari_startup_irq(unsigned int irq)
+{
+ m68k_irq_startup(irq);
+ atari_turnon_irq(irq);
+ atari_enable_irq(irq);
+ return 0;
+}
+
+static void atari_shutdown_irq(unsigned int irq)
+{
+ atari_disable_irq(irq);
+ atari_turnoff_irq(irq);
+ m68k_irq_shutdown(irq);
+}
+
+static struct irq_controller atari_irq_controller = {
+ .name = "atari",
+ .lock = SPIN_LOCK_UNLOCKED,
+ .startup = atari_startup_irq,
+ .shutdown = atari_shutdown_irq,
+ .enable = atari_enable_irq,
+ .disable = atari_disable_irq,
+};
+
/*
* void atari_init_IRQ (void)
*
@@ -333,12 +356,8 @@ extern int atari_SCC_reset_done;
void __init atari_init_IRQ(void)
{
- int i;
-
- /* initialize the vector table */
- for (i = 0; i < NUM_INT_SOURCES; ++i) {
- vectors[IRQ_SOURCE_TO_VECTOR(i)] = bad_interrupt;
- }
+ m68k_setup_user_interrupt(VEC_USER, 192, NULL);
+ m68k_setup_irq_controller(&atari_irq_controller, 1, NUM_ATARI_SOURCES - 1);
/* Initialize the MFP(s) */
@@ -378,8 +397,7 @@ void __init atari_init_IRQ(void)
* enabled in VME mask
*/
tt_scu.vme_mask = 0x60; /* enable MFP and SCC ints */
- }
- else {
+ } else {
/* If no SCU and no Hades, the HSYNC interrupt needs to be
* disabled this way. (Else _inthandler in kernel/sys_call.S
* gets overruns)
@@ -404,184 +422,6 @@ void __init atari_init_IRQ(void)
}
-static irqreturn_t atari_call_irq_list( int irq, void *dev_id, struct pt_regs *fp )
-{
- irq_node_t *node;
-
- for (node = (irq_node_t *)dev_id; node; node = node->next)
- node->handler(irq, node->dev_id, fp);
- return IRQ_HANDLED;
-}
-
-
-/*
- * atari_request_irq : add an interrupt service routine for a particular
- * machine specific interrupt source.
- * If the addition was successful, it returns 0.
- */
-
-int atari_request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *),
- unsigned long flags, const char *devname, void *dev_id)
-{
- int vector;
- unsigned long oflags = flags;
-
- /*
- * The following is a hack to make some PCI card drivers work,
- * which set the SA_SHIRQ flag.
- */
-
- flags &= ~SA_SHIRQ;
-
- if (flags == SA_INTERRUPT) {
- printk ("%s: SA_INTERRUPT changed to IRQ_TYPE_SLOW for %s\n",
- __FUNCTION__, devname);
- flags = IRQ_TYPE_SLOW;
- }
- if (flags < IRQ_TYPE_SLOW || flags > IRQ_TYPE_PRIO) {
- printk ("%s: Bad irq type 0x%lx <0x%lx> requested from %s\n",
- __FUNCTION__, flags, oflags, devname);
- return -EINVAL;
- }
- if (!IS_VALID_INTNO(irq)) {
- printk ("%s: Unknown irq %d requested from %s\n",
- __FUNCTION__, irq, devname);
- return -ENXIO;
- }
- vector = IRQ_SOURCE_TO_VECTOR(irq);
-
- /*
- * Check type/source combination: slow ints are (currently)
- * only possible for MFP-interrupts.
- */
- if (flags == IRQ_TYPE_SLOW &&
- (irq < STMFP_SOURCE_BASE || irq >= SCC_SOURCE_BASE)) {
- printk ("%s: Slow irq requested for non-MFP source %d from %s\n",
- __FUNCTION__, irq, devname);
- return -EINVAL;
- }
-
- if (vectors[vector] == bad_interrupt) {
- /* int has no handler yet */
- irq_handler[irq].handler = handler;
- irq_handler[irq].dev_id = dev_id;
- irq_param[irq].flags = flags;
- irq_param[irq].devname = devname;
- vectors[vector] =
- (flags == IRQ_TYPE_SLOW) ? slow_handlers[irq-STMFP_SOURCE_BASE] :
- (flags == IRQ_TYPE_FAST) ? atari_fast_irq_handler :
- atari_prio_irq_handler;
- /* If MFP int, also enable and umask it */
- atari_turnon_irq(irq);
- atari_enable_irq(irq);
-
- return 0;
- }
- else if (irq_param[irq].flags == flags) {
- /* old handler is of same type -> handlers can be chained */
- irq_node_t *node;
- unsigned long flags;
-
- local_irq_save(flags);
-
- if (irq_handler[irq].handler != atari_call_irq_list) {
- /* Only one handler yet, make a node for this first one */
- if (!(node = new_irq_node()))
- return -ENOMEM;
- node->handler = irq_handler[irq].handler;
- node->dev_id = irq_handler[irq].dev_id;
- node->devname = irq_param[irq].devname;
- node->next = NULL;
-
- irq_handler[irq].handler = atari_call_irq_list;
- irq_handler[irq].dev_id = node;
- irq_param[irq].devname = "chained";
- }
-
- if (!(node = new_irq_node()))
- return -ENOMEM;
- node->handler = handler;
- node->dev_id = dev_id;
- node->devname = devname;
- /* new handlers are put in front of the queue */
- node->next = irq_handler[irq].dev_id;
- irq_handler[irq].dev_id = node;
-
- local_irq_restore(flags);
- return 0;
- } else {
- printk ("%s: Irq %d allocated by other type int (call from %s)\n",
- __FUNCTION__, irq, devname);
- return -EBUSY;
- }
-}
-
-void atari_free_irq(unsigned int irq, void *dev_id)
-{
- unsigned long flags;
- int vector;
- irq_node_t **list, *node;
-
- if (!IS_VALID_INTNO(irq)) {
- printk("%s: Unknown irq %d\n", __FUNCTION__, irq);
- return;
- }
-
- vector = IRQ_SOURCE_TO_VECTOR(irq);
- if (vectors[vector] == bad_interrupt)
- goto not_found;
-
- local_irq_save(flags);
-
- if (irq_handler[irq].handler != atari_call_irq_list) {
- /* It's the only handler for the interrupt */
- if (irq_handler[irq].dev_id != dev_id) {
- local_irq_restore(flags);
- goto not_found;
- }
- irq_handler[irq].handler = NULL;
- irq_handler[irq].dev_id = NULL;
- irq_param[irq].devname = NULL;
- vectors[vector] = bad_interrupt;
- /* If MFP int, also disable it */
- atari_disable_irq(irq);
- atari_turnoff_irq(irq);
-
- local_irq_restore(flags);
- return;
- }
-
- /* The interrupt is chained, find the irq on the list */
- for(list = (irq_node_t **)&irq_handler[irq].dev_id; *list; list = &(*list)->next) {
- if ((*list)->dev_id == dev_id) break;
- }
- if (!*list) {
- local_irq_restore(flags);
- goto not_found;
- }
-
- (*list)->handler = NULL; /* Mark it as free for reallocation */
- *list = (*list)->next;
-
- /* If there's now only one handler, unchain the interrupt, i.e. plug in
- * the handler directly again and omit atari_call_irq_list */
- node = (irq_node_t *)irq_handler[irq].dev_id;
- if (node && !node->next) {
- irq_handler[irq].handler = node->handler;
- irq_handler[irq].dev_id = node->dev_id;
- irq_param[irq].devname = node->devname;
- node->handler = NULL; /* Mark it as free for reallocation */
- }
-
- local_irq_restore(flags);
- return;
-
-not_found:
- printk("%s: tried to remove invalid irq\n", __FUNCTION__);
- return;
-}
-
-
/*
* atari_register_vme_int() returns the number of a free interrupt vector for
* hardware with a programmable int vector (probably a VME board).
@@ -591,58 +431,24 @@ unsigned long atari_register_vme_int(void)
{
int i;
- for(i = 0; i < 32; i++)
- if((free_vme_vec_bitmap & (1 << i)) == 0)
+ for (i = 0; i < 32; i++)
+ if ((free_vme_vec_bitmap & (1 << i)) == 0)
break;
- if(i == 16)
+ if (i == 16)
return 0;
free_vme_vec_bitmap |= 1 << i;
- return (VME_SOURCE_BASE + i);
+ return VME_SOURCE_BASE + i;
}
void atari_unregister_vme_int(unsigned long irq)
{
- if(irq >= VME_SOURCE_BASE && irq < VME_SOURCE_BASE + VME_MAX_SOURCES) {
+ if (irq >= VME_SOURCE_BASE && irq < VME_SOURCE_BASE + VME_MAX_SOURCES) {
irq -= VME_SOURCE_BASE;
free_vme_vec_bitmap &= ~(1 << irq);
}
}
-int show_atari_interrupts(struct seq_file *p, void *v)
-{
- int i;
-
- for (i = 0; i < NUM_INT_SOURCES; ++i) {
- if (vectors[IRQ_SOURCE_TO_VECTOR(i)] == bad_interrupt)
- continue;
- if (i < STMFP_SOURCE_BASE)
- seq_printf(p, "auto %2d: %10u ",
- i, kstat_cpu(0).irqs[i]);
- else
- seq_printf(p, "vec $%02x: %10u ",
- IRQ_SOURCE_TO_VECTOR(i),
- kstat_cpu(0).irqs[i]);
-
- if (irq_handler[i].handler != atari_call_irq_list) {
- seq_printf(p, "%s\n", irq_param[i].devname);
- }
- else {
- irq_node_t *n;
- for( n = (irq_node_t *)irq_handler[i].dev_id; n; n = n->next ) {
- seq_printf(p, "%s\n", n->devname);
- if (n->next)
- seq_puts(p, " " );
- }
- }
- }
- if (num_spurious)
- seq_printf(p, "spurio.: %10u\n", num_spurious);
-
- return 0;
-}
-
-
diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
index 1012b08e552..b2079252a95 100644
--- a/arch/m68k/atari/config.c
+++ b/arch/m68k/atari/config.c
@@ -24,7 +24,6 @@
* Miscellaneous atari stuff
*/
-#include <linux/config.h>
#include <linux/types.h>
#include <linux/mm.h>
#include <linux/console.h>
@@ -57,12 +56,6 @@ static int atari_get_hardware_list(char *buffer);
/* atari specific irq functions */
extern void atari_init_IRQ (void);
-extern int atari_request_irq (unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *),
- unsigned long flags, const char *devname, void *dev_id);
-extern void atari_free_irq (unsigned int irq, void *dev_id);
-extern void atari_enable_irq (unsigned int);
-extern void atari_disable_irq (unsigned int);
-extern int show_atari_interrupts (struct seq_file *, void *);
extern void atari_mksound( unsigned int count, unsigned int ticks );
#ifdef CONFIG_HEARTBEAT
static void atari_heartbeat( int on );
@@ -232,13 +225,8 @@ void __init config_atari(void)
mach_sched_init = atari_sched_init;
mach_init_IRQ = atari_init_IRQ;
- mach_request_irq = atari_request_irq;
- mach_free_irq = atari_free_irq;
- enable_irq = atari_enable_irq;
- disable_irq = atari_disable_irq;
mach_get_model = atari_get_model;
mach_get_hardware_list = atari_get_hardware_list;
- mach_get_irq_list = show_atari_interrupts;
mach_gettimeoffset = atari_gettimeoffset;
mach_reset = atari_reset;
mach_max_dma_address = 0xffffff;
diff --git a/arch/m68k/atari/debug.c b/arch/m68k/atari/debug.c
index ace05f79d96..4ae01004d8d 100644
--- a/arch/m68k/atari/debug.c
+++ b/arch/m68k/atari/debug.c
@@ -10,7 +10,6 @@
* for more details.
*/
-#include <linux/config.h>
#include <linux/types.h>
#include <linux/tty.h>
#include <linux/console.h>
diff --git a/arch/m68k/atari/hades-pci.c b/arch/m68k/atari/hades-pci.c
index 8888debf71e..6ca57b6564d 100644
--- a/arch/m68k/atari/hades-pci.c
+++ b/arch/m68k/atari/hades-pci.c
@@ -4,7 +4,6 @@
* Written by Wout Klaren.
*/
-#include <linux/config.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <asm/io.h>
diff --git a/arch/m68k/atari/stram.c b/arch/m68k/atari/stram.c
index 22e0481a5f7..bf4588cbe37 100644
--- a/arch/m68k/atari/stram.c
+++ b/arch/m68k/atari/stram.c
@@ -8,7 +8,6 @@
* for more details.
*/
-#include <linux/config.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/mm.h>
diff --git a/arch/m68k/bvme6000/Makefile b/arch/m68k/bvme6000/Makefile
index 2348e6ceed1..d8174004fe2 100644
--- a/arch/m68k/bvme6000/Makefile
+++ b/arch/m68k/bvme6000/Makefile
@@ -2,4 +2,4 @@
# Makefile for Linux arch/m68k/bvme6000 source directory
#
-obj-y := config.o bvmeints.o rtc.o
+obj-y := config.o rtc.o
diff --git a/arch/m68k/bvme6000/bvmeints.c b/arch/m68k/bvme6000/bvmeints.c
deleted file mode 100644
index 298a8df0266..00000000000
--- a/arch/m68k/bvme6000/bvmeints.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * arch/m68k/bvme6000/bvmeints.c
- *
- * Copyright (C) 1997 Richard Hirst [richard@sleepie.demon.co.uk]
- *
- * based on amiints.c -- Amiga Linux interrupt handling code
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file README.legal in the main directory of this archive
- * for more details.
- *
- */
-
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/seq_file.h>
-
-#include <asm/ptrace.h>
-#include <asm/system.h>
-#include <asm/irq.h>
-#include <asm/traps.h>
-
-static irqreturn_t bvme6000_defhand (int irq, void *dev_id, struct pt_regs *fp);
-
-/*
- * This should ideally be 4 elements only, for speed.
- */
-
-static struct {
- irqreturn_t (*handler)(int, void *, struct pt_regs *);
- unsigned long flags;
- void *dev_id;
- const char *devname;
- unsigned count;
-} irq_tab[256];
-
-/*
- * void bvme6000_init_IRQ (void)
- *
- * Parameters: None
- *
- * Returns: Nothing
- *
- * This function is called during kernel startup to initialize
- * the bvme6000 IRQ handling routines.
- */
-
-void bvme6000_init_IRQ (void)
-{
- int i;
-
- for (i = 0; i < 256; i++) {
- irq_tab[i].handler = bvme6000_defhand;
- irq_tab[i].flags = IRQ_FLG_STD;
- irq_tab[i].dev_id = NULL;
- irq_tab[i].devname = NULL;
- irq_tab[i].count = 0;
- }
-}
-
-int bvme6000_request_irq(unsigned int irq,
- irqreturn_t (*handler)(int, void *, struct pt_regs *),
- unsigned long flags, const char *devname, void *dev_id)
-{
- if (irq > 255) {
- printk("%s: Incorrect IRQ %d from %s\n", __FUNCTION__, irq, devname);
- return -ENXIO;
- }
-#if 0
- /* Nothing special about auto-vectored devices for the BVME6000,
- * but treat it specially to avoid changes elsewhere.
- */
-
- if (irq >= VEC_INT1 && irq <= VEC_INT7)
- return cpu_request_irq(irq - VEC_SPUR, handler, flags,
- devname, dev_id);
-#endif
- if (!(irq_tab[irq].flags & IRQ_FLG_STD)) {
- if (irq_tab[irq].flags & IRQ_FLG_LOCK) {
- printk("%s: IRQ %d from %s is not replaceable\n",
- __FUNCTION__, irq, irq_tab[irq].devname);
- return -EBUSY;
- }
- if (flags & IRQ_FLG_REPLACE) {
- printk("%s: %s can't replace IRQ %d from %s\n",
- __FUNCTION__, devname, irq, irq_tab[irq].devname);
- return -EBUSY;
- }
- }
- irq_tab[irq].handler = handler;
- irq_tab[irq].flags = flags;
- irq_tab[irq].dev_id = dev_id;
- irq_tab[irq].devname = devname;
- return 0;
-}
-
-void bvme6000_free_irq(unsigned int irq, void *dev_id)
-{
- if (irq > 255) {
- printk("%s: Incorrect IRQ %d\n", __FUNCTION__, irq);
- return;
- }
-#if 0
- if (irq >= VEC_INT1 && irq <= VEC_INT7) {
- cpu_free_irq(irq - VEC_SPUR, dev_id);
- return;
- }
-#endif
- if (irq_tab[irq].dev_id != dev_id)
- printk("%s: Removing probably wrong IRQ %d from %s\n",
- __FUNCTION__, irq, irq_tab[irq].devname);
-
- irq_tab[irq].handler = bvme6000_defhand;
- irq_tab[irq].flags = IRQ_FLG_STD;
- irq_tab[irq].dev_id = NULL;
- irq_tab[irq].devname = NULL;
-}
-
-irqreturn_t bvme6000_process_int (unsigned long vec, struct pt_regs *fp)
-{
- if (vec > 255) {
- printk ("bvme6000_process_int: Illegal vector %ld", vec);
- return IRQ_NONE;
- } else {
- irq_tab[vec].count++;
- irq_tab[vec].handler(vec, irq_tab[vec].dev_id, fp);
- return IRQ_HANDLED;
- }
-}
-
-int show_bvme6000_interrupts(struct seq_file *p, void *v)
-{
- int i;
-
- for (i = 0; i < 256; i++) {
- if (irq_tab[i].count)
- seq_printf(p, "Vec 0x%02x: %8d %s\n",
- i, irq_tab[i].count,
- irq_tab[i].devname ? irq_tab[i].devname : "free");
- }
- return 0;
-}
-
-
-static irqreturn_t bvme6000_defhand (int irq, void *dev_id, struct pt_regs *fp)
-{
- printk ("Unknown interrupt 0x%02x\n", irq);
- return IRQ_NONE;
-}
-
-void bvme6000_enable_irq (unsigned int irq)
-{
-}
-
-
-void bvme6000_disable_irq (unsigned int irq)
-{
-}
-
diff --git a/arch/m68k/bvme6000/config.c b/arch/m68k/bvme6000/config.c
index c90cb5fcc8e..d1e916ae55a 100644
--- a/arch/m68k/bvme6000/config.c
+++ b/arch/m68k/bvme6000/config.c
@@ -36,15 +36,8 @@
#include <asm/machdep.h>
#include <asm/bvme6000hw.h>
-extern irqreturn_t bvme6000_process_int (int level, struct pt_regs *regs);
-extern void bvme6000_init_IRQ (void);
-extern void bvme6000_free_irq (unsigned int, void *);
-extern int show_bvme6000_interrupts(struct seq_file *, void *);
-extern void bvme6000_enable_irq (unsigned int);
-extern void bvme6000_disable_irq (unsigned int);
static void bvme6000_get_model(char *model);
static int bvme6000_get_hardware_list(char *buffer);
-extern int bvme6000_request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *), unsigned long flags, const char *devname, void *dev_id);
extern void bvme6000_sched_init(irqreturn_t (*handler)(int, void *, struct pt_regs *));
extern unsigned long bvme6000_gettimeoffset (void);
extern int bvme6000_hwclk (int, struct rtc_time *);
@@ -100,6 +93,14 @@ static int bvme6000_get_hardware_list(char *buffer)
return 0;
}
+/*
+ * This function is called during kernel startup to initialize
+ * the bvme6000 IRQ handling routines.
+ */
+static void bvme6000_init_IRQ(void)
+{
+ m68k_setup_user_interrupt(VEC_USER, 192, NULL);
+}
void __init config_bvme6000(void)
{
@@ -127,12 +128,6 @@ void __init config_bvme6000(void)
mach_hwclk = bvme6000_hwclk;
mach_set_clock_mmss = bvme6000_set_clock_mmss;
mach_reset = bvme6000_reset;
- mach_free_irq = bvme6000_free_irq;
- mach_process_int = bvme6000_process_int;
- mach_get_irq_list = show_bvme6000_interrupts;
- mach_request_irq = bvme6000_request_irq;
- enable_irq = bvme6000_enable_irq;
- disable_irq = bvme6000_disable_irq;
mach_get_model = bvme6000_get_model;
mach_get_hardware_list = bvme6000_get_hardware_list;
diff --git a/arch/m68k/hp300/Makefile b/arch/m68k/hp300/Makefile
index 89b6317899e..288b9c67c9b 100644
--- a/arch/m68k/hp300/Makefile
+++ b/arch/m68k/hp300/Makefile
@@ -2,4 +2,4 @@
# Makefile for Linux arch/m68k/hp300 source directory
#
-obj-y := ksyms.o config.o ints.o time.o reboot.o
+obj-y := ksyms.o config.o time.o reboot.o
diff --git a/arch/m68k/hp300/config.c b/arch/m68k/hp300/config.c
index 6d129eef370..1c05a626054 100644
--- a/arch/m68k/hp300/config.c
+++ b/arch/m68k/hp300/config.c
@@ -7,7 +7,6 @@
* called by setup.c.
*/
-#include <linux/config.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/string.h>
@@ -21,7 +20,6 @@
#include <asm/hp300hw.h>
#include <asm/rtc.h>
-#include "ints.h"
#include "time.h"
unsigned long hp300_model;
@@ -64,8 +62,6 @@ static char *hp300_models[] __initdata = {
static char hp300_model_name[13] = "HP9000/";
extern void hp300_reset(void);
-extern irqreturn_t (*hp300_default_handler[])(int, void *, struct pt_regs *);
-extern int show_hp300_interrupts(struct seq_file *, void *);
#ifdef CONFIG_SERIAL_8250_CONSOLE
extern int hp300_setup_serial_console(void) __init;
#endif
@@ -245,16 +241,16 @@ static unsigned int hp300_get_ss(void)
hp300_rtc_read(RTC_REG_SEC2);
}
+static void __init hp300_init_IRQ(void)
+{
+}
+
void __init config_hp300(void)
{
mach_sched_init = hp300_sched_init;
mach_init_IRQ = hp300_init_IRQ;
- mach_request_irq = hp300_request_irq;
- mach_free_irq = hp300_free_irq;
mach_get_model = hp300_get_model;
- mach_get_irq_list = show_hp300_interrupts;
mach_gettimeoffset = hp300_gettimeoffset;
- mach_default_handler = &hp300_default_handler;
mach_hwclk = hp300_hwclk;
mach_get_ss = hp300_get_ss;
mach_reset = hp300_reset;
diff --git a/arch/m68k/hp300/ints.c b/arch/m68k/hp300/ints.c
deleted file mode 100644
index 0c5bb403e89..00000000000
--- a/arch/m68k/hp300/ints.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * linux/arch/m68k/hp300/ints.c
- *
- * Copyright (C) 1998 Philip Blundell <philb@gnu.org>
- *
- * This file contains the HP300-specific interrupt handling.
- * We only use the autovector interrupts, and therefore we need to
- * maintain lists of devices sharing each ipl.
- * [ipl list code added by Peter Maydell <pmaydell@chiark.greenend.org.uk> 06/1998]
- */
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/init.h>
-#include <linux/sched.h>
-#include <linux/kernel_stat.h>
-#include <linux/interrupt.h>
-#include <linux/spinlock.h>
-#include <asm/machdep.h>
-#include <asm/irq.h>
-#include <asm/io.h>
-#include <asm/system.h>
-#include <asm/traps.h>
-#include <asm/ptrace.h>
-#include <asm/errno.h>
-#include "ints.h"
-
-/* Each ipl has a linked list of interrupt service routines.
- * Service routines are added via hp300_request_irq() and removed
- * via hp300_free_irq(). The device driver should set IRQ_FLG_FAST
- * if it needs to be serviced early (eg FIFOless UARTs); this will
- * cause it to be added at the front of the queue rather than
- * the back.
- * Currently IRQ_FLG_SLOW and flags=0 are treated identically; if
- * we needed three levels of priority we could distinguish them
- * but this strikes me as mildly ugly...
- */
-
-/* we start with no entries in any list */
-static irq_node_t *hp300_irq_list[HP300_NUM_IRQS];
-
-static spinlock_t irqlist_lock;
-
-/* This handler receives all interrupts, dispatching them to the registered handlers */
-static irqreturn_t hp300_int_handler(int irq, void *dev_id, struct pt_regs *fp)
-{
- irq_node_t *t;
- /* We just give every handler on the chain an opportunity to handle
- * the interrupt, in priority order.
- */
- for(t = hp300_irq_list[irq]; t; t=t->next)
- t->handler(irq, t->dev_id, fp);
- /* We could put in some accounting routines, checks for stray interrupts,
- * etc, in here. Note that currently we can't tell whether or not
- * a handler handles the interrupt, though.
- */
- return IRQ_HANDLED;
-}
-
-static irqreturn_t hp300_badint(int irq, void *dev_id, struct pt_regs *fp)
-{
- num_spurious += 1;
- return IRQ_NONE;
-}
-
-irqreturn_t (*hp300_default_handler[SYS_IRQS])(int, void *, struct pt_regs *) = {
- [0] = hp300_badint,
- [1] = hp300_int_handler,
- [2] = hp300_int_handler,
- [3] = hp300_int_handler,
- [4] = hp300_int_handler,
- [5] = hp300_int_handler,
- [6] = hp300_int_handler,
- [7] = hp300_int_handler
-};
-
-/* dev_id had better be unique to each handler because it's the only way we have
- * to distinguish handlers when removing them...
- *
- * It would be pretty easy to support IRQ_FLG_LOCK (handler is not replacable)
- * and IRQ_FLG_REPLACE (handler replaces existing one with this dev_id)
- * if we wanted to. IRQ_FLG_FAST is needed for devices where interrupt latency
- * matters (eg the dreaded FIFOless UART...)
- */
-int hp300_request_irq(unsigned int irq,
- irqreturn_t (*handler) (int, void *, struct pt_regs *),
- unsigned long flags, const char *devname, void *dev_id)
-{
- irq_node_t *t, *n = new_irq_node();
-
- if (!n) /* oops, no free nodes */
- return -ENOMEM;
-
- spin_lock_irqsave(&irqlist_lock, flags);
-
- if (!hp300_irq_list[irq]) {
- /* no list yet */
- hp300_irq_list[irq] = n;
- n->next = NULL;
- } else if (flags & IRQ_FLG_FAST) {
- /* insert at head of list */
- n->next = hp300_irq_list[irq];
- hp300_irq_list[irq] = n;
- } else {
- /* insert at end of list */
- for(t = hp300_irq_list[irq]; t->next; t = t->next)
- /* do nothing */;
- n->next = NULL;
- t->next = n;
- }
-
- /* Fill in n appropriately */
- n->handler = handler;
- n->flags = flags;
- n->dev_id = dev_id;
- n->devname = devname;
- spin_unlock_irqrestore(&irqlist_lock, flags);
- return 0;
-}
-
-void hp300_free_irq(unsigned int irq, void *dev_id)
-{
- irq_node_t *t;
- unsigned long flags;
-
- spin_lock_irqsave(&irqlist_lock, flags);
-
- t = hp300_irq_list[irq];
- if (!t) /* no handlers at all for that IRQ */
- {
- printk(KERN_ERR "hp300_free_irq: attempt to remove nonexistent handler for IRQ %d\n", irq);
- spin_unlock_irqrestore(&irqlist_lock, flags);
- return;
- }
-
- if (t->dev_id == dev_id)
- { /* removing first handler on chain */
- t->flags = IRQ_FLG_STD; /* we probably don't really need these */
- t->dev_id = NULL;
- t->devname = NULL;
- t->handler = NULL; /* frees this irq_node_t */
- hp300_irq_list[irq] = t->next;
- spin_unlock_irqrestore(&irqlist_lock, flags);
- return;
- }
-
- /* OK, must be removing from middle of the chain */
-
- for (t = hp300_irq_list[irq]; t->next && t->next->dev_id != dev_id; t = t->next)
- /* do nothing */;
- if (!t->next)
- {
- printk(KERN_ERR "hp300_free_irq: attempt to remove nonexistent handler for IRQ %d\n", irq);
- spin_unlock_irqrestore(&irqlist_lock, flags);
- return;
- }
- /* remove the entry after t: */
- t->next->flags = IRQ_FLG_STD;
- t->next->dev_id = NULL;
- t->next->devname = NULL;
- t->next->handler = NULL;
- t->next = t->next->next;
-
- spin_unlock_irqrestore(&irqlist_lock, flags);
-}
-
-int show_hp300_interrupts(struct seq_file *p, void *v)
-{
- return 0;
-}
-
-void __init hp300_init_IRQ(void)
-{
- spin_lock_init(&irqlist_lock);
-}
diff --git a/arch/m68k/hp300/ints.h b/arch/m68k/hp300/ints.h
deleted file mode 100644
index 8cfabe2f384..00000000000
--- a/arch/m68k/hp300/ints.h
+++ /dev/null
@@ -1,9 +0,0 @@
-extern void hp300_init_IRQ(void);
-extern void (*hp300_handlers[8])(int, void *, struct pt_regs *);
-extern void hp300_free_irq(unsigned int irq, void *dev_id);
-extern int hp300_request_irq(unsigned int irq,
- irqreturn_t (*handler) (int, void *, struct pt_regs *),
- unsigned long flags, const char *devname, void *dev_id);
-
-/* number of interrupts, includes 0 (what's that?) */
-#define HP300_NUM_IRQS 8
diff --git a/arch/m68k/hp300/time.c b/arch/m68k/hp300/time.c
index 8da5b1b31e6..7df05662b27 100644
--- a/arch/m68k/hp300/time.c
+++ b/arch/m68k/hp300/time.c
@@ -18,7 +18,6 @@
#include <asm/system.h>
#include <asm/traps.h>
#include <asm/blinken.h>
-#include "ints.h"
/* Clock hardware definitions */
@@ -71,7 +70,7 @@ void __init hp300_sched_init(irqreturn_t (*vector)(int, void *, struct pt_regs *
asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
- cpu_request_irq(6, hp300_tick, IRQ_FLG_STD, "timer tick", vector);
+ request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector);
out_8(CLOCKBASE + CLKCR2, 0x1); /* select CR1 */
out_8(CLOCKBASE + CLKCR1, 0x40); /* enable irq */
diff --git a/arch/m68k/kernel/Makefile b/arch/m68k/kernel/Makefile
index 458925c471a..dae609797dc 100644
--- a/arch/m68k/kernel/Makefile
+++ b/arch/m68k/kernel/Makefile
@@ -9,8 +9,8 @@ else
endif
extra-y += vmlinux.lds
-obj-y := entry.o process.o traps.o ints.o signal.o ptrace.o \
- sys_m68k.o time.o semaphore.o setup.o m68k_ksyms.o
+obj-y := entry.o process.o traps.o ints.o dma.o signal.o ptrace.o \
+ sys_m68k.o time.o semaphore.o setup.o m68k_ksyms.o
obj-$(CONFIG_PCI) += bios32.o
obj-$(CONFIG_MODULES) += module.o
diff --git a/arch/m68k/kernel/bios32.c b/arch/m68k/kernel/bios32.c
index a901685eb6a..af170c2be73 100644
--- a/arch/m68k/kernel/bios32.c
+++ b/arch/m68k/kernel/bios32.c
@@ -6,7 +6,6 @@
* Based on the DEC Alpha bios32.c by Dave Rusling and David Mosberger.
*/
-#include <linux/config.h>
#include <linux/init.h>
#include <linux/kernel.h>
diff --git a/arch/m68k/kernel/dma.c b/arch/m68k/kernel/dma.c
new file mode 100644
index 00000000000..fc449f8b204
--- /dev/null
+++ b/arch/m68k/kernel/dma.c
@@ -0,0 +1,129 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file COPYING in the main directory of this archive
+ * for more details.
+ */
+
+#undef DEBUG
+
+#include <linux/dma-mapping.h>
+#include <linux/device.h>
+#include <linux/kernel.h>
+#include <linux/vmalloc.h>
+
+#include <asm/pgalloc.h>
+#include <asm/scatterlist.h>
+
+void *dma_alloc_coherent(struct device *dev, size_t size,
+ dma_addr_t *handle, int flag)
+{
+ struct page *page, **map;
+ pgprot_t pgprot;
+ void *addr;
+ int i, order;
+
+ pr_debug("dma_alloc_coherent: %d,%x\n", size, flag);
+
+ size = PAGE_ALIGN(size);
+ order = get_order(size);
+
+ page = alloc_pages(flag, order);
+ if (!page)
+ return NULL;
+
+ *handle = page_to_phys(page);
+ map = kmalloc(sizeof(struct page *) << order, flag & ~__GFP_DMA);
+ if (!map) {
+ __free_pages(page, order);
+ return NULL;
+ }
+ split_page(page, order);
+
+ order = 1 << order;
+ size >>= PAGE_SHIFT;
+ map[0] = page;
+ for (i = 1; i < size; i++)
+ map[i] = page + i;
+ for (; i < order; i++)
+ __free_page(page + i);
+ pgprot = __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_DIRTY);
+ if (CPU_IS_040_OR_060)
+ pgprot_val(pgprot) |= _PAGE_GLOBAL040 | _PAGE_NOCACHE_S;
+ else
+ pgprot_val(pgprot) |= _PAGE_NOCACHE030;
+ addr = vmap(map, size, flag, pgprot);
+ kfree(map);
+
+ return addr;
+}
+EXPORT_SYMBOL(dma_alloc_coherent);
+
+void dma_free_coherent(struct device *dev, size_t size,
+ void *addr, dma_addr_t handle)
+{
+ pr_debug("dma_free_coherent: %p, %x\n", addr, handle);
+ vfree(addr);
+}
+EXPORT_SYMBOL(dma_free_coherent);
+
+inline void dma_sync_single_for_device(struct device *dev, dma_addr_t handle, size_t size,
+ enum dma_data_direction dir)
+{
+ switch (dir) {
+ case DMA_TO_DEVICE:
+ cache_push(handle, size);
+ break;
+ case DMA_FROM_DEVICE:
+ cache_clear(handle, size);
+ break;
+ default:
+ if (printk_ratelimit())
+ printk("dma_sync_single_for_device: unsupported dir %u\n", dir);
+ break;
+ }
+}
+EXPORT_SYMBOL(dma_sync_single_for_device);
+
+void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nents,
+ enum dma_data_direction dir)
+{
+ int i;
+
+ for (i = 0; i < nents; sg++, i++)
+ dma_sync_single_for_device(dev, sg->dma_address, sg->length, dir);
+}
+EXPORT_SYMBOL(dma_sync_sg_for_device);
+
+dma_addr_t dma_map_single(struct device *dev, void *addr, size_t size,
+ enum dma_data_direction dir)
+{
+ dma_addr_t handle = virt_to_bus(addr);
+
+ dma_sync_single_for_device(dev, handle, size, dir);
+ return handle;
+}
+EXPORT_SYMBOL(dma_map_single);
+
+dma_addr_t dma_map_page(struct device *dev, struct page *page,
+ unsigned long offset, size_t size,
+ enum dma_data_direction dir)
+{
+ dma_addr_t handle = page_to_phys(page) + offset;
+
+ dma_sync_single_for_device(dev, handle, size, dir);
+ return handle;
+}
+EXPORT_SYMBOL(dma_map_page);
+
+int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
+ enum dma_data_direction dir)
+{
+ int i;
+
+ for (i = 0; i < nents; sg++, i++) {
+ sg->dma_address = page_to_phys(sg->page) + sg->offset;
+ dma_sync_single_for_device(dev, sg->dma_address, sg->length, dir);
+ }
+ return nents;
+}
+EXPORT_SYMBOL(dma_map_sg);
diff --git a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S
index 320fde05dc6..9083c8b7659 100644
--- a/arch/m68k/kernel/entry.S
+++ b/arch/m68k/kernel/entry.S
@@ -33,7 +33,6 @@
* for 68040
*/
-#include <linux/config.h>
#include <linux/linkage.h>
#include <asm/entry.h>
#include <asm/errno.h>
@@ -45,9 +44,11 @@
#include <asm/asm-offsets.h>
.globl system_call, buserr, trap, resume
-.globl inthandler, sys_call_table
+.globl sys_call_table
.globl sys_fork, sys_clone, sys_vfork
.globl ret_from_interrupt, bad_interrupt
+.globl auto_irqhandler_fixup
+.globl user_irqvec_fixup, user_irqhandler_fixup
.text
ENTRY(buserr)
@@ -191,65 +192,29 @@ do_delayed_trace:
jbra resume_userspace
-#if 0
-#ifdef CONFIG_AMIGA
-ami_inthandler:
- addql #1,irq_stat+CPUSTAT_LOCAL_IRQ_COUNT
- SAVE_ALL_INT
- GET_CURRENT(%d0)
+/* This is the main interrupt handler for autovector interrupts */
- bfextu %sp@(PT_VECTOR){#4,#12},%d0
- movel %d0,%a0
- addql #1,%a0@(kstat+STAT_IRQ-VECOFF(VEC_SPUR))
- movel %a0@(autoirq_list-VECOFF(VEC_SPUR)),%a0
-
-| amiga vector int handler get the req mask instead of irq vector
- lea CUSTOMBASE,%a1
- movew %a1@(C_INTREQR),%d0
- andw %a1@(C_INTENAR),%d0
-
-| prepare stack (push frame pointer, dev_id & req mask)
- pea %sp@
- movel %a0@(IRQ_DEVID),%sp@-
- movel %d0,%sp@-
- pea %pc@(ret_from_interrupt:w)
- jbra @(IRQ_HANDLER,%a0)@(0)
-
-ENTRY(nmi_handler)
- rte
-#endif
-#endif
-
-/*
-** This is the main interrupt handler, responsible for calling process_int()
-*/
-inthandler:
+ENTRY(auto_inthandler)
SAVE_ALL_INT
GET_CURRENT(%d0)
- addqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+2)
+ addqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1)
| put exception # in d0
- bfextu %sp@(PT_VECTOR){#4,#10},%d0
+ bfextu %sp@(PT_VECTOR){#4,#10},%d0
+ subw #VEC_SPUR,%d0
movel %sp,%sp@-
movel %d0,%sp@- | put vector # on stack
-#if defined(MACH_Q40_ONLY) && defined(CONFIG_BLK_DEV_FD)
- btstb #4,0xff000000 | Q40 floppy needs very special treatment ...
- jbeq 1f
- btstb #3,0xff000004
- jbeq 1f
- jbsr floppy_hardint
- jbra 3f
-1:
-#endif
- jbsr process_int | process the IRQ
-3: addql #8,%sp | pop parameters off stack
+auto_irqhandler_fixup = . + 2
+ jsr m68k_handle_int | process the IRQ
+ addql #8,%sp | pop parameters off stack
ret_from_interrupt:
- subqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+2)
- jeq 1f
-2:
- RESTORE_ALL
-1:
+ subqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1)
+ jeq ret_from_last_interrupt
+2: RESTORE_ALL
+
+ ALIGN
+ret_from_last_interrupt:
moveq #(~ALLOWINT>>8)&0xff,%d0
andb %sp@(PT_SR),%d0
jne 2b
@@ -260,12 +225,42 @@ ret_from_interrupt:
pea ret_from_exception
jra do_softirq
+/* Handler for user defined interrupt vectors */
+
+ENTRY(user_inthandler)
+ SAVE_ALL_INT
+ GET_CURRENT(%d0)
+ addqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1)
+ | put exception # in d0
+ bfextu %sp@(PT_VECTOR){#4,#10},%d0
+user_irqvec_fixup = . + 2
+ subw #VEC_USER,%d0
+
+ movel %sp,%sp@-
+ movel %d0,%sp@- | put vector # on stack
+user_irqhandler_fixup = . + 2
+ jsr m68k_handle_int | process the IRQ
+ addql #8,%sp | pop parameters off stack
+
+ subqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1)
+ jeq ret_from_last_interrupt
+ RESTORE_ALL
/* Handler for uninitialized and spurious interrupts */
-bad_interrupt:
- addql #1,num_spurious
- rte
+ENTRY(bad_inthandler)
+ SAVE_ALL_INT
+ GET_CURRENT(%d0)
+ addqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1)
+
+ movel %sp,%sp@-
+ jsr handle_badint
+ addql #4,%sp
+
+ subqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1)
+ jeq ret_from_last_interrupt
+ RESTORE_ALL
+
ENTRY(sys_fork)
SAVE_SWITCH_STACK
diff --git a/arch/m68k/kernel/head.S b/arch/m68k/kernel/head.S
index 70002c146ee..6739e87fe82 100644
--- a/arch/m68k/kernel/head.S
+++ b/arch/m68k/kernel/head.S
@@ -255,7 +255,6 @@
* MAC_USE_SCC_B: Use the SCC port B (printer) for serial debug (default).
*/
-#include <linux/config.h>
#include <linux/linkage.h>
#include <linux/init.h>
#include <asm/bootinfo.h>
diff --git a/arch/m68k/kernel/ints.c b/arch/m68k/kernel/ints.c
index 514d323ad53..b33e37fb7b0 100644
--- a/arch/m68k/kernel/ints.c
+++ b/arch/m68k/kernel/ints.c
@@ -25,7 +25,6 @@
* which must be served /Roman Zippel
*/
-#include <linux/config.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/sched.h>
@@ -39,47 +38,40 @@
#include <asm/traps.h>
#include <asm/page.h>
#include <asm/machdep.h>
+#include <asm/cacheflush.h>
#ifdef CONFIG_Q40
#include <asm/q40ints.h>
#endif
+extern u32 auto_irqhandler_fixup[];
+extern u32 user_irqhandler_fixup[];
+extern u16 user_irqvec_fixup[];
+
/* table for system interrupt handlers */
-static irq_handler_t irq_list[SYS_IRQS];
-
-static const char *default_names[SYS_IRQS] = {
- [0] = "spurious int",
- [1] = "int1 handler",
- [2] = "int2 handler",
- [3] = "int3 handler",
- [4] = "int4 handler",
- [5] = "int5 handler",
- [6] = "int6 handler",
- [7] = "int7 handler"
+static struct irq_node *irq_list[NR_IRQS];
+static struct irq_controller *irq_controller[NR_IRQS];
+static int irq_depth[NR_IRQS];
+
+static int m68k_first_user_vec;
+
+static struct irq_controller auto_irq_controller = {
+ .name = "auto",
+ .lock = SPIN_LOCK_UNLOCKED,
+ .startup = m68k_irq_startup,
+ .shutdown = m68k_irq_shutdown,
};
-/* The number of spurious interrupts */
-volatile unsigned int num_spurious;
+static struct irq_controller user_irq_controller = {
+ .name = "user",
+ .lock = SPIN_LOCK_UNLOCKED,
+ .startup = m68k_irq_startup,
+ .shutdown = m68k_irq_shutdown,
+};
#define NUM_IRQ_NODES 100
static irq_node_t nodes[NUM_IRQ_NODES];
-static void dummy_enable_irq(unsigned int irq);
-static void dummy_disable_irq(unsigned int irq);
-static int dummy_request_irq(unsigned int irq,
- irqreturn_t (*handler) (int, void *, struct pt_regs *),
- unsigned long flags, const char *devname, void *dev_id);
-static void dummy_free_irq(unsigned int irq, void *dev_id);
-
-void (*enable_irq) (unsigned int) = dummy_enable_irq;
-void (*disable_irq) (unsigned int) = dummy_disable_irq;
-
-int (*mach_request_irq) (unsigned int, irqreturn_t (*)(int, void *, struct pt_regs *),
- unsigned long, const char *, void *) = dummy_request_irq;
-void (*mach_free_irq) (unsigned int, void *) = dummy_free_irq;
-
-void init_irq_proc(void);
-
/*
* void init_IRQ(void)
*
@@ -95,18 +87,76 @@ void __init init_IRQ(void)
{
int i;
- for (i = 0; i < SYS_IRQS; i++) {
- if (mach_default_handler)
- irq_list[i].handler = (*mach_default_handler)[i];
- irq_list[i].flags = 0;
- irq_list[i].dev_id = NULL;
- irq_list[i].devname = default_names[i];
+ /* assembly irq entry code relies on this... */
+ if (HARDIRQ_MASK != 0x00ff0000) {
+ extern void hardirq_mask_is_broken(void);
+ hardirq_mask_is_broken();
}
- for (i = 0; i < NUM_IRQ_NODES; i++)
- nodes[i].handler = NULL;
+ for (i = IRQ_AUTO_1; i <= IRQ_AUTO_7; i++)
+ irq_controller[i] = &auto_irq_controller;
+
+ mach_init_IRQ();
+}
+
+/**
+ * m68k_setup_auto_interrupt
+ * @handler: called from auto vector interrupts
+ *
+ * setup the handler to be called from auto vector interrupts instead of the
+ * standard m68k_handle_int(), it will be called with irq numbers in the range
+ * from IRQ_AUTO_1 - IRQ_AUTO_7.
+ */
+void __init m68k_setup_auto_interrupt(void (*handler)(unsigned int, struct pt_regs *))
+{
+ if (handler)
+ *auto_irqhandler_fixup = (u32)handler;
+ flush_icache();
+}
+
+/**
+ * m68k_setup_user_interrupt
+ * @vec: first user vector interrupt to handle
+ * @cnt: number of active user vector interrupts
+ * @handler: called from user vector interrupts
+ *
+ * setup user vector interrupts, this includes activating the specified range
+ * of interrupts, only then these interrupts can be requested (note: this is
+ * different from auto vector interrupts). An optional handler can be installed
+ * to be called instead of the default m68k_handle_int(), it will be called
+ * with irq numbers starting from IRQ_USER.
+ */
+void __init m68k_setup_user_interrupt(unsigned int vec, unsigned int cnt,
+ void (*handler)(unsigned int, struct pt_regs *))
+{
+ int i;
+
+ m68k_first_user_vec = vec;
+ for (i = 0; i < cnt; i++)
+ irq_controller[IRQ_USER + i] = &user_irq_controller;
+ *user_irqvec_fixup = vec - IRQ_USER;
+ if (handler)
+ *user_irqhandler_fixup = (u32)handler;
+ flush_icache();
+}
+
+/**
+ * m68k_setup_irq_controller
+ * @contr: irq controller which controls specified irq
+ * @irq: first irq to be managed by the controller
+ *
+ * Change the controller for the specified range of irq, which will be used to
+ * manage these irq. auto/user irq already have a default controller, which can
+ * be changed as well, but the controller probably should use m68k_irq_startup/
+ * m68k_irq_shutdown.
+ */
+void m68k_setup_irq_controller(struct irq_controller *contr, unsigned int irq,
+ unsigned int cnt)
+{
+ int i;
- mach_init_IRQ ();
+ for (i = 0; i < cnt; i++)
+ irq_controller[irq + i] = contr;
}
irq_node_t *new_irq_node(void)
@@ -114,84 +164,183 @@ irq_node_t *new_irq_node(void)
irq_node_t *node;
short i;
- for (node = nodes, i = NUM_IRQ_NODES-1; i >= 0; node++, i--)
- if (!node->handler)
+ for (node = nodes, i = NUM_IRQ_NODES-1; i >= 0; node++, i--) {
+ if (!node->handler) {
+ memset(node, 0, sizeof(*node));
return node;
+ }
+ }
printk ("new_irq_node: out of nodes\n");
return NULL;
}
-/*
- * We will keep these functions until I have convinced Linus to move
- * the declaration of them from include/linux/sched.h to
- * include/asm/irq.h.
- */
+int setup_irq(unsigned int irq, struct irq_node *node)
+{
+ struct irq_controller *contr;
+ struct irq_node **prev;
+ unsigned long flags;
+
+ if (irq >= NR_IRQS || !(contr = irq_controller[irq])) {
+ printk("%s: Incorrect IRQ %d from %s\n",
+ __FUNCTION__, irq, node->devname);
+ return -ENXIO;
+ }
+
+ spin_lock_irqsave(&contr->lock, flags);
+
+ prev = irq_list + irq;
+ if (*prev) {
+ /* Can't share interrupts unless both agree to */
+ if (!((*prev)->flags & node->flags & IRQF_SHARED)) {
+ spin_unlock_irqrestore(&contr->lock, flags);
+ return -EBUSY;
+ }
+ while (*prev)
+ prev = &(*prev)->next;
+ }
+
+ if (!irq_list[irq]) {
+ if (contr->startup)
+ contr->startup(irq);
+ else
+ contr->enable(irq);
+ }
+ node->next = NULL;
+ *prev = node;
+
+ spin_unlock_irqrestore(&contr->lock, flags);
+
+ return 0;
+}
+
int request_irq(unsigned int irq,
irqreturn_t (*handler) (int, void *, struct pt_regs *),
unsigned long flags, const char *devname, void *dev_id)
{
- return mach_request_irq(irq, handler, flags, devname, dev_id);
+ struct irq_node *node;
+ int res;
+
+ node = new_irq_node();
+ if (!node)
+ return -ENOMEM;
+
+ node->handler = handler;
+ node->flags = flags;
+ node->dev_id = dev_id;
+ node->devname = devname;
+
+ res = setup_irq(irq, node);
+ if (res)
+ node->handler = NULL;
+
+ return res;
}
EXPORT_SYMBOL(request_irq);
void free_irq(unsigned int irq, void *dev_id)
{
- mach_free_irq(irq, dev_id);
+ struct irq_controller *contr;
+ struct irq_node **p, *node;
+ unsigned long flags;
+
+ if (irq >= NR_IRQS || !(contr = irq_controller[irq])) {
+ printk("%s: Incorrect IRQ %d\n", __FUNCTION__, irq);
+ return;
+ }
+
+ spin_lock_irqsave(&contr->lock, flags);
+
+ p = irq_list + irq;
+ while ((node = *p)) {
+ if (node->dev_id == dev_id)
+ break;
+ p = &node->next;
+ }
+
+ if (node) {
+ *p = node->next;
+ node->handler = NULL;
+ } else
+ printk("%s: Removing probably wrong IRQ %d\n",
+ __FUNCTION__, irq);
+
+ if (!irq_list[irq]) {
+ if (contr->shutdown)
+ contr->shutdown(irq);
+ else
+ contr->disable(irq);
+ }
+
+ spin_unlock_irqrestore(&contr->lock, flags);
}
EXPORT_SYMBOL(free_irq);
-int cpu_request_irq(unsigned int irq,
- irqreturn_t (*handler)(int, void *, struct pt_regs *),
- unsigned long flags, const char *devname, void *dev_id)
+void enable_irq(unsigned int irq)
{
- if (irq < IRQ1 || irq > IRQ7) {
- printk("%s: Incorrect IRQ %d from %s\n",
- __FUNCTION__, irq, devname);
- return -ENXIO;
- }
+ struct irq_controller *contr;
+ unsigned long flags;
-#if 0
- if (!(irq_list[irq].flags & IRQ_FLG_STD)) {
- if (irq_list[irq].flags & IRQ_FLG_LOCK) {
- printk("%s: IRQ %d from %s is not replaceable\n",
- __FUNCTION__, irq, irq_list[irq].devname);
- return -EBUSY;
- }
- if (!(flags & IRQ_FLG_REPLACE)) {
- printk("%s: %s can't replace IRQ %d from %s\n",
- __FUNCTION__, devname, irq, irq_list[irq].devname);
- return -EBUSY;
- }
+ if (irq >= NR_IRQS || !(contr = irq_controller[irq])) {
+ printk("%s: Incorrect IRQ %d\n",
+ __FUNCTION__, irq);
+ return;
}
-#endif
- irq_list[irq].handler = handler;
- irq_list[irq].flags = flags;
- irq_list[irq].dev_id = dev_id;
- irq_list[irq].devname = devname;
- return 0;
+ spin_lock_irqsave(&contr->lock, flags);
+ if (irq_depth[irq]) {
+ if (!--irq_depth[irq]) {
+ if (contr->enable)
+ contr->enable(irq);
+ }
+ } else
+ WARN_ON(1);
+ spin_unlock_irqrestore(&contr->lock, flags);
}
-void cpu_free_irq(unsigned int irq, void *dev_id)
+EXPORT_SYMBOL(enable_irq);
+
+void disable_irq(unsigned int irq)
{
- if (irq < IRQ1 || irq > IRQ7) {
- printk("%s: Incorrect IRQ %d\n", __FUNCTION__, irq);
+ struct irq_controller *contr;
+ unsigned long flags;
+
+ if (irq >= NR_IRQS || !(contr = irq_controller[irq])) {
+ printk("%s: Incorrect IRQ %d\n",
+ __FUNCTION__, irq);
return;
}
- if (irq_list[irq].dev_id != dev_id)
- printk("%s: Removing probably wrong IRQ %d from %s\n",
- __FUNCTION__, irq, irq_list[irq].devname);
+ spin_lock_irqsave(&contr->lock, flags);
+ if (!irq_depth[irq]++) {
+ if (contr->disable)
+ contr->disable(irq);
+ }
+ spin_unlock_irqrestore(&contr->lock, flags);
+}
- irq_list[irq].handler = (*mach_default_handler)[irq];
- irq_list[irq].flags = 0;
- irq_list[irq].dev_id = NULL;
- irq_list[irq].devname = default_names[irq];
+EXPORT_SYMBOL(disable_irq);
+
+int m68k_irq_startup(unsigned int irq)
+{
+ if (irq <= IRQ_AUTO_7)
+ vectors[VEC_SPUR + irq] = auto_inthandler;
+ else
+ vectors[m68k_first_user_vec + irq - IRQ_USER] = user_inthandler;
+ return 0;
}
+void m68k_irq_shutdown(unsigned int irq)
+{
+ if (irq <= IRQ_AUTO_7)
+ vectors[VEC_SPUR + irq] = bad_inthandler;
+ else
+ vectors[m68k_first_user_vec + irq - IRQ_USER] = bad_inthandler;
+}
+
+
/*
* Do we need these probe functions on the m68k?
*
@@ -219,58 +368,50 @@ int probe_irq_off (unsigned long irqs)
EXPORT_SYMBOL(probe_irq_off);
-static void dummy_enable_irq(unsigned int irq)
-{
- printk("calling uninitialized enable_irq()\n");
-}
-
-static void dummy_disable_irq(unsigned int irq)
+unsigned int irq_canonicalize(unsigned int irq)
{
- printk("calling uninitialized disable_irq()\n");
+#ifdef CONFIG_Q40
+ if (MACH_IS_Q40 && irq == 11)
+ irq = 10;
+#endif
+ return irq;
}
-static int dummy_request_irq(unsigned int irq,
- irqreturn_t (*handler) (int, void *, struct pt_regs *),
- unsigned long flags, const char *devname, void *dev_id)
-{
- printk("calling uninitialized request_irq()\n");
- return 0;
-}
+EXPORT_SYMBOL(irq_canonicalize);
-static void dummy_free_irq(unsigned int irq, void *dev_id)
+asmlinkage void m68k_handle_int(unsigned int irq, struct pt_regs *regs)
{
- printk("calling uninitialized disable_irq()\n");
+ struct irq_node *node;
+
+ kstat_cpu(0).irqs[irq]++;
+ node = irq_list[irq];
+ do {
+ node->handler(irq, node->dev_id, regs);
+ node = node->next;
+ } while (node);
}
-asmlinkage void process_int(unsigned long vec, struct pt_regs *fp)
+asmlinkage void handle_badint(struct pt_regs *regs)
{
- if (vec >= VEC_INT1 && vec <= VEC_INT7 && !MACH_IS_BVME6000) {
- vec -= VEC_SPUR;
- kstat_cpu(0).irqs[vec]++;
- irq_list[vec].handler(vec, irq_list[vec].dev_id, fp);
- } else {
- if (mach_process_int)
- mach_process_int(vec, fp);
- else
- panic("Can't process interrupt vector %ld\n", vec);
- return;
- }
+ kstat_cpu(0).irqs[0]++;
+ printk("unexpected interrupt from %u\n", regs->vector);
}
int show_interrupts(struct seq_file *p, void *v)
{
+ struct irq_controller *contr;
+ struct irq_node *node;
int i = *(loff_t *) v;
/* autovector interrupts */
- if (i < SYS_IRQS) {
- if (mach_default_handler) {
- seq_printf(p, "auto %2d: %10u ", i,
- i ? kstat_cpu(0).irqs[i] : num_spurious);
- seq_puts(p, " ");
- seq_printf(p, "%s\n", irq_list[i].devname);
- }
- } else if (i == SYS_IRQS)
- mach_get_irq_list(p, v);
+ if (irq_list[i]) {
+ contr = irq_controller[i];
+ node = irq_list[i];
+ seq_printf(p, "%-8s %3u: %10u %s", contr->name, i, kstat_cpu(0).irqs[i], node->devname);
+ while ((node = node->next))
+ seq_printf(p, ", %s", node->devname);
+ seq_puts(p, "\n");
+ }
return 0;
}
diff --git a/arch/m68k/kernel/m68k_ksyms.c b/arch/m68k/kernel/m68k_ksyms.c
index 5b7952ea2ba..aff26a52167 100644
--- a/arch/m68k/kernel/m68k_ksyms.c
+++ b/arch/m68k/kernel/m68k_ksyms.c
@@ -7,7 +7,6 @@
#include <linux/elfcore.h>
#include <linux/in6.h>
#include <linux/interrupt.h>
-#include <linux/config.h>
#include <asm/setup.h>
#include <asm/machdep.h>
@@ -57,8 +56,6 @@ EXPORT_SYMBOL(dump_thread);
EXPORT_SYMBOL(strnlen);
EXPORT_SYMBOL(strrchr);
EXPORT_SYMBOL(strstr);
-EXPORT_SYMBOL(enable_irq);
-EXPORT_SYMBOL(disable_irq);
EXPORT_SYMBOL(kernel_thread);
#ifdef CONFIG_VME
EXPORT_SYMBOL(vme_brdtype);
diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
index 33648efb772..45a46646c1b 100644
--- a/arch/m68k/kernel/process.c
+++ b/arch/m68k/kernel/process.c
@@ -10,7 +10,6 @@
* This file handles the architecture-dependent parts of process handling..
*/
-#include <linux/config.h>
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/sched.h>
diff --git a/arch/m68k/kernel/ptrace.c b/arch/m68k/kernel/ptrace.c
index 540638ca81f..ef89060ea32 100644
--- a/arch/m68k/kernel/ptrace.c
+++ b/arch/m68k/kernel/ptrace.c
@@ -18,7 +18,6 @@
#include <linux/errno.h>
#include <linux/ptrace.h>
#include <linux/user.h>
-#include <linux/config.h>
#include <linux/signal.h>
#include <asm/uaccess.h>
diff --git a/arch/m68k/kernel/semaphore.c b/arch/m68k/kernel/semaphore.c
index 1ebb79baaa8..d12cbbfe6eb 100644
--- a/arch/m68k/kernel/semaphore.c
+++ b/arch/m68k/kernel/semaphore.c
@@ -3,7 +3,6 @@
* specific changes in <asm/semaphore-helper.h>
*/
-#include <linux/config.h>
#include <linux/sched.h>
#include <linux/init.h>
#include <asm/semaphore-helper.h>
diff --git a/arch/m68k/kernel/setup.c b/arch/m68k/kernel/setup.c
index 750d5b3c971..f2d7ee0ee18 100644
--- a/arch/m68k/kernel/setup.c
+++ b/arch/m68k/kernel/setup.c
@@ -8,7 +8,6 @@
* This file handles the architecture-dependent parts of system setup
*/
-#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/sched.h>
@@ -68,11 +67,8 @@ char m68k_debug_device[6] = "";
void (*mach_sched_init) (irqreturn_t (*handler)(int, void *, struct pt_regs *)) __initdata = NULL;
/* machine dependent irq functions */
void (*mach_init_IRQ) (void) __initdata = NULL;
-irqreturn_t (*(*mach_default_handler)[]) (int, void *, struct pt_regs *);
void (*mach_get_model) (char *model);
int (*mach_get_hardware_list) (char *buffer);
-int (*mach_get_irq_list) (struct seq_file *, void *);
-irqreturn_t (*mach_process_int) (int, struct pt_regs *);
/* machine dependent timer functions */
unsigned long (*mach_gettimeoffset) (void);
int (*mach_hwclk) (int, struct rtc_time*);
diff --git a/arch/m68k/kernel/signal.c b/arch/m68k/kernel/signal.c
index 866917bfa02..f9af893cd28 100644
--- a/arch/m68k/kernel/signal.c
+++ b/arch/m68k/kernel/signal.c
@@ -763,7 +763,7 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
/* This is the X/Open sanctioned signal stack switching. */
if (ka->sa.sa_flags & SA_ONSTACK) {
- if (!on_sig_stack(usp))
+ if (!sas_ss_flags(usp))
usp = current->sas_ss_sp + current->sas_ss_size;
}
return (void __user *)((usp - frame_size) & -8UL);
diff --git a/arch/m68k/kernel/traps.c b/arch/m68k/kernel/traps.c
index cdf58fbb3e7..4569406a2e1 100644
--- a/arch/m68k/kernel/traps.c
+++ b/arch/m68k/kernel/traps.c
@@ -18,7 +18,6 @@
* Sets up all exception vectors
*/
-#include <linux/config.h>
#include <linux/sched.h>
#include <linux/signal.h>
#include <linux/kernel.h>
@@ -45,7 +44,6 @@
asmlinkage void system_call(void);
asmlinkage void buserr(void);
asmlinkage void trap(void);
-asmlinkage void inthandler(void);
asmlinkage void nmihandler(void);
#ifdef CONFIG_M68KFPU_EMU
asmlinkage void fpu_emu(void);
@@ -53,51 +51,7 @@ asmlinkage void fpu_emu(void);
e_vector vectors[256] = {
[VEC_BUSERR] = buserr,
- [VEC_ADDRERR] = trap,
- [VEC_ILLEGAL] = trap,
- [VEC_ZERODIV] = trap,
- [VEC_CHK] = trap,
- [VEC_TRAP] = trap,
- [VEC_PRIV] = trap,
- [VEC_TRACE] = trap,
- [VEC_LINE10] = trap,
- [VEC_LINE11] = trap,
- [VEC_RESV12] = trap,
- [VEC_COPROC] = trap,
- [VEC_FORMAT] = trap,
- [VEC_UNINT] = trap,
- [VEC_RESV16] = trap,
- [VEC_RESV17] = trap,
- [VEC_RESV18] = trap,
- [VEC_RESV19] = trap,
- [VEC_RESV20] = trap,
- [VEC_RESV21] = trap,
- [VEC_RESV22] = trap,
- [VEC_RESV23] = trap,
- [VEC_SPUR] = inthandler,
- [VEC_INT1] = inthandler,
- [VEC_INT2] = inthandler,
- [VEC_INT3] = inthandler,
- [VEC_INT4] = inthandler,
- [VEC_INT5] = inthandler,
- [VEC_INT6] = inthandler,
- [VEC_INT7] = inthandler,
[VEC_SYS] = system_call,
- [VEC_TRAP1] = trap,
- [VEC_TRAP2] = trap,
- [VEC_TRAP3] = trap,
- [VEC_TRAP4] = trap,
- [VEC_TRAP5] = trap,
- [VEC_TRAP6] = trap,
- [VEC_TRAP7] = trap,
- [VEC_TRAP8] = trap,
- [VEC_TRAP9] = trap,
- [VEC_TRAP10] = trap,
- [VEC_TRAP11] = trap,
- [VEC_TRAP12] = trap,
- [VEC_TRAP13] = trap,
- [VEC_TRAP14] = trap,
- [VEC_TRAP15] = trap,
};
/* nmi handler for the Amiga */
@@ -114,7 +68,7 @@ void __init base_trap_init(void)
if(MACH_IS_SUN3X) {
extern e_vector *sun3x_prom_vbr;
- __asm__ volatile ("movec %%vbr, %0" : "=r" ((void*)sun3x_prom_vbr));
+ __asm__ volatile ("movec %%vbr, %0" : "=r" (sun3x_prom_vbr));
}
/* setup the exception vector table */
@@ -132,12 +86,15 @@ void __init trap_init (void)
{
int i;
- for (i = 48; i < 64; i++)
+ for (i = VEC_SPUR; i <= VEC_INT7; i++)
+ vectors[i] = bad_inthandler;
+
+ for (i = 0; i < VEC_USER; i++)
if (!vectors[i])
vectors[i] = trap;
- for (i = 64; i < 256; i++)
- vectors[i] = inthandler;
+ for (i = VEC_USER; i < 256; i++)
+ vectors[i] = bad_inthandler;
#ifdef CONFIG_M68KFPU_EMU
if (FPU_IS_EMU)
@@ -927,71 +884,94 @@ void show_trace(unsigned long *stack)
void show_registers(struct pt_regs *regs)
{
struct frame *fp = (struct frame *)regs;
+ mm_segment_t old_fs = get_fs();
+ u16 c, *cp;
unsigned long addr;
int i;
+ print_modules();
+ printk("PC: [<%08lx>]",regs->pc);
+ print_symbol(" %s", regs->pc);
+ printk("\nSR: %04x SP: %p a2: %08lx\n",
+ regs->sr, regs, regs->a2);
+ printk("d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n",
+ regs->d0, regs->d1, regs->d2, regs->d3);
+ printk("d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",
+ regs->d4, regs->d5, regs->a0, regs->a1);
+
+ printk("Process %s (pid: %d, task=%p)\n",
+ current->comm, current->pid, current);
addr = (unsigned long)&fp->un;
- printk("Frame format=%X ", fp->ptregs.format);
- switch (fp->ptregs.format) {
+ printk("Frame format=%X ", regs->format);
+ switch (regs->format) {
case 0x2:
- printk("instr addr=%08lx\n", fp->un.fmt2.iaddr);
- addr += sizeof(fp->un.fmt2);
- break;
+ printk("instr addr=%08lx\n", fp->un.fmt2.iaddr);
+ addr += sizeof(fp->un.fmt2);
+ break;
case 0x3:
- printk("eff addr=%08lx\n", fp->un.fmt3.effaddr);
- addr += sizeof(fp->un.fmt3);
- break;
+ printk("eff addr=%08lx\n", fp->un.fmt3.effaddr);
+ addr += sizeof(fp->un.fmt3);
+ break;
case 0x4:
- printk((CPU_IS_060 ? "fault addr=%08lx fslw=%08lx\n"
- : "eff addr=%08lx pc=%08lx\n"),
- fp->un.fmt4.effaddr, fp->un.fmt4.pc);
- addr += sizeof(fp->un.fmt4);
- break;
+ printk((CPU_IS_060 ? "fault addr=%08lx fslw=%08lx\n"
+ : "eff addr=%08lx pc=%08lx\n"),
+ fp->un.fmt4.effaddr, fp->un.fmt4.pc);
+ addr += sizeof(fp->un.fmt4);
+ break;
case 0x7:
- printk("eff addr=%08lx ssw=%04x faddr=%08lx\n",
- fp->un.fmt7.effaddr, fp->un.fmt7.ssw, fp->un.fmt7.faddr);
- printk("wb 1 stat/addr/data: %04x %08lx %08lx\n",
- fp->un.fmt7.wb1s, fp->un.fmt7.wb1a, fp->un.fmt7.wb1dpd0);
- printk("wb 2 stat/addr/data: %04x %08lx %08lx\n",
- fp->un.fmt7.wb2s, fp->un.fmt7.wb2a, fp->un.fmt7.wb2d);
- printk("wb 3 stat/addr/data: %04x %08lx %08lx\n",
- fp->un.fmt7.wb3s, fp->un.fmt7.wb3a, fp->un.fmt7.wb3d);
- printk("push data: %08lx %08lx %08lx %08lx\n",
- fp->un.fmt7.wb1dpd0, fp->un.fmt7.pd1, fp->un.fmt7.pd2,
- fp->un.fmt7.pd3);
- addr += sizeof(fp->un.fmt7);
- break;
+ printk("eff addr=%08lx ssw=%04x faddr=%08lx\n",
+ fp->un.fmt7.effaddr, fp->un.fmt7.ssw, fp->un.fmt7.faddr);
+ printk("wb 1 stat/addr/data: %04x %08lx %08lx\n",
+ fp->un.fmt7.wb1s, fp->un.fmt7.wb1a, fp->un.fmt7.wb1dpd0);
+ printk("wb 2 stat/addr/data: %04x %08lx %08lx\n",
+ fp->un.fmt7.wb2s, fp->un.fmt7.wb2a, fp->un.fmt7.wb2d);
+ printk("wb 3 stat/addr/data: %04x %08lx %08lx\n",
+ fp->un.fmt7.wb3s, fp->un.fmt7.wb3a, fp->un.fmt7.wb3d);
+ printk("push data: %08lx %08lx %08lx %08lx\n",
+ fp->un.fmt7.wb1dpd0, fp->un.fmt7.pd1, fp->un.fmt7.pd2,
+ fp->un.fmt7.pd3);
+ addr += sizeof(fp->un.fmt7);
+ break;
case 0x9:
- printk("instr addr=%08lx\n", fp->un.fmt9.iaddr);
- addr += sizeof(fp->un.fmt9);
- break;
+ printk("instr addr=%08lx\n", fp->un.fmt9.iaddr);
+ addr += sizeof(fp->un.fmt9);
+ break;
case 0xa:
- printk("ssw=%04x isc=%04x isb=%04x daddr=%08lx dobuf=%08lx\n",
- fp->un.fmta.ssw, fp->un.fmta.isc, fp->un.fmta.isb,
- fp->un.fmta.daddr, fp->un.fmta.dobuf);
- addr += sizeof(fp->un.fmta);
- break;
+ printk("ssw=%04x isc=%04x isb=%04x daddr=%08lx dobuf=%08lx\n",
+ fp->un.fmta.ssw, fp->un.fmta.isc, fp->un.fmta.isb,
+ fp->un.fmta.daddr, fp->un.fmta.dobuf);
+ addr += sizeof(fp->un.fmta);
+ break;
case 0xb:
- printk("ssw=%04x isc=%04x isb=%04x daddr=%08lx dobuf=%08lx\n",
- fp->un.fmtb.ssw, fp->un.fmtb.isc, fp->un.fmtb.isb,
- fp->un.fmtb.daddr, fp->un.fmtb.dobuf);
- printk("baddr=%08lx dibuf=%08lx ver=%x\n",
- fp->un.fmtb.baddr, fp->un.fmtb.dibuf, fp->un.fmtb.ver);
- addr += sizeof(fp->un.fmtb);
- break;
+ printk("ssw=%04x isc=%04x isb=%04x daddr=%08lx dobuf=%08lx\n",
+ fp->un.fmtb.ssw, fp->un.fmtb.isc, fp->un.fmtb.isb,
+ fp->un.fmtb.daddr, fp->un.fmtb.dobuf);
+ printk("baddr=%08lx dibuf=%08lx ver=%x\n",
+ fp->un.fmtb.baddr, fp->un.fmtb.dibuf, fp->un.fmtb.ver);
+ addr += sizeof(fp->un.fmtb);
+ break;
default:
- printk("\n");
+ printk("\n");
}
show_stack(NULL, (unsigned long *)addr);
- printk("Code: ");
- for (i = 0; i < 10; i++)
- printk("%04x ", 0xffff & ((short *) fp->ptregs.pc)[i]);
+ printk("Code:");
+ set_fs(KERNEL_DS);
+ cp = (u16 *)regs->pc;
+ for (i = -8; i < 16; i++) {
+ if (get_user(c, cp + i) && i >= 0) {
+ printk(" Bad PC value.");
+ break;
+ }
+ printk(i ? " %04x" : " <%04x>", c);
+ }
+ set_fs(old_fs);
printk ("\n");
}
void show_stack(struct task_struct *task, unsigned long *stack)
{
+ unsigned long *p;
unsigned long *endstack;
int i;
@@ -1004,12 +984,13 @@ void show_stack(struct task_struct *task, unsigned long *stack)
endstack = (unsigned long *)(((unsigned long)stack + THREAD_SIZE - 1) & -THREAD_SIZE);
printk("Stack from %08lx:", (unsigned long)stack);
+ p = stack;
for (i = 0; i < kstack_depth_to_print; i++) {
- if (stack + 1 > endstack)
+ if (p + 1 > endstack)
break;
if (i % 8 == 0)
printk("\n ");
- printk(" %08lx", *stack++);
+ printk(" %08lx", *p++);
}
printk("\n");
show_trace(stack);
@@ -1188,19 +1169,7 @@ void die_if_kernel (char *str, struct pt_regs *fp, int nr)
console_verbose();
printk("%s: %08x\n",str,nr);
- print_modules();
- printk("PC: [<%08lx>]",fp->pc);
- print_symbol(" %s\n", fp->pc);
- printk("\nSR: %04x SP: %p a2: %08lx\n",
- fp->sr, fp, fp->a2);
- printk("d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n",
- fp->d0, fp->d1, fp->d2, fp->d3);
- printk("d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",
- fp->d4, fp->d5, fp->a0, fp->a1);
-
- printk("Process %s (pid: %d, stackpage=%08lx)\n",
- current->comm, current->pid, PAGE_SIZE+(unsigned long)current);
- show_stack(NULL, (unsigned long *)fp);
+ show_registers(fp);
do_exit(SIGSEGV);
}
diff --git a/arch/m68k/kernel/vmlinux.lds.S b/arch/m68k/kernel/vmlinux.lds.S
index 497b924f3c8..99ba315bd0a 100644
--- a/arch/m68k/kernel/vmlinux.lds.S
+++ b/arch/m68k/kernel/vmlinux.lds.S
@@ -1,4 +1,3 @@
-#include <linux/config.h>
PHDRS
{
text PT_LOAD FILEHDR PHDRS FLAGS (7);
diff --git a/arch/m68k/lib/Makefile b/arch/m68k/lib/Makefile
index ebe51a51381..6bbf19f9600 100644
--- a/arch/m68k/lib/Makefile
+++ b/arch/m68k/lib/Makefile
@@ -4,5 +4,5 @@
EXTRA_AFLAGS := -traditional
-lib-y := ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \
- checksum.o string.o semaphore.o
+lib-y := ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \
+ checksum.o string.o semaphore.o uaccess.o
diff --git a/arch/m68k/lib/uaccess.c b/arch/m68k/lib/uaccess.c
new file mode 100644
index 00000000000..1bc188c0d98
--- /dev/null
+++ b/arch/m68k/lib/uaccess.c
@@ -0,0 +1,222 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file COPYING in the main directory of this archive
+ * for more details.
+ */
+
+#include <linux/module.h>
+#include <asm/uaccess.h>
+
+unsigned long __generic_copy_from_user(void *to, const void __user *from,
+ unsigned long n)
+{
+ unsigned long tmp, res;
+
+ asm volatile ("\n"
+ " tst.l %0\n"
+ " jeq 2f\n"
+ "1: moves.l (%1)+,%3\n"
+ " move.l %3,(%2)+\n"
+ " subq.l #1,%0\n"
+ " jne 1b\n"
+ "2: btst #1,%5\n"
+ " jeq 4f\n"
+ "3: moves.w (%1)+,%3\n"
+ " move.w %3,(%2)+\n"
+ "4: btst #0,%5\n"
+ " jeq 6f\n"
+ "5: moves.b (%1)+,%3\n"
+ " move.b %3,(%2)+\n"
+ "6:\n"
+ " .section .fixup,\"ax\"\n"
+ " .even\n"
+ "10: move.l %0,%3\n"
+ "7: clr.l (%2)+\n"
+ " subq.l #1,%3\n"
+ " jne 7b\n"
+ " lsl.l #2,%0\n"
+ " btst #1,%5\n"
+ " jeq 8f\n"
+ "30: clr.w (%2)+\n"
+ " addq.l #2,%0\n"
+ "8: btst #0,%5\n"
+ " jeq 6b\n"
+ "50: clr.b (%2)+\n"
+ " addq.l #1,%0\n"
+ " jra 6b\n"
+ " .previous\n"
+ "\n"
+ " .section __ex_table,\"a\"\n"
+ " .align 4\n"
+ " .long 1b,10b\n"
+ " .long 3b,30b\n"
+ " .long 5b,50b\n"
+ " .previous"
+ : "=d" (res), "+a" (from), "+a" (to), "=&r" (tmp)
+ : "0" (n / 4), "d" (n & 3));
+
+ return res;
+}
+EXPORT_SYMBOL(__generic_copy_from_user);
+
+unsigned long __generic_copy_to_user(void __user *to, const void *from,
+ unsigned long n)
+{
+ unsigned long tmp, res;
+
+ asm volatile ("\n"
+ " tst.l %0\n"
+ " jeq 4f\n"
+ "1: move.l (%1)+,%3\n"
+ "2: moves.l %3,(%2)+\n"
+ "3: subq.l #1,%0\n"
+ " jne 1b\n"
+ "4: btst #1,%5\n"
+ " jeq 6f\n"
+ " move.w (%1)+,%3\n"
+ "5: moves.w %3,(%2)+\n"
+ "6: btst #0,%5\n"
+ " jeq 8f\n"
+ " move.b (%1)+,%3\n"
+ "7: moves.b %3,(%2)+\n"
+ "8:\n"
+ " .section .fixup,\"ax\"\n"
+ " .even\n"
+ "20: lsl.l #2,%0\n"
+ "50: add.l %5,%0\n"
+ " jra 7b\n"
+ " .previous\n"
+ "\n"
+ " .section __ex_table,\"a\"\n"
+ " .align 4\n"
+ " .long 2b,20b\n"
+ " .long 3b,20b\n"
+ " .long 5b,50b\n"
+ " .long 6b,50b\n"
+ " .long 7b,50b\n"
+ " .long 8b,50b\n"
+ " .previous"
+ : "=d" (res), "+a" (from), "+a" (to), "=&r" (tmp)
+ : "0" (n / 4), "d" (n & 3));
+
+ return res;
+}
+EXPORT_SYMBOL(__generic_copy_to_user);
+
+/*
+ * Copy a null terminated string from userspace.
+ */
+long strncpy_from_user(char *dst, const char __user *src, long count)
+{
+ long res;
+ char c;
+
+ if (count <= 0)
+ return count;
+
+ asm volatile ("\n"
+ "1: moves.b (%2)+,%4\n"
+ " move.b %4,(%1)+\n"
+ " jeq 2f\n"
+ " subq.l #1,%3\n"
+ " jne 1b\n"
+ "2: sub.l %3,%0\n"
+ "3:\n"
+ " .section .fixup,\"ax\"\n"
+ " .even\n"
+ "10: move.l %5,%0\n"
+ " jra 3b\n"
+ " .previous\n"
+ "\n"
+ " .section __ex_table,\"a\"\n"
+ " .align 4\n"
+ " .long 1b,10b\n"
+ " .previous"
+ : "=d" (res), "+a" (dst), "+a" (src), "+r" (count), "=&d" (c)
+ : "i" (-EFAULT), "0" (count));
+
+ return res;
+}
+EXPORT_SYMBOL(strncpy_from_user);
+
+/*
+ * Return the size of a string (including the ending 0)
+ *
+ * Return 0 on exception, a value greater than N if too long
+ */
+long strnlen_user(const char __user *src, long n)
+{
+ char c;
+ long res;
+
+ asm volatile ("\n"
+ "1: subq.l #1,%1\n"
+ " jmi 3f\n"
+ "2: moves.b (%0)+,%2\n"
+ " tst.b %2\n"
+ " jne 1b\n"
+ " jra 4f\n"
+ "\n"
+ "3: addq.l #1,%0\n"
+ "4: sub.l %4,%0\n"
+ "5:\n"
+ " .section .fixup,\"ax\"\n"
+ " .even\n"
+ "20: sub.l %0,%0\n"
+ " jra 5b\n"
+ " .previous\n"
+ "\n"
+ " .section __ex_table,\"a\"\n"
+ " .align 4\n"
+ " .long 2b,20b\n"
+ " .previous\n"
+ : "=&a" (res), "+d" (n), "=&d" (c)
+ : "0" (src), "r" (src));
+
+ return res;
+}
+EXPORT_SYMBOL(strnlen_user);
+
+/*
+ * Zero Userspace
+ */
+
+unsigned long clear_user(void __user *to, unsigned long n)
+{
+ unsigned long res;
+
+ asm volatile ("\n"
+ " tst.l %0\n"
+ " jeq 3f\n"
+ "1: moves.l %2,(%1)+\n"
+ "2: subq.l #1,%0\n"
+ " jne 1b\n"
+ "3: btst #1,%4\n"
+ " jeq 5f\n"
+ "4: moves.w %2,(%1)+\n"
+ "5: btst #0,%4\n"
+ " jeq 7f\n"
+ "6: moves.b %2,(%1)\n"
+ "7:\n"
+ " .section .fixup,\"ax\"\n"
+ " .even\n"
+ "10: lsl.l #2,%0\n"
+ "40: add.l %4,%0\n"
+ " jra 7b\n"
+ " .previous\n"
+ "\n"
+ " .section __ex_table,\"a\"\n"
+ " .align 4\n"
+ " .long 1b,10b\n"
+ " .long 2b,10b\n"
+ " .long 4b,40b\n"
+ " .long 5b,40b\n"
+ " .long 6b,40b\n"
+ " .long 7b,40b\n"
+ " .previous"
+ : "=d" (res), "+a" (to)
+ : "r" (0), "0" (n / 4), "d" (n & 3));
+
+ return res;
+}
+EXPORT_SYMBOL(clear_user);
diff --git a/arch/m68k/mac/baboon.c b/arch/m68k/mac/baboon.c
index b19b7dd9bd2..6eaa881793d 100644
--- a/arch/m68k/mac/baboon.c
+++ b/arch/m68k/mac/baboon.c
@@ -81,7 +81,7 @@ irqreturn_t baboon_irq(int irq, void *dev_id, struct pt_regs *regs)
for (i = 0, irq_bit = 1 ; i < 3 ; i++, irq_bit <<= 1) {
if (events & irq_bit/* & baboon_active*/) {
baboon_active &= ~irq_bit;
- mac_do_irq_list(IRQ_BABOON_0 + i, regs);
+ m68k_handle_int(IRQ_BABOON_0 + i, regs);
baboon_active |= irq_bit;
baboon->mb_ifr &= ~irq_bit;
}
diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c
index 14f8d3f4e19..85dda1095b1 100644
--- a/arch/m68k/mac/config.c
+++ b/arch/m68k/mac/config.c
@@ -10,7 +10,6 @@
* Miscellaneous linux stuff
*/
-#include <linux/config.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/mm.h>
@@ -89,38 +88,11 @@ extern void mac_debugging_long(int, long);
static void mac_get_model(char *str);
-void mac_bang(int irq, void *vector, struct pt_regs *p)
-{
- printk(KERN_INFO "Resetting ...\n");
- mac_reset();
-}
-
static void mac_sched_init(irqreturn_t (*vector)(int, void *, struct pt_regs *))
{
via_init_clock(vector);
}
-#if 0
-void mac_waitbut (void)
-{
- ;
-}
-#endif
-
-extern irqreturn_t mac_default_handler(int, void *, struct pt_regs *);
-
-irqreturn_t (*mac_handlers[8])(int, void *, struct pt_regs *)=
-{
- mac_default_handler,
- mac_default_handler,
- mac_default_handler,
- mac_default_handler,
- mac_default_handler,
- mac_default_handler,
- mac_default_handler,
- mac_default_handler
-};
-
/*
* Parse a Macintosh-specific record in the bootinfo
*/
@@ -196,13 +168,7 @@ void __init config_mac(void)
mach_sched_init = mac_sched_init;
mach_init_IRQ = mac_init_IRQ;
- mach_request_irq = mac_request_irq;
- mach_free_irq = mac_free_irq;
- enable_irq = mac_enable_irq;
- disable_irq = mac_disable_irq;
mach_get_model = mac_get_model;
- mach_default_handler = &mac_handlers;
- mach_get_irq_list = show_mac_interrupts;
mach_gettimeoffset = mac_gettimeoffset;
#warning move to adb/via init
#if 0
diff --git a/arch/m68k/mac/debug.c b/arch/m68k/mac/debug.c
index cc62ed61cda..4eeb09dc0e8 100644
--- a/arch/m68k/mac/debug.c
+++ b/arch/m68k/mac/debug.c
@@ -14,7 +14,6 @@
* for more details.
*/
-#include <linux/config.h>
#include <linux/types.h>
#include <linux/sched.h>
#include <linux/tty.h>
diff --git a/arch/m68k/mac/iop.c b/arch/m68k/mac/iop.c
index 9179a379840..bc657b1057a 100644
--- a/arch/m68k/mac/iop.c
+++ b/arch/m68k/mac/iop.c
@@ -104,7 +104,6 @@
* should execute quickly.)
*/
-#include <linux/config.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/mm.h>
@@ -317,7 +316,7 @@ void __init iop_register_interrupts(void)
{
if (iop_ism_present) {
if (oss_present) {
- cpu_request_irq(OSS_IRQLEV_IOPISM, iop_ism_irq,
+ request_irq(OSS_IRQLEV_IOPISM, iop_ism_irq,
IRQ_FLG_LOCK, "ISM IOP",
(void *) IOP_NUM_ISM);
oss_irq_enable(IRQ_MAC_ADB);
diff --git a/arch/m68k/mac/macints.c b/arch/m68k/mac/macints.c
index 1809601ad90..694b14bb0de 100644
--- a/arch/m68k/mac/macints.c
+++ b/arch/m68k/mac/macints.c
@@ -137,14 +137,6 @@
#define DEBUG_SPURIOUS
#define SHUTUP_SONIC
-/*
- * The mac_irq_list array is an array of linked lists of irq_node_t nodes.
- * Each node contains one handler to be called whenever the interrupt
- * occurs, with fast handlers listed before slow handlers.
- */
-
-irq_node_t *mac_irq_list[NUM_MAC_SOURCES];
-
/* SCC interrupt mask */
static int scc_mask;
@@ -209,34 +201,37 @@ extern int baboon_irq_pending(int);
* SCC interrupt routines
*/
-static void scc_irq_enable(int);
-static void scc_irq_disable(int);
+static void scc_irq_enable(unsigned int);
+static void scc_irq_disable(unsigned int);
/*
* console_loglevel determines NMI handler function
*/
-extern irqreturn_t mac_bang(int, void *, struct pt_regs *);
irqreturn_t mac_nmi_handler(int, void *, struct pt_regs *);
irqreturn_t mac_debug_handler(int, void *, struct pt_regs *);
/* #define DEBUG_MACINTS */
+static void mac_enable_irq(unsigned int irq);
+static void mac_disable_irq(unsigned int irq);
+
+static struct irq_controller mac_irq_controller = {
+ .name = "mac",
+ .lock = SPIN_LOCK_UNLOCKED,
+ .enable = mac_enable_irq,
+ .disable = mac_disable_irq,
+};
+
void mac_init_IRQ(void)
{
- int i;
-
#ifdef DEBUG_MACINTS
printk("mac_init_IRQ(): Setting things up...\n");
#endif
- /* Initialize the IRQ handler lists. Initially each list is empty, */
-
- for (i = 0; i < NUM_MAC_SOURCES; i++) {
- mac_irq_list[i] = NULL;
- }
-
scc_mask = 0;
+ m68k_setup_irq_controller(&mac_irq_controller, IRQ_USER,
+ NUM_MAC_SOURCES - IRQ_USER);
/* Make sure the SONIC interrupt is cleared or things get ugly */
#ifdef SHUTUP_SONIC
printk("Killing onboard sonic... ");
@@ -253,15 +248,16 @@ void mac_init_IRQ(void)
* at levels 1-7. Most of the work is done elsewhere.
*/
- if (oss_present) {
+ if (oss_present)
oss_register_interrupts();
- } else {
+ else
via_register_interrupts();
- }
- if (psc_present) psc_register_interrupts();
- if (baboon_present) baboon_register_interrupts();
+ if (psc_present)
+ psc_register_interrupts();
+ if (baboon_present)
+ baboon_register_interrupts();
iop_register_interrupts();
- cpu_request_irq(7, mac_nmi_handler, IRQ_FLG_LOCK, "NMI",
+ request_irq(IRQ_AUTO_7, mac_nmi_handler, 0, "NMI",
mac_nmi_handler);
#ifdef DEBUG_MACINTS
printk("mac_init_IRQ(): Done!\n");
@@ -269,104 +265,6 @@ void mac_init_IRQ(void)
}
/*
- * Routines to work with irq_node_t's on linked lists lifted from
- * the Amiga code written by Roman Zippel.
- */
-
-static inline void mac_insert_irq(irq_node_t **list, irq_node_t *node)
-{
- unsigned long flags;
- irq_node_t *cur;
-
- if (!node->dev_id)
- printk("%s: Warning: dev_id of %s is zero\n",
- __FUNCTION__, node->devname);
-
- local_irq_save(flags);
-
- cur = *list;
-
- if (node->flags & IRQ_FLG_FAST) {
- node->flags &= ~IRQ_FLG_SLOW;
- while (cur && cur->flags & IRQ_FLG_FAST) {
- list = &cur->next;
- cur = cur->next;
- }
- } else if (node->flags & IRQ_FLG_SLOW) {
- while (cur) {
- list = &cur->next;
- cur = cur->next;
- }
- } else {
- while (cur && !(cur->flags & IRQ_FLG_SLOW)) {
- list = &cur->next;
- cur = cur->next;
- }
- }
-
- node->next = cur;
- *list = node;
-
- local_irq_restore(flags);
-}
-
-static inline void mac_delete_irq(irq_node_t **list, void *dev_id)
-{
- unsigned long flags;
- irq_node_t *node;
-
- local_irq_save(flags);
-
- for (node = *list; node; list = &node->next, node = *list) {
- if (node->dev_id == dev_id) {
- *list = node->next;
- /* Mark it as free. */
- node->handler = NULL;
- local_irq_restore(flags);
- return;
- }
- }
- local_irq_restore(flags);
- printk ("%s: tried to remove invalid irq\n", __FUNCTION__);
-}
-
-/*
- * Call all the handlers for a given interrupt. Fast handlers are called
- * first followed by slow handlers.
- *
- * This code taken from the original Amiga code written by Roman Zippel.
- */
-
-void mac_do_irq_list(int irq, struct pt_regs *fp)
-{
- irq_node_t *node, *slow_nodes;
- unsigned long flags;
-
- kstat_cpu(0).irqs[irq]++;
-
-#ifdef DEBUG_SPURIOUS
- if (!mac_irq_list[irq] && (console_loglevel > 7)) {
- printk("mac_do_irq_list: spurious interrupt %d!\n", irq);
- return;
- }
-#endif
-
- /* serve first fast and normal handlers */
- for (node = mac_irq_list[irq];
- node && (!(node->flags & IRQ_FLG_SLOW));
- node = node->next)
- node->handler(irq, node->dev_id, fp);
- if (!node) return;
- local_save_flags(flags);
- local_irq_restore((flags & ~0x0700) | (fp->sr & 0x0700));
- /* if slow handlers exists, serve them now */
- slow_nodes = node;
- for (; node; node = node->next) {
- node->handler(irq, node->dev_id, fp);
- }
-}
-
-/*
* mac_enable_irq - enable an interrupt source
* mac_disable_irq - disable an interrupt source
* mac_clear_irq - clears a pending interrupt
@@ -375,276 +273,124 @@ void mac_do_irq_list(int irq, struct pt_regs *fp)
* These routines are just dispatchers to the VIA/OSS/PSC routines.
*/
-void mac_enable_irq (unsigned int irq)
+static void mac_enable_irq(unsigned int irq)
{
- int irq_src = IRQ_SRC(irq);
+ int irq_src = IRQ_SRC(irq);
switch(irq_src) {
- case 1: via_irq_enable(irq);
- break;
- case 2:
- case 7: if (oss_present) {
- oss_irq_enable(irq);
- } else {
- via_irq_enable(irq);
- }
- break;
- case 3:
- case 4:
- case 5:
- case 6: if (psc_present) {
- psc_irq_enable(irq);
- } else if (oss_present) {
- oss_irq_enable(irq);
- } else if (irq_src == 4) {
- scc_irq_enable(irq);
- }
- break;
- case 8: if (baboon_present) {
- baboon_irq_enable(irq);
- }
- break;
+ case 1:
+ via_irq_enable(irq);
+ break;
+ case 2:
+ case 7:
+ if (oss_present)
+ oss_irq_enable(irq);
+ else
+ via_irq_enable(irq);
+ break;
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ if (psc_present)
+ psc_irq_enable(irq);
+ else if (oss_present)
+ oss_irq_enable(irq);
+ else if (irq_src == 4)
+ scc_irq_enable(irq);
+ break;
+ case 8:
+ if (baboon_present)
+ baboon_irq_enable(irq);
+ break;
}
}
-void mac_disable_irq (unsigned int irq)
+static void mac_disable_irq(unsigned int irq)
{
- int irq_src = IRQ_SRC(irq);
+ int irq_src = IRQ_SRC(irq);
switch(irq_src) {
- case 1: via_irq_disable(irq);
- break;
- case 2:
- case 7: if (oss_present) {
- oss_irq_disable(irq);
- } else {
- via_irq_disable(irq);
- }
- break;
- case 3:
- case 4:
- case 5:
- case 6: if (psc_present) {
- psc_irq_disable(irq);
- } else if (oss_present) {
- oss_irq_disable(irq);
- } else if (irq_src == 4) {
- scc_irq_disable(irq);
- }
- break;
- case 8: if (baboon_present) {
- baboon_irq_disable(irq);
- }
- break;
+ case 1:
+ via_irq_disable(irq);
+ break;
+ case 2:
+ case 7:
+ if (oss_present)
+ oss_irq_disable(irq);
+ else
+ via_irq_disable(irq);
+ break;
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ if (psc_present)
+ psc_irq_disable(irq);
+ else if (oss_present)
+ oss_irq_disable(irq);
+ else if (irq_src == 4)
+ scc_irq_disable(irq);
+ break;
+ case 8:
+ if (baboon_present)
+ baboon_irq_disable(irq);
+ break;
}
}
-void mac_clear_irq( unsigned int irq )
+void mac_clear_irq(unsigned int irq)
{
switch(IRQ_SRC(irq)) {
- case 1: via_irq_clear(irq);
- break;
- case 2:
- case 7: if (oss_present) {
- oss_irq_clear(irq);
- } else {
- via_irq_clear(irq);
- }
- break;
- case 3:
- case 4:
- case 5:
- case 6: if (psc_present) {
- psc_irq_clear(irq);
- } else if (oss_present) {
- oss_irq_clear(irq);
- }
- break;
- case 8: if (baboon_present) {
- baboon_irq_clear(irq);
- }
- break;
+ case 1:
+ via_irq_clear(irq);
+ break;
+ case 2:
+ case 7:
+ if (oss_present)
+ oss_irq_clear(irq);
+ else
+ via_irq_clear(irq);
+ break;
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ if (psc_present)
+ psc_irq_clear(irq);
+ else if (oss_present)
+ oss_irq_clear(irq);
+ break;
+ case 8:
+ if (baboon_present)
+ baboon_irq_clear(irq);
+ break;
}
}
-int mac_irq_pending( unsigned int irq )
+int mac_irq_pending(unsigned int irq)
{
switch(IRQ_SRC(irq)) {
- case 1: return via_irq_pending(irq);
- case 2:
- case 7: if (oss_present) {
- return oss_irq_pending(irq);
- } else {
- return via_irq_pending(irq);
- }
- case 3:
- case 4:
- case 5:
- case 6: if (psc_present) {
- return psc_irq_pending(irq);
- } else if (oss_present) {
- return oss_irq_pending(irq);
- }
- }
- return 0;
-}
-
-/*
- * Add an interrupt service routine to an interrupt source.
- * Returns 0 on success.
- *
- * FIXME: You can register interrupts on nonexistent source (ie PSC4 on a
- * non-PSC machine). We should return -EINVAL in those cases.
- */
-
-int mac_request_irq(unsigned int irq,
- irqreturn_t (*handler)(int, void *, struct pt_regs *),
- unsigned long flags, const char *devname, void *dev_id)
-{
- irq_node_t *node;
-
-#ifdef DEBUG_MACINTS
- printk ("%s: irq %d requested for %s\n", __FUNCTION__, irq, devname);
-#endif
-
- if (irq < VIA1_SOURCE_BASE) {
- return cpu_request_irq(irq, handler, flags, devname, dev_id);
+ case 1:
+ return via_irq_pending(irq);
+ case 2:
+ case 7:
+ if (oss_present)
+ return oss_irq_pending(irq);
+ else
+ return via_irq_pending(irq);
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ if (psc_present)
+ return psc_irq_pending(irq);
+ else if (oss_present)
+ return oss_irq_pending(irq);
}
-
- if (irq >= NUM_MAC_SOURCES) {
- printk ("%s: unknown irq %d requested by %s\n",
- __FUNCTION__, irq, devname);
- }
-
- /* Get a node and stick it onto the right list */
-
- if (!(node = new_irq_node())) return -ENOMEM;
-
- node->handler = handler;
- node->flags = flags;
- node->dev_id = dev_id;
- node->devname = devname;
- node->next = NULL;
- mac_insert_irq(&mac_irq_list[irq], node);
-
- /* Now enable the IRQ source */
-
- mac_enable_irq(irq);
-
return 0;
}
-/*
- * Removes an interrupt service routine from an interrupt source.
- */
-
-void mac_free_irq(unsigned int irq, void *dev_id)
-{
-#ifdef DEBUG_MACINTS
- printk ("%s: irq %d freed by %p\n", __FUNCTION__, irq, dev_id);
-#endif
-
- if (irq < VIA1_SOURCE_BASE) {
- cpu_free_irq(irq, dev_id);
- return;
- }
-
- if (irq >= NUM_MAC_SOURCES) {
- printk ("%s: unknown irq %d freed\n",
- __FUNCTION__, irq);
- return;
- }
-
- mac_delete_irq(&mac_irq_list[irq], dev_id);
-
- /* If the list for this interrupt is */
- /* empty then disable the source. */
-
- if (!mac_irq_list[irq]) {
- mac_disable_irq(irq);
- }
-}
-
-/*
- * Generate a pretty listing for /proc/interrupts
- *
- * By the time we're called the autovector interrupt list has already been
- * generated, so we just need to do the machspec interrupts.
- *
- * 990506 (jmt) - rewritten to handle chained machspec interrupt handlers.
- * Also removed display of num_spurious it is already
- * displayed for us as autovector irq 0.
- */
-
-int show_mac_interrupts(struct seq_file *p, void *v)
-{
- int i;
- irq_node_t *node;
- char *base;
-
- /* Don't do Nubus interrupts in this loop; we do them separately */
- /* below so that we can print slot numbers instead of IRQ numbers */
-
- for (i = VIA1_SOURCE_BASE ; i < NUM_MAC_SOURCES ; ++i) {
-
- /* Nonexistant interrupt or nothing registered; skip it. */
-
- if ((node = mac_irq_list[i]) == NULL) continue;
- if (node->flags & IRQ_FLG_STD) continue;
-
- base = "";
- switch(IRQ_SRC(i)) {
- case 1: base = "via1";
- break;
- case 2: if (oss_present) {
- base = "oss";
- } else {
- base = "via2";
- }
- break;
- case 3:
- case 4:
- case 5:
- case 6: if (psc_present) {
- base = "psc";
- } else if (oss_present) {
- base = "oss";
- } else {
- if (IRQ_SRC(i) == 4) base = "scc";
- }
- break;
- case 7: base = "nbus";
- break;
- case 8: base = "bbn";
- break;
- }
- seq_printf(p, "%4s %2d: %10u ", base, i, kstat_cpu(0).irqs[i]);
-
- do {
- if (node->flags & IRQ_FLG_FAST) {
- seq_puts(p, "F ");
- } else if (node->flags & IRQ_FLG_SLOW) {
- seq_puts(p, "S ");
- } else {
- seq_puts(p, " ");
- }
- seq_printf(p, "%s\n", node->devname);
- if ((node = node->next)) {
- seq_puts(p, " ");
- }
- } while(node);
-
- }
- return 0;
-}
-
-void mac_default_handler(int irq, void *dev_id, struct pt_regs *regs)
-{
-#ifdef DEBUG_SPURIOUS
- printk("Unexpected IRQ %d on device %p\n", irq, dev_id);
-#endif
-}
-
static int num_debug[8];
irqreturn_t mac_debug_handler(int irq, void *dev_id, struct pt_regs *regs)
@@ -684,7 +430,7 @@ irqreturn_t mac_nmi_handler(int irq, void *dev_id, struct pt_regs *fp)
while (nmi_hold == 1)
udelay(1000);
- if ( console_loglevel >= 8 ) {
+ if (console_loglevel >= 8) {
#if 0
show_state();
printk("PC: %08lx\nSR: %04x SP: %p\n", fp->pc, fp->sr, fp);
@@ -713,14 +459,16 @@ irqreturn_t mac_nmi_handler(int irq, void *dev_id, struct pt_regs *fp)
* done in hardware (only the PSC can do that.)
*/
-static void scc_irq_enable(int irq) {
- int irq_idx = IRQ_IDX(irq);
+static void scc_irq_enable(unsigned int irq)
+{
+ int irq_idx = IRQ_IDX(irq);
scc_mask |= (1 << irq_idx);
}
-static void scc_irq_disable(int irq) {
- int irq_idx = IRQ_IDX(irq);
+static void scc_irq_disable(unsigned int irq)
+{
+ int irq_idx = IRQ_IDX(irq);
scc_mask &= ~(1 << irq_idx);
}
@@ -755,6 +503,8 @@ void mac_scc_dispatch(int irq, void *dev_id, struct pt_regs *regs)
/* and since they're autovector interrupts they */
/* pretty much kill the system. */
- if (reg & 0x38) mac_do_irq_list(IRQ_SCCA, regs);
- if (reg & 0x07) mac_do_irq_list(IRQ_SCCB, regs);
+ if (reg & 0x38)
+ m68k_handle_int(IRQ_SCCA, regs);
+ if (reg & 0x07)
+ m68k_handle_int(IRQ_SCCB, regs);
}
diff --git a/arch/m68k/mac/misc.c b/arch/m68k/mac/misc.c
index bbb0c3b95e9..56d1f5676ad 100644
--- a/arch/m68k/mac/misc.c
+++ b/arch/m68k/mac/misc.c
@@ -2,7 +2,6 @@
* Miscellaneous Mac68K-specific stuff
*/
-#include <linux/config.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/miscdevice.h>
diff --git a/arch/m68k/mac/oss.c b/arch/m68k/mac/oss.c
index 33354769272..63e04365191 100644
--- a/arch/m68k/mac/oss.c
+++ b/arch/m68k/mac/oss.c
@@ -67,15 +67,15 @@ void __init oss_init(void)
void __init oss_register_interrupts(void)
{
- cpu_request_irq(OSS_IRQLEV_SCSI, oss_irq, IRQ_FLG_LOCK,
+ request_irq(OSS_IRQLEV_SCSI, oss_irq, IRQ_FLG_LOCK,
"scsi", (void *) oss);
- cpu_request_irq(OSS_IRQLEV_IOPSCC, mac_scc_dispatch, IRQ_FLG_LOCK,
+ request_irq(OSS_IRQLEV_IOPSCC, mac_scc_dispatch, IRQ_FLG_LOCK,
"scc", mac_scc_dispatch);
- cpu_request_irq(OSS_IRQLEV_NUBUS, oss_nubus_irq, IRQ_FLG_LOCK,
+ request_irq(OSS_IRQLEV_NUBUS, oss_nubus_irq, IRQ_FLG_LOCK,
"nubus", (void *) oss);
- cpu_request_irq(OSS_IRQLEV_SOUND, oss_irq, IRQ_FLG_LOCK,
+ request_irq(OSS_IRQLEV_SOUND, oss_irq, IRQ_FLG_LOCK,
"sound", (void *) oss);
- cpu_request_irq(OSS_IRQLEV_VIA1, via1_irq, IRQ_FLG_LOCK,
+ request_irq(OSS_IRQLEV_VIA1, via1_irq, IRQ_FLG_LOCK,
"via1", (void *) via1);
}
@@ -113,7 +113,7 @@ irqreturn_t oss_irq(int irq, void *dev_id, struct pt_regs *regs)
oss->irq_pending &= ~OSS_IP_SOUND;
} else if (events & OSS_IP_SCSI) {
oss->irq_level[OSS_SCSI] = OSS_IRQLEV_DISABLED;
- mac_do_irq_list(IRQ_MAC_SCSI, regs);
+ m68k_handle_int(IRQ_MAC_SCSI, regs);
oss->irq_pending &= ~OSS_IP_SCSI;
oss->irq_level[OSS_SCSI] = OSS_IRQLEV_SCSI;
} else {
@@ -146,7 +146,7 @@ irqreturn_t oss_nubus_irq(int irq, void *dev_id, struct pt_regs *regs)
for (i = 0, irq_bit = 1 ; i < 6 ; i++, irq_bit <<= 1) {
if (events & irq_bit) {
oss->irq_level[i] = OSS_IRQLEV_DISABLED;
- mac_do_irq_list(NUBUS_SOURCE_BASE + i, regs);
+ m68k_handle_int(NUBUS_SOURCE_BASE + i, regs);
oss->irq_pending &= ~irq_bit;
oss->irq_level[i] = OSS_IRQLEV_NUBUS;
}
diff --git a/arch/m68k/mac/psc.c b/arch/m68k/mac/psc.c
index e72384e43a1..e2621809175 100644
--- a/arch/m68k/mac/psc.c
+++ b/arch/m68k/mac/psc.c
@@ -117,10 +117,10 @@ void __init psc_init(void)
void __init psc_register_interrupts(void)
{
- cpu_request_irq(3, psc_irq, IRQ_FLG_LOCK, "psc3", (void *) 0x30);
- cpu_request_irq(4, psc_irq, IRQ_FLG_LOCK, "psc4", (void *) 0x40);
- cpu_request_irq(5, psc_irq, IRQ_FLG_LOCK, "psc5", (void *) 0x50);
- cpu_request_irq(6, psc_irq, IRQ_FLG_LOCK, "psc6", (void *) 0x60);
+ request_irq(IRQ_AUTO_3, psc_irq, 0, "psc3", (void *) 0x30);
+ request_irq(IRQ_AUTO_4, psc_irq, 0, "psc4", (void *) 0x40);
+ request_irq(IRQ_AUTO_5, psc_irq, 0, "psc5", (void *) 0x50);
+ request_irq(IRQ_AUTO_6, psc_irq, 0, "psc6", (void *) 0x60);
}
/*
@@ -149,7 +149,7 @@ irqreturn_t psc_irq(int irq, void *dev_id, struct pt_regs *regs)
for (i = 0, irq_bit = 1 ; i < 4 ; i++, irq_bit <<= 1) {
if (events & irq_bit) {
psc_write_byte(pIER, irq_bit);
- mac_do_irq_list(base_irq + i, regs);
+ m68k_handle_int(base_irq + i, regs);
psc_write_byte(pIFR, irq_bit);
psc_write_byte(pIER, irq_bit | 0x80);
}
diff --git a/arch/m68k/mac/via.c b/arch/m68k/mac/via.c
index cd528bf7b43..c4aa345d544 100644
--- a/arch/m68k/mac/via.c
+++ b/arch/m68k/mac/via.c
@@ -25,7 +25,6 @@
#include <linux/init.h>
#include <linux/ide.h>
-#include <asm/traps.h>
#include <asm/bootinfo.h>
#include <asm/macintosh.h>
#include <asm/macints.h>
@@ -71,7 +70,6 @@ void via_irq_enable(int irq);
void via_irq_disable(int irq);
void via_irq_clear(int irq);
-extern irqreturn_t mac_bang(int, void *, struct pt_regs *);
extern irqreturn_t mac_scc_dispatch(int, void *, struct pt_regs *);
extern int oss_present;
@@ -212,11 +210,6 @@ void __init via_init(void)
break;
}
#else
- /* The alernate IRQ mapping seems to just not work. Anyone with a */
- /* supported machine is welcome to take a stab at fixing it. It */
- /* _should_ work on the following Quadras: 610,650,700,800,900,950 */
- /* - 1999-06-12 (jmt) */
-
via_alt_mapping = 0;
#endif
@@ -260,27 +253,21 @@ void __init via_init_clock(irqreturn_t (*func)(int, void *, struct pt_regs *))
void __init via_register_interrupts(void)
{
if (via_alt_mapping) {
- cpu_request_irq(IRQ_AUTO_1, via1_irq,
+ request_irq(IRQ_AUTO_1, via1_irq,
IRQ_FLG_LOCK|IRQ_FLG_FAST, "software",
(void *) via1);
- cpu_request_irq(IRQ_AUTO_6, via1_irq,
+ request_irq(IRQ_AUTO_6, via1_irq,
IRQ_FLG_LOCK|IRQ_FLG_FAST, "via1",
(void *) via1);
} else {
- cpu_request_irq(IRQ_AUTO_1, via1_irq,
+ request_irq(IRQ_AUTO_1, via1_irq,
IRQ_FLG_LOCK|IRQ_FLG_FAST, "via1",
(void *) via1);
-#if 0 /* interferes with serial on some machines */
- if (!psc_present) {
- cpu_request_irq(IRQ_AUTO_6, mac_bang, IRQ_FLG_LOCK,
- "Off Switch", mac_bang);
- }
-#endif
}
- cpu_request_irq(IRQ_AUTO_2, via2_irq, IRQ_FLG_LOCK|IRQ_FLG_FAST,
+ request_irq(IRQ_AUTO_2, via2_irq, IRQ_FLG_LOCK|IRQ_FLG_FAST,
"via2", (void *) via2);
if (!psc_present) {
- cpu_request_irq(IRQ_AUTO_4, mac_scc_dispatch, IRQ_FLG_LOCK,
+ request_irq(IRQ_AUTO_4, mac_scc_dispatch, IRQ_FLG_LOCK,
"scc", mac_scc_dispatch);
}
request_irq(IRQ_MAC_NUBUS, via_nubus_irq, IRQ_FLG_LOCK|IRQ_FLG_FAST,
@@ -437,7 +424,7 @@ irqreturn_t via1_irq(int irq, void *dev_id, struct pt_regs *regs)
for (i = 0, irq_bit = 1 ; i < 7 ; i++, irq_bit <<= 1)
if (events & irq_bit) {
via1[vIER] = irq_bit;
- mac_do_irq_list(VIA1_SOURCE_BASE + i, regs);
+ m68k_handle_int(VIA1_SOURCE_BASE + i, regs);
via1[vIFR] = irq_bit;
via1[vIER] = irq_bit | 0x80;
}
@@ -452,7 +439,7 @@ irqreturn_t via1_irq(int irq, void *dev_id, struct pt_regs *regs)
/* No, it won't be set. that's why we're doing this. */
via_irq_disable(IRQ_MAC_NUBUS);
via_irq_clear(IRQ_MAC_NUBUS);
- mac_do_irq_list(IRQ_MAC_NUBUS, regs);
+ m68k_handle_int(IRQ_MAC_NUBUS, regs);
via_irq_enable(IRQ_MAC_NUBUS);
}
#endif
@@ -471,8 +458,8 @@ irqreturn_t via2_irq(int irq, void *dev_id, struct pt_regs *regs)
for (i = 0, irq_bit = 1 ; i < 7 ; i++, irq_bit <<= 1)
if (events & irq_bit) {
via2[gIER] = irq_bit;
- mac_do_irq_list(VIA2_SOURCE_BASE + i, regs);
via2[gIFR] = irq_bit | rbv_clear;
+ m68k_handle_int(VIA2_SOURCE_BASE + i, regs);
via2[gIER] = irq_bit | 0x80;
}
return IRQ_HANDLED;
@@ -494,7 +481,7 @@ irqreturn_t via_nubus_irq(int irq, void *dev_id, struct pt_regs *regs)
for (i = 0, irq_bit = 1 ; i < 7 ; i++, irq_bit <<= 1) {
if (events & irq_bit) {
via_irq_disable(NUBUS_SOURCE_BASE + i);
- mac_do_irq_list(NUBUS_SOURCE_BASE + i, regs);
+ m68k_handle_int(NUBUS_SOURCE_BASE + i, regs);
via_irq_enable(NUBUS_SOURCE_BASE + i);
}
}
@@ -529,6 +516,7 @@ void via_irq_enable(int irq) {
}
via2[gIER] = irq_bit | 0x80;
} else if (irq_src == 7) {
+ nubus_active |= irq_bit;
if (rbv_present) {
/* enable the slot interrupt. SIER works like IER. */
via2[rSIER] = IER_SET_BIT(irq_idx);
@@ -550,7 +538,6 @@ void via_irq_enable(int irq) {
}
}
}
- nubus_active |= irq_bit;
}
}
diff --git a/arch/m68k/math-emu/fp_entry.S b/arch/m68k/math-emu/fp_entry.S
index 5ec2d9101ea..954b4f304a7 100644
--- a/arch/m68k/math-emu/fp_entry.S
+++ b/arch/m68k/math-emu/fp_entry.S
@@ -35,7 +35,6 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <linux/config.h>
#include <linux/linkage.h>
#include <asm/entry.h>
diff --git a/arch/m68k/math-emu/fp_util.S b/arch/m68k/math-emu/fp_util.S
index a9f7f012906..b093b85fcdd 100644
--- a/arch/m68k/math-emu/fp_util.S
+++ b/arch/m68k/math-emu/fp_util.S
@@ -35,7 +35,6 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <linux/config.h>
#include "fp_emu.h"
/*
diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c
index a190e39c907..ab90213e5c5 100644
--- a/arch/m68k/mm/init.c
+++ b/arch/m68k/mm/init.c
@@ -7,7 +7,6 @@
* to motorola.c and sun3mmu.c
*/
-#include <linux/config.h>
#include <linux/signal.h>
#include <linux/sched.h>
#include <linux/mm.h>
diff --git a/arch/m68k/mm/kmap.c b/arch/m68k/mm/kmap.c
index 85ad19a0ac7..f46f049d29f 100644
--- a/arch/m68k/mm/kmap.c
+++ b/arch/m68k/mm/kmap.c
@@ -7,7 +7,6 @@
* used by other architectures /Roman Zippel
*/
-#include <linux/config.h>
#include <linux/mm.h>
#include <linux/kernel.h>
#include <linux/string.h>
@@ -259,13 +258,15 @@ void __iounmap(void *addr, unsigned long size)
if (CPU_IS_020_OR_030) {
int pmd_off = (virtaddr/PTRTREESIZE) & 15;
+ int pmd_type = pmd_dir->pmd[pmd_off] & _DESCTYPE_MASK;
- if ((pmd_dir->pmd[pmd_off] & _DESCTYPE_MASK) == _PAGE_PRESENT) {
+ if (pmd_type == _PAGE_PRESENT) {
pmd_dir->pmd[pmd_off] = 0;
virtaddr += PTRTREESIZE;
size -= PTRTREESIZE;
continue;
- }
+ } else if (pmd_type == 0)
+ continue;
}
if (pmd_bad(*pmd_dir)) {
diff --git a/arch/m68k/mm/memory.c b/arch/m68k/mm/memory.c
index d6d582a5abb..a0c095e1722 100644
--- a/arch/m68k/mm/memory.c
+++ b/arch/m68k/mm/memory.c
@@ -4,7 +4,6 @@
* Copyright (C) 1995 Hamish Macdonald
*/
-#include <linux/config.h>
#include <linux/mm.h>
#include <linux/kernel.h>
#include <linux/string.h>
@@ -94,8 +93,7 @@ pmd_t *get_pointer_table (void)
PD_MARKBITS(dp) = mask & ~tmp;
if (!PD_MARKBITS(dp)) {
/* move to end of list */
- list_del(dp);
- list_add_tail(dp, &ptable_list);
+ list_move_tail(dp, &ptable_list);
}
return (pmd_t *) (page_address(PD_PAGE(dp)) + off);
}
@@ -123,8 +121,7 @@ int free_pointer_table (pmd_t *ptable)
* move this descriptor to the front of the list, since
* it has one or more free tables.
*/
- list_del(dp);
- list_add(dp, &ptable_list);
+ list_move(dp, &ptable_list);
}
return 0;
}
diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c
index afb57eeafdc..49015e32d8f 100644
--- a/arch/m68k/mm/motorola.c
+++ b/arch/m68k/mm/motorola.c
@@ -8,7 +8,6 @@
* Moved 8/20/1999 Sam Creasey
*/
-#include <linux/config.h>
#include <linux/module.h>
#include <linux/signal.h>
#include <linux/sched.h>
@@ -203,7 +202,7 @@ void __init paging_init(void)
{
int chunk;
unsigned long mem_avail = 0;
- unsigned long zones_size[3] = { 0, };
+ unsigned long zones_size[MAX_NR_ZONES] = { 0, };
#ifdef DEBUG
{
@@ -257,12 +256,12 @@ void __init paging_init(void)
#ifdef DEBUG
printk ("before free_area_init\n");
#endif
- zones_size[0] = (mach_max_dma_address < (unsigned long)high_memory ?
- (mach_max_dma_address+1) : (unsigned long)high_memory);
- zones_size[1] = (unsigned long)high_memory - zones_size[0];
+ zones_size[ZONE_DMA] = (mach_max_dma_address < (unsigned long)high_memory ?
+ (mach_max_dma_address+1) : (unsigned long)high_memory);
+ zones_size[ZONE_NORMAL] = (unsigned long)high_memory - zones_size[0];
- zones_size[0] = (zones_size[0] - PAGE_OFFSET) >> PAGE_SHIFT;
- zones_size[1] >>= PAGE_SHIFT;
+ zones_size[ZONE_DMA] = (zones_size[ZONE_DMA] - PAGE_OFFSET) >> PAGE_SHIFT;
+ zones_size[ZONE_NORMAL] >>= PAGE_SHIFT;
free_area_init(zones_size);
}
diff --git a/arch/m68k/mm/sun3mmu.c b/arch/m68k/mm/sun3mmu.c
index a47be196a47..ac6640ade0b 100644
--- a/arch/m68k/mm/sun3mmu.c
+++ b/arch/m68k/mm/sun3mmu.c
@@ -46,7 +46,7 @@ void __init paging_init(void)
unsigned long address;
unsigned long next_pgtable;
unsigned long bootmem_end;
- unsigned long zones_size[3] = {0, 0, 0};
+ unsigned long zones_size[MAX_NR_ZONES] = { 0, };
unsigned long size;
@@ -92,8 +92,7 @@ void __init paging_init(void)
current->mm = NULL;
/* memory sizing is a hack stolen from motorola.c.. hope it works for us */
- zones_size[0] = ((unsigned long)high_memory - PAGE_OFFSET) >> PAGE_SHIFT;
- zones_size[1] = 0;
+ zones_size[ZONE_DMA] = ((unsigned long)high_memory - PAGE_OFFSET) >> PAGE_SHIFT;
free_area_init(zones_size);
diff --git a/arch/m68k/mvme147/147ints.c b/arch/m68k/mvme147/147ints.c
deleted file mode 100644
index 69a744ee35a..00000000000
--- a/arch/m68k/mvme147/147ints.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * arch/m68k/mvme147/147ints.c
- *
- * Copyright (C) 1997 Richard Hirst [richard@sleepie.demon.co.uk]
- *
- * based on amiints.c -- Amiga Linux interrupt handling code
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file README.legal in the main directory of this archive
- * for more details.
- *
- */
-
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/seq_file.h>
-
-#include <asm/ptrace.h>
-#include <asm/system.h>
-#include <asm/irq.h>
-#include <asm/traps.h>
-
-static irqreturn_t mvme147_defhand (int irq, void *dev_id, struct pt_regs *fp);
-
-/*
- * This should ideally be 4 elements only, for speed.
- */
-
-static struct {
- irqreturn_t (*handler)(int, void *, struct pt_regs *);
- unsigned long flags;
- void *dev_id;
- const char *devname;
- unsigned count;
-} irq_tab[256];
-
-/*
- * void mvme147_init_IRQ (void)
- *
- * Parameters: None
- *
- * Returns: Nothing
- *
- * This function is called during kernel startup to initialize
- * the mvme147 IRQ handling routines.
- */
-
-void mvme147_init_IRQ (void)
-{
- int i;
-
- for (i = 0; i < 256; i++) {
- irq_tab[i].handler = mvme147_defhand;
- irq_tab[i].flags = IRQ_FLG_STD;
- irq_tab[i].dev_id = NULL;
- irq_tab[i].devname = NULL;
- irq_tab[i].count = 0;
- }
-}
-
-int mvme147_request_irq(unsigned int irq,
- irqreturn_t (*handler)(int, void *, struct pt_regs *),
- unsigned long flags, const char *devname, void *dev_id)
-{
- if (irq > 255) {
- printk("%s: Incorrect IRQ %d from %s\n", __FUNCTION__, irq, devname);
- return -ENXIO;
- }
- if (!(irq_tab[irq].flags & IRQ_FLG_STD)) {
- if (irq_tab[irq].flags & IRQ_FLG_LOCK) {
- printk("%s: IRQ %d from %s is not replaceable\n",
- __FUNCTION__, irq, irq_tab[irq].devname);
- return -EBUSY;
- }
- if (flags & IRQ_FLG_REPLACE) {
- printk("%s: %s can't replace IRQ %d from %s\n",
- __FUNCTION__, devname, irq, irq_tab[irq].devname);
- return -EBUSY;
- }
- }
- irq_tab[irq].handler = handler;
- irq_tab[irq].flags = flags;
- irq_tab[irq].dev_id = dev_id;
- irq_tab[irq].devname = devname;
- return 0;
-}
-
-void mvme147_free_irq(unsigned int irq, void *dev_id)
-{
- if (irq > 255) {
- printk("%s: Incorrect IRQ %d\n", __FUNCTION__, irq);
- return;
- }
- if (irq_tab[irq].dev_id != dev_id)
- printk("%s: Removing probably wrong IRQ %d from %s\n",
- __FUNCTION__, irq, irq_tab[irq].devname);
-
- irq_tab[irq].handler = mvme147_defhand;
- irq_tab[irq].flags = IRQ_FLG_STD;
- irq_tab[irq].dev_id = NULL;
- irq_tab[irq].devname = NULL;
-}
-
-irqreturn_t mvme147_process_int (unsigned long vec, struct pt_regs *fp)
-{
- if (vec > 255) {
- printk ("mvme147_process_int: Illegal vector %ld\n", vec);
- return IRQ_NONE;
- } else {
- irq_tab[vec].count++;
- irq_tab[vec].handler(vec, irq_tab[vec].dev_id, fp);
- return IRQ_HANDLED;
- }
-}
-
-int show_mvme147_interrupts (struct seq_file *p, void *v)
-{
- int i;
-
- for (i = 0; i < 256; i++) {
- if (irq_tab[i].count)
- seq_printf(p, "Vec 0x%02x: %8d %s\n",
- i, irq_tab[i].count,
- irq_tab[i].devname ? irq_tab[i].devname : "free");
- }
- return 0;
-}
-
-
-static irqreturn_t mvme147_defhand (int irq, void *dev_id, struct pt_regs *fp)
-{
- printk ("Unknown interrupt 0x%02x\n", irq);
- return IRQ_NONE;
-}
-
-void mvme147_enable_irq (unsigned int irq)
-{
-}
-
-
-void mvme147_disable_irq (unsigned int irq)
-{
-}
-
diff --git a/arch/m68k/mvme147/Makefile b/arch/m68k/mvme147/Makefile
index f0153ed3efa..a36d38dbfbb 100644
--- a/arch/m68k/mvme147/Makefile
+++ b/arch/m68k/mvme147/Makefile
@@ -2,4 +2,4 @@
# Makefile for Linux arch/m68k/mvme147 source directory
#
-obj-y := config.o 147ints.o
+obj-y := config.o
diff --git a/arch/m68k/mvme147/config.c b/arch/m68k/mvme147/config.c
index 0fcf9720c2f..0cd0e5bddce 100644
--- a/arch/m68k/mvme147/config.c
+++ b/arch/m68k/mvme147/config.c
@@ -36,15 +36,8 @@
#include <asm/mvme147hw.h>
-extern irqreturn_t mvme147_process_int (int level, struct pt_regs *regs);
-extern void mvme147_init_IRQ (void);
-extern void mvme147_free_irq (unsigned int, void *);
-extern int show_mvme147_interrupts (struct seq_file *, void *);
-extern void mvme147_enable_irq (unsigned int);
-extern void mvme147_disable_irq (unsigned int);
static void mvme147_get_model(char *model);
static int mvme147_get_hardware_list(char *buffer);
-extern int mvme147_request_irq (unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *), unsigned long flags, const char *devname, void *dev_id);
extern void mvme147_sched_init(irqreturn_t (*handler)(int, void *, struct pt_regs *));
extern unsigned long mvme147_gettimeoffset (void);
extern int mvme147_hwclk (int, struct rtc_time *);
@@ -91,6 +84,15 @@ static int mvme147_get_hardware_list(char *buffer)
return 0;
}
+/*
+ * This function is called during kernel startup to initialize
+ * the mvme147 IRQ handling routines.
+ */
+
+void mvme147_init_IRQ(void)
+{
+ m68k_setup_user_interrupt(VEC_USER, 192, NULL);
+}
void __init config_mvme147(void)
{
@@ -101,12 +103,6 @@ void __init config_mvme147(void)
mach_hwclk = mvme147_hwclk;
mach_set_clock_mmss = mvme147_set_clock_mmss;
mach_reset = mvme147_reset;
- mach_free_irq = mvme147_free_irq;
- mach_process_int = mvme147_process_int;
- mach_get_irq_list = show_mvme147_interrupts;
- mach_request_irq = mvme147_request_irq;
- enable_irq = mvme147_enable_irq;
- disable_irq = mvme147_disable_irq;
mach_get_model = mvme147_get_model;
mach_get_hardware_list = mvme147_get_hardware_list;
diff --git a/arch/m68k/mvme16x/16xints.c b/arch/m68k/mvme16x/16xints.c
deleted file mode 100644
index 793ef735b59..00000000000
--- a/arch/m68k/mvme16x/16xints.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * arch/m68k/mvme16x/16xints.c
- *
- * Copyright (C) 1995 Richard Hirst [richard@sleepie.demon.co.uk]
- *
- * based on amiints.c -- Amiga Linux interrupt handling code
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file README.legal in the main directory of this archive
- * for more details.
- *
- */
-
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/seq_file.h>
-
-#include <asm/system.h>
-#include <asm/ptrace.h>
-#include <asm/irq.h>
-
-static irqreturn_t mvme16x_defhand (int irq, void *dev_id, struct pt_regs *fp);
-
-/*
- * This should ideally be 4 elements only, for speed.
- */
-
-static struct {
- irqreturn_t (*handler)(int, void *, struct pt_regs *);
- unsigned long flags;
- void *dev_id;
- const char *devname;
- unsigned count;
-} irq_tab[192];
-
-/*
- * void mvme16x_init_IRQ (void)
- *
- * Parameters: None
- *
- * Returns: Nothing
- *
- * This function is called during kernel startup to initialize
- * the mvme16x IRQ handling routines. Should probably ensure
- * that the base vectors for the VMEChip2 and PCCChip2 are valid.
- */
-
-void mvme16x_init_IRQ (void)
-{
- int i;
-
- for (i = 0; i < 192; i++) {
- irq_tab[i].handler = mvme16x_defhand;
- irq_tab[i].flags = IRQ_FLG_STD;
- irq_tab[i].dev_id = NULL;
- irq_tab[i].devname = NULL;
- irq_tab[i].count = 0;
- }
-}
-
-int mvme16x_request_irq(unsigned int irq,
- irqreturn_t (*handler)(int, void *, struct pt_regs *),
- unsigned long flags, const char *devname, void *dev_id)
-{
- if (irq < 64 || irq > 255) {
- printk("%s: Incorrect IRQ %d from %s\n", __FUNCTION__, irq, devname);
- return -ENXIO;
- }
-
- if (!(irq_tab[irq-64].flags & IRQ_FLG_STD)) {
- if (irq_tab[irq-64].flags & IRQ_FLG_LOCK) {
- printk("%s: IRQ %d from %s is not replaceable\n",
- __FUNCTION__, irq, irq_tab[irq-64].devname);
- return -EBUSY;
- }
- if (flags & IRQ_FLG_REPLACE) {
- printk("%s: %s can't replace IRQ %d from %s\n",
- __FUNCTION__, devname, irq, irq_tab[irq-64].devname);
- return -EBUSY;
- }
- }
- irq_tab[irq-64].handler = handler;
- irq_tab[irq-64].flags = flags;
- irq_tab[irq-64].dev_id = dev_id;
- irq_tab[irq-64].devname = devname;
- return 0;
-}
-
-void mvme16x_free_irq(unsigned int irq, void *dev_id)
-{
- if (irq < 64 || irq > 255) {
- printk("%s: Incorrect IRQ %d\n", __FUNCTION__, irq);
- return;
- }
-
- if (irq_tab[irq-64].dev_id != dev_id)
- printk("%s: Removing probably wrong IRQ %d from %s\n",
- __FUNCTION__, irq, irq_tab[irq-64].devname);
-
- irq_tab[irq-64].handler = mvme16x_defhand;
- irq_tab[irq-64].flags = IRQ_FLG_STD;
- irq_tab[irq-64].dev_id = NULL;
- irq_tab[irq-64].devname = NULL;
-}
-
-irqreturn_t mvme16x_process_int (unsigned long vec, struct pt_regs *fp)
-{
- if (vec < 64 || vec > 255) {
- printk ("mvme16x_process_int: Illegal vector %ld", vec);
- return IRQ_NONE;
- } else {
- irq_tab[vec-64].count++;
- irq_tab[vec-64].handler(vec, irq_tab[vec-64].dev_id, fp);
- return IRQ_HANDLED;
- }
-}
-
-int show_mvme16x_interrupts (struct seq_file *p, void *v)
-{
- int i;
-
- for (i = 0; i < 192; i++) {
- if (irq_tab[i].count)
- seq_printf(p, "Vec 0x%02x: %8d %s\n",
- i+64, irq_tab[i].count,
- irq_tab[i].devname ? irq_tab[i].devname : "free");
- }
- return 0;
-}
-
-
-static irqreturn_t mvme16x_defhand (int irq, void *dev_id, struct pt_regs *fp)
-{
- printk ("Unknown interrupt 0x%02x\n", irq);
- return IRQ_NONE;
-}
-
-
-void mvme16x_enable_irq (unsigned int irq)
-{
-}
-
-
-void mvme16x_disable_irq (unsigned int irq)
-{
-}
-
-
diff --git a/arch/m68k/mvme16x/Makefile b/arch/m68k/mvme16x/Makefile
index 5129f56b64a..950e82f2164 100644
--- a/arch/m68k/mvme16x/Makefile
+++ b/arch/m68k/mvme16x/Makefile
@@ -2,4 +2,4 @@
# Makefile for Linux arch/m68k/mvme16x source directory
#
-obj-y := config.o 16xints.o rtc.o mvme16x_ksyms.o
+obj-y := config.o rtc.o mvme16x_ksyms.o
diff --git a/arch/m68k/mvme16x/config.c b/arch/m68k/mvme16x/config.c
index 26ce81c1337..ce2727ed1bc 100644
--- a/arch/m68k/mvme16x/config.c
+++ b/arch/m68k/mvme16x/config.c
@@ -40,15 +40,8 @@ extern t_bdid mvme_bdid;
static MK48T08ptr_t volatile rtc = (MK48T08ptr_t)MVME_RTC_BASE;
-extern irqreturn_t mvme16x_process_int (int level, struct pt_regs *regs);
-extern void mvme16x_init_IRQ (void);
-extern void mvme16x_free_irq (unsigned int, void *);
-extern int show_mvme16x_interrupts (struct seq_file *, void *);
-extern void mvme16x_enable_irq (unsigned int);
-extern void mvme16x_disable_irq (unsigned int);
static void mvme16x_get_model(char *model);
static int mvme16x_get_hardware_list(char *buffer);
-extern int mvme16x_request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *), unsigned long flags, const char *devname, void *dev_id);
extern void mvme16x_sched_init(irqreturn_t (*handler)(int, void *, struct pt_regs *));
extern unsigned long mvme16x_gettimeoffset (void);
extern int mvme16x_hwclk (int, struct rtc_time *);
@@ -120,6 +113,16 @@ static int mvme16x_get_hardware_list(char *buffer)
return (len);
}
+/*
+ * This function is called during kernel startup to initialize
+ * the mvme16x IRQ handling routines. Should probably ensure
+ * that the base vectors for the VMEChip2 and PCCChip2 are valid.
+ */
+
+static void mvme16x_init_IRQ (void)
+{
+ m68k_setup_user_interrupt(VEC_USER, 192, NULL);
+}
#define pcc2chip ((volatile u_char *)0xfff42000)
#define PccSCCMICR 0x1d
@@ -138,12 +141,6 @@ void __init config_mvme16x(void)
mach_hwclk = mvme16x_hwclk;
mach_set_clock_mmss = mvme16x_set_clock_mmss;
mach_reset = mvme16x_reset;
- mach_free_irq = mvme16x_free_irq;
- mach_process_int = mvme16x_process_int;
- mach_get_irq_list = show_mvme16x_interrupts;
- mach_request_irq = mvme16x_request_irq;
- enable_irq = mvme16x_enable_irq;
- disable_irq = mvme16x_disable_irq;
mach_get_model = mvme16x_get_model;
mach_get_hardware_list = mvme16x_get_hardware_list;
diff --git a/arch/m68k/q40/config.c b/arch/m68k/q40/config.c
index 5e0f9b04d45..9a182787640 100644
--- a/arch/m68k/q40/config.c
+++ b/arch/m68k/q40/config.c
@@ -12,7 +12,6 @@
* for more details.
*/
-#include <linux/config.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/mm.h>
@@ -37,15 +36,9 @@
#include <asm/q40_master.h>
extern irqreturn_t q40_process_int (int level, struct pt_regs *regs);
-extern irqreturn_t (*q40_default_handler[]) (int, void *, struct pt_regs *); /* added just for debugging */
extern void q40_init_IRQ (void);
-extern void q40_free_irq (unsigned int, void *);
-extern int show_q40_interrupts (struct seq_file *, void *);
-extern void q40_enable_irq (unsigned int);
-extern void q40_disable_irq (unsigned int);
static void q40_get_model(char *model);
static int q40_get_hardware_list(char *buffer);
-extern int q40_request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *), unsigned long flags, const char *devname, void *dev_id);
extern void q40_sched_init(irqreturn_t (*handler)(int, void *, struct pt_regs *));
extern unsigned long q40_gettimeoffset (void);
@@ -175,13 +168,6 @@ void __init config_q40(void)
mach_set_clock_mmss = q40_set_clock_mmss;
mach_reset = q40_reset;
- mach_free_irq = q40_free_irq;
- mach_process_int = q40_process_int;
- mach_get_irq_list = show_q40_interrupts;
- mach_request_irq = q40_request_irq;
- enable_irq = q40_enable_irq;
- disable_irq = q40_disable_irq;
- mach_default_handler = &q40_default_handler;
mach_get_model = q40_get_model;
mach_get_hardware_list = q40_get_hardware_list;
diff --git a/arch/m68k/q40/q40ints.c b/arch/m68k/q40/q40ints.c
index f8ecc2664fe..472f41c4158 100644
--- a/arch/m68k/q40/q40ints.c
+++ b/arch/m68k/q40/q40ints.c
@@ -14,13 +14,8 @@
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/errno.h>
-#include <linux/string.h>
-#include <linux/sched.h>
-#include <linux/seq_file.h>
#include <linux/interrupt.h>
-#include <linux/hardirq.h>
-#include <asm/rtc.h>
#include <asm/ptrace.h>
#include <asm/system.h>
#include <asm/irq.h>
@@ -39,29 +34,37 @@
*
*/
-extern int ints_inited;
+static void q40_irq_handler(unsigned int, struct pt_regs *fp);
+static void q40_enable_irq(unsigned int);
+static void q40_disable_irq(unsigned int);
+unsigned short q40_ablecount[35];
+unsigned short q40_state[35];
-irqreturn_t q40_irq2_handler (int, void *, struct pt_regs *fp);
-
-
-static irqreturn_t q40_defhand (int irq, void *dev_id, struct pt_regs *fp);
-static irqreturn_t default_handler(int lev, void *dev_id, struct pt_regs *regs);
-
-
-#define DEVNAME_SIZE 24
+static int q40_irq_startup(unsigned int irq)
+{
+ /* test for ISA ints not implemented by HW */
+ switch (irq) {
+ case 1: case 2: case 8: case 9:
+ case 11: case 12: case 13:
+ printk("%s: ISA IRQ %d not implemented by HW\n", __FUNCTION__, irq);
+ return -ENXIO;
+ }
+ return 0;
+}
-static struct q40_irq_node {
- irqreturn_t (*handler)(int, void *, struct pt_regs *);
- unsigned long flags;
- void *dev_id;
- /* struct q40_irq_node *next;*/
- char devname[DEVNAME_SIZE];
- unsigned count;
- unsigned short state;
-} irq_tab[Q40_IRQ_MAX+1];
+static void q40_irq_shutdown(unsigned int irq)
+{
+}
-short unsigned q40_ablecount[Q40_IRQ_MAX+1];
+static struct irq_controller q40_irq_controller = {
+ .name = "q40",
+ .lock = SPIN_LOCK_UNLOCKED,
+ .startup = q40_irq_startup,
+ .shutdown = q40_irq_shutdown,
+ .enable = q40_enable_irq,
+ .disable = q40_disable_irq,
+};
/*
* void q40_init_IRQ (void)
@@ -74,139 +77,29 @@ short unsigned q40_ablecount[Q40_IRQ_MAX+1];
* the q40 IRQ handling routines.
*/
-static int disabled=0;
+static int disabled;
-void q40_init_IRQ (void)
+void q40_init_IRQ(void)
{
- int i;
-
- disabled=0;
- for (i = 0; i <= Q40_IRQ_MAX; i++) {
- irq_tab[i].handler = q40_defhand;
- irq_tab[i].flags = 0;
- irq_tab[i].dev_id = NULL;
- /* irq_tab[i].next = NULL;*/
- irq_tab[i].devname[0] = 0;
- irq_tab[i].count = 0;
- irq_tab[i].state =0;
- q40_ablecount[i]=0; /* all enabled */
- }
+ m68k_setup_irq_controller(&q40_irq_controller, 1, Q40_IRQ_MAX);
/* setup handler for ISA ints */
- cpu_request_irq(IRQ2, q40_irq2_handler, 0, "q40 ISA and master chip",
- NULL);
+ m68k_setup_auto_interrupt(q40_irq_handler);
+
+ m68k_irq_startup(IRQ_AUTO_2);
+ m68k_irq_startup(IRQ_AUTO_4);
/* now enable some ints.. */
- master_outb(1,EXT_ENABLE_REG); /* ISA IRQ 5-15 */
+ master_outb(1, EXT_ENABLE_REG); /* ISA IRQ 5-15 */
/* make sure keyboard IRQ is disabled */
- master_outb(0,KEY_IRQ_ENABLE_REG);
+ master_outb(0, KEY_IRQ_ENABLE_REG);
}
-int q40_request_irq(unsigned int irq,
- irqreturn_t (*handler)(int, void *, struct pt_regs *),
- unsigned long flags, const char *devname, void *dev_id)
-{
- /*printk("q40_request_irq %d, %s\n",irq,devname);*/
-
- if (irq > Q40_IRQ_MAX || (irq>15 && irq<32)) {
- printk("%s: Incorrect IRQ %d from %s\n", __FUNCTION__, irq, devname);
- return -ENXIO;
- }
-
- /* test for ISA ints not implemented by HW */
- switch (irq)
- {
- case 1: case 2: case 8: case 9:
- case 12: case 13:
- printk("%s: ISA IRQ %d from %s not implemented by HW\n", __FUNCTION__, irq, devname);
- return -ENXIO;
- case 11:
- printk("warning IRQ 10 and 11 not distinguishable\n");
- irq=10;
- default:
- ;
- }
-
- if (irq<Q40_IRQ_SAMPLE)
- {
- if (irq_tab[irq].dev_id != NULL)
- {
- printk("%s: IRQ %d from %s is not replaceable\n",
- __FUNCTION__, irq, irq_tab[irq].devname);
- return -EBUSY;
- }
- /*printk("IRQ %d set to handler %p\n",irq,handler);*/
- if (dev_id==NULL)
- {
- printk("WARNING: dev_id == NULL in request_irq\n");
- dev_id=(void*)1;
- }
- irq_tab[irq].handler = handler;
- irq_tab[irq].flags = flags;
- irq_tab[irq].dev_id = dev_id;
- strlcpy(irq_tab[irq].devname,devname,sizeof(irq_tab[irq].devname));
- irq_tab[irq].state = 0;
- return 0;
- }
- else {
- /* Q40_IRQ_SAMPLE :somewhat special actions required here ..*/
- cpu_request_irq(4, handler, flags, devname, dev_id);
- cpu_request_irq(6, handler, flags, devname, dev_id);
- return 0;
- }
-}
-
-void q40_free_irq(unsigned int irq, void *dev_id)
-{
- if (irq > Q40_IRQ_MAX || (irq>15 && irq<32)) {
- printk("%s: Incorrect IRQ %d, dev_id %x \n", __FUNCTION__, irq, (unsigned)dev_id);
- return;
- }
-
- /* test for ISA ints not implemented by HW */
- switch (irq)
- {
- case 1: case 2: case 8: case 9:
- case 12: case 13:
- printk("%s: ISA IRQ %d from %x invalid\n", __FUNCTION__, irq, (unsigned)dev_id);
- return;
- case 11: irq=10;
- default:
- ;
- }
-
- if (irq<Q40_IRQ_SAMPLE)
- {
- if (irq_tab[irq].dev_id != dev_id)
- printk("%s: Removing probably wrong IRQ %d from %s\n",
- __FUNCTION__, irq, irq_tab[irq].devname);
-
- irq_tab[irq].handler = q40_defhand;
- irq_tab[irq].flags = 0;
- irq_tab[irq].dev_id = NULL;
- /* irq_tab[irq].devname = NULL; */
- /* do not reset state !! */
- }
- else
- { /* == Q40_IRQ_SAMPLE */
- cpu_free_irq(4, dev_id);
- cpu_free_irq(6, dev_id);
- }
-}
-
-
-irqreturn_t q40_process_int (int level, struct pt_regs *fp)
-{
- printk("unexpected interrupt vec=%x, pc=%lx, d0=%lx, d0_orig=%lx, d1=%lx, d2=%lx\n",
- level, fp->pc, fp->d0, fp->orig_d0, fp->d1, fp->d2);
- printk("\tIIRQ_REG = %x, EIRQ_REG = %x\n",master_inb(IIRQ_REG),master_inb(EIRQ_REG));
- return IRQ_HANDLED;
-}
/*
* this stuff doesn't really belong here..
-*/
+ */
int ql_ticks; /* 200Hz ticks since last jiffie */
static int sound_ticks;
@@ -215,54 +108,53 @@ static int sound_ticks;
void q40_mksound(unsigned int hz, unsigned int ticks)
{
- /* for now ignore hz, except that hz==0 switches off sound */
- /* simply alternate the ampl (128-SVOL)-(128+SVOL)-..-.. at 200Hz */
- if (hz==0)
- {
- if (sound_ticks)
- sound_ticks=1;
-
- *DAC_LEFT=128;
- *DAC_RIGHT=128;
-
- return;
- }
- /* sound itself is done in q40_timer_int */
- if (sound_ticks == 0) sound_ticks=1000; /* pretty long beep */
- sound_ticks=ticks<<1;
+ /* for now ignore hz, except that hz==0 switches off sound */
+ /* simply alternate the ampl (128-SVOL)-(128+SVOL)-..-.. at 200Hz */
+ if (hz == 0) {
+ if (sound_ticks)
+ sound_ticks = 1;
+
+ *DAC_LEFT = 128;
+ *DAC_RIGHT = 128;
+
+ return;
+ }
+ /* sound itself is done in q40_timer_int */
+ if (sound_ticks == 0)
+ sound_ticks = 1000; /* pretty long beep */
+ sound_ticks = ticks << 1;
}
static irqreturn_t (*q40_timer_routine)(int, void *, struct pt_regs *);
static irqreturn_t q40_timer_int (int irq, void * dev, struct pt_regs * regs)
{
- ql_ticks = ql_ticks ? 0 : 1;
- if (sound_ticks)
- {
- unsigned char sval=(sound_ticks & 1) ? 128-SVOL : 128+SVOL;
- sound_ticks--;
- *DAC_LEFT=sval;
- *DAC_RIGHT=sval;
- }
-
- if (!ql_ticks)
- q40_timer_routine(irq, dev, regs);
- return IRQ_HANDLED;
+ ql_ticks = ql_ticks ? 0 : 1;
+ if (sound_ticks) {
+ unsigned char sval=(sound_ticks & 1) ? 128-SVOL : 128+SVOL;
+ sound_ticks--;
+ *DAC_LEFT=sval;
+ *DAC_RIGHT=sval;
+ }
+
+ if (!ql_ticks)
+ q40_timer_routine(irq, dev, regs);
+ return IRQ_HANDLED;
}
void q40_sched_init (irqreturn_t (*timer_routine)(int, void *, struct pt_regs *))
{
- int timer_irq;
+ int timer_irq;
- q40_timer_routine = timer_routine;
- timer_irq=Q40_IRQ_FRAME;
+ q40_timer_routine = timer_routine;
+ timer_irq = Q40_IRQ_FRAME;
- if (request_irq(timer_irq, q40_timer_int, 0,
+ if (request_irq(timer_irq, q40_timer_int, 0,
"timer", q40_timer_int))
- panic ("Couldn't register timer int");
+ panic("Couldn't register timer int");
- master_outb(-1,FRAME_CLEAR_REG);
- master_outb( 1,FRAME_RATE_REG);
+ master_outb(-1, FRAME_CLEAR_REG);
+ master_outb( 1, FRAME_RATE_REG);
}
@@ -308,169 +200,132 @@ static int mext_disabled=0; /* ext irq disabled by master chip? */
static int aliased_irq=0; /* how many times inside handler ?*/
-/* got level 2 interrupt, dispatch to ISA or keyboard/timer IRQs */
-irqreturn_t q40_irq2_handler (int vec, void *devname, struct pt_regs *fp)
+/* got interrupt, dispatch to ISA or keyboard/timer IRQs */
+static void q40_irq_handler(unsigned int irq, struct pt_regs *fp)
{
- unsigned mir, mer;
- int irq,i;
+ unsigned mir, mer;
+ int i;
//repeat:
- mir=master_inb(IIRQ_REG);
- if (mir&Q40_IRQ_FRAME_MASK) {
- irq_tab[Q40_IRQ_FRAME].count++;
- irq_tab[Q40_IRQ_FRAME].handler(Q40_IRQ_FRAME,irq_tab[Q40_IRQ_FRAME].dev_id,fp);
- master_outb(-1,FRAME_CLEAR_REG);
- }
- if ((mir&Q40_IRQ_SER_MASK) || (mir&Q40_IRQ_EXT_MASK)) {
- mer=master_inb(EIRQ_REG);
- for (i=0; eirqs[i].mask; i++) {
- if (mer&(eirqs[i].mask)) {
- irq=eirqs[i].irq;
+ mir = master_inb(IIRQ_REG);
+#ifdef CONFIG_BLK_DEV_FD
+ if ((mir & Q40_IRQ_EXT_MASK) &&
+ (master_inb(EIRQ_REG) & Q40_IRQ6_MASK)) {
+ floppy_hardint();
+ return;
+ }
+#endif
+ switch (irq) {
+ case 4:
+ case 6:
+ m68k_handle_int(Q40_IRQ_SAMPLE, fp);
+ return;
+ }
+ if (mir & Q40_IRQ_FRAME_MASK) {
+ m68k_handle_int(Q40_IRQ_FRAME, fp);
+ master_outb(-1, FRAME_CLEAR_REG);
+ }
+ if ((mir & Q40_IRQ_SER_MASK) || (mir & Q40_IRQ_EXT_MASK)) {
+ mer = master_inb(EIRQ_REG);
+ for (i = 0; eirqs[i].mask; i++) {
+ if (mer & eirqs[i].mask) {
+ irq = eirqs[i].irq;
/*
* There is a little mess wrt which IRQ really caused this irq request. The
* main problem is that IIRQ_REG and EIRQ_REG reflect the state when they
* are read - which is long after the request came in. In theory IRQs should
* not just go away but they occassionally do
*/
- if (irq>4 && irq<=15 && mext_disabled) {
- /*aliased_irq++;*/
- goto iirq;
- }
- if (irq_tab[irq].handler == q40_defhand ) {
- printk("handler for IRQ %d not defined\n",irq);
- continue; /* ignore uninited INTs :-( */
- }
- if ( irq_tab[irq].state & IRQ_INPROGRESS ) {
- /* some handlers do local_irq_enable() for irq latency reasons, */
- /* however reentering an active irq handler is not permitted */
+ if (irq > 4 && irq <= 15 && mext_disabled) {
+ /*aliased_irq++;*/
+ goto iirq;
+ }
+ if (q40_state[irq] & IRQ_INPROGRESS) {
+ /* some handlers do local_irq_enable() for irq latency reasons, */
+ /* however reentering an active irq handler is not permitted */
#ifdef IP_USE_DISABLE
- /* in theory this is the better way to do it because it still */
- /* lets through eg the serial irqs, unfortunately it crashes */
- disable_irq(irq);
- disabled=1;
+ /* in theory this is the better way to do it because it still */
+ /* lets through eg the serial irqs, unfortunately it crashes */
+ disable_irq(irq);
+ disabled = 1;
#else
- /*printk("IRQ_INPROGRESS detected for irq %d, disabling - %s disabled\n",irq,disabled ? "already" : "not yet"); */
- fp->sr = (((fp->sr) & (~0x700))+0x200);
- disabled=1;
+ /*printk("IRQ_INPROGRESS detected for irq %d, disabling - %s disabled\n",
+ irq, disabled ? "already" : "not yet"); */
+ fp->sr = (((fp->sr) & (~0x700))+0x200);
+ disabled = 1;
#endif
- goto iirq;
- }
- irq_tab[irq].count++;
- irq_tab[irq].state |= IRQ_INPROGRESS;
- irq_tab[irq].handler(irq,irq_tab[irq].dev_id,fp);
- irq_tab[irq].state &= ~IRQ_INPROGRESS;
-
- /* naively enable everything, if that fails than */
- /* this function will be reentered immediately thus */
- /* getting another chance to disable the IRQ */
-
- if ( disabled ) {
+ goto iirq;
+ }
+ q40_state[irq] |= IRQ_INPROGRESS;
+ m68k_handle_int(irq, fp);
+ q40_state[irq] &= ~IRQ_INPROGRESS;
+
+ /* naively enable everything, if that fails than */
+ /* this function will be reentered immediately thus */
+ /* getting another chance to disable the IRQ */
+
+ if (disabled) {
#ifdef IP_USE_DISABLE
- if (irq>4){
- disabled=0;
- enable_irq(irq);}
+ if (irq > 4) {
+ disabled = 0;
+ enable_irq(irq);
+ }
#else
- disabled=0;
- /*printk("reenabling irq %d\n",irq); */
+ disabled = 0;
+ /*printk("reenabling irq %d\n", irq); */
#endif
- }
+ }
// used to do 'goto repeat;' here, this delayed bh processing too long
- return IRQ_HANDLED;
- }
- }
- if (mer && ccleirq>0 && !aliased_irq)
- printk("ISA interrupt from unknown source? EIRQ_REG = %x\n",mer),ccleirq--;
- }
- iirq:
- mir=master_inb(IIRQ_REG);
- /* should test whether keyboard irq is really enabled, doing it in defhand */
- if (mir&Q40_IRQ_KEYB_MASK) {
- irq_tab[Q40_IRQ_KEYBOARD].count++;
- irq_tab[Q40_IRQ_KEYBOARD].handler(Q40_IRQ_KEYBOARD,irq_tab[Q40_IRQ_KEYBOARD].dev_id,fp);
- }
- return IRQ_HANDLED;
-}
-
-int show_q40_interrupts (struct seq_file *p, void *v)
-{
- int i;
-
- for (i = 0; i <= Q40_IRQ_MAX; i++) {
- if (irq_tab[i].count)
- seq_printf(p, "%sIRQ %02d: %8d %s%s\n",
- (i<=15) ? "ISA-" : " " ,
- i, irq_tab[i].count,
- irq_tab[i].devname[0] ? irq_tab[i].devname : "?",
- irq_tab[i].handler == q40_defhand ?
- " (now unassigned)" : "");
+ return;
+ }
+ }
+ if (mer && ccleirq > 0 && !aliased_irq) {
+ printk("ISA interrupt from unknown source? EIRQ_REG = %x\n",mer);
+ ccleirq--;
+ }
}
- return 0;
-}
-
+ iirq:
+ mir = master_inb(IIRQ_REG);
+ /* should test whether keyboard irq is really enabled, doing it in defhand */
+ if (mir & Q40_IRQ_KEYB_MASK)
+ m68k_handle_int(Q40_IRQ_KEYBOARD, fp);
-static irqreturn_t q40_defhand (int irq, void *dev_id, struct pt_regs *fp)
-{
- if (irq!=Q40_IRQ_KEYBOARD)
- printk ("Unknown q40 interrupt %d\n", irq);
- else master_outb(-1,KEYBOARD_UNLOCK_REG);
- return IRQ_NONE;
+ return;
}
-static irqreturn_t default_handler(int lev, void *dev_id, struct pt_regs *regs)
-{
- printk ("Uninitialised interrupt level %d\n", lev);
- return IRQ_NONE;
-}
-
-irqreturn_t (*q40_default_handler[SYS_IRQS])(int, void *, struct pt_regs *) = {
- [0] = default_handler,
- [1] = default_handler,
- [2] = default_handler,
- [3] = default_handler,
- [4] = default_handler,
- [5] = default_handler,
- [6] = default_handler,
- [7] = default_handler
-};
-
-void q40_enable_irq (unsigned int irq)
+void q40_enable_irq(unsigned int irq)
{
- if ( irq>=5 && irq<=15 )
- {
- mext_disabled--;
- if (mext_disabled>0)
- printk("q40_enable_irq : nested disable/enable\n");
- if (mext_disabled==0)
- master_outb(1,EXT_ENABLE_REG);
- }
+ if (irq >= 5 && irq <= 15) {
+ mext_disabled--;
+ if (mext_disabled > 0)
+ printk("q40_enable_irq : nested disable/enable\n");
+ if (mext_disabled == 0)
+ master_outb(1, EXT_ENABLE_REG);
+ }
}
-void q40_disable_irq (unsigned int irq)
+void q40_disable_irq(unsigned int irq)
{
- /* disable ISA iqs : only do something if the driver has been
- * verified to be Q40 "compatible" - right now IDE, NE2K
- * Any driver should not attempt to sleep across disable_irq !!
- */
-
- if ( irq>=5 && irq<=15 ) {
- master_outb(0,EXT_ENABLE_REG);
- mext_disabled++;
- if (mext_disabled>1) printk("disable_irq nesting count %d\n",mext_disabled);
- }
+ /* disable ISA iqs : only do something if the driver has been
+ * verified to be Q40 "compatible" - right now IDE, NE2K
+ * Any driver should not attempt to sleep across disable_irq !!
+ */
+
+ if (irq >= 5 && irq <= 15) {
+ master_outb(0, EXT_ENABLE_REG);
+ mext_disabled++;
+ if (mext_disabled > 1)
+ printk("disable_irq nesting count %d\n",mext_disabled);
+ }
}
-unsigned long q40_probe_irq_on (void)
+unsigned long q40_probe_irq_on(void)
{
- printk("irq probing not working - reconfigure the driver to avoid this\n");
- return -1;
+ printk("irq probing not working - reconfigure the driver to avoid this\n");
+ return -1;
}
-int q40_probe_irq_off (unsigned long irqs)
+int q40_probe_irq_off(unsigned long irqs)
{
- return -1;
+ return -1;
}
-/*
- * Local variables:
- * compile-command: "m68k-linux-gcc -D__KERNEL__ -I/home/rz/lx/linux-2.2.6/include -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -pipe -fno-strength-reduce -ffixed-a2 -m68040 -c -o q40ints.o q40ints.c"
- * End:
- */
diff --git a/arch/m68k/sun3/config.c b/arch/m68k/sun3/config.c
index f1ca0dfbaa6..d09d03b3d95 100644
--- a/arch/m68k/sun3/config.c
+++ b/arch/m68k/sun3/config.c
@@ -8,7 +8,6 @@
* for more details.
*/
-#include <linux/config.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/mm.h>
@@ -36,7 +35,6 @@ extern char _text, _end;
char sun3_reserved_pmeg[SUN3_PMEGS_NUM];
extern unsigned long sun3_gettimeoffset(void);
-extern int show_sun3_interrupts (struct seq_file *, void *);
extern void sun3_sched_init(irqreturn_t (*handler)(int, void *, struct pt_regs *));
extern void sun3_get_model (char* model);
extern void idprom_init (void);
@@ -147,13 +145,6 @@ void __init config_sun3(void)
mach_sched_init = sun3_sched_init;
mach_init_IRQ = sun3_init_IRQ;
- mach_default_handler = &sun3_default_handler;
- mach_request_irq = sun3_request_irq;
- mach_free_irq = sun3_free_irq;
- enable_irq = sun3_enable_irq;
- disable_irq = sun3_disable_irq;
- mach_process_int = sun3_process_int;
- mach_get_irq_list = show_sun3_interrupts;
mach_reset = sun3_reboot;
mach_gettimeoffset = sun3_gettimeoffset;
mach_get_model = sun3_get_model;
diff --git a/arch/m68k/sun3/prom/init.c b/arch/m68k/sun3/prom/init.c
index 2e6ae56aec1..202adfcc316 100644
--- a/arch/m68k/sun3/prom/init.c
+++ b/arch/m68k/sun3/prom/init.c
@@ -5,7 +5,6 @@
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
*/
-#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/init.h>
diff --git a/arch/m68k/sun3/prom/printf.c b/arch/m68k/sun3/prom/printf.c
index e6ee1006344..e7bfde377b5 100644
--- a/arch/m68k/sun3/prom/printf.c
+++ b/arch/m68k/sun3/prom/printf.c
@@ -8,7 +8,6 @@
* about or use it! It's simple and smelly anyway....
*/
-#include <linux/config.h>
#include <linux/kernel.h>
#include <asm/openprom.h>
diff --git a/arch/m68k/sun3/sun3dvma.c b/arch/m68k/sun3/sun3dvma.c
index f04a1d25f1a..6c265222cbc 100644
--- a/arch/m68k/sun3/sun3dvma.c
+++ b/arch/m68k/sun3/sun3dvma.c
@@ -6,7 +6,6 @@
* Contains common routines for sun3/sun3x DVMA management.
*/
-#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/list.h>
@@ -119,8 +118,7 @@ static inline int refill(void)
if(hole->end == prev->start) {
hole->size += prev->size;
hole->end = prev->end;
- list_del(&(prev->list));
- list_add(&(prev->list), &hole_cache);
+ list_move(&(prev->list), &hole_cache);
ret++;
}
@@ -182,8 +180,7 @@ static inline unsigned long get_baddr(int len, unsigned long align)
#endif
return hole->end;
} else if(hole->size == newlen) {
- list_del(&(hole->list));
- list_add(&(hole->list), &hole_cache);
+ list_move(&(hole->list), &hole_cache);
dvma_entry_use(hole->start) = newlen;
#ifdef DVMA_DEBUG
dvma_allocs++;
diff --git a/arch/m68k/sun3/sun3ints.c b/arch/m68k/sun3/sun3ints.c
index e62a033cd49..f18b9d3ef16 100644
--- a/arch/m68k/sun3/sun3ints.c
+++ b/arch/m68k/sun3/sun3ints.c
@@ -6,7 +6,6 @@
* for more details.
*/
-#include <linux/config.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/sched.h>
@@ -19,7 +18,6 @@
#include <linux/seq_file.h>
extern void sun3_leds (unsigned char);
-static irqreturn_t sun3_inthandle(int irq, void *dev_id, struct pt_regs *fp);
void sun3_disable_interrupts(void)
{
@@ -40,48 +38,30 @@ int led_pattern[8] = {
volatile unsigned char* sun3_intreg;
-void sun3_insert_irq(irq_node_t **list, irq_node_t *node)
-{
-}
-
-void sun3_delete_irq(irq_node_t **list, void *dev_id)
-{
-}
-
void sun3_enable_irq(unsigned int irq)
{
- *sun3_intreg |= (1<<irq);
+ *sun3_intreg |= (1 << irq);
}
void sun3_disable_irq(unsigned int irq)
{
- *sun3_intreg &= ~(1<<irq);
-}
-
-inline void sun3_do_irq(int irq, struct pt_regs *fp)
-{
- kstat_cpu(0).irqs[SYS_IRQS + irq]++;
- *sun3_intreg &= ~(1<<irq);
- *sun3_intreg |= (1<<irq);
+ *sun3_intreg &= ~(1 << irq);
}
static irqreturn_t sun3_int7(int irq, void *dev_id, struct pt_regs *fp)
{
- sun3_do_irq(irq,fp);
- if(!(kstat_cpu(0).irqs[SYS_IRQS + irq] % 2000))
- sun3_leds(led_pattern[(kstat_cpu(0).irqs[SYS_IRQS+irq]%16000)
- /2000]);
+ *sun3_intreg |= (1 << irq);
+ if (!(kstat_cpu(0).irqs[irq] % 2000))
+ sun3_leds(led_pattern[(kstat_cpu(0).irqs[irq] % 16000) / 2000]);
return IRQ_HANDLED;
}
static irqreturn_t sun3_int5(int irq, void *dev_id, struct pt_regs *fp)
{
- kstat_cpu(0).irqs[SYS_IRQS + irq]++;
#ifdef CONFIG_SUN3
intersil_clear();
#endif
- *sun3_intreg &= ~(1<<irq);
- *sun3_intreg |= (1<<irq);
+ *sun3_intreg |= (1 << irq);
#ifdef CONFIG_SUN3
intersil_clear();
#endif
@@ -89,65 +69,8 @@ static irqreturn_t sun3_int5(int irq, void *dev_id, struct pt_regs *fp)
#ifndef CONFIG_SMP
update_process_times(user_mode(fp));
#endif
- if(!(kstat_cpu(0).irqs[SYS_IRQS + irq] % 20))
- sun3_leds(led_pattern[(kstat_cpu(0).irqs[SYS_IRQS+irq]%160)
- /20]);
- return IRQ_HANDLED;
-}
-
-/* handle requested ints, excepting 5 and 7, which always do the same
- thing */
-irqreturn_t (*sun3_default_handler[SYS_IRQS])(int, void *, struct pt_regs *) = {
- [0] = sun3_inthandle,
- [1] = sun3_inthandle,
- [2] = sun3_inthandle,
- [3] = sun3_inthandle,
- [4] = sun3_inthandle,
- [5] = sun3_int5,
- [6] = sun3_inthandle,
- [7] = sun3_int7
-};
-
-static const char *dev_names[SYS_IRQS] = {
- [5] = "timer",
- [7] = "int7 handler"
-};
-static void *dev_ids[SYS_IRQS];
-static irqreturn_t (*sun3_inthandler[SYS_IRQS])(int, void *, struct pt_regs *) = {
- [5] = sun3_int5,
- [7] = sun3_int7
-};
-static irqreturn_t (*sun3_vechandler[SUN3_INT_VECS])(int, void *, struct pt_regs *);
-static void *vec_ids[SUN3_INT_VECS];
-static const char *vec_names[SUN3_INT_VECS];
-static int vec_ints[SUN3_INT_VECS];
-
-
-int show_sun3_interrupts(struct seq_file *p, void *v)
-{
- int i;
-
- for(i = 0; i < (SUN3_INT_VECS-1); i++) {
- if(sun3_vechandler[i] != NULL) {
- seq_printf(p, "vec %3d: %10u %s\n", i+64,
- vec_ints[i],
- (vec_names[i]) ? vec_names[i] :
- "sun3_vechandler");
- }
- }
-
- return 0;
-}
-
-static irqreturn_t sun3_inthandle(int irq, void *dev_id, struct pt_regs *fp)
-{
- if(sun3_inthandler[irq] == NULL)
- panic ("bad interrupt %d received (id %p)\n",irq, dev_id);
-
- kstat_cpu(0).irqs[SYS_IRQS + irq]++;
- *sun3_intreg &= ~(1<<irq);
-
- sun3_inthandler[irq](irq, dev_ids[irq], fp);
+ if (!(kstat_cpu(0).irqs[irq] % 20))
+ sun3_leds(led_pattern[(kstat_cpu(0).irqs[irq] % 160) / 20]);
return IRQ_HANDLED;
}
@@ -157,109 +80,31 @@ static irqreturn_t sun3_vec255(int irq, void *dev_id, struct pt_regs *fp)
return IRQ_HANDLED;
}
-void sun3_init_IRQ(void)
+static void sun3_inthandle(unsigned int irq, struct pt_regs *fp)
{
- int i;
-
- *sun3_intreg = 1;
-
- for(i = 0; i < SYS_IRQS; i++)
- {
- if(dev_names[i])
- cpu_request_irq(i, sun3_default_handler[i], 0,
- dev_names[i], NULL);
- }
-
- for(i = 0; i < 192; i++)
- sun3_vechandler[i] = NULL;
-
- sun3_vechandler[191] = sun3_vec255;
-}
-
-int sun3_request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *),
- unsigned long flags, const char *devname, void *dev_id)
-{
-
- if(irq < SYS_IRQS) {
- if(sun3_inthandler[irq] != NULL) {
- printk("sun3_request_irq: request for irq %d -- already taken!\n", irq);
- return 1;
- }
-
- sun3_inthandler[irq] = handler;
- dev_ids[irq] = dev_id;
- dev_names[irq] = devname;
-
- /* setting devname would be nice */
- cpu_request_irq(irq, sun3_default_handler[irq], 0, devname,
- NULL);
-
- return 0;
- } else {
- if((irq >= 64) && (irq <= 255)) {
- int vec;
-
- vec = irq - 64;
- if(sun3_vechandler[vec] != NULL) {
- printk("sun3_request_irq: request for vec %d -- already taken!\n", irq);
- return 1;
- }
-
- sun3_vechandler[vec] = handler;
- vec_ids[vec] = dev_id;
- vec_names[vec] = devname;
- vec_ints[vec] = 0;
-
- return 0;
- }
- }
-
- printk("sun3_request_irq: invalid irq %d\n", irq);
- return 1;
+ *sun3_intreg &= ~(1 << irq);
+ m68k_handle_int(irq, fp);
}
-void sun3_free_irq(unsigned int irq, void *dev_id)
-{
-
- if(irq < SYS_IRQS) {
- if(sun3_inthandler[irq] == NULL)
- panic("sun3_free_int: attempt to free unused irq %d\n", irq);
- if(dev_ids[irq] != dev_id)
- panic("sun3_free_int: incorrect dev_id for irq %d\n", irq);
-
- sun3_inthandler[irq] = NULL;
- return;
- } else if((irq >= 64) && (irq <= 255)) {
- int vec;
-
- vec = irq - 64;
- if(sun3_vechandler[vec] == NULL)
- panic("sun3_free_int: attempt to free unused vector %d\n", irq);
- if(vec_ids[irq] != dev_id)
- panic("sun3_free_int: incorrect dev_id for vec %d\n", irq);
-
- sun3_vechandler[vec] = NULL;
- return;
- } else {
- panic("sun3_free_irq: invalid irq %d\n", irq);
- }
-}
+static struct irq_controller sun3_irq_controller = {
+ .name = "sun3",
+ .lock = SPIN_LOCK_UNLOCKED,
+ .startup = m68k_irq_startup,
+ .shutdown = m68k_irq_shutdown,
+ .enable = sun3_enable_irq,
+ .disable = sun3_disable_irq,
+};
-irqreturn_t sun3_process_int(int irq, struct pt_regs *regs)
+void sun3_init_IRQ(void)
{
+ *sun3_intreg = 1;
- if((irq >= 64) && (irq <= 255)) {
- int vec;
-
- vec = irq - 64;
- if(sun3_vechandler[vec] == NULL)
- panic ("bad interrupt vector %d received\n",irq);
+ m68k_setup_auto_interrupt(sun3_inthandle);
+ m68k_setup_irq_controller(&sun3_irq_controller, IRQ_AUTO_1, 7);
+ m68k_setup_user_interrupt(VEC_USER, 192, NULL);
- vec_ints[vec]++;
- return sun3_vechandler[vec](irq, vec_ids[vec], regs);
- } else {
- panic("sun3_process_int: unable to handle interrupt vector %d\n",
- irq);
- }
+ request_irq(IRQ_AUTO_5, sun3_int5, 0, "int5", NULL);
+ request_irq(IRQ_AUTO_7, sun3_int7, 0, "int7", NULL);
+ request_irq(IRQ_USER+127, sun3_vec255, 0, "vec255", NULL);
}
diff --git a/arch/m68k/sun3x/config.c b/arch/m68k/sun3x/config.c
index 0920f5d3360..987891783a4 100644
--- a/arch/m68k/sun3x/config.c
+++ b/arch/m68k/sun3x/config.c
@@ -6,7 +6,6 @@
* based on code from Oliver Jowett <oliver@jowett.manawatu.gen.nz>
*/
-#include <linux/config.h>
#include <linux/types.h>
#include <linux/mm.h>
#include <linux/console.h>
@@ -52,17 +51,10 @@ void __init config_sun3x(void)
sun3x_prom_init();
- mach_get_irq_list = show_sun3_interrupts;
mach_max_dma_address = 0xffffffff; /* we can DMA anywhere, whee */
- mach_default_handler = &sun3_default_handler;
mach_sched_init = sun3x_sched_init;
mach_init_IRQ = sun3_init_IRQ;
- enable_irq = sun3_enable_irq;
- disable_irq = sun3_disable_irq;
- mach_request_irq = sun3_request_irq;
- mach_free_irq = sun3_free_irq;
- mach_process_int = sun3_process_int;
mach_gettimeoffset = sun3x_gettimeoffset;
mach_reset = sun3x_reboot;