diff options
author | David Howells <dhowells@redhat.com> | 2010-10-07 09:08:55 -0400 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2010-10-07 09:08:55 -0400 |
commit | df9ee29270c11dba7d0fe0b83ce47a4d8e8d2101 (patch) | |
tree | 0c9a87ef1ea042c4432f122c3d03614d21156fc1 /arch/microblaze | |
parent | ca4d3e6746bdcfccb517349bce2d2c5b5614fb6f (diff) |
Fix IRQ flag handling naming
Fix the IRQ flag handling naming. In linux/irqflags.h under one configuration,
it maps:
local_irq_enable() -> raw_local_irq_enable()
local_irq_disable() -> raw_local_irq_disable()
local_irq_save() -> raw_local_irq_save()
...
and under the other configuration, it maps:
raw_local_irq_enable() -> local_irq_enable()
raw_local_irq_disable() -> local_irq_disable()
raw_local_irq_save() -> local_irq_save()
...
This is quite confusing. There should be one set of names expected of the
arch, and this should be wrapped to give another set of names that are expected
by users of this facility.
Change this to have the arch provide:
flags = arch_local_save_flags()
flags = arch_local_irq_save()
arch_local_irq_restore(flags)
arch_local_irq_disable()
arch_local_irq_enable()
arch_irqs_disabled_flags(flags)
arch_irqs_disabled()
arch_safe_halt()
Then linux/irqflags.h wraps these to provide:
raw_local_save_flags(flags)
raw_local_irq_save(flags)
raw_local_irq_restore(flags)
raw_local_irq_disable()
raw_local_irq_enable()
raw_irqs_disabled_flags(flags)
raw_irqs_disabled()
raw_safe_halt()
with type checking on the flags 'arguments', and then wraps those to provide:
local_save_flags(flags)
local_irq_save(flags)
local_irq_restore(flags)
local_irq_disable()
local_irq_enable()
irqs_disabled_flags(flags)
irqs_disabled()
safe_halt()
with tracing included if enabled.
The arch functions can now all be inline functions rather than some of them
having to be macros.
Signed-off-by: David Howells <dhowells@redhat.com> [X86, FRV, MN10300]
Signed-off-by: Chris Metcalf <cmetcalf@tilera.com> [Tile]
Signed-off-by: Michal Simek <monstr@monstr.eu> [Microblaze]
Tested-by: Catalin Marinas <catalin.marinas@arm.com> [ARM]
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com> [AVR]
Acked-by: Tony Luck <tony.luck@intel.com> [IA-64]
Acked-by: Hirokazu Takata <takata@linux-m32r.org> [M32R]
Acked-by: Greg Ungerer <gerg@uclinux.org> [M68K/M68KNOMMU]
Acked-by: Ralf Baechle <ralf@linux-mips.org> [MIPS]
Acked-by: Kyle McMartin <kyle@mcmartin.ca> [PA-RISC]
Acked-by: Paul Mackerras <paulus@samba.org> [PowerPC]
Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com> [S390]
Acked-by: Chen Liqin <liqin.chen@sunplusct.com> [Score]
Acked-by: Matt Fleming <matt@console-pimps.org> [SH]
Acked-by: David S. Miller <davem@davemloft.net> [Sparc]
Acked-by: Chris Zankel <chris@zankel.net> [Xtensa]
Reviewed-by: Richard Henderson <rth@twiddle.net> [Alpha]
Reviewed-by: Yoshinori Sato <ysato@users.sourceforge.jp> [H8300]
Cc: starvik@axis.com [CRIS]
Cc: jesper.nilsson@axis.com [CRIS]
Cc: linux-cris-kernel@axis.com
Diffstat (limited to 'arch/microblaze')
-rw-r--r-- | arch/microblaze/include/asm/irqflags.h | 193 |
1 files changed, 102 insertions, 91 deletions
diff --git a/arch/microblaze/include/asm/irqflags.h b/arch/microblaze/include/asm/irqflags.h index 2c38c6d80176..5fd31905775d 100644 --- a/arch/microblaze/include/asm/irqflags.h +++ b/arch/microblaze/include/asm/irqflags.h | |||
@@ -9,103 +9,114 @@ | |||
9 | #ifndef _ASM_MICROBLAZE_IRQFLAGS_H | 9 | #ifndef _ASM_MICROBLAZE_IRQFLAGS_H |
10 | #define _ASM_MICROBLAZE_IRQFLAGS_H | 10 | #define _ASM_MICROBLAZE_IRQFLAGS_H |
11 | 11 | ||
12 | #include <linux/irqflags.h> | 12 | #include <linux/types.h> |
13 | #include <asm/registers.h> | 13 | #include <asm/registers.h> |
14 | 14 | ||
15 | # if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR | 15 | #ifdef CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR |
16 | 16 | ||
17 | # define raw_local_irq_save(flags) \ | 17 | static inline unsigned long arch_local_irq_save(void) |
18 | do { \ | 18 | { |
19 | asm volatile (" msrclr %0, %1; \ | 19 | unsigned long flags; |
20 | nop;" \ | 20 | asm volatile(" msrclr %0, %1 \n" |
21 | : "=r"(flags) \ | 21 | " nop \n" |
22 | : "i"(MSR_IE) \ | 22 | : "=r"(flags) |
23 | : "memory"); \ | 23 | : "i"(MSR_IE) |
24 | } while (0) | 24 | : "memory"); |
25 | 25 | return flags; | |
26 | # define raw_local_irq_disable() \ | 26 | } |
27 | do { \ | 27 | |
28 | asm volatile (" msrclr r0, %0; \ | 28 | static inline void arch_local_irq_disable(void) |
29 | nop;" \ | 29 | { |
30 | : \ | 30 | /* this uses r0 without declaring it - is that correct? */ |
31 | : "i"(MSR_IE) \ | 31 | asm volatile(" msrclr r0, %0 \n" |
32 | : "memory"); \ | 32 | " nop \n" |
33 | } while (0) | 33 | : |
34 | 34 | : "i"(MSR_IE) | |
35 | # define raw_local_irq_enable() \ | 35 | : "memory"); |
36 | do { \ | 36 | } |
37 | asm volatile (" msrset r0, %0; \ | 37 | |
38 | nop;" \ | 38 | static inline void arch_local_irq_enable(void) |
39 | : \ | 39 | { |
40 | : "i"(MSR_IE) \ | 40 | /* this uses r0 without declaring it - is that correct? */ |
41 | : "memory"); \ | 41 | asm volatile(" msrset r0, %0 \n" |
42 | } while (0) | 42 | " nop \n" |
43 | 43 | : | |
44 | # else /* CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR == 0 */ | 44 | : "i"(MSR_IE) |
45 | 45 | : "memory"); | |
46 | # define raw_local_irq_save(flags) \ | 46 | } |
47 | do { \ | 47 | |
48 | register unsigned tmp; \ | 48 | #else /* !CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR */ |
49 | asm volatile (" mfs %0, rmsr; \ | 49 | |
50 | nop; \ | 50 | static inline unsigned long arch_local_irq_save(void) |
51 | andi %1, %0, %2; \ | 51 | { |
52 | mts rmsr, %1; \ | 52 | unsigned long flags, tmp; |
53 | nop;" \ | 53 | asm volatile (" mfs %0, rmsr \n" |
54 | : "=r"(flags), "=r" (tmp) \ | 54 | " nop \n" |
55 | : "i"(~MSR_IE) \ | 55 | " andi %1, %0, %2 \n" |
56 | : "memory"); \ | 56 | " mts rmsr, %1 \n" |
57 | } while (0) | 57 | " nop \n" |
58 | 58 | : "=r"(flags), "=r"(tmp) | |
59 | # define raw_local_irq_disable() \ | 59 | : "i"(~MSR_IE) |
60 | do { \ | 60 | : "memory"); |
61 | register unsigned tmp; \ | 61 | return flags; |
62 | asm volatile (" mfs %0, rmsr; \ | 62 | } |
63 | nop; \ | 63 | |
64 | andi %0, %0, %1; \ | 64 | static inline void arch_local_irq_disable(void) |
65 | mts rmsr, %0; \ | 65 | { |
66 | nop;" \ | 66 | unsigned long tmp; |
67 | : "=r"(tmp) \ | 67 | asm volatile(" mfs %0, rmsr \n" |
68 | : "i"(~MSR_IE) \ | 68 | " nop \n" |
69 | : "memory"); \ | 69 | " andi %0, %0, %1 \n" |
70 | } while (0) | 70 | " mts rmsr, %0 \n" |
71 | 71 | " nop \n" | |
72 | # define raw_local_irq_enable() \ | 72 | : "=r"(tmp) |
73 | do { \ | 73 | : "i"(~MSR_IE) |
74 | register unsigned tmp; \ | 74 | : "memory"); |
75 | asm volatile (" mfs %0, rmsr; \ | 75 | } |
76 | nop; \ | 76 | |
77 | ori %0, %0, %1; \ | 77 | static inline void arch_local_irq_enable(void) |
78 | mts rmsr, %0; \ | 78 | { |
79 | nop;" \ | 79 | unsigned long tmp; |
80 | : "=r"(tmp) \ | 80 | asm volatile(" mfs %0, rmsr \n" |
81 | : "i"(MSR_IE) \ | 81 | " nop \n" |
82 | : "memory"); \ | 82 | " ori %0, %0, %1 \n" |
83 | } while (0) | 83 | " mts rmsr, %0 \n" |
84 | 84 | " nop \n" | |
85 | # endif /* CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR */ | 85 | : "=r"(tmp) |
86 | 86 | : "i"(MSR_IE) | |
87 | #define raw_local_irq_restore(flags) \ | 87 | : "memory"); |
88 | do { \ | 88 | } |
89 | asm volatile (" mts rmsr, %0; \ | 89 | |
90 | nop;" \ | 90 | #endif /* CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR */ |
91 | : \ | 91 | |
92 | : "r"(flags) \ | 92 | static inline unsigned long arch_local_save_flags(void) |
93 | : "memory"); \ | ||
94 | } while (0) | ||
95 | |||
96 | static inline unsigned long get_msr(void) | ||
97 | { | 93 | { |
98 | unsigned long flags; | 94 | unsigned long flags; |
99 | asm volatile (" mfs %0, rmsr; \ | 95 | asm volatile(" mfs %0, rmsr \n" |
100 | nop;" \ | 96 | " nop \n" |
101 | : "=r"(flags) \ | 97 | : "=r"(flags) |
102 | : \ | 98 | : |
103 | : "memory"); \ | 99 | : "memory"); |
104 | return flags; | 100 | return flags; |
105 | } | 101 | } |
106 | 102 | ||
107 | #define raw_local_save_flags(flags) ((flags) = get_msr()) | 103 | static inline void arch_local_irq_restore(unsigned long flags) |
108 | #define raw_irqs_disabled() ((get_msr() & MSR_IE) == 0) | 104 | { |
109 | #define raw_irqs_disabled_flags(flags) ((flags & MSR_IE) == 0) | 105 | asm volatile(" mts rmsr, %0 \n" |
106 | " nop \n" | ||
107 | : | ||
108 | : "r"(flags) | ||
109 | : "memory"); | ||
110 | } | ||
111 | |||
112 | static inline bool arch_irqs_disabled_flags(unsigned long flags) | ||
113 | { | ||
114 | return (flags & MSR_IE) == 0; | ||
115 | } | ||
116 | |||
117 | static inline bool arch_irqs_disabled(void) | ||
118 | { | ||
119 | return arch_irqs_disabled_flags(arch_local_save_flags()); | ||
120 | } | ||
110 | 121 | ||
111 | #endif /* _ASM_MICROBLAZE_IRQFLAGS_H */ | 122 | #endif /* _ASM_MICROBLAZE_IRQFLAGS_H */ |