aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asm-sparc/ide.h102
-rw-r--r--include/asm-sparc/ide_32.h95
-rw-r--r--include/asm-sparc/ide_64.h118
-rw-r--r--include/asm-sparc/io_32.h1
-rw-r--r--include/asm-sparc/io_64.h2
5 files changed, 99 insertions, 219 deletions
diff --git a/include/asm-sparc/ide.h b/include/asm-sparc/ide.h
index a3c7f5ff270a..879fcec72dc1 100644
--- a/include/asm-sparc/ide.h
+++ b/include/asm-sparc/ide.h
@@ -1,8 +1,100 @@
1#ifndef ___ASM_SPARC_IDE_H 1/* ide.h: SPARC PCI specific IDE glue.
2#define ___ASM_SPARC_IDE_H 2 *
3#if defined(__sparc__) && defined(__arch64__) 3 * Copyright (C) 1997 David S. Miller (davem@davemloft.net)
4#include <asm-sparc/ide_64.h> 4 * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be)
5 * Adaptation from sparc64 version to sparc by Pete Zaitcev.
6 */
7
8#ifndef _SPARC_IDE_H
9#define _SPARC_IDE_H
10
11#ifdef __KERNEL__
12
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>
5#else 19#else
6#include <asm-sparc/ide_32.h> 20#include <asm/pgtable.h>
21#include <asm/psr.h>
7#endif 22#endif
23
24#undef MAX_HWIFS
25#define MAX_HWIFS 2
26
27#define __ide_insl(data_reg, buffer, wcount) \
28 __ide_insw(data_reg, buffer, (wcount)<<1)
29#define __ide_outsl(data_reg, buffer, wcount) \
30 __ide_outsw(data_reg, buffer, (wcount)<<1)
31
32/* On sparc, I/O ports and MMIO registers are accessed identically. */
33#define __ide_mm_insw __ide_insw
34#define __ide_mm_insl __ide_insl
35#define __ide_mm_outsw __ide_outsw
36#define __ide_mm_outsl __ide_outsl
37
38static inline void __ide_insw(void __iomem *port, void *dst, u32 count)
39{
40#if defined(CONFIG_SPARC64) && defined(DCACHE_ALIASING_POSSIBLE)
41 unsigned long end = (unsigned long)dst + (count << 1);
8#endif 42#endif
43 u16 *ps = dst;
44 u32 *pi;
45
46 if(((unsigned long)ps) & 0x2) {
47 *ps++ = __raw_readw(port);
48 count--;
49 }
50 pi = (u32 *)ps;
51 while(count >= 2) {
52 u32 w;
53
54 w = __raw_readw(port) << 16;
55 w |= __raw_readw(port);
56 *pi++ = w;
57 count -= 2;
58 }
59 ps = (u16 *)pi;
60 if(count)
61 *ps++ = __raw_readw(port);
62
63#if defined(CONFIG_SPARC64) && defined(DCACHE_ALIASING_POSSIBLE)
64 __flush_dcache_range((unsigned long)dst, end);
65#endif
66}
67
68static inline void __ide_outsw(void __iomem *port, const void *src, u32 count)
69{
70#if defined(CONFIG_SPARC64) && defined(DCACHE_ALIASING_POSSIBLE)
71 unsigned long end = (unsigned long)src + (count << 1);
72#endif
73 const u16 *ps = src;
74 const u32 *pi;
75
76 if(((unsigned long)src) & 0x2) {
77 __raw_writew(*ps++, port);
78 count--;
79 }
80 pi = (const u32 *)ps;
81 while(count >= 2) {
82 u32 w;
83
84 w = *pi++;
85 __raw_writew((w >> 16), port);
86 __raw_writew(w, port);
87 count -= 2;
88 }
89 ps = (const u16 *)pi;
90 if(count)
91 __raw_writew(*ps, port);
92
93#if defined(CONFIG_SPARC64) && defined(DCACHE_ALIASING_POSSIBLE)
94 __flush_dcache_range((unsigned long)src, end);
95#endif
96}
97
98#endif /* __KERNEL__ */
99
100#endif /* _SPARC_IDE_H */
diff --git a/include/asm-sparc/ide_32.h b/include/asm-sparc/ide_32.h
deleted file mode 100644
index afd1736ed480..000000000000
--- a/include/asm-sparc/ide_32.h
+++ /dev/null
@@ -1,95 +0,0 @@
1/* ide.h: SPARC PCI specific IDE glue.
2 *
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 */
7
8#ifndef _SPARC_IDE_H
9#define _SPARC_IDE_H
10
11#ifdef __KERNEL__
12
13#include <asm/pgtable.h>
14#include <asm/io.h>
15#include <asm/psr.h>
16
17#undef MAX_HWIFS
18#define MAX_HWIFS 2
19
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)
24
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
30
31static inline void __ide_insw(unsigned long port,
32 void *dst,
33 unsigned long count)
34{
35 volatile unsigned short *data_port;
36 /* unsigned long end = (unsigned long)dst + (count << 1); */ /* P3 */
37 u16 *ps = dst;
38 u32 *pi;
39
40 data_port = (volatile unsigned short *)port;
41
42 if(((unsigned long)ps) & 0x2) {
43 *ps++ = *data_port;
44 count--;
45 }
46 pi = (u32 *)ps;
47 while(count >= 2) {
48 u32 w;
49
50 w = (*data_port) << 16;
51 w |= (*data_port);
52 *pi++ = w;
53 count -= 2;
54 }
55 ps = (u16 *)pi;
56 if(count)
57 *ps++ = *data_port;
58
59 /* __flush_dcache_range((unsigned long)dst, end); */ /* P3 see hme */
60}
61
62static inline void __ide_outsw(unsigned long port,
63 const void *src,
64 unsigned long count)
65{
66 volatile unsigned short *data_port;
67 /* unsigned long end = (unsigned long)src + (count << 1); */
68 const u16 *ps = src;
69 const u32 *pi;
70
71 data_port = (volatile unsigned short *)port;
72
73 if(((unsigned long)src) & 0x2) {
74 *data_port = *ps++;
75 count--;
76 }
77 pi = (const u32 *)ps;
78 while(count >= 2) {
79 u32 w;
80
81 w = *pi++;
82 *data_port = (w >> 16);
83 *data_port = w;
84 count -= 2;
85 }
86 ps = (const u16 *)pi;
87 if(count)
88 *data_port = *ps;
89
90 /* __flush_dcache_range((unsigned long)src, end); */ /* P3 see hme */
91}
92
93#endif /* __KERNEL__ */
94
95#endif /* _SPARC_IDE_H */
diff --git a/include/asm-sparc/ide_64.h b/include/asm-sparc/ide_64.h
deleted file mode 100644
index 1282676da1cd..000000000000
--- a/include/asm-sparc/ide_64.h
+++ /dev/null
@@ -1,118 +0,0 @@
1/*
2 * ide.h: Ultra/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 */
7
8#ifndef _SPARC64_IDE_H
9#define _SPARC64_IDE_H
10
11#ifdef __KERNEL__
12
13#include <asm/pgalloc.h>
14#include <asm/io.h>
15#include <asm/spitfire.h>
16#include <asm/cacheflush.h>
17#include <asm/page.h>
18
19#ifndef MAX_HWIFS
20# ifdef CONFIG_BLK_DEV_IDEPCI
21#define MAX_HWIFS 10
22# else
23#define MAX_HWIFS 2
24# endif
25#endif
26
27#define __ide_insl(data_reg, buffer, wcount) \
28 __ide_insw(data_reg, buffer, (wcount)<<1)
29#define __ide_outsl(data_reg, buffer, wcount) \
30 __ide_outsw(data_reg, buffer, (wcount)<<1)
31
32/* On sparc64, I/O ports and MMIO registers are accessed identically. */
33#define __ide_mm_insw __ide_insw
34#define __ide_mm_insl __ide_insl
35#define __ide_mm_outsw __ide_outsw
36#define __ide_mm_outsl __ide_outsl
37
38static inline unsigned int inw_be(void __iomem *addr)
39{
40 unsigned int ret;
41
42 __asm__ __volatile__("lduha [%1] %2, %0"
43 : "=r" (ret)
44 : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
45
46 return ret;
47}
48
49static inline void __ide_insw(void __iomem *port, void *dst, u32 count)
50{
51#ifdef DCACHE_ALIASING_POSSIBLE
52 unsigned long end = (unsigned long)dst + (count << 1);
53#endif
54 u16 *ps = dst;
55 u32 *pi;
56
57 if(((u64)ps) & 0x2) {
58 *ps++ = inw_be(port);
59 count--;
60 }
61 pi = (u32 *)ps;
62 while(count >= 2) {
63 u32 w;
64
65 w = inw_be(port) << 16;
66 w |= inw_be(port);
67 *pi++ = w;
68 count -= 2;
69 }
70 ps = (u16 *)pi;
71 if(count)
72 *ps++ = inw_be(port);
73
74#ifdef DCACHE_ALIASING_POSSIBLE
75 __flush_dcache_range((unsigned long)dst, end);
76#endif
77}
78
79static inline void outw_be(unsigned short w, void __iomem *addr)
80{
81 __asm__ __volatile__("stha %0, [%1] %2"
82 : /* no outputs */
83 : "r" (w), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
84}
85
86static inline void __ide_outsw(void __iomem *port, void *src, u32 count)
87{
88#ifdef DCACHE_ALIASING_POSSIBLE
89 unsigned long end = (unsigned long)src + (count << 1);
90#endif
91 const u16 *ps = src;
92 const u32 *pi;
93
94 if(((u64)src) & 0x2) {
95 outw_be(*ps++, port);
96 count--;
97 }
98 pi = (const u32 *)ps;
99 while(count >= 2) {
100 u32 w;
101
102 w = *pi++;
103 outw_be((w >> 16), port);
104 outw_be(w, port);
105 count -= 2;
106 }
107 ps = (const u16 *)pi;
108 if(count)
109 outw_be(*ps, port);
110
111#ifdef DCACHE_ALIASING_POSSIBLE
112 __flush_dcache_range((unsigned long)src, end);
113#endif
114}
115
116#endif /* __KERNEL__ */
117
118#endif /* _SPARC64_IDE_H */
diff --git a/include/asm-sparc/io_32.h b/include/asm-sparc/io_32.h
index c43af722ae8c..10d7da450070 100644
--- a/include/asm-sparc/io_32.h
+++ b/include/asm-sparc/io_32.h
@@ -244,6 +244,7 @@ _memcpy_toio(volatile void __iomem *dst, const void *src, __kernel_size_t n)
244 */ 244 */
245extern void __iomem *ioremap(unsigned long offset, unsigned long size); 245extern void __iomem *ioremap(unsigned long offset, unsigned long size);
246#define ioremap_nocache(X,Y) ioremap((X),(Y)) 246#define ioremap_nocache(X,Y) ioremap((X),(Y))
247#define ioremap_wc(X,Y) ioremap((X),(Y))
247extern void iounmap(volatile void __iomem *addr); 248extern void iounmap(volatile void __iomem *addr);
248 249
249#define ioread8(X) readb(X) 250#define ioread8(X) readb(X)
diff --git a/include/asm-sparc/io_64.h b/include/asm-sparc/io_64.h
index f4907414b39d..0bff078ffdd0 100644
--- a/include/asm-sparc/io_64.h
+++ b/include/asm-sparc/io_64.h
@@ -16,7 +16,6 @@
16/* BIO layer definitions. */ 16/* BIO layer definitions. */
17extern unsigned long kern_base, kern_size; 17extern unsigned long kern_base, kern_size;
18#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) 18#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
19#define BIO_VMERGE_BOUNDARY 8192
20 19
21static inline u8 _inb(unsigned long addr) 20static inline u8 _inb(unsigned long addr)
22{ 21{
@@ -461,6 +460,7 @@ static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
461} 460}
462 461
463#define ioremap_nocache(X,Y) ioremap((X),(Y)) 462#define ioremap_nocache(X,Y) ioremap((X),(Y))
463#define ioremap_wc(X,Y) ioremap((X),(Y))
464 464
465static inline void iounmap(volatile void __iomem *addr) 465static inline void iounmap(volatile void __iomem *addr)
466{ 466{