aboutsummaryrefslogtreecommitdiffstats
path: root/lib/iomap.c
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@SteelEye.com>2005-04-16 18:25:54 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:25:54 -0400
commitdae409a27788774adb810f7cdb771ba7cce7af8a (patch)
tree7fbbbe81527c5f321f374f958a82dfa30e170850 /lib/iomap.c
parentc41f5eb3b8feb8772561f0e34cfee4de1fa433ec (diff)
[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/iomap.c')
-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)
58{ 58{
59 IO_COND(addr, return inw(port), return readw(addr)); 59 IO_COND(addr, return inw(port), return readw(addr));
60} 60}
61unsigned int fastcall ioread16be(void __iomem *addr)
62{
63 IO_COND(addr, return inw(port), return be16_to_cpu(__raw_readw(addr)));
64}
61unsigned int fastcall ioread32(void __iomem *addr) 65unsigned int fastcall ioread32(void __iomem *addr)
62{ 66{
63 IO_COND(addr, return inl(port), return readl(addr)); 67 IO_COND(addr, return inl(port), return readl(addr));
64} 68}
69unsigned int fastcall ioread32be(void __iomem *addr)
70{
71 IO_COND(addr, return inl(port), return be32_to_cpu(__raw_readl(addr)));
72}
65EXPORT_SYMBOL(ioread8); 73EXPORT_SYMBOL(ioread8);
66EXPORT_SYMBOL(ioread16); 74EXPORT_SYMBOL(ioread16);
75EXPORT_SYMBOL(ioread16be);
67EXPORT_SYMBOL(ioread32); 76EXPORT_SYMBOL(ioread32);
77EXPORT_SYMBOL(ioread32be);
68 78
69void fastcall iowrite8(u8 val, void __iomem *addr) 79void fastcall iowrite8(u8 val, void __iomem *addr)
70{ 80{
@@ -74,13 +84,23 @@ void fastcall iowrite16(u16 val, void __iomem *addr)
74{ 84{
75 IO_COND(addr, outw(val,port), writew(val, addr)); 85 IO_COND(addr, outw(val,port), writew(val, addr));
76} 86}
87void fastcall iowrite16be(u16 val, void __iomem *addr)
88{
89 IO_COND(addr, outw(val,port), __raw_writew(cpu_to_be16(val), addr));
90}
77void fastcall iowrite32(u32 val, void __iomem *addr) 91void fastcall iowrite32(u32 val, void __iomem *addr)
78{ 92{
79 IO_COND(addr, outl(val,port), writel(val, addr)); 93 IO_COND(addr, outl(val,port), writel(val, addr));
80} 94}
95void fastcall iowrite32be(u32 val, void __iomem *addr)
96{
97 IO_COND(addr, outl(val,port), __raw_writel(cpu_to_be32(val), addr));
98}
81EXPORT_SYMBOL(iowrite8); 99EXPORT_SYMBOL(iowrite8);
82EXPORT_SYMBOL(iowrite16); 100EXPORT_SYMBOL(iowrite16);
101EXPORT_SYMBOL(iowrite16be);
83EXPORT_SYMBOL(iowrite32); 102EXPORT_SYMBOL(iowrite32);
103EXPORT_SYMBOL(iowrite32be);
84 104
85/* 105/*
86 * These are the "repeat MMIO read/write" functions. 106 * These are the "repeat MMIO read/write" functions.