1 #ifndef _M68KNOMMU_IO_H
2 #define _M68KNOMMU_IO_H
6 #include <asm/virtconvert.h>
25 static inline unsigned short _swapw(
volatile unsigned short v)
27 return ((v << 8) | (v >> 8));
30 static inline unsigned int _swapl(
volatile unsigned long v)
32 return ((v << 24) | ((v & 0xff00) << 8) | ((v & 0xff0000) >> 8) | (v >> 24));
36 ({ unsigned char __v = (*(volatile unsigned char *) (addr)); __v; })
38 ({ unsigned short __v = (*(volatile unsigned short *) (addr)); __v; })
40 ({ unsigned int __v = (*(volatile unsigned int *) (addr)); __v; })
42 #define readb_relaxed(addr) readb(addr)
43 #define readw_relaxed(addr) readw(addr)
44 #define readl_relaxed(addr) readl(addr)
46 #define writeb(b,addr) (void)((*(volatile unsigned char *) (addr)) = (b))
47 #define writew(b,addr) (void)((*(volatile unsigned short *) (addr)) = (b))
48 #define writel(b,addr) (void)((*(volatile unsigned int *) (addr)) = (b))
50 #define __raw_readb readb
51 #define __raw_readw readw
52 #define __raw_readl readl
53 #define __raw_writeb writeb
54 #define __raw_writew writew
55 #define __raw_writel writel
57 static inline void io_outsb(
unsigned int addr,
void *
buf,
int len)
59 volatile unsigned char *ap = (
volatile unsigned char *) addr;
60 unsigned char *bp = (
unsigned char *) buf;
65 static inline void io_outsw(
unsigned int addr,
void *buf,
int len)
67 volatile unsigned short *ap = (
volatile unsigned short *) addr;
68 unsigned short *bp = (
unsigned short *) buf;
73 static inline void io_outsl(
unsigned int addr,
void *buf,
int len)
75 volatile unsigned int *ap = (
volatile unsigned int *) addr;
76 unsigned int *bp = (
unsigned int *) buf;
81 static inline void io_insb(
unsigned int addr,
void *buf,
int len)
83 volatile unsigned char *ap = (
volatile unsigned char *) addr;
84 unsigned char *bp = (
unsigned char *) buf;
89 static inline void io_insw(
unsigned int addr,
void *buf,
int len)
91 volatile unsigned short *ap = (
volatile unsigned short *) addr;
92 unsigned short *bp = (
unsigned short *) buf;
97 static inline void io_insl(
unsigned int addr,
void *buf,
int len)
99 volatile unsigned int *ap = (
volatile unsigned int *) addr;
100 unsigned int *bp = (
unsigned int *) buf;
112 #define memset_io(a,b,c) memset((void *)(a),(b),(c))
113 #define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c))
114 #define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c))
116 #define inb(addr) readb(addr)
117 #define inw(addr) readw(addr)
118 #define inl(addr) readl(addr)
119 #define outb(x,addr) ((void) writeb(x,addr))
120 #define outw(x,addr) ((void) writew(x,addr))
121 #define outl(x,addr) ((void) writel(x,addr))
123 #define inb_p(addr) inb(addr)
124 #define inw_p(addr) inw(addr)
125 #define inl_p(addr) inl(addr)
126 #define outb_p(x,addr) outb(x,addr)
127 #define outw_p(x,addr) outw(x,addr)
128 #define outl_p(x,addr) outl(x,addr)
130 #define outsb(a,b,l) io_outsb(a,b,l)
131 #define outsw(a,b,l) io_outsw(a,b,l)
132 #define outsl(a,b,l) io_outsl(a,b,l)
134 #define insb(a,b,l) io_insb(a,b,l)
135 #define insw(a,b,l) io_insw(a,b,l)
136 #define insl(a,b,l) io_insl(a,b,l)
138 #define IO_SPACE_LIMIT 0xffffffff
142 #define IOMAP_FULL_CACHING 0
143 #define IOMAP_NOCACHE_SER 1
144 #define IOMAP_NOCACHE_NONSER 2
145 #define IOMAP_WRITETHROUGH 3
147 static inline void *
__ioremap(
unsigned long physaddr,
unsigned long size,
int cacheflag)
149 return (
void *) physaddr;
151 static inline void *
ioremap(
unsigned long physaddr,
unsigned long size)
153 return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
155 static inline void *
ioremap_nocache(
unsigned long physaddr,
unsigned long size)
157 return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
161 return __ioremap(physaddr, size, IOMAP_WRITETHROUGH);
163 static inline void *
ioremap_fullcache(
unsigned long physaddr,
unsigned long size)
165 return __ioremap(physaddr, size, IOMAP_FULL_CACHING);
168 #define iounmap(addr) do { } while(0)
174 #define xlate_dev_mem_ptr(p) __va(p)
179 #define xlate_dev_kmem_ptr(p) p