aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-06-23 05:04:03 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-23 10:42:54 -0400
commit3f4cd389c3564caf1eec70957fcbd9d88c995d45 (patch)
treea7d5870592f04adc4ee2c2e004737a976b28f728
parenta8a77573c9e5345bcf6a963858745cd83c923f44 (diff)
[PATCH] frv: basic __iomem annotations
Add annotations to the FRV I/O handling functions for sparse. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/frv/mm/kmap.c6
-rw-r--r--include/asm-frv/io.h38
-rw-r--r--include/asm-frv/mb-regs.h27
3 files changed, 41 insertions, 30 deletions
diff --git a/arch/frv/mm/kmap.c b/arch/frv/mm/kmap.c
index c54f18e65ea6..40b62c5c2951 100644
--- a/arch/frv/mm/kmap.c
+++ b/arch/frv/mm/kmap.c
@@ -31,15 +31,15 @@
31 * Map some physical address range into the kernel address space. 31 * Map some physical address range into the kernel address space.
32 */ 32 */
33 33
34void *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag) 34void __iomem *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag)
35{ 35{
36 return (void *)physaddr; 36 return (void __iomem *)physaddr;
37} 37}
38 38
39/* 39/*
40 * Unmap a ioremap()ed region again 40 * Unmap a ioremap()ed region again
41 */ 41 */
42void iounmap(void *addr) 42void iounmap(void volatile __iomem *addr)
43{ 43{
44} 44}
45 45
diff --git a/include/asm-frv/io.h b/include/asm-frv/io.h
index b56eba59e3cd..f49398a82977 100644
--- a/include/asm-frv/io.h
+++ b/include/asm-frv/io.h
@@ -40,13 +40,13 @@ static inline unsigned long _swapl(unsigned long v)
40//#define __iormb() asm volatile("membar") 40//#define __iormb() asm volatile("membar")
41//#define __iowmb() asm volatile("membar") 41//#define __iowmb() asm volatile("membar")
42 42
43#define __raw_readb(addr) __builtin_read8((void *) (addr)) 43#define __raw_readb __builtin_read8
44#define __raw_readw(addr) __builtin_read16((void *) (addr)) 44#define __raw_readw __builtin_read16
45#define __raw_readl(addr) __builtin_read32((void *) (addr)) 45#define __raw_readl __builtin_read32
46 46
47#define __raw_writeb(datum, addr) __builtin_write8((void *) (addr), datum) 47#define __raw_writeb(datum, addr) __builtin_write8(addr, datum)
48#define __raw_writew(datum, addr) __builtin_write16((void *) (addr), datum) 48#define __raw_writew(datum, addr) __builtin_write16(addr, datum)
49#define __raw_writel(datum, addr) __builtin_write32((void *) (addr), datum) 49#define __raw_writel(datum, addr) __builtin_write32(addr, datum)
50 50
51static inline void io_outsb(unsigned int addr, const void *buf, int len) 51static inline void io_outsb(unsigned int addr, const void *buf, int len)
52{ 52{
@@ -128,12 +128,12 @@ static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int
128 128
129static inline uint8_t inb(unsigned long addr) 129static inline uint8_t inb(unsigned long addr)
130{ 130{
131 return __builtin_read8((void *)addr); 131 return __builtin_read8((void __iomem *)addr);
132} 132}
133 133
134static inline uint16_t inw(unsigned long addr) 134static inline uint16_t inw(unsigned long addr)
135{ 135{
136 uint16_t ret = __builtin_read16((void *)addr); 136 uint16_t ret = __builtin_read16((void __iomem *)addr);
137 137
138 if (__is_PCI_IO(addr)) 138 if (__is_PCI_IO(addr))
139 ret = _swapw(ret); 139 ret = _swapw(ret);
@@ -143,7 +143,7 @@ static inline uint16_t inw(unsigned long addr)
143 143
144static inline uint32_t inl(unsigned long addr) 144static inline uint32_t inl(unsigned long addr)
145{ 145{
146 uint32_t ret = __builtin_read32((void *)addr); 146 uint32_t ret = __builtin_read32((void __iomem *)addr);
147 147
148 if (__is_PCI_IO(addr)) 148 if (__is_PCI_IO(addr))
149 ret = _swapl(ret); 149 ret = _swapl(ret);
@@ -153,21 +153,21 @@ static inline uint32_t inl(unsigned long addr)
153 153
154static inline void outb(uint8_t datum, unsigned long addr) 154static inline void outb(uint8_t datum, unsigned long addr)
155{ 155{
156 __builtin_write8((void *)addr, datum); 156 __builtin_write8((void __iomem *)addr, datum);
157} 157}
158 158
159static inline void outw(uint16_t datum, unsigned long addr) 159static inline void outw(uint16_t datum, unsigned long addr)
160{ 160{
161 if (__is_PCI_IO(addr)) 161 if (__is_PCI_IO(addr))
162 datum = _swapw(datum); 162 datum = _swapw(datum);
163 __builtin_write16((void *)addr, datum); 163 __builtin_write16((void __iomem *)addr, datum);
164} 164}
165 165
166static inline void outl(uint32_t datum, unsigned long addr) 166static inline void outl(uint32_t datum, unsigned long addr)
167{ 167{
168 if (__is_PCI_IO(addr)) 168 if (__is_PCI_IO(addr))
169 datum = _swapl(datum); 169 datum = _swapl(datum);
170 __builtin_write32((void *)addr, datum); 170 __builtin_write32((void __iomem *)addr, datum);
171} 171}
172 172
173#define inb_p(addr) inb(addr) 173#define inb_p(addr) inb(addr)
@@ -189,12 +189,12 @@ static inline void outl(uint32_t datum, unsigned long addr)
189 189
190static inline uint8_t readb(const volatile void __iomem *addr) 190static inline uint8_t readb(const volatile void __iomem *addr)
191{ 191{
192 return __builtin_read8((volatile uint8_t __force *) addr); 192 return __builtin_read8((__force void volatile __iomem *) addr);
193} 193}
194 194
195static inline uint16_t readw(const volatile void __iomem *addr) 195static inline uint16_t readw(const volatile void __iomem *addr)
196{ 196{
197 uint16_t ret = __builtin_read16((volatile uint16_t __force *)addr); 197 uint16_t ret = __builtin_read16((__force void volatile __iomem *)addr);
198 198
199 if (__is_PCI_MEM(addr)) 199 if (__is_PCI_MEM(addr))
200 ret = _swapw(ret); 200 ret = _swapw(ret);
@@ -203,7 +203,7 @@ static inline uint16_t readw(const volatile void __iomem *addr)
203 203
204static inline uint32_t readl(const volatile void __iomem *addr) 204static inline uint32_t readl(const volatile void __iomem *addr)
205{ 205{
206 uint32_t ret = __builtin_read32((volatile uint32_t __force *)addr); 206 uint32_t ret = __builtin_read32((__force void volatile __iomem *)addr);
207 207
208 if (__is_PCI_MEM(addr)) 208 if (__is_PCI_MEM(addr))
209 ret = _swapl(ret); 209 ret = _swapl(ret);
@@ -217,7 +217,7 @@ static inline uint32_t readl(const volatile void __iomem *addr)
217 217
218static inline void writeb(uint8_t datum, volatile void __iomem *addr) 218static inline void writeb(uint8_t datum, volatile void __iomem *addr)
219{ 219{
220 __builtin_write8((volatile uint8_t __force *) addr, datum); 220 __builtin_write8(addr, datum);
221 if (__is_PCI_MEM(addr)) 221 if (__is_PCI_MEM(addr))
222 __flush_PCI_writes(); 222 __flush_PCI_writes();
223} 223}
@@ -227,7 +227,7 @@ static inline void writew(uint16_t datum, volatile void __iomem *addr)
227 if (__is_PCI_MEM(addr)) 227 if (__is_PCI_MEM(addr))
228 datum = _swapw(datum); 228 datum = _swapw(datum);
229 229
230 __builtin_write16((volatile uint16_t __force *) addr, datum); 230 __builtin_write16(addr, datum);
231 if (__is_PCI_MEM(addr)) 231 if (__is_PCI_MEM(addr))
232 __flush_PCI_writes(); 232 __flush_PCI_writes();
233} 233}
@@ -237,7 +237,7 @@ static inline void writel(uint32_t datum, volatile void __iomem *addr)
237 if (__is_PCI_MEM(addr)) 237 if (__is_PCI_MEM(addr))
238 datum = _swapl(datum); 238 datum = _swapl(datum);
239 239
240 __builtin_write32((volatile uint32_t __force *) addr, datum); 240 __builtin_write32(addr, datum);
241 if (__is_PCI_MEM(addr)) 241 if (__is_PCI_MEM(addr))
242 __flush_PCI_writes(); 242 __flush_PCI_writes();
243} 243}
@@ -271,7 +271,7 @@ static inline void __iomem *ioremap_fullcache(unsigned long physaddr, unsigned l
271 return __ioremap(physaddr, size, IOMAP_FULL_CACHING); 271 return __ioremap(physaddr, size, IOMAP_FULL_CACHING);
272} 272}
273 273
274extern void iounmap(void __iomem *addr); 274extern void iounmap(void volatile __iomem *addr);
275 275
276static inline void __iomem *ioport_map(unsigned long port, unsigned int nr) 276static inline void __iomem *ioport_map(unsigned long port, unsigned int nr)
277{ 277{
diff --git a/include/asm-frv/mb-regs.h b/include/asm-frv/mb-regs.h
index 93fa732fb0cd..219e5f926f18 100644
--- a/include/asm-frv/mb-regs.h
+++ b/include/asm-frv/mb-regs.h
@@ -16,6 +16,17 @@
16#include <asm/sections.h> 16#include <asm/sections.h>
17#include <asm/mem-layout.h> 17#include <asm/mem-layout.h>
18 18
19#ifndef __ASSEMBLY__
20/* gcc builtins, annotated */
21
22unsigned long __builtin_read8(volatile void __iomem *);
23unsigned long __builtin_read16(volatile void __iomem *);
24unsigned long __builtin_read32(volatile void __iomem *);
25void __builtin_write8(volatile void __iomem *, unsigned char);
26void __builtin_write16(volatile void __iomem *, unsigned short);
27void __builtin_write32(volatile void __iomem *, unsigned long);
28#endif
29
19#define __region_IO KERNEL_IO_START /* the region from 0xe0000000 to 0xffffffff has suitable 30#define __region_IO KERNEL_IO_START /* the region from 0xe0000000 to 0xffffffff has suitable
20 * protection laid over the top for use in memory-mapped 31 * protection laid over the top for use in memory-mapped
21 * I/O 32 * I/O
@@ -59,7 +70,7 @@
59#define __region_PCI_MEM (__region_CS2 + 0x08000000UL) 70#define __region_PCI_MEM (__region_CS2 + 0x08000000UL)
60#define __flush_PCI_writes() \ 71#define __flush_PCI_writes() \
61do { \ 72do { \
62 __builtin_write8((volatile void *) __region_PCI_MEM, 0); \ 73 __builtin_write8((volatile void __iomem *) __region_PCI_MEM, 0); \
63} while(0) 74} while(0)
64 75
65#define __is_PCI_IO(addr) \ 76#define __is_PCI_IO(addr) \
@@ -83,15 +94,15 @@ extern int __nongprelbss mb93090_mb00_detected;
83#define __set_LEDS(X) \ 94#define __set_LEDS(X) \
84do { \ 95do { \
85 if (mb93090_mb00_detected) \ 96 if (mb93090_mb00_detected) \
86 __builtin_write32((void *) __addr_LEDS(), ~(X)); \ 97 __builtin_write32((void __iomem *) __addr_LEDS(), ~(X)); \
87} while (0) 98} while (0)
88#else 99#else
89#define __set_LEDS(X) 100#define __set_LEDS(X)
90#endif 101#endif
91 102
92#define __addr_LCD() (__region_CS2 + 0x01200008UL) 103#define __addr_LCD() (__region_CS2 + 0x01200008UL)
93#define __get_LCD(B) __builtin_read32((volatile void *) (B)) 104#define __get_LCD(B) __builtin_read32((volatile void __iomem *) (B))
94#define __set_LCD(B,X) __builtin_write32((volatile void *) (B), (X)) 105#define __set_LCD(B,X) __builtin_write32((volatile void __iomem *) (B), (X))
95 106
96#define LCD_D 0x000000ff /* LCD data bus */ 107#define LCD_D 0x000000ff /* LCD data bus */
97#define LCD_RW 0x00000100 /* LCD R/W signal */ 108#define LCD_RW 0x00000100 /* LCD R/W signal */
@@ -161,11 +172,11 @@ do { \
161#define __get_CLKIN() 66000000UL 172#define __get_CLKIN() 66000000UL
162 173
163#define __addr_LEDS() (__region_CS2 + 0x00000023UL) 174#define __addr_LEDS() (__region_CS2 + 0x00000023UL)
164#define __set_LEDS(X) __builtin_write8((volatile void *) __addr_LEDS(), (X)) 175#define __set_LEDS(X) __builtin_write8((volatile void __iomem *) __addr_LEDS(), (X))
165 176
166#define __addr_FPGATR() (__region_CS2 + 0x00000030UL) 177#define __addr_FPGATR() (__region_CS2 + 0x00000030UL)
167#define __set_FPGATR(X) __builtin_write32((volatile void *) __addr_FPGATR(), (X)) 178#define __set_FPGATR(X) __builtin_write32((volatile void __iomem *) __addr_FPGATR(), (X))
168#define __get_FPGATR() __builtin_read32((volatile void *) __addr_FPGATR()) 179#define __get_FPGATR() __builtin_read32((volatile void __iomem *) __addr_FPGATR())
169 180
170#define MB93093_FPGA_FPGATR_AUDIO_CLK 0x00000003 181#define MB93093_FPGA_FPGATR_AUDIO_CLK 0x00000003
171 182
@@ -180,7 +191,7 @@ do { \
180#define MB93093_FPGA_SWR_PUSHSWMASK (0x1F<<26) 191#define MB93093_FPGA_SWR_PUSHSWMASK (0x1F<<26)
181#define MB93093_FPGA_SWR_PUSHSW4 (1<<29) 192#define MB93093_FPGA_SWR_PUSHSW4 (1<<29)
182 193
183#define __addr_FPGA_SWR ((volatile void *)(__region_CS2 + 0x28UL)) 194#define __addr_FPGA_SWR ((volatile void __iomem *)(__region_CS2 + 0x28UL))
184#define __get_FPGA_PUSHSW1_5() (__builtin_read32(__addr_FPGA_SWR) & MB93093_FPGA_SWR_PUSHSWMASK) 195#define __get_FPGA_PUSHSW1_5() (__builtin_read32(__addr_FPGA_SWR) & MB93093_FPGA_SWR_PUSHSWMASK)
185 196
186 197