#include <linux/types.h>
#include <linux/interrupt.h>
#include <linux/ioport.h>
-#include <linux/irq.h>
#include <linux/timex.h>
#include <linux/slab.h>
#include <linux/random.h>
#include <linux/smp_lock.h>
#include <linux/kernel_stat.h>
#include <linux/delay.h>
-#include <linux/bitops.h>
+#include <asm/bitops.h>
#include <asm/bootinfo.h>
#include <asm/io.h>
#include <asm/mipsregs.h>
if (!pend0)
return;
+ /* Prevent any of the picked intrs from recursing */
+ LOCAL_HUB_S(pi_int_mask0, mask0 & ~pend0);
+
swlevel = ms1bit(pend0);
#ifdef CONFIG_SMP
if (pend0 & (1UL << CPU_RESCHED_A_IRQ)) {
do_IRQ(irq, regs);
}
+ /* clear bit in pend0 */
+ pend0 ^= 1UL << swlevel;
+
+ /* Now allow the set of serviced intrs again */
+ LOCAL_HUB_S(pi_int_mask0, mask0);
LOCAL_HUB_L(PI_INT_PEND0);
}
if (!pend1)
return;
+ /* Prevent any of the picked intrs from recursing */
+ LOCAL_HUB_S(pi_int_mask1, mask1 & ~pend1);
+
swlevel = ms1bit(pend1);
/* "map" swlevel to irq */
irq = si->level_to_irq[swlevel];
LOCAL_HUB_CLR_INTR(swlevel);
do_IRQ(irq, regs);
+ /* clear bit in pend1 */
+ pend1 ^= 1UL << swlevel;
+ /* Now allow the set of serviced intrs again */
+ LOCAL_HUB_S(pi_int_mask1, mask1);
LOCAL_HUB_L(PI_INT_PEND1);
}
__set_bit(bit, si->irq_enable_mask);
+ /* Make sure it's not already pending when we connect it. */
+ REMOTE_HUB_CLR_INTR(nasid, bit);
+
if (!cputoslice(cpu)) {
REMOTE_HUB_S(nasid, PI_INT_MASK0_A, si->irq_enable_mask[0]);
REMOTE_HUB_S(nasid, PI_INT_MASK1_A, si->irq_enable_mask[1]);
bridgereg_t device;
bridge_t *bridge;
int pin, swlevel;
- cpuid_t cpu;
pin = SLOT_FROM_PCI_IRQ(irq);
bc = IRQ_TO_BRIDGE(irq);
* "map" irq to a swlevel greater than 6 since the first 6 bits
* of INT_PEND0 are taken
*/
- swlevel = find_level(&cpu, irq);
+ swlevel = alloc_level(bc->irq_cpu, irq);
+ intr_connect_level(bc->irq_cpu, swlevel);
+
bridge->b_int_addr[pin].addr = (0x20000 | swlevel | (bc->nasid << 8));
bridge->b_int_enable |= (1 << pin);
- bridge->b_int_enable |= 0x7ffffe00; /* more stuff in int_enable */
+ /* more stuff in int_enable reg */
+ bridge->b_int_enable |= 0x7ffffe00;
/*
* Enable sending of an interrupt clear packt to the hub on a high to
device |= (pin << (pin*3));
bridge->b_int_device = device;
- bridge->b_wid_tflush;
+ bridge->b_widget.w_tflush; /* Flush */
return 0; /* Never anything pending. */
}
si->level_to_irq[swlevel] = -1;
bridge->b_int_enable &= ~(1 << pin);
- bridge->b_wid_tflush;
+ bridge->b_widget.w_tflush; /* Flush */
}
static inline void enable_bridge_irq(unsigned int irq)
{
- cpuid_t cpu;
- int swlevel;
-
- swlevel = find_level(&cpu, irq); /* Criminal offence */
- intr_connect_level(cpu, swlevel);
+ /* All the braindamage happens magically for us in ip27_do_irq */
}
-static inline void disable_bridge_irq(unsigned int irq)
+static void disable_bridge_irq(unsigned int irq)
{
- cpuid_t cpu;
- int swlevel;
-
- swlevel = find_level(&cpu, irq); /* Criminal offence */
- intr_disconnect_level(cpu, swlevel);
+ /* All the braindamage happens magically for us in ip27_do_irq */
}
static void mask_and_ack_bridge_irq(unsigned int irq)
{
- disable_bridge_irq(irq);
+ /* All the braindamage happens magically for us in ip27_do_irq */
}
static void end_bridge_irq(unsigned int irq)
{
- if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)) &&
- irq_desc[irq].action)
- enable_bridge_irq(irq);
}
static struct hw_interrupt_type bridge_irq_type = {
static unsigned long irq_map[NR_IRQS / BITS_PER_LONG];
-static int allocate_irqno(void)
+unsigned int allocate_irqno(void)
{
int irq;
again:
- irq = find_first_zero_bit(irq_map, NR_IRQS);
+ irq = find_first_zero_bit(irq_map, LEVELS_PER_SLICE);
if (irq >= NR_IRQS)
- return -ENOSPC;
+ return -1;
if (test_and_set_bit(irq, irq_map))
goto again;
clear_bit(irq, irq_map);
}
-void __devinit register_bridge_irq(unsigned int irq)
+void __init init_IRQ(void)
{
- irq_desc[irq].status = IRQ_DISABLED;
- irq_desc[irq].action = 0;
- irq_desc[irq].depth = 1;
- irq_desc[irq].handler = &bridge_irq_type;
-}
+ int i;
-int __devinit request_bridge_irq(struct bridge_controller *bc)
-{
- int irq = allocate_irqno();
- int swlevel, cpu;
- nasid_t nasid;
-
- if (irq < 0)
- return irq;
+ set_except_vector(0, ip27_irq);
/*
- * "map" irq to a swlevel greater than 6 since the first 6 bits
- * of INT_PEND0 are taken
+ * Right now the bridge irq is our kitchen sink interrupt type
*/
- cpu = bc->irq_cpu;
- swlevel = alloc_level(cpu, irq);
- if (unlikely(swlevel < 0)) {
- free_irqno(irq);
-
- return -EAGAIN;
+ for (i = 0; i <= NR_IRQS; i++) {
+ irq_desc[i].status = IRQ_DISABLED;
+ irq_desc[i].action = 0;
+ irq_desc[i].depth = 1;
+ irq_desc[i].handler = &bridge_irq_type;
}
-
- /* Make sure it's not already pending when we connect it. */
- nasid = COMPACT_TO_NASID_NODEID(cpu_to_node(cpu));
- REMOTE_HUB_CLR_INTR(nasid, swlevel);
-
- intr_connect_level(cpu, swlevel);
-
- register_bridge_irq(irq);
-
- return irq;
-}
-
-void __init arch_init_irq(void)
-{
- set_except_vector(0, ip27_irq);
}
void install_ipi(void)