]> err.no Git - linux-2.6/blobdiff - arch/mips/sibyte/bcm1480/irq.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6
[linux-2.6] / arch / mips / sibyte / bcm1480 / irq.c
index 610df40cb82088241ed6fdcb52e98ed30cef455d..a46b75b23ecb1e2ef10f4470279764f23905dacc 100644 (file)
@@ -15,7 +15,6 @@
  * 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/config.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/linkage.h>
@@ -84,7 +83,7 @@ extern char sb1250_duart_present[];
 #endif
 #endif
 
-static struct hw_interrupt_type bcm1480_irq_type = {
+static struct irq_chip bcm1480_irq_type = {
        .typename = "BCM1480-IMR",
        .startup = startup_bcm1480_irq,
        .shutdown = shutdown_bcm1480_irq,
@@ -141,7 +140,7 @@ static void bcm1480_set_affinity(unsigned int irq, cpumask_t mask)
 {
        int i = 0, old_cpu, cpu, int_on, k;
        u64 cur_ints;
-       irq_desc_t *desc = irq_desc + irq;
+       struct irq_desc *desc = irq_desc + irq;
        unsigned long flags;
        unsigned int irq_dirty;
 
@@ -279,7 +278,7 @@ void __init init_bcm1480_irqs(void)
                        irq_desc[i].chip = &bcm1480_irq_type;
                        bcm1480_irq_owner[i] = 0;
                } else {
-                       irq_desc[i].chip = &no_irq_type;
+                       irq_desc[i].chip = &no_irq_chip;
                }
        }
 }
@@ -302,7 +301,7 @@ static struct irqaction bcm1480_dummy_action = {
 
 int bcm1480_steal_irq(int irq)
 {
-       irq_desc_t *desc = irq_desc + irq;
+       struct irq_desc *desc = irq_desc + irq;
        unsigned long flags;
        int retval = 0;
 
@@ -470,21 +469,6 @@ void bcm1480_kgdb_interrupt(struct pt_regs *regs)
 
 #endif         /* CONFIG_KGDB */
 
-static inline int dclz(unsigned long long x)
-{
-       int lz;
-
-       __asm__ (
-       "       .set    push                                            \n"
-       "       .set    mips64                                          \n"
-       "       dclz    %0, %1                                          \n"
-       "       .set    pop                                             \n"
-       : "=r" (lz)
-       : "r" (x));
-
-       return lz;
-}
-
 extern void bcm1480_timer_interrupt(struct pt_regs *regs);
 extern void bcm1480_mailbox_interrupt(struct pt_regs *regs);
 extern void bcm1480_kgdb_interrupt(struct pt_regs *regs);
@@ -498,27 +482,28 @@ asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
        write_c0_compare(read_c0_count());
 #endif
 
-       pending = read_c0_cause();
+       pending = read_c0_cause() & read_c0_status();
 
 #ifdef CONFIG_SIBYTE_BCM1480_PROF
        if (pending & CAUSEF_IP7)       /* Cpu performance counter interrupt */
                sbprof_cpu_intr(exception_epc(regs));
+       else
 #endif
 
        if (pending & CAUSEF_IP4)
                bcm1480_timer_interrupt(regs);
 
 #ifdef CONFIG_SMP
-       if (pending & CAUSEF_IP3)
+       else if (pending & CAUSEF_IP3)
                bcm1480_mailbox_interrupt(regs);
 #endif
 
 #ifdef CONFIG_KGDB
-       if (pending & CAUSEF_IP6)
+       else if (pending & CAUSEF_IP6)
                bcm1480_kgdb_interrupt(regs);           /* KGDB (uart 1) */
 #endif
 
-       if (pending & CAUSEF_IP2) {
+       else if (pending & CAUSEF_IP2) {
                unsigned long long mask_h, mask_l;
                unsigned long base;
 
@@ -534,11 +519,11 @@ asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
                mask_l = __raw_readq(
                        IOADDR(base + R_BCM1480_IMR_INTERRUPT_STATUS_BASE_L));
 
-               if (!mask_h) {
+               if (mask_h) {
                        if (mask_h ^ 1)
-                               do_IRQ(63 - dclz(mask_h), regs);
+                               do_IRQ(fls64(mask_h) - 1, regs);
                        else
-                               do_IRQ(127 - dclz(mask_l), regs);
+                               do_IRQ(63 + fls64(mask_l), regs);
                }
        }
 }