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 *addr
);
24 extern void *__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 = (*(volatile u8 *) (addr)); __v; })
34 #define in_be16(addr) \
35 ({ u16 __v = (*(volatile u16 *) (addr)); __v; })
36 #define in_be32(addr) \
37 ({ u32 __v = (*(volatile u32 *) (addr)); __v; })
38 #define in_le16(addr) \
39 ({ u16 __v = le16_to_cpu(*(volatile u16 *) (addr)); __v; })
40 #define in_le32(addr) \
41 ({ u32 __v = le32_to_cpu(*(volatile u32 *) (addr)); __v; })
43 #define out_8(addr,b) (void)((*(volatile u8 *) (addr)) = (b))
44 #define out_be16(addr,w) (void)((*(volatile u16 *) (addr)) = (w))
45 #define out_be32(addr,l) (void)((*(volatile u32 *) (addr)) = (l))
46 #define out_le16(addr,w) (void)((*(volatile u16 *) (addr)) = cpu_to_le16(w))
47 #define out_le32(addr,l) (void)((*(volatile u32 *) (addr)) = cpu_to_le32(l))
50 #define raw_inw in_be16
51 #define raw_inl in_be32
53 #define raw_outb(val,port) out_8((port),(val))
54 #define raw_outw(val,port) out_be16((port),(val))
55 #define raw_outl(val,port) out_be32((port),(val))
57 static inline void raw_insb(volatile u8
*port
, u8
*buf
, unsigned int len
)
61 for (i
= 0; i
< len
; i
++)
65 static inline void raw_outsb(volatile u8
*port
, const u8
*buf
,
70 for (i
= 0; i
< len
; i
++)
74 static inline void raw_insw(volatile u16
*port
, u16
*buf
, unsigned int nr
)
81 "1: movew %2@,%0@+; dbra %1,1b"
82 : "=a" (buf
), "=d" (tmp
)
83 : "a" (port
), "0" (buf
),
107 : "=a" (buf
), "=d" (tmp
)
108 : "a" (port
), "0" (buf
),
113 static inline void raw_outsw(volatile u16
*port
, const u16
*buf
,
121 "1: movew %0@+,%2@; dbra %1,1b"
122 : "=a" (buf
), "=d" (tmp
)
123 : "a" (port
), "0" (buf
),
147 : "=a" (buf
), "=d" (tmp
)
148 : "a" (port
), "0" (buf
),
153 static inline void raw_insl(volatile u32
*port
, u32
*buf
, unsigned int nr
)
160 "1: movel %2@,%0@+; dbra %1,1b"
161 : "=a" (buf
), "=d" (tmp
)
162 : "a" (port
), "0" (buf
),
186 : "=a" (buf
), "=d" (tmp
)
187 : "a" (port
), "0" (buf
),
192 static inline void raw_outsl(volatile u32
*port
, const u32
*buf
,
200 "1: movel %0@+,%2@; dbra %1,1b"
201 : "=a" (buf
), "=d" (tmp
)
202 : "a" (port
), "0" (buf
),
226 : "=a" (buf
), "=d" (tmp
)
227 : "a" (port
), "0" (buf
),
233 static inline void raw_insw_swapw(volatile u16
*port
, u16
*buf
,
238 ("\tmovel %0,%/a0\n\t"
242 "1:\tmovew %/a0@,%/d0\n\t"
244 "movew %/d0,%/a1@+\n\t"
247 : "g" (port
), "g" (buf
), "g" (nr
)
248 : "d0", "a0", "a1", "d6");
256 "1:\tmovew %/a0@,%/d0\n\t"
258 "movew %/d0,%/a1@+\n\t"
259 "movew %/a0@,%/d0\n\t"
261 "movew %/d0,%/a1@+\n\t"
262 "movew %/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"
282 : "g" (port
), "g" (buf
), "g" (nr
)
283 : "d0", "a0", "a1", "d6");
286 static inline void raw_outsw_swapw(volatile u16
*port
, const u16
*buf
,
295 "1:\tmovew %/a1@+,%/d0\n\t"
297 "movew %/d0,%/a0@\n\t"
300 : "g" (port
), "g" (buf
), "g" (nr
)
301 : "d0", "a0", "a1", "d6");
309 "1:\tmovew %/a1@+,%/d0\n\t"
311 "movew %/d0,%/a0@\n\t"
312 "movew %/a1@+,%/d0\n\t"
314 "movew %/d0,%/a0@\n\t"
315 "movew %/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"
335 : "g" (port
), "g" (buf
), "g" (nr
)
336 : "d0", "a0", "a1", "d6");
340 #endif /* __KERNEL__ */
342 #endif /* _RAW_IO_H */