diff options
author | Mike Frysinger <vapier.adi@gmail.com> | 2008-11-18 04:48:22 -0500 |
---|---|---|
committer | Bryan Wu <cooloney@kernel.org> | 2008-11-18 04:48:22 -0500 |
commit | b60705765a635728187e5cea5f36914886675013 (patch) | |
tree | 400a8fd966f117140511bf4606f96084c208c14f /arch/blackfin/include/asm/irq.h | |
parent | b1271d31a59e73a70284c2cdcbe2b0589f6479c7 (diff) |
Blackfin arch: move out irq related functions
move irq related functions into asm/irq.h and out of the mondo asm/system.h
Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Diffstat (limited to 'arch/blackfin/include/asm/irq.h')
-rw-r--r-- | arch/blackfin/include/asm/irq.h | 92 |
1 files changed, 91 insertions, 1 deletions
diff --git a/arch/blackfin/include/asm/irq.h b/arch/blackfin/include/asm/irq.h index 9377816fa18a..e43c20583fcd 100644 --- a/arch/blackfin/include/asm/irq.h +++ b/arch/blackfin/include/asm/irq.h | |||
@@ -19,11 +19,101 @@ | |||
19 | 19 | ||
20 | /* SYS_IRQS and NR_IRQS are defined in <mach-bf5xx/irq.h>*/ | 20 | /* SYS_IRQS and NR_IRQS are defined in <mach-bf5xx/irq.h>*/ |
21 | #include <mach/irq.h> | 21 | #include <mach/irq.h> |
22 | #include <asm/ptrace.h> | 22 | #include <asm/pda.h> |
23 | #include <asm/processor.h> | ||
23 | 24 | ||
24 | static __inline__ int irq_canonicalize(int irq) | 25 | static __inline__ int irq_canonicalize(int irq) |
25 | { | 26 | { |
26 | return irq; | 27 | return irq; |
27 | } | 28 | } |
28 | 29 | ||
30 | /* | ||
31 | * Interrupt configuring macros. | ||
32 | */ | ||
33 | #define local_irq_disable() \ | ||
34 | do { \ | ||
35 | int __tmp_dummy; \ | ||
36 | __asm__ __volatile__( \ | ||
37 | "cli %0;" \ | ||
38 | : "=d" (__tmp_dummy) \ | ||
39 | ); \ | ||
40 | } while (0) | ||
41 | |||
42 | #if ANOMALY_05000244 && defined(CONFIG_BFIN_ICACHE) | ||
43 | # define NOP_PAD_ANOMALY_05000244 "nop; nop;" | ||
44 | #else | ||
45 | # define NOP_PAD_ANOMALY_05000244 | ||
46 | #endif | ||
47 | |||
48 | #ifdef CONFIG_SMP | ||
49 | /* Forward decl needed due to cdef inter dependencies */ | ||
50 | static inline uint32_t __pure bfin_dspid(void); | ||
51 | # define blackfin_core_id() (bfin_dspid() & 0xff) | ||
52 | # define irq_flags cpu_pda[blackfin_core_id()].imask | ||
53 | #else | ||
54 | extern unsigned long irq_flags; | ||
55 | #endif | ||
56 | |||
57 | #define local_irq_enable() \ | ||
58 | __asm__ __volatile__( \ | ||
59 | "sti %0;" \ | ||
60 | : \ | ||
61 | : "d" (irq_flags) \ | ||
62 | ) | ||
63 | |||
64 | #define idle_with_irq_disabled() \ | ||
65 | __asm__ __volatile__( \ | ||
66 | NOP_PAD_ANOMALY_05000244 \ | ||
67 | ".align 8;" \ | ||
68 | "sti %0;" \ | ||
69 | "idle;" \ | ||
70 | : \ | ||
71 | : "d" (irq_flags) \ | ||
72 | ) | ||
73 | |||
74 | #ifdef CONFIG_DEBUG_HWERR | ||
75 | # define __save_and_cli(x) \ | ||
76 | __asm__ __volatile__( \ | ||
77 | "cli %0;" \ | ||
78 | "sti %1;" \ | ||
79 | : "=&d" (x) \ | ||
80 | : "d" (0x3F) \ | ||
81 | ) | ||
82 | #else | ||
83 | # define __save_and_cli(x) \ | ||
84 | __asm__ __volatile__( \ | ||
85 | "cli %0;" \ | ||
86 | : "=&d" (x) \ | ||
87 | ) | ||
88 | #endif | ||
89 | |||
90 | #define local_save_flags(x) \ | ||
91 | __asm__ __volatile__( \ | ||
92 | "cli %0;" \ | ||
93 | "sti %0;" \ | ||
94 | : "=d" (x) \ | ||
95 | ) | ||
96 | |||
97 | #ifdef CONFIG_DEBUG_HWERR | ||
98 | #define irqs_enabled_from_flags(x) (((x) & ~0x3f) != 0) | ||
99 | #else | ||
100 | #define irqs_enabled_from_flags(x) ((x) != 0x1f) | ||
101 | #endif | ||
102 | |||
103 | #define local_irq_restore(x) \ | ||
104 | do { \ | ||
105 | if (irqs_enabled_from_flags(x)) \ | ||
106 | local_irq_enable(); \ | ||
107 | } while (0) | ||
108 | |||
109 | /* For spinlocks etc */ | ||
110 | #define local_irq_save(x) __save_and_cli(x) | ||
111 | |||
112 | #define irqs_disabled() \ | ||
113 | ({ \ | ||
114 | unsigned long flags; \ | ||
115 | local_save_flags(flags); \ | ||
116 | !irqs_enabled_from_flags(flags); \ | ||
117 | }) | ||
118 | |||
29 | #endif /* _BFIN_IRQ_H_ */ | 119 | #endif /* _BFIN_IRQ_H_ */ |