Blame view

include/asm-generic/iomap.h 2.8 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
  #ifndef __GENERIC_IO_H
  #define __GENERIC_IO_H
  
  #include <linux/linkage.h>
dae409a27   James Bottomley   [PATCH] add Big E...
5
  #include <asm/byteorder.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
  
  /*
   * These are the "generic" interfaces for doing new-style
   * memory-mapped or PIO accesses. Architectures may do
   * their own arch-optimized versions, these just act as
   * wrappers around the old-style IO register access functions:
   * read[bwl]/write[bwl]/in[bwl]/out[bwl]
   *
   * Don't include this directly, include it from <asm/io.h>.
   */
  
  /*
   * Read/write from/to an (offsettable) iomem cookie. It might be a PIO
   * access or a MMIO access, these functions don't care. The info is
   * encoded in the hardware mapping set up by the mapping functions
   * (or the cookie itself, depending on implementation and hw).
   *
   * The generic routines just encode the PIO/MMIO as part of the
   * cookie, and coldly assume that the MMIO IO mappings are not
   * in the low address range. Architectures for which this is not
   * true can't use this generic implementation.
   */
144b2a914   Harvey Harrison   asm-generic: remo...
28
29
30
31
32
  extern unsigned int ioread8(void __iomem *);
  extern unsigned int ioread16(void __iomem *);
  extern unsigned int ioread16be(void __iomem *);
  extern unsigned int ioread32(void __iomem *);
  extern unsigned int ioread32be(void __iomem *);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
33

144b2a914   Harvey Harrison   asm-generic: remo...
34
35
36
37
38
  extern void iowrite8(u8, void __iomem *);
  extern void iowrite16(u16, void __iomem *);
  extern void iowrite16be(u16, void __iomem *);
  extern void iowrite32(u32, void __iomem *);
  extern void iowrite32be(u32, void __iomem *);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
39
40
41
42
43
44
45
46
47
48
49
50
  
  /*
   * "string" versions of the above. Note that they
   * use native byte ordering for the accesses (on
   * the assumption that IO and memory agree on a
   * byte order, and CPU byteorder is irrelevant).
   *
   * They do _not_ update the port address. If you
   * want MMIO that copies stuff laid out in MMIO
   * memory across multiple ports, use "memcpy_toio()"
   * and friends.
   */
144b2a914   Harvey Harrison   asm-generic: remo...
51
52
53
  extern void ioread8_rep(void __iomem *port, void *buf, unsigned long count);
  extern void ioread16_rep(void __iomem *port, void *buf, unsigned long count);
  extern void ioread32_rep(void __iomem *port, void *buf, unsigned long count);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
54

144b2a914   Harvey Harrison   asm-generic: remo...
55
56
57
  extern void iowrite8_rep(void __iomem *port, const void *buf, unsigned long count);
  extern void iowrite16_rep(void __iomem *port, const void *buf, unsigned long count);
  extern void iowrite32_rep(void __iomem *port, const void *buf, unsigned long count);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
58

82ed223c2   Jonas Bonn   iomap: make IOPOR...
59
  #ifdef CONFIG_HAS_IOPORT
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
60
61
62
  /* Create a virtual mapping cookie for an IO port range */
  extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
  extern void ioport_unmap(void __iomem *);
82ed223c2   Jonas Bonn   iomap: make IOPOR...
63
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
64

1526a756f   venkatesh.pallipadi@intel.com   generic: add iore...
65
66
67
  #ifndef ARCH_HAS_IOREMAP_WC
  #define ioremap_wc ioremap_nocache
  #endif
82ed223c2   Jonas Bonn   iomap: make IOPOR...
68
  #ifdef CONFIG_PCI
66eab4df2   Michael S. Tsirkin   lib: add GENERIC_...
69
  /* Destroy a virtual mapping cookie for a PCI BAR (memory or IO) */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
70
  struct pci_dev;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
71
  extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
fea80311a   Randy Dunlap   iomap: make IOPOR...
72
73
  #else
  struct pci_dev;
fea80311a   Randy Dunlap   iomap: make IOPOR...
74
75
  static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
  { }
82ed223c2   Jonas Bonn   iomap: make IOPOR...
76
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
77

66eab4df2   Michael S. Tsirkin   lib: add GENERIC_...
78
  #include <asm-generic/pci_iomap.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
79
  #endif