~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/m32r/include/asm/io.h

Version: ~ [ linux-5.9-rc6 ] ~ [ linux-5.8.10 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.66 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.146 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.198 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.236 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.236 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #ifndef _ASM_M32R_IO_H
  2 #define _ASM_M32R_IO_H
  3 
  4 #include <linux/string.h>
  5 #include <linux/compiler.h>
  6 #include <asm/page.h>  /* __va */
  7 
  8 #ifdef __KERNEL__
  9 
 10 #define IO_SPACE_LIMIT  0xFFFFFFFF
 11 
 12 /**
 13  *      virt_to_phys    -       map virtual addresses to physical
 14  *      @address: address to remap
 15  *
 16  *      The returned physical address is the physical (CPU) mapping for
 17  *      the memory address given. It is only valid to use this function on
 18  *      addresses directly mapped or allocated via kmalloc.
 19  *
 20  *      This function does not give bus mappings for DMA transfers. In
 21  *      almost all conceivable cases a device driver should not be using
 22  *      this function
 23  */
 24 
 25 static inline unsigned long virt_to_phys(volatile void * address)
 26 {
 27         return __pa(address);
 28 }
 29 
 30 /**
 31  *      phys_to_virt    -       map physical address to virtual
 32  *      @address: address to remap
 33  *
 34  *      The returned virtual address is a current CPU mapping for
 35  *      the memory address given. It is only valid to use this function on
 36  *      addresses that have a kernel mapping
 37  *
 38  *      This function does not handle bus mappings for DMA transfers. In
 39  *      almost all conceivable cases a device driver should not be using
 40  *      this function
 41  */
 42 
 43 static inline void *phys_to_virt(unsigned long address)
 44 {
 45         return __va(address);
 46 }
 47 
 48 extern void __iomem *
 49 __ioremap(unsigned long offset, unsigned long size, unsigned long flags);
 50 
 51 /**
 52  *      ioremap         -       map bus memory into CPU space
 53  *      @offset:        bus address of the memory
 54  *      @size:          size of the resource to map
 55  *
 56  *      ioremap performs a platform specific sequence of operations to
 57  *      make bus memory CPU accessible via the readb/readw/readl/writeb/
 58  *      writew/writel functions and the other mmio helpers. The returned
 59  *      address is not guaranteed to be usable directly as a virtual
 60  *      address.
 61  */
 62 
 63 static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
 64 {
 65         return __ioremap(offset, size, 0);
 66 }
 67 
 68 extern void iounmap(volatile void __iomem *addr);
 69 #define ioremap_nocache(off,size) ioremap(off,size)
 70 #define ioremap_wc ioremap_nocache
 71 #define ioremap_wt ioremap_nocache
 72 #define ioremap_uc ioremap_nocache
 73 
 74 /*
 75  * IO bus memory addresses are also 1:1 with the physical address
 76  */
 77 #define page_to_phys(page)      (page_to_pfn(page) << PAGE_SHIFT)
 78 #define page_to_bus     page_to_phys
 79 #define virt_to_bus     virt_to_phys
 80 
 81 extern unsigned char _inb(unsigned long);
 82 extern unsigned short _inw(unsigned long);
 83 extern unsigned long _inl(unsigned long);
 84 extern unsigned char _inb_p(unsigned long);
 85 extern unsigned short _inw_p(unsigned long);
 86 extern unsigned long _inl_p(unsigned long);
 87 extern void _outb(unsigned char, unsigned long);
 88 extern void _outw(unsigned short, unsigned long);
 89 extern void _outl(unsigned long, unsigned long);
 90 extern void _outb_p(unsigned char, unsigned long);
 91 extern void _outw_p(unsigned short, unsigned long);
 92 extern void _outl_p(unsigned long, unsigned long);
 93 extern void _insb(unsigned int, void *, unsigned long);
 94 extern void _insw(unsigned int, void *, unsigned long);
 95 extern void _insl(unsigned int, void *, unsigned long);
 96 extern void _outsb(unsigned int, const void *, unsigned long);
 97 extern void _outsw(unsigned int, const void *, unsigned long);
 98 extern void _outsl(unsigned int, const void *, unsigned long);
 99 
100 static inline unsigned char _readb(unsigned long addr)
101 {
102         return *(volatile unsigned char __force *)addr;
103 }
104 
105 static inline unsigned short _readw(unsigned long addr)
106 {
107         return *(volatile unsigned short __force *)addr;
108 }
109 
110 static inline unsigned long _readl(unsigned long addr)
111 {
112         return *(volatile unsigned long __force *)addr;
113 }
114 
115 static inline void _writeb(unsigned char b, unsigned long addr)
116 {
117         *(volatile unsigned char __force *)addr = b;
118 }
119 
120 static inline void _writew(unsigned short w, unsigned long addr)
121 {
122         *(volatile unsigned short __force *)addr = w;
123 }
124 
125 static inline void _writel(unsigned long l, unsigned long addr)
126 {
127         *(volatile unsigned long __force *)addr = l;
128 }
129 
130 #define inb     _inb
131 #define inw     _inw
132 #define inl     _inl
133 #define outb    _outb
134 #define outw    _outw
135 #define outl    _outl
136 
137 #define inb_p   _inb_p
138 #define inw_p   _inw_p
139 #define inl_p   _inl_p
140 #define outb_p  _outb_p
141 #define outw_p  _outw_p
142 #define outl_p  _outl_p
143 
144 #define insb    _insb
145 #define insw    _insw
146 #define insl    _insl
147 #define outsb   _outsb
148 #define outsw   _outsw
149 #define outsl   _outsl
150 
151 #define readb(addr)   _readb((unsigned long)(addr))
152 #define readw(addr)   _readw((unsigned long)(addr))
153 #define readl(addr)   _readl((unsigned long)(addr))
154 #define __raw_readb readb
155 #define __raw_readw readw
156 #define __raw_readl readl
157 #define readb_relaxed readb
158 #define readw_relaxed readw
159 #define readl_relaxed readl
160 
161 #define writeb(val, addr)  _writeb((val), (unsigned long)(addr))
162 #define writew(val, addr)  _writew((val), (unsigned long)(addr))
163 #define writel(val, addr)  _writel((val), (unsigned long)(addr))
164 #define __raw_writeb writeb
165 #define __raw_writew writew
166 #define __raw_writel writel
167 #define writeb_relaxed writeb
168 #define writew_relaxed writew
169 #define writel_relaxed writel
170 
171 #define ioread8 readb
172 #define ioread16 readw
173 #define ioread32 readl
174 #define iowrite8 writeb
175 #define iowrite16 writew
176 #define iowrite32 writel
177 
178 #define ioread8_rep(p, dst, count) insb((unsigned long)(p), (dst), (count))
179 #define ioread16_rep(p, dst, count) insw((unsigned long)(p), (dst), (count))
180 #define ioread32_rep(p, dst, count) insl((unsigned long)(p), (dst), (count))
181 
182 #define iowrite8_rep(p, src, count) outsb((unsigned long)(p), (src), (count))
183 #define iowrite16_rep(p, src, count) outsw((unsigned long)(p), (src), (count))
184 #define iowrite32_rep(p, src, count) outsl((unsigned long)(p), (src), (count))
185 
186 #define ioread16be(addr)        be16_to_cpu(readw(addr))
187 #define ioread32be(addr)        be32_to_cpu(readl(addr))
188 #define iowrite16be(v, addr)    writew(cpu_to_be16(v), (addr))
189 #define iowrite32be(v, addr)    writel(cpu_to_be32(v), (addr))
190 
191 #define mmiowb()
192 
193 #define flush_write_buffers() do { } while (0)  /* M32R_FIXME */
194 
195 static inline void
196 memset_io(volatile void __iomem *addr, unsigned char val, int count)
197 {
198         memset((void __force *) addr, val, count);
199 }
200 
201 static inline void
202 memcpy_fromio(void *dst, volatile void __iomem *src, int count)
203 {
204         memcpy(dst, (void __force *) src, count);
205 }
206 
207 static inline void
208 memcpy_toio(volatile void __iomem *dst, const void *src, int count)
209 {
210         memcpy((void __force *) dst, src, count);
211 }
212 
213 /*
214  * Convert a physical pointer to a virtual kernel pointer for /dev/mem
215  * access
216  */
217 #define xlate_dev_mem_ptr(p)    __va(p)
218 
219 /*
220  * Convert a virtual cached pointer to an uncached pointer
221  */
222 #define xlate_dev_kmem_ptr(p)   p
223 
224 #endif  /* __KERNEL__ */
225 
226 #endif  /* _ASM_M32R_IO_H */
227 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp