diff options
author | Mike Frysinger <michael.frysinger@analog.com> | 2007-07-24 23:19:14 -0400 |
---|---|---|
committer | Bryan Wu <bryan.wu@analog.com> | 2007-07-24 23:19:14 -0400 |
commit | 1aafd9091226a02b481298315f959f777294684e (patch) | |
tree | b09e0aaabb6aacd882499a69b28638cbd669dbba /include/asm-blackfin/system.h | |
parent | 287050fe13bf34824f03b4351002b0e2db4ee5cb (diff) |
Blackfin arch: revise anomaly handling by basing things on the compiler not the kconfig defines
revise anomaly handling by basing things on the compiler not the kconfig defines,
so the header is stable and usable outside of the kernel. This also allows us to
move some code from preprocessing to compiling (gcc culls dead code)
which should help with code quality (readability, catch minor bugs, etc...).
Signed-off-by: Mike Frysinger <michael.frysinger@analog.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Diffstat (limited to 'include/asm-blackfin/system.h')
-rw-r--r-- | include/asm-blackfin/system.h | 93 |
1 files changed, 51 insertions, 42 deletions
diff --git a/include/asm-blackfin/system.h b/include/asm-blackfin/system.h index 5e5f1a0566c0..b03cf7d5b9a3 100644 --- a/include/asm-blackfin/system.h +++ b/include/asm-blackfin/system.h | |||
@@ -36,6 +36,7 @@ | |||
36 | 36 | ||
37 | #include <linux/linkage.h> | 37 | #include <linux/linkage.h> |
38 | #include <linux/compiler.h> | 38 | #include <linux/compiler.h> |
39 | #include <asm/mach/anomaly.h> | ||
39 | 40 | ||
40 | /* | 41 | /* |
41 | * Interrupt configuring macros. | 42 | * Interrupt configuring macros. |
@@ -43,53 +44,60 @@ | |||
43 | 44 | ||
44 | extern unsigned long irq_flags; | 45 | extern unsigned long irq_flags; |
45 | 46 | ||
46 | #define local_irq_enable() do { \ | 47 | #define local_irq_enable() \ |
47 | __asm__ __volatile__ ( \ | 48 | __asm__ __volatile__( \ |
48 | "sti %0;" \ | 49 | "sti %0;" \ |
49 | ::"d"(irq_flags)); \ | 50 | : \ |
50 | } while (0) | 51 | : "d" (irq_flags) \ |
52 | ) | ||
51 | 53 | ||
52 | #define local_irq_disable() do { \ | 54 | #define local_irq_disable() \ |
53 | int _tmp_dummy; \ | 55 | do { \ |
54 | __asm__ __volatile__ ( \ | 56 | int __tmp_dummy; \ |
55 | "cli %0;" \ | 57 | __asm__ __volatile__( \ |
56 | :"=d" (_tmp_dummy):); \ | 58 | "cli %0;" \ |
57 | } while (0) | 59 | : "=d" (__tmp_dummy) \ |
60 | ); \ | ||
61 | } while (0) | ||
58 | 62 | ||
59 | #if defined(ANOMALY_05000244) && defined (CONFIG_BLKFIN_CACHE) | 63 | #if ANOMALY_05000244 && defined(CONFIG_BLKFIN_CACHE) |
60 | #define idle_with_irq_disabled() do { \ | 64 | # define NOP_PAD_ANOMALY_05000244 "nop; nop;" |
61 | __asm__ __volatile__ ( \ | ||
62 | "nop; nop;\n" \ | ||
63 | ".align 8;\n" \ | ||
64 | "sti %0; idle;\n" \ | ||
65 | ::"d" (irq_flags)); \ | ||
66 | } while (0) | ||
67 | #else | 65 | #else |
68 | #define idle_with_irq_disabled() do { \ | 66 | # define NOP_PAD_ANOMALY_05000244 |
69 | __asm__ __volatile__ ( \ | ||
70 | ".align 8;\n" \ | ||
71 | "sti %0; idle;\n" \ | ||
72 | ::"d" (irq_flags)); \ | ||
73 | } while (0) | ||
74 | #endif | 67 | #endif |
75 | 68 | ||
69 | #define idle_with_irq_disabled() \ | ||
70 | __asm__ __volatile__( \ | ||
71 | NOP_PAD_ANOMALY_05000244 \ | ||
72 | ".align 8;" \ | ||
73 | "sti %0;" \ | ||
74 | "idle;" \ | ||
75 | : \ | ||
76 | : "d" (irq_flags) \ | ||
77 | ) | ||
78 | |||
76 | #ifdef CONFIG_DEBUG_HWERR | 79 | #ifdef CONFIG_DEBUG_HWERR |
77 | #define __save_and_cli(x) do { \ | 80 | # define __save_and_cli(x) \ |
78 | __asm__ __volatile__ ( \ | 81 | __asm__ __volatile__( \ |
79 | "cli %0;\n\tsti %1;" \ | 82 | "cli %0;" \ |
80 | :"=&d"(x): "d" (0x3F)); \ | 83 | "sti %1;" \ |
81 | } while (0) | 84 | : "=&d" (x) \ |
85 | : "d" (0x3F) \ | ||
86 | ) | ||
82 | #else | 87 | #else |
83 | #define __save_and_cli(x) do { \ | 88 | # define __save_and_cli(x) \ |
84 | __asm__ __volatile__ ( \ | 89 | __asm__ __volatile__( \ |
85 | "cli %0;" \ | 90 | "cli %0;" \ |
86 | :"=&d"(x):); \ | 91 | : "=&d" (x) \ |
87 | } while (0) | 92 | ) |
88 | #endif | 93 | #endif |
89 | 94 | ||
90 | #define local_save_flags(x) asm volatile ("cli %0;" \ | 95 | #define local_save_flags(x) \ |
91 | "sti %0;" \ | 96 | __asm__ __volatile__( \ |
92 | :"=d"(x):); | 97 | "cli %0;" \ |
98 | "sti %0;" \ | ||
99 | : "=d" (x) \ | ||
100 | ) | ||
93 | 101 | ||
94 | #ifdef CONFIG_DEBUG_HWERR | 102 | #ifdef CONFIG_DEBUG_HWERR |
95 | #define irqs_enabled_from_flags(x) (((x) & ~0x3f) != 0) | 103 | #define irqs_enabled_from_flags(x) (((x) & ~0x3f) != 0) |
@@ -97,10 +105,11 @@ extern unsigned long irq_flags; | |||
97 | #define irqs_enabled_from_flags(x) ((x) != 0x1f) | 105 | #define irqs_enabled_from_flags(x) ((x) != 0x1f) |
98 | #endif | 106 | #endif |
99 | 107 | ||
100 | #define local_irq_restore(x) do { \ | 108 | #define local_irq_restore(x) \ |
101 | if (irqs_enabled_from_flags(x)) \ | 109 | do { \ |
102 | local_irq_enable (); \ | 110 | if (irqs_enabled_from_flags(x)) \ |
103 | } while (0) | 111 | local_irq_enable(); \ |
112 | } while (0) | ||
104 | 113 | ||
105 | /* For spinlocks etc */ | 114 | /* For spinlocks etc */ |
106 | #define local_irq_save(x) __save_and_cli(x) | 115 | #define local_irq_save(x) __save_and_cli(x) |