diff options
Diffstat (limited to 'include/asm-sparc/ide.h')
-rw-r--r-- | include/asm-sparc/ide.h | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/include/asm-sparc/ide.h b/include/asm-sparc/ide.h new file mode 100644 index 000000000000..64d810385ea4 --- /dev/null +++ b/include/asm-sparc/ide.h | |||
@@ -0,0 +1,100 @@ | |||
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 <linux/config.h> | ||
15 | #include <asm/pgtable.h> | ||
16 | #include <asm/io.h> | ||
17 | #include <asm/psr.h> | ||
18 | |||
19 | #undef MAX_HWIFS | ||
20 | #define MAX_HWIFS 2 | ||
21 | |||
22 | #define IDE_ARCH_OBSOLETE_INIT | ||
23 | #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ | ||
24 | |||
25 | #define __ide_insl(data_reg, buffer, wcount) \ | ||
26 | __ide_insw(data_reg, buffer, (wcount)<<1) | ||
27 | #define __ide_outsl(data_reg, buffer, wcount) \ | ||
28 | __ide_outsw(data_reg, buffer, (wcount)<<1) | ||
29 | |||
30 | /* On sparc, I/O ports and MMIO registers are accessed identically. */ | ||
31 | #define __ide_mm_insw __ide_insw | ||
32 | #define __ide_mm_insl __ide_insl | ||
33 | #define __ide_mm_outsw __ide_outsw | ||
34 | #define __ide_mm_outsl __ide_outsl | ||
35 | |||
36 | static __inline__ void __ide_insw(unsigned long port, | ||
37 | void *dst, | ||
38 | unsigned long count) | ||
39 | { | ||
40 | volatile unsigned short *data_port; | ||
41 | /* unsigned long end = (unsigned long)dst + (count << 1); */ /* P3 */ | ||
42 | u16 *ps = dst; | ||
43 | u32 *pi; | ||
44 | |||
45 | data_port = (volatile unsigned short *)port; | ||
46 | |||
47 | if(((unsigned long)ps) & 0x2) { | ||
48 | *ps++ = *data_port; | ||
49 | count--; | ||
50 | } | ||
51 | pi = (u32 *)ps; | ||
52 | while(count >= 2) { | ||
53 | u32 w; | ||
54 | |||
55 | w = (*data_port) << 16; | ||
56 | w |= (*data_port); | ||
57 | *pi++ = w; | ||
58 | count -= 2; | ||
59 | } | ||
60 | ps = (u16 *)pi; | ||
61 | if(count) | ||
62 | *ps++ = *data_port; | ||
63 | |||
64 | /* __flush_dcache_range((unsigned long)dst, end); */ /* P3 see hme */ | ||
65 | } | ||
66 | |||
67 | static __inline__ void __ide_outsw(unsigned long port, | ||
68 | const void *src, | ||
69 | unsigned long count) | ||
70 | { | ||
71 | volatile unsigned short *data_port; | ||
72 | /* unsigned long end = (unsigned long)src + (count << 1); */ | ||
73 | const u16 *ps = src; | ||
74 | const u32 *pi; | ||
75 | |||
76 | data_port = (volatile unsigned short *)port; | ||
77 | |||
78 | if(((unsigned long)src) & 0x2) { | ||
79 | *data_port = *ps++; | ||
80 | count--; | ||
81 | } | ||
82 | pi = (const u32 *)ps; | ||
83 | while(count >= 2) { | ||
84 | u32 w; | ||
85 | |||
86 | w = *pi++; | ||
87 | *data_port = (w >> 16); | ||
88 | *data_port = w; | ||
89 | count -= 2; | ||
90 | } | ||
91 | ps = (const u16 *)pi; | ||
92 | if(count) | ||
93 | *data_port = *ps; | ||
94 | |||
95 | /* __flush_dcache_range((unsigned long)src, end); */ /* P3 see hme */ | ||
96 | } | ||
97 | |||
98 | #endif /* __KERNEL__ */ | ||
99 | |||
100 | #endif /* _SPARC_IDE_H */ | ||