From 75337fb90e0ef6702c1bb2337334e258f7119b76 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Wed, 9 May 2001 00:32:39 +0000 Subject: Rewrite of Indy IRQs to new style. --- arch/mips/config.in | 1 + arch/mips/defconfig | 1 + arch/mips/defconfig-ip22 | 1 + arch/mips/kernel/Makefile | 1 + arch/mips/kernel/irq.c | 21 +- arch/mips/kernel/old-irq.c | 6 + arch/mips/kernel/setup.c | 14 - arch/mips/sgi/kernel/indy_int.c | 574 +++++++++++++++++----------------------- arch/mips/sgi/kernel/setup.c | 12 - arch/mips/sni/irq.c | 1 - include/asm-mips/hw_irq.h | 19 +- 11 files changed, 288 insertions(+), 363 deletions(-) diff --git a/arch/mips/config.in b/arch/mips/config.in index 5a0a17c57..46c654fa2 100644 --- a/arch/mips/config.in +++ b/arch/mips/config.in @@ -142,6 +142,7 @@ if [ "$CONFIG_SGI_IP22" = "y" ]; then define_bool CONFIG_PC_KEYB y define_bool CONFIG_SGI y define_bool CONFIG_OLD_TIME_C y + define_bool CONFIG_NEW_IRQ y fi if [ "$CONFIG_SNI_RM200_PCI" = "y" ]; then define_bool CONFIG_ARC32 y diff --git a/arch/mips/defconfig b/arch/mips/defconfig index 371fa391f..d0ac0802b 100644 --- a/arch/mips/defconfig +++ b/arch/mips/defconfig @@ -38,6 +38,7 @@ CONFIG_BOARD_SCACHE=y CONFIG_PC_KEYB=y CONFIG_SGI=y CONFIG_OLD_TIME_C=y +CONFIG_NEW_IRQ=y # CONFIG_ISA is not set # CONFIG_EISA is not set # CONFIG_PCI is not set diff --git a/arch/mips/defconfig-ip22 b/arch/mips/defconfig-ip22 index 371fa391f..d0ac0802b 100644 --- a/arch/mips/defconfig-ip22 +++ b/arch/mips/defconfig-ip22 @@ -38,6 +38,7 @@ CONFIG_BOARD_SCACHE=y CONFIG_PC_KEYB=y CONFIG_SGI=y CONFIG_OLD_TIME_C=y +CONFIG_NEW_IRQ=y # CONFIG_ISA is not set # CONFIG_EISA is not set # CONFIG_PCI is not set diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile index 94917f676..f22c94f39 100644 --- a/arch/mips/kernel/Makefile +++ b/arch/mips/kernel/Makefile @@ -42,6 +42,7 @@ endif # Old style irq support, going to die in 2.5. export-objs += old-irq.o +obj-$(CONFIG_NEW_IRQ) += irq.o obj-$(CONFIG_ROTTEN_IRQ) += old-irq.o # transition from old time.c to new time.c diff --git a/arch/mips/kernel/irq.c b/arch/mips/kernel/irq.c index ba73db690..7a779e2dd 100644 --- a/arch/mips/kernel/irq.c +++ b/arch/mips/kernel/irq.c @@ -76,6 +76,9 @@ int get_irq_list(char *buf) int i; p += sprintf(p, " "); + for (i=0; i < 1 /*smp_num_cpus*/; i++) + p += sprintf(p, "CPU%d ", i); + *p++ = '\n'; for (i = 0 ; i < NR_IRQS ; i++) { action = irq_desc[i].action; @@ -182,10 +185,6 @@ void disable_irq(unsigned int irq) } } -void disable_irq(unsigned int irq) -{ -} - /** * enable_irq - enable interrupt handling on an irq * @irq: Interrupt to enable @@ -228,7 +227,7 @@ void enable_irq(unsigned int irq) * SMP cross-CPU interrupts have their own specific * handlers). */ -asmlinkage unsigned int do_IRQ(int irq, struct pt_regs regs) +asmlinkage unsigned int do_IRQ(int irq, struct pt_regs *regs) { /* * We ack quickly, we don't want the irq controller @@ -694,3 +693,15 @@ int setup_irq(unsigned int irq, struct irqaction * new) /* register_irq_proc(irq); */ return 0; } + +void __init init_generic_irq(void) +{ + int i; + + for (i = 0; i < NR_IRQS; i++) { + irq_desc[i].status = IRQ_DISABLED; + irq_desc[i].action = NULL; + irq_desc[i].depth = 1; + irq_desc[i].handler = &no_irq_type; + } +} diff --git a/arch/mips/kernel/old-irq.c b/arch/mips/kernel/old-irq.c index a13948d32..a5dfa2542 100644 --- a/arch/mips/kernel/old-irq.c +++ b/arch/mips/kernel/old-irq.c @@ -33,6 +33,12 @@ #include #include +/* + * The board specific setup routine sets irq_setup to point to a board + * specific setup routine. + */ +void (*irq_setup)(void); + /* * Linux has a controller-independent x86 interrupt architecture. * every controller has a 'controller-template', that is used diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index ac15aae33..ce3016c55 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c @@ -100,12 +100,6 @@ static char command_line[COMMAND_LINE_SIZE]; char saved_command_line[COMMAND_LINE_SIZE]; extern char arcs_cmdline[COMMAND_LINE_SIZE]; -/* - * The board specific setup routine sets irq_setup to point to a board - * specific setup routine. - */ -void (*irq_setup)(void); - /* * mips_io_port_base is the begin of the address space to which x86 style * I/O ports are mapped. @@ -420,11 +414,6 @@ init_arch(int argc, char **argv, char **envp, int *prom_vec) start_kernel(); } -static void __init default_irq_setup(void) -{ - panic("Unknown machtype in init_IRQ"); -} - void __init add_memory_region(unsigned long start, unsigned long size, long type) { @@ -536,9 +525,6 @@ void __init setup_arch(char **cmdline_p) int i; - /* Save defaults for configuration-dependent routines. */ - irq_setup = default_irq_setup; - #ifdef CONFIG_BLK_DEV_FD fd_ops = &no_fd_ops; #endif diff --git a/arch/mips/sgi/kernel/indy_int.c b/arch/mips/sgi/kernel/indy_int.c index fdacd8722..971a96557 100644 --- a/arch/mips/sgi/kernel/indy_int.c +++ b/arch/mips/sgi/kernel/indy_int.c @@ -78,387 +78,301 @@ unsigned long spurious_count = 0; * 16 --> 23 == vectored level 2 interrupts * 24 --> 31 == vectored level 3 interrupts (not used) */ -void disable_local_irq(unsigned int irq_nr) +static void enable_local0_irq(unsigned int irq) { unsigned long flags; save_and_cli(flags); - switch(irq_nr) { - case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: - ioc_icontrol->imask0 &= ~(1 << irq_nr); - break; - - case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: - ioc_icontrol->imask1 &= ~(1 << (irq_nr - 8)); - break; - - case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23: - ioc_icontrol->cmeimask0 &= ~(1 << (irq_nr - 16)); - break; - - default: - /* This way we'll see if anyone would ever want vectored - * level 3 interrupts. Highly unlikely. - */ - printk("Yeeee, got passed irq_nr %d at disable_irq\n", irq_nr); - panic("INVALID IRQ level!"); - }; + ioc_icontrol->imask0 |= (1 << (irq - SGINT_LOCAL0)); restore_flags(flags); } -void enable_local_irq(unsigned int irq_nr) +static unsigned int startup_local0_irq(unsigned int irq) +{ + enable_local0_irq(irq); + + return 0; /* Never anything pending */ +} + +static void disable_local0_irq(unsigned int irq) { unsigned long flags; + save_and_cli(flags); - switch(irq_nr) { - case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: - ioc_icontrol->imask0 |= (1 << irq_nr); - break; - - case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: - ioc_icontrol->imask1 |= (1 << (irq_nr - 8)); - break; - - case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23: - enable_local_irq(7); - ioc_icontrol->cmeimask0 |= (1 << (irq_nr - 16)); - break; - - default: - printk("Yeeee, got passed irq_nr %d at disable_irq\n", irq_nr); - panic("INVALID IRQ level!"); - }; + ioc_icontrol->imask0 &= ~(1 << (irq - SGINT_LOCAL0)); restore_flags(flags); } -void disable_gio_irq(unsigned int irq_nr) +#define shutdown_local0_irq disable_local0_irq +#define mask_and_ack_local0_irq disable_local0_irq + +static void end_local0_irq (unsigned int irq) { - /* XXX TODO XXX */ + if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) + enable_local0_irq(irq); } -void enable_gio_irq(unsigned int irq_nr) +static struct hw_interrupt_type ip22_local0_irq_type = { + "IP22 local 0", + startup_local0_irq, + shutdown_local0_irq, + enable_local0_irq, + disable_local0_irq, + mask_and_ack_local0_irq, + end_local0_irq, + NULL +}; + +static void enable_local1_irq(unsigned int irq) { - /* XXX TODO XXX */ + unsigned long flags; + + save_and_cli(flags); + ioc_icontrol->imask1 |= (1 << (irq - SGINT_LOCAL1)); } -void disable_hpcdma_irq(unsigned int irq_nr) +static unsigned int startup_local1_irq(unsigned int irq) { - /* XXX TODO XXX */ + enable_local1_irq(irq); + + return 0; /* Never anything pending */ } -void enable_hpcdma_irq(unsigned int irq_nr) +void disable_local1_irq(unsigned int irq) { - /* XXX TODO XXX */ + unsigned long flags; + + save_and_cli(flags); + ioc_icontrol->imask1 &= ~(1 << (irq- SGINT_LOCAL1)); + restore_flags(flags); } -void disable_irq(unsigned int irq_nr) +#define shutdown_local1_irq disable_local1_irq +#define mask_and_ack_local1_irq disable_local1_irq + +static void end_local1_irq (unsigned int irq) { - unsigned int n = irq_nr; - if(n >= SGINT_END) { - printk("whee, invalid irq_nr %d\n", irq_nr); - panic("IRQ, you lose..."); - } - if(n >= SGINT_LOCAL0 && n < SGINT_GIO) { - disable_local_irq(n - SGINT_LOCAL0); - } else if(n >= SGINT_GIO && n < SGINT_HPCDMA) { - disable_gio_irq(n - SGINT_GIO); - } else if(n >= SGINT_HPCDMA && n < SGINT_END) { - disable_hpcdma_irq(n - SGINT_HPCDMA); - } else { - panic("how did I get here?"); - } + if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) + enable_local1_irq(irq); } -void enable_irq(unsigned int irq_nr) +static struct hw_interrupt_type ip22_local1_irq_type = { + "IP22 local 1", + startup_local1_irq, + shutdown_local1_irq, + enable_local1_irq, + disable_local1_irq, + mask_and_ack_local1_irq, + end_local1_irq, + NULL +}; + +static void enable_local2_irq(unsigned int irq) { - unsigned int n = irq_nr; - if(n >= SGINT_END) { - printk("whee, invalid irq_nr %d\n", irq_nr); - panic("IRQ, you lose..."); - } - if(n >= SGINT_LOCAL0 && n < SGINT_GIO) { - enable_local_irq(n - SGINT_LOCAL0); - } else if(n >= SGINT_GIO && n < SGINT_HPCDMA) { - enable_gio_irq(n - SGINT_GIO); - } else if(n >= SGINT_HPCDMA && n < SGINT_END) { - enable_hpcdma_irq(n - SGINT_HPCDMA); - } else { - panic("how did I get here?"); - } + unsigned long flags; + + save_and_cli(flags); + enable_local0_irq(7); + ioc_icontrol->cmeimask0 |= (1 << (irq - SGINT_LOCAL2)); + restore_flags(flags); } -#if 0 -/* - * Currently unused. - */ -static void local_unex(int irq, void *data, struct pt_regs *regs) +static unsigned int startup_local2_irq(unsigned int irq) { - printk("Whee: unexpected local IRQ at %08lx\n", - (unsigned long) regs->cp0_epc); - printk("DUMP: stat0<%x> stat1<%x> vmeistat<%x>\n", - ioc_icontrol->istat0, ioc_icontrol->istat1, - ioc_icontrol->vmeistat); -} -#endif + enable_local2_irq(irq); -static struct irqaction *local_irq_action[24] = { - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL -}; + return 0; /* Never anything pending */ +} -int setup_indy_irq(int irq, struct irqaction * new) +void disable_local2_irq(unsigned int irq) { - printk("setup_indy_irq: Yeee, don't know how to setup irq<%d> for %s %p\n", - irq, new->name, new->handler); - return 0; + unsigned long flags; + + save_and_cli(flags); + ioc_icontrol->cmeimask0 &= ~(1 << (irq - SGINT_LOCAL2)); + restore_flags(flags); } -static struct irqaction r4ktimer_action = { - NULL, 0, 0, "R4000 timer/counter", NULL, NULL, -}; +#define shutdown_local2_irq disable_local2_irq +#define mask_and_ack_local2_irq disable_local2_irq -static struct irqaction indy_berr_action = { - NULL, 0, 0, "IP22 Bus Error", NULL, NULL, -}; +static void end_local2_irq (unsigned int irq) +{ + if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) + enable_local2_irq(irq); +} -static struct irqaction *irq_action[16] = { - NULL, NULL, NULL, NULL, - NULL, NULL, &indy_berr_action, &r4ktimer_action, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL +static struct hw_interrupt_type ip22_local2_irq_type = { + "IP22 local 2", + startup_local2_irq, + shutdown_local2_irq, + enable_local2_irq, + disable_local2_irq, + mask_and_ack_local2_irq, + end_local2_irq, + NULL }; -int get_irq_list(char *buf) +static void enable_local3_irq(unsigned int irq) { - int i, len = 0; - int num = 0; - struct irqaction * action; - - for (i = 0 ; i < 16 ; i++, num++) { - action = irq_action[i]; - if (!action) - continue; - len += sprintf(buf+len, "%2d: %8d %c %s", - num, kstat.irqs[0][num], - (action->flags & SA_INTERRUPT) ? '+' : ' ', - action->name); - for (action=action->next; action; action = action->next) { - len += sprintf(buf+len, ",%s %s", - (action->flags & SA_INTERRUPT) ? " +" : "", - action->name); - } - len += sprintf(buf+len, " [on-chip]\n"); - } - for (i = 0 ; i < 24 ; i++, num++) { - action = local_irq_action[i]; - if (!action) - continue; - len += sprintf(buf+len, "%2d: %8d %c %s", - num, kstat.irqs[0][num], - (action->flags & SA_INTERRUPT) ? '+' : ' ', - action->name); - for (action=action->next; action; action = action->next) { - len += sprintf(buf+len, ",%s %s", - (action->flags & SA_INTERRUPT) ? " +" : "", - action->name); - } - len += sprintf(buf+len, " [local]\n"); - } - return len; + unsigned long flags; + + save_and_cli(flags); + printk("Yeeee, got passed irq_nr %d at disable_irq\n", irq); + panic("INVALID IRQ level!"); + restore_flags(flags); } -/* - * do_IRQ handles IRQ's that have been installed without the - * SA_INTERRUPT flag: it uses the full signal-handling return - * and runs with other interrupts enabled. All relatively slow - * IRQ's should use this format: notably the keyboard/timer - * routines. - */ -asmlinkage void do_IRQ(int irq, struct pt_regs * regs) +static unsigned int startup_local3_irq(unsigned int irq) { - struct irqaction *action; - int do_random, cpu; + enable_local3_irq(irq); - cpu = smp_processor_id(); - irq_enter(cpu, irq); - kstat.irqs[0][irq]++; + return 0; /* Never anything pending */ +} - printk("Got irq %d, press a key.", irq); - prom_getchar(); - romvec->imode(); +void disable_local3_irq(unsigned int irq) +{ + unsigned long flags; + save_and_cli(flags); /* - * mask and ack quickly, we don't want the irq controller - * thinking we're snobs just because some other CPU has - * disabled global interrupts (we have already done the - * INT_ACK cycles, it's too late to try to pretend to the - * controller that we aren't taking the interrupt). - * - * Commented out because we've already done this in the - * machinespecific part of the handler. It's reasonable to - * do this here in a highlevel language though because that way - * we could get rid of a good part of duplicated code ... + * This way we'll see if anyone would ever want vectored level 3 + * interrupts. Highly unlikely. */ - /* mask_and_ack_irq(irq); */ - - action = *(irq + irq_action); - if (action) { - if (!(action->flags & SA_INTERRUPT)) - __sti(); - action = *(irq + irq_action); - do_random = 0; - do { - do_random |= action->flags; - action->handler(irq, action->dev_id, regs); - action = action->next; - } while (action); - if (do_random & SA_SAMPLE_RANDOM) - add_interrupt_randomness(irq); - __cli(); - } - irq_exit(cpu, irq); + printk("Yeeee, got passed irq_nr %d at disable_irq\n", irq); + panic("INVALID IRQ level!"); + restore_flags(flags); +} + +#define shutdown_local3_irq disable_local3_irq +#define mask_and_ack_local3_irq disable_local3_irq - /* unmasking and bottom half handling is done magically for us. */ +static void end_local3_irq (unsigned int irq) +{ + if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) + enable_local3_irq(irq); } -int request_local_irq(unsigned int lirq, void (*func)(int, void *, struct pt_regs *), - unsigned long iflags, const char *dname, void *devid) +static struct hw_interrupt_type ip22_local3_irq_type = { + "IP22 local 3", + startup_local3_irq, + shutdown_local3_irq, + enable_local3_irq, + disable_local3_irq, + mask_and_ack_local3_irq, + end_local3_irq, + NULL +}; + +void enable_gio_irq(unsigned int irq) { - struct irqaction *action; - - lirq -= SGINT_LOCAL0; - if(lirq >= 24 || !func) - return -EINVAL; - - action = (struct irqaction *)kmalloc(sizeof(struct irqaction), GFP_KERNEL); - if(!action) - return -ENOMEM; - - action->handler = func; - action->flags = iflags; - action->mask = 0; - action->name = dname; - action->dev_id = devid; - action->next = 0; - local_irq_action[lirq] = action; - enable_irq(lirq + SGINT_LOCAL0); - return 0; + /* XXX TODO XXX */ } -void free_local_irq(unsigned int lirq, void *dev_id) +static unsigned int startup_gio_irq(unsigned int irq) { - struct irqaction *action; + enable_gio_irq(irq); - lirq -= SGINT_LOCAL0; - if(lirq >= 24) { - printk("Aieee: trying to free bogus local irq %d\n", - lirq + SGINT_LOCAL0); - return; - } - action = local_irq_action[lirq]; - local_irq_action[lirq] = NULL; - disable_irq(lirq + SGINT_LOCAL0); - kfree(action); + return 0; /* Never anything pending */ } -int request_irq(unsigned int irq, - void (*handler)(int, void *, struct pt_regs *), - unsigned long irqflags, - const char * devname, - void *dev_id) +void disable_gio_irq(unsigned int irq) { - int retval; - struct irqaction * action; + /* XXX TODO XXX */ +} - if (irq >= SGINT_END) - return -EINVAL; - if (!handler) - return -EINVAL; +#define shutdown_gio_irq disable_gio_irq +#define mask_and_ack_gio_irq disable_gio_irq - if((irq >= SGINT_LOCAL0) && (irq < SGINT_GIO)) - return request_local_irq(irq, handler, irqflags, devname, dev_id); +static void end_gio_irq (unsigned int irq) +{ + if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) + enable_gio_irq(irq); +} - action = (struct irqaction *)kmalloc(sizeof(struct irqaction), GFP_KERNEL); - if (!action) - return -ENOMEM; +static struct hw_interrupt_type ip22_gio_irq_type = { + "IP22 GIO", + startup_gio_irq, + shutdown_gio_irq, + enable_gio_irq, + disable_gio_irq, + mask_and_ack_gio_irq, + end_gio_irq, + NULL +}; - action->handler = handler; - action->flags = irqflags; - action->mask = 0; - action->name = devname; - action->next = NULL; - action->dev_id = dev_id; +void enable_hpcdma_irq(unsigned int irq) +{ + /* XXX TODO XXX */ +} - retval = setup_indy_irq(irq, action); +static unsigned int startup_hpcdma_irq(unsigned int irq) +{ + enable_hpcdma_irq(irq); - if (retval) - kfree(action); - return retval; + return 0; /* Never anything pending */ } - -void free_irq(unsigned int irq, void *dev_id) -{ - struct irqaction * action, **p; - unsigned long flags; - if (irq >= SGINT_END) { - printk("Trying to free IRQ%d\n",irq); - return; - } - if((irq >= SGINT_LOCAL0) && (irq < SGINT_GIO)) { - free_local_irq(irq, dev_id); - return; - } - for (p = irq + irq_action; (action = *p) != NULL; p = &action->next) { - if (action->dev_id != dev_id) - continue; - - /* Found it - now free it */ - save_and_cli(flags); - *p = action->next; - restore_flags(flags); - kfree(action); - return; - } - printk("Trying to free free IRQ%d\n",irq); +void disable_hpcdma_irq(unsigned int irq) +{ + /* XXX TODO XXX */ } -void __init init_IRQ(void) +#define shutdown_hpcdma_irq disable_hpcdma_irq +#define mask_and_ack_hpcdma_irq disable_hpcdma_irq + +static void end_hpcdma_irq (unsigned int irq) { - irq_setup(); + if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) + enable_hpcdma_irq(irq); } +static struct hw_interrupt_type ip22_hpcdma_irq_type = { + "IP22 HPC DMA", + startup_hpcdma_irq, + shutdown_hpcdma_irq, + enable_hpcdma_irq, + disable_hpcdma_irq, + mask_and_ack_hpcdma_irq, + end_hpcdma_irq, + NULL +}; + +static struct irqaction r4ktimer_action = { + NULL, 0, 0, "R4000 timer/counter", NULL, NULL, +}; + +static struct irqaction indy_berr_action = { + NULL, 0, 0, "IP22 Bus Error", NULL, NULL, +}; + +static struct irqaction *irq_action[16] = { + NULL, NULL, NULL, NULL, + NULL, NULL, &indy_berr_action, &r4ktimer_action, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL +}; + void indy_local0_irqdispatch(struct pt_regs *regs) { - struct irqaction *action; unsigned char mask = ioc_icontrol->istat0; unsigned char mask2 = 0; - int irq, cpu = smp_processor_id();; + int irq; mask &= ioc_icontrol->imask0; - if(mask & ISTAT0_LIO2) { + if (mask & ISTAT0_LIO2) { mask2 = ioc_icontrol->vmeistat; mask2 &= ioc_icontrol->cmeimask0; irq = lc2msk_to_irqnr[mask2]; - action = local_irq_action[irq]; } else { irq = lc0msk_to_irqnr[mask]; - action = local_irq_action[irq]; } /* if irq == 0, then the interrupt has already been cleared */ - if ( irq == 0 ) { goto end; } - /* if action == NULL, then we do have a handler for the irq */ - if ( action == NULL ) { goto no_handler; } - - irq_enter(cpu, irq); - kstat.irqs[0][irq + 16]++; - action->handler(irq, action->dev_id, regs); - irq_exit(cpu, irq); + if (irq == 0) + goto end; + + do_IRQ(irq, regs); goto end; no_handler: @@ -470,10 +384,9 @@ end: void indy_local1_irqdispatch(struct pt_regs *regs) { - struct irqaction *action; unsigned char mask = ioc_icontrol->istat1; unsigned char mask2 = 0; - int irq, cpu = smp_processor_id();; + int irq; mask &= ioc_icontrol->imask1; if (mask & ISTAT1_LIO3) { @@ -481,21 +394,16 @@ void indy_local1_irqdispatch(struct pt_regs *regs) mask2 = ioc_icontrol->vmeistat; mask2 &= ioc_icontrol->cmeimask1; irq = lc3msk_to_irqnr[ioc_icontrol->vmeistat]; - action = local_irq_action[irq]; } else { irq = lc1msk_to_irqnr[mask]; - action = local_irq_action[irq]; } + /* if irq == 0, then the interrupt has already been cleared */ /* not sure if it is needed here, but it is needed for local0 */ - if ( irq == 0 ) { goto end; } - /* if action == NULL, then we do have a handler for the irq */ - if ( action == NULL ) { goto no_handler; } - - irq_enter(cpu, irq); - kstat.irqs[0][irq + 24]++; - action->handler(irq, action->dev_id, regs); - irq_exit(cpu, irq); + if (irq == 0) + goto end; + + do_IRQ(irq, regs); goto end; no_handler: @@ -519,18 +427,7 @@ void indy_buserror_irq(struct pt_regs *regs) irq_exit(cpu, irq); } -/* Misc. crap just to keep the kernel linking... */ -unsigned long probe_irq_on (void) -{ - return 0; -} - -int probe_irq_off (unsigned long irqs) -{ - return 0; -} - -void __init sgint_init(void) +void __init init_IRQ(void) { int i; @@ -538,43 +435,43 @@ void __init sgint_init(void) sgi_i3regs = (struct sgi_int3_regs *) (KSEG1 + SGI_INT3_BASE); /* Init local mask --> irq tables. */ - for(i = 0; i < 256; i++) { - if(i & 0x80) { + for (i = 0; i < 256; i++) { + if (i & 0x80) { lc0msk_to_irqnr[i] = 7; lc1msk_to_irqnr[i] = 15; lc2msk_to_irqnr[i] = 23; lc3msk_to_irqnr[i] = 31; - } else if(i & 0x40) { + } else if (i & 0x40) { lc0msk_to_irqnr[i] = 6; lc1msk_to_irqnr[i] = 14; lc2msk_to_irqnr[i] = 22; lc3msk_to_irqnr[i] = 30; - } else if(i & 0x20) { + } else if (i & 0x20) { lc0msk_to_irqnr[i] = 5; lc1msk_to_irqnr[i] = 13; lc2msk_to_irqnr[i] = 21; lc3msk_to_irqnr[i] = 29; - } else if(i & 0x10) { + } else if (i & 0x10) { lc0msk_to_irqnr[i] = 4; lc1msk_to_irqnr[i] = 12; lc2msk_to_irqnr[i] = 20; lc3msk_to_irqnr[i] = 28; - } else if(i & 0x08) { + } else if (i & 0x08) { lc0msk_to_irqnr[i] = 3; lc1msk_to_irqnr[i] = 11; lc2msk_to_irqnr[i] = 19; lc3msk_to_irqnr[i] = 27; - } else if(i & 0x04) { + } else if (i & 0x04) { lc0msk_to_irqnr[i] = 2; lc1msk_to_irqnr[i] = 10; lc2msk_to_irqnr[i] = 18; lc3msk_to_irqnr[i] = 26; - } else if(i & 0x02) { + } else if (i & 0x02) { lc0msk_to_irqnr[i] = 1; lc1msk_to_irqnr[i] = 9; lc2msk_to_irqnr[i] = 17; lc3msk_to_irqnr[i] = 25; - } else if(i & 0x01) { + } else if (i & 0x01) { lc0msk_to_irqnr[i] = 0; lc1msk_to_irqnr[i] = 8; lc2msk_to_irqnr[i] = 16; @@ -604,6 +501,29 @@ void __init sgint_init(void) ioc_icontrol->cmeimask0 = 0; ioc_icontrol->cmeimask1 = 0; - /* Now safe to set the exception vector. */ set_except_vector(0, indyIRQ); + + init_generic_irq(); + + for (i = SGINT_LOCAL0; i < SGINT_END; i++) { + hw_irq_controller *handler; + + if (i < SGINT_LOCAL1) + handler = &ip22_local0_irq_type; + else if (i < SGINT_LOCAL2) + handler = &ip22_local1_irq_type; + else if (i < SGINT_LOCAL3) + handler = &ip22_local2_irq_type; + else if (i < SGINT_GIO) + handler = &ip22_local3_irq_type; + else if (i < SGINT_HPCDMA) + handler = &ip22_gio_irq_type; + else if (i < SGINT_END) + handler = &ip22_hpcdma_irq_type; + + irq_desc[i].status = IRQ_DISABLED; + irq_desc[i].action = 0; + irq_desc[i].depth = 1; + irq_desc[i].handler = handler; + } } diff --git a/arch/mips/sgi/kernel/setup.c b/arch/mips/sgi/kernel/setup.c index 898e242bf..f4ae5862d 100644 --- a/arch/mips/sgi/kernel/setup.c +++ b/arch/mips/sgi/kernel/setup.c @@ -117,17 +117,6 @@ struct kbd_ops sgi_kbd_ops = { sgi_read_status }; -static void __init sgi_irq_setup(void) -{ - sgint_init(); - -#ifdef CONFIG_REMOTE_DEBUG - if (remote_debug) - set_debug_traps(); - breakpoint(); /* you may move this line to whereever you want :-) */ -#endif -} - void (*board_time_init)(struct irqaction *irq); static unsigned long dosample(volatile unsigned char *tcwp, @@ -234,7 +223,6 @@ void __init sgi_setup(void) char *kgdb_ttyd; #endif - irq_setup = sgi_irq_setup; board_time_init = sgi_time_init; /* Init the INDY HPC I/O controller. Need to call this before diff --git a/arch/mips/sni/irq.c b/arch/mips/sni/irq.c index 8af85d13f..016cdf74e 100644 --- a/arch/mips/sni/irq.c +++ b/arch/mips/sni/irq.c @@ -20,7 +20,6 @@ spinlock_t pciasic_lock = SPIN_LOCK_UNLOCKED; extern asmlinkage void sni_rm200_pci_handle_int(void); extern void do_IRQ(int irq, struct pt_regs *regs); -extern void i8259_do_irq(int irq, struct pt_regs *regs); static void enable_pciasic_irq(unsigned int irq); diff --git a/include/asm-mips/hw_irq.h b/include/asm-mips/hw_irq.h index 1bf6629b4..8dfa57d9b 100644 --- a/include/asm-mips/hw_irq.h +++ b/include/asm-mips/hw_irq.h @@ -1,5 +1,16 @@ -/* This exists merely to satisfy . There is - nothing that would go here of general interest. +/* + * 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. + * + * Copyright (C) 2000, 2001 by Ralf Baechle + */ +#ifndef _ASM_HW_IRQ_H +#define _ASM_HW_IRQ_H - Everything of consequence is in arch/alpha/kernel/irq_impl.h, - to be used only in arch/alpha/kernel/. */ +/* This may not be apropriate for all machines, we'll see ... */ +static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) +{ +} + +#endif /* _ASM_HW_IRQ_H */ -- cgit v1.2.3