ppc32: Big-endian I/O memory accessors.
PATCH 1/1 ppc32: Big-endian I/O memory accessors.
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
io.h | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+)
include/asm-ppc/io.h +20 -0
@@ -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);
Quoted 11 lines · Arthur Othieno
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.htmlSigned-off-by Arthur Othieno <[email protected]>
No, that's not correct. You need to use the in_be/out_be variants which provide proper memory barriers.
Ben.
Quoted 8 lines · Benjamin Herrenschmidt
Quoted 2 lines · Arthur Othieno
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.
io.h | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+)
include/asm-ppc/io.h +20 -0
@@ -487,11 +487,21 @@ static inline unsigned int ioread16(voidreturn 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, vowritew (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);