Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


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