2 * linux/include/asm-m68k/raw_io.h
4 * 10/20/00 RZ: - created from bits of io.h and ide.h to cleanup namespace
13 #include <asm/types.h>
16 /* Values for nocacheflag and cmode */
17 #define IOMAP_FULL_CACHING 0
18 #define IOMAP_NOCACHE_SER 1
19 #define IOMAP_NOCACHE_NONSER 2
20 #define IOMAP_WRITETHROUGH 3
22 extern void iounmap(void __iomem
*addr
);
24 extern void __iomem
*__ioremap(unsigned long physaddr
, unsigned long size
,
26 extern void __iounmap(void *addr
, unsigned long size
);
29 /* ++roman: The assignments to temp. vars avoid that gcc sometimes generates
30 * two accesses to memory, which may be undesirable for some devices.
33 ({ u8 __v = (*(__force volatile u8 *) (addr)); __v; })
34 #define in_be16(addr) \
35 ({ u16 __v = (*(__force volatile u16 *) (addr)); __v; })
36 #define in_be32(addr) \
37 ({ u32 __v = (*(__force volatile u32 *) (addr)); __v; })
38 #define in_le16(addr) \
39 ({ u16 __v = le16_to_cpu(*(__force volatile __le16 *) (addr)); __v; })
40 #define in_le32(addr) \
41 ({ u32 __v = le32_to_cpu(*(__force volatile __le32 *) (addr)); __v; })
43 #define out_8(addr,b) (void)((*(__force volatile u8 *) (addr)) = (b))
44 #define out_be16(addr,w) (void)((*(__force volatile u16 *) (addr)) = (w))
45 #define out_be32(addr,l) (void)((*(__force volatile u32 *) (addr)) = (l))
46 #define out_le16(addr,w) (void)((*(__force volatile __le16 *) (addr)) = cpu_to_le16(w))
47 #define out_le32(addr,l) (void)((*(__force volatile __le32 *) (addr)) = cpu_to_le32(l))
50 #define raw_inw in_be16
51 #define raw_inl in_be32
52 #define __raw_readb in_8
53 #define __raw_readw in_be16
54 #define __raw_readl in_be32
56 #define raw_outb(val,port) out_8((port),(val))
57 #define raw_outw(val,port) out_be16((port),(val))
58 #define raw_outl(val,port) out_be32((port),(val))
59 #define __raw_writeb(val,addr) out_8((addr),(val))
60 #define __raw_writew(val,addr) out_be16((addr),(val))
61 #define __raw_writel(val,addr) out_be32((addr),(val))
63 static inline void raw_insb(volatile u8 __iomem
*port
, u8
*buf
, unsigned int len
)
67 for (i
= 0; i
< len
; i
++)
71 static inline void raw_outsb(volatile u8 __iomem
*port
, const u8
*buf
,
76 for (i
= 0; i
< len
; i
++)
80 static inline void raw_insw(volatile u16 __iomem
*port
, u16
*buf
, unsigned int nr
)
87 "1: movew %2@,%0@+; dbra %1,1b"
88 : "=a" (buf
), "=d" (tmp
)
89 : "a" (port
), "0" (buf
),
113 : "=a" (buf
), "=d" (tmp
)
114 : "a" (port
), "0" (buf
),
119 static inline void raw_outsw(volatile u16 __iomem
*port
, const u16
*buf
,
127 "1: movew %0@+,%2@; dbra %1,1b"
128 : "=a" (buf
), "=d" (tmp
)
129 : "a" (port
), "0" (buf
),
153 : "=a" (buf
), "=d" (tmp
)
154 : "a" (port
), "0" (buf
),
159 static inline void raw_insl(volatile u32 __iomem
*port
, u32
*buf
, unsigned int nr
)
166 "1: movel %2@,%0@+; dbra %1,1b"
167 : "=a" (buf
), "=d" (tmp
)
168 : "a" (port
), "0" (buf
),
192 : "=a" (buf
), "=d" (tmp
)
193 : "a" (port
), "0" (buf
),
198 static inline void raw_outsl(volatile u32 __iomem
*port
, const u32
*buf
,
206 "1: movel %0@+,%2@; dbra %1,1b"
207 : "=a" (buf
), "=d" (tmp
)
208 : "a" (port
), "0" (buf
),
232 : "=a" (buf
), "=d" (tmp
)
233 : "a" (port
), "0" (buf
),
239 static inline void raw_insw_swapw(volatile u16 __iomem
*port
, u16
*buf
,
244 ("\tmovel %0,%/a0\n\t"
248 "1:\tmovew %/a0@,%/d0\n\t"
250 "movew %/d0,%/a1@+\n\t"
253 : "g" (port
), "g" (buf
), "g" (nr
)
254 : "d0", "a0", "a1", "d6");
262 "1:\tmovew %/a0@,%/d0\n\t"
264 "movew %/d0,%/a1@+\n\t"
265 "movew %/a0@,%/d0\n\t"
267 "movew %/d0,%/a1@+\n\t"
268 "movew %/a0@,%/d0\n\t"
270 "movew %/d0,%/a1@+\n\t"
271 "movew %/a0@,%/d0\n\t"
273 "movew %/d0,%/a1@+\n\t"
274 "movew %/a0@,%/d0\n\t"
276 "movew %/d0,%/a1@+\n\t"
277 "movew %/a0@,%/d0\n\t"
279 "movew %/d0,%/a1@+\n\t"
280 "movew %/a0@,%/d0\n\t"
282 "movew %/d0,%/a1@+\n\t"
283 "movew %/a0@,%/d0\n\t"
285 "movew %/d0,%/a1@+\n\t"
288 : "g" (port
), "g" (buf
), "g" (nr
)
289 : "d0", "a0", "a1", "d6");
292 static inline void raw_outsw_swapw(volatile u16 __iomem
*port
, const u16
*buf
,
301 "1:\tmovew %/a1@+,%/d0\n\t"
303 "movew %/d0,%/a0@\n\t"
306 : "g" (port
), "g" (buf
), "g" (nr
)
307 : "d0", "a0", "a1", "d6");
315 "1:\tmovew %/a1@+,%/d0\n\t"
317 "movew %/d0,%/a0@\n\t"
318 "movew %/a1@+,%/d0\n\t"
320 "movew %/d0,%/a0@\n\t"
321 "movew %/a1@+,%/d0\n\t"
323 "movew %/d0,%/a0@\n\t"
324 "movew %/a1@+,%/d0\n\t"
326 "movew %/d0,%/a0@\n\t"
327 "movew %/a1@+,%/d0\n\t"
329 "movew %/d0,%/a0@\n\t"
330 "movew %/a1@+,%/d0\n\t"
332 "movew %/d0,%/a0@\n\t"
333 "movew %/a1@+,%/d0\n\t"
335 "movew %/d0,%/a0@\n\t"
336 "movew %/a1@+,%/d0\n\t"
338 "movew %/d0,%/a0@\n\t"
341 : "g" (port
), "g" (buf
), "g" (nr
)
342 : "d0", "a0", "a1", "d6");
345 #endif /* __KERNEL__ */
347 #endif /* _RAW_IO_H */