]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
sh: Convert to asm-generic/irqflags.h.
authorPaul Mundt <lethal@linux-sh.org>
Sat, 17 Oct 2009 12:06:39 +0000 (21:06 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Sat, 17 Oct 2009 12:06:39 +0000 (21:06 +0900)
This simplifies the irqflags support by switching over to the asm-generic
version. The necessary support functions are brought out-of-line for both
SHcompact and SHmedia instruction sets.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
arch/sh/include/asm/irqflags.h
arch/sh/include/asm/irqflags_32.h [deleted file]
arch/sh/include/asm/irqflags_64.h [deleted file]
arch/sh/include/asm/system_32.h
arch/sh/include/asm/system_64.h
arch/sh/kernel/Makefile
arch/sh/kernel/irq_32.c [new file with mode: 0644]
arch/sh/kernel/irq_64.c [new file with mode: 0644]

index 46e71da5be6b2263ddda378390dbfd94d866d4f5..a741153b41c2d1eb5eb4c4e428410bac86f81135 100644 (file)
@@ -1,34 +1,9 @@
 #ifndef __ASM_SH_IRQFLAGS_H
 #define __ASM_SH_IRQFLAGS_H
 
-#ifdef CONFIG_SUPERH32
-#include "irqflags_32.h"
-#else
-#include "irqflags_64.h"
-#endif
+#define RAW_IRQ_DISABLED       0xf0
+#define RAW_IRQ_ENABLED                0x00
 
-#define raw_local_save_flags(flags) \
-               do { (flags) = __raw_local_save_flags(); } while (0)
-
-static inline int raw_irqs_disabled_flags(unsigned long flags)
-{
-       return (flags != 0);
-}
-
-static inline int raw_irqs_disabled(void)
-{
-       unsigned long flags = __raw_local_save_flags();
-
-       return raw_irqs_disabled_flags(flags);
-}
-
-#define raw_local_irq_save(flags) \
-               do { (flags) = __raw_local_irq_save(); } while (0)
-
-static inline void raw_local_irq_restore(unsigned long flags)
-{
-       if ((flags & 0xf0) != 0xf0)
-               raw_local_irq_enable();
-}
+#include <asm-generic/irqflags.h>
 
 #endif /* __ASM_SH_IRQFLAGS_H */
diff --git a/arch/sh/include/asm/irqflags_32.h b/arch/sh/include/asm/irqflags_32.h
deleted file mode 100644 (file)
index 60218f5..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-#ifndef __ASM_SH_IRQFLAGS_32_H
-#define __ASM_SH_IRQFLAGS_32_H
-
-static inline void raw_local_irq_enable(void)
-{
-       unsigned long __dummy0, __dummy1;
-
-       __asm__ __volatile__ (
-               "stc    sr, %0\n\t"
-               "and    %1, %0\n\t"
-#ifdef CONFIG_CPU_HAS_SR_RB
-               "stc    r6_bank, %1\n\t"
-               "or     %1, %0\n\t"
-#endif
-               "ldc    %0, sr\n\t"
-               : "=&r" (__dummy0), "=r" (__dummy1)
-               : "1" (~0x000000f0)
-               : "memory"
-       );
-}
-
-static inline void raw_local_irq_disable(void)
-{
-       unsigned long flags;
-
-       __asm__ __volatile__ (
-               "stc    sr, %0\n\t"
-               "or     #0xf0, %0\n\t"
-               "ldc    %0, sr\n\t"
-               : "=&z" (flags)
-               : /* no inputs */
-               : "memory"
-       );
-}
-
-static inline void set_bl_bit(void)
-{
-       unsigned long __dummy0, __dummy1;
-
-       __asm__ __volatile__ (
-               "stc    sr, %0\n\t"
-               "or     %2, %0\n\t"
-               "and    %3, %0\n\t"
-               "ldc    %0, sr\n\t"
-               : "=&r" (__dummy0), "=r" (__dummy1)
-               : "r" (0x10000000), "r" (0xffffff0f)
-               : "memory"
-       );
-}
-
-static inline void clear_bl_bit(void)
-{
-       unsigned long __dummy0, __dummy1;
-
-       __asm__ __volatile__ (
-               "stc    sr, %0\n\t"
-               "and    %2, %0\n\t"
-               "ldc    %0, sr\n\t"
-               : "=&r" (__dummy0), "=r" (__dummy1)
-               : "1" (~0x10000000)
-               : "memory"
-       );
-}
-
-static inline unsigned long __raw_local_save_flags(void)
-{
-       unsigned long flags;
-
-       __asm__ __volatile__ (
-               "stc    sr, %0\n\t"
-               "and    #0xf0, %0\n\t"
-               : "=&z" (flags)
-               : /* no inputs */
-               : "memory"
-       );
-
-       return flags;
-}
-
-static inline unsigned long __raw_local_irq_save(void)
-{
-       unsigned long flags, __dummy;
-
-       __asm__ __volatile__ (
-               "stc    sr, %1\n\t"
-               "mov    %1, %0\n\t"
-               "or     #0xf0, %0\n\t"
-               "ldc    %0, sr\n\t"
-               "mov    %1, %0\n\t"
-               "and    #0xf0, %0\n\t"
-               : "=&z" (flags), "=&r" (__dummy)
-               : /* no inputs */
-               : "memory"
-       );
-
-       return flags;
-}
-
-#endif /* __ASM_SH_IRQFLAGS_32_H */
diff --git a/arch/sh/include/asm/irqflags_64.h b/arch/sh/include/asm/irqflags_64.h
deleted file mode 100644 (file)
index 88f6522..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-#ifndef __ASM_SH_IRQFLAGS_64_H
-#define __ASM_SH_IRQFLAGS_64_H
-
-#include <cpu/registers.h>
-
-#define SR_MASK_LL     0x00000000000000f0LL
-#define SR_BL_LL       0x0000000010000000LL
-
-static inline void raw_local_irq_enable(void)
-{
-       unsigned long long __dummy0, __dummy1 = ~SR_MASK_LL;
-
-       __asm__ __volatile__("getcon    " __SR ", %0\n\t"
-                            "and       %0, %1, %0\n\t"
-                            "putcon    %0, " __SR "\n\t"
-                            : "=&r" (__dummy0)
-                            : "r" (__dummy1));
-}
-
-static inline void raw_local_irq_disable(void)
-{
-       unsigned long long __dummy0, __dummy1 = SR_MASK_LL;
-
-       __asm__ __volatile__("getcon    " __SR ", %0\n\t"
-                            "or        %0, %1, %0\n\t"
-                            "putcon    %0, " __SR "\n\t"
-                            : "=&r" (__dummy0)
-                            : "r" (__dummy1));
-}
-
-static inline void set_bl_bit(void)
-{
-       unsigned long long __dummy0, __dummy1 = SR_BL_LL;
-
-       __asm__ __volatile__("getcon    " __SR ", %0\n\t"
-                            "or        %0, %1, %0\n\t"
-                            "putcon    %0, " __SR "\n\t"
-                            : "=&r" (__dummy0)
-                            : "r" (__dummy1));
-
-}
-
-static inline void clear_bl_bit(void)
-{
-       unsigned long long __dummy0, __dummy1 = ~SR_BL_LL;
-
-       __asm__ __volatile__("getcon    " __SR ", %0\n\t"
-                            "and       %0, %1, %0\n\t"
-                            "putcon    %0, " __SR "\n\t"
-                            : "=&r" (__dummy0)
-                            : "r" (__dummy1));
-}
-
-static inline unsigned long __raw_local_save_flags(void)
-{
-       unsigned long long __dummy = SR_MASK_LL;
-       unsigned long flags;
-
-       __asm__ __volatile__ (
-               "getcon " __SR ", %0\n\t"
-               "and    %0, %1, %0"
-               : "=&r" (flags)
-               : "r" (__dummy));
-
-       return flags;
-}
-
-static inline unsigned long __raw_local_irq_save(void)
-{
-       unsigned long long __dummy0, __dummy1 = SR_MASK_LL;
-       unsigned long flags;
-
-       __asm__ __volatile__ (
-               "getcon " __SR ", %1\n\t"
-               "or     %1, r63, %0\n\t"
-               "or     %1, %2, %1\n\t"
-               "putcon %1, " __SR "\n\t"
-               "and    %0, %2, %0"
-               : "=&r" (flags), "=&r" (__dummy0)
-               : "r" (__dummy1));
-
-       return flags;
-}
-
-#endif /* __ASM_SH_IRQFLAGS_64_H */
index 607d413f616844445d1f4366a40d13a8a8143ab3..06814f5b59c7b95f81c9e6cab7fbea7b43f10364 100644 (file)
@@ -232,4 +232,33 @@ asmlinkage void do_exception_error(unsigned long r4, unsigned long r5,
                                   unsigned long r6, unsigned long r7,
                                   struct pt_regs __regs);
 
+static inline void set_bl_bit(void)
+{
+       unsigned long __dummy0, __dummy1;
+
+       __asm__ __volatile__ (
+               "stc    sr, %0\n\t"
+               "or     %2, %0\n\t"
+               "and    %3, %0\n\t"
+               "ldc    %0, sr\n\t"
+               : "=&r" (__dummy0), "=r" (__dummy1)
+               : "r" (0x10000000), "r" (0xffffff0f)
+               : "memory"
+       );
+}
+
+static inline void clear_bl_bit(void)
+{
+       unsigned long __dummy0, __dummy1;
+
+       __asm__ __volatile__ (
+               "stc    sr, %0\n\t"
+               "and    %2, %0\n\t"
+               "ldc    %0, sr\n\t"
+               : "=&r" (__dummy0), "=r" (__dummy1)
+               : "1" (~0x10000000)
+               : "memory"
+       );
+}
+
 #endif /* __ASM_SH_SYSTEM_32_H */
index 8e4a03e7966c00069e32c80c4135946f36805e6c..ab1dd917ea87daa7ea7b82a061c8eb03f660c84a 100644 (file)
@@ -12,6 +12,7 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  */
+#include <cpu/registers.h>
 #include <asm/processor.h>
 
 /*
@@ -47,4 +48,29 @@ static inline reg_size_t register_align(void *val)
        return (unsigned long long)(signed long long)(signed long)val;
 }
 
+#define SR_BL_LL       0x0000000010000000LL
+
+static inline void set_bl_bit(void)
+{
+       unsigned long long __dummy0, __dummy1 = SR_BL_LL;
+
+       __asm__ __volatile__("getcon    " __SR ", %0\n\t"
+                            "or        %0, %1, %0\n\t"
+                            "putcon    %0, " __SR "\n\t"
+                            : "=&r" (__dummy0)
+                            : "r" (__dummy1));
+
+}
+
+static inline void clear_bl_bit(void)
+{
+       unsigned long long __dummy0, __dummy1 = ~SR_BL_LL;
+
+       __asm__ __volatile__("getcon    " __SR ", %0\n\t"
+                            "and       %0, %1, %0\n\t"
+                            "putcon    %0, " __SR "\n\t"
+                            : "=&r" (__dummy0)
+                            : "r" (__dummy1));
+}
+
 #endif /* __ASM_SH_SYSTEM_64_H */
index f8791203cfe3d350823170f08f9434d65e883482..6fe0fcdaf5318f43ea358a25964ab7c5d2b3e2ec 100644 (file)
@@ -12,8 +12,8 @@ endif
 CFLAGS_REMOVE_return_address.o = -pg
 
 obj-y  := debugtraps.o dumpstack.o idle.o io.o io_generic.o irq.o      \
-          machvec.o nmi_debug.o process_$(BITS).o ptrace_$(BITS).o     \
-          return_address.o                                             \
+          irq_$(BITS).o machvec.o nmi_debug.o process_$(BITS).o        \
+          ptrace_$(BITS).o return_address.o                            \
           setup.o signal_$(BITS).o sys_sh.o sys_sh$(BITS).o            \
           syscalls_$(BITS).o time.o topology.o traps.o                 \
           traps_$(BITS).o unwinder.o
diff --git a/arch/sh/kernel/irq_32.c b/arch/sh/kernel/irq_32.c
new file mode 100644 (file)
index 0000000..b98a694
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * SHcompact irqflags support
+ *
+ * Copyright (C) 2006 - 2009 Paul Mundt
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+#include <linux/irqflags.h>
+#include <linux/module.h>
+
+void raw_local_irq_restore(unsigned long flags)
+{
+       unsigned long __dummy0, __dummy1;
+
+       if (flags == RAW_IRQ_DISABLED) {
+               __asm__ __volatile__ (
+                       "stc    sr, %0\n\t"
+                       "or     #0xf0, %0\n\t"
+                       "ldc    %0, sr\n\t"
+                       : "=&z" (__dummy0)
+                       : /* no inputs */
+                       : "memory"
+               );
+       } else {
+               __asm__ __volatile__ (
+                       "stc    sr, %0\n\t"
+                       "and    %1, %0\n\t"
+#ifdef CONFIG_CPU_HAS_SR_RB
+                       "stc    r6_bank, %1\n\t"
+                       "or     %1, %0\n\t"
+#endif
+                       "ldc    %0, sr\n\t"
+                       : "=&r" (__dummy0), "=r" (__dummy1)
+                       : "1" (~RAW_IRQ_DISABLED)
+                       : "memory"
+               );
+       }
+}
+EXPORT_SYMBOL(raw_local_irq_restore);
+
+unsigned long __raw_local_save_flags(void)
+{
+       unsigned long flags;
+
+       __asm__ __volatile__ (
+               "stc    sr, %0\n\t"
+               "and    #0xf0, %0\n\t"
+               : "=&z" (flags)
+               : /* no inputs */
+               : "memory"
+       );
+
+       return flags;
+}
+EXPORT_SYMBOL(__raw_local_save_flags);
diff --git a/arch/sh/kernel/irq_64.c b/arch/sh/kernel/irq_64.c
new file mode 100644 (file)
index 0000000..09d9271
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * SHmedia irqflags support
+ *
+ * Copyright (C) 2006 - 2009 Paul Mundt
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+#include <linux/irqflags.h>
+#include <linux/module.h>
+#include <cpu/registers.h>
+
+void raw_local_irq_restore(unsigned long flags)
+{
+       unsigned long long __dummy;
+
+       if (flags == RAW_IRQ_DISABLED) {
+               __asm__ __volatile__ (
+                       "getcon " __SR ", %0\n\t"
+                       "or     %0, %1, %0\n\t"
+                       "putcon %0, " __SR "\n\t"
+                       : "=&r" (__dummy)
+                       : "r" (RAW_IRQ_DISABLED)
+               );
+       } else {
+               __asm__ __volatile__ (
+                       "getcon " __SR ", %0\n\t"
+                       "and    %0, %1, %0\n\t"
+                       "putcon %0, " __SR "\n\t"
+                       : "=&r" (__dummy)
+                       : "r" (~RAW_IRQ_DISABLED)
+               );
+       }
+}
+EXPORT_SYMBOL(raw_local_irq_restore);
+
+unsigned long __raw_local_save_flags(void)
+{
+       unsigned long flags;
+
+       __asm__ __volatile__ (
+               "getcon " __SR ", %0\n\t"
+               "and    %0, %1, %0"
+               : "=&r" (flags)
+               : "r" (RAW_IRQ_DISABLED)
+       );
+
+       return flags;
+}
+EXPORT_SYMBOL(__raw_local_save_flags);