d1bef4ed5f
This patch-queue improves the generic IRQ layer to be truly generic, by adding various abstractions and features to it, without impacting existing functionality. While the queue can be best described as "fix and improve everything in the generic IRQ layer that we could think of", and thus it consists of many smaller features and lots of cleanups, the one feature that stands out most is the new 'irq chip' abstraction. The irq-chip abstraction is about describing and coding and IRQ controller driver by mapping its raw hardware capabilities [and quirks, if needed] in a straightforward way, without having to think about "IRQ flow" (level/edge/etc.) type of details. This stands in contrast with the current 'irq-type' model of genirq architectures, which 'mixes' raw hardware capabilities with 'flow' details. The patchset supports both types of irq controller designs at once, and converts i386 and x86_64 to the new irq-chip design. As a bonus side-effect of the irq-chip approach, chained interrupt controllers (master/slave PIC constructs, etc.) are now supported by design as well. The end result of this patchset intends to be simpler architecture-level code and more consolidation between architectures. We reused many bits of code and many concepts from Russell King's ARM IRQ layer, the merging of which was one of the motivations for this patchset. This patch: rename desc->handler to desc->chip. Originally i did not want to do this, because it's a big patch. But having both "desc->handler", "desc->handle_irq" and "action->handler" caused a large degree of confusion and made the code appear alot less clean than it truly is. I have also attempted a dual approach as well by introducing a desc->chip alias - but that just wasnt robust enough and broke frequently. So lets get over with this quickly. The conversion was done automatically via scripts and converts all the code in the kernel. This renaming patch is the first one amongst the patches, so that the remaining patches can stay flexible and can be merged and split up without having some big monolithic patch act as a merge barrier. [akpm@osdl.org: build fix] [akpm@osdl.org: another build fix] Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
116 lines
2.9 KiB
C
116 lines
2.9 KiB
C
/*
|
|
* Interrupt handing routines for NEC VR4100 series.
|
|
*
|
|
* Copyright (C) 2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*/
|
|
#include <linux/interrupt.h>
|
|
#include <linux/module.h>
|
|
|
|
#include <asm/irq_cpu.h>
|
|
#include <asm/system.h>
|
|
#include <asm/vr41xx/vr41xx.h>
|
|
|
|
typedef struct irq_cascade {
|
|
int (*get_irq)(unsigned int, struct pt_regs *);
|
|
} irq_cascade_t;
|
|
|
|
static irq_cascade_t irq_cascade[NR_IRQS] __cacheline_aligned;
|
|
|
|
static struct irqaction cascade_irqaction = {
|
|
.handler = no_action,
|
|
.mask = CPU_MASK_NONE,
|
|
.name = "cascade",
|
|
};
|
|
|
|
int cascade_irq(unsigned int irq, int (*get_irq)(unsigned int, struct pt_regs *))
|
|
{
|
|
int retval = 0;
|
|
|
|
if (irq >= NR_IRQS)
|
|
return -EINVAL;
|
|
|
|
if (irq_cascade[irq].get_irq != NULL)
|
|
free_irq(irq, NULL);
|
|
|
|
irq_cascade[irq].get_irq = get_irq;
|
|
|
|
if (get_irq != NULL) {
|
|
retval = setup_irq(irq, &cascade_irqaction);
|
|
if (retval < 0)
|
|
irq_cascade[irq].get_irq = NULL;
|
|
}
|
|
|
|
return retval;
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(cascade_irq);
|
|
|
|
static void irq_dispatch(unsigned int irq, struct pt_regs *regs)
|
|
{
|
|
irq_cascade_t *cascade;
|
|
irq_desc_t *desc;
|
|
|
|
if (irq >= NR_IRQS) {
|
|
atomic_inc(&irq_err_count);
|
|
return;
|
|
}
|
|
|
|
cascade = irq_cascade + irq;
|
|
if (cascade->get_irq != NULL) {
|
|
unsigned int source_irq = irq;
|
|
desc = irq_desc + source_irq;
|
|
desc->chip->ack(source_irq);
|
|
irq = cascade->get_irq(irq, regs);
|
|
if (irq < 0)
|
|
atomic_inc(&irq_err_count);
|
|
else
|
|
irq_dispatch(irq, regs);
|
|
desc->chip->end(source_irq);
|
|
} else
|
|
do_IRQ(irq, regs);
|
|
}
|
|
|
|
asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
|
|
{
|
|
unsigned int pending = read_c0_cause() & read_c0_status() & ST0_IM;
|
|
|
|
if (pending & CAUSEF_IP7)
|
|
do_IRQ(7, regs);
|
|
else if (pending & 0x7800) {
|
|
if (pending & CAUSEF_IP3)
|
|
irq_dispatch(3, regs);
|
|
else if (pending & CAUSEF_IP4)
|
|
irq_dispatch(4, regs);
|
|
else if (pending & CAUSEF_IP5)
|
|
irq_dispatch(5, regs);
|
|
else if (pending & CAUSEF_IP6)
|
|
irq_dispatch(6, regs);
|
|
} else if (pending & CAUSEF_IP2)
|
|
irq_dispatch(2, regs);
|
|
else if (pending & CAUSEF_IP0)
|
|
do_IRQ(0, regs);
|
|
else if (pending & CAUSEF_IP1)
|
|
do_IRQ(1, regs);
|
|
else
|
|
spurious_interrupt(regs);
|
|
}
|
|
|
|
void __init arch_init_irq(void)
|
|
{
|
|
mips_cpu_irq_init(MIPS_CPU_IRQ_BASE);
|
|
}
|