Commit 5ae0b6c7 authored by Jay Estabrook's avatar Jay Estabrook Committed by Linus Torvalds

ALPHA: correct low-level I/O routines for sable-lynx

This code corrects the behavior of the t2_readX/t2_writeX routines,
and t2_ioreadNN/t2_iowriteNN routines.

The value T2_DENSE_MEM is now subtracted from the "xaddr" argument in
each of the readX/writeX routines, since those routines may be called
directly, rather than always through the ioreadNN/iowriteNN routines.

Examples of the direct calls, via the __raw_readX/writeX macros, are
the memcpy_fromio/toio, _memset_c_io, and scr_memcpyw routines.
Signed-off-by: default avatarJay Estabrook <jay.estabrook@hp.com>
Signed-off-by: default avatarIvan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Richard Henderson <rth@twiddle.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 025a2215
...@@ -437,9 +437,15 @@ static inline void t2_outl(u32 b, unsigned long addr) ...@@ -437,9 +437,15 @@ static inline void t2_outl(u32 b, unsigned long addr)
static DEFINE_SPINLOCK(t2_hae_lock); static DEFINE_SPINLOCK(t2_hae_lock);
/*
* NOTE: take T2_DENSE_MEM off in each readX/writeX routine, since
* they may be called directly, rather than through the
* ioreadNN/iowriteNN routines.
*/
__EXTERN_INLINE u8 t2_readb(const volatile void __iomem *xaddr) __EXTERN_INLINE u8 t2_readb(const volatile void __iomem *xaddr)
{ {
unsigned long addr = (unsigned long) xaddr; unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
unsigned long result, msb; unsigned long result, msb;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&t2_hae_lock, flags); spin_lock_irqsave(&t2_hae_lock, flags);
...@@ -453,7 +459,7 @@ __EXTERN_INLINE u8 t2_readb(const volatile void __iomem *xaddr) ...@@ -453,7 +459,7 @@ __EXTERN_INLINE u8 t2_readb(const volatile void __iomem *xaddr)
__EXTERN_INLINE u16 t2_readw(const volatile void __iomem *xaddr) __EXTERN_INLINE u16 t2_readw(const volatile void __iomem *xaddr)
{ {
unsigned long addr = (unsigned long) xaddr; unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
unsigned long result, msb; unsigned long result, msb;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&t2_hae_lock, flags); spin_lock_irqsave(&t2_hae_lock, flags);
...@@ -471,7 +477,7 @@ __EXTERN_INLINE u16 t2_readw(const volatile void __iomem *xaddr) ...@@ -471,7 +477,7 @@ __EXTERN_INLINE u16 t2_readw(const volatile void __iomem *xaddr)
*/ */
__EXTERN_INLINE u32 t2_readl(const volatile void __iomem *xaddr) __EXTERN_INLINE u32 t2_readl(const volatile void __iomem *xaddr)
{ {
unsigned long addr = (unsigned long) xaddr; unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
unsigned long result, msb; unsigned long result, msb;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&t2_hae_lock, flags); spin_lock_irqsave(&t2_hae_lock, flags);
...@@ -485,7 +491,7 @@ __EXTERN_INLINE u32 t2_readl(const volatile void __iomem *xaddr) ...@@ -485,7 +491,7 @@ __EXTERN_INLINE u32 t2_readl(const volatile void __iomem *xaddr)
__EXTERN_INLINE u64 t2_readq(const volatile void __iomem *xaddr) __EXTERN_INLINE u64 t2_readq(const volatile void __iomem *xaddr)
{ {
unsigned long addr = (unsigned long) xaddr; unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
unsigned long r0, r1, work, msb; unsigned long r0, r1, work, msb;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&t2_hae_lock, flags); spin_lock_irqsave(&t2_hae_lock, flags);
...@@ -501,7 +507,7 @@ __EXTERN_INLINE u64 t2_readq(const volatile void __iomem *xaddr) ...@@ -501,7 +507,7 @@ __EXTERN_INLINE u64 t2_readq(const volatile void __iomem *xaddr)
__EXTERN_INLINE void t2_writeb(u8 b, volatile void __iomem *xaddr) __EXTERN_INLINE void t2_writeb(u8 b, volatile void __iomem *xaddr)
{ {
unsigned long addr = (unsigned long) xaddr; unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
unsigned long msb, w; unsigned long msb, w;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&t2_hae_lock, flags); spin_lock_irqsave(&t2_hae_lock, flags);
...@@ -515,7 +521,7 @@ __EXTERN_INLINE void t2_writeb(u8 b, volatile void __iomem *xaddr) ...@@ -515,7 +521,7 @@ __EXTERN_INLINE void t2_writeb(u8 b, volatile void __iomem *xaddr)
__EXTERN_INLINE void t2_writew(u16 b, volatile void __iomem *xaddr) __EXTERN_INLINE void t2_writew(u16 b, volatile void __iomem *xaddr)
{ {
unsigned long addr = (unsigned long) xaddr; unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
unsigned long msb, w; unsigned long msb, w;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&t2_hae_lock, flags); spin_lock_irqsave(&t2_hae_lock, flags);
...@@ -533,7 +539,7 @@ __EXTERN_INLINE void t2_writew(u16 b, volatile void __iomem *xaddr) ...@@ -533,7 +539,7 @@ __EXTERN_INLINE void t2_writew(u16 b, volatile void __iomem *xaddr)
*/ */
__EXTERN_INLINE void t2_writel(u32 b, volatile void __iomem *xaddr) __EXTERN_INLINE void t2_writel(u32 b, volatile void __iomem *xaddr)
{ {
unsigned long addr = (unsigned long) xaddr; unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
unsigned long msb; unsigned long msb;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&t2_hae_lock, flags); spin_lock_irqsave(&t2_hae_lock, flags);
...@@ -546,7 +552,7 @@ __EXTERN_INLINE void t2_writel(u32 b, volatile void __iomem *xaddr) ...@@ -546,7 +552,7 @@ __EXTERN_INLINE void t2_writel(u32 b, volatile void __iomem *xaddr)
__EXTERN_INLINE void t2_writeq(u64 b, volatile void __iomem *xaddr) __EXTERN_INLINE void t2_writeq(u64 b, volatile void __iomem *xaddr)
{ {
unsigned long addr = (unsigned long) xaddr; unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
unsigned long msb, work; unsigned long msb, work;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&t2_hae_lock, flags); spin_lock_irqsave(&t2_hae_lock, flags);
...@@ -587,14 +593,14 @@ __EXTERN_INLINE int t2_is_mmio(const volatile void __iomem *addr) ...@@ -587,14 +593,14 @@ __EXTERN_INLINE int t2_is_mmio(const volatile void __iomem *addr)
__EXTERN_INLINE unsigned int t2_ioread##NS(void __iomem *xaddr) \ __EXTERN_INLINE unsigned int t2_ioread##NS(void __iomem *xaddr) \
{ \ { \
if (t2_is_mmio(xaddr)) \ if (t2_is_mmio(xaddr)) \
return t2_read##OS(xaddr - T2_DENSE_MEM); \ return t2_read##OS(xaddr); \
else \ else \
return t2_in##OS((unsigned long)xaddr - T2_IO); \ return t2_in##OS((unsigned long)xaddr - T2_IO); \
} \ } \
__EXTERN_INLINE void t2_iowrite##NS(u##NS b, void __iomem *xaddr) \ __EXTERN_INLINE void t2_iowrite##NS(u##NS b, void __iomem *xaddr) \
{ \ { \
if (t2_is_mmio(xaddr)) \ if (t2_is_mmio(xaddr)) \
t2_write##OS(b, xaddr - T2_DENSE_MEM); \ t2_write##OS(b, xaddr); \
else \ else \
t2_out##OS(b, (unsigned long)xaddr - T2_IO); \ t2_out##OS(b, (unsigned long)xaddr - T2_IO); \
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment