2005-04-17 00:20:36 +02:00
|
|
|
#ifndef __GENERIC_IO_H
|
|
|
|
#define __GENERIC_IO_H
|
|
|
|
|
|
|
|
#include <linux/linkage.h>
|
[PATCH] add Big Endian variants of ioread/iowrite
In the new io infrastructure, all of our operators are expecting the
underlying device to be little endian (because the PCI bus, their main
consumer, is LE).
However, there are a fair few devices and busses in the world that are
actually Big Endian. There's even evidence that some of these BE bus and
chip types are attached to LE systems. Thus, there's a need for a BE
equivalent of our io{read,write}{16,32} operations.
The attached patch adds this as io{read,write}{16,32}be. When it's in,
I'll add the first consume (the 53c700 SCSI chip driver).
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-17 00:25:54 +02:00
|
|
|
#include <asm/byteorder.h>
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
2008-02-08 13:19:56 +01:00
|
|
|
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 *);
|
2005-04-17 00:20:36 +02:00
|
|
|
|
2008-02-08 13:19:56 +01:00
|
|
|
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 *);
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* "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.
|
|
|
|
*/
|
2008-02-08 13:19:56 +01:00
|
|
|
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);
|
2005-04-17 00:20:36 +02:00
|
|
|
|
2008-02-08 13:19:56 +01:00
|
|
|
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);
|
2005-04-17 00:20:36 +02:00
|
|
|
|
2011-07-02 17:23:29 +02:00
|
|
|
#ifdef CONFIG_HAS_IOPORT
|
2005-04-17 00:20:36 +02:00
|
|
|
/* 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 *);
|
2011-07-02 17:23:29 +02:00
|
|
|
#endif
|
2005-04-17 00:20:36 +02:00
|
|
|
|
2008-03-19 01:00:24 +01:00
|
|
|
#ifndef ARCH_HAS_IOREMAP_WC
|
|
|
|
#define ioremap_wc ioremap_nocache
|
|
|
|
#endif
|
|
|
|
|
2011-07-02 17:23:29 +02:00
|
|
|
#ifdef CONFIG_PCI
|
2005-04-17 00:20:36 +02:00
|
|
|
/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
|
|
|
|
struct pci_dev;
|
|
|
|
extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
|
|
|
|
extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
|
2011-07-02 17:23:29 +02:00
|
|
|
#endif
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
#endif
|