aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-blackfin/blackfin.h
diff options
context:
space:
mode:
authorMike Frysinger <michael.frysinger@analog.com>2007-07-24 23:19:14 -0400
committerBryan Wu <bryan.wu@analog.com>2007-07-24 23:19:14 -0400
commit1aafd9091226a02b481298315f959f777294684e (patch)
treeb09e0aaabb6aacd882499a69b28638cbd669dbba /include/asm-blackfin/blackfin.h
parent287050fe13bf34824f03b4351002b0e2db4ee5cb (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/blackfin.h')
-rw-r--r--include/asm-blackfin/blackfin.h118
1 files changed, 56 insertions, 62 deletions
diff --git a/include/asm-blackfin/blackfin.h b/include/asm-blackfin/blackfin.h
index 25b934b7f829..1b2dd5a3fe7a 100644
--- a/include/asm-blackfin/blackfin.h
+++ b/include/asm-blackfin/blackfin.h
@@ -17,72 +17,66 @@
17#ifndef __ASSEMBLY__ 17#ifndef __ASSEMBLY__
18 18
19/* SSYNC implementation for C file */ 19/* SSYNC implementation for C file */
20#if defined(ANOMALY_05000312) && defined(ANOMALY_05000244) 20static inline void SSYNC(void)
21static inline void SSYNC (void)
22{ 21{
23 int _tmp; 22 int _tmp;
24 __asm__ __volatile__ ("cli %0;\n\t" 23 if (ANOMALY_05000312 && ANOMALY_05000244)
25 "nop;nop;\n\t" 24 __asm__ __volatile__(
26 "ssync;\n\t" 25 "cli %0;"
27 "sti %0;\n\t" 26 "nop;"
28 :"=d"(_tmp):); 27 "nop;"
28 "ssync;"
29 "sti %0;"
30 : "=d" (_tmp)
31 );
32 else if (ANOMALY_05000312 && !ANOMALY_05000244)
33 __asm__ __volatile__(
34 "cli %0;"
35 "ssync;"
36 "sti %0;"
37 : "=d" (_tmp)
38 );
39 else if (!ANOMALY_05000312 && ANOMALY_05000244)
40 __asm__ __volatile__(
41 "nop;"
42 "nop;"
43 "nop;"
44 "ssync;"
45 );
46 else
47 __asm__ __volatile__("ssync;");
29} 48}
30#elif defined(ANOMALY_05000312) && !defined(ANOMALY_05000244)
31static inline void SSYNC (void)
32{
33 int _tmp;
34 __asm__ __volatile__ ("cli %0;\n\t"
35 "ssync;\n\t"
36 "sti %0;\n\t"
37 :"=d"(_tmp):);
38}
39#elif !defined(ANOMALY_05000312) && defined(ANOMALY_05000244)
40static inline void SSYNC (void)
41{
42 __asm__ __volatile__ ("nop; nop; nop;\n\t"
43 "ssync;\n\t"
44 ::);
45}
46#elif !defined(ANOMALY_05000312) && !defined(ANOMALY_05000244)
47static inline void SSYNC (void)
48{
49 __asm__ __volatile__ ("ssync;\n\t");
50}
51#endif
52 49
53/* CSYNC implementation for C file */ 50/* CSYNC implementation for C file */
54#if defined(ANOMALY_05000312) && defined(ANOMALY_05000244) 51static inline void CSYNC(void)
55static inline void CSYNC (void)
56{ 52{
57 int _tmp; 53 int _tmp;
58 __asm__ __volatile__ ("cli %0;\n\t" 54 if (ANOMALY_05000312 && ANOMALY_05000244)
59 "nop;nop;\n\t" 55 __asm__ __volatile__(
60 "csync;\n\t" 56 "cli %0;"
61 "sti %0;\n\t" 57 "nop;"
62 :"=d"(_tmp):); 58 "nop;"
63} 59 "csync;"
64#elif defined(ANOMALY_05000312) && !defined(ANOMALY_05000244) 60 "sti %0;"
65static inline void CSYNC (void) 61 : "=d" (_tmp)
66{ 62 );
67 int _tmp; 63 else if (ANOMALY_05000312 && !ANOMALY_05000244)
68 __asm__ __volatile__ ("cli %0;\n\t" 64 __asm__ __volatile__(
69 "csync;\n\t" 65 "cli %0;"
70 "sti %0;\n\t" 66 "csync;"
71 :"=d"(_tmp):); 67 "sti %0;"
72} 68 : "=d" (_tmp)
73#elif !defined(ANOMALY_05000312) && defined(ANOMALY_05000244) 69 );
74static inline void CSYNC (void) 70 else if (!ANOMALY_05000312 && ANOMALY_05000244)
75{ 71 __asm__ __volatile__(
76 __asm__ __volatile__ ("nop; nop; nop;\n\t" 72 "nop;"
77 "ssync;\n\t" 73 "nop;"
78 ::); 74 "nop;"
79} 75 "ssync;"
80#elif !defined(ANOMALY_05000312) && !defined(ANOMALY_05000244) 76 );
81static inline void CSYNC (void) 77 else
82{ 78 __asm__ __volatile__("csync;");
83 __asm__ __volatile__ ("csync;\n\t");
84} 79}
85#endif
86 80
87#else /* __ASSEMBLY__ */ 81#else /* __ASSEMBLY__ */
88 82
@@ -91,19 +85,19 @@ static inline void CSYNC (void)
91#define ssync(x) SSYNC(x) 85#define ssync(x) SSYNC(x)
92#define csync(x) CSYNC(x) 86#define csync(x) CSYNC(x)
93 87
94#if defined(ANOMALY_05000312) && defined(ANOMALY_05000244) 88#if ANOMALY_05000312 && ANOMALY_05000244
95#define SSYNC(scratch) cli scratch; nop; nop; SSYNC; sti scratch; 89#define SSYNC(scratch) cli scratch; nop; nop; SSYNC; sti scratch;
96#define CSYNC(scratch) cli scratch; nop; nop; CSYNC; sti scratch; 90#define CSYNC(scratch) cli scratch; nop; nop; CSYNC; sti scratch;
97 91
98#elif defined(ANOMALY_05000312) && !defined(ANOMALY_05000244) 92#elif ANOMALY_05000312 && !ANOMALY_05000244
99#define SSYNC(scratch) cli scratch; nop; nop; SSYNC; sti scratch; 93#define SSYNC(scratch) cli scratch; nop; nop; SSYNC; sti scratch;
100#define CSYNC(scratch) cli scratch; nop; nop; CSYNC; sti scratch; 94#define CSYNC(scratch) cli scratch; nop; nop; CSYNC; sti scratch;
101 95
102#elif !defined(ANOMALY_05000312) && defined(ANOMALY_05000244) 96#elif !ANOMALY_05000312 && ANOMALY_05000244
103#define SSYNC(scratch) nop; nop; nop; SSYNC; 97#define SSYNC(scratch) nop; nop; nop; SSYNC;
104#define CSYNC(scratch) nop; nop; nop; CSYNC; 98#define CSYNC(scratch) nop; nop; nop; CSYNC;
105 99
106#elif !defined(ANOMALY_05000312) && !defined(ANOMALY_05000244) 100#elif !ANOMALY_05000312 && !ANOMALY_05000244
107#define SSYNC(scratch) SSYNC; 101#define SSYNC(scratch) SSYNC;
108#define CSYNC(scratch) CSYNC; 102#define CSYNC(scratch) CSYNC;
109 103