Merge branch 'upstream-jeff' of git://git.kernel.org/pub/scm/linux/kernel/git/romieu...
[deliverable/linux.git] / include / asm-sparc / ide.h
1 /* $Id: ide.h,v 1.7 2002/01/16 20:58:40 davem Exp $
2 * ide.h: SPARC PCI specific IDE glue.
3 *
4 * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
5 * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be)
6 * Adaptation from sparc64 version to sparc by Pete Zaitcev.
7 */
8
9 #ifndef _SPARC_IDE_H
10 #define _SPARC_IDE_H
11
12 #ifdef __KERNEL__
13
14 #include <asm/pgtable.h>
15 #include <asm/io.h>
16 #include <asm/psr.h>
17
18 #undef MAX_HWIFS
19 #define MAX_HWIFS 2
20
21 #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
22
23 #define __ide_insl(data_reg, buffer, wcount) \
24 __ide_insw(data_reg, buffer, (wcount)<<1)
25 #define __ide_outsl(data_reg, buffer, wcount) \
26 __ide_outsw(data_reg, buffer, (wcount)<<1)
27
28 /* On sparc, I/O ports and MMIO registers are accessed identically. */
29 #define __ide_mm_insw __ide_insw
30 #define __ide_mm_insl __ide_insl
31 #define __ide_mm_outsw __ide_outsw
32 #define __ide_mm_outsl __ide_outsl
33
34 static __inline__ void __ide_insw(unsigned long port,
35 void *dst,
36 unsigned long count)
37 {
38 volatile unsigned short *data_port;
39 /* unsigned long end = (unsigned long)dst + (count << 1); */ /* P3 */
40 u16 *ps = dst;
41 u32 *pi;
42
43 data_port = (volatile unsigned short *)port;
44
45 if(((unsigned long)ps) & 0x2) {
46 *ps++ = *data_port;
47 count--;
48 }
49 pi = (u32 *)ps;
50 while(count >= 2) {
51 u32 w;
52
53 w = (*data_port) << 16;
54 w |= (*data_port);
55 *pi++ = w;
56 count -= 2;
57 }
58 ps = (u16 *)pi;
59 if(count)
60 *ps++ = *data_port;
61
62 /* __flush_dcache_range((unsigned long)dst, end); */ /* P3 see hme */
63 }
64
65 static __inline__ void __ide_outsw(unsigned long port,
66 const void *src,
67 unsigned long count)
68 {
69 volatile unsigned short *data_port;
70 /* unsigned long end = (unsigned long)src + (count << 1); */
71 const u16 *ps = src;
72 const u32 *pi;
73
74 data_port = (volatile unsigned short *)port;
75
76 if(((unsigned long)src) & 0x2) {
77 *data_port = *ps++;
78 count--;
79 }
80 pi = (const u32 *)ps;
81 while(count >= 2) {
82 u32 w;
83
84 w = *pi++;
85 *data_port = (w >> 16);
86 *data_port = w;
87 count -= 2;
88 }
89 ps = (const u16 *)pi;
90 if(count)
91 *data_port = *ps;
92
93 /* __flush_dcache_range((unsigned long)src, end); */ /* P3 see hme */
94 }
95
96 #endif /* __KERNEL__ */
97
98 #endif /* _SPARC_IDE_H */
This page took 0.035167 seconds and 6 git commands to generate.