[MIPS] TRACE_IRQFLAGS_SUPPORT support.
[linux-2.6.git] / include / asm-mips / irqflags.h
similarity index 80%
rename from include/asm-mips/interrupt.h
rename to include/asm-mips/irqflags.h
index a99d6867510fde017b85e00ddee65d79ae5762e5..43ca09a3a3d0ca2735b6f0b364c0190cee2569c4 100644 (file)
@@ -8,13 +8,15 @@
  * Copyright (C) 1999 Silicon Graphics
  * Copyright (C) 2000 MIPS Technologies, Inc.
  */
-#ifndef _ASM_INTERRUPT_H
-#define _ASM_INTERRUPT_H
+#ifndef _ASM_IRQFLAGS_H
+#define _ASM_IRQFLAGS_H
+
+#ifndef __ASSEMBLY__
 
 #include <asm/hazards.h>
 
 __asm__ (
-       "       .macro  local_irq_enable                                \n"
+       "       .macro  raw_local_irq_enable                            \n"
        "       .set    push                                            \n"
        "       .set    reorder                                         \n"
        "       .set    noat                                            \n"
@@ -35,10 +37,10 @@ __asm__ (
        "       .set    pop                                             \n"
        "       .endm");
 
-static inline void local_irq_enable(void)
+static inline void raw_local_irq_enable(void)
 {
        __asm__ __volatile__(
-               "local_irq_enable"
+               "raw_local_irq_enable"
                : /* no outputs */
                : /* no inputs */
                : "memory");
@@ -63,7 +65,7 @@ static inline void local_irq_enable(void)
  * Workaround: mask EXL bit of the result or place a nop before mfc0.
  */
 __asm__ (
-       "       .macro  local_irq_disable\n"
+       "       .macro  raw_local_irq_disable\n"
        "       .set    push                                            \n"
        "       .set    noat                                            \n"
 #ifdef CONFIG_MIPS_MT_SMTC
@@ -84,17 +86,17 @@ __asm__ (
        "       .set    pop                                             \n"
        "       .endm                                                   \n");
 
-static inline void local_irq_disable(void)
+static inline void raw_local_irq_disable(void)
 {
        __asm__ __volatile__(
-               "local_irq_disable"
+               "raw_local_irq_disable"
                : /* no outputs */
                : /* no inputs */
                : "memory");
 }
 
 __asm__ (
-       "       .macro  local_save_flags flags                          \n"
+       "       .macro  raw_local_save_flags flags                      \n"
        "       .set    push                                            \n"
        "       .set    reorder                                         \n"
 #ifdef CONFIG_MIPS_MT_SMTC
@@ -105,13 +107,13 @@ __asm__ (
        "       .set    pop                                             \n"
        "       .endm                                                   \n");
 
-#define local_save_flags(x)                                            \
+#define raw_local_save_flags(x)                                                \
 __asm__ __volatile__(                                                  \
-       "local_save_flags %0"                                           \
+       "raw_local_save_flags %0"                                       \
        : "=r" (x))
 
 __asm__ (
-       "       .macro  local_irq_save result                           \n"
+       "       .macro  raw_local_irq_save result                       \n"
        "       .set    push                                            \n"
        "       .set    reorder                                         \n"
        "       .set    noat                                            \n"
@@ -135,15 +137,15 @@ __asm__ (
        "       .set    pop                                             \n"
        "       .endm                                                   \n");
 
-#define local_irq_save(x)                                              \
+#define raw_local_irq_save(x)                                          \
 __asm__ __volatile__(                                                  \
-       "local_irq_save\t%0"                                            \
+       "raw_local_irq_save\t%0"                                        \
        : "=r" (x)                                                      \
        : /* no inputs */                                               \
        : "memory")
 
 __asm__ (
-       "       .macro  local_irq_restore flags                         \n"
+       "       .macro  raw_local_irq_restore flags                     \n"
        "       .set    push                                            \n"
        "       .set    noreorder                                       \n"
        "       .set    noat                                            \n"
@@ -182,40 +184,42 @@ __asm__ (
        "       .set    pop                                             \n"
        "       .endm                                                   \n");
 
-#define local_irq_restore(flags)                                       \
+#define raw_local_irq_restore(flags)                                   \
 do {                                                                   \
        unsigned long __tmp1;                                           \
                                                                        \
        __asm__ __volatile__(                                           \
-               "local_irq_restore\t%0"                                 \
+               "raw_local_irq_restore\t%0"                             \
                : "=r" (__tmp1)                                         \
                : "0" (flags)                                           \
                : "memory");                                            \
 } while(0)
 
-static inline int irqs_disabled(void)
+static inline int raw_irqs_disabled_flags(unsigned long flags)
 {
 #ifdef CONFIG_MIPS_MT_SMTC
        /*
         * SMTC model uses TCStatus.IXMT to disable interrupts for a thread/CPU
         */
-       unsigned long __result;
-
-       __asm__ __volatile__(
-       "       .set    noreorder                                       \n"
-       "       mfc0    %0, $2, 1                                       \n"
-       "       andi    %0, 0x400                                       \n"
-       "       slt     %0, $0, %0                                      \n"
-       "       .set    reorder                                         \n"
-       : "=r" (__result));
-
-       return __result;
+       return flags & 0x400;
 #else
-       unsigned long flags;
-       local_save_flags(flags);
-
        return !(flags & 1);
 #endif
 }
 
-#endif /* _ASM_INTERRUPT_H */
+#endif
+
+/*
+ * Do the CPU's IRQ-state tracing from assembly code.
+ */
+#ifdef CONFIG_TRACE_IRQFLAGS
+# define TRACE_IRQS_ON                                                 \
+       jal     trace_hardirqs_on
+# define TRACE_IRQS_OFF                                                        \
+       jal     trace_hardirqs_off
+#else
+# define TRACE_IRQS_ON
+# define TRACE_IRQS_OFF
+#endif
+
+#endif /* _ASM_IRQFLAGS_H */