summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@SteelEye.com>2005-04-17 00:25:54 +0200
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-17 00:25:54 +0200
commitdae409a27788774adb810f7cdb771ba7cce7af8a (patch)
tree7fbbbe81527c5f321f374f958a82dfa30e170850 /lib
parent[PATCH] efi: eliminate bad section references (diff)
downloadlinux-dae409a27788774adb810f7cdb771ba7cce7af8a.tar.xz
linux-dae409a27788774adb810f7cdb771ba7cce7af8a.zip
[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>
Diffstat (limited to 'lib')
-rw-r--r--lib/iomap.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/iomap.c b/lib/iomap.c
index 5e74390852b0..55689c5d3379 100644
--- a/lib/iomap.c
+++ b/lib/iomap.c
@@ -58,13 +58,23 @@ unsigned int fastcall ioread16(void __iomem *addr)
{
IO_COND(addr, return inw(port), return readw(addr));
}
+unsigned int fastcall ioread16be(void __iomem *addr)
+{
+ IO_COND(addr, return inw(port), return be16_to_cpu(__raw_readw(addr)));
+}
unsigned int fastcall ioread32(void __iomem *addr)
{
IO_COND(addr, return inl(port), return readl(addr));
}
+unsigned int fastcall ioread32be(void __iomem *addr)
+{
+ IO_COND(addr, return inl(port), return be32_to_cpu(__raw_readl(addr)));
+}
EXPORT_SYMBOL(ioread8);
EXPORT_SYMBOL(ioread16);
+EXPORT_SYMBOL(ioread16be);
EXPORT_SYMBOL(ioread32);
+EXPORT_SYMBOL(ioread32be);
void fastcall iowrite8(u8 val, void __iomem *addr)
{
@@ -74,13 +84,23 @@ void fastcall iowrite16(u16 val, void __iomem *addr)
{
IO_COND(addr, outw(val,port), writew(val, addr));
}
+void fastcall iowrite16be(u16 val, void __iomem *addr)
+{
+ IO_COND(addr, outw(val,port), __raw_writew(cpu_to_be16(val), addr));
+}
void fastcall iowrite32(u32 val, void __iomem *addr)
{
IO_COND(addr, outl(val,port), writel(val, addr));
}
+void fastcall iowrite32be(u32 val, void __iomem *addr)
+{
+ IO_COND(addr, outl(val,port), __raw_writel(cpu_to_be32(val), addr));
+}
EXPORT_SYMBOL(iowrite8);
EXPORT_SYMBOL(iowrite16);
+EXPORT_SYMBOL(iowrite16be);
EXPORT_SYMBOL(iowrite32);
+EXPORT_SYMBOL(iowrite32be);
/*
* These are the "repeat MMIO read/write" functions.