aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJay Estabrook <jay.estabrook@hp.com>2007-06-01 03:47:04 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-06-01 11:18:29 -0400
commit5ae0b6c704877d0c6b95dd7c3b1907770ca28b79 (patch)
tree0d11567e33f883d241697d358dd12010d5917133 /include
parent025a22151c41890e5d30a1d4fb84c547b84d7671 (diff)
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: Jay Estabrook <jay.estabrook@hp.com> Signed-off-by: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Cc: Richard Henderson <rth@twiddle.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/asm-alpha/core_t2.h26
1 files changed, 16 insertions, 10 deletions
diff --git a/include/asm-alpha/core_t2.h b/include/asm-alpha/core_t2.h
index 457c34b6eb09..90e6b5d6c214 100644
--- a/include/asm-alpha/core_t2.h
+++ b/include/asm-alpha/core_t2.h
@@ -437,9 +437,15 @@ static inline void t2_outl(u32 b, unsigned long addr)
437 437
438static DEFINE_SPINLOCK(t2_hae_lock); 438static DEFINE_SPINLOCK(t2_hae_lock);
439 439
440/*
441 * NOTE: take T2_DENSE_MEM off in each readX/writeX routine, since
442 * they may be called directly, rather than through the
443 * ioreadNN/iowriteNN routines.
444 */
445
440__EXTERN_INLINE u8 t2_readb(const volatile void __iomem *xaddr) 446__EXTERN_INLINE u8 t2_readb(const volatile void __iomem *xaddr)
441{ 447{
442 unsigned long addr = (unsigned long) xaddr; 448 unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
443 unsigned long result, msb; 449 unsigned long result, msb;
444 unsigned long flags; 450 unsigned long flags;
445 spin_lock_irqsave(&t2_hae_lock, flags); 451 spin_lock_irqsave(&t2_hae_lock, flags);
@@ -453,7 +459,7 @@ __EXTERN_INLINE u8 t2_readb(const volatile void __iomem *xaddr)
453 459
454__EXTERN_INLINE u16 t2_readw(const volatile void __iomem *xaddr) 460__EXTERN_INLINE u16 t2_readw(const volatile void __iomem *xaddr)
455{ 461{
456 unsigned long addr = (unsigned long) xaddr; 462 unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
457 unsigned long result, msb; 463 unsigned long result, msb;
458 unsigned long flags; 464 unsigned long flags;
459 spin_lock_irqsave(&t2_hae_lock, flags); 465 spin_lock_irqsave(&t2_hae_lock, flags);
@@ -471,7 +477,7 @@ __EXTERN_INLINE u16 t2_readw(const volatile void __iomem *xaddr)
471 */ 477 */
472__EXTERN_INLINE u32 t2_readl(const volatile void __iomem *xaddr) 478__EXTERN_INLINE u32 t2_readl(const volatile void __iomem *xaddr)
473{ 479{
474 unsigned long addr = (unsigned long) xaddr; 480 unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
475 unsigned long result, msb; 481 unsigned long result, msb;
476 unsigned long flags; 482 unsigned long flags;
477 spin_lock_irqsave(&t2_hae_lock, flags); 483 spin_lock_irqsave(&t2_hae_lock, flags);
@@ -485,7 +491,7 @@ __EXTERN_INLINE u32 t2_readl(const volatile void __iomem *xaddr)
485 491
486__EXTERN_INLINE u64 t2_readq(const volatile void __iomem *xaddr) 492__EXTERN_INLINE u64 t2_readq(const volatile void __iomem *xaddr)
487{ 493{
488 unsigned long addr = (unsigned long) xaddr; 494 unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
489 unsigned long r0, r1, work, msb; 495 unsigned long r0, r1, work, msb;
490 unsigned long flags; 496 unsigned long flags;
491 spin_lock_irqsave(&t2_hae_lock, flags); 497 spin_lock_irqsave(&t2_hae_lock, flags);
@@ -501,7 +507,7 @@ __EXTERN_INLINE u64 t2_readq(const volatile void __iomem *xaddr)
501 507
502__EXTERN_INLINE void t2_writeb(u8 b, volatile void __iomem *xaddr) 508__EXTERN_INLINE void t2_writeb(u8 b, volatile void __iomem *xaddr)
503{ 509{
504 unsigned long addr = (unsigned long) xaddr; 510 unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
505 unsigned long msb, w; 511 unsigned long msb, w;
506 unsigned long flags; 512 unsigned long flags;
507 spin_lock_irqsave(&t2_hae_lock, flags); 513 spin_lock_irqsave(&t2_hae_lock, flags);
@@ -515,7 +521,7 @@ __EXTERN_INLINE void t2_writeb(u8 b, volatile void __iomem *xaddr)
515 521
516__EXTERN_INLINE void t2_writew(u16 b, volatile void __iomem *xaddr) 522__EXTERN_INLINE void t2_writew(u16 b, volatile void __iomem *xaddr)
517{ 523{
518 unsigned long addr = (unsigned long) xaddr; 524 unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
519 unsigned long msb, w; 525 unsigned long msb, w;
520 unsigned long flags; 526 unsigned long flags;
521 spin_lock_irqsave(&t2_hae_lock, flags); 527 spin_lock_irqsave(&t2_hae_lock, flags);
@@ -533,7 +539,7 @@ __EXTERN_INLINE void t2_writew(u16 b, volatile void __iomem *xaddr)
533 */ 539 */
534__EXTERN_INLINE void t2_writel(u32 b, volatile void __iomem *xaddr) 540__EXTERN_INLINE void t2_writel(u32 b, volatile void __iomem *xaddr)
535{ 541{
536 unsigned long addr = (unsigned long) xaddr; 542 unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
537 unsigned long msb; 543 unsigned long msb;
538 unsigned long flags; 544 unsigned long flags;
539 spin_lock_irqsave(&t2_hae_lock, flags); 545 spin_lock_irqsave(&t2_hae_lock, flags);
@@ -546,7 +552,7 @@ __EXTERN_INLINE void t2_writel(u32 b, volatile void __iomem *xaddr)
546 552
547__EXTERN_INLINE void t2_writeq(u64 b, volatile void __iomem *xaddr) 553__EXTERN_INLINE void t2_writeq(u64 b, volatile void __iomem *xaddr)
548{ 554{
549 unsigned long addr = (unsigned long) xaddr; 555 unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
550 unsigned long msb, work; 556 unsigned long msb, work;
551 unsigned long flags; 557 unsigned long flags;
552 spin_lock_irqsave(&t2_hae_lock, flags); 558 spin_lock_irqsave(&t2_hae_lock, flags);
@@ -587,14 +593,14 @@ __EXTERN_INLINE int t2_is_mmio(const volatile void __iomem *addr)
587__EXTERN_INLINE unsigned int t2_ioread##NS(void __iomem *xaddr) \ 593__EXTERN_INLINE unsigned int t2_ioread##NS(void __iomem *xaddr) \
588{ \ 594{ \
589 if (t2_is_mmio(xaddr)) \ 595 if (t2_is_mmio(xaddr)) \
590 return t2_read##OS(xaddr - T2_DENSE_MEM); \ 596 return t2_read##OS(xaddr); \
591 else \ 597 else \
592 return t2_in##OS((unsigned long)xaddr - T2_IO); \ 598 return t2_in##OS((unsigned long)xaddr - T2_IO); \
593} \ 599} \
594__EXTERN_INLINE void t2_iowrite##NS(u##NS b, void __iomem *xaddr) \ 600__EXTERN_INLINE void t2_iowrite##NS(u##NS b, void __iomem *xaddr) \
595{ \ 601{ \
596 if (t2_is_mmio(xaddr)) \ 602 if (t2_is_mmio(xaddr)) \
597 t2_write##OS(b, xaddr - T2_DENSE_MEM); \ 603 t2_write##OS(b, xaddr); \
598 else \ 604 else \
599 t2_out##OS(b, (unsigned long)xaddr - T2_IO); \ 605 t2_out##OS(b, (unsigned long)xaddr - T2_IO); \
600} 606}