1 /* $Id: ide.h,v 1.21 2001/09/25 20:21:48 kanoj Exp $
2 * ide.h: Ultra/PCI specific IDE glue.
4 * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
5 * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be)
13 #include <linux/config.h>
14 #include <asm/pgalloc.h>
16 #include <asm/spitfire.h>
17 #include <asm/cacheflush.h>
20 # ifdef CONFIG_BLK_DEV_IDEPCI
27 #define IDE_ARCH_OBSOLETE_INIT
28 #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
30 #define __ide_insl(data_reg, buffer, wcount) \
31 __ide_insw(data_reg, buffer, (wcount)<<1)
32 #define __ide_outsl(data_reg, buffer, wcount) \
33 __ide_outsw(data_reg, buffer, (wcount)<<1)
35 /* On sparc64, I/O ports and MMIO registers are accessed identically. */
36 #define __ide_mm_insw __ide_insw
37 #define __ide_mm_insl __ide_insl
38 #define __ide_mm_outsw __ide_outsw
39 #define __ide_mm_outsl __ide_outsl
41 static inline unsigned int inw_be(void __iomem
*addr
)
45 __asm__
__volatile__("lduha [%1] %2, %0"
47 : "r" (addr
), "i" (ASI_PHYS_BYPASS_EC_E
));
52 static inline void __ide_insw(void __iomem
*port
, void *dst
, u32 count
)
54 #ifdef DCACHE_ALIASING_POSSIBLE
55 unsigned long end
= (unsigned long)dst
+ (count
<< 1);
68 w
= inw_be(port
) << 16;
77 #ifdef DCACHE_ALIASING_POSSIBLE
78 __flush_dcache_range((unsigned long)dst
, end
);
82 static inline void outw_be(unsigned short w
, void __iomem
*addr
)
84 __asm__
__volatile__("stha %0, [%1] %2"
86 : "r" (w
), "r" (addr
), "i" (ASI_PHYS_BYPASS_EC_E
));
89 static inline void __ide_outsw(void __iomem
*port
, void *src
, u32 count
)
91 #ifdef DCACHE_ALIASING_POSSIBLE
92 unsigned long end
= (unsigned long)src
+ (count
<< 1);
97 if(((u64
)src
) & 0x2) {
101 pi
= (const u32
*)ps
;
106 outw_be((w
>> 16), port
);
110 ps
= (const u16
*)pi
;
114 #ifdef DCACHE_ALIASING_POSSIBLE
115 __flush_dcache_range((unsigned long)src
, end
);
119 #endif /* __KERNEL__ */
121 #endif /* _SPARC64_IDE_H */