|
@@ -228,3 +228,98 @@ extern int pci_ioremap_io(unsigned int offset, phys_addr_t phys_addr);
|
|
* by introducing sequence points into the in*() definitions. Note that
|
|
* by introducing sequence points into the in*() definitions. Note that
|
|
* __raw_* do not guarantee this behaviour.
|
|
* __raw_* do not guarantee this behaviour.
|
|
*
|
|
*
|
|
|
|
+ * The {in,out}[bwl] macros are for emulating x86-style PCI/ISA IO space.
|
|
|
|
+ */
|
|
|
|
+#ifdef __io
|
|
|
|
+#define outb(v,p) ({ __iowmb(); __raw_writeb(v,__io(p)); })
|
|
|
|
+#define outw(v,p) ({ __iowmb(); __raw_writew((__force __u16) \
|
|
|
|
+ cpu_to_le16(v),__io(p)); })
|
|
|
|
+#define outl(v,p) ({ __iowmb(); __raw_writel((__force __u32) \
|
|
|
|
+ cpu_to_le32(v),__io(p)); })
|
|
|
|
+
|
|
|
|
+#define inb(p) ({ __u8 __v = __raw_readb(__io(p)); __iormb(); __v; })
|
|
|
|
+#define inw(p) ({ __u16 __v = le16_to_cpu((__force __le16) \
|
|
|
|
+ __raw_readw(__io(p))); __iormb(); __v; })
|
|
|
|
+#define inl(p) ({ __u32 __v = le32_to_cpu((__force __le32) \
|
|
|
|
+ __raw_readl(__io(p))); __iormb(); __v; })
|
|
|
|
+
|
|
|
|
+#define outsb(p,d,l) __raw_writesb(__io(p),d,l)
|
|
|
|
+#define outsw(p,d,l) __raw_writesw(__io(p),d,l)
|
|
|
|
+#define outsl(p,d,l) __raw_writesl(__io(p),d,l)
|
|
|
|
+
|
|
|
|
+#define insb(p,d,l) __raw_readsb(__io(p),d,l)
|
|
|
|
+#define insw(p,d,l) __raw_readsw(__io(p),d,l)
|
|
|
|
+#define insl(p,d,l) __raw_readsl(__io(p),d,l)
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+#define outb_p(val,port) outb((val),(port))
|
|
|
|
+#define outw_p(val,port) outw((val),(port))
|
|
|
|
+#define outl_p(val,port) outl((val),(port))
|
|
|
|
+#define inb_p(port) inb((port))
|
|
|
|
+#define inw_p(port) inw((port))
|
|
|
|
+#define inl_p(port) inl((port))
|
|
|
|
+
|
|
|
|
+#define outsb_p(port,from,len) outsb(port,from,len)
|
|
|
|
+#define outsw_p(port,from,len) outsw(port,from,len)
|
|
|
|
+#define outsl_p(port,from,len) outsl(port,from,len)
|
|
|
|
+#define insb_p(port,to,len) insb(port,to,len)
|
|
|
|
+#define insw_p(port,to,len) insw(port,to,len)
|
|
|
|
+#define insl_p(port,to,len) insl(port,to,len)
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * String version of IO memory access ops:
|
|
|
|
+ */
|
|
|
|
+extern void _memcpy_fromio(void *, const volatile void __iomem *, size_t);
|
|
|
|
+extern void _memcpy_toio(volatile void __iomem *, const void *, size_t);
|
|
|
|
+extern void _memset_io(volatile void __iomem *, int, size_t);
|
|
|
|
+
|
|
|
|
+#define mmiowb()
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * Memory access primitives
|
|
|
|
+ * ------------------------
|
|
|
|
+ *
|
|
|
|
+ * These perform PCI memory accesses via an ioremap region. They don't
|
|
|
|
+ * take an address as such, but a cookie.
|
|
|
|
+ *
|
|
|
|
+ * Again, this are defined to perform little endian accesses. See the
|
|
|
|
+ * IO port primitives for more information.
|
|
|
|
+ */
|
|
|
|
+#ifndef readl
|
|
|
|
+#define readb_relaxed(c) ({ u8 __r = __raw_readb(c); __r; })
|
|
|
|
+#define readw_relaxed(c) ({ u16 __r = le16_to_cpu((__force __le16) \
|
|
|
|
+ __raw_readw(c)); __r; })
|
|
|
|
+#define readl_relaxed(c) ({ u32 __r = le32_to_cpu((__force __le32) \
|
|
|
|
+ __raw_readl(c)); __r; })
|
|
|
|
+
|
|
|
|
+#define writeb_relaxed(v,c) __raw_writeb(v,c)
|
|
|
|
+#define writew_relaxed(v,c) __raw_writew((__force u16) cpu_to_le16(v),c)
|
|
|
|
+#define writel_relaxed(v,c) __raw_writel((__force u32) cpu_to_le32(v),c)
|
|
|
|
+
|
|
|
|
+#define readb(c) ({ u8 __v = readb_relaxed(c); __iormb(); __v; })
|
|
|
|
+#define readw(c) ({ u16 __v = readw_relaxed(c); __iormb(); __v; })
|
|
|
|
+#define readl(c) ({ u32 __v = readl_relaxed(c); __iormb(); __v; })
|
|
|
|
+
|
|
|
|
+#define writeb(v,c) ({ __iowmb(); writeb_relaxed(v,c); })
|
|
|
|
+#define writew(v,c) ({ __iowmb(); writew_relaxed(v,c); })
|
|
|
|
+#define writel(v,c) ({ __iowmb(); writel_relaxed(v,c); })
|
|
|
|
+
|
|
|
|
+#define readsb(p,d,l) __raw_readsb(p,d,l)
|
|
|
|
+#define readsw(p,d,l) __raw_readsw(p,d,l)
|
|
|
|
+#define readsl(p,d,l) __raw_readsl(p,d,l)
|
|
|
|
+
|
|
|
|
+#define writesb(p,d,l) __raw_writesb(p,d,l)
|
|
|
|
+#define writesw(p,d,l) __raw_writesw(p,d,l)
|
|
|
|
+#define writesl(p,d,l) __raw_writesl(p,d,l)
|
|
|
|
+
|
|
|
|
+#define memset_io(c,v,l) _memset_io(c,(v),(l))
|
|
|
|
+#define memcpy_fromio(a,c,l) _memcpy_fromio((a),c,(l))
|
|
|
|
+#define memcpy_toio(c,a,l) _memcpy_toio(c,(a),(l))
|
|
|
|
+
|
|
|
|
+#endif /* readl */
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * ioremap and friends.
|
|
|
|
+ *
|
|
|
|
+ * ioremap takes a PCI memory address, as specified in
|
|
|
|
+ * Documentation/io-mapping.txt.
|