Go to the documentation of this file.
11 #ifndef _ASM_MICROBLAZE_IO_H
12 #define _ASM_MICROBLAZE_IO_H
14 #include <asm/byteorder.h>
16 #include <linux/types.h>
22 #define _ISA_MEM_BASE 0
23 #define PCI_DRAM_OFFSET 0
25 #define _IO_BASE isa_io_base
26 #define _ISA_MEM_BASE isa_mem_base
27 #define PCI_DRAM_OFFSET pci_dram_offset
36 #define IO_SPACE_LIMIT (0xFFFFFFFF)
44 return *(
volatile unsigned char __force *)addr;
48 return *(
volatile unsigned short __force *)addr;
52 return *(
volatile unsigned int __force *)addr;
56 return *(
volatile unsigned long __force *)addr;
60 *(
volatile unsigned char __force *)addr = v;
64 *(
volatile unsigned short __force *)addr = v;
68 *(
volatile unsigned int __force *)addr = v;
72 *(
volatile unsigned long __force *)addr = v;
82 return *(
volatile unsigned char __force *)addr;
88 static inline unsigned int readl(
const volatile void __iomem *addr)
92 static inline void writeb(
unsigned char v,
volatile void __iomem *addr)
94 *(
volatile unsigned char __force *)addr = v;
96 static inline void writew(
unsigned short v,
volatile void __iomem *addr)
100 static inline void writel(
unsigned int v,
volatile void __iomem *addr)
108 #define ioread8(addr) __raw_readb((u8 *)(addr))
109 #define ioread16(addr) __raw_readw((u16 *)(addr))
110 #define ioread32(addr) __raw_readl((u32 *)(addr))
111 #define iowrite8(v, addr) __raw_writeb((u8)(v), (u8 *)(addr))
112 #define iowrite16(v, addr) __raw_writew((u16)(v), (u16 *)(addr))
113 #define iowrite32(v, addr) __raw_writel((u32)(v), (u32 *)(addr))
115 #define ioread16be(addr) __raw_readw((u16 *)(addr))
116 #define ioread32be(addr) __raw_readl((u32 *)(addr))
117 #define iowrite16be(v, addr) __raw_writew((u16)(v), (u16 *)(addr))
118 #define iowrite32be(v, addr) __raw_writel((u32)(v), (u32 *)(addr))
126 #define inb(port) readb((u8 *)((port)))
127 #define outb(val, port) writeb((val), (u8 *)((unsigned long)(port)))
128 #define inw(port) readw((u16 *)((port)))
129 #define outw(val, port) writew((val), (u16 *)((unsigned long)(port)))
130 #define inl(port) readl((u32 *)((port)))
131 #define outl(val, port) writel((val), (u32 *)((unsigned long)(port)))
133 #define inb_p(port) inb((port))
134 #define outb_p(val, port) outb((val), (port))
135 #define inw_p(port) inw((port))
136 #define outw_p(val, port) outw((val), (port))
137 #define inl_p(port) inl((port))
138 #define outl_p(val, port) outl((val), (port))
140 #define memset_io(a, b, c) memset((void *)(a), (b), (c))
141 #define memcpy_fromio(a, b, c) memcpy((a), (void *)(b), (c))
142 #define memcpy_toio(a, b, c) memcpy((void *)(a), (b), (c))
146 #define phys_to_virt(addr) ((void *)__phys_to_virt(addr))
147 #define virt_to_phys(addr) ((unsigned long)__virt_to_phys(addr))
148 #define virt_to_bus(addr) ((unsigned long)__virt_to_phys(addr))
150 #define page_to_bus(page) (page_to_phys(page))
151 #define bus_to_virt(addr) (phys_to_virt(addr))
153 extern void iounmap(
void *addr);
157 #define ioremap_writethrough(addr, size) ioremap((addr), (size))
158 #define ioremap_nocache(addr, size) ioremap((addr), (size))
159 #define ioremap_fullcache(addr, size) ioremap((addr), (size))
177 return __pa((
unsigned long)address);
180 #define virt_to_bus virt_to_phys
196 return (
void *)
__va(address);
199 #define bus_to_virt(a) phys_to_virt(a)
207 #define ioremap(physaddr, size) ((void __iomem *)(unsigned long)(physaddr))
208 #define iounmap(addr) ((void)0)
209 #define ioremap_nocache(physaddr, size) ioremap(physaddr, size)
217 #define xlate_dev_mem_ptr(p) __va(p)
222 #define xlate_dev_kmem_ptr(p) p
227 #define out_be32(a, v) __raw_writel((v), (void __iomem __force *)(a))
228 #define out_be16(a, v) __raw_writew((v), (a))
230 #define in_be32(a) __raw_readl((const void __iomem __force *)(a))
231 #define in_be16(a) __raw_readw(a)
233 #define writel_be(v, a) out_be32((__force unsigned *)a, v)
234 #define readl_be(a) in_be32((__force unsigned *)a)
240 #define out_le32(a, v) __raw_writel(__cpu_to_le32(v), (a))
241 #define out_le16(a, v) __raw_writew(__cpu_to_le16(v), (a))
243 #define in_le32(a) __le32_to_cpu(__raw_readl(a))
244 #define in_le16(a) __le16_to_cpu(__raw_readw(a))
247 #define out_8(a, v) __raw_writeb((v), (a))
248 #define in_8(a) __raw_readb(a)
252 #define ioport_map(port, nr) ((void __iomem *)(port))
253 #define ioport_unmap(addr)
283 static inline void insl(
unsigned long addr,
void *buffer,
int count)
296 static inline void outsb(
unsigned long addr,
const void *buffer,
int count)
308 static inline void outsw(
unsigned long addr,
const void *buffer,
int count)
320 static inline void outsl(
unsigned long addr,
const void *buffer,
int count)
331 #define ioread8_rep(p, dst, count) \
332 insb((unsigned long) (p), (dst), (count))
333 #define ioread16_rep(p, dst, count) \
334 insw((unsigned long) (p), (dst), (count))
335 #define ioread32_rep(p, dst, count) \
336 insl((unsigned long) (p), (dst), (count))
338 #define iowrite8_rep(p, src, count) \
339 outsb((unsigned long) (p), (src), (count))
340 #define iowrite16_rep(p, src, count) \
341 outsw((unsigned long) (p), (src), (count))
342 #define iowrite32_rep(p, src, count) \
343 outsl((unsigned long) (p), (src), (count))