aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asm-alpha/ide.h11
-rw-r--r--include/asm-arm/ide.h8
-rw-r--r--include/asm-blackfin/ide.h4
-rw-r--r--include/asm-ia64/ide.h10
-rw-r--r--include/asm-m32r/ide.h10
-rw-r--r--include/asm-mips/mach-generic/ide.h10
-rw-r--r--include/asm-parisc/ide.h2
-rw-r--r--include/asm-powerpc/ide.h57
-rw-r--r--include/asm-powerpc/mediabay.h6
-rw-r--r--include/asm-sh/ide.h3
-rw-r--r--include/asm-sparc/ide.h2
-rw-r--r--include/asm-sparc64/ide.h2
-rw-r--r--include/asm-x86/ide.h10
-rw-r--r--include/linux/hdreg.h4
-rw-r--r--include/linux/ide.h174
15 files changed, 143 insertions, 170 deletions
diff --git a/include/asm-alpha/ide.h b/include/asm-alpha/ide.h
index b7bf68d0407b..f44129abc02c 100644
--- a/include/asm-alpha/ide.h
+++ b/include/asm-alpha/ide.h
@@ -13,9 +13,6 @@
13 13
14#ifdef __KERNEL__ 14#ifdef __KERNEL__
15 15
16
17#define IDE_ARCH_OBSOLETE_DEFAULTS
18
19static inline int ide_default_irq(unsigned long base) 16static inline int ide_default_irq(unsigned long base)
20{ 17{
21 switch (base) { 18 switch (base) {
@@ -40,14 +37,6 @@ static inline unsigned long ide_default_io_base(int index)
40 } 37 }
41} 38}
42 39
43#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
44
45#ifdef CONFIG_PCI
46#define ide_init_default_irq(base) (0)
47#else
48#define ide_init_default_irq(base) ide_default_irq(base)
49#endif
50
51#include <asm-generic/ide_iops.h> 40#include <asm-generic/ide_iops.h>
52 41
53#endif /* __KERNEL__ */ 42#endif /* __KERNEL__ */
diff --git a/include/asm-arm/ide.h b/include/asm-arm/ide.h
index f348fcf3150b..88f4d231ce4f 100644
--- a/include/asm-arm/ide.h
+++ b/include/asm-arm/ide.h
@@ -17,14 +17,6 @@
17#define MAX_HWIFS 4 17#define MAX_HWIFS 4
18#endif 18#endif
19 19
20#if !defined(CONFIG_ARCH_L7200)
21# ifdef CONFIG_ARCH_CLPS7500
22# define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
23# else
24# define ide_default_io_ctl(base) (0)
25# endif
26#endif /* !ARCH_L7200 */
27
28#define __ide_mm_insw(port,addr,len) readsw(port,addr,len) 20#define __ide_mm_insw(port,addr,len) readsw(port,addr,len)
29#define __ide_mm_insl(port,addr,len) readsl(port,addr,len) 21#define __ide_mm_insl(port,addr,len) readsl(port,addr,len)
30#define __ide_mm_outsw(port,addr,len) writesw(port,addr,len) 22#define __ide_mm_outsw(port,addr,len) writesw(port,addr,len)
diff --git a/include/asm-blackfin/ide.h b/include/asm-blackfin/ide.h
index 121e272581d6..5b88de115bf4 100644
--- a/include/asm-blackfin/ide.h
+++ b/include/asm-blackfin/ide.h
@@ -19,10 +19,6 @@
19 19
20#define MAX_HWIFS 1 20#define MAX_HWIFS 1
21 21
22/* Legacy ... BLK_DEV_IDECS */
23#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
24
25
26#include <asm-generic/ide_iops.h> 22#include <asm-generic/ide_iops.h>
27 23
28/****************************************************************************/ 24/****************************************************************************/
diff --git a/include/asm-ia64/ide.h b/include/asm-ia64/ide.h
index 1ccf23809329..8fa3f8cd067a 100644
--- a/include/asm-ia64/ide.h
+++ b/include/asm-ia64/ide.h
@@ -16,8 +16,6 @@
16 16
17#include <linux/irq.h> 17#include <linux/irq.h>
18 18
19#define IDE_ARCH_OBSOLETE_DEFAULTS
20
21static inline int ide_default_irq(unsigned long base) 19static inline int ide_default_irq(unsigned long base)
22{ 20{
23 switch (base) { 21 switch (base) {
@@ -46,14 +44,6 @@ static inline unsigned long ide_default_io_base(int index)
46 } 44 }
47} 45}
48 46
49#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
50
51#ifdef CONFIG_PCI
52#define ide_init_default_irq(base) (0)
53#else
54#define ide_init_default_irq(base) ide_default_irq(base)
55#endif
56
57#include <asm-generic/ide_iops.h> 47#include <asm-generic/ide_iops.h>
58 48
59#endif /* __KERNEL__ */ 49#endif /* __KERNEL__ */
diff --git a/include/asm-m32r/ide.h b/include/asm-m32r/ide.h
index 5d2044e529ab..1e7f6474d130 100644
--- a/include/asm-m32r/ide.h
+++ b/include/asm-m32r/ide.h
@@ -23,8 +23,6 @@
23# endif 23# endif
24#endif 24#endif
25 25
26#define IDE_ARCH_OBSOLETE_DEFAULTS
27
28static __inline__ int ide_default_irq(unsigned long base) 26static __inline__ int ide_default_irq(unsigned long base)
29{ 27{
30 switch (base) { 28 switch (base) {
@@ -65,14 +63,6 @@ static __inline__ unsigned long ide_default_io_base(int index)
65 } 63 }
66} 64}
67 65
68#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
69
70#ifdef CONFIG_BLK_DEV_IDEPCI
71#define ide_init_default_irq(base) (0)
72#else
73#define ide_init_default_irq(base) ide_default_irq(base)
74#endif
75
76#include <asm-generic/ide_iops.h> 66#include <asm-generic/ide_iops.h>
77 67
78#endif /* __KERNEL__ */ 68#endif /* __KERNEL__ */
diff --git a/include/asm-mips/mach-generic/ide.h b/include/asm-mips/mach-generic/ide.h
index 4ec2b930dfbb..0f6c251f5fec 100644
--- a/include/asm-mips/mach-generic/ide.h
+++ b/include/asm-mips/mach-generic/ide.h
@@ -27,8 +27,6 @@
27# endif 27# endif
28#endif 28#endif
29 29
30#define IDE_ARCH_OBSOLETE_DEFAULTS
31
32static __inline__ int ide_probe_legacy(void) 30static __inline__ int ide_probe_legacy(void)
33{ 31{
34#ifdef CONFIG_PCI 32#ifdef CONFIG_PCI
@@ -98,14 +96,6 @@ static __inline__ unsigned long ide_default_io_base(int index)
98 } 96 }
99} 97}
100 98
101#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
102
103#ifdef CONFIG_BLK_DEV_IDEPCI
104#define ide_init_default_irq(base) (0)
105#else
106#define ide_init_default_irq(base) ide_default_irq(base)
107#endif
108
109/* MIPS port and memory-mapped I/O string operations. */ 99/* MIPS port and memory-mapped I/O string operations. */
110static inline void __ide_flush_prologue(void) 100static inline void __ide_flush_prologue(void)
111{ 101{
diff --git a/include/asm-parisc/ide.h b/include/asm-parisc/ide.h
index be8760fbc8ee..db0c94410095 100644
--- a/include/asm-parisc/ide.h
+++ b/include/asm-parisc/ide.h
@@ -17,8 +17,6 @@
17#define MAX_HWIFS 2 17#define MAX_HWIFS 2
18#endif 18#endif
19 19
20#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
21
22#define ide_request_irq(irq,hand,flg,dev,id) request_irq((irq),(hand),(flg),(dev),(id)) 20#define ide_request_irq(irq,hand,flg,dev,id) request_irq((irq),(hand),(flg),(dev),(id))
23#define ide_free_irq(irq,dev_id) free_irq((irq), (dev_id)) 21#define ide_free_irq(irq,dev_id) free_irq((irq), (dev_id))
24#define ide_request_region(from,extent,name) request_region((from), (extent), (name)) 22#define ide_request_region(from,extent,name) request_region((from), (extent), (name))
diff --git a/include/asm-powerpc/ide.h b/include/asm-powerpc/ide.h
index 6d50310ecaea..3d90bf7d3d73 100644
--- a/include/asm-powerpc/ide.h
+++ b/include/asm-powerpc/ide.h
@@ -31,39 +31,48 @@
31#include <linux/hdreg.h> 31#include <linux/hdreg.h>
32#include <linux/ioport.h> 32#include <linux/ioport.h>
33 33
34struct ide_machdep_calls { 34/* FIXME: use ide_platform host driver */
35 int (*default_irq)(unsigned long base);
36 unsigned long (*default_io_base)(int index);
37 void (*ide_init_hwif)(hw_regs_t *hw,
38 unsigned long data_port,
39 unsigned long ctrl_port,
40 int *irq);
41};
42
43extern struct ide_machdep_calls ppc_ide_md;
44
45#define IDE_ARCH_OBSOLETE_DEFAULTS
46
47static __inline__ int ide_default_irq(unsigned long base) 35static __inline__ int ide_default_irq(unsigned long base)
48{ 36{
49 if (ppc_ide_md.default_irq) 37#ifdef CONFIG_PPLUS
50 return ppc_ide_md.default_irq(base); 38 switch (base) {
39 case 0x1f0: return 14;
40 case 0x170: return 15;
41 }
42#endif
43#ifdef CONFIG_PPC_PREP
44 switch (base) {
45 case 0x1f0: return 13;
46 case 0x170: return 13;
47 case 0x1e8: return 11;
48 case 0x168: return 10;
49 case 0xfff0: return 14; /* MCP(N)750 ide0 */
50 case 0xffe0: return 15; /* MCP(N)750 ide1 */
51 }
52#endif
51 return 0; 53 return 0;
52} 54}
53 55
56/* FIXME: use ide_platform host driver */
54static __inline__ unsigned long ide_default_io_base(int index) 57static __inline__ unsigned long ide_default_io_base(int index)
55{ 58{
56 if (ppc_ide_md.default_io_base) 59#ifdef CONFIG_PPLUS
57 return ppc_ide_md.default_io_base(index); 60 switch (index) {
61 case 0: return 0x1f0;
62 case 1: return 0x170;
63 }
64#endif
65#ifdef CONFIG_PPC_PREP
66 switch (index) {
67 case 0: return 0x1f0;
68 case 1: return 0x170;
69 case 2: return 0x1e8;
70 case 3: return 0x168;
71 }
72#endif
58 return 0; 73 return 0;
59} 74}
60 75
61#ifdef CONFIG_PCI
62#define ide_init_default_irq(base) (0)
63#else
64#define ide_init_default_irq(base) ide_default_irq(base)
65#endif
66
67#ifdef CONFIG_BLK_DEV_MPC8xx_IDE 76#ifdef CONFIG_BLK_DEV_MPC8xx_IDE
68#define IDE_ARCH_ACK_INTR 1 77#define IDE_ARCH_ACK_INTR 1
69#define ide_ack_intr(hwif) ((hwif)->ack_intr ? (hwif)->ack_intr(hwif) : 1) 78#define ide_ack_intr(hwif) ((hwif)->ack_intr ? (hwif)->ack_intr(hwif) : 1)
@@ -71,8 +80,6 @@ static __inline__ unsigned long ide_default_io_base(int index)
71 80
72#endif /* __powerpc64__ */ 81#endif /* __powerpc64__ */
73 82
74#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
75
76#endif /* __KERNEL__ */ 83#endif /* __KERNEL__ */
77 84
78#endif /* _ASM_POWERPC_IDE_H */ 85#endif /* _ASM_POWERPC_IDE_H */
diff --git a/include/asm-powerpc/mediabay.h b/include/asm-powerpc/mediabay.h
index de83fe196309..df111c362a7f 100644
--- a/include/asm-powerpc/mediabay.h
+++ b/include/asm-powerpc/mediabay.h
@@ -22,10 +22,14 @@ int check_media_bay(struct device_node *which_bay, int what);
22/* Number of bays in the machine or 0 */ 22/* Number of bays in the machine or 0 */
23extern int media_bay_count; 23extern int media_bay_count;
24 24
25#ifdef CONFIG_BLK_DEV_IDE_PMAC
26#include <linux/ide.h>
27
25int check_media_bay_by_base(unsigned long base, int what); 28int check_media_bay_by_base(unsigned long base, int what);
26/* called by IDE PMAC host driver to register IDE controller for media bay */ 29/* called by IDE PMAC host driver to register IDE controller for media bay */
27int media_bay_set_ide_infos(struct device_node *which_bay, unsigned long base, 30int media_bay_set_ide_infos(struct device_node *which_bay, unsigned long base,
28 int irq, int index); 31 int irq, ide_hwif_t *hwif);
32#endif
29 33
30#endif /* __KERNEL__ */ 34#endif /* __KERNEL__ */
31#endif /* _PPC_MEDIABAY_H */ 35#endif /* _PPC_MEDIABAY_H */
diff --git a/include/asm-sh/ide.h b/include/asm-sh/ide.h
index 9f8e9142dc33..58e0bdd52be4 100644
--- a/include/asm-sh/ide.h
+++ b/include/asm-sh/ide.h
@@ -14,9 +14,6 @@
14 14
15#ifdef __KERNEL__ 15#ifdef __KERNEL__
16 16
17
18#define ide_default_io_ctl(base) (0)
19
20#include <asm-generic/ide_iops.h> 17#include <asm-generic/ide_iops.h>
21 18
22#endif /* __KERNEL__ */ 19#endif /* __KERNEL__ */
diff --git a/include/asm-sparc/ide.h b/include/asm-sparc/ide.h
index 4076cb5d1581..afd1736ed480 100644
--- a/include/asm-sparc/ide.h
+++ b/include/asm-sparc/ide.h
@@ -17,8 +17,6 @@
17#undef MAX_HWIFS 17#undef MAX_HWIFS
18#define MAX_HWIFS 2 18#define MAX_HWIFS 2
19 19
20#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
21
22#define __ide_insl(data_reg, buffer, wcount) \ 20#define __ide_insl(data_reg, buffer, wcount) \
23 __ide_insw(data_reg, buffer, (wcount)<<1) 21 __ide_insw(data_reg, buffer, (wcount)<<1)
24#define __ide_outsl(data_reg, buffer, wcount) \ 22#define __ide_outsl(data_reg, buffer, wcount) \
diff --git a/include/asm-sparc64/ide.h b/include/asm-sparc64/ide.h
index ac7eb210b941..c5fdabe0b42d 100644
--- a/include/asm-sparc64/ide.h
+++ b/include/asm-sparc64/ide.h
@@ -24,8 +24,6 @@
24# endif 24# endif
25#endif 25#endif
26 26
27#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
28
29#define __ide_insl(data_reg, buffer, wcount) \ 27#define __ide_insl(data_reg, buffer, wcount) \
30 __ide_insw(data_reg, buffer, (wcount)<<1) 28 __ide_insw(data_reg, buffer, (wcount)<<1)
31#define __ide_outsl(data_reg, buffer, wcount) \ 29#define __ide_outsl(data_reg, buffer, wcount) \
diff --git a/include/asm-x86/ide.h b/include/asm-x86/ide.h
index c2552d8bebf7..cf9c98e5bdb5 100644
--- a/include/asm-x86/ide.h
+++ b/include/asm-x86/ide.h
@@ -20,8 +20,6 @@
20# endif 20# endif
21#endif 21#endif
22 22
23#define IDE_ARCH_OBSOLETE_DEFAULTS
24
25static __inline__ int ide_default_irq(unsigned long base) 23static __inline__ int ide_default_irq(unsigned long base)
26{ 24{
27 switch (base) { 25 switch (base) {
@@ -60,14 +58,6 @@ static __inline__ unsigned long ide_default_io_base(int index)
60 } 58 }
61} 59}
62 60
63#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
64
65#ifdef CONFIG_BLK_DEV_IDEPCI
66#define ide_init_default_irq(base) (0)
67#else
68#define ide_init_default_irq(base) ide_default_irq(base)
69#endif
70
71#include <asm-generic/ide_iops.h> 61#include <asm-generic/ide_iops.h>
72 62
73#endif /* __KERNEL__ */ 63#endif /* __KERNEL__ */
diff --git a/include/linux/hdreg.h b/include/linux/hdreg.h
index e38e75967e74..c37e9241fae7 100644
--- a/include/linux/hdreg.h
+++ b/include/linux/hdreg.h
@@ -422,9 +422,11 @@ struct hd_geometry {
422#define HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ 422#define HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */
423#define HDIO_SET_DMA 0x0326 /* change use-dma flag */ 423#define HDIO_SET_DMA 0x0326 /* change use-dma flag */
424#define HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ 424#define HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */
425#ifndef __KERNEL__
425#define HDIO_SCAN_HWIF 0x0328 /* register and (re)scan interface */ 426#define HDIO_SCAN_HWIF 0x0328 /* register and (re)scan interface */
426#define HDIO_SET_NICE 0x0329 /* set nice flags */
427#define HDIO_UNREGISTER_HWIF 0x032a /* unregister interface */ 427#define HDIO_UNREGISTER_HWIF 0x032a /* unregister interface */
428#endif
429#define HDIO_SET_NICE 0x0329 /* set nice flags */
428#define HDIO_SET_WCACHE 0x032b /* change write cache enable-disable */ 430#define HDIO_SET_WCACHE 0x032b /* change write cache enable-disable */
429#define HDIO_SET_ACOUSTIC 0x032c /* change acoustic behavior */ 431#define HDIO_SET_ACOUSTIC 0x032c /* change acoustic behavior */
430#define HDIO_SET_BUSSTATE 0x032d /* set the bus state of the hwif */ 432#define HDIO_SET_BUSSTATE 0x032d /* set the bus state of the hwif */
diff --git a/include/linux/ide.h b/include/linux/ide.h
index bc26b2f27359..6c39482fd1a1 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -82,24 +82,10 @@ typedef unsigned char byte; /* used everywhere */
82 82
83#define IDE_FEATURE_OFFSET IDE_ERROR_OFFSET 83#define IDE_FEATURE_OFFSET IDE_ERROR_OFFSET
84#define IDE_COMMAND_OFFSET IDE_STATUS_OFFSET 84#define IDE_COMMAND_OFFSET IDE_STATUS_OFFSET
85 85#define IDE_ALTSTATUS_OFFSET IDE_CONTROL_OFFSET
86#define IDE_DATA_REG (HWIF(drive)->io_ports[IDE_DATA_OFFSET]) 86#define IDE_IREASON_OFFSET IDE_NSECTOR_OFFSET
87#define IDE_ERROR_REG (HWIF(drive)->io_ports[IDE_ERROR_OFFSET]) 87#define IDE_BCOUNTL_OFFSET IDE_LCYL_OFFSET
88#define IDE_NSECTOR_REG (HWIF(drive)->io_ports[IDE_NSECTOR_OFFSET]) 88#define IDE_BCOUNTH_OFFSET IDE_HCYL_OFFSET
89#define IDE_SECTOR_REG (HWIF(drive)->io_ports[IDE_SECTOR_OFFSET])
90#define IDE_LCYL_REG (HWIF(drive)->io_ports[IDE_LCYL_OFFSET])
91#define IDE_HCYL_REG (HWIF(drive)->io_ports[IDE_HCYL_OFFSET])
92#define IDE_SELECT_REG (HWIF(drive)->io_ports[IDE_SELECT_OFFSET])
93#define IDE_STATUS_REG (HWIF(drive)->io_ports[IDE_STATUS_OFFSET])
94#define IDE_CONTROL_REG (HWIF(drive)->io_ports[IDE_CONTROL_OFFSET])
95#define IDE_IRQ_REG (HWIF(drive)->io_ports[IDE_IRQ_OFFSET])
96
97#define IDE_FEATURE_REG IDE_ERROR_REG
98#define IDE_COMMAND_REG IDE_STATUS_REG
99#define IDE_ALTSTATUS_REG IDE_CONTROL_REG
100#define IDE_IREASON_REG IDE_NSECTOR_REG
101#define IDE_BCOUNTL_REG IDE_LCYL_REG
102#define IDE_BCOUNTH_REG IDE_HCYL_REG
103 89
104#define OK_STAT(stat,good,bad) (((stat)&((good)|(bad)))==(good)) 90#define OK_STAT(stat,good,bad) (((stat)&((good)|(bad)))==(good))
105#define BAD_R_STAT (BUSY_STAT | ERR_STAT) 91#define BAD_R_STAT (BUSY_STAT | ERR_STAT)
@@ -169,7 +155,7 @@ enum { ide_unknown, ide_generic, ide_pci,
169 ide_rz1000, ide_trm290, 155 ide_rz1000, ide_trm290,
170 ide_cmd646, ide_cy82c693, ide_4drives, 156 ide_cmd646, ide_cy82c693, ide_4drives,
171 ide_pmac, ide_etrax100, ide_acorn, 157 ide_pmac, ide_etrax100, ide_acorn,
172 ide_au1xxx, ide_palm3710, ide_forced 158 ide_au1xxx, ide_palm3710
173}; 159};
174 160
175typedef u8 hwif_chipset_t; 161typedef u8 hwif_chipset_t;
@@ -186,14 +172,9 @@ typedef struct hw_regs_s {
186} hw_regs_t; 172} hw_regs_t;
187 173
188struct hwif_s * ide_find_port(unsigned long); 174struct hwif_s * ide_find_port(unsigned long);
189struct hwif_s *ide_deprecated_find_port(unsigned long);
190void ide_init_port_data(struct hwif_s *, unsigned int); 175void ide_init_port_data(struct hwif_s *, unsigned int);
191void ide_init_port_hw(struct hwif_s *, hw_regs_t *); 176void ide_init_port_hw(struct hwif_s *, hw_regs_t *);
192 177
193struct ide_drive_s;
194int ide_register_hw(hw_regs_t *, void (*)(struct ide_drive_s *),
195 struct hwif_s **);
196
197static inline void ide_std_init_ports(hw_regs_t *hw, 178static inline void ide_std_init_ports(hw_regs_t *hw,
198 unsigned long io_addr, 179 unsigned long io_addr,
199 unsigned long ctl_addr) 180 unsigned long ctl_addr)
@@ -213,45 +194,6 @@ static inline void ide_std_init_ports(hw_regs_t *hw,
213#define MAX_HWIFS CONFIG_IDE_MAX_HWIFS 194#define MAX_HWIFS CONFIG_IDE_MAX_HWIFS
214#endif 195#endif
215 196
216/* needed on alpha, x86/x86_64, ia64, mips, ppc32 and sh */
217#ifndef IDE_ARCH_OBSOLETE_DEFAULTS
218# define ide_default_io_base(index) (0)
219# define ide_default_irq(base) (0)
220# define ide_init_default_irq(base) (0)
221#endif
222
223#ifdef CONFIG_IDE_ARCH_OBSOLETE_INIT
224static inline void ide_init_hwif_ports(hw_regs_t *hw,
225 unsigned long io_addr,
226 unsigned long ctl_addr,
227 int *irq)
228{
229 if (!ctl_addr)
230 ide_std_init_ports(hw, io_addr, ide_default_io_ctl(io_addr));
231 else
232 ide_std_init_ports(hw, io_addr, ctl_addr);
233
234 if (irq)
235 *irq = 0;
236
237 hw->io_ports[IDE_IRQ_OFFSET] = 0;
238
239#ifdef CONFIG_PPC32
240 if (ppc_ide_md.ide_init_hwif)
241 ppc_ide_md.ide_init_hwif(hw, io_addr, ctl_addr, irq);
242#endif
243}
244#else
245static inline void ide_init_hwif_ports(hw_regs_t *hw,
246 unsigned long io_addr,
247 unsigned long ctl_addr,
248 int *irq)
249{
250 if (io_addr || ctl_addr)
251 printk(KERN_WARNING "%s: must not be called\n", __FUNCTION__);
252}
253#endif /* CONFIG_IDE_ARCH_OBSOLETE_INIT */
254
255/* Currently only m68k, apus and m8xx need it */ 197/* Currently only m68k, apus and m8xx need it */
256#ifndef IDE_ARCH_ACK_INTR 198#ifndef IDE_ARCH_ACK_INTR
257# define ide_ack_intr(hwif) (1) 199# define ide_ack_intr(hwif) (1)
@@ -406,7 +348,7 @@ typedef struct ide_drive_s {
406 u8 wcache; /* status of write cache */ 348 u8 wcache; /* status of write cache */
407 u8 acoustic; /* acoustic management */ 349 u8 acoustic; /* acoustic management */
408 u8 media; /* disk, cdrom, tape, floppy, ... */ 350 u8 media; /* disk, cdrom, tape, floppy, ... */
409 u8 ctl; /* "normal" value for IDE_CONTROL_REG */ 351 u8 ctl; /* "normal" value for Control register */
410 u8 ready_stat; /* min status value for drive ready */ 352 u8 ready_stat; /* min status value for drive ready */
411 u8 mult_count; /* current multiple sector setting */ 353 u8 mult_count; /* current multiple sector setting */
412 u8 mult_req; /* requested multiple sector setting */ 354 u8 mult_req; /* requested multiple sector setting */
@@ -507,8 +449,6 @@ typedef struct hwif_s {
507 void (*maskproc)(ide_drive_t *, int); 449 void (*maskproc)(ide_drive_t *, int);
508 /* check host's drive quirk list */ 450 /* check host's drive quirk list */
509 void (*quirkproc)(ide_drive_t *); 451 void (*quirkproc)(ide_drive_t *);
510 /* driver soft-power interface */
511 int (*busproc)(ide_drive_t *, int);
512#endif 452#endif
513 u8 (*mdma_filter)(ide_drive_t *); 453 u8 (*mdma_filter)(ide_drive_t *);
514 u8 (*udma_filter)(ide_drive_t *); 454 u8 (*udma_filter)(ide_drive_t *);
@@ -578,7 +518,6 @@ typedef struct hwif_s {
578 518
579 unsigned noprobe : 1; /* don't probe for this interface */ 519 unsigned noprobe : 1; /* don't probe for this interface */
580 unsigned present : 1; /* this interface exists */ 520 unsigned present : 1; /* this interface exists */
581 unsigned hold : 1; /* this interface is always present */
582 unsigned serialized : 1; /* serialized all channel operation */ 521 unsigned serialized : 1; /* serialized all channel operation */
583 unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ 522 unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */
584 unsigned reset : 1; /* reset after probe */ 523 unsigned reset : 1; /* reset after probe */
@@ -586,7 +525,9 @@ typedef struct hwif_s {
586 unsigned mmio : 1; /* host uses MMIO */ 525 unsigned mmio : 1; /* host uses MMIO */
587 unsigned straight8 : 1; /* Alan's straight 8 check */ 526 unsigned straight8 : 1; /* Alan's straight 8 check */
588 527
589 struct device gendev; 528 struct device gendev;
529 struct device *portdev;
530
590 struct completion gendev_rel_comp; /* To deal with device release() */ 531 struct completion gendev_rel_comp; /* To deal with device release() */
591 532
592 void *hwif_data; /* extra hwif data */ 533 void *hwif_data; /* extra hwif data */
@@ -647,6 +588,68 @@ int set_io_32bit(ide_drive_t *, int);
647int set_pio_mode(ide_drive_t *, int); 588int set_pio_mode(ide_drive_t *, int);
648int set_using_dma(ide_drive_t *, int); 589int set_using_dma(ide_drive_t *, int);
649 590
591/* ATAPI packet command flags */
592enum {
593 /* set when an error is considered normal - no retry (ide-tape) */
594 PC_FLAG_ABORT = (1 << 0),
595 PC_FLAG_SUPPRESS_ERROR = (1 << 1),
596 PC_FLAG_WAIT_FOR_DSC = (1 << 2),
597 PC_FLAG_DMA_OK = (1 << 3),
598 PC_FLAG_DMA_RECOMMENDED = (1 << 4),
599 PC_FLAG_DMA_IN_PROGRESS = (1 << 5),
600 PC_FLAG_DMA_ERROR = (1 << 6),
601 PC_FLAG_WRITING = (1 << 7),
602 /* command timed out */
603 PC_FLAG_TIMEDOUT = (1 << 8),
604};
605
606struct ide_atapi_pc {
607 /* actual packet bytes */
608 u8 c[12];
609 /* incremented on each retry */
610 int retries;
611 int error;
612
613 /* bytes to transfer */
614 int req_xfer;
615 /* bytes actually transferred */
616 int xferred;
617
618 /* data buffer */
619 u8 *buf;
620 /* current buffer position */
621 u8 *cur_pos;
622 int buf_size;
623 /* missing/available data on the current buffer */
624 int b_count;
625
626 /* the corresponding request */
627 struct request *rq;
628
629 unsigned long flags;
630
631 /*
632 * those are more or less driver-specific and some of them are subject
633 * to change/removal later.
634 */
635 u8 pc_buf[256];
636 void (*idefloppy_callback) (ide_drive_t *);
637 ide_startstop_t (*idetape_callback) (ide_drive_t *);
638
639 /* idetape only */
640 struct idetape_bh *bh;
641 char *b_data;
642
643 /* idescsi only for now */
644 struct scatterlist *sg;
645 unsigned int sg_cnt;
646
647 struct scsi_cmnd *scsi_cmd;
648 void (*done) (struct scsi_cmnd *);
649
650 unsigned long timeout;
651};
652
650#ifdef CONFIG_IDE_PROC_FS 653#ifdef CONFIG_IDE_PROC_FS
651/* 654/*
652 * configurable drive settings 655 * configurable drive settings
@@ -691,6 +694,7 @@ void proc_ide_create(void);
691void proc_ide_destroy(void); 694void proc_ide_destroy(void);
692void ide_proc_register_port(ide_hwif_t *); 695void ide_proc_register_port(ide_hwif_t *);
693void ide_proc_port_register_devices(ide_hwif_t *); 696void ide_proc_port_register_devices(ide_hwif_t *);
697void ide_proc_unregister_device(ide_drive_t *);
694void ide_proc_unregister_port(ide_hwif_t *); 698void ide_proc_unregister_port(ide_hwif_t *);
695void ide_proc_register_driver(ide_drive_t *, ide_driver_t *); 699void ide_proc_register_driver(ide_drive_t *, ide_driver_t *);
696void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *); 700void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *);
@@ -724,6 +728,7 @@ static inline void proc_ide_create(void) { ; }
724static inline void proc_ide_destroy(void) { ; } 728static inline void proc_ide_destroy(void) { ; }
725static inline void ide_proc_register_port(ide_hwif_t *hwif) { ; } 729static inline void ide_proc_register_port(ide_hwif_t *hwif) { ; }
726static inline void ide_proc_port_register_devices(ide_hwif_t *hwif) { ; } 730static inline void ide_proc_port_register_devices(ide_hwif_t *hwif) { ; }
731static inline void ide_proc_unregister_device(ide_drive_t *drive) { ; }
727static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; } 732static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; }
728static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } 733static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; }
729static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } 734static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; }
@@ -990,7 +995,6 @@ extern void do_ide_request(struct request_queue *);
990void ide_init_disk(struct gendisk *, ide_drive_t *); 995void ide_init_disk(struct gendisk *, ide_drive_t *);
991 996
992#ifdef CONFIG_IDEPCI_PCIBUS_ORDER 997#ifdef CONFIG_IDEPCI_PCIBUS_ORDER
993extern int ide_scan_direction;
994extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name); 998extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name);
995#define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME) 999#define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME)
996#else 1000#else
@@ -1195,7 +1199,7 @@ static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {}
1195void ide_remove_port_from_hwgroup(ide_hwif_t *); 1199void ide_remove_port_from_hwgroup(ide_hwif_t *);
1196extern int ide_hwif_request_regions(ide_hwif_t *hwif); 1200extern int ide_hwif_request_regions(ide_hwif_t *hwif);
1197extern void ide_hwif_release_regions(ide_hwif_t* hwif); 1201extern void ide_hwif_release_regions(ide_hwif_t* hwif);
1198void ide_unregister(unsigned int, int, int); 1202void ide_unregister(unsigned int);
1199 1203
1200void ide_register_region(struct gendisk *); 1204void ide_register_region(struct gendisk *);
1201void ide_unregister_region(struct gendisk *); 1205void ide_unregister_region(struct gendisk *);
@@ -1204,6 +1208,8 @@ void ide_undecoded_slave(ide_drive_t *);
1204 1208
1205int ide_device_add_all(u8 *idx, const struct ide_port_info *); 1209int ide_device_add_all(u8 *idx, const struct ide_port_info *);
1206int ide_device_add(u8 idx[4], const struct ide_port_info *); 1210int ide_device_add(u8 idx[4], const struct ide_port_info *);
1211void ide_port_unregister_devices(ide_hwif_t *);
1212void ide_port_scan(ide_hwif_t *);
1207 1213
1208static inline void *ide_get_hwifdata (ide_hwif_t * hwif) 1214static inline void *ide_get_hwifdata (ide_hwif_t * hwif)
1209{ 1215{
@@ -1279,6 +1285,7 @@ extern struct mutex ide_cfg_mtx;
1279#define local_irq_set(flags) do { local_save_flags((flags)); local_irq_enable_in_hardirq(); } while (0) 1285#define local_irq_set(flags) do { local_save_flags((flags)); local_irq_enable_in_hardirq(); } while (0)
1280 1286
1281extern struct bus_type ide_bus_type; 1287extern struct bus_type ide_bus_type;
1288extern struct class *ide_port_class;
1282 1289
1283/* check if CACHE FLUSH (EXT) command is supported (bits defined in ATA-6) */ 1290/* check if CACHE FLUSH (EXT) command is supported (bits defined in ATA-6) */
1284#define ide_id_has_flush_cache(id) ((id)->cfs_enable_2 & 0x3000) 1291#define ide_id_has_flush_cache(id) ((id)->cfs_enable_2 & 0x3000)
@@ -1307,7 +1314,10 @@ static inline ide_drive_t *ide_get_paired_drive(ide_drive_t *drive)
1307 1314
1308static inline void ide_set_irq(ide_drive_t *drive, int on) 1315static inline void ide_set_irq(ide_drive_t *drive, int on)
1309{ 1316{
1310 drive->hwif->OUTB(drive->ctl | (on ? 0 : 2), IDE_CONTROL_REG); 1317 ide_hwif_t *hwif = drive->hwif;
1318
1319 hwif->OUTB(drive->ctl | (on ? 0 : 2),
1320 hwif->io_ports[IDE_CONTROL_OFFSET]);
1311} 1321}
1312 1322
1313static inline u8 ide_read_status(ide_drive_t *drive) 1323static inline u8 ide_read_status(ide_drive_t *drive)
@@ -1331,4 +1341,26 @@ static inline u8 ide_read_error(ide_drive_t *drive)
1331 return hwif->INB(hwif->io_ports[IDE_ERROR_OFFSET]); 1341 return hwif->INB(hwif->io_ports[IDE_ERROR_OFFSET]);
1332} 1342}
1333 1343
1344/*
1345 * Too bad. The drive wants to send us data which we are not ready to accept.
1346 * Just throw it away.
1347 */
1348static inline void ide_atapi_discard_data(ide_drive_t *drive, unsigned bcount)
1349{
1350 ide_hwif_t *hwif = drive->hwif;
1351
1352 /* FIXME: use ->atapi_input_bytes */
1353 while (bcount--)
1354 (void)hwif->INB(hwif->io_ports[IDE_DATA_OFFSET]);
1355}
1356
1357static inline void ide_atapi_write_zeros(ide_drive_t *drive, unsigned bcount)
1358{
1359 ide_hwif_t *hwif = drive->hwif;
1360
1361 /* FIXME: use ->atapi_output_bytes */
1362 while (bcount--)
1363 hwif->OUTB(0, hwif->io_ports[IDE_DATA_OFFSET]);
1364}
1365
1334#endif /* _IDE_H */ 1366#endif /* _IDE_H */