diff options
Diffstat (limited to 'include/asm-sparc64/ide.h')
-rw-r--r-- | include/asm-sparc64/ide.h | 47 |
1 files changed, 30 insertions, 17 deletions
diff --git a/include/asm-sparc64/ide.h b/include/asm-sparc64/ide.h index c8db43d59..0f6d0de23 100644 --- a/include/asm-sparc64/ide.h +++ b/include/asm-sparc64/ide.h @@ -1,4 +1,4 @@ -/* $Id: ide.h,v 1.14 1999/05/15 05:02:35 davem Exp $ +/* $Id: ide.h,v 1.16 1999/08/30 10:14:42 davem Exp $ * ide.h: Ultra/PCI specific IDE glue. * * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) @@ -10,6 +10,7 @@ #ifdef __KERNEL__ +#include <linux/config.h> #include <asm/pgtable.h> #include <asm/io.h> #include <asm/hdreg.h> @@ -53,7 +54,7 @@ static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port, */ static __inline__ void ide_init_default_hwifs(void) { -#ifdef __DO_I_NEED_THIS +#ifndef CONFIG_BLK_DEV_IDEPCI hw_regs_t hw; int index; @@ -62,7 +63,7 @@ static __inline__ void ide_init_default_hwifs(void) hw.irq = ide_default_irq(ide_default_io_base(index)); ide_register_hw(&hw, NULL); } -#endif /* __DO_I_NEED_THIS */ +#endif /* CONFIG_BLK_DEV_IDEPCI */ } typedef union { @@ -134,50 +135,62 @@ static __inline__ void ide_release_region(ide_ioreg_t base, unsigned int size) #define insw(port, buf, nr) ide_insw((port), (buf), (nr)) #define outsw(port, buf, nr) ide_outsw((port), (buf), (nr)) +static __inline__ unsigned int inw_be(unsigned long addr) +{ + unsigned int ret; + + __asm__ __volatile__("lduha [%1] %2, %0" + : "=r" (ret) + : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); + + return ret; +} + static __inline__ void ide_insw(unsigned long port, void *dst, unsigned long count) { - volatile unsigned short *data_port; unsigned long end = (unsigned long)dst + (count << 1); u16 *ps = dst; u32 *pi; - data_port = (volatile unsigned short *)port; - if(((u64)ps) & 0x2) { - *ps++ = *data_port; + *ps++ = inw_be(port); count--; } pi = (u32 *)ps; while(count >= 2) { u32 w; - w = (*data_port) << 16; - w |= (*data_port); + w = inw_be(port) << 16; + w |= inw_be(port); *pi++ = w; count -= 2; } ps = (u16 *)pi; if(count) - *ps++ = *data_port; + *ps++ = inw_be(port); __flush_dcache_range((unsigned long)dst, end); } +static __inline__ void outw_be(unsigned short w, unsigned long addr) +{ + __asm__ __volatile__("stha %0, [%1] %2" + : /* no outputs */ + : "r" (w), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E)); +} + static __inline__ void ide_outsw(unsigned long port, const void *src, unsigned long count) { - volatile unsigned short *data_port; unsigned long end = (unsigned long)src + (count << 1); const u16 *ps = src; const u32 *pi; - data_port = (volatile unsigned short *)port; - if(((u64)src) & 0x2) { - *data_port = *ps++; + outw_be(*ps++, port); count--; } pi = (const u32 *)ps; @@ -185,13 +198,13 @@ static __inline__ void ide_outsw(unsigned long port, u32 w; w = *pi++; - *data_port = (w >> 16); - *data_port = w; + outw_be((w >> 16), port); + outw_be(w, port); count -= 2; } ps = (const u16 *)pi; if(count) - *data_port = *ps; + outw_be(*ps, port); __flush_dcache_range((unsigned long)src, end); } |