#ifndef __GENERIC_IO_H1#define __GENERIC_IO_H23#include <linux/linkage.h>4#include <asm/byteorder.h>56/*7* These are the "generic" interfaces for doing new-style8* memory-mapped or PIO accesses. Architectures may do9* their own arch-optimized versions, these just act as10* 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*/1516/*17* Read/write from/to an (offsettable) iomem cookie. It might be a PIO18* access or a MMIO access, these functions don't care. The info is19* encoded in the hardware mapping set up by the mapping functions20* (or the cookie itself, depending on implementation and hw).21*22* The generic routines just encode the PIO/MMIO as part of the23* cookie, and coldly assume that the MMIO IO mappings are not24* in the low address range. Architectures for which this is not25* true can't use this generic implementation.26*/27extern unsigned int ioread8(void __iomem *);28extern unsigned int ioread16(void __iomem *);29extern unsigned int ioread16be(void __iomem *);30extern unsigned int ioread32(void __iomem *);31extern unsigned int ioread32be(void __iomem *);3233extern void iowrite8(u8, void __iomem *);34extern void iowrite16(u16, void __iomem *);35extern void iowrite16be(u16, void __iomem *);36extern void iowrite32(u32, void __iomem *);37extern void iowrite32be(u32, void __iomem *);3839/*40* "string" versions of the above. Note that they41* use native byte ordering for the accesses (on42* the assumption that IO and memory agree on a43* byte order, and CPU byteorder is irrelevant).44*45* They do _not_ update the port address. If you46* want MMIO that copies stuff laid out in MMIO47* memory across multiple ports, use "memcpy_toio()"48* and friends.49*/50extern void ioread8_rep(void __iomem *port, void *buf, unsigned long count);51extern void ioread16_rep(void __iomem *port, void *buf, unsigned long count);52extern void ioread32_rep(void __iomem *port, void *buf, unsigned long count);5354extern void iowrite8_rep(void __iomem *port, const void *buf, unsigned long count);55extern void iowrite16_rep(void __iomem *port, const void *buf, unsigned long count);56extern void iowrite32_rep(void __iomem *port, const void *buf, unsigned long count);5758/* Create a virtual mapping cookie for an IO port range */59extern void __iomem *ioport_map(unsigned long port, unsigned int nr);60extern void ioport_unmap(void __iomem *);6162#ifndef ARCH_HAS_IOREMAP_WC63#define ioremap_wc ioremap_nocache64#endif6566/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */67struct pci_dev;68extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);69extern void pci_iounmap(struct pci_dev *dev, void __iomem *);7071#endif727374