* [PATCH] ppc32: Big-endian I/O memory accessors.
@ 2005-10-10 21:50 Arthur Othieno
0 siblings, 0 replies; 4+ messages in thread
From: Arthur Othieno @ 2005-10-10 21:50 UTC (permalink / raw)
To: paulus; +Cc: linuxppc-dev
From: Arthur Othieno <a.othieno@bluewin.ch>
I/O memory accessors. Big endian version. For those busses/devices
that do export big-endian I/O memory.
Of notable relevance/reference:
http://lwn.net/Articles/132804/
http://ozlabs.org/pipermail/linuxppc-embedded/2005-August/019798.html
http://ozlabs.org/pipermail/linuxppc-embedded/2005-August/019752.html
Signed-off-by: Arthur Othieno <a.othieno@bluewin.ch>
---
Paulus,
A similar patch for ppc64 made it upstream with your big ppc64 merge.
This one is still sitting in http://patchwork.ozlabs.org/linuxppc/
and didn't make it with the ppc32 equivalent. Thanks.
include/asm-ppc/io.h | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff -uprN a/include/asm-ppc/io.h b/include/asm-ppc/io.h
--- a/include/asm-ppc/io.h 2005-08-21 17:49:44.000000000 -0400
+++ b/include/asm-ppc/io.h 2005-08-21 20:29:55.000000000 -0400
@@ -487,11 +487,21 @@ static inline unsigned int ioread16(void
return readw(addr);
}
+static inline unsigned int ioread16be(void __iomem *addr)
+{
+ return in_be16(addr);
+}
+
static inline unsigned int ioread32(void __iomem *addr)
{
return readl(addr);
}
+static inline unsigned int ioread32be(void __iomem *addr)
+{
+ return in_be32(addr);
+}
+
static inline void iowrite8(u8 val, void __iomem *addr)
{
writeb(val, addr);
@@ -502,11 +512,21 @@ static inline void iowrite16(u16 val, vo
writew(val, addr);
}
+static inline void iowrite16be(u16 val, void __iomem *addr)
+{
+ out_be16(addr, val);
+}
+
static inline void iowrite32(u32 val, void __iomem *addr)
{
writel(val, addr);
}
+static inline void iowrite32be(u32 val, void __iomem *addr)
+{
+ out_be32(addr, val);
+}
+
static inline void ioread8_rep(void __iomem *addr, void *dst, unsigned long count)
{
_insb(addr, dst, count);
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH] ppc32: Big-endian I/O memory accessors.
@ 2005-08-21 1:16 Arthur Othieno
2005-08-21 21:22 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 4+ messages in thread
From: Arthur Othieno @ 2005-08-21 1:16 UTC (permalink / raw)
To: linuxppc-dev
I/O memory accessors. Big-endian version. For those busses/devices
that do export big-endian I/O memory.
Of notable relevance/reference:
http://lwn.net/Articles/132804/
http://ozlabs.org/pipermail/linuxppc-embedded/2005-August/019798.html
http://ozlabs.org/pipermail/linuxppc-embedded/2005-August/019752.html
Signed-Off-By: Arthur Othieno <a.othieno@bluewin.ch>
io.h | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+)
--- a/include/asm-ppc/io.h 2005-08-20 19:24:40.000000000 -0400
+++ b/include/asm-ppc/io.h 2005-08-20 20:18:03.000000000 -0400
@@ -487,11 +487,21 @@
return readw(addr);
}
+static inline unsigned int ioread16be(void __iomem *addr)
+{
+ return __raw_readw(addr);
+}
+
static inline unsigned int ioread32(void __iomem *addr)
{
return readl(addr);
}
+static inline unsigned int ioread32be(void __iomem *addr)
+{
+ return __raw_readl(addr);
+}
+
static inline void iowrite8(u8 val, void __iomem *addr)
{
writeb(val, addr);
@@ -502,11 +512,21 @@
writew(val, addr);
}
+static inline void iowrite16be(u16 val, void __iomem *addr)
+{
+ __raw_writew(val, addr);
+}
+
static inline void iowrite32(u32 val, void __iomem *addr)
{
writel(val, addr);
}
+static inline void iowrite32be(u32 val, void __iomem *addr)
+{
+ __raw_writel(val, addr);
+}
+
static inline void ioread8_rep(void __iomem *addr, void *dst, unsigned long count)
{
_insb(addr, dst, count);
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] ppc32: Big-endian I/O memory accessors.
2005-08-21 1:16 Arthur Othieno
@ 2005-08-21 21:22 ` Benjamin Herrenschmidt
2005-08-22 12:51 ` Arthur Othieno
0 siblings, 1 reply; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2005-08-21 21:22 UTC (permalink / raw)
To: Arthur Othieno; +Cc: linuxppc-dev
On Sat, 2005-08-20 at 21:16 -0400, Arthur Othieno wrote:
> I/O memory accessors. Big-endian version. For those busses/devices
> that do export big-endian I/O memory.
>
> Of notable relevance/reference:
>
> http://lwn.net/Articles/132804/
> http://ozlabs.org/pipermail/linuxppc-embedded/2005-August/019798.html
> http://ozlabs.org/pipermail/linuxppc-embedded/2005-August/019752.html
>
> Signed-Off-By: Arthur Othieno <a.othieno@bluewin.ch>
>
No, that's not correct. You need to use the in_be/out_be variants which
provide proper memory barriers.
Ben.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ppc32: Big-endian I/O memory accessors.
2005-08-21 21:22 ` Benjamin Herrenschmidt
@ 2005-08-22 12:51 ` Arthur Othieno
0 siblings, 0 replies; 4+ messages in thread
From: Arthur Othieno @ 2005-08-22 12:51 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
On Mon, Aug 22, 2005 at 07:22:41AM +1000, Benjamin Herrenschmidt wrote:
> On Sat, 2005-08-20 at 21:16 -0400, Arthur Othieno wrote:
> > I/O memory accessors. Big-endian version. For those busses/devices
> > that do export big-endian I/O memory.
>
> No, that's not correct. You need to use the in_be/out_be variants which
> provide proper memory barriers.
>
> Ben.
Oops. Silly me. Updated patch inline.
Signed-Off-By: Arthur Othieno <a.othieno@bluewin.ch>
io.h | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+)
diff -uprN a/include/asm-ppc/io.h b/include/asm-ppc/io.h
--- a/include/asm-ppc/io.h 2005-08-21 17:49:44.000000000 -0400
+++ b/include/asm-ppc/io.h 2005-08-21 20:29:55.000000000 -0400
@@ -487,11 +487,21 @@ static inline unsigned int ioread16(void
return readw(addr);
}
+static inline unsigned int ioread16be(void __iomem *addr)
+{
+ return in_be16(addr);
+}
+
static inline unsigned int ioread32(void __iomem *addr)
{
return readl(addr);
}
+static inline unsigned int ioread32be(void __iomem *addr)
+{
+ return in_be32(addr);
+}
+
static inline void iowrite8(u8 val, void __iomem *addr)
{
writeb(val, addr);
@@ -502,11 +512,21 @@ static inline void iowrite16(u16 val, vo
writew(val, addr);
}
+static inline void iowrite16be(u16 val, void __iomem *addr)
+{
+ out_be16(addr, val);
+}
+
static inline void iowrite32(u32 val, void __iomem *addr)
{
writel(val, addr);
}
+static inline void iowrite32be(u32 val, void __iomem *addr)
+{
+ out_be32(addr, val);
+}
+
static inline void ioread8_rep(void __iomem *addr, void *dst, unsigned long count)
{
_insb(addr, dst, count);
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-10-10 22:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-10 21:50 [PATCH] ppc32: Big-endian I/O memory accessors Arthur Othieno
-- strict thread matches above, loose matches on Subject: below --
2005-08-21 1:16 Arthur Othieno
2005-08-21 21:22 ` Benjamin Herrenschmidt
2005-08-22 12:51 ` Arthur Othieno
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).