[MIPS] Don't drag a platform specific header into generic arch code.
authorRalf Baechle <ralf@linux-mips.org>
Wed, 20 Jun 2007 21:27:10 +0000 (22:27 +0100)
committerRalf Baechle <ralf@linux-mips.org>
Wed, 20 Jun 2007 21:27:10 +0000 (22:27 +0100)
For some platforms it's definitions may conflict.  So that's the one-liner.
The rest is 10 square kilometers of collateral damage fixup this include
used to paper over.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
16 files changed:
arch/mips/kernel/smtc.c
arch/mips/kernel/time.c
arch/mips/kernel/traps.c
arch/mips/mips-boards/atlas/atlas_int.c
arch/mips/mips-boards/generic/time.c
arch/mips/mips-boards/malta/malta_int.c
arch/mips/mips-boards/sead/sead_int.c
arch/mips/mips-boards/sead/sead_setup.c
arch/mips/mips-boards/sim/sim_int.c
arch/mips/mips-boards/sim/sim_time.c
drivers/net/mipsnet.c
include/asm-mips/irq.h
include/asm-mips/mips-boards/atlasint.h
include/asm-mips/mips-boards/maltaint.h
include/asm-mips/mips-boards/seadint.h
include/asm-mips/mips-boards/simint.h

index 21eb5993a19fe52a99aa9714bda5db917da42fb2..2e011470c347d34389d660ab6f748d583d1b75d4 100644 (file)
@@ -13,9 +13,9 @@
 #include <asm/system.h>
 #include <asm/hardirq.h>
 #include <asm/hazards.h>
+#include <asm/irq.h>
 #include <asm/mmu_context.h>
 #include <asm/smp.h>
-#include <asm/mips-boards/maltaint.h>
 #include <asm/mipsregs.h>
 #include <asm/cacheflush.h>
 #include <asm/time.h>
@@ -614,7 +614,7 @@ int setup_irq_smtc(unsigned int irq, struct irqaction * new,
 #ifdef CONFIG_SMTC_IDLE_HOOK_DEBUG
        unsigned int vpe = current_cpu_data.vpe_id;
 
-       vpemask[vpe][irq - MIPSCPU_INT_BASE] = 1;
+       vpemask[vpe][irq - MIPS_CPU_IRQ_BASE] = 1;
 #endif
        irq_hwmask[irq] = hwmask;
 
@@ -822,7 +822,7 @@ void ipi_decode(struct smtc_ipi *pipi)
        switch (type_copy) {
        case SMTC_CLOCK_TICK:
                irq_enter();
-               kstat_this_cpu.irqs[MIPSCPU_INT_BASE + MIPSCPU_INT_CPUCTR]++;
+               kstat_this_cpu.irqs[MIPS_CPU_IRQ_BASE + cp0_perfcount_irq]++;
                /* Invoke Clock "Interrupt" */
                ipi_timer_latch[dest_copy] = 0;
 #ifdef CONFIG_SMTC_IDLE_HOOK_DEBUG
index 7def1ff3da9492573508870c2f927af670aeaecc..d48d1d5bea0a2515758a4795a292ea6dfc7f2d2c 100644 (file)
@@ -199,11 +199,16 @@ int (*perf_irq)(void) = null_perf_irq;
 EXPORT_SYMBOL(null_perf_irq);
 EXPORT_SYMBOL(perf_irq);
 
+/*
+ * Timer interrupt
+ */
+int cp0_compare_irq;
+
 /*
  * Performance counter IRQ or -1 if shared with timer
  */
-int mipsxx_perfcount_irq;
-EXPORT_SYMBOL(mipsxx_perfcount_irq);
+int cp0_perfcount_irq;
+EXPORT_SYMBOL_GPL(cp0_perfcount_irq);
 
 /*
  * Possibly handle a performance counter interrupt.
@@ -213,12 +218,12 @@ static inline int handle_perf_irq (int r2)
 {
        /*
         * The performance counter overflow interrupt may be shared with the
-        * timer interrupt (mipsxx_perfcount_irq < 0). If it is and a
+        * timer interrupt (cp0_perfcount_irq < 0). If it is and a
         * performance counter has overflowed (perf_irq() == IRQ_HANDLED)
         * and we can't reliably determine if a counter interrupt has also
         * happened (!r2) then don't check for a timer interrupt.
         */
-       return (mipsxx_perfcount_irq < 0) &&
+       return (cp0_perfcount_irq < 0) &&
                perf_irq() == IRQ_HANDLED &&
                !r2;
 }
index a7a17eb9bfcde7ee4c71fd5bc7c2d73dd949091b..b1233644fcca66e208282666ff946958ffcca1e3 100644 (file)
@@ -1350,9 +1350,6 @@ void __init per_cpu_trap_init(void)
        if (!secondaryTC) {
 #endif /* CONFIG_MIPS_MT_SMTC */
 
-       /*
-        * Interrupt handling.
-        */
        if (cpu_has_veic || cpu_has_vint) {
                write_c0_ebase (ebase);
                /* Setting vector spacing enables EI/VI mode  */
@@ -1366,6 +1363,23 @@ void __init per_cpu_trap_init(void)
                } else
                        set_c0_cause(CAUSEF_IV);
        }
+
+       /*
+        * Before R2 both interrupt numbers were fixed to 7, so on R2 only:
+        *
+        *  o read IntCtl.IPTI to determine the timer interrupt
+        *  o read IntCtl.IPPCI to determine the performance counter interrupt
+        */
+       if (cpu_has_mips_r2) {
+               cp0_compare_irq = (read_c0_intctl () >> 29) & 7;
+               cp0_perfcount_irq = -1;
+       } else {
+               cp0_compare_irq = CP0_LEGACY_COMPARE_IRQ;
+               cp0_perfcount_irq = (read_c0_intctl () >> 26) & 7;
+               if (cp0_perfcount_irq != cp0_compare_irq)
+                       cp0_perfcount_irq = -1;
+       }
+
 #ifdef CONFIG_MIPS_MT_SMTC
        }
 #endif /* CONFIG_MIPS_MT_SMTC */
index 9f49da95aacf86c7297a60bfd340f13a0b3adc1c..6c8f0255e85de2812ebe87b4e2f7e5e9babc5c6d 100644 (file)
@@ -189,7 +189,7 @@ asmlinkage void plat_irq_dispatch(void)
        if (irq == MIPSCPU_INT_ATLAS)
                atlas_hw0_irqdispatch();
        else if (irq >= 0)
-               do_IRQ(MIPSCPU_INT_BASE + irq);
+               do_IRQ(MIPS_CPU_IRQ_BASE + irq);
        else
                spurious_interrupt();
 }
@@ -261,11 +261,11 @@ void __init arch_init_irq(void)
        } else if (cpu_has_vint) {
                set_vi_handler (MIPSCPU_INT_ATLAS, atlas_hw0_irqdispatch);
 #ifdef CONFIG_MIPS_MT_SMTC
-               setup_irq_smtc (MIPSCPU_INT_BASE + MIPSCPU_INT_ATLAS,
+               setup_irq_smtc (MIPS_CPU_IRQ_BASE + MIPSCPU_INT_ATLAS,
                                &atlasirq, (0x100 << MIPSCPU_INT_ATLAS));
 #else /* Not SMTC */
-               setup_irq(MIPSCPU_INT_BASE + MIPSCPU_INT_ATLAS, &atlasirq);
+               setup_irq(MIPS_CPU_IRQ_BASE + MIPSCPU_INT_ATLAS, &atlasirq);
 #endif /* CONFIG_MIPS_MT_SMTC */
        } else
-               setup_irq(MIPSCPU_INT_BASE + MIPSCPU_INT_ATLAS, &atlasirq);
+               setup_irq(MIPS_CPU_IRQ_BASE + MIPSCPU_INT_ATLAS, &atlasirq);
 }
index 8f1000f51b3d2b2512fe0d99b0fa669f11a23391..c45d556aa96bd3553e1accbe115521391efc9b22 100644 (file)
@@ -54,7 +54,7 @@
 unsigned long cpu_khz;
 
 static int mips_cpu_timer_irq;
-extern int mipsxx_perfcount_irq;
+extern int cp0_perfcount_irq;
 extern void smtc_timer_broadcast(int);
 
 static void mips_timer_dispatch(void)
@@ -64,7 +64,7 @@ static void mips_timer_dispatch(void)
 
 static void mips_perf_dispatch(void)
 {
-       do_IRQ(mipsxx_perfcount_irq);
+       do_IRQ(cp0_perfcount_irq);
 }
 
 /*
@@ -82,12 +82,12 @@ static inline int handle_perf_irq (int r2)
 {
        /*
         * The performance counter overflow interrupt may be shared with the
-        * timer interrupt (mipsxx_perfcount_irq < 0). If it is and a
+        * timer interrupt (cp0_perfcount_irq < 0). If it is and a
         * performance counter has overflowed (perf_irq() == IRQ_HANDLED)
         * and we can't reliably determine if a counter interrupt has also
         * happened (!r2) then don't check for a timer interrupt.
         */
-       return (mipsxx_perfcount_irq < 0) &&
+       return (cp0_perfcount_irq < 0) &&
                perf_irq() == IRQ_HANDLED &&
                !r2;
 }
@@ -259,42 +259,31 @@ static struct irqaction perf_irqaction = {
 
 void __init plat_perf_setup(struct irqaction *irq)
 {
-       int hwint = 0;
-       mipsxx_perfcount_irq = -1;
+       cp0_perfcount_irq = -1;
 
 #ifdef MSC01E_INT_BASE
        if (cpu_has_veic) {
                set_vi_handler (MSC01E_INT_PERFCTR, mips_perf_dispatch);
-               mipsxx_perfcount_irq = MSC01E_INT_BASE + MSC01E_INT_PERFCTR;
+               cp0_perfcount_irq = MSC01E_INT_BASE + MSC01E_INT_PERFCTR;
        } else
 #endif
-       if (cpu_has_mips_r2) {
-               /*
-                * Read IntCtl.IPPCI to determine the performance
-                * counter interrupt
-                */
-               hwint = (read_c0_intctl () >> 26) & 7;
-               if (hwint != MIPSCPU_INT_CPUCTR) {
-                       if (cpu_has_vint)
-                               set_vi_handler (hwint, mips_perf_dispatch);
-                       mipsxx_perfcount_irq = MIPSCPU_INT_BASE + hwint;
-               }
-       }
-       if (mipsxx_perfcount_irq >= 0) {
+       if (cp0_perfcount_irq >= 0) {
+               if (cpu_has_vint)
+                       set_vi_handler(cp0_perfcount_irq, mips_perf_dispatch);
 #ifdef CONFIG_MIPS_MT_SMTC
-               setup_irq_smtc(mipsxx_perfcount_irq, irq, 0x100 << hwint);
+               setup_irq_smtc(cp0_perfcount_irq, irq,
+                              0x100 << cp0_perfcount_irq);
 #else
-               setup_irq(mipsxx_perfcount_irq, irq);
+               setup_irq(cp0_perfcount_irq, irq);
 #endif /* CONFIG_MIPS_MT_SMTC */
 #ifdef CONFIG_SMP
-               set_irq_handler(mipsxx_perfcount_irq, handle_percpu_irq);
+               set_irq_handler(cp0_perfcount_irq, handle_percpu_irq);
 #endif
        }
 }
 
 void __init plat_timer_setup(struct irqaction *irq)
 {
-       int hwint = 0;
 #ifdef MSC01E_INT_BASE
        if (cpu_has_veic) {
                set_vi_handler (MSC01E_INT_CPUCTR, mips_timer_dispatch);
@@ -303,22 +292,15 @@ void __init plat_timer_setup(struct irqaction *irq)
        else
 #endif
        {
-               if (cpu_has_mips_r2)
-                       /*
-                        * Read IntCtl.IPTI to determine the timer interrupt
-                        */
-                       hwint = (read_c0_intctl () >> 29) & 7;
-               else
-                       hwint = MIPSCPU_INT_CPUCTR;
                if (cpu_has_vint)
-                       set_vi_handler (hwint, mips_timer_dispatch);
-               mips_cpu_timer_irq = MIPSCPU_INT_BASE + hwint;
+                       set_vi_handler(cp0_compare_irq, mips_timer_dispatch);
+               mips_cpu_timer_irq = MIPS_CPU_IRQ_BASE + cp0_compare_irq;
        }
 
        /* we are using the cpu counter for timer interrupts */
        irq->handler = mips_timer_interrupt;    /* we use our own handler */
 #ifdef CONFIG_MIPS_MT_SMTC
-       setup_irq_smtc(mips_cpu_timer_irq, irq, 0x100 << hwint);
+       setup_irq_smtc(mips_cpu_timer_irq, irq, 0x100 << cp0_compare_irq);
 #else
        setup_irq(mips_cpu_timer_irq, irq);
 #endif /* CONFIG_MIPS_MT_SMTC */
index 1668cc21d5b5a12197da88d351b4d1b5fa03e14e..c78d48349600872d87f721b8420f13d96cbe5e8b 100644 (file)
@@ -257,7 +257,7 @@ asmlinkage void plat_irq_dispatch(void)
        if (irq == MIPSCPU_INT_I8259A)
                malta_hw0_irqdispatch();
        else if (irq > 0)
-               do_IRQ(MIPSCPU_INT_BASE + irq);
+               do_IRQ(MIPS_CPU_IRQ_BASE + irq);
        else
                spurious_interrupt();
 }
@@ -326,17 +326,17 @@ void __init arch_init_irq(void)
                set_vi_handler (MIPSCPU_INT_I8259A, malta_hw0_irqdispatch);
                set_vi_handler (MIPSCPU_INT_COREHI, corehi_irqdispatch);
 #ifdef CONFIG_MIPS_MT_SMTC
-               setup_irq_smtc (MIPSCPU_INT_BASE+MIPSCPU_INT_I8259A, &i8259irq,
+               setup_irq_smtc (MIPS_CPU_IRQ_BASE+MIPSCPU_INT_I8259A, &i8259irq,
                        (0x100 << MIPSCPU_INT_I8259A));
-               setup_irq_smtc (MIPSCPU_INT_BASE+MIPSCPU_INT_COREHI,
+               setup_irq_smtc (MIPS_CPU_IRQ_BASE+MIPSCPU_INT_COREHI,
                        &corehi_irqaction, (0x100 << MIPSCPU_INT_COREHI));
 #else /* Not SMTC */
-               setup_irq (MIPSCPU_INT_BASE+MIPSCPU_INT_I8259A, &i8259irq);
-               setup_irq (MIPSCPU_INT_BASE+MIPSCPU_INT_COREHI, &corehi_irqaction);
+               setup_irq (MIPS_CPU_IRQ_BASE+MIPSCPU_INT_I8259A, &i8259irq);
+               setup_irq (MIPS_CPU_IRQ_BASE+MIPSCPU_INT_COREHI, &corehi_irqaction);
 #endif /* CONFIG_MIPS_MT_SMTC */
        }
        else {
-               setup_irq (MIPSCPU_INT_BASE+MIPSCPU_INT_I8259A, &i8259irq);
-               setup_irq (MIPSCPU_INT_BASE+MIPSCPU_INT_COREHI, &corehi_irqaction);
+               setup_irq (MIPS_CPU_IRQ_BASE+MIPSCPU_INT_I8259A, &i8259irq);
+               setup_irq (MIPS_CPU_IRQ_BASE+MIPSCPU_INT_COREHI, &corehi_irqaction);
        }
 }
index c4b9de3a7f27ba922c3eda8e9f1a8713e5dc8f90..9ca0f82f136079f2b689d46511e657e42369d94b 100644 (file)
@@ -106,7 +106,7 @@ asmlinkage void plat_irq_dispatch(void)
        irq = irq_ffs(pending);
 
        if (irq >= 0)
-               do_IRQ(MIPSCPU_INT_BASE + irq);
+               do_IRQ(MIPS_CPU_IRQ_BASE + irq);
        else
                spurious_interrupt();
 }
index 811aba100605aa53711930e400f21f82b17cac15..bb801409d39b10eefeefb7ce4ca42f73c168425b 100644 (file)
@@ -68,7 +68,7 @@ static void __init serial_init(void)
 #else
        s.iobase = SEAD_UART0_REGS_BASE+3;
 #endif
-       s.irq = MIPSCPU_INT_BASE + MIPSCPU_INT_UART0;
+       s.irq = MIPS_CPU_IRQ_BASE + MIPSCPU_INT_UART0;
        s.uartclk = SEAD_BASE_BAUD * 16;
        s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ;
        s.iotype = UPIO_PORT;
index 15ac0655c1ff49f59bf79564139e6ee32a182ddd..766e0159ee5b31568a9981eab5ff590d54a53bf2 100644 (file)
@@ -77,7 +77,7 @@ asmlinkage void plat_irq_dispatch(void)
        irq = irq_ffs(pending);
 
        if (irq > 0)
-               do_IRQ(MIPSCPU_INT_BASE + irq);
+               do_IRQ(MIPS_CPU_IRQ_BASE + irq);
        else
                spurious_interrupt();
 }
index d3a21c741514617abb962c931188d24f0d30e9fb..7224ffe31d36188b97ea1d6832e9acfed79a33b9 100644 (file)
@@ -71,8 +71,8 @@ irqreturn_t sim_timer_interrupt(int irq, void *dev_id)
 
        int vpflags = dvpe();
        write_c0_compare (read_c0_count() - 1);
-       clear_c0_cause(0x100 << MIPSCPU_INT_CPUCTR);
-       set_c0_status(0x100 << MIPSCPU_INT_CPUCTR);
+       clear_c0_cause(0x100 << cp0_compare_irq);
+       set_c0_status(0x100 << cp0_compare_irq);
        irq_enable_hazard();
        evpe(vpflags);
 
@@ -183,8 +183,8 @@ void __init plat_timer_setup(struct irqaction *irq)
        }
        else {
                if (cpu_has_vint)
-                       set_vi_handler(MIPSCPU_INT_CPUCTR, mips_timer_dispatch);
-               mips_cpu_timer_irq = MIPSCPU_INT_BASE + MIPSCPU_INT_CPUCTR;
+                       set_vi_handler(cp0_compare_irq, mips_timer_dispatch);
+               mips_cpu_timer_irq = MIPS_CPU_IRQ_BASE + cp0_compare_irq;
        }
 
        /* we are using the cpu counter for timer interrupts */
index 638a279ec5051823a96819a95163dbd4383af7d6..9853c74f6bbf24d2775b5e45eb8dd0f5e4a7b863 100644 (file)
@@ -240,7 +240,7 @@ static int __init mipsnet_probe(struct device *dev)
         * TODO: probe for these or load them from PARAM
         */
        netdev->base_addr = 0x4200;
-       netdev->irq = MIPSCPU_INT_BASE + MIPSCPU_INT_MB0 +
+       netdev->irq = MIPS_CPU_IRQ_BASE + MIPSCPU_INT_MB0 +
                      inl(mipsnet_reg_address(netdev, interruptInfo));
 
        // Get the io region now, get irq on open()
index 91803ba30ff2abd2ac5d4c19b39b1f4590e5af8d..3ca6a076124d745c163aaf918872507a7b4bccfd 100644 (file)
@@ -72,4 +72,13 @@ extern int allocate_irqno(void);
 extern void alloc_legacy_irqno(void);
 extern void free_irqno(unsigned int irq);
 
+/*
+ * Before R2 the timer and performance counter interrupts were both fixed to
+ * IE7.  Since R2 their number has to be read from the c0_intctl register.
+ */
+#define CP0_LEGACY_COMPARE_IRQ 7
+
+extern int cp0_compare_irq;
+extern int cp0_perfcount_irq;
+
 #endif /* _ASM_IRQ_H */
index 76add42e486e292b816e487ab8cbbe565607bd14..93ba1c1b2a4f99bb40419993d7c3de39588bd8d6 100644 (file)
 
 #include <irq.h>
 
-/*
- * Interrupts 0..7 are used for Atlas CPU interrupts (nonEIC mode)
- */
-#define MIPSCPU_INT_BASE       MIPS_CPU_IRQ_BASE
-
 /* CPU interrupt offsets */
 #define MIPSCPU_INT_SW0                0
 #define MIPSCPU_INT_SW1                1
@@ -42,7 +37,6 @@
 #define MIPSCPU_INT_MB2                4
 #define MIPSCPU_INT_MB3                5
 #define MIPSCPU_INT_MB4                6
-#define MIPSCPU_INT_CPUCTR     7
 
 /*
  * Interrupts 8..39 are used for Atlas interrupt controller interrupts
index 9180d6466113f4fb5b6a86de84b19eaed122173b..7461318f1cd10a12c77823bec2beb86ae5d029a3 100644 (file)
  */
 #define MALTA_INT_BASE         0
 
-/*
- * Interrupts 16..23 are used for Malta CPU interrupts (nonEIC mode)
- */
-#define MIPSCPU_INT_BASE       MIPS_CPU_IRQ_BASE
-
 /* CPU interrupt offsets */
 #define MIPSCPU_INT_SW0                0
 #define MIPSCPU_INT_SW1                1
@@ -49,7 +44,6 @@
 #define MIPSCPU_INT_COREHI     MIPSCPU_INT_MB3
 #define MIPSCPU_INT_MB4                6
 #define MIPSCPU_INT_CORELO     MIPSCPU_INT_MB4
-#define MIPSCPU_INT_CPUCTR     7
 
 /*
  * Interrupts 64..127 are used for Soc-it Classic interrupts
index 4f6a3933699d12ed613551477466af19ac9b6862..e710bae073404b8104e616f184d19e85ddd5ba33 100644 (file)
 
 #include <irq.h>
 
-/*
- * Interrupts 0..7 are used for SEAD CPU interrupts
- */
-#define MIPSCPU_INT_BASE       MIPS_CPU_IRQ_BASE
-
 #define MIPSCPU_INT_UART0      2
 #define MIPSCPU_INT_UART1      3
 
-#define MIPSCPU_INT_CPUCTR     7
-
 #endif /* !(_MIPS_SEADINT_H) */
index 54f2fe621d6913498899fa6bc63a09845813cdfa..8ef6db76d5c13ff421722e72e7f3edea40b108e1 100644 (file)
 
 #define SIM_INT_BASE           0
 #define MIPSCPU_INT_MB0                2
-#define MIPSCPU_INT_BASE       MIPS_CPU_IRQ_BASE
 #define MIPS_CPU_TIMER_IRQ     7
 
 
-#define MIPSCPU_INT_CPUCTR     7
-
 #define MSC01E_INT_BASE                64
 
-#define MIPSCPU_INT_CPUCTR     7
 #define MSC01E_INT_CPUCTR      11
 
 #endif