aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-generic/iomap.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-generic/iomap.h')
-rw-r--r--include/asm-generic/iomap.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/include/asm-generic/iomap.h b/include/asm-generic/iomap.h
new file mode 100644
index 000000000000..4991543d44c8
--- /dev/null
+++ b/include/asm-generic/iomap.h
@@ -0,0 +1,63 @@
1#ifndef __GENERIC_IO_H
2#define __GENERIC_IO_H
3
4#include <linux/linkage.h>
5
6/*
7 * These are the "generic" interfaces for doing new-style
8 * memory-mapped or PIO accesses. Architectures may do
9 * their own arch-optimized versions, these just act as
10 * wrappers around the old-style IO register access functions:
11 * read[bwl]/write[bwl]/in[bwl]/out[bwl]
12 *
13 * Don't include this directly, include it from <asm/io.h>.
14 */
15
16/*
17 * Read/write from/to an (offsettable) iomem cookie. It might be a PIO
18 * access or a MMIO access, these functions don't care. The info is
19 * encoded in the hardware mapping set up by the mapping functions
20 * (or the cookie itself, depending on implementation and hw).
21 *
22 * The generic routines just encode the PIO/MMIO as part of the
23 * cookie, and coldly assume that the MMIO IO mappings are not
24 * in the low address range. Architectures for which this is not
25 * true can't use this generic implementation.
26 */
27extern unsigned int fastcall ioread8(void __iomem *);
28extern unsigned int fastcall ioread16(void __iomem *);
29extern unsigned int fastcall ioread32(void __iomem *);
30
31extern void fastcall iowrite8(u8, void __iomem *);
32extern void fastcall iowrite16(u16, void __iomem *);
33extern void fastcall iowrite32(u32, void __iomem *);
34
35/*
36 * "string" versions of the above. Note that they
37 * use native byte ordering for the accesses (on
38 * the assumption that IO and memory agree on a
39 * byte order, and CPU byteorder is irrelevant).
40 *
41 * They do _not_ update the port address. If you
42 * want MMIO that copies stuff laid out in MMIO
43 * memory across multiple ports, use "memcpy_toio()"
44 * and friends.
45 */
46extern void fastcall ioread8_rep(void __iomem *port, void *buf, unsigned long count);
47extern void fastcall ioread16_rep(void __iomem *port, void *buf, unsigned long count);
48extern void fastcall ioread32_rep(void __iomem *port, void *buf, unsigned long count);
49
50extern void fastcall iowrite8_rep(void __iomem *port, const void *buf, unsigned long count);
51extern void fastcall iowrite16_rep(void __iomem *port, const void *buf, unsigned long count);
52extern void fastcall iowrite32_rep(void __iomem *port, const void *buf, unsigned long count);
53
54/* Create a virtual mapping cookie for an IO port range */
55extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
56extern void ioport_unmap(void __iomem *);
57
58/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
59struct pci_dev;
60extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
61extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
62
63#endif