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/mach-common/def_LPBlackfin.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/mach-common/def_LPBlackfin.h')
-rw-r--r-- | include/asm-blackfin/mach-common/def_LPBlackfin.h | 132 |
1 files changed, 64 insertions, 68 deletions
diff --git a/include/asm-blackfin/mach-common/def_LPBlackfin.h b/include/asm-blackfin/mach-common/def_LPBlackfin.h index be1ece8c0c27..260515d15280 100644 --- a/include/asm-blackfin/mach-common/def_LPBlackfin.h +++ b/include/asm-blackfin/mach-common/def_LPBlackfin.h | |||
@@ -33,81 +33,77 @@ | |||
33 | 33 | ||
34 | #include <asm/mach/anomaly.h> | 34 | #include <asm/mach/anomaly.h> |
35 | 35 | ||
36 | /*#if !defined(__ADSPLPBLACKFIN__) | ||
37 | #warning def_LPBlackfin.h should only be included for 532 compatible chips. | ||
38 | #endif | ||
39 | */ | ||
40 | |||
41 | #define MK_BMSK_(x) (1<<x) | 36 | #define MK_BMSK_(x) (1<<x) |
42 | 37 | ||
43 | #if defined(ANOMALY_05000198) | 38 | #ifndef __ASSEMBLY__ |
44 | |||
45 | #define bfin_read8(addr) ({ unsigned char __v; \ | ||
46 | __asm__ __volatile__ ("NOP;\n\t" \ | ||
47 | "%0 = b[%1] (z);\n\t" \ | ||
48 | : "=d"(__v) : "a"(addr)); \ | ||
49 | __v; }) | ||
50 | |||
51 | #define bfin_read16(addr) ({ unsigned __v; \ | ||
52 | __asm__ __volatile__ ("NOP;\n\t"\ | ||
53 | "%0 = w[%1] (z);\n\t"\ | ||
54 | : "=d"(__v) : "a"(addr)); (unsigned short)__v; }) | ||
55 | |||
56 | #define bfin_read32(addr) ({ unsigned __v; \ | ||
57 | __asm__ __volatile__ ("NOP;\n\t"\ | ||
58 | "%0 = [%1];\n\t"\ | ||
59 | : "=d"(__v) : "a"(addr)); __v; }) | ||
60 | 39 | ||
61 | #define bfin_write8(addr, val) ({ \ | 40 | #include <linux/types.h> |
62 | __asm__ __volatile__ ("NOP;\n\t" \ | ||
63 | "b[%0] = %1;\n\t" \ | ||
64 | : : "a"(addr), "d"(val) : "memory");}) | ||
65 | |||
66 | #define bfin_write16(addr,val) ({\ | ||
67 | __asm__ __volatile__ ("NOP;\n\t"\ | ||
68 | "w[%0] = %1;\n\t"\ | ||
69 | : : "a"(addr) , "d"(val) : "memory");}) | ||
70 | |||
71 | #define bfin_write32(addr,val) ({\ | ||
72 | __asm__ __volatile__ ("NOP;\n\t"\ | ||
73 | "[%0] = %1;\n\t"\ | ||
74 | : : "a"(addr) , "d"(val) : "memory");}) | ||
75 | 41 | ||
42 | #if ANOMALY_05000198 | ||
43 | # define NOP_PAD_ANOMALY_05000198 "nop;" | ||
76 | #else | 44 | #else |
77 | 45 | # define NOP_PAD_ANOMALY_05000198 | |
78 | #define bfin_read8(addr) ({ unsigned char __v; \ | ||
79 | __asm__ __volatile__ ( \ | ||
80 | "%0 = b[%1] (z);\n\t" \ | ||
81 | :"=d"(__v) : "a"(addr)); \ | ||
82 | __v; }) | ||
83 | |||
84 | #define bfin_read16(addr) ({ unsigned __v; \ | ||
85 | __asm__ __volatile__ (\ | ||
86 | "%0 = w[%1] (z);\n\t"\ | ||
87 | : "=d"(__v) : "a"(addr)); (unsigned short)__v; }) | ||
88 | |||
89 | #define bfin_read32(addr) ({ unsigned __v; \ | ||
90 | __asm__ __volatile__ (\ | ||
91 | "%0 = [%1];\n\t"\ | ||
92 | : "=d"(__v) : "a"(addr)); __v; }) | ||
93 | |||
94 | #define bfin_write8(addr, val) ({ \ | ||
95 | __asm__ __volatile__ ( \ | ||
96 | "b[%0] = %1; \n\t" \ | ||
97 | ::"a"(addr), "d"(val) : "memory");}) | ||
98 | |||
99 | #define bfin_write16(addr,val) ({\ | ||
100 | __asm__ __volatile__ (\ | ||
101 | "w[%0] = %1;\n\t"\ | ||
102 | : : "a"(addr) , "d"(val) : "memory");}) | ||
103 | |||
104 | #define bfin_write32(addr,val) ({\ | ||
105 | __asm__ __volatile__ (\ | ||
106 | "[%0] = %1;\n\t"\ | ||
107 | : : "a"(addr) , "d"(val) : "memory");}) | ||
108 | |||
109 | #endif | 46 | #endif |
110 | 47 | ||
48 | #define bfin_read8(addr) ({ \ | ||
49 | uint8_t __v; \ | ||
50 | __asm__ __volatile__( \ | ||
51 | NOP_PAD_ANOMALY_05000198 \ | ||
52 | "%0 = b[%1] (z);" \ | ||
53 | : "=d" (__v) \ | ||
54 | : "a" (addr) \ | ||
55 | ); \ | ||
56 | __v; }) | ||
57 | |||
58 | #define bfin_read16(addr) ({ \ | ||
59 | uint16_t __v; \ | ||
60 | __asm__ __volatile__( \ | ||
61 | NOP_PAD_ANOMALY_05000198 \ | ||
62 | "%0 = w[%1] (z);" \ | ||
63 | : "=d" (__v) \ | ||
64 | : "a" (addr) \ | ||
65 | ); \ | ||
66 | __v; }) | ||
67 | |||
68 | #define bfin_read32(addr) ({ \ | ||
69 | uint32_t __v; \ | ||
70 | __asm__ __volatile__( \ | ||
71 | NOP_PAD_ANOMALY_05000198 \ | ||
72 | "%0 = [%1];" \ | ||
73 | : "=d" (__v) \ | ||
74 | : "a" (addr) \ | ||
75 | ); \ | ||
76 | __v; }) | ||
77 | |||
78 | #define bfin_write8(addr, val) \ | ||
79 | __asm__ __volatile__( \ | ||
80 | NOP_PAD_ANOMALY_05000198 \ | ||
81 | "b[%0] = %1;" \ | ||
82 | : \ | ||
83 | : "a" (addr), "d" (val) \ | ||
84 | : "memory" \ | ||
85 | ) | ||
86 | |||
87 | #define bfin_write16(addr, val) \ | ||
88 | __asm__ __volatile__( \ | ||
89 | NOP_PAD_ANOMALY_05000198 \ | ||
90 | "w[%0] = %1;" \ | ||
91 | : \ | ||
92 | : "a" (addr), "d" (val) \ | ||
93 | : "memory" \ | ||
94 | ) | ||
95 | |||
96 | #define bfin_write32(addr, val) \ | ||
97 | __asm__ __volatile__( \ | ||
98 | NOP_PAD_ANOMALY_05000198 \ | ||
99 | "[%0] = %1;" \ | ||
100 | : \ | ||
101 | : "a" (addr), "d" (val) \ | ||
102 | : "memory" \ | ||
103 | ) | ||
104 | |||
105 | #endif /* __ASSEMBLY__ */ | ||
106 | |||
111 | /************************************************** | 107 | /************************************************** |
112 | * System Register Bits | 108 | * System Register Bits |
113 | **************************************************/ | 109 | **************************************************/ |