1 /* ide.h: SPARC PCI specific IDE glue.
3 * Copyright (C) 1997 David S. Miller (davem@davemloft.net)
4 * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be)
5 * Adaptation from sparc64 version to sparc by Pete Zaitcev.
15 #include <asm/pgalloc.h>
16 #include <asm/spitfire.h>
17 #include <asm/cacheflush.h>
20 #include <asm/pgtable.h>
27 #define __ide_insl(data_reg, buffer, wcount) \
28 __ide_insw(data_reg, buffer, (wcount)<<1)
29 #define __ide_outsl(data_reg, buffer, wcount) \
30 __ide_outsw(data_reg, buffer, (wcount)<<1)
32 /* On sparc, I/O ports and MMIO registers are accessed identically. */
33 #define __ide_mm_insw __ide_insw
34 #define __ide_mm_insl __ide_insl
35 #define __ide_mm_outsw __ide_outsw
36 #define __ide_mm_outsl __ide_outsl
38 static inline void __ide_insw(void __iomem *port, void *dst, u32 count)
40 #if defined(CONFIG_SPARC64) && defined(DCACHE_ALIASING_POSSIBLE)
41 unsigned long end = (unsigned long)dst + (count << 1);
46 if(((unsigned long)ps) & 0x2) {
47 *ps++ = __raw_readw(port);
54 w = __raw_readw(port) << 16;
55 w |= __raw_readw(port);
61 *ps++ = __raw_readw(port);
63 #if defined(CONFIG_SPARC64) && defined(DCACHE_ALIASING_POSSIBLE)
64 __flush_dcache_range((unsigned long)dst, end);
68 static inline void __ide_outsw(void __iomem *port, const void *src, u32 count)
70 #if defined(CONFIG_SPARC64) && defined(DCACHE_ALIASING_POSSIBLE)
71 unsigned long end = (unsigned long)src + (count << 1);
76 if(((unsigned long)src) & 0x2) {
77 __raw_writew(*ps++, port);
85 __raw_writew((w >> 16), port);
86 __raw_writew(w, port);
91 __raw_writew(*ps, port);
93 #if defined(CONFIG_SPARC64) && defined(DCACHE_ALIASING_POSSIBLE)
94 __flush_dcache_range((unsigned long)src, end);
98 #endif /* __KERNEL__ */
100 #endif /* _SPARC_IDE_H */