ide: <asm-sparc/ide_64.h>: use __raw_{read,write}w()
[linux-2.6/linux-loongson.git] / include / asm-sparc / ide_32.h
blob81a00b60bcce38974b0dfab9f356ec41287fb229
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.
6 */
8 #ifndef _SPARC_IDE_H
9 #define _SPARC_IDE_H
11 #ifdef __KERNEL__
13 #include <asm/pgtable.h>
14 #include <asm/io.h>
15 #include <asm/psr.h>
17 #undef MAX_HWIFS
18 #define MAX_HWIFS 2
20 #define __ide_insl(data_reg, buffer, wcount) \
21 __ide_insw(data_reg, buffer, (wcount)<<1)
22 #define __ide_outsl(data_reg, buffer, wcount) \
23 __ide_outsw(data_reg, buffer, (wcount)<<1)
25 /* On sparc, I/O ports and MMIO registers are accessed identically. */
26 #define __ide_mm_insw __ide_insw
27 #define __ide_mm_insl __ide_insl
28 #define __ide_mm_outsw __ide_outsw
29 #define __ide_mm_outsl __ide_outsl
31 static inline void __ide_insw(void __iomem *port, void *dst, u32 count)
33 /* unsigned long end = (unsigned long)dst + (count << 1); */ /* P3 */
34 u16 *ps = dst;
35 u32 *pi;
37 if(((unsigned long)ps) & 0x2) {
38 *ps++ = __raw_readw(port);
39 count--;
41 pi = (u32 *)ps;
42 while(count >= 2) {
43 u32 w;
45 w = __raw_readw(port) << 16;
46 w |= __raw_readw(port);
47 *pi++ = w;
48 count -= 2;
50 ps = (u16 *)pi;
51 if(count)
52 *ps++ = __raw_readw(port);
54 /* __flush_dcache_range((unsigned long)dst, end); */ /* P3 see hme */
57 static inline void __ide_outsw(void __iomem *port, const void *src, u32 count)
59 /* unsigned long end = (unsigned long)src + (count << 1); */
60 const u16 *ps = src;
61 const u32 *pi;
63 if(((unsigned long)src) & 0x2) {
64 __raw_writew(*ps++, port);
65 count--;
67 pi = (const u32 *)ps;
68 while(count >= 2) {
69 u32 w;
71 w = *pi++;
72 __raw_writew((w >> 16), port);
73 __raw_writew(w, port);
74 count -= 2;
76 ps = (const u16 *)pi;
77 if(count)
78 __raw_writew(*ps, port);
80 /* __flush_dcache_range((unsigned long)src, end); */ /* P3 see hme */
83 #endif /* __KERNEL__ */
85 #endif /* _SPARC_IDE_H */