IB/ipath: Convert ipath_eep_sem semaphore to a mutex
[linux-2.6/zen-sources.git] / include / asm-sparc / ide.h
blob4076cb5d1581cdbcce73bac0e2c9cc5974064db2
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_default_io_ctl(base) ((base) + 0x206) /* obsolete */
22 #define __ide_insl(data_reg, buffer, wcount) \
23 __ide_insw(data_reg, buffer, (wcount)<<1)
24 #define __ide_outsl(data_reg, buffer, wcount) \
25 __ide_outsw(data_reg, buffer, (wcount)<<1)
27 /* On sparc, I/O ports and MMIO registers are accessed identically. */
28 #define __ide_mm_insw __ide_insw
29 #define __ide_mm_insl __ide_insl
30 #define __ide_mm_outsw __ide_outsw
31 #define __ide_mm_outsl __ide_outsl
33 static inline void __ide_insw(unsigned long port,
34 void *dst,
35 unsigned long count)
37 volatile unsigned short *data_port;
38 /* unsigned long end = (unsigned long)dst + (count << 1); */ /* P3 */
39 u16 *ps = dst;
40 u32 *pi;
42 data_port = (volatile unsigned short *)port;
44 if(((unsigned long)ps) & 0x2) {
45 *ps++ = *data_port;
46 count--;
48 pi = (u32 *)ps;
49 while(count >= 2) {
50 u32 w;
52 w = (*data_port) << 16;
53 w |= (*data_port);
54 *pi++ = w;
55 count -= 2;
57 ps = (u16 *)pi;
58 if(count)
59 *ps++ = *data_port;
61 /* __flush_dcache_range((unsigned long)dst, end); */ /* P3 see hme */
64 static inline void __ide_outsw(unsigned long port,
65 const void *src,
66 unsigned long count)
68 volatile unsigned short *data_port;
69 /* unsigned long end = (unsigned long)src + (count << 1); */
70 const u16 *ps = src;
71 const u32 *pi;
73 data_port = (volatile unsigned short *)port;
75 if(((unsigned long)src) & 0x2) {
76 *data_port = *ps++;
77 count--;
79 pi = (const u32 *)ps;
80 while(count >= 2) {
81 u32 w;
83 w = *pi++;
84 *data_port = (w >> 16);
85 *data_port = w;
86 count -= 2;
88 ps = (const u16 *)pi;
89 if(count)
90 *data_port = *ps;
92 /* __flush_dcache_range((unsigned long)src, end); */ /* P3 see hme */
95 #endif /* __KERNEL__ */
97 #endif /* _SPARC_IDE_H */