2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
* linux/arch/alpha/kernel/irq_pyxis.c
|
|
|
|
*
|
|
|
|
* Based on code written by David A Rusling (david.rusling@reo.mts.dec.com).
|
|
|
|
*
|
|
|
|
* IRQ Code common to all PYXIS core logic chips.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/sched.h>
|
|
|
|
#include <linux/irq.h>
|
|
|
|
|
|
|
|
#include <asm/io.h>
|
|
|
|
#include <asm/core_cia.h>
|
|
|
|
|
|
|
|
#include "proto.h"
|
|
|
|
#include "irq_impl.h"
|
|
|
|
|
|
|
|
|
|
|
|
/* Note mask bit is true for ENABLED irqs. */
|
|
|
|
static unsigned long cached_irq_mask;
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
pyxis_update_irq_hw(unsigned long mask)
|
|
|
|
{
|
|
|
|
*(vulp)PYXIS_INT_MASK = mask;
|
|
|
|
mb();
|
|
|
|
*(vulp)PYXIS_INT_MASK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
pyxis_enable_irq(unsigned int irq)
|
|
|
|
{
|
|
|
|
pyxis_update_irq_hw(cached_irq_mask |= 1UL << (irq - 16));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
pyxis_disable_irq(unsigned int irq)
|
|
|
|
{
|
|
|
|
pyxis_update_irq_hw(cached_irq_mask &= ~(1UL << (irq - 16)));
|
|
|
|
}
|
|
|
|
|
|
|
|
static unsigned int
|
|
|
|
pyxis_startup_irq(unsigned int irq)
|
|
|
|
{
|
|
|
|
pyxis_enable_irq(irq);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
pyxis_end_irq(unsigned int irq)
|
|
|
|
{
|
|
|
|
if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
|
|
|
|
pyxis_enable_irq(irq);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
pyxis_mask_and_ack_irq(unsigned int irq)
|
|
|
|
{
|
|
|
|
unsigned long bit = 1UL << (irq - 16);
|
|
|
|
unsigned long mask = cached_irq_mask &= ~bit;
|
|
|
|
|
|
|
|
/* Disable the interrupt. */
|
|
|
|
*(vulp)PYXIS_INT_MASK = mask;
|
|
|
|
wmb();
|
|
|
|
/* Ack PYXIS PCI interrupt. */
|
|
|
|
*(vulp)PYXIS_INT_REQ = bit;
|
|
|
|
mb();
|
|
|
|
/* Re-read to force both writes. */
|
|
|
|
*(vulp)PYXIS_INT_MASK;
|
|
|
|
}
|
|
|
|
|
2009-06-16 22:33:25 +00:00
|
|
|
static struct irq_chip pyxis_irq_type = {
|
2009-12-01 03:51:31 +00:00
|
|
|
.name = "PYXIS",
|
2005-04-16 22:20:36 +00:00
|
|
|
.startup = pyxis_startup_irq,
|
|
|
|
.shutdown = pyxis_disable_irq,
|
|
|
|
.enable = pyxis_enable_irq,
|
|
|
|
.disable = pyxis_disable_irq,
|
|
|
|
.ack = pyxis_mask_and_ack_irq,
|
|
|
|
.end = pyxis_end_irq,
|
|
|
|
};
|
|
|
|
|
|
|
|
void
|
2006-10-08 13:36:08 +00:00
|
|
|
pyxis_device_interrupt(unsigned long vector)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
unsigned long pld;
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
/* Read the interrupt summary register of PYXIS */
|
|
|
|
pld = *(vulp)PYXIS_INT_REQ;
|
|
|
|
pld &= cached_irq_mask;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Now for every possible bit set, work through them and call
|
|
|
|
* the appropriate interrupt handler.
|
|
|
|
*/
|
|
|
|
while (pld) {
|
|
|
|
i = ffz(~pld);
|
|
|
|
pld &= pld - 1; /* clear least bit set */
|
|
|
|
if (i == 7)
|
2006-10-08 13:36:08 +00:00
|
|
|
isa_device_interrupt(vector);
|
2005-04-16 22:20:36 +00:00
|
|
|
else
|
2006-10-08 13:37:32 +00:00
|
|
|
handle_irq(16+i);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void __init
|
|
|
|
init_pyxis_irqs(unsigned long ignore_mask)
|
|
|
|
{
|
|
|
|
long i;
|
|
|
|
|
|
|
|
*(vulp)PYXIS_INT_MASK = 0; /* disable all */
|
|
|
|
*(vulp)PYXIS_INT_REQ = -1; /* flush all */
|
|
|
|
mb();
|
|
|
|
|
|
|
|
/* Send -INTA pulses to clear any pending interrupts ...*/
|
|
|
|
*(vuip) CIA_IACK_SC;
|
|
|
|
|
|
|
|
for (i = 16; i < 48; ++i) {
|
|
|
|
if ((ignore_mask >> i) & 1)
|
|
|
|
continue;
|
|
|
|
irq_desc[i].status = IRQ_DISABLED | IRQ_LEVEL;
|
[PATCH] genirq: rename desc->handler to desc->chip
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>
2006-06-29 09:24:36 +00:00
|
|
|
irq_desc[i].chip = &pyxis_irq_type;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
setup_irq(16+7, &isa_cascade_irqaction);
|
|
|
|
}
|