aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-sparc/ide.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-sparc/ide.h')
-rw-r--r--include/asm-sparc/ide.h58
1 files changed, 30 insertions, 28 deletions
diff --git a/include/asm-sparc/ide.h b/include/asm-sparc/ide.h
index afd1736ed480..b7af3d658239 100644
--- a/include/asm-sparc/ide.h
+++ b/include/asm-sparc/ide.h
@@ -10,12 +10,16 @@
10 10
11#ifdef __KERNEL__ 11#ifdef __KERNEL__
12 12
13#include <asm/pgtable.h>
14#include <asm/io.h> 13#include <asm/io.h>
14#ifdef CONFIG_SPARC64
15#include <asm/pgalloc.h>
16#include <asm/spitfire.h>
17#include <asm/cacheflush.h>
18#include <asm/page.h>
19#else
20#include <asm/pgtable.h>
15#include <asm/psr.h> 21#include <asm/psr.h>
16 22#endif
17#undef MAX_HWIFS
18#define MAX_HWIFS 2
19 23
20#define __ide_insl(data_reg, buffer, wcount) \ 24#define __ide_insl(data_reg, buffer, wcount) \
21 __ide_insw(data_reg, buffer, (wcount)<<1) 25 __ide_insw(data_reg, buffer, (wcount)<<1)
@@ -28,50 +32,46 @@
28#define __ide_mm_outsw __ide_outsw 32#define __ide_mm_outsw __ide_outsw
29#define __ide_mm_outsl __ide_outsl 33#define __ide_mm_outsl __ide_outsl
30 34
31static inline void __ide_insw(unsigned long port, 35static inline void __ide_insw(void __iomem *port, void *dst, u32 count)
32 void *dst,
33 unsigned long count)
34{ 36{
35 volatile unsigned short *data_port; 37#if defined(CONFIG_SPARC64) && defined(DCACHE_ALIASING_POSSIBLE)
36 /* unsigned long end = (unsigned long)dst + (count << 1); */ /* P3 */ 38 unsigned long end = (unsigned long)dst + (count << 1);
39#endif
37 u16 *ps = dst; 40 u16 *ps = dst;
38 u32 *pi; 41 u32 *pi;
39 42
40 data_port = (volatile unsigned short *)port;
41
42 if(((unsigned long)ps) & 0x2) { 43 if(((unsigned long)ps) & 0x2) {
43 *ps++ = *data_port; 44 *ps++ = __raw_readw(port);
44 count--; 45 count--;
45 } 46 }
46 pi = (u32 *)ps; 47 pi = (u32 *)ps;
47 while(count >= 2) { 48 while(count >= 2) {
48 u32 w; 49 u32 w;
49 50
50 w = (*data_port) << 16; 51 w = __raw_readw(port) << 16;
51 w |= (*data_port); 52 w |= __raw_readw(port);
52 *pi++ = w; 53 *pi++ = w;
53 count -= 2; 54 count -= 2;
54 } 55 }
55 ps = (u16 *)pi; 56 ps = (u16 *)pi;
56 if(count) 57 if(count)
57 *ps++ = *data_port; 58 *ps++ = __raw_readw(port);
58 59
59 /* __flush_dcache_range((unsigned long)dst, end); */ /* P3 see hme */ 60#if defined(CONFIG_SPARC64) && defined(DCACHE_ALIASING_POSSIBLE)
61 __flush_dcache_range((unsigned long)dst, end);
62#endif
60} 63}
61 64
62static inline void __ide_outsw(unsigned long port, 65static inline void __ide_outsw(void __iomem *port, const void *src, u32 count)
63 const void *src,
64 unsigned long count)
65{ 66{
66 volatile unsigned short *data_port; 67#if defined(CONFIG_SPARC64) && defined(DCACHE_ALIASING_POSSIBLE)
67 /* unsigned long end = (unsigned long)src + (count << 1); */ 68 unsigned long end = (unsigned long)src + (count << 1);
69#endif
68 const u16 *ps = src; 70 const u16 *ps = src;
69 const u32 *pi; 71 const u32 *pi;
70 72
71 data_port = (volatile unsigned short *)port;
72
73 if(((unsigned long)src) & 0x2) { 73 if(((unsigned long)src) & 0x2) {
74 *data_port = *ps++; 74 __raw_writew(*ps++, port);
75 count--; 75 count--;
76 } 76 }
77 pi = (const u32 *)ps; 77 pi = (const u32 *)ps;
@@ -79,15 +79,17 @@ static inline void __ide_outsw(unsigned long port,
79 u32 w; 79 u32 w;
80 80
81 w = *pi++; 81 w = *pi++;
82 *data_port = (w >> 16); 82 __raw_writew((w >> 16), port);
83 *data_port = w; 83 __raw_writew(w, port);
84 count -= 2; 84 count -= 2;
85 } 85 }
86 ps = (const u16 *)pi; 86 ps = (const u16 *)pi;
87 if(count) 87 if(count)
88 *data_port = *ps; 88 __raw_writew(*ps, port);
89 89
90 /* __flush_dcache_range((unsigned long)src, end); */ /* P3 see hme */ 90#if defined(CONFIG_SPARC64) && defined(DCACHE_ALIASING_POSSIBLE)
91 __flush_dcache_range((unsigned long)src, end);
92#endif
91} 93}
92 94
93#endif /* __KERNEL__ */ 95#endif /* __KERNEL__ */