make oldconfig will rebuild these...
[linux-2.4.21-pre4.git] / include / asm-mips64 / ide.h
1 /*
2  * This file is subject to the terms and conditions of the GNU General Public
3  * License.  See the file "COPYING" in the main directory of this archive
4  * for more details.
5  *
6  * This file contains the MIPS architecture specific IDE code.
7  *
8  * Copyright (C) 1994-1996  Linus Torvalds & authors
9  */
10
11 /*
12  *  This file contains the MIPS architecture specific IDE code.
13  */
14
15 #ifndef __ASM_IDE_H
16 #define __ASM_IDE_H
17
18 #ifdef __KERNEL__
19
20 #include <linux/config.h>
21 #include <asm/io.h>
22
23 #ifndef MAX_HWIFS
24 # ifdef CONFIG_BLK_DEV_IDEPCI
25 #define MAX_HWIFS       10
26 # else
27 #define MAX_HWIFS       6
28 # endif
29 #endif
30
31 struct ide_ops {
32         int (*ide_default_irq)(ide_ioreg_t base);
33         ide_ioreg_t (*ide_default_io_base)(int index);
34         void (*ide_init_hwif_ports)(hw_regs_t *hw, ide_ioreg_t data_port,
35                                     ide_ioreg_t ctrl_port, int *irq);
36 };
37
38 extern struct ide_ops *ide_ops;
39
40 static __inline__ int ide_default_irq(ide_ioreg_t base)
41 {
42         return ide_ops->ide_default_irq(base);
43 }
44
45 static __inline__ ide_ioreg_t ide_default_io_base(int index)
46 {
47         return ide_ops->ide_default_io_base(index);
48 }
49
50 static inline void ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port,
51                                        ide_ioreg_t ctrl_port, int *irq)
52 {
53         ide_ops->ide_init_hwif_ports(hw, data_port, ctrl_port, irq);
54 }
55
56 static __inline__ void ide_init_default_hwifs(void)
57 {
58 #ifndef CONFIG_BLK_DEV_IDEPCI
59         hw_regs_t hw;
60         int index;
61
62         for(index = 0; index < MAX_HWIFS; index++) {
63                 ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
64                 hw.irq = ide_default_irq(ide_default_io_base(index));
65                 ide_register_hw(&hw, NULL);
66         }
67 #endif /* CONFIG_BLK_DEV_IDEPCI */
68 }
69
70 #if defined(CONFIG_SWAP_IO_SPACE) && defined(__MIPSEB__)
71
72 #ifdef insl
73 #undef insl
74 #endif
75 #ifdef outsl
76 #undef outsl
77 #endif
78 #ifdef insw
79 #undef insw
80 #endif
81 #ifdef outsw
82 #undef outsw
83 #endif
84
85 #define insw(p,a,c)                                                     \
86 do {                                                                    \
87         unsigned short *ptr = (unsigned short *)(a);                    \
88         unsigned int i = (c);                                           \
89         while (i--)                                                     \
90                 *ptr++ = inw(p);                                        \
91 } while (0)
92 #define insl(p,a,c)                                                     \
93 do {                                                                    \
94         unsigned long *ptr = (unsigned long *)(a);                      \
95         unsigned int i = (c);                                           \
96         while (i--)                                                     \
97                 *ptr++ = inl(p);                                        \
98 } while (0)
99 #define outsw(p,a,c)                                                    \
100 do {                                                                    \
101         unsigned short *ptr = (unsigned short *)(a);                    \
102         unsigned int i = (c);                                           \
103         while (i--)                                                     \
104                 outw(*ptr++, (p));                                      \
105 } while (0)
106 #define outsl(p,a,c) {                                                  \
107         unsigned long *ptr = (unsigned long *)(a);                      \
108         unsigned int i = (c);                                           \
109         while (i--)                                                     \
110                 outl(*ptr++, (p));                                      \
111 } while (0)
112
113 #endif /* defined(CONFIG_SWAP_IO_SPACE) && defined(__MIPSEB__)  */
114
115 #endif /* __KERNEL__ */
116
117 #endif /* __ASM_IDE_H */