Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/agpgart
[linux-drm-fsl-dcu.git] / arch / mips / mips-boards / malta / malta_int.c
index 7cc0ba4f553ab2bae354b14fe07983faf47cfb37..3c206bb171602ff3ce331586ee63a11fc7319825 100644 (file)
 #include <linux/slab.h>
 #include <linux/interrupt.h>
 #include <linux/kernel_stat.h>
+#include <linux/kernel.h>
 #include <linux/random.h>
 
 #include <asm/i8259.h>
 #include <asm/irq_cpu.h>
 #include <asm/io.h>
+#include <asm/irq_regs.h>
 #include <asm/mips-boards/malta.h>
 #include <asm/mips-boards/maltaint.h>
 #include <asm/mips-boards/piix4.h>
@@ -114,7 +116,7 @@ static inline int get_int(void)
        return irq;
 }
 
-static void malta_hw0_irqdispatch(struct pt_regs *regs)
+static void malta_hw0_irqdispatch(void)
 {
        int irq;
 
@@ -123,17 +125,21 @@ static void malta_hw0_irqdispatch(struct pt_regs *regs)
                return;  /* interrupt has already been cleared */
        }
 
-       do_IRQ(MALTA_INT_BASE+irq, regs);
+       do_IRQ(MALTA_INT_BASE + irq);
 }
 
-void corehi_irqdispatch(struct pt_regs *regs)
+static void corehi_irqdispatch(void)
 {
+       unsigned int intedge, intsteer, pcicmd, pcibadaddr;
+        unsigned int pcimstat, intisr, inten, intpol;
        unsigned int intrcause,datalo,datahi;
-        unsigned int pcimstat, intisr, inten, intpol, intedge, intsteer, pcicmd, pcibadaddr;
+       struct pt_regs *regs = get_irq_regs();
 
         printk("CoreHI interrupt, shouldn't happen, so we die here!!!\n");
-        printk("epc   : %08lx\nStatus: %08lx\nCause : %08lx\nbadVaddr : %08lx\n"
-, regs->cp0_epc, regs->cp0_status, regs->cp0_cause, regs->cp0_badvaddr);
+        printk("epc   : %08lx\nStatus: %08lx\n"
+              "Cause : %08lx\nbadVaddr : %08lx\n",
+              regs->cp0_epc, regs->cp0_status,
+              regs->cp0_cause, regs->cp0_badvaddr);
 
        /* Read all the registers and then print them as there is a
           problem with interspersed printk's upsetting the Bonito controller.
@@ -146,7 +152,7 @@ void corehi_irqdispatch(struct pt_regs *regs)
         case MIPS_REVISION_CORID_CORE_FPGA3:
         case MIPS_REVISION_CORID_CORE_24K:
         case MIPS_REVISION_CORID_CORE_EMUL_MSC:
-                ll_msc_irq(regs);
+                ll_msc_irq();
                 break;
         case MIPS_REVISION_CORID_QED_RM5261:
         case MIPS_REVISION_CORID_CORE_LV:
@@ -208,23 +214,23 @@ static inline unsigned int irq_ffs(unsigned int pending)
        unsigned int a0 = 7;
        unsigned int t0;
 
-       t0 = s0 & 0xf000;
+       t0 = pending & 0xf000;
        t0 = t0 < 1;
        t0 = t0 << 2;
        a0 = a0 - t0;
-       s0 = s0 << t0;
+       pending = pending << t0;
 
-       t0 = s0 & 0xc000;
+       t0 = pending & 0xc000;
        t0 = t0 < 1;
        t0 = t0 << 1;
        a0 = a0 - t0;
-       s0 = s0 << t0;
+       pending = pending << t0;
 
-       t0 = s0 & 0x8000;
+       t0 = pending & 0x8000;
        t0 = t0 < 1;
        //t0 = t0 << 2;
        a0 = a0 - t0;
-       //s0 = s0 << t0;
+       //pending = pending << t0;
 
        return a0;
 #endif
@@ -255,7 +261,7 @@ static inline unsigned int irq_ffs(unsigned int pending)
  * another exception, big deal.
  */
 
-asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
+asmlinkage void plat_irq_dispatch(void)
 {
        unsigned int pending = read_c0_cause() & read_c0_status() & ST0_IM;
        int irq;
@@ -263,11 +269,11 @@ asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
        irq = irq_ffs(pending);
 
        if (irq == MIPSCPU_INT_I8259A)
-               malta_hw0_irqdispatch(regs);
+               malta_hw0_irqdispatch();
        else if (irq > 0)
-               do_IRQ(MIPSCPU_INT_BASE + irq, regs);
+               do_IRQ(MIPSCPU_INT_BASE + irq);
        else
-               spurious_interrupt(regs);
+               spurious_interrupt();
 }
 
 static struct irqaction i8259irq = {
@@ -284,7 +290,7 @@ msc_irqmap_t __initdata msc_irqmap[] = {
        {MSC01C_INT_TMR,                MSC01_IRQ_EDGE, 0},
        {MSC01C_INT_PCI,                MSC01_IRQ_LEVEL, 0},
 };
-int __initdata msc_nr_irqs = sizeof(msc_irqmap)/sizeof(msc_irqmap_t);
+int __initdata msc_nr_irqs = ARRAY_SIZE(msc_irqmap);
 
 msc_irqmap_t __initdata msc_eicirqmap[] = {
        {MSC01E_INT_SW0,                MSC01_IRQ_LEVEL, 0},
@@ -298,14 +304,14 @@ msc_irqmap_t __initdata msc_eicirqmap[] = {
        {MSC01E_INT_PERFCTR,            MSC01_IRQ_LEVEL, 0},
        {MSC01E_INT_CPUCTR,             MSC01_IRQ_LEVEL, 0}
 };
-int __initdata msc_nr_eicirqs = sizeof(msc_eicirqmap)/sizeof(msc_irqmap_t);
+int __initdata msc_nr_eicirqs = ARRAY_SIZE(msc_eicirqmap);
 
 void __init arch_init_irq(void)
 {
        init_i8259_irqs();
 
        if (!cpu_has_veic)
-               mips_cpu_irq_init (MIPSCPU_INT_BASE);
+               mips_cpu_irq_init();
 
         switch(mips_revision_corid) {
         case MIPS_REVISION_CORID_CORE_MSC: