diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-03-30 13:05:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-03-30 13:05:43 -0400 |
commit | 83826dc505e6c6f432332dd45681be4bb71635ce (patch) | |
tree | 761f6321c3c5ef94e63344e948e684313d61b88a | |
parent | ffd14285142cb398b2b613e27f71be415d28072e (diff) | |
parent | bf717c0a2e18dbe82eeb28e57b0abede3cdf45d6 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: (70 commits)
ide: keep track of number of bytes instead of sectors in struct ide_cmd
ide: remove ide_execute_pkt_cmd() (v2)
ide: add ->dma_timer_expiry method and remove ->dma_exec_cmd one (v2)
ide: set hwif->expiry prior to calling [__]ide_set_handler()
ide: use do_rw_taskfile() for ATA_CMD_PACKET commands
ide: pass command to ide_map_sg()
ide: remove ide_end_request()
ide: use ide_end_rq() in ide_complete_rq()
ide: pass number of bytes to complete to ide_complete_rq()
ide: remove BUG() from ide_complete_rq()
ide: move rq->errors quirk out from ide_end_request()
ide: pass error value to ide_complete_rq()
ide: sanitize ide_end_rq()
ide: add ide_end_rq() (v2)
ide: make ide_special_rq() BUG() on unknown requests
ide: sanitize ide_finish_cmd()
ide: use ide_complete_cmd() for REQ_UNPARK_HEADS
ide: use ide_complete_cmd() for head unload commands
ide: task_error() -> task_error_cmd()
ide: unify exit paths in task_pio_intr()
...
61 files changed, 1418 insertions, 1667 deletions
diff --git a/arch/m68k/include/asm/ide.h b/arch/m68k/include/asm/ide.h index b996a3c8cff5..3958726664ba 100644 --- a/arch/m68k/include/asm/ide.h +++ b/arch/m68k/include/asm/ide.h | |||
@@ -30,101 +30,28 @@ | |||
30 | #define _M68K_IDE_H | 30 | #define _M68K_IDE_H |
31 | 31 | ||
32 | #ifdef __KERNEL__ | 32 | #ifdef __KERNEL__ |
33 | |||
34 | |||
35 | #include <asm/setup.h> | 33 | #include <asm/setup.h> |
36 | #include <asm/io.h> | 34 | #include <asm/io.h> |
37 | #include <asm/irq.h> | 35 | #include <asm/irq.h> |
38 | 36 | ||
39 | #ifdef CONFIG_ATARI | ||
40 | #include <linux/interrupt.h> | ||
41 | #include <asm/atari_stdma.h> | ||
42 | #endif | ||
43 | |||
44 | #ifdef CONFIG_MAC | ||
45 | #include <asm/macints.h> | ||
46 | #endif | ||
47 | |||
48 | /* | 37 | /* |
49 | * Get rid of defs from io.h - ide has its private and conflicting versions | 38 | * Get rid of defs from io.h - ide has its private and conflicting versions |
50 | * Since so far no single m68k platform uses ISA/PCI I/O space for IDE, we | 39 | * Since so far no single m68k platform uses ISA/PCI I/O space for IDE, we |
51 | * always use the `raw' MMIO versions | 40 | * always use the `raw' MMIO versions |
52 | */ | 41 | */ |
53 | #undef inb | ||
54 | #undef inw | ||
55 | #undef insw | ||
56 | #undef inl | ||
57 | #undef insl | ||
58 | #undef outb | ||
59 | #undef outw | ||
60 | #undef outsw | ||
61 | #undef outl | ||
62 | #undef outsl | ||
63 | #undef readb | 42 | #undef readb |
64 | #undef readw | 43 | #undef readw |
65 | #undef readl | ||
66 | #undef writeb | 44 | #undef writeb |
67 | #undef writew | 45 | #undef writew |
68 | #undef writel | ||
69 | 46 | ||
70 | #define inb in_8 | ||
71 | #define inw in_be16 | ||
72 | #define insw(port, addr, n) raw_insw((u16 *)port, addr, n) | ||
73 | #define inl in_be32 | ||
74 | #define insl(port, addr, n) raw_insl((u32 *)port, addr, n) | ||
75 | #define outb(val, port) out_8(port, val) | ||
76 | #define outw(val, port) out_be16(port, val) | ||
77 | #define outsw(port, addr, n) raw_outsw((u16 *)port, addr, n) | ||
78 | #define outl(val, port) out_be32(port, val) | ||
79 | #define outsl(port, addr, n) raw_outsl((u32 *)port, addr, n) | ||
80 | #define readb in_8 | 47 | #define readb in_8 |
81 | #define readw in_be16 | 48 | #define readw in_be16 |
82 | #define __ide_mm_insw(port, addr, n) raw_insw((u16 *)port, addr, n) | 49 | #define __ide_mm_insw(port, addr, n) raw_insw((u16 *)port, addr, n) |
83 | #define readl in_be32 | ||
84 | #define __ide_mm_insl(port, addr, n) raw_insl((u32 *)port, addr, n) | 50 | #define __ide_mm_insl(port, addr, n) raw_insl((u32 *)port, addr, n) |
85 | #define writeb(val, port) out_8(port, val) | 51 | #define writeb(val, port) out_8(port, val) |
86 | #define writew(val, port) out_be16(port, val) | 52 | #define writew(val, port) out_be16(port, val) |
87 | #define __ide_mm_outsw(port, addr, n) raw_outsw((u16 *)port, addr, n) | 53 | #define __ide_mm_outsw(port, addr, n) raw_outsw((u16 *)port, addr, n) |
88 | #define writel(val, port) out_be32(port, val) | ||
89 | #define __ide_mm_outsl(port, addr, n) raw_outsl((u32 *)port, addr, n) | 54 | #define __ide_mm_outsl(port, addr, n) raw_outsl((u32 *)port, addr, n) |
90 | #if defined(CONFIG_ATARI) || defined(CONFIG_Q40) | ||
91 | #define insw_swapw(port, addr, n) raw_insw_swapw((u16 *)port, addr, n) | ||
92 | #define outsw_swapw(port, addr, n) raw_outsw_swapw((u16 *)port, addr, n) | ||
93 | #endif | ||
94 | |||
95 | #ifdef CONFIG_BLK_DEV_FALCON_IDE | ||
96 | #define IDE_ARCH_LOCK | ||
97 | |||
98 | extern int falconide_intr_lock; | ||
99 | |||
100 | static __inline__ void ide_release_lock (void) | ||
101 | { | ||
102 | if (MACH_IS_ATARI) { | ||
103 | if (falconide_intr_lock == 0) { | ||
104 | printk("ide_release_lock: bug\n"); | ||
105 | return; | ||
106 | } | ||
107 | falconide_intr_lock = 0; | ||
108 | stdma_release(); | ||
109 | } | ||
110 | } | ||
111 | |||
112 | static __inline__ void | ||
113 | ide_get_lock(irq_handler_t handler, void *data) | ||
114 | { | ||
115 | if (MACH_IS_ATARI) { | ||
116 | if (falconide_intr_lock == 0) { | ||
117 | if (in_interrupt() > 0) | ||
118 | panic( "Falcon IDE hasn't ST-DMA lock in interrupt" ); | ||
119 | stdma_lock(handler, data); | ||
120 | falconide_intr_lock = 1; | ||
121 | } | ||
122 | } | ||
123 | } | ||
124 | #endif /* CONFIG_BLK_DEV_FALCON_IDE */ | ||
125 | |||
126 | #define IDE_ARCH_ACK_INTR | ||
127 | #define ide_ack_intr(hwif) ((hwif)->ack_intr ? (hwif)->ack_intr(hwif) : 1) | ||
128 | 55 | ||
129 | #endif /* __KERNEL__ */ | 56 | #endif /* __KERNEL__ */ |
130 | #endif /* _M68K_IDE_H */ | 57 | #endif /* _M68K_IDE_H */ |
diff --git a/drivers/ide/alim15x3.c b/drivers/ide/alim15x3.c index d3513b6b8530..d516168464fc 100644 --- a/drivers/ide/alim15x3.c +++ b/drivers/ide/alim15x3.c | |||
@@ -191,17 +191,18 @@ static void ali_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
191 | /** | 191 | /** |
192 | * ali15x3_dma_setup - begin a DMA phase | 192 | * ali15x3_dma_setup - begin a DMA phase |
193 | * @drive: target device | 193 | * @drive: target device |
194 | * @cmd: command | ||
194 | * | 195 | * |
195 | * Returns 1 if the DMA cannot be performed, zero on success. | 196 | * Returns 1 if the DMA cannot be performed, zero on success. |
196 | */ | 197 | */ |
197 | 198 | ||
198 | static int ali15x3_dma_setup(ide_drive_t *drive) | 199 | static int ali15x3_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) |
199 | { | 200 | { |
200 | if (m5229_revision < 0xC2 && drive->media != ide_disk) { | 201 | if (m5229_revision < 0xC2 && drive->media != ide_disk) { |
201 | if (rq_data_dir(drive->hwif->rq)) | 202 | if (cmd->tf_flags & IDE_TFLAG_WRITE) |
202 | return 1; /* try PIO instead of DMA */ | 203 | return 1; /* try PIO instead of DMA */ |
203 | } | 204 | } |
204 | return ide_dma_setup(drive); | 205 | return ide_dma_setup(drive, cmd); |
205 | } | 206 | } |
206 | 207 | ||
207 | /** | 208 | /** |
@@ -503,11 +504,11 @@ static const struct ide_port_ops ali_port_ops = { | |||
503 | static const struct ide_dma_ops ali_dma_ops = { | 504 | static const struct ide_dma_ops ali_dma_ops = { |
504 | .dma_host_set = ide_dma_host_set, | 505 | .dma_host_set = ide_dma_host_set, |
505 | .dma_setup = ali15x3_dma_setup, | 506 | .dma_setup = ali15x3_dma_setup, |
506 | .dma_exec_cmd = ide_dma_exec_cmd, | ||
507 | .dma_start = ide_dma_start, | 507 | .dma_start = ide_dma_start, |
508 | .dma_end = ide_dma_end, | 508 | .dma_end = ide_dma_end, |
509 | .dma_test_irq = ide_dma_test_irq, | 509 | .dma_test_irq = ide_dma_test_irq, |
510 | .dma_lost_irq = ide_dma_lost_irq, | 510 | .dma_lost_irq = ide_dma_lost_irq, |
511 | .dma_timer_expiry = ide_dma_sff_timer_expiry, | ||
511 | .dma_timeout = ide_dma_timeout, | 512 | .dma_timeout = ide_dma_timeout, |
512 | .dma_sff_read_status = ide_dma_sff_read_status, | 513 | .dma_sff_read_status = ide_dma_sff_read_status, |
513 | }; | 514 | }; |
diff --git a/drivers/ide/at91_ide.c b/drivers/ide/at91_ide.c index 1bb50f46388d..27547121daff 100644 --- a/drivers/ide/at91_ide.c +++ b/drivers/ide/at91_ide.c | |||
@@ -143,7 +143,7 @@ static void apply_timings(const u8 chipselect, const u8 pio, | |||
143 | set_smc_timings(chipselect, cycle, setup, pulse, data_float, use_iordy); | 143 | set_smc_timings(chipselect, cycle, setup, pulse, data_float, use_iordy); |
144 | } | 144 | } |
145 | 145 | ||
146 | static void at91_ide_input_data(ide_drive_t *drive, struct request *rq, | 146 | static void at91_ide_input_data(ide_drive_t *drive, struct ide_cmd *cmd, |
147 | void *buf, unsigned int len) | 147 | void *buf, unsigned int len) |
148 | { | 148 | { |
149 | ide_hwif_t *hwif = drive->hwif; | 149 | ide_hwif_t *hwif = drive->hwif; |
@@ -156,11 +156,11 @@ static void at91_ide_input_data(ide_drive_t *drive, struct request *rq, | |||
156 | len++; | 156 | len++; |
157 | 157 | ||
158 | enter_16bit(chipselect, mode); | 158 | enter_16bit(chipselect, mode); |
159 | __ide_mm_insw((void __iomem *) io_ports->data_addr, buf, len / 2); | 159 | readsw((void __iomem *)io_ports->data_addr, buf, len / 2); |
160 | leave_16bit(chipselect, mode); | 160 | leave_16bit(chipselect, mode); |
161 | } | 161 | } |
162 | 162 | ||
163 | static void at91_ide_output_data(ide_drive_t *drive, struct request *rq, | 163 | static void at91_ide_output_data(ide_drive_t *drive, struct ide_cmd *cmd, |
164 | void *buf, unsigned int len) | 164 | void *buf, unsigned int len) |
165 | { | 165 | { |
166 | ide_hwif_t *hwif = drive->hwif; | 166 | ide_hwif_t *hwif = drive->hwif; |
@@ -171,7 +171,7 @@ static void at91_ide_output_data(ide_drive_t *drive, struct request *rq, | |||
171 | pdbg("cs %u buf %p len %d\n", chipselect, buf, len); | 171 | pdbg("cs %u buf %p len %d\n", chipselect, buf, len); |
172 | 172 | ||
173 | enter_16bit(chipselect, mode); | 173 | enter_16bit(chipselect, mode); |
174 | __ide_mm_outsw((void __iomem *) io_ports->data_addr, buf, len / 2); | 174 | writesw((void __iomem *)io_ports->data_addr, buf, len / 2); |
175 | leave_16bit(chipselect, mode); | 175 | leave_16bit(chipselect, mode); |
176 | } | 176 | } |
177 | 177 | ||
@@ -185,55 +185,55 @@ static void ide_mm_outb(u8 value, unsigned long port) | |||
185 | writeb(value, (void __iomem *) port); | 185 | writeb(value, (void __iomem *) port); |
186 | } | 186 | } |
187 | 187 | ||
188 | static void at91_ide_tf_load(ide_drive_t *drive, ide_task_t *task) | 188 | static void at91_ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) |
189 | { | 189 | { |
190 | ide_hwif_t *hwif = drive->hwif; | 190 | ide_hwif_t *hwif = drive->hwif; |
191 | struct ide_io_ports *io_ports = &hwif->io_ports; | 191 | struct ide_io_ports *io_ports = &hwif->io_ports; |
192 | struct ide_taskfile *tf = &task->tf; | 192 | struct ide_taskfile *tf = &cmd->tf; |
193 | u8 HIHI = (task->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; | 193 | u8 HIHI = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; |
194 | 194 | ||
195 | if (task->tf_flags & IDE_TFLAG_FLAGGED) | 195 | if (cmd->tf_flags & IDE_FTFLAG_FLAGGED) |
196 | HIHI = 0xFF; | 196 | HIHI = 0xFF; |
197 | 197 | ||
198 | if (task->tf_flags & IDE_TFLAG_OUT_DATA) { | 198 | if (cmd->tf_flags & IDE_FTFLAG_OUT_DATA) { |
199 | u16 data = (tf->hob_data << 8) | tf->data; | 199 | u16 data = (tf->hob_data << 8) | tf->data; |
200 | 200 | ||
201 | at91_ide_output_data(drive, NULL, &data, 2); | 201 | at91_ide_output_data(drive, NULL, &data, 2); |
202 | } | 202 | } |
203 | 203 | ||
204 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) | 204 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) |
205 | ide_mm_outb(tf->hob_feature, io_ports->feature_addr); | 205 | ide_mm_outb(tf->hob_feature, io_ports->feature_addr); |
206 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) | 206 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) |
207 | ide_mm_outb(tf->hob_nsect, io_ports->nsect_addr); | 207 | ide_mm_outb(tf->hob_nsect, io_ports->nsect_addr); |
208 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) | 208 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) |
209 | ide_mm_outb(tf->hob_lbal, io_ports->lbal_addr); | 209 | ide_mm_outb(tf->hob_lbal, io_ports->lbal_addr); |
210 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) | 210 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) |
211 | ide_mm_outb(tf->hob_lbam, io_ports->lbam_addr); | 211 | ide_mm_outb(tf->hob_lbam, io_ports->lbam_addr); |
212 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) | 212 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) |
213 | ide_mm_outb(tf->hob_lbah, io_ports->lbah_addr); | 213 | ide_mm_outb(tf->hob_lbah, io_ports->lbah_addr); |
214 | 214 | ||
215 | if (task->tf_flags & IDE_TFLAG_OUT_FEATURE) | 215 | if (cmd->tf_flags & IDE_TFLAG_OUT_FEATURE) |
216 | ide_mm_outb(tf->feature, io_ports->feature_addr); | 216 | ide_mm_outb(tf->feature, io_ports->feature_addr); |
217 | if (task->tf_flags & IDE_TFLAG_OUT_NSECT) | 217 | if (cmd->tf_flags & IDE_TFLAG_OUT_NSECT) |
218 | ide_mm_outb(tf->nsect, io_ports->nsect_addr); | 218 | ide_mm_outb(tf->nsect, io_ports->nsect_addr); |
219 | if (task->tf_flags & IDE_TFLAG_OUT_LBAL) | 219 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAL) |
220 | ide_mm_outb(tf->lbal, io_ports->lbal_addr); | 220 | ide_mm_outb(tf->lbal, io_ports->lbal_addr); |
221 | if (task->tf_flags & IDE_TFLAG_OUT_LBAM) | 221 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAM) |
222 | ide_mm_outb(tf->lbam, io_ports->lbam_addr); | 222 | ide_mm_outb(tf->lbam, io_ports->lbam_addr); |
223 | if (task->tf_flags & IDE_TFLAG_OUT_LBAH) | 223 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAH) |
224 | ide_mm_outb(tf->lbah, io_ports->lbah_addr); | 224 | ide_mm_outb(tf->lbah, io_ports->lbah_addr); |
225 | 225 | ||
226 | if (task->tf_flags & IDE_TFLAG_OUT_DEVICE) | 226 | if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) |
227 | ide_mm_outb((tf->device & HIHI) | drive->select, io_ports->device_addr); | 227 | ide_mm_outb((tf->device & HIHI) | drive->select, io_ports->device_addr); |
228 | } | 228 | } |
229 | 229 | ||
230 | static void at91_ide_tf_read(ide_drive_t *drive, ide_task_t *task) | 230 | static void at91_ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) |
231 | { | 231 | { |
232 | ide_hwif_t *hwif = drive->hwif; | 232 | ide_hwif_t *hwif = drive->hwif; |
233 | struct ide_io_ports *io_ports = &hwif->io_ports; | 233 | struct ide_io_ports *io_ports = &hwif->io_ports; |
234 | struct ide_taskfile *tf = &task->tf; | 234 | struct ide_taskfile *tf = &cmd->tf; |
235 | 235 | ||
236 | if (task->tf_flags & IDE_TFLAG_IN_DATA) { | 236 | if (cmd->tf_flags & IDE_FTFLAG_IN_DATA) { |
237 | u16 data; | 237 | u16 data; |
238 | 238 | ||
239 | at91_ide_input_data(drive, NULL, &data, 2); | 239 | at91_ide_input_data(drive, NULL, &data, 2); |
@@ -244,31 +244,31 @@ static void at91_ide_tf_read(ide_drive_t *drive, ide_task_t *task) | |||
244 | /* be sure we're looking at the low order bits */ | 244 | /* be sure we're looking at the low order bits */ |
245 | ide_mm_outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); | 245 | ide_mm_outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); |
246 | 246 | ||
247 | if (task->tf_flags & IDE_TFLAG_IN_FEATURE) | 247 | if (cmd->tf_flags & IDE_TFLAG_IN_FEATURE) |
248 | tf->feature = ide_mm_inb(io_ports->feature_addr); | 248 | tf->feature = ide_mm_inb(io_ports->feature_addr); |
249 | if (task->tf_flags & IDE_TFLAG_IN_NSECT) | 249 | if (cmd->tf_flags & IDE_TFLAG_IN_NSECT) |
250 | tf->nsect = ide_mm_inb(io_ports->nsect_addr); | 250 | tf->nsect = ide_mm_inb(io_ports->nsect_addr); |
251 | if (task->tf_flags & IDE_TFLAG_IN_LBAL) | 251 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAL) |
252 | tf->lbal = ide_mm_inb(io_ports->lbal_addr); | 252 | tf->lbal = ide_mm_inb(io_ports->lbal_addr); |
253 | if (task->tf_flags & IDE_TFLAG_IN_LBAM) | 253 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAM) |
254 | tf->lbam = ide_mm_inb(io_ports->lbam_addr); | 254 | tf->lbam = ide_mm_inb(io_ports->lbam_addr); |
255 | if (task->tf_flags & IDE_TFLAG_IN_LBAH) | 255 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAH) |
256 | tf->lbah = ide_mm_inb(io_ports->lbah_addr); | 256 | tf->lbah = ide_mm_inb(io_ports->lbah_addr); |
257 | if (task->tf_flags & IDE_TFLAG_IN_DEVICE) | 257 | if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE) |
258 | tf->device = ide_mm_inb(io_ports->device_addr); | 258 | tf->device = ide_mm_inb(io_ports->device_addr); |
259 | 259 | ||
260 | if (task->tf_flags & IDE_TFLAG_LBA48) { | 260 | if (cmd->tf_flags & IDE_TFLAG_LBA48) { |
261 | ide_mm_outb(ATA_DEVCTL_OBS | 0x80, io_ports->ctl_addr); | 261 | ide_mm_outb(ATA_DEVCTL_OBS | 0x80, io_ports->ctl_addr); |
262 | 262 | ||
263 | if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) | 263 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) |
264 | tf->hob_feature = ide_mm_inb(io_ports->feature_addr); | 264 | tf->hob_feature = ide_mm_inb(io_ports->feature_addr); |
265 | if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT) | 265 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT) |
266 | tf->hob_nsect = ide_mm_inb(io_ports->nsect_addr); | 266 | tf->hob_nsect = ide_mm_inb(io_ports->nsect_addr); |
267 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL) | 267 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL) |
268 | tf->hob_lbal = ide_mm_inb(io_ports->lbal_addr); | 268 | tf->hob_lbal = ide_mm_inb(io_ports->lbal_addr); |
269 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM) | 269 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM) |
270 | tf->hob_lbam = ide_mm_inb(io_ports->lbam_addr); | 270 | tf->hob_lbam = ide_mm_inb(io_ports->lbam_addr); |
271 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH) | 271 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH) |
272 | tf->hob_lbah = ide_mm_inb(io_ports->lbah_addr); | 272 | tf->hob_lbah = ide_mm_inb(io_ports->lbah_addr); |
273 | } | 273 | } |
274 | } | 274 | } |
diff --git a/drivers/ide/au1xxx-ide.c b/drivers/ide/au1xxx-ide.c index 154ec2cf734f..d3a9d6c15328 100644 --- a/drivers/ide/au1xxx-ide.c +++ b/drivers/ide/au1xxx-ide.c | |||
@@ -86,13 +86,13 @@ void auide_outsw(unsigned long port, void *addr, u32 count) | |||
86 | ctp->cur_ptr = au1xxx_ddma_get_nextptr_virt(dp); | 86 | ctp->cur_ptr = au1xxx_ddma_get_nextptr_virt(dp); |
87 | } | 87 | } |
88 | 88 | ||
89 | static void au1xxx_input_data(ide_drive_t *drive, struct request *rq, | 89 | static void au1xxx_input_data(ide_drive_t *drive, struct ide_cmd *cmd, |
90 | void *buf, unsigned int len) | 90 | void *buf, unsigned int len) |
91 | { | 91 | { |
92 | auide_insw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2); | 92 | auide_insw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2); |
93 | } | 93 | } |
94 | 94 | ||
95 | static void au1xxx_output_data(ide_drive_t *drive, struct request *rq, | 95 | static void au1xxx_output_data(ide_drive_t *drive, struct ide_cmd *cmd, |
96 | void *buf, unsigned int len) | 96 | void *buf, unsigned int len) |
97 | { | 97 | { |
98 | auide_outsw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2); | 98 | auide_outsw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2); |
@@ -209,23 +209,17 @@ static void auide_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
209 | */ | 209 | */ |
210 | 210 | ||
211 | #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA | 211 | #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA |
212 | static int auide_build_dmatable(ide_drive_t *drive) | 212 | static int auide_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd) |
213 | { | 213 | { |
214 | int i, iswrite, count = 0; | ||
215 | ide_hwif_t *hwif = drive->hwif; | 214 | ide_hwif_t *hwif = drive->hwif; |
216 | struct request *rq = hwif->rq; | ||
217 | _auide_hwif *ahwif = &auide_hwif; | 215 | _auide_hwif *ahwif = &auide_hwif; |
218 | struct scatterlist *sg; | 216 | struct scatterlist *sg; |
217 | int i = cmd->sg_nents, count = 0; | ||
218 | int iswrite = !!(cmd->tf_flags & IDE_TFLAG_WRITE); | ||
219 | 219 | ||
220 | iswrite = (rq_data_dir(rq) == WRITE); | ||
221 | /* Save for interrupt context */ | 220 | /* Save for interrupt context */ |
222 | ahwif->drive = drive; | 221 | ahwif->drive = drive; |
223 | 222 | ||
224 | hwif->sg_nents = i = ide_build_sglist(drive, rq); | ||
225 | |||
226 | if (!i) | ||
227 | return 0; | ||
228 | |||
229 | /* fill the descriptors */ | 223 | /* fill the descriptors */ |
230 | sg = hwif->sg_table; | 224 | sg = hwif->sg_table; |
231 | while (i && sg_dma_len(sg)) { | 225 | while (i && sg_dma_len(sg)) { |
@@ -286,12 +280,7 @@ static int auide_build_dmatable(ide_drive_t *drive) | |||
286 | 280 | ||
287 | static int auide_dma_end(ide_drive_t *drive) | 281 | static int auide_dma_end(ide_drive_t *drive) |
288 | { | 282 | { |
289 | ide_hwif_t *hwif = drive->hwif; | 283 | ide_destroy_dmatable(drive); |
290 | |||
291 | if (hwif->sg_nents) { | ||
292 | ide_destroy_dmatable(drive); | ||
293 | hwif->sg_nents = 0; | ||
294 | } | ||
295 | 284 | ||
296 | return 0; | 285 | return 0; |
297 | } | 286 | } |
@@ -301,19 +290,10 @@ static void auide_dma_start(ide_drive_t *drive ) | |||
301 | } | 290 | } |
302 | 291 | ||
303 | 292 | ||
304 | static void auide_dma_exec_cmd(ide_drive_t *drive, u8 command) | 293 | static int auide_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) |
305 | { | 294 | { |
306 | /* issue cmd to drive */ | 295 | if (auide_build_dmatable(drive, cmd) == 0) { |
307 | ide_execute_command(drive, command, &ide_dma_intr, | 296 | ide_map_sg(drive, cmd); |
308 | (2*WAIT_CMD), NULL); | ||
309 | } | ||
310 | |||
311 | static int auide_dma_setup(ide_drive_t *drive) | ||
312 | { | ||
313 | struct request *rq = drive->hwif->rq; | ||
314 | |||
315 | if (!auide_build_dmatable(drive)) { | ||
316 | ide_map_sg(drive, rq); | ||
317 | return 1; | 297 | return 1; |
318 | } | 298 | } |
319 | 299 | ||
@@ -369,7 +349,6 @@ static void auide_init_dbdma_dev(dbdev_tab_t *dev, u32 dev_id, u32 tsize, u32 de | |||
369 | static const struct ide_dma_ops au1xxx_dma_ops = { | 349 | static const struct ide_dma_ops au1xxx_dma_ops = { |
370 | .dma_host_set = auide_dma_host_set, | 350 | .dma_host_set = auide_dma_host_set, |
371 | .dma_setup = auide_dma_setup, | 351 | .dma_setup = auide_dma_setup, |
372 | .dma_exec_cmd = auide_dma_exec_cmd, | ||
373 | .dma_start = auide_dma_start, | 352 | .dma_start = auide_dma_start, |
374 | .dma_end = auide_dma_end, | 353 | .dma_end = auide_dma_end, |
375 | .dma_test_irq = auide_dma_test_irq, | 354 | .dma_test_irq = auide_dma_test_irq, |
diff --git a/drivers/ide/buddha.c b/drivers/ide/buddha.c index c5a3c9ef6a5d..d028f8864bc1 100644 --- a/drivers/ide/buddha.c +++ b/drivers/ide/buddha.c | |||
@@ -143,6 +143,11 @@ static void __init buddha_setup_ports(hw_regs_t *hw, unsigned long base, | |||
143 | hw->chipset = ide_generic; | 143 | hw->chipset = ide_generic; |
144 | } | 144 | } |
145 | 145 | ||
146 | static const struct ide_port_info buddha_port_info = { | ||
147 | .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA, | ||
148 | .irq_flags = IRQF_SHARED, | ||
149 | }; | ||
150 | |||
146 | /* | 151 | /* |
147 | * Probe for a Buddha or Catweasel IDE interface | 152 | * Probe for a Buddha or Catweasel IDE interface |
148 | */ | 153 | */ |
@@ -172,10 +177,6 @@ static int __init buddha_init(void) | |||
172 | 177 | ||
173 | board = z->resource.start; | 178 | board = z->resource.start; |
174 | 179 | ||
175 | /* | ||
176 | * FIXME: we now have selectable mmio v/s iomio transports. | ||
177 | */ | ||
178 | |||
179 | if(type != BOARD_XSURF) { | 180 | if(type != BOARD_XSURF) { |
180 | if (!request_mem_region(board+BUDDHA_BASE1, 0x800, "IDE")) | 181 | if (!request_mem_region(board+BUDDHA_BASE1, 0x800, "IDE")) |
181 | continue; | 182 | continue; |
@@ -224,7 +225,7 @@ fail_base2: | |||
224 | hws[i] = &hw[i]; | 225 | hws[i] = &hw[i]; |
225 | } | 226 | } |
226 | 227 | ||
227 | ide_host_add(NULL, hws, NULL); | 228 | ide_host_add(&buddha_port_info, hws, NULL); |
228 | } | 229 | } |
229 | 230 | ||
230 | return 0; | 231 | return 0; |
diff --git a/drivers/ide/cmd64x.c b/drivers/ide/cmd64x.c index aeee036b1503..bf0e3f470824 100644 --- a/drivers/ide/cmd64x.c +++ b/drivers/ide/cmd64x.c | |||
@@ -379,11 +379,11 @@ static const struct ide_port_ops cmd64x_port_ops = { | |||
379 | static const struct ide_dma_ops cmd64x_dma_ops = { | 379 | static const struct ide_dma_ops cmd64x_dma_ops = { |
380 | .dma_host_set = ide_dma_host_set, | 380 | .dma_host_set = ide_dma_host_set, |
381 | .dma_setup = ide_dma_setup, | 381 | .dma_setup = ide_dma_setup, |
382 | .dma_exec_cmd = ide_dma_exec_cmd, | ||
383 | .dma_start = ide_dma_start, | 382 | .dma_start = ide_dma_start, |
384 | .dma_end = cmd64x_dma_end, | 383 | .dma_end = cmd64x_dma_end, |
385 | .dma_test_irq = cmd64x_dma_test_irq, | 384 | .dma_test_irq = cmd64x_dma_test_irq, |
386 | .dma_lost_irq = ide_dma_lost_irq, | 385 | .dma_lost_irq = ide_dma_lost_irq, |
386 | .dma_timer_expiry = ide_dma_sff_timer_expiry, | ||
387 | .dma_timeout = ide_dma_timeout, | 387 | .dma_timeout = ide_dma_timeout, |
388 | .dma_sff_read_status = ide_dma_sff_read_status, | 388 | .dma_sff_read_status = ide_dma_sff_read_status, |
389 | }; | 389 | }; |
@@ -391,11 +391,11 @@ static const struct ide_dma_ops cmd64x_dma_ops = { | |||
391 | static const struct ide_dma_ops cmd646_rev1_dma_ops = { | 391 | static const struct ide_dma_ops cmd646_rev1_dma_ops = { |
392 | .dma_host_set = ide_dma_host_set, | 392 | .dma_host_set = ide_dma_host_set, |
393 | .dma_setup = ide_dma_setup, | 393 | .dma_setup = ide_dma_setup, |
394 | .dma_exec_cmd = ide_dma_exec_cmd, | ||
395 | .dma_start = ide_dma_start, | 394 | .dma_start = ide_dma_start, |
396 | .dma_end = cmd646_1_dma_end, | 395 | .dma_end = cmd646_1_dma_end, |
397 | .dma_test_irq = ide_dma_test_irq, | 396 | .dma_test_irq = ide_dma_test_irq, |
398 | .dma_lost_irq = ide_dma_lost_irq, | 397 | .dma_lost_irq = ide_dma_lost_irq, |
398 | .dma_timer_expiry = ide_dma_sff_timer_expiry, | ||
399 | .dma_timeout = ide_dma_timeout, | 399 | .dma_timeout = ide_dma_timeout, |
400 | .dma_sff_read_status = ide_dma_sff_read_status, | 400 | .dma_sff_read_status = ide_dma_sff_read_status, |
401 | }; | 401 | }; |
@@ -403,11 +403,11 @@ static const struct ide_dma_ops cmd646_rev1_dma_ops = { | |||
403 | static const struct ide_dma_ops cmd648_dma_ops = { | 403 | static const struct ide_dma_ops cmd648_dma_ops = { |
404 | .dma_host_set = ide_dma_host_set, | 404 | .dma_host_set = ide_dma_host_set, |
405 | .dma_setup = ide_dma_setup, | 405 | .dma_setup = ide_dma_setup, |
406 | .dma_exec_cmd = ide_dma_exec_cmd, | ||
407 | .dma_start = ide_dma_start, | 406 | .dma_start = ide_dma_start, |
408 | .dma_end = cmd648_dma_end, | 407 | .dma_end = cmd648_dma_end, |
409 | .dma_test_irq = cmd648_dma_test_irq, | 408 | .dma_test_irq = cmd648_dma_test_irq, |
410 | .dma_lost_irq = ide_dma_lost_irq, | 409 | .dma_lost_irq = ide_dma_lost_irq, |
410 | .dma_timer_expiry = ide_dma_sff_timer_expiry, | ||
411 | .dma_timeout = ide_dma_timeout, | 411 | .dma_timeout = ide_dma_timeout, |
412 | .dma_sff_read_status = ide_dma_sff_read_status, | 412 | .dma_sff_read_status = ide_dma_sff_read_status, |
413 | }; | 413 | }; |
diff --git a/drivers/ide/cs5536.c b/drivers/ide/cs5536.c index 7a62db719a46..d5dcf4899607 100644 --- a/drivers/ide/cs5536.c +++ b/drivers/ide/cs5536.c | |||
@@ -231,11 +231,11 @@ static const struct ide_port_ops cs5536_port_ops = { | |||
231 | static const struct ide_dma_ops cs5536_dma_ops = { | 231 | static const struct ide_dma_ops cs5536_dma_ops = { |
232 | .dma_host_set = ide_dma_host_set, | 232 | .dma_host_set = ide_dma_host_set, |
233 | .dma_setup = ide_dma_setup, | 233 | .dma_setup = ide_dma_setup, |
234 | .dma_exec_cmd = ide_dma_exec_cmd, | ||
235 | .dma_start = cs5536_dma_start, | 234 | .dma_start = cs5536_dma_start, |
236 | .dma_end = cs5536_dma_end, | 235 | .dma_end = cs5536_dma_end, |
237 | .dma_test_irq = ide_dma_test_irq, | 236 | .dma_test_irq = ide_dma_test_irq, |
238 | .dma_lost_irq = ide_dma_lost_irq, | 237 | .dma_lost_irq = ide_dma_lost_irq, |
238 | .dma_timer_expiry = ide_dma_sff_timer_expiry, | ||
239 | .dma_timeout = ide_dma_timeout, | 239 | .dma_timeout = ide_dma_timeout, |
240 | }; | 240 | }; |
241 | 241 | ||
diff --git a/drivers/ide/delkin_cb.c b/drivers/ide/delkin_cb.c index bacb1194c9c9..f153b95619bb 100644 --- a/drivers/ide/delkin_cb.c +++ b/drivers/ide/delkin_cb.c | |||
@@ -66,6 +66,7 @@ static const struct ide_port_info delkin_cb_port_info = { | |||
66 | .port_ops = &delkin_cb_port_ops, | 66 | .port_ops = &delkin_cb_port_ops, |
67 | .host_flags = IDE_HFLAG_IO_32BIT | IDE_HFLAG_UNMASK_IRQS | | 67 | .host_flags = IDE_HFLAG_IO_32BIT | IDE_HFLAG_UNMASK_IRQS | |
68 | IDE_HFLAG_NO_DMA, | 68 | IDE_HFLAG_NO_DMA, |
69 | .irq_flags = IRQF_SHARED, | ||
69 | .init_chipset = delkin_cb_init_chipset, | 70 | .init_chipset = delkin_cb_init_chipset, |
70 | }; | 71 | }; |
71 | 72 | ||
diff --git a/drivers/ide/dtc2278.c b/drivers/ide/dtc2278.c index 689b2e493413..c6b138122981 100644 --- a/drivers/ide/dtc2278.c +++ b/drivers/ide/dtc2278.c | |||
@@ -100,7 +100,8 @@ static const struct ide_port_info dtc2278_port_info __initdata = { | |||
100 | IDE_HFLAG_IO_32BIT | | 100 | IDE_HFLAG_IO_32BIT | |
101 | /* disallow ->io_32bit changes */ | 101 | /* disallow ->io_32bit changes */ |
102 | IDE_HFLAG_NO_IO_32BIT | | 102 | IDE_HFLAG_NO_IO_32BIT | |
103 | IDE_HFLAG_NO_DMA, | 103 | IDE_HFLAG_NO_DMA | |
104 | IDE_HFLAG_DTC2278, | ||
104 | .pio_mask = ATA_PIO4, | 105 | .pio_mask = ATA_PIO4, |
105 | }; | 106 | }; |
106 | 107 | ||
diff --git a/drivers/ide/falconide.c b/drivers/ide/falconide.c index a638e952d67a..b368a5effc3a 100644 --- a/drivers/ide/falconide.c +++ b/drivers/ide/falconide.c | |||
@@ -40,29 +40,48 @@ | |||
40 | * which is shared between several drivers. | 40 | * which is shared between several drivers. |
41 | */ | 41 | */ |
42 | 42 | ||
43 | int falconide_intr_lock; | 43 | static int falconide_intr_lock; |
44 | EXPORT_SYMBOL(falconide_intr_lock); | ||
45 | 44 | ||
46 | static void falconide_input_data(ide_drive_t *drive, struct request *rq, | 45 | static void falconide_release_lock(void) |
46 | { | ||
47 | if (falconide_intr_lock == 0) { | ||
48 | printk(KERN_ERR "%s: bug\n", __func__); | ||
49 | return; | ||
50 | } | ||
51 | falconide_intr_lock = 0; | ||
52 | stdma_release(); | ||
53 | } | ||
54 | |||
55 | static void falconide_get_lock(irq_handler_t handler, void *data) | ||
56 | { | ||
57 | if (falconide_intr_lock == 0) { | ||
58 | if (in_interrupt() > 0) | ||
59 | panic("Falcon IDE hasn't ST-DMA lock in interrupt"); | ||
60 | stdma_lock(handler, data); | ||
61 | falconide_intr_lock = 1; | ||
62 | } | ||
63 | } | ||
64 | |||
65 | static void falconide_input_data(ide_drive_t *drive, struct ide_cmd *cmd, | ||
47 | void *buf, unsigned int len) | 66 | void *buf, unsigned int len) |
48 | { | 67 | { |
49 | unsigned long data_addr = drive->hwif->io_ports.data_addr; | 68 | unsigned long data_addr = drive->hwif->io_ports.data_addr; |
50 | 69 | ||
51 | if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS) | 70 | if (drive->media == ide_disk && cmd && (cmd->tf_flags & IDE_TFLAG_FS)) |
52 | return insw(data_addr, buf, (len + 1) / 2); | 71 | return insw(data_addr, buf, (len + 1) / 2); |
53 | 72 | ||
54 | insw_swapw(data_addr, buf, (len + 1) / 2); | 73 | raw_insw_swapw((u16 *)data_addr, buf, (len + 1) / 2); |
55 | } | 74 | } |
56 | 75 | ||
57 | static void falconide_output_data(ide_drive_t *drive, struct request *rq, | 76 | static void falconide_output_data(ide_drive_t *drive, struct ide_cmd *cmd, |
58 | void *buf, unsigned int len) | 77 | void *buf, unsigned int len) |
59 | { | 78 | { |
60 | unsigned long data_addr = drive->hwif->io_ports.data_addr; | 79 | unsigned long data_addr = drive->hwif->io_ports.data_addr; |
61 | 80 | ||
62 | if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS) | 81 | if (drive->media == ide_disk && cmd && (cmd->tf_flags & IDE_TFLAG_FS)) |
63 | return outsw(data_addr, buf, (len + 1) / 2); | 82 | return outsw(data_addr, buf, (len + 1) / 2); |
64 | 83 | ||
65 | outsw_swapw(data_addr, buf, (len + 1) / 2); | 84 | raw_outsw_swapw((u16 *)data_addr, buf, (len + 1) / 2); |
66 | } | 85 | } |
67 | 86 | ||
68 | /* Atari has a byte-swapped IDE interface */ | 87 | /* Atari has a byte-swapped IDE interface */ |
@@ -81,8 +100,12 @@ static const struct ide_tp_ops falconide_tp_ops = { | |||
81 | }; | 100 | }; |
82 | 101 | ||
83 | static const struct ide_port_info falconide_port_info = { | 102 | static const struct ide_port_info falconide_port_info = { |
103 | .get_lock = falconide_get_lock, | ||
104 | .release_lock = falconide_release_lock, | ||
84 | .tp_ops = &falconide_tp_ops, | 105 | .tp_ops = &falconide_tp_ops, |
85 | .host_flags = IDE_HFLAG_NO_DMA | IDE_HFLAG_SERIALIZE, | 106 | .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_SERIALIZE | |
107 | IDE_HFLAG_NO_DMA, | ||
108 | .irq_flags = IRQF_SHARED, | ||
86 | }; | 109 | }; |
87 | 110 | ||
88 | static void __init falconide_setup_ports(hw_regs_t *hw) | 111 | static void __init falconide_setup_ports(hw_regs_t *hw) |
@@ -132,9 +155,9 @@ static int __init falconide_init(void) | |||
132 | goto err; | 155 | goto err; |
133 | } | 156 | } |
134 | 157 | ||
135 | ide_get_lock(NULL, NULL); | 158 | falconide_get_lock(NULL, NULL); |
136 | rc = ide_host_register(host, &falconide_port_info, hws); | 159 | rc = ide_host_register(host, &falconide_port_info, hws); |
137 | ide_release_lock(); | 160 | falconide_release_lock(); |
138 | 161 | ||
139 | if (rc) | 162 | if (rc) |
140 | goto err_free; | 163 | goto err_free; |
diff --git a/drivers/ide/gayle.c b/drivers/ide/gayle.c index 59bd0be9dcb3..dc778251cb05 100644 --- a/drivers/ide/gayle.c +++ b/drivers/ide/gayle.c | |||
@@ -118,7 +118,9 @@ static void __init gayle_setup_ports(hw_regs_t *hw, unsigned long base, | |||
118 | } | 118 | } |
119 | 119 | ||
120 | static const struct ide_port_info gayle_port_info = { | 120 | static const struct ide_port_info gayle_port_info = { |
121 | .host_flags = IDE_HFLAG_SERIALIZE | IDE_HFLAG_NO_DMA, | 121 | .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_SERIALIZE | |
122 | IDE_HFLAG_NO_DMA, | ||
123 | .irq_flags = IRQF_SHARED, | ||
122 | }; | 124 | }; |
123 | 125 | ||
124 | /* | 126 | /* |
@@ -163,9 +165,6 @@ found: | |||
163 | irqport = (unsigned long)ZTWO_VADDR(GAYLE_IRQ_1200); | 165 | irqport = (unsigned long)ZTWO_VADDR(GAYLE_IRQ_1200); |
164 | ack_intr = gayle_ack_intr_a1200; | 166 | ack_intr = gayle_ack_intr_a1200; |
165 | } | 167 | } |
166 | /* | ||
167 | * FIXME: we now have selectable modes between mmio v/s iomio | ||
168 | */ | ||
169 | 168 | ||
170 | res_start = ((unsigned long)phys_base) & ~(GAYLE_NEXT_PORT-1); | 169 | res_start = ((unsigned long)phys_base) & ~(GAYLE_NEXT_PORT-1); |
171 | res_n = GAYLE_IDEREG_SIZE; | 170 | res_n = GAYLE_IDEREG_SIZE; |
diff --git a/drivers/ide/hpt366.c b/drivers/ide/hpt366.c index d3b3e824f445..dbaf184ed9c5 100644 --- a/drivers/ide/hpt366.c +++ b/drivers/ide/hpt366.c | |||
@@ -1418,11 +1418,11 @@ static const struct ide_port_ops hpt3xx_port_ops = { | |||
1418 | static const struct ide_dma_ops hpt37x_dma_ops = { | 1418 | static const struct ide_dma_ops hpt37x_dma_ops = { |
1419 | .dma_host_set = ide_dma_host_set, | 1419 | .dma_host_set = ide_dma_host_set, |
1420 | .dma_setup = ide_dma_setup, | 1420 | .dma_setup = ide_dma_setup, |
1421 | .dma_exec_cmd = ide_dma_exec_cmd, | ||
1422 | .dma_start = ide_dma_start, | 1421 | .dma_start = ide_dma_start, |
1423 | .dma_end = hpt374_dma_end, | 1422 | .dma_end = hpt374_dma_end, |
1424 | .dma_test_irq = hpt374_dma_test_irq, | 1423 | .dma_test_irq = hpt374_dma_test_irq, |
1425 | .dma_lost_irq = ide_dma_lost_irq, | 1424 | .dma_lost_irq = ide_dma_lost_irq, |
1425 | .dma_timer_expiry = ide_dma_sff_timer_expiry, | ||
1426 | .dma_timeout = ide_dma_timeout, | 1426 | .dma_timeout = ide_dma_timeout, |
1427 | .dma_sff_read_status = ide_dma_sff_read_status, | 1427 | .dma_sff_read_status = ide_dma_sff_read_status, |
1428 | }; | 1428 | }; |
@@ -1430,11 +1430,11 @@ static const struct ide_dma_ops hpt37x_dma_ops = { | |||
1430 | static const struct ide_dma_ops hpt370_dma_ops = { | 1430 | static const struct ide_dma_ops hpt370_dma_ops = { |
1431 | .dma_host_set = ide_dma_host_set, | 1431 | .dma_host_set = ide_dma_host_set, |
1432 | .dma_setup = ide_dma_setup, | 1432 | .dma_setup = ide_dma_setup, |
1433 | .dma_exec_cmd = ide_dma_exec_cmd, | ||
1434 | .dma_start = hpt370_dma_start, | 1433 | .dma_start = hpt370_dma_start, |
1435 | .dma_end = hpt370_dma_end, | 1434 | .dma_end = hpt370_dma_end, |
1436 | .dma_test_irq = ide_dma_test_irq, | 1435 | .dma_test_irq = ide_dma_test_irq, |
1437 | .dma_lost_irq = ide_dma_lost_irq, | 1436 | .dma_lost_irq = ide_dma_lost_irq, |
1437 | .dma_timer_expiry = ide_dma_sff_timer_expiry, | ||
1438 | .dma_timeout = hpt370_dma_timeout, | 1438 | .dma_timeout = hpt370_dma_timeout, |
1439 | .dma_sff_read_status = ide_dma_sff_read_status, | 1439 | .dma_sff_read_status = ide_dma_sff_read_status, |
1440 | }; | 1440 | }; |
@@ -1442,11 +1442,11 @@ static const struct ide_dma_ops hpt370_dma_ops = { | |||
1442 | static const struct ide_dma_ops hpt36x_dma_ops = { | 1442 | static const struct ide_dma_ops hpt36x_dma_ops = { |
1443 | .dma_host_set = ide_dma_host_set, | 1443 | .dma_host_set = ide_dma_host_set, |
1444 | .dma_setup = ide_dma_setup, | 1444 | .dma_setup = ide_dma_setup, |
1445 | .dma_exec_cmd = ide_dma_exec_cmd, | ||
1446 | .dma_start = ide_dma_start, | 1445 | .dma_start = ide_dma_start, |
1447 | .dma_end = ide_dma_end, | 1446 | .dma_end = ide_dma_end, |
1448 | .dma_test_irq = ide_dma_test_irq, | 1447 | .dma_test_irq = ide_dma_test_irq, |
1449 | .dma_lost_irq = hpt366_dma_lost_irq, | 1448 | .dma_lost_irq = hpt366_dma_lost_irq, |
1449 | .dma_timer_expiry = ide_dma_sff_timer_expiry, | ||
1450 | .dma_timeout = ide_dma_timeout, | 1450 | .dma_timeout = ide_dma_timeout, |
1451 | .dma_sff_read_status = ide_dma_sff_read_status, | 1451 | .dma_sff_read_status = ide_dma_sff_read_status, |
1452 | }; | 1452 | }; |
diff --git a/drivers/ide/icside.c b/drivers/ide/icside.c index 415d7e24f2b6..51ce404fe532 100644 --- a/drivers/ide/icside.c +++ b/drivers/ide/icside.c | |||
@@ -307,15 +307,14 @@ static void icside_dma_start(ide_drive_t *drive) | |||
307 | enable_dma(ec->dma); | 307 | enable_dma(ec->dma); |
308 | } | 308 | } |
309 | 309 | ||
310 | static int icside_dma_setup(ide_drive_t *drive) | 310 | static int icside_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) |
311 | { | 311 | { |
312 | ide_hwif_t *hwif = drive->hwif; | 312 | ide_hwif_t *hwif = drive->hwif; |
313 | struct expansion_card *ec = ECARD_DEV(hwif->dev); | 313 | struct expansion_card *ec = ECARD_DEV(hwif->dev); |
314 | struct icside_state *state = ecard_get_drvdata(ec); | 314 | struct icside_state *state = ecard_get_drvdata(ec); |
315 | struct request *rq = hwif->rq; | ||
316 | unsigned int dma_mode; | 315 | unsigned int dma_mode; |
317 | 316 | ||
318 | if (rq_data_dir(rq)) | 317 | if (cmd->tf_flags & IDE_TFLAG_WRITE) |
319 | dma_mode = DMA_MODE_WRITE; | 318 | dma_mode = DMA_MODE_WRITE; |
320 | else | 319 | else |
321 | dma_mode = DMA_MODE_READ; | 320 | dma_mode = DMA_MODE_READ; |
@@ -325,8 +324,6 @@ static int icside_dma_setup(ide_drive_t *drive) | |||
325 | */ | 324 | */ |
326 | BUG_ON(dma_channel_active(ec->dma)); | 325 | BUG_ON(dma_channel_active(ec->dma)); |
327 | 326 | ||
328 | hwif->sg_nents = ide_build_sglist(drive, rq); | ||
329 | |||
330 | /* | 327 | /* |
331 | * Ensure that we have the right interrupt routed. | 328 | * Ensure that we have the right interrupt routed. |
332 | */ | 329 | */ |
@@ -346,7 +343,7 @@ static int icside_dma_setup(ide_drive_t *drive) | |||
346 | * Tell the DMA engine about the SG table and | 343 | * Tell the DMA engine about the SG table and |
347 | * data direction. | 344 | * data direction. |
348 | */ | 345 | */ |
349 | set_dma_sg(ec->dma, hwif->sg_table, hwif->sg_nents); | 346 | set_dma_sg(ec->dma, hwif->sg_table, cmd->sg_nents); |
350 | set_dma_mode(ec->dma, dma_mode); | 347 | set_dma_mode(ec->dma, dma_mode); |
351 | 348 | ||
352 | drive->waiting_for_dma = 1; | 349 | drive->waiting_for_dma = 1; |
@@ -354,12 +351,6 @@ static int icside_dma_setup(ide_drive_t *drive) | |||
354 | return 0; | 351 | return 0; |
355 | } | 352 | } |
356 | 353 | ||
357 | static void icside_dma_exec_cmd(ide_drive_t *drive, u8 cmd) | ||
358 | { | ||
359 | /* issue cmd to drive */ | ||
360 | ide_execute_command(drive, cmd, ide_dma_intr, 2 * WAIT_CMD, NULL); | ||
361 | } | ||
362 | |||
363 | static int icside_dma_test_irq(ide_drive_t *drive) | 354 | static int icside_dma_test_irq(ide_drive_t *drive) |
364 | { | 355 | { |
365 | ide_hwif_t *hwif = drive->hwif; | 356 | ide_hwif_t *hwif = drive->hwif; |
@@ -383,7 +374,6 @@ static int icside_dma_init(ide_hwif_t *hwif, const struct ide_port_info *d) | |||
383 | static const struct ide_dma_ops icside_v6_dma_ops = { | 374 | static const struct ide_dma_ops icside_v6_dma_ops = { |
384 | .dma_host_set = icside_dma_host_set, | 375 | .dma_host_set = icside_dma_host_set, |
385 | .dma_setup = icside_dma_setup, | 376 | .dma_setup = icside_dma_setup, |
386 | .dma_exec_cmd = icside_dma_exec_cmd, | ||
387 | .dma_start = icside_dma_start, | 377 | .dma_start = icside_dma_start, |
388 | .dma_end = icside_dma_end, | 378 | .dma_end = icside_dma_end, |
389 | .dma_test_irq = icside_dma_test_irq, | 379 | .dma_test_irq = icside_dma_test_irq, |
@@ -419,6 +409,10 @@ static void icside_setup_ports(hw_regs_t *hw, void __iomem *base, | |||
419 | hw->chipset = ide_acorn; | 409 | hw->chipset = ide_acorn; |
420 | } | 410 | } |
421 | 411 | ||
412 | static const struct ide_port_info icside_v5_port_info = { | ||
413 | .host_flags = IDE_HFLAG_NO_DMA, | ||
414 | }; | ||
415 | |||
422 | static int __devinit | 416 | static int __devinit |
423 | icside_register_v5(struct icside_state *state, struct expansion_card *ec) | 417 | icside_register_v5(struct icside_state *state, struct expansion_card *ec) |
424 | { | 418 | { |
@@ -445,7 +439,7 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec) | |||
445 | 439 | ||
446 | icside_setup_ports(&hw, base, &icside_cardinfo_v5, ec); | 440 | icside_setup_ports(&hw, base, &icside_cardinfo_v5, ec); |
447 | 441 | ||
448 | host = ide_host_alloc(NULL, hws); | 442 | host = ide_host_alloc(&icside_v5_port_info, hws); |
449 | if (host == NULL) | 443 | if (host == NULL) |
450 | return -ENODEV; | 444 | return -ENODEV; |
451 | 445 | ||
@@ -453,7 +447,7 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec) | |||
453 | 447 | ||
454 | ecard_set_drvdata(ec, state); | 448 | ecard_set_drvdata(ec, state); |
455 | 449 | ||
456 | ret = ide_host_register(host, NULL, hws); | 450 | ret = ide_host_register(host, &icside_v5_port_info, hws); |
457 | if (ret) | 451 | if (ret) |
458 | goto err_free; | 452 | goto err_free; |
459 | 453 | ||
diff --git a/drivers/ide/ide-4drives.c b/drivers/ide/ide-4drives.c index 9e85b1ec9607..78aca75a2c48 100644 --- a/drivers/ide/ide-4drives.c +++ b/drivers/ide/ide-4drives.c | |||
@@ -23,7 +23,8 @@ static const struct ide_port_ops ide_4drives_port_ops = { | |||
23 | 23 | ||
24 | static const struct ide_port_info ide_4drives_port_info = { | 24 | static const struct ide_port_info ide_4drives_port_info = { |
25 | .port_ops = &ide_4drives_port_ops, | 25 | .port_ops = &ide_4drives_port_ops, |
26 | .host_flags = IDE_HFLAG_SERIALIZE | IDE_HFLAG_NO_DMA, | 26 | .host_flags = IDE_HFLAG_SERIALIZE | IDE_HFLAG_NO_DMA | |
27 | IDE_HFLAG_4DRIVES, | ||
27 | }; | 28 | }; |
28 | 29 | ||
29 | static int __init ide_4drives_init(void) | 30 | static int __init ide_4drives_init(void) |
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c index 5b704f1ea90c..12f436951bff 100644 --- a/drivers/ide/ide-acpi.c +++ b/drivers/ide/ide-acpi.c | |||
@@ -304,7 +304,7 @@ static int do_drive_set_taskfiles(ide_drive_t *drive, | |||
304 | /* send all taskfile registers (0x1f1-0x1f7) *in*that*order* */ | 304 | /* send all taskfile registers (0x1f1-0x1f7) *in*that*order* */ |
305 | for (ix = 0; ix < gtf_count; ix++) { | 305 | for (ix = 0; ix < gtf_count; ix++) { |
306 | u8 *gtf = (u8 *)(gtf_address + ix * REGS_PER_GTF); | 306 | u8 *gtf = (u8 *)(gtf_address + ix * REGS_PER_GTF); |
307 | ide_task_t task; | 307 | struct ide_cmd cmd; |
308 | 308 | ||
309 | DEBPRINT("(0x1f1-1f7): " | 309 | DEBPRINT("(0x1f1-1f7): " |
310 | "hex: %02x %02x %02x %02x %02x %02x %02x\n", | 310 | "hex: %02x %02x %02x %02x %02x %02x %02x\n", |
@@ -317,11 +317,11 @@ static int do_drive_set_taskfiles(ide_drive_t *drive, | |||
317 | } | 317 | } |
318 | 318 | ||
319 | /* convert GTF to taskfile */ | 319 | /* convert GTF to taskfile */ |
320 | memset(&task, 0, sizeof(ide_task_t)); | 320 | memset(&cmd, 0, sizeof(cmd)); |
321 | memcpy(&task.tf_array[7], gtf, REGS_PER_GTF); | 321 | memcpy(&cmd.tf_array[7], gtf, REGS_PER_GTF); |
322 | task.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; | 322 | cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; |
323 | 323 | ||
324 | err = ide_no_data_taskfile(drive, &task); | 324 | err = ide_no_data_taskfile(drive, &cmd); |
325 | if (err) { | 325 | if (err) { |
326 | printk(KERN_ERR "%s: ide_no_data_taskfile failed: %u\n", | 326 | printk(KERN_ERR "%s: ide_no_data_taskfile failed: %u\n", |
327 | __func__, err); | 327 | __func__, err); |
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index 6adc5b4a4406..2fb5d28a9be5 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c | |||
@@ -302,16 +302,16 @@ EXPORT_SYMBOL_GPL(ide_cd_get_xferlen); | |||
302 | 302 | ||
303 | void ide_read_bcount_and_ireason(ide_drive_t *drive, u16 *bcount, u8 *ireason) | 303 | void ide_read_bcount_and_ireason(ide_drive_t *drive, u16 *bcount, u8 *ireason) |
304 | { | 304 | { |
305 | ide_task_t task; | 305 | struct ide_cmd cmd; |
306 | 306 | ||
307 | memset(&task, 0, sizeof(task)); | 307 | memset(&cmd, 0, sizeof(cmd)); |
308 | task.tf_flags = IDE_TFLAG_IN_LBAH | IDE_TFLAG_IN_LBAM | | 308 | cmd.tf_flags = IDE_TFLAG_IN_LBAH | IDE_TFLAG_IN_LBAM | |
309 | IDE_TFLAG_IN_NSECT; | 309 | IDE_TFLAG_IN_NSECT; |
310 | 310 | ||
311 | drive->hwif->tp_ops->tf_read(drive, &task); | 311 | drive->hwif->tp_ops->tf_read(drive, &cmd); |
312 | 312 | ||
313 | *bcount = (task.tf.lbah << 8) | task.tf.lbam; | 313 | *bcount = (cmd.tf.lbah << 8) | cmd.tf.lbam; |
314 | *ireason = task.tf.nsect & 3; | 314 | *ireason = cmd.tf.nsect & 3; |
315 | } | 315 | } |
316 | EXPORT_SYMBOL_GPL(ide_read_bcount_and_ireason); | 316 | EXPORT_SYMBOL_GPL(ide_read_bcount_and_ireason); |
317 | 317 | ||
@@ -336,11 +336,6 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive) | |||
336 | timeout = (drive->media == ide_floppy) ? WAIT_FLOPPY_CMD | 336 | timeout = (drive->media == ide_floppy) ? WAIT_FLOPPY_CMD |
337 | : WAIT_TAPE_CMD; | 337 | : WAIT_TAPE_CMD; |
338 | 338 | ||
339 | if (pc->flags & PC_FLAG_TIMEDOUT) { | ||
340 | drive->pc_callback(drive, 0); | ||
341 | return ide_stopped; | ||
342 | } | ||
343 | |||
344 | /* Clear the interrupt */ | 339 | /* Clear the interrupt */ |
345 | stat = tp_ops->read_status(hwif); | 340 | stat = tp_ops->read_status(hwif); |
346 | 341 | ||
@@ -362,6 +357,8 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive) | |||
362 | 357 | ||
363 | /* No more interrupts */ | 358 | /* No more interrupts */ |
364 | if ((stat & ATA_DRQ) == 0) { | 359 | if ((stat & ATA_DRQ) == 0) { |
360 | int uptodate; | ||
361 | |||
365 | debug_log("Packet command completed, %d bytes transferred\n", | 362 | debug_log("Packet command completed, %d bytes transferred\n", |
366 | pc->xferred); | 363 | pc->xferred); |
367 | 364 | ||
@@ -400,7 +397,22 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive) | |||
400 | dsc = 1; | 397 | dsc = 1; |
401 | 398 | ||
402 | /* Command finished - Call the callback function */ | 399 | /* Command finished - Call the callback function */ |
403 | drive->pc_callback(drive, dsc); | 400 | uptodate = drive->pc_callback(drive, dsc); |
401 | |||
402 | if (uptodate == 0) | ||
403 | drive->failed_pc = NULL; | ||
404 | |||
405 | if (blk_special_request(rq)) { | ||
406 | rq->errors = 0; | ||
407 | ide_complete_rq(drive, 0, blk_rq_bytes(rq)); | ||
408 | } else { | ||
409 | if (blk_fs_request(rq) == 0 && uptodate <= 0) { | ||
410 | if (rq->errors == 0) | ||
411 | rq->errors = -EIO; | ||
412 | } | ||
413 | ide_complete_rq(drive, uptodate ? 0 : -EIO, | ||
414 | ide_rq_bytes(rq)); | ||
415 | } | ||
404 | 416 | ||
405 | return ide_stopped; | 417 | return ide_stopped; |
406 | } | 418 | } |
@@ -458,7 +470,8 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive) | |||
458 | 470 | ||
459 | /* FIXME: don't do partial completions */ | 471 | /* FIXME: don't do partial completions */ |
460 | if (drive->media == ide_floppy) | 472 | if (drive->media == ide_floppy) |
461 | ide_end_request(drive, 1, done >> 9); | 473 | ide_complete_rq(drive, 0, |
474 | done ? done : ide_rq_bytes(rq)); | ||
462 | } else | 475 | } else |
463 | xferfunc(drive, NULL, pc->cur_pos, bcount); | 476 | xferfunc(drive, NULL, pc->cur_pos, bcount); |
464 | 477 | ||
@@ -470,39 +483,32 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive) | |||
470 | rq->cmd[0], bcount); | 483 | rq->cmd[0], bcount); |
471 | next_irq: | 484 | next_irq: |
472 | /* And set the interrupt handler again */ | 485 | /* And set the interrupt handler again */ |
473 | ide_set_handler(drive, ide_pc_intr, timeout, NULL); | 486 | ide_set_handler(drive, ide_pc_intr, timeout); |
474 | return ide_started; | 487 | return ide_started; |
475 | } | 488 | } |
476 | 489 | ||
477 | static void ide_pktcmd_tf_load(ide_drive_t *drive, u32 tf_flags, u16 bcount) | 490 | static void ide_init_packet_cmd(struct ide_cmd *cmd, u32 tf_flags, |
491 | u16 bcount, u8 dma) | ||
478 | { | 492 | { |
479 | ide_hwif_t *hwif = drive->hwif; | 493 | cmd->protocol = dma ? ATAPI_PROT_DMA : ATAPI_PROT_PIO; |
480 | ide_task_t task; | 494 | cmd->tf_flags |= IDE_TFLAG_OUT_LBAH | IDE_TFLAG_OUT_LBAM | |
481 | u8 dma = drive->dma; | 495 | IDE_TFLAG_OUT_FEATURE | tf_flags; |
482 | 496 | cmd->tf.command = ATA_CMD_PACKET; | |
483 | memset(&task, 0, sizeof(task)); | 497 | cmd->tf.feature = dma; /* Use PIO/DMA */ |
484 | task.tf_flags = IDE_TFLAG_OUT_LBAH | IDE_TFLAG_OUT_LBAM | | 498 | cmd->tf.lbam = bcount & 0xff; |
485 | IDE_TFLAG_OUT_FEATURE | tf_flags; | 499 | cmd->tf.lbah = (bcount >> 8) & 0xff; |
486 | task.tf.feature = dma; /* Use PIO/DMA */ | ||
487 | task.tf.lbam = bcount & 0xff; | ||
488 | task.tf.lbah = (bcount >> 8) & 0xff; | ||
489 | |||
490 | ide_tf_dump(drive->name, &task.tf); | ||
491 | hwif->tp_ops->set_irq(hwif, 1); | ||
492 | SELECT_MASK(drive, 0); | ||
493 | hwif->tp_ops->tf_load(drive, &task); | ||
494 | } | 500 | } |
495 | 501 | ||
496 | static u8 ide_read_ireason(ide_drive_t *drive) | 502 | static u8 ide_read_ireason(ide_drive_t *drive) |
497 | { | 503 | { |
498 | ide_task_t task; | 504 | struct ide_cmd cmd; |
499 | 505 | ||
500 | memset(&task, 0, sizeof(task)); | 506 | memset(&cmd, 0, sizeof(cmd)); |
501 | task.tf_flags = IDE_TFLAG_IN_NSECT; | 507 | cmd.tf_flags = IDE_TFLAG_IN_NSECT; |
502 | 508 | ||
503 | drive->hwif->tp_ops->tf_read(drive, &task); | 509 | drive->hwif->tp_ops->tf_read(drive, &cmd); |
504 | 510 | ||
505 | return task.tf.nsect & 3; | 511 | return cmd.tf.nsect & 3; |
506 | } | 512 | } |
507 | 513 | ||
508 | static u8 ide_wait_ireason(ide_drive_t *drive, u8 ireason) | 514 | static u8 ide_wait_ireason(ide_drive_t *drive, u8 ireason) |
@@ -597,11 +603,13 @@ static ide_startstop_t ide_transfer_pc(ide_drive_t *drive) | |||
597 | } | 603 | } |
598 | } | 604 | } |
599 | 605 | ||
606 | hwif->expiry = expiry; | ||
607 | |||
600 | /* Set the interrupt routine */ | 608 | /* Set the interrupt routine */ |
601 | ide_set_handler(drive, | 609 | ide_set_handler(drive, |
602 | (dev_is_idecd(drive) ? drive->irq_handler | 610 | (dev_is_idecd(drive) ? drive->irq_handler |
603 | : ide_pc_intr), | 611 | : ide_pc_intr), |
604 | timeout, expiry); | 612 | timeout); |
605 | 613 | ||
606 | /* Begin DMA, if necessary */ | 614 | /* Begin DMA, if necessary */ |
607 | if (dev_is_idecd(drive)) { | 615 | if (dev_is_idecd(drive)) { |
@@ -621,23 +629,30 @@ static ide_startstop_t ide_transfer_pc(ide_drive_t *drive) | |||
621 | return ide_started; | 629 | return ide_started; |
622 | } | 630 | } |
623 | 631 | ||
624 | ide_startstop_t ide_issue_pc(ide_drive_t *drive) | 632 | ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_cmd *cmd) |
625 | { | 633 | { |
626 | struct ide_atapi_pc *pc; | 634 | struct ide_atapi_pc *pc; |
627 | ide_hwif_t *hwif = drive->hwif; | 635 | ide_hwif_t *hwif = drive->hwif; |
636 | const struct ide_dma_ops *dma_ops = hwif->dma_ops; | ||
628 | ide_expiry_t *expiry = NULL; | 637 | ide_expiry_t *expiry = NULL; |
638 | struct request *rq = hwif->rq; | ||
629 | unsigned int timeout; | 639 | unsigned int timeout; |
630 | u32 tf_flags; | 640 | u32 tf_flags; |
631 | u16 bcount; | 641 | u16 bcount; |
642 | u8 drq_int = !!(drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT); | ||
632 | 643 | ||
633 | if (dev_is_idecd(drive)) { | 644 | if (dev_is_idecd(drive)) { |
634 | tf_flags = IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL; | 645 | tf_flags = IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL; |
635 | bcount = ide_cd_get_xferlen(hwif->rq); | 646 | bcount = ide_cd_get_xferlen(rq); |
636 | expiry = ide_cd_expiry; | 647 | expiry = ide_cd_expiry; |
637 | timeout = ATAPI_WAIT_PC; | 648 | timeout = ATAPI_WAIT_PC; |
638 | 649 | ||
639 | if (drive->dma) | 650 | if (drive->dma) { |
640 | drive->dma = !hwif->dma_ops->dma_setup(drive); | 651 | if (ide_build_sglist(drive, cmd)) |
652 | drive->dma = !dma_ops->dma_setup(drive, cmd); | ||
653 | else | ||
654 | drive->dma = 0; | ||
655 | } | ||
641 | } else { | 656 | } else { |
642 | pc = drive->pc; | 657 | pc = drive->pc; |
643 | 658 | ||
@@ -656,8 +671,12 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive) | |||
656 | } | 671 | } |
657 | 672 | ||
658 | if ((pc->flags & PC_FLAG_DMA_OK) && | 673 | if ((pc->flags & PC_FLAG_DMA_OK) && |
659 | (drive->dev_flags & IDE_DFLAG_USING_DMA)) | 674 | (drive->dev_flags & IDE_DFLAG_USING_DMA)) { |
660 | drive->dma = !hwif->dma_ops->dma_setup(drive); | 675 | if (ide_build_sglist(drive, cmd)) |
676 | drive->dma = !dma_ops->dma_setup(drive, cmd); | ||
677 | else | ||
678 | drive->dma = 0; | ||
679 | } | ||
661 | 680 | ||
662 | if (!drive->dma) | 681 | if (!drive->dma) |
663 | pc->flags &= ~PC_FLAG_DMA_OK; | 682 | pc->flags &= ~PC_FLAG_DMA_OK; |
@@ -666,18 +685,18 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive) | |||
666 | : WAIT_TAPE_CMD; | 685 | : WAIT_TAPE_CMD; |
667 | } | 686 | } |
668 | 687 | ||
669 | ide_pktcmd_tf_load(drive, tf_flags, bcount); | 688 | ide_init_packet_cmd(cmd, tf_flags, bcount, drive->dma); |
670 | 689 | ||
671 | /* Issue the packet command */ | 690 | (void)do_rw_taskfile(drive, cmd); |
672 | if (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT) { | 691 | |
692 | if (drq_int) { | ||
673 | if (drive->dma) | 693 | if (drive->dma) |
674 | drive->waiting_for_dma = 0; | 694 | drive->waiting_for_dma = 0; |
675 | ide_execute_command(drive, ATA_CMD_PACKET, ide_transfer_pc, | 695 | hwif->expiry = expiry; |
676 | timeout, expiry); | ||
677 | return ide_started; | ||
678 | } else { | ||
679 | ide_execute_pkt_cmd(drive); | ||
680 | return ide_transfer_pc(drive); | ||
681 | } | 696 | } |
697 | |||
698 | ide_execute_command(drive, cmd, ide_transfer_pc, timeout); | ||
699 | |||
700 | return drq_int ? ide_started : ide_transfer_pc(drive); | ||
682 | } | 701 | } |
683 | EXPORT_SYMBOL_GPL(ide_issue_pc); | 702 | EXPORT_SYMBOL_GPL(ide_issue_pc); |
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 2177cd11664c..3f630e4080d4 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -100,8 +100,7 @@ static int cdrom_log_sense(ide_drive_t *drive, struct request *rq, | |||
100 | { | 100 | { |
101 | int log = 0; | 101 | int log = 0; |
102 | 102 | ||
103 | ide_debug_log(IDE_DBG_SENSE, "Call %s, sense_key: 0x%x\n", __func__, | 103 | ide_debug_log(IDE_DBG_SENSE, "sense_key: 0x%x", sense->sense_key); |
104 | sense->sense_key); | ||
105 | 104 | ||
106 | if (!sense || !rq || (rq->cmd_flags & REQ_QUIET)) | 105 | if (!sense || !rq || (rq->cmd_flags & REQ_QUIET)) |
107 | return 0; | 106 | return 0; |
@@ -151,13 +150,12 @@ static void cdrom_analyze_sense_data(ide_drive_t *drive, | |||
151 | unsigned long bio_sectors; | 150 | unsigned long bio_sectors; |
152 | struct cdrom_info *info = drive->driver_data; | 151 | struct cdrom_info *info = drive->driver_data; |
153 | 152 | ||
154 | ide_debug_log(IDE_DBG_SENSE, "Call %s, error_code: 0x%x, " | 153 | ide_debug_log(IDE_DBG_SENSE, "error_code: 0x%x, sense_key: 0x%x", |
155 | "sense_key: 0x%x\n", __func__, sense->error_code, | 154 | sense->error_code, sense->sense_key); |
156 | sense->sense_key); | ||
157 | 155 | ||
158 | if (failed_command) | 156 | if (failed_command) |
159 | ide_debug_log(IDE_DBG_SENSE, "%s: failed cmd: 0x%x\n", | 157 | ide_debug_log(IDE_DBG_SENSE, "failed cmd: 0x%x", |
160 | __func__, failed_command->cmd[0]); | 158 | failed_command->cmd[0]); |
161 | 159 | ||
162 | if (!cdrom_log_sense(drive, failed_command, sense)) | 160 | if (!cdrom_log_sense(drive, failed_command, sense)) |
163 | return; | 161 | return; |
@@ -215,9 +213,9 @@ static void cdrom_queue_request_sense(ide_drive_t *drive, void *sense, | |||
215 | struct request *failed_command) | 213 | struct request *failed_command) |
216 | { | 214 | { |
217 | struct cdrom_info *info = drive->driver_data; | 215 | struct cdrom_info *info = drive->driver_data; |
218 | struct request *rq = &info->request_sense_request; | 216 | struct request *rq = &drive->request_sense_rq; |
219 | 217 | ||
220 | ide_debug_log(IDE_DBG_SENSE, "Call %s\n", __func__); | 218 | ide_debug_log(IDE_DBG_SENSE, "enter"); |
221 | 219 | ||
222 | if (sense == NULL) | 220 | if (sense == NULL) |
223 | sense = &info->sense_data; | 221 | sense = &info->sense_data; |
@@ -239,8 +237,8 @@ static void cdrom_queue_request_sense(ide_drive_t *drive, void *sense, | |||
239 | rq->buffer = (void *) failed_command; | 237 | rq->buffer = (void *) failed_command; |
240 | 238 | ||
241 | if (failed_command) | 239 | if (failed_command) |
242 | ide_debug_log(IDE_DBG_SENSE, "failed_cmd: 0x%x\n", | 240 | ide_debug_log(IDE_DBG_SENSE, "failed_cmd: 0x%x", |
243 | failed_command->cmd[0]); | 241 | failed_command->cmd[0]); |
244 | 242 | ||
245 | drive->hwif->rq = NULL; | 243 | drive->hwif->rq = NULL; |
246 | 244 | ||
@@ -252,9 +250,8 @@ static void cdrom_end_request(ide_drive_t *drive, int uptodate) | |||
252 | struct request *rq = drive->hwif->rq; | 250 | struct request *rq = drive->hwif->rq; |
253 | int nsectors = rq->hard_cur_sectors; | 251 | int nsectors = rq->hard_cur_sectors; |
254 | 252 | ||
255 | ide_debug_log(IDE_DBG_FUNC, "Call %s, cmd: 0x%x, uptodate: 0x%x, " | 253 | ide_debug_log(IDE_DBG_FUNC, "cmd: 0x%x, uptodate: 0x%x, nsectors: %d", |
256 | "nsectors: %d\n", __func__, rq->cmd[0], uptodate, | 254 | rq->cmd[0], uptodate, nsectors); |
257 | nsectors); | ||
258 | 255 | ||
259 | if (blk_sense_request(rq) && uptodate) { | 256 | if (blk_sense_request(rq) && uptodate) { |
260 | /* | 257 | /* |
@@ -275,8 +272,8 @@ static void cdrom_end_request(ide_drive_t *drive, int uptodate) | |||
275 | * now end the failed request | 272 | * now end the failed request |
276 | */ | 273 | */ |
277 | if (blk_fs_request(failed)) { | 274 | if (blk_fs_request(failed)) { |
278 | if (ide_end_dequeued_request(drive, failed, 0, | 275 | if (ide_end_rq(drive, failed, -EIO, |
279 | failed->hard_nr_sectors)) | 276 | failed->hard_nr_sectors << 9)) |
280 | BUG(); | 277 | BUG(); |
281 | } else { | 278 | } else { |
282 | if (blk_end_request(failed, -EIO, | 279 | if (blk_end_request(failed, -EIO, |
@@ -295,10 +292,13 @@ static void cdrom_end_request(ide_drive_t *drive, int uptodate) | |||
295 | if (!nsectors) | 292 | if (!nsectors) |
296 | nsectors = 1; | 293 | nsectors = 1; |
297 | 294 | ||
298 | ide_debug_log(IDE_DBG_FUNC, "Exit %s, uptodate: 0x%x, nsectors: %d\n", | 295 | ide_debug_log(IDE_DBG_FUNC, "uptodate: 0x%x, nsectors: %d", |
299 | __func__, uptodate, nsectors); | 296 | uptodate, nsectors); |
300 | 297 | ||
301 | ide_end_request(drive, uptodate, nsectors); | 298 | if (blk_fs_request(rq) == 0 && uptodate <= 0 && rq->errors == 0) |
299 | rq->errors = -EIO; | ||
300 | |||
301 | ide_complete_rq(drive, uptodate ? 0 : -EIO, nsectors << 9); | ||
302 | } | 302 | } |
303 | 303 | ||
304 | static void ide_dump_status_no_sense(ide_drive_t *drive, const char *msg, u8 st) | 304 | static void ide_dump_status_no_sense(ide_drive_t *drive, const char *msg, u8 st) |
@@ -338,9 +338,10 @@ static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret) | |||
338 | return 1; | 338 | return 1; |
339 | } | 339 | } |
340 | 340 | ||
341 | ide_debug_log(IDE_DBG_RQ, "%s: stat: 0x%x, good_stat: 0x%x, " | 341 | ide_debug_log(IDE_DBG_RQ, "stat: 0x%x, good_stat: 0x%x, cmd[0]: 0x%x, " |
342 | "rq->cmd[0]: 0x%x, rq->cmd_type: 0x%x, err: 0x%x\n", | 342 | "rq->cmd_type: 0x%x, err: 0x%x", |
343 | __func__, stat, good_stat, rq->cmd[0], rq->cmd_type, err); | 343 | stat, good_stat, rq->cmd[0], rq->cmd_type, |
344 | err); | ||
344 | 345 | ||
345 | if (blk_sense_request(rq)) { | 346 | if (blk_sense_request(rq)) { |
346 | /* | 347 | /* |
@@ -530,8 +531,7 @@ static int ide_cd_check_ireason(ide_drive_t *drive, struct request *rq, | |||
530 | { | 531 | { |
531 | ide_hwif_t *hwif = drive->hwif; | 532 | ide_hwif_t *hwif = drive->hwif; |
532 | 533 | ||
533 | ide_debug_log(IDE_DBG_FUNC, "Call %s, ireason: 0x%x, rw: 0x%x\n", | 534 | ide_debug_log(IDE_DBG_FUNC, "ireason: 0x%x, rw: 0x%x", ireason, rw); |
534 | __func__, ireason, rw); | ||
535 | 535 | ||
536 | /* | 536 | /* |
537 | * ireason == 0: the drive wants to receive data from us | 537 | * ireason == 0: the drive wants to receive data from us |
@@ -572,7 +572,7 @@ static int ide_cd_check_ireason(ide_drive_t *drive, struct request *rq, | |||
572 | */ | 572 | */ |
573 | static int ide_cd_check_transfer_size(ide_drive_t *drive, int len) | 573 | static int ide_cd_check_transfer_size(ide_drive_t *drive, int len) |
574 | { | 574 | { |
575 | ide_debug_log(IDE_DBG_FUNC, "Call %s, len: %d\n", __func__, len); | 575 | ide_debug_log(IDE_DBG_FUNC, "len: %d", len); |
576 | 576 | ||
577 | if ((len % SECTOR_SIZE) == 0) | 577 | if ((len % SECTOR_SIZE) == 0) |
578 | return 0; | 578 | return 0; |
@@ -594,8 +594,7 @@ static int ide_cd_check_transfer_size(ide_drive_t *drive, int len) | |||
594 | static ide_startstop_t ide_cd_prepare_rw_request(ide_drive_t *drive, | 594 | static ide_startstop_t ide_cd_prepare_rw_request(ide_drive_t *drive, |
595 | struct request *rq) | 595 | struct request *rq) |
596 | { | 596 | { |
597 | ide_debug_log(IDE_DBG_RQ, "Call %s: rq->cmd_flags: 0x%x\n", __func__, | 597 | ide_debug_log(IDE_DBG_RQ, "rq->cmd_flags: 0x%x", rq->cmd_flags); |
598 | rq->cmd_flags); | ||
599 | 598 | ||
600 | if (rq_data_dir(rq) == READ) { | 599 | if (rq_data_dir(rq) == READ) { |
601 | unsigned short sectors_per_frame = | 600 | unsigned short sectors_per_frame = |
@@ -639,7 +638,7 @@ static ide_startstop_t ide_cd_prepare_rw_request(ide_drive_t *drive, | |||
639 | static void ide_cd_restore_request(ide_drive_t *drive, struct request *rq) | 638 | static void ide_cd_restore_request(ide_drive_t *drive, struct request *rq) |
640 | { | 639 | { |
641 | 640 | ||
642 | ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__); | 641 | ide_debug_log(IDE_DBG_FUNC, "enter"); |
643 | 642 | ||
644 | if (rq->buffer != bio_data(rq->bio)) { | 643 | if (rq->buffer != bio_data(rq->bio)) { |
645 | sector_t n = | 644 | sector_t n = |
@@ -658,8 +657,7 @@ static void ide_cd_restore_request(ide_drive_t *drive, struct request *rq) | |||
658 | 657 | ||
659 | static void ide_cd_request_sense_fixup(ide_drive_t *drive, struct request *rq) | 658 | static void ide_cd_request_sense_fixup(ide_drive_t *drive, struct request *rq) |
660 | { | 659 | { |
661 | ide_debug_log(IDE_DBG_FUNC, "Call %s, rq->cmd[0]: 0x%x\n", | 660 | ide_debug_log(IDE_DBG_FUNC, "rq->cmd[0]: 0x%x", rq->cmd[0]); |
662 | __func__, rq->cmd[0]); | ||
663 | 661 | ||
664 | /* | 662 | /* |
665 | * Some of the trailing request sense fields are optional, | 663 | * Some of the trailing request sense fields are optional, |
@@ -686,9 +684,9 @@ int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd, | |||
686 | if (!sense) | 684 | if (!sense) |
687 | sense = &local_sense; | 685 | sense = &local_sense; |
688 | 686 | ||
689 | ide_debug_log(IDE_DBG_PC, "Call %s, cmd[0]: 0x%x, write: 0x%x, " | 687 | ide_debug_log(IDE_DBG_PC, "cmd[0]: 0x%x, write: 0x%x, timeout: %d, " |
690 | "timeout: %d, cmd_flags: 0x%x\n", __func__, cmd[0], write, | 688 | "cmd_flags: 0x%x", |
691 | timeout, cmd_flags); | 689 | cmd[0], write, timeout, cmd_flags); |
692 | 690 | ||
693 | /* start of retry loop */ | 691 | /* start of retry loop */ |
694 | do { | 692 | do { |
@@ -772,8 +770,8 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
772 | u16 len; | 770 | u16 len; |
773 | u8 ireason; | 771 | u8 ireason; |
774 | 772 | ||
775 | ide_debug_log(IDE_DBG_PC, "Call %s, rq->cmd[0]: 0x%x, write: 0x%x\n", | 773 | ide_debug_log(IDE_DBG_PC, "cmd[0]: 0x%x, write: 0x%x", |
776 | __func__, rq->cmd[0], write); | 774 | rq->cmd[0], write); |
777 | 775 | ||
778 | /* check for errors */ | 776 | /* check for errors */ |
779 | dma = drive->dma; | 777 | dma = drive->dma; |
@@ -795,10 +793,11 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
795 | if (dma_error) | 793 | if (dma_error) |
796 | return ide_error(drive, "dma error", stat); | 794 | return ide_error(drive, "dma error", stat); |
797 | if (blk_fs_request(rq)) { | 795 | if (blk_fs_request(rq)) { |
798 | ide_end_request(drive, 1, rq->nr_sectors); | 796 | ide_complete_rq(drive, 0, rq->nr_sectors |
797 | ? (rq->nr_sectors << 9) : ide_rq_bytes(rq)); | ||
799 | return ide_stopped; | 798 | return ide_stopped; |
800 | } else if (rq->cmd_type == REQ_TYPE_ATA_PC && !rq->bio) { | 799 | } else if (rq->cmd_type == REQ_TYPE_ATA_PC && !rq->bio) { |
801 | ide_end_request(drive, 1, 1); | 800 | ide_complete_rq(drive, 0, 512); |
802 | return ide_stopped; | 801 | return ide_stopped; |
803 | } | 802 | } |
804 | goto end_request; | 803 | goto end_request; |
@@ -810,8 +809,8 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
810 | if (thislen > len) | 809 | if (thislen > len) |
811 | thislen = len; | 810 | thislen = len; |
812 | 811 | ||
813 | ide_debug_log(IDE_DBG_PC, "%s: DRQ: stat: 0x%x, thislen: %d\n", | 812 | ide_debug_log(IDE_DBG_PC, "DRQ: stat: 0x%x, thislen: %d", |
814 | __func__, stat, thislen); | 813 | stat, thislen); |
815 | 814 | ||
816 | /* If DRQ is clear, the command has completed. */ | 815 | /* If DRQ is clear, the command has completed. */ |
817 | if ((stat & ATA_DRQ) == 0) { | 816 | if ((stat & ATA_DRQ) == 0) { |
@@ -876,8 +875,9 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
876 | xferfunc = hwif->tp_ops->input_data; | 875 | xferfunc = hwif->tp_ops->input_data; |
877 | } | 876 | } |
878 | 877 | ||
879 | ide_debug_log(IDE_DBG_PC, "%s: data transfer, rq->cmd_type: 0x%x, " | 878 | ide_debug_log(IDE_DBG_PC, "data transfer, rq->cmd_type: 0x%x, " |
880 | "ireason: 0x%x\n", __func__, rq->cmd_type, ireason); | 879 | "ireason: 0x%x", |
880 | rq->cmd_type, ireason); | ||
881 | 881 | ||
882 | /* transfer data */ | 882 | /* transfer data */ |
883 | while (thislen > 0) { | 883 | while (thislen > 0) { |
@@ -959,7 +959,8 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
959 | expiry = ide_cd_expiry; | 959 | expiry = ide_cd_expiry; |
960 | } | 960 | } |
961 | 961 | ||
962 | ide_set_handler(drive, cdrom_newpc_intr, timeout, expiry); | 962 | hwif->expiry = expiry; |
963 | ide_set_handler(drive, cdrom_newpc_intr, timeout); | ||
963 | return ide_started; | 964 | return ide_started; |
964 | 965 | ||
965 | end_request: | 966 | end_request: |
@@ -988,9 +989,9 @@ static ide_startstop_t cdrom_start_rw(ide_drive_t *drive, struct request *rq) | |||
988 | unsigned short sectors_per_frame = | 989 | unsigned short sectors_per_frame = |
989 | queue_hardsect_size(drive->queue) >> SECTOR_BITS; | 990 | queue_hardsect_size(drive->queue) >> SECTOR_BITS; |
990 | 991 | ||
991 | ide_debug_log(IDE_DBG_RQ, "Call %s, rq->cmd[0]: 0x%x, write: 0x%x, " | 992 | ide_debug_log(IDE_DBG_RQ, "rq->cmd[0]: 0x%x, write: 0x%x, " |
992 | "secs_per_frame: %u\n", | 993 | "secs_per_frame: %u", |
993 | __func__, rq->cmd[0], write, sectors_per_frame); | 994 | rq->cmd[0], write, sectors_per_frame); |
994 | 995 | ||
995 | if (write) { | 996 | if (write) { |
996 | /* disk has become write protected */ | 997 | /* disk has become write protected */ |
@@ -1026,9 +1027,8 @@ static ide_startstop_t cdrom_start_rw(ide_drive_t *drive, struct request *rq) | |||
1026 | static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq) | 1027 | static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq) |
1027 | { | 1028 | { |
1028 | 1029 | ||
1029 | ide_debug_log(IDE_DBG_PC, "Call %s, rq->cmd[0]: 0x%x, " | 1030 | ide_debug_log(IDE_DBG_PC, "rq->cmd[0]: 0x%x, rq->cmd_type: 0x%x", |
1030 | "rq->cmd_type: 0x%x\n", __func__, rq->cmd[0], | 1031 | rq->cmd[0], rq->cmd_type); |
1031 | rq->cmd_type); | ||
1032 | 1032 | ||
1033 | if (blk_pc_request(rq)) | 1033 | if (blk_pc_request(rq)) |
1034 | rq->cmd_flags |= REQ_QUIET; | 1034 | rq->cmd_flags |= REQ_QUIET; |
@@ -1067,10 +1067,13 @@ static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq) | |||
1067 | static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, | 1067 | static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, |
1068 | sector_t block) | 1068 | sector_t block) |
1069 | { | 1069 | { |
1070 | ide_debug_log(IDE_DBG_RQ, "Call %s, rq->cmd[0]: 0x%x, " | 1070 | struct ide_cmd cmd; |
1071 | "rq->cmd_type: 0x%x, block: %llu\n", | 1071 | |
1072 | __func__, rq->cmd[0], rq->cmd_type, | 1072 | ide_debug_log(IDE_DBG_RQ, "cmd: 0x%x, block: %llu", |
1073 | (unsigned long long)block); | 1073 | rq->cmd[0], (unsigned long long)block); |
1074 | |||
1075 | if (drive->debug_mask & IDE_DBG_RQ) | ||
1076 | blk_dump_rq_flags(rq, "ide_cd_do_request"); | ||
1074 | 1077 | ||
1075 | if (blk_fs_request(rq)) { | 1078 | if (blk_fs_request(rq)) { |
1076 | if (cdrom_start_rw(drive, rq) == ide_stopped) | 1079 | if (cdrom_start_rw(drive, rq) == ide_stopped) |
@@ -1094,7 +1097,14 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, | |||
1094 | return ide_stopped; | 1097 | return ide_stopped; |
1095 | } | 1098 | } |
1096 | 1099 | ||
1097 | return ide_issue_pc(drive); | 1100 | memset(&cmd, 0, sizeof(cmd)); |
1101 | |||
1102 | if (rq_data_dir(rq)) | ||
1103 | cmd.tf_flags |= IDE_TFLAG_WRITE; | ||
1104 | |||
1105 | cmd.rq = rq; | ||
1106 | |||
1107 | return ide_issue_pc(drive, &cmd); | ||
1098 | } | 1108 | } |
1099 | 1109 | ||
1100 | /* | 1110 | /* |
@@ -1119,7 +1129,7 @@ int cdrom_check_status(ide_drive_t *drive, struct request_sense *sense) | |||
1119 | struct cdrom_device_info *cdi = &info->devinfo; | 1129 | struct cdrom_device_info *cdi = &info->devinfo; |
1120 | unsigned char cmd[BLK_MAX_CDB]; | 1130 | unsigned char cmd[BLK_MAX_CDB]; |
1121 | 1131 | ||
1122 | ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__); | 1132 | ide_debug_log(IDE_DBG_FUNC, "enter"); |
1123 | 1133 | ||
1124 | memset(cmd, 0, BLK_MAX_CDB); | 1134 | memset(cmd, 0, BLK_MAX_CDB); |
1125 | cmd[0] = GPCMD_TEST_UNIT_READY; | 1135 | cmd[0] = GPCMD_TEST_UNIT_READY; |
@@ -1147,7 +1157,7 @@ static int cdrom_read_capacity(ide_drive_t *drive, unsigned long *capacity, | |||
1147 | unsigned len = sizeof(capbuf); | 1157 | unsigned len = sizeof(capbuf); |
1148 | u32 blocklen; | 1158 | u32 blocklen; |
1149 | 1159 | ||
1150 | ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__); | 1160 | ide_debug_log(IDE_DBG_FUNC, "enter"); |
1151 | 1161 | ||
1152 | memset(cmd, 0, BLK_MAX_CDB); | 1162 | memset(cmd, 0, BLK_MAX_CDB); |
1153 | cmd[0] = GPCMD_READ_CDVD_CAPACITY; | 1163 | cmd[0] = GPCMD_READ_CDVD_CAPACITY; |
@@ -1179,8 +1189,8 @@ static int cdrom_read_capacity(ide_drive_t *drive, unsigned long *capacity, | |||
1179 | *capacity = 1 + be32_to_cpu(capbuf.lba); | 1189 | *capacity = 1 + be32_to_cpu(capbuf.lba); |
1180 | *sectors_per_frame = blocklen >> SECTOR_BITS; | 1190 | *sectors_per_frame = blocklen >> SECTOR_BITS; |
1181 | 1191 | ||
1182 | ide_debug_log(IDE_DBG_PROBE, "%s: cap: %lu, sectors_per_frame: %lu\n", | 1192 | ide_debug_log(IDE_DBG_PROBE, "cap: %lu, sectors_per_frame: %lu", |
1183 | __func__, *capacity, *sectors_per_frame); | 1193 | *capacity, *sectors_per_frame); |
1184 | 1194 | ||
1185 | return 0; | 1195 | return 0; |
1186 | } | 1196 | } |
@@ -1191,7 +1201,7 @@ static int cdrom_read_tocentry(ide_drive_t *drive, int trackno, int msf_flag, | |||
1191 | { | 1201 | { |
1192 | unsigned char cmd[BLK_MAX_CDB]; | 1202 | unsigned char cmd[BLK_MAX_CDB]; |
1193 | 1203 | ||
1194 | ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__); | 1204 | ide_debug_log(IDE_DBG_FUNC, "enter"); |
1195 | 1205 | ||
1196 | memset(cmd, 0, BLK_MAX_CDB); | 1206 | memset(cmd, 0, BLK_MAX_CDB); |
1197 | 1207 | ||
@@ -1221,7 +1231,7 @@ int ide_cd_read_toc(ide_drive_t *drive, struct request_sense *sense) | |||
1221 | long last_written; | 1231 | long last_written; |
1222 | unsigned long sectors_per_frame = SECTORS_PER_FRAME; | 1232 | unsigned long sectors_per_frame = SECTORS_PER_FRAME; |
1223 | 1233 | ||
1224 | ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__); | 1234 | ide_debug_log(IDE_DBG_FUNC, "enter"); |
1225 | 1235 | ||
1226 | if (toc == NULL) { | 1236 | if (toc == NULL) { |
1227 | /* try to allocate space */ | 1237 | /* try to allocate space */ |
@@ -1383,7 +1393,7 @@ int ide_cdrom_get_capabilities(ide_drive_t *drive, u8 *buf) | |||
1383 | struct packet_command cgc; | 1393 | struct packet_command cgc; |
1384 | int stat, attempts = 3, size = ATAPI_CAPABILITIES_PAGE_SIZE; | 1394 | int stat, attempts = 3, size = ATAPI_CAPABILITIES_PAGE_SIZE; |
1385 | 1395 | ||
1386 | ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__); | 1396 | ide_debug_log(IDE_DBG_FUNC, "enter"); |
1387 | 1397 | ||
1388 | if ((drive->atapi_flags & IDE_AFLAG_FULL_CAPS_PAGE) == 0) | 1398 | if ((drive->atapi_flags & IDE_AFLAG_FULL_CAPS_PAGE) == 0) |
1389 | size -= ATAPI_CAPABILITIES_PAGE_PAD_SIZE; | 1399 | size -= ATAPI_CAPABILITIES_PAGE_PAD_SIZE; |
@@ -1403,7 +1413,7 @@ void ide_cdrom_update_speed(ide_drive_t *drive, u8 *buf) | |||
1403 | struct cdrom_info *cd = drive->driver_data; | 1413 | struct cdrom_info *cd = drive->driver_data; |
1404 | u16 curspeed, maxspeed; | 1414 | u16 curspeed, maxspeed; |
1405 | 1415 | ||
1406 | ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__); | 1416 | ide_debug_log(IDE_DBG_FUNC, "enter"); |
1407 | 1417 | ||
1408 | if (drive->atapi_flags & IDE_AFLAG_LE_SPEED_FIELDS) { | 1418 | if (drive->atapi_flags & IDE_AFLAG_LE_SPEED_FIELDS) { |
1409 | curspeed = le16_to_cpup((__le16 *)&buf[8 + 14]); | 1419 | curspeed = le16_to_cpup((__le16 *)&buf[8 + 14]); |
@@ -1413,8 +1423,8 @@ void ide_cdrom_update_speed(ide_drive_t *drive, u8 *buf) | |||
1413 | maxspeed = be16_to_cpup((__be16 *)&buf[8 + 8]); | 1423 | maxspeed = be16_to_cpup((__be16 *)&buf[8 + 8]); |
1414 | } | 1424 | } |
1415 | 1425 | ||
1416 | ide_debug_log(IDE_DBG_PROBE, "%s: curspeed: %u, maxspeed: %u\n", | 1426 | ide_debug_log(IDE_DBG_PROBE, "curspeed: %u, maxspeed: %u", |
1417 | __func__, curspeed, maxspeed); | 1427 | curspeed, maxspeed); |
1418 | 1428 | ||
1419 | cd->current_speed = (curspeed + (176/2)) / 176; | 1429 | cd->current_speed = (curspeed + (176/2)) / 176; |
1420 | cd->max_speed = (maxspeed + (176/2)) / 176; | 1430 | cd->max_speed = (maxspeed + (176/2)) / 176; |
@@ -1448,7 +1458,7 @@ static int ide_cdrom_register(ide_drive_t *drive, int nslots) | |||
1448 | struct cdrom_info *info = drive->driver_data; | 1458 | struct cdrom_info *info = drive->driver_data; |
1449 | struct cdrom_device_info *devinfo = &info->devinfo; | 1459 | struct cdrom_device_info *devinfo = &info->devinfo; |
1450 | 1460 | ||
1451 | ide_debug_log(IDE_DBG_PROBE, "Call %s, nslots: %d\n", __func__, nslots); | 1461 | ide_debug_log(IDE_DBG_PROBE, "nslots: %d", nslots); |
1452 | 1462 | ||
1453 | devinfo->ops = &ide_cdrom_dops; | 1463 | devinfo->ops = &ide_cdrom_dops; |
1454 | devinfo->speed = info->current_speed; | 1464 | devinfo->speed = info->current_speed; |
@@ -1471,9 +1481,8 @@ static int ide_cdrom_probe_capabilities(ide_drive_t *drive) | |||
1471 | mechtype_t mechtype; | 1481 | mechtype_t mechtype; |
1472 | int nslots = 1; | 1482 | int nslots = 1; |
1473 | 1483 | ||
1474 | ide_debug_log(IDE_DBG_PROBE, "Call %s, drive->media: 0x%x, " | 1484 | ide_debug_log(IDE_DBG_PROBE, "media: 0x%x, atapi_flags: 0x%lx", |
1475 | "drive->atapi_flags: 0x%lx\n", __func__, drive->media, | 1485 | drive->media, drive->atapi_flags); |
1476 | drive->atapi_flags); | ||
1477 | 1486 | ||
1478 | cdi->mask = (CDC_CD_R | CDC_CD_RW | CDC_DVD | CDC_DVD_R | | 1487 | cdi->mask = (CDC_CD_R | CDC_CD_RW | CDC_DVD | CDC_DVD_R | |
1479 | CDC_DVD_RAM | CDC_SELECT_DISC | CDC_PLAY_AUDIO | | 1488 | CDC_DVD_RAM | CDC_SELECT_DISC | CDC_PLAY_AUDIO | |
@@ -1754,7 +1763,7 @@ static int ide_cdrom_setup(ide_drive_t *drive) | |||
1754 | char *fw_rev = (char *)&id[ATA_ID_FW_REV]; | 1763 | char *fw_rev = (char *)&id[ATA_ID_FW_REV]; |
1755 | int nslots; | 1764 | int nslots; |
1756 | 1765 | ||
1757 | ide_debug_log(IDE_DBG_PROBE, "Call %s\n", __func__); | 1766 | ide_debug_log(IDE_DBG_PROBE, "enter"); |
1758 | 1767 | ||
1759 | blk_queue_prep_rq(drive->queue, ide_cdrom_prep_fn); | 1768 | blk_queue_prep_rq(drive->queue, ide_cdrom_prep_fn); |
1760 | blk_queue_dma_alignment(drive->queue, 31); | 1769 | blk_queue_dma_alignment(drive->queue, 31); |
@@ -1797,7 +1806,7 @@ static void ide_cd_remove(ide_drive_t *drive) | |||
1797 | { | 1806 | { |
1798 | struct cdrom_info *info = drive->driver_data; | 1807 | struct cdrom_info *info = drive->driver_data; |
1799 | 1808 | ||
1800 | ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__); | 1809 | ide_debug_log(IDE_DBG_FUNC, "enter"); |
1801 | 1810 | ||
1802 | ide_proc_unregister_driver(drive, info->driver); | 1811 | ide_proc_unregister_driver(drive, info->driver); |
1803 | device_del(&info->dev); | 1812 | device_del(&info->dev); |
@@ -1815,7 +1824,7 @@ static void ide_cd_release(struct device *dev) | |||
1815 | ide_drive_t *drive = info->drive; | 1824 | ide_drive_t *drive = info->drive; |
1816 | struct gendisk *g = info->disk; | 1825 | struct gendisk *g = info->disk; |
1817 | 1826 | ||
1818 | ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__); | 1827 | ide_debug_log(IDE_DBG_FUNC, "enter"); |
1819 | 1828 | ||
1820 | kfree(info->toc); | 1829 | kfree(info->toc); |
1821 | if (devinfo->handle == drive) | 1830 | if (devinfo->handle == drive) |
@@ -1839,7 +1848,6 @@ static struct ide_driver ide_cdrom_driver = { | |||
1839 | .remove = ide_cd_remove, | 1848 | .remove = ide_cd_remove, |
1840 | .version = IDECD_VERSION, | 1849 | .version = IDECD_VERSION, |
1841 | .do_request = ide_cd_do_request, | 1850 | .do_request = ide_cd_do_request, |
1842 | .end_request = ide_end_request, | ||
1843 | #ifdef CONFIG_IDE_PROC_FS | 1851 | #ifdef CONFIG_IDE_PROC_FS |
1844 | .proc_entries = ide_cd_proc_entries, | 1852 | .proc_entries = ide_cd_proc_entries, |
1845 | .proc_devsets = ide_cd_proc_devsets, | 1853 | .proc_devsets = ide_cd_proc_devsets, |
@@ -1974,9 +1982,8 @@ static int ide_cd_probe(ide_drive_t *drive) | |||
1974 | struct gendisk *g; | 1982 | struct gendisk *g; |
1975 | struct request_sense sense; | 1983 | struct request_sense sense; |
1976 | 1984 | ||
1977 | ide_debug_log(IDE_DBG_PROBE, "Call %s, drive->driver_req: %s, " | 1985 | ide_debug_log(IDE_DBG_PROBE, "driver_req: %s, media: 0x%x", |
1978 | "drive->media: 0x%x\n", __func__, drive->driver_req, | 1986 | drive->driver_req, drive->media); |
1979 | drive->media); | ||
1980 | 1987 | ||
1981 | if (!strstr("ide-cdrom", drive->driver_req)) | 1988 | if (!strstr("ide-cdrom", drive->driver_req)) |
1982 | goto failed; | 1989 | goto failed; |
diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h index c878bfcf1116..1d97101099ce 100644 --- a/drivers/ide/ide-cd.h +++ b/drivers/ide/ide-cd.h | |||
@@ -11,7 +11,7 @@ | |||
11 | #define IDECD_DEBUG_LOG 0 | 11 | #define IDECD_DEBUG_LOG 0 |
12 | 12 | ||
13 | #if IDECD_DEBUG_LOG | 13 | #if IDECD_DEBUG_LOG |
14 | #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, args) | 14 | #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) |
15 | #else | 15 | #else |
16 | #define ide_debug_log(lvl, fmt, args...) do {} while (0) | 16 | #define ide_debug_log(lvl, fmt, args...) do {} while (0) |
17 | #endif | 17 | #endif |
@@ -91,8 +91,6 @@ struct cdrom_info { | |||
91 | on this device. */ | 91 | on this device. */ |
92 | struct request_sense sense_data; | 92 | struct request_sense sense_data; |
93 | 93 | ||
94 | struct request request_sense_request; | ||
95 | |||
96 | u8 max_speed; /* Max speed of the drive. */ | 94 | u8 max_speed; /* Max speed of the drive. */ |
97 | u8 current_speed; /* Current speed of the drive. */ | 95 | u8 current_speed; /* Current speed of the drive. */ |
98 | 96 | ||
diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c index f50210fe558f..9e47f3529d55 100644 --- a/drivers/ide/ide-cs.c +++ b/drivers/ide/ide-cs.c | |||
@@ -154,6 +154,7 @@ static const struct ide_port_ops idecs_port_ops = { | |||
154 | static const struct ide_port_info idecs_port_info = { | 154 | static const struct ide_port_info idecs_port_info = { |
155 | .port_ops = &idecs_port_ops, | 155 | .port_ops = &idecs_port_ops, |
156 | .host_flags = IDE_HFLAG_NO_DMA, | 156 | .host_flags = IDE_HFLAG_NO_DMA, |
157 | .irq_flags = IRQF_SHARED, | ||
157 | }; | 158 | }; |
158 | 159 | ||
159 | static struct ide_host *idecs_register(unsigned long io, unsigned long ctl, | 160 | static struct ide_host *idecs_register(unsigned long io, unsigned long ctl, |
diff --git a/drivers/ide/ide-devsets.c b/drivers/ide/ide-devsets.c index 7c3953414d47..5bf958e5b1d5 100644 --- a/drivers/ide/ide-devsets.c +++ b/drivers/ide/ide-devsets.c | |||
@@ -183,8 +183,6 @@ ide_startstop_t ide_do_devset(ide_drive_t *drive, struct request *rq) | |||
183 | err = setfunc(drive, *(int *)&rq->cmd[1]); | 183 | err = setfunc(drive, *(int *)&rq->cmd[1]); |
184 | if (err) | 184 | if (err) |
185 | rq->errors = err; | 185 | rq->errors = err; |
186 | else | 186 | ide_complete_rq(drive, err, ide_rq_bytes(rq)); |
187 | err = 1; | ||
188 | ide_end_request(drive, err, 0); | ||
189 | return ide_stopped; | 187 | return ide_stopped; |
190 | } | 188 | } |
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 806760d24cef..ca934c8a1289 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <linux/mutex.h> | 28 | #include <linux/mutex.h> |
29 | #include <linux/leds.h> | 29 | #include <linux/leds.h> |
30 | #include <linux/ide.h> | 30 | #include <linux/ide.h> |
31 | #include <linux/hdreg.h> | ||
32 | 31 | ||
33 | #include <asm/byteorder.h> | 32 | #include <asm/byteorder.h> |
34 | #include <asm/irq.h> | 33 | #include <asm/irq.h> |
@@ -53,33 +52,26 @@ static const u8 ide_rw_cmds[] = { | |||
53 | ATA_CMD_WRITE_EXT, | 52 | ATA_CMD_WRITE_EXT, |
54 | }; | 53 | }; |
55 | 54 | ||
56 | static const u8 ide_data_phases[] = { | 55 | static void ide_tf_set_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 dma) |
57 | TASKFILE_MULTI_IN, | ||
58 | TASKFILE_MULTI_OUT, | ||
59 | TASKFILE_IN, | ||
60 | TASKFILE_OUT, | ||
61 | TASKFILE_IN_DMA, | ||
62 | TASKFILE_OUT_DMA, | ||
63 | }; | ||
64 | |||
65 | static void ide_tf_set_cmd(ide_drive_t *drive, ide_task_t *task, u8 dma) | ||
66 | { | 56 | { |
67 | u8 index, lba48, write; | 57 | u8 index, lba48, write; |
68 | 58 | ||
69 | lba48 = (task->tf_flags & IDE_TFLAG_LBA48) ? 2 : 0; | 59 | lba48 = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 2 : 0; |
70 | write = (task->tf_flags & IDE_TFLAG_WRITE) ? 1 : 0; | 60 | write = (cmd->tf_flags & IDE_TFLAG_WRITE) ? 1 : 0; |
71 | 61 | ||
72 | if (dma) | 62 | if (dma) { |
63 | cmd->protocol = ATA_PROT_DMA; | ||
73 | index = 8; | 64 | index = 8; |
74 | else | 65 | } else { |
75 | index = drive->mult_count ? 0 : 4; | 66 | cmd->protocol = ATA_PROT_PIO; |
76 | 67 | if (drive->mult_count) { | |
77 | task->tf.command = ide_rw_cmds[index + lba48 + write]; | 68 | cmd->tf_flags |= IDE_TFLAG_MULTI_PIO; |
78 | 69 | index = 0; | |
79 | if (dma) | 70 | } else |
80 | index = 8; /* fixup index */ | 71 | index = 4; |
72 | } | ||
81 | 73 | ||
82 | task->data_phase = ide_data_phases[index / 2 + write]; | 74 | cmd->tf.command = ide_rw_cmds[index + lba48 + write]; |
83 | } | 75 | } |
84 | 76 | ||
85 | /* | 77 | /* |
@@ -93,8 +85,8 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, | |||
93 | u16 nsectors = (u16)rq->nr_sectors; | 85 | u16 nsectors = (u16)rq->nr_sectors; |
94 | u8 lba48 = !!(drive->dev_flags & IDE_DFLAG_LBA48); | 86 | u8 lba48 = !!(drive->dev_flags & IDE_DFLAG_LBA48); |
95 | u8 dma = !!(drive->dev_flags & IDE_DFLAG_USING_DMA); | 87 | u8 dma = !!(drive->dev_flags & IDE_DFLAG_USING_DMA); |
96 | ide_task_t task; | 88 | struct ide_cmd cmd; |
97 | struct ide_taskfile *tf = &task.tf; | 89 | struct ide_taskfile *tf = &cmd.tf; |
98 | ide_startstop_t rc; | 90 | ide_startstop_t rc; |
99 | 91 | ||
100 | if ((hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA) && lba48 && dma) { | 92 | if ((hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA) && lba48 && dma) { |
@@ -104,13 +96,8 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, | |||
104 | lba48 = 0; | 96 | lba48 = 0; |
105 | } | 97 | } |
106 | 98 | ||
107 | if (!dma) { | 99 | memset(&cmd, 0, sizeof(cmd)); |
108 | ide_init_sg_cmd(drive, rq); | 100 | cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; |
109 | ide_map_sg(drive, rq); | ||
110 | } | ||
111 | |||
112 | memset(&task, 0, sizeof(task)); | ||
113 | task.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; | ||
114 | 101 | ||
115 | if (drive->dev_flags & IDE_DFLAG_LBA) { | 102 | if (drive->dev_flags & IDE_DFLAG_LBA) { |
116 | if (lba48) { | 103 | if (lba48) { |
@@ -129,7 +116,7 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, | |||
129 | tf->lbam = (u8)(block >> 8); | 116 | tf->lbam = (u8)(block >> 8); |
130 | tf->lbah = (u8)(block >> 16); | 117 | tf->lbah = (u8)(block >> 16); |
131 | 118 | ||
132 | task.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB); | 119 | cmd.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB); |
133 | } else { | 120 | } else { |
134 | tf->nsect = nsectors & 0xff; | 121 | tf->nsect = nsectors & 0xff; |
135 | tf->lbal = block; | 122 | tf->lbal = block; |
@@ -156,23 +143,27 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, | |||
156 | tf->device = head; | 143 | tf->device = head; |
157 | } | 144 | } |
158 | 145 | ||
146 | cmd.tf_flags |= IDE_TFLAG_FS; | ||
147 | |||
159 | if (rq_data_dir(rq)) | 148 | if (rq_data_dir(rq)) |
160 | task.tf_flags |= IDE_TFLAG_WRITE; | 149 | cmd.tf_flags |= IDE_TFLAG_WRITE; |
150 | |||
151 | ide_tf_set_cmd(drive, &cmd, dma); | ||
152 | cmd.rq = rq; | ||
161 | 153 | ||
162 | ide_tf_set_cmd(drive, &task, dma); | 154 | if (dma == 0) { |
163 | if (!dma) | 155 | ide_init_sg_cmd(&cmd, nsectors << 9); |
164 | hwif->data_phase = task.data_phase; | 156 | ide_map_sg(drive, &cmd); |
165 | task.rq = rq; | 157 | } |
166 | 158 | ||
167 | rc = do_rw_taskfile(drive, &task); | 159 | rc = do_rw_taskfile(drive, &cmd); |
168 | 160 | ||
169 | if (rc == ide_stopped && dma) { | 161 | if (rc == ide_stopped && dma) { |
170 | /* fallback to PIO */ | 162 | /* fallback to PIO */ |
171 | task.tf_flags |= IDE_TFLAG_DMA_PIO_FALLBACK; | 163 | cmd.tf_flags |= IDE_TFLAG_DMA_PIO_FALLBACK; |
172 | ide_tf_set_cmd(drive, &task, 0); | 164 | ide_tf_set_cmd(drive, &cmd, 0); |
173 | hwif->data_phase = task.data_phase; | 165 | ide_init_sg_cmd(&cmd, nsectors << 9); |
174 | ide_init_sg_cmd(drive, rq); | 166 | rc = do_rw_taskfile(drive, &cmd); |
175 | rc = do_rw_taskfile(drive, &task); | ||
176 | } | 167 | } |
177 | 168 | ||
178 | return rc; | 169 | return rc; |
@@ -193,7 +184,9 @@ static ide_startstop_t ide_do_rw_disk(ide_drive_t *drive, struct request *rq, | |||
193 | 184 | ||
194 | if (!blk_fs_request(rq)) { | 185 | if (!blk_fs_request(rq)) { |
195 | blk_dump_rq_flags(rq, "ide_do_rw_disk - bad command"); | 186 | blk_dump_rq_flags(rq, "ide_do_rw_disk - bad command"); |
196 | ide_end_request(drive, 0, 0); | 187 | if (rq->errors == 0) |
188 | rq->errors = -EIO; | ||
189 | ide_complete_rq(drive, -EIO, ide_rq_bytes(rq)); | ||
197 | return ide_stopped; | 190 | return ide_stopped; |
198 | } | 191 | } |
199 | 192 | ||
@@ -216,22 +209,22 @@ static ide_startstop_t ide_do_rw_disk(ide_drive_t *drive, struct request *rq, | |||
216 | */ | 209 | */ |
217 | static u64 idedisk_read_native_max_address(ide_drive_t *drive, int lba48) | 210 | static u64 idedisk_read_native_max_address(ide_drive_t *drive, int lba48) |
218 | { | 211 | { |
219 | ide_task_t args; | 212 | struct ide_cmd cmd; |
220 | struct ide_taskfile *tf = &args.tf; | 213 | struct ide_taskfile *tf = &cmd.tf; |
221 | u64 addr = 0; | 214 | u64 addr = 0; |
222 | 215 | ||
223 | /* Create IDE/ATA command request structure */ | 216 | memset(&cmd, 0, sizeof(cmd)); |
224 | memset(&args, 0, sizeof(ide_task_t)); | ||
225 | if (lba48) | 217 | if (lba48) |
226 | tf->command = ATA_CMD_READ_NATIVE_MAX_EXT; | 218 | tf->command = ATA_CMD_READ_NATIVE_MAX_EXT; |
227 | else | 219 | else |
228 | tf->command = ATA_CMD_READ_NATIVE_MAX; | 220 | tf->command = ATA_CMD_READ_NATIVE_MAX; |
229 | tf->device = ATA_LBA; | 221 | tf->device = ATA_LBA; |
230 | args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; | 222 | |
223 | cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; | ||
231 | if (lba48) | 224 | if (lba48) |
232 | args.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB); | 225 | cmd.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB); |
233 | /* submit command request */ | 226 | |
234 | ide_no_data_taskfile(drive, &args); | 227 | ide_no_data_taskfile(drive, &cmd); |
235 | 228 | ||
236 | /* if OK, compute maximum address value */ | 229 | /* if OK, compute maximum address value */ |
237 | if ((tf->status & 0x01) == 0) | 230 | if ((tf->status & 0x01) == 0) |
@@ -246,13 +239,13 @@ static u64 idedisk_read_native_max_address(ide_drive_t *drive, int lba48) | |||
246 | */ | 239 | */ |
247 | static u64 idedisk_set_max_address(ide_drive_t *drive, u64 addr_req, int lba48) | 240 | static u64 idedisk_set_max_address(ide_drive_t *drive, u64 addr_req, int lba48) |
248 | { | 241 | { |
249 | ide_task_t args; | 242 | struct ide_cmd cmd; |
250 | struct ide_taskfile *tf = &args.tf; | 243 | struct ide_taskfile *tf = &cmd.tf; |
251 | u64 addr_set = 0; | 244 | u64 addr_set = 0; |
252 | 245 | ||
253 | addr_req--; | 246 | addr_req--; |
254 | /* Create IDE/ATA command request structure */ | 247 | |
255 | memset(&args, 0, sizeof(ide_task_t)); | 248 | memset(&cmd, 0, sizeof(cmd)); |
256 | tf->lbal = (addr_req >> 0) & 0xff; | 249 | tf->lbal = (addr_req >> 0) & 0xff; |
257 | tf->lbam = (addr_req >>= 8) & 0xff; | 250 | tf->lbam = (addr_req >>= 8) & 0xff; |
258 | tf->lbah = (addr_req >>= 8) & 0xff; | 251 | tf->lbah = (addr_req >>= 8) & 0xff; |
@@ -266,11 +259,13 @@ static u64 idedisk_set_max_address(ide_drive_t *drive, u64 addr_req, int lba48) | |||
266 | tf->command = ATA_CMD_SET_MAX; | 259 | tf->command = ATA_CMD_SET_MAX; |
267 | } | 260 | } |
268 | tf->device |= ATA_LBA; | 261 | tf->device |= ATA_LBA; |
269 | args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; | 262 | |
263 | cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; | ||
270 | if (lba48) | 264 | if (lba48) |
271 | args.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB); | 265 | cmd.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB); |
272 | /* submit command request */ | 266 | |
273 | ide_no_data_taskfile(drive, &args); | 267 | ide_no_data_taskfile(drive, &cmd); |
268 | |||
274 | /* if OK, compute maximum address value */ | 269 | /* if OK, compute maximum address value */ |
275 | if ((tf->status & 0x01) == 0) | 270 | if ((tf->status & 0x01) == 0) |
276 | addr_set = ide_get_lba_addr(tf, lba48) + 1; | 271 | addr_set = ide_get_lba_addr(tf, lba48) + 1; |
@@ -389,24 +384,24 @@ static int ide_disk_get_capacity(ide_drive_t *drive) | |||
389 | static void idedisk_prepare_flush(struct request_queue *q, struct request *rq) | 384 | static void idedisk_prepare_flush(struct request_queue *q, struct request *rq) |
390 | { | 385 | { |
391 | ide_drive_t *drive = q->queuedata; | 386 | ide_drive_t *drive = q->queuedata; |
392 | ide_task_t *task = kmalloc(sizeof(*task), GFP_ATOMIC); | 387 | struct ide_cmd *cmd = kmalloc(sizeof(*cmd), GFP_ATOMIC); |
393 | 388 | ||
394 | /* FIXME: map struct ide_taskfile on rq->cmd[] */ | 389 | /* FIXME: map struct ide_taskfile on rq->cmd[] */ |
395 | BUG_ON(task == NULL); | 390 | BUG_ON(cmd == NULL); |
396 | 391 | ||
397 | memset(task, 0, sizeof(*task)); | 392 | memset(cmd, 0, sizeof(*cmd)); |
398 | if (ata_id_flush_ext_enabled(drive->id) && | 393 | if (ata_id_flush_ext_enabled(drive->id) && |
399 | (drive->capacity64 >= (1UL << 28))) | 394 | (drive->capacity64 >= (1UL << 28))) |
400 | task->tf.command = ATA_CMD_FLUSH_EXT; | 395 | cmd->tf.command = ATA_CMD_FLUSH_EXT; |
401 | else | 396 | else |
402 | task->tf.command = ATA_CMD_FLUSH; | 397 | cmd->tf.command = ATA_CMD_FLUSH; |
403 | task->tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE | | 398 | cmd->tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE | |
404 | IDE_TFLAG_DYN; | 399 | IDE_TFLAG_DYN; |
405 | task->data_phase = TASKFILE_NO_DATA; | 400 | cmd->protocol = ATA_PROT_NODATA; |
406 | 401 | ||
407 | rq->cmd_type = REQ_TYPE_ATA_TASKFILE; | 402 | rq->cmd_type = REQ_TYPE_ATA_TASKFILE; |
408 | rq->cmd_flags |= REQ_SOFTBARRIER; | 403 | rq->cmd_flags |= REQ_SOFTBARRIER; |
409 | rq->special = task; | 404 | rq->special = cmd; |
410 | } | 405 | } |
411 | 406 | ||
412 | ide_devset_get(multcount, mult_count); | 407 | ide_devset_get(multcount, mult_count); |
@@ -456,15 +451,15 @@ static int set_nowerr(ide_drive_t *drive, int arg) | |||
456 | 451 | ||
457 | static int ide_do_setfeature(ide_drive_t *drive, u8 feature, u8 nsect) | 452 | static int ide_do_setfeature(ide_drive_t *drive, u8 feature, u8 nsect) |
458 | { | 453 | { |
459 | ide_task_t task; | 454 | struct ide_cmd cmd; |
460 | 455 | ||
461 | memset(&task, 0, sizeof(task)); | 456 | memset(&cmd, 0, sizeof(cmd)); |
462 | task.tf.feature = feature; | 457 | cmd.tf.feature = feature; |
463 | task.tf.nsect = nsect; | 458 | cmd.tf.nsect = nsect; |
464 | task.tf.command = ATA_CMD_SET_FEATURES; | 459 | cmd.tf.command = ATA_CMD_SET_FEATURES; |
465 | task.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; | 460 | cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; |
466 | 461 | ||
467 | return ide_no_data_taskfile(drive, &task); | 462 | return ide_no_data_taskfile(drive, &cmd); |
468 | } | 463 | } |
469 | 464 | ||
470 | static void update_ordered(ide_drive_t *drive) | 465 | static void update_ordered(ide_drive_t *drive) |
@@ -531,15 +526,16 @@ static int set_wcache(ide_drive_t *drive, int arg) | |||
531 | 526 | ||
532 | static int do_idedisk_flushcache(ide_drive_t *drive) | 527 | static int do_idedisk_flushcache(ide_drive_t *drive) |
533 | { | 528 | { |
534 | ide_task_t args; | 529 | struct ide_cmd cmd; |
535 | 530 | ||
536 | memset(&args, 0, sizeof(ide_task_t)); | 531 | memset(&cmd, 0, sizeof(cmd)); |
537 | if (ata_id_flush_ext_enabled(drive->id)) | 532 | if (ata_id_flush_ext_enabled(drive->id)) |
538 | args.tf.command = ATA_CMD_FLUSH_EXT; | 533 | cmd.tf.command = ATA_CMD_FLUSH_EXT; |
539 | else | 534 | else |
540 | args.tf.command = ATA_CMD_FLUSH; | 535 | cmd.tf.command = ATA_CMD_FLUSH; |
541 | args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; | 536 | cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; |
542 | return ide_no_data_taskfile(drive, &args); | 537 | |
538 | return ide_no_data_taskfile(drive, &cmd); | ||
543 | } | 539 | } |
544 | 540 | ||
545 | ide_devset_get(acoustic, acoustic); | 541 | ide_devset_get(acoustic, acoustic); |
@@ -711,17 +707,17 @@ static int ide_disk_init_media(ide_drive_t *drive, struct gendisk *disk) | |||
711 | static int ide_disk_set_doorlock(ide_drive_t *drive, struct gendisk *disk, | 707 | static int ide_disk_set_doorlock(ide_drive_t *drive, struct gendisk *disk, |
712 | int on) | 708 | int on) |
713 | { | 709 | { |
714 | ide_task_t task; | 710 | struct ide_cmd cmd; |
715 | int ret; | 711 | int ret; |
716 | 712 | ||
717 | if ((drive->dev_flags & IDE_DFLAG_DOORLOCKING) == 0) | 713 | if ((drive->dev_flags & IDE_DFLAG_DOORLOCKING) == 0) |
718 | return 0; | 714 | return 0; |
719 | 715 | ||
720 | memset(&task, 0, sizeof(task)); | 716 | memset(&cmd, 0, sizeof(cmd)); |
721 | task.tf.command = on ? ATA_CMD_MEDIA_LOCK : ATA_CMD_MEDIA_UNLOCK; | 717 | cmd.tf.command = on ? ATA_CMD_MEDIA_LOCK : ATA_CMD_MEDIA_UNLOCK; |
722 | task.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; | 718 | cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; |
723 | 719 | ||
724 | ret = ide_no_data_taskfile(drive, &task); | 720 | ret = ide_no_data_taskfile(drive, &cmd); |
725 | 721 | ||
726 | if (ret) | 722 | if (ret) |
727 | drive->dev_flags &= ~IDE_DFLAG_DOORLOCKING; | 723 | drive->dev_flags &= ~IDE_DFLAG_DOORLOCKING; |
@@ -737,6 +733,5 @@ const struct ide_disk_ops ide_ata_disk_ops = { | |||
737 | .init_media = ide_disk_init_media, | 733 | .init_media = ide_disk_init_media, |
738 | .set_doorlock = ide_disk_set_doorlock, | 734 | .set_doorlock = ide_disk_set_doorlock, |
739 | .do_request = ide_do_rw_disk, | 735 | .do_request = ide_do_rw_disk, |
740 | .end_request = ide_end_request, | ||
741 | .ioctl = ide_disk_ioctl, | 736 | .ioctl = ide_disk_ioctl, |
742 | }; | 737 | }; |
diff --git a/drivers/ide/ide-disk_proc.c b/drivers/ide/ide-disk_proc.c index 1f86dcbd2b1c..eaea3bef2073 100644 --- a/drivers/ide/ide-disk_proc.c +++ b/drivers/ide/ide-disk_proc.c | |||
@@ -1,38 +1,38 @@ | |||
1 | #include <linux/kernel.h> | 1 | #include <linux/kernel.h> |
2 | #include <linux/ide.h> | 2 | #include <linux/ide.h> |
3 | #include <linux/hdreg.h> | ||
4 | 3 | ||
5 | #include "ide-disk.h" | 4 | #include "ide-disk.h" |
6 | 5 | ||
7 | static int smart_enable(ide_drive_t *drive) | 6 | static int smart_enable(ide_drive_t *drive) |
8 | { | 7 | { |
9 | ide_task_t args; | 8 | struct ide_cmd cmd; |
10 | struct ide_taskfile *tf = &args.tf; | 9 | struct ide_taskfile *tf = &cmd.tf; |
11 | 10 | ||
12 | memset(&args, 0, sizeof(ide_task_t)); | 11 | memset(&cmd, 0, sizeof(cmd)); |
13 | tf->feature = ATA_SMART_ENABLE; | 12 | tf->feature = ATA_SMART_ENABLE; |
14 | tf->lbam = ATA_SMART_LBAM_PASS; | 13 | tf->lbam = ATA_SMART_LBAM_PASS; |
15 | tf->lbah = ATA_SMART_LBAH_PASS; | 14 | tf->lbah = ATA_SMART_LBAH_PASS; |
16 | tf->command = ATA_CMD_SMART; | 15 | tf->command = ATA_CMD_SMART; |
17 | args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; | 16 | cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; |
18 | return ide_no_data_taskfile(drive, &args); | 17 | |
18 | return ide_no_data_taskfile(drive, &cmd); | ||
19 | } | 19 | } |
20 | 20 | ||
21 | static int get_smart_data(ide_drive_t *drive, u8 *buf, u8 sub_cmd) | 21 | static int get_smart_data(ide_drive_t *drive, u8 *buf, u8 sub_cmd) |
22 | { | 22 | { |
23 | ide_task_t args; | 23 | struct ide_cmd cmd; |
24 | struct ide_taskfile *tf = &args.tf; | 24 | struct ide_taskfile *tf = &cmd.tf; |
25 | 25 | ||
26 | memset(&args, 0, sizeof(ide_task_t)); | 26 | memset(&cmd, 0, sizeof(cmd)); |
27 | tf->feature = sub_cmd; | 27 | tf->feature = sub_cmd; |
28 | tf->nsect = 0x01; | 28 | tf->nsect = 0x01; |
29 | tf->lbam = ATA_SMART_LBAM_PASS; | 29 | tf->lbam = ATA_SMART_LBAM_PASS; |
30 | tf->lbah = ATA_SMART_LBAH_PASS; | 30 | tf->lbah = ATA_SMART_LBAH_PASS; |
31 | tf->command = ATA_CMD_SMART; | 31 | tf->command = ATA_CMD_SMART; |
32 | args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; | 32 | cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; |
33 | args.data_phase = TASKFILE_IN; | 33 | cmd.protocol = ATA_PROT_PIO; |
34 | (void) smart_enable(drive); | 34 | |
35 | return ide_raw_taskfile(drive, &args, buf, 1); | 35 | return ide_raw_taskfile(drive, &cmd, buf, 1); |
36 | } | 36 | } |
37 | 37 | ||
38 | static int proc_idedisk_read_cache | 38 | static int proc_idedisk_read_cache |
@@ -67,6 +67,8 @@ static int proc_idedisk_read_smart(char *page, char **start, off_t off, | |||
67 | ide_drive_t *drive = (ide_drive_t *)data; | 67 | ide_drive_t *drive = (ide_drive_t *)data; |
68 | int len = 0, i = 0; | 68 | int len = 0, i = 0; |
69 | 69 | ||
70 | (void)smart_enable(drive); | ||
71 | |||
70 | if (get_smart_data(drive, page, sub_cmd) == 0) { | 72 | if (get_smart_data(drive, page, sub_cmd) == 0) { |
71 | unsigned short *val = (unsigned short *) page; | 73 | unsigned short *val = (unsigned short *) page; |
72 | char *out = (char *)val + SECTOR_SIZE; | 74 | char *out = (char *)val + SECTOR_SIZE; |
diff --git a/drivers/ide/ide-dma-sff.c b/drivers/ide/ide-dma-sff.c index 123d393658af..75a9ea2e4c82 100644 --- a/drivers/ide/ide-dma-sff.c +++ b/drivers/ide/ide-dma-sff.c | |||
@@ -111,7 +111,7 @@ EXPORT_SYMBOL_GPL(ide_dma_host_set); | |||
111 | * May also be invoked from trm290.c | 111 | * May also be invoked from trm290.c |
112 | */ | 112 | */ |
113 | 113 | ||
114 | int ide_build_dmatable(ide_drive_t *drive, struct request *rq) | 114 | int ide_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd) |
115 | { | 115 | { |
116 | ide_hwif_t *hwif = drive->hwif; | 116 | ide_hwif_t *hwif = drive->hwif; |
117 | __le32 *table = (__le32 *)hwif->dmatable_cpu; | 117 | __le32 *table = (__le32 *)hwif->dmatable_cpu; |
@@ -120,11 +120,7 @@ int ide_build_dmatable(ide_drive_t *drive, struct request *rq) | |||
120 | struct scatterlist *sg; | 120 | struct scatterlist *sg; |
121 | u8 is_trm290 = !!(hwif->host_flags & IDE_HFLAG_TRM290); | 121 | u8 is_trm290 = !!(hwif->host_flags & IDE_HFLAG_TRM290); |
122 | 122 | ||
123 | hwif->sg_nents = ide_build_sglist(drive, rq); | 123 | for_each_sg(hwif->sg_table, sg, cmd->sg_nents, i) { |
124 | if (hwif->sg_nents == 0) | ||
125 | return 0; | ||
126 | |||
127 | for_each_sg(hwif->sg_table, sg, hwif->sg_nents, i) { | ||
128 | u32 cur_addr, cur_len, xcount, bcount; | 124 | u32 cur_addr, cur_len, xcount, bcount; |
129 | 125 | ||
130 | cur_addr = sg_dma_address(sg); | 126 | cur_addr = sg_dma_address(sg); |
@@ -179,6 +175,7 @@ EXPORT_SYMBOL_GPL(ide_build_dmatable); | |||
179 | /** | 175 | /** |
180 | * ide_dma_setup - begin a DMA phase | 176 | * ide_dma_setup - begin a DMA phase |
181 | * @drive: target device | 177 | * @drive: target device |
178 | * @cmd: command | ||
182 | * | 179 | * |
183 | * Build an IDE DMA PRD (IDE speak for scatter gather table) | 180 | * Build an IDE DMA PRD (IDE speak for scatter gather table) |
184 | * and then set up the DMA transfer registers for a device | 181 | * and then set up the DMA transfer registers for a device |
@@ -189,17 +186,16 @@ EXPORT_SYMBOL_GPL(ide_build_dmatable); | |||
189 | * is returned. | 186 | * is returned. |
190 | */ | 187 | */ |
191 | 188 | ||
192 | int ide_dma_setup(ide_drive_t *drive) | 189 | int ide_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) |
193 | { | 190 | { |
194 | ide_hwif_t *hwif = drive->hwif; | 191 | ide_hwif_t *hwif = drive->hwif; |
195 | struct request *rq = hwif->rq; | ||
196 | unsigned int reading = rq_data_dir(rq) ? 0 : ATA_DMA_WR; | ||
197 | u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0; | 192 | u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0; |
193 | u8 rw = (cmd->tf_flags & IDE_TFLAG_WRITE) ? 0 : ATA_DMA_WR; | ||
198 | u8 dma_stat; | 194 | u8 dma_stat; |
199 | 195 | ||
200 | /* fall back to pio! */ | 196 | /* fall back to pio! */ |
201 | if (!ide_build_dmatable(drive, rq)) { | 197 | if (ide_build_dmatable(drive, cmd) == 0) { |
202 | ide_map_sg(drive, rq); | 198 | ide_map_sg(drive, cmd); |
203 | return 1; | 199 | return 1; |
204 | } | 200 | } |
205 | 201 | ||
@@ -212,9 +208,9 @@ int ide_dma_setup(ide_drive_t *drive) | |||
212 | 208 | ||
213 | /* specify r/w */ | 209 | /* specify r/w */ |
214 | if (mmio) | 210 | if (mmio) |
215 | writeb(reading, (void __iomem *)(hwif->dma_base + ATA_DMA_CMD)); | 211 | writeb(rw, (void __iomem *)(hwif->dma_base + ATA_DMA_CMD)); |
216 | else | 212 | else |
217 | outb(reading, hwif->dma_base + ATA_DMA_CMD); | 213 | outb(rw, hwif->dma_base + ATA_DMA_CMD); |
218 | 214 | ||
219 | /* read DMA status for INTR & ERROR flags */ | 215 | /* read DMA status for INTR & ERROR flags */ |
220 | dma_stat = hwif->dma_ops->dma_sff_read_status(hwif); | 216 | dma_stat = hwif->dma_ops->dma_sff_read_status(hwif); |
@@ -228,7 +224,7 @@ int ide_dma_setup(ide_drive_t *drive) | |||
228 | EXPORT_SYMBOL_GPL(ide_dma_setup); | 224 | EXPORT_SYMBOL_GPL(ide_dma_setup); |
229 | 225 | ||
230 | /** | 226 | /** |
231 | * dma_timer_expiry - handle a DMA timeout | 227 | * ide_dma_sff_timer_expiry - handle a DMA timeout |
232 | * @drive: Drive that timed out | 228 | * @drive: Drive that timed out |
233 | * | 229 | * |
234 | * An IDE DMA transfer timed out. In the event of an error we ask | 230 | * An IDE DMA transfer timed out. In the event of an error we ask |
@@ -241,7 +237,7 @@ EXPORT_SYMBOL_GPL(ide_dma_setup); | |||
241 | * This can occur if an interrupt is lost or due to hang or bugs. | 237 | * This can occur if an interrupt is lost or due to hang or bugs. |
242 | */ | 238 | */ |
243 | 239 | ||
244 | static int dma_timer_expiry(ide_drive_t *drive) | 240 | int ide_dma_sff_timer_expiry(ide_drive_t *drive) |
245 | { | 241 | { |
246 | ide_hwif_t *hwif = drive->hwif; | 242 | ide_hwif_t *hwif = drive->hwif; |
247 | u8 dma_stat = hwif->dma_ops->dma_sff_read_status(hwif); | 243 | u8 dma_stat = hwif->dma_ops->dma_sff_read_status(hwif); |
@@ -265,14 +261,7 @@ static int dma_timer_expiry(ide_drive_t *drive) | |||
265 | 261 | ||
266 | return 0; /* Status is unknown -- reset the bus */ | 262 | return 0; /* Status is unknown -- reset the bus */ |
267 | } | 263 | } |
268 | 264 | EXPORT_SYMBOL_GPL(ide_dma_sff_timer_expiry); | |
269 | void ide_dma_exec_cmd(ide_drive_t *drive, u8 command) | ||
270 | { | ||
271 | /* issue cmd to drive */ | ||
272 | ide_execute_command(drive, command, &ide_dma_intr, 2 * WAIT_CMD, | ||
273 | dma_timer_expiry); | ||
274 | } | ||
275 | EXPORT_SYMBOL_GPL(ide_dma_exec_cmd); | ||
276 | 265 | ||
277 | void ide_dma_start(ide_drive_t *drive) | 266 | void ide_dma_start(ide_drive_t *drive) |
278 | { | 267 | { |
@@ -346,10 +335,10 @@ EXPORT_SYMBOL_GPL(ide_dma_test_irq); | |||
346 | const struct ide_dma_ops sff_dma_ops = { | 335 | const struct ide_dma_ops sff_dma_ops = { |
347 | .dma_host_set = ide_dma_host_set, | 336 | .dma_host_set = ide_dma_host_set, |
348 | .dma_setup = ide_dma_setup, | 337 | .dma_setup = ide_dma_setup, |
349 | .dma_exec_cmd = ide_dma_exec_cmd, | ||
350 | .dma_start = ide_dma_start, | 338 | .dma_start = ide_dma_start, |
351 | .dma_end = ide_dma_end, | 339 | .dma_end = ide_dma_end, |
352 | .dma_test_irq = ide_dma_test_irq, | 340 | .dma_test_irq = ide_dma_test_irq, |
341 | .dma_timer_expiry = ide_dma_sff_timer_expiry, | ||
353 | .dma_timeout = ide_dma_timeout, | 342 | .dma_timeout = ide_dma_timeout, |
354 | .dma_lost_irq = ide_dma_lost_irq, | 343 | .dma_lost_irq = ide_dma_lost_irq, |
355 | .dma_sff_read_status = ide_dma_sff_read_status, | 344 | .dma_sff_read_status = ide_dma_sff_read_status, |
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index a878f4734f81..3dbf80c15491 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c | |||
@@ -96,9 +96,13 @@ ide_startstop_t ide_dma_intr(ide_drive_t *drive) | |||
96 | 96 | ||
97 | if (OK_STAT(stat, DRIVE_READY, drive->bad_wstat | ATA_DRQ)) { | 97 | if (OK_STAT(stat, DRIVE_READY, drive->bad_wstat | ATA_DRQ)) { |
98 | if (!dma_stat) { | 98 | if (!dma_stat) { |
99 | struct request *rq = hwif->rq; | 99 | struct ide_cmd *cmd = &hwif->cmd; |
100 | 100 | ||
101 | task_end_request(drive, rq, stat); | 101 | if ((cmd->tf_flags & IDE_TFLAG_FS) == 0) |
102 | ide_finish_cmd(drive, cmd, stat); | ||
103 | else | ||
104 | ide_complete_rq(drive, 0, | ||
105 | cmd->rq->nr_sectors << 9); | ||
102 | return ide_stopped; | 106 | return ide_stopped; |
103 | } | 107 | } |
104 | printk(KERN_ERR "%s: %s: bad DMA status (0x%02x)\n", | 108 | printk(KERN_ERR "%s: %s: bad DMA status (0x%02x)\n", |
@@ -106,7 +110,6 @@ ide_startstop_t ide_dma_intr(ide_drive_t *drive) | |||
106 | } | 110 | } |
107 | return ide_error(drive, "dma_intr", stat); | 111 | return ide_error(drive, "dma_intr", stat); |
108 | } | 112 | } |
109 | EXPORT_SYMBOL_GPL(ide_dma_intr); | ||
110 | 113 | ||
111 | int ide_dma_good_drive(ide_drive_t *drive) | 114 | int ide_dma_good_drive(ide_drive_t *drive) |
112 | { | 115 | { |
@@ -116,7 +119,7 @@ int ide_dma_good_drive(ide_drive_t *drive) | |||
116 | /** | 119 | /** |
117 | * ide_build_sglist - map IDE scatter gather for DMA I/O | 120 | * ide_build_sglist - map IDE scatter gather for DMA I/O |
118 | * @drive: the drive to build the DMA table for | 121 | * @drive: the drive to build the DMA table for |
119 | * @rq: the request holding the sg list | 122 | * @cmd: command |
120 | * | 123 | * |
121 | * Perform the DMA mapping magic necessary to access the source or | 124 | * Perform the DMA mapping magic necessary to access the source or |
122 | * target buffers of a request via DMA. The lower layers of the | 125 | * target buffers of a request via DMA. The lower layers of the |
@@ -124,28 +127,29 @@ int ide_dma_good_drive(ide_drive_t *drive) | |||
124 | * operate in a portable fashion. | 127 | * operate in a portable fashion. |
125 | */ | 128 | */ |
126 | 129 | ||
127 | int ide_build_sglist(ide_drive_t *drive, struct request *rq) | 130 | int ide_build_sglist(ide_drive_t *drive, struct ide_cmd *cmd) |
128 | { | 131 | { |
129 | ide_hwif_t *hwif = drive->hwif; | 132 | ide_hwif_t *hwif = drive->hwif; |
130 | struct scatterlist *sg = hwif->sg_table; | 133 | struct scatterlist *sg = hwif->sg_table; |
131 | int i; | 134 | int i; |
132 | 135 | ||
133 | ide_map_sg(drive, rq); | 136 | ide_map_sg(drive, cmd); |
134 | 137 | ||
135 | if (rq_data_dir(rq) == READ) | 138 | if (cmd->tf_flags & IDE_TFLAG_WRITE) |
136 | hwif->sg_dma_direction = DMA_FROM_DEVICE; | 139 | cmd->sg_dma_direction = DMA_TO_DEVICE; |
137 | else | 140 | else |
138 | hwif->sg_dma_direction = DMA_TO_DEVICE; | 141 | cmd->sg_dma_direction = DMA_FROM_DEVICE; |
139 | 142 | ||
140 | i = dma_map_sg(hwif->dev, sg, hwif->sg_nents, hwif->sg_dma_direction); | 143 | i = dma_map_sg(hwif->dev, sg, cmd->sg_nents, cmd->sg_dma_direction); |
141 | if (i) { | 144 | if (i == 0) |
142 | hwif->orig_sg_nents = hwif->sg_nents; | 145 | ide_map_sg(drive, cmd); |
143 | hwif->sg_nents = i; | 146 | else { |
147 | cmd->orig_sg_nents = cmd->sg_nents; | ||
148 | cmd->sg_nents = i; | ||
144 | } | 149 | } |
145 | 150 | ||
146 | return i; | 151 | return i; |
147 | } | 152 | } |
148 | EXPORT_SYMBOL_GPL(ide_build_sglist); | ||
149 | 153 | ||
150 | /** | 154 | /** |
151 | * ide_destroy_dmatable - clean up DMA mapping | 155 | * ide_destroy_dmatable - clean up DMA mapping |
@@ -161,9 +165,10 @@ EXPORT_SYMBOL_GPL(ide_build_sglist); | |||
161 | void ide_destroy_dmatable(ide_drive_t *drive) | 165 | void ide_destroy_dmatable(ide_drive_t *drive) |
162 | { | 166 | { |
163 | ide_hwif_t *hwif = drive->hwif; | 167 | ide_hwif_t *hwif = drive->hwif; |
168 | struct ide_cmd *cmd = &hwif->cmd; | ||
164 | 169 | ||
165 | dma_unmap_sg(hwif->dev, hwif->sg_table, hwif->orig_sg_nents, | 170 | dma_unmap_sg(hwif->dev, hwif->sg_table, cmd->orig_sg_nents, |
166 | hwif->sg_dma_direction); | 171 | cmd->sg_dma_direction); |
167 | } | 172 | } |
168 | EXPORT_SYMBOL_GPL(ide_destroy_dmatable); | 173 | EXPORT_SYMBOL_GPL(ide_destroy_dmatable); |
169 | 174 | ||
diff --git a/drivers/ide/ide-eh.c b/drivers/ide/ide-eh.c index 1231b5e486f2..11664976eea3 100644 --- a/drivers/ide/ide-eh.c +++ b/drivers/ide/ide-eh.c | |||
@@ -123,8 +123,18 @@ ide_startstop_t ide_error(ide_drive_t *drive, const char *msg, u8 stat) | |||
123 | 123 | ||
124 | /* retry only "normal" I/O: */ | 124 | /* retry only "normal" I/O: */ |
125 | if (!blk_fs_request(rq)) { | 125 | if (!blk_fs_request(rq)) { |
126 | rq->errors = 1; | 126 | if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { |
127 | ide_end_drive_cmd(drive, stat, err); | 127 | struct ide_cmd *cmd = rq->special; |
128 | |||
129 | if (cmd) | ||
130 | ide_complete_cmd(drive, cmd, stat, err); | ||
131 | } else if (blk_pm_request(rq)) { | ||
132 | rq->errors = 1; | ||
133 | ide_complete_pm_rq(drive, rq); | ||
134 | return ide_stopped; | ||
135 | } | ||
136 | rq->errors = err; | ||
137 | ide_complete_rq(drive, err ? -EIO : 0, blk_rq_bytes(rq)); | ||
128 | return ide_stopped; | 138 | return ide_stopped; |
129 | } | 139 | } |
130 | 140 | ||
@@ -136,8 +146,11 @@ static inline void ide_complete_drive_reset(ide_drive_t *drive, int err) | |||
136 | { | 146 | { |
137 | struct request *rq = drive->hwif->rq; | 147 | struct request *rq = drive->hwif->rq; |
138 | 148 | ||
139 | if (rq && blk_special_request(rq) && rq->cmd[0] == REQ_DRIVE_RESET) | 149 | if (rq && blk_special_request(rq) && rq->cmd[0] == REQ_DRIVE_RESET) { |
140 | ide_end_request(drive, err ? err : 1, 0); | 150 | if (err <= 0 && rq->errors == 0) |
151 | rq->errors = -EIO; | ||
152 | ide_complete_rq(drive, err ? err : 0, ide_rq_bytes(rq)); | ||
153 | } | ||
141 | } | 154 | } |
142 | 155 | ||
143 | /* needed below */ | 156 | /* needed below */ |
@@ -162,8 +175,7 @@ static ide_startstop_t atapi_reset_pollfunc(ide_drive_t *drive) | |||
162 | printk(KERN_INFO "%s: ATAPI reset complete\n", drive->name); | 175 | printk(KERN_INFO "%s: ATAPI reset complete\n", drive->name); |
163 | else { | 176 | else { |
164 | if (time_before(jiffies, hwif->poll_timeout)) { | 177 | if (time_before(jiffies, hwif->poll_timeout)) { |
165 | ide_set_handler(drive, &atapi_reset_pollfunc, HZ/20, | 178 | ide_set_handler(drive, &atapi_reset_pollfunc, HZ/20); |
166 | NULL); | ||
167 | /* continue polling */ | 179 | /* continue polling */ |
168 | return ide_started; | 180 | return ide_started; |
169 | } | 181 | } |
@@ -225,7 +237,7 @@ static ide_startstop_t reset_pollfunc(ide_drive_t *drive) | |||
225 | 237 | ||
226 | if (!OK_STAT(tmp, 0, ATA_BUSY)) { | 238 | if (!OK_STAT(tmp, 0, ATA_BUSY)) { |
227 | if (time_before(jiffies, hwif->poll_timeout)) { | 239 | if (time_before(jiffies, hwif->poll_timeout)) { |
228 | ide_set_handler(drive, &reset_pollfunc, HZ/20, NULL); | 240 | ide_set_handler(drive, &reset_pollfunc, HZ/20); |
229 | /* continue polling */ | 241 | /* continue polling */ |
230 | return ide_started; | 242 | return ide_started; |
231 | } | 243 | } |
@@ -342,7 +354,7 @@ static ide_startstop_t do_reset1(ide_drive_t *drive, int do_not_try_atapi) | |||
342 | ndelay(400); | 354 | ndelay(400); |
343 | hwif->poll_timeout = jiffies + WAIT_WORSTCASE; | 355 | hwif->poll_timeout = jiffies + WAIT_WORSTCASE; |
344 | hwif->polling = 1; | 356 | hwif->polling = 1; |
345 | __ide_set_handler(drive, &atapi_reset_pollfunc, HZ/20, NULL); | 357 | __ide_set_handler(drive, &atapi_reset_pollfunc, HZ/20); |
346 | spin_unlock_irqrestore(&hwif->lock, flags); | 358 | spin_unlock_irqrestore(&hwif->lock, flags); |
347 | return ide_started; | 359 | return ide_started; |
348 | } | 360 | } |
@@ -402,7 +414,7 @@ static ide_startstop_t do_reset1(ide_drive_t *drive, int do_not_try_atapi) | |||
402 | udelay(10); | 414 | udelay(10); |
403 | hwif->poll_timeout = jiffies + WAIT_WORSTCASE; | 415 | hwif->poll_timeout = jiffies + WAIT_WORSTCASE; |
404 | hwif->polling = 1; | 416 | hwif->polling = 1; |
405 | __ide_set_handler(drive, &reset_pollfunc, HZ/20, NULL); | 417 | __ide_set_handler(drive, &reset_pollfunc, HZ/20); |
406 | 418 | ||
407 | /* | 419 | /* |
408 | * Some weird controller like resetting themselves to a strange | 420 | * Some weird controller like resetting themselves to a strange |
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 317ec62c33d4..7ae662334835 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c | |||
@@ -61,50 +61,6 @@ | |||
61 | */ | 61 | */ |
62 | #define IDEFLOPPY_PC_DELAY (HZ/20) /* default delay for ZIP 100 (50ms) */ | 62 | #define IDEFLOPPY_PC_DELAY (HZ/20) /* default delay for ZIP 100 (50ms) */ |
63 | 63 | ||
64 | /* Error code returned in rq->errors to the higher part of the driver. */ | ||
65 | #define IDEFLOPPY_ERROR_GENERAL 101 | ||
66 | |||
67 | /* | ||
68 | * Used to finish servicing a request. For read/write requests, we will call | ||
69 | * ide_end_request to pass to the next buffer. | ||
70 | */ | ||
71 | static int ide_floppy_end_request(ide_drive_t *drive, int uptodate, int nsecs) | ||
72 | { | ||
73 | struct ide_disk_obj *floppy = drive->driver_data; | ||
74 | struct request *rq = drive->hwif->rq; | ||
75 | int error; | ||
76 | |||
77 | ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__); | ||
78 | |||
79 | switch (uptodate) { | ||
80 | case 0: | ||
81 | error = IDEFLOPPY_ERROR_GENERAL; | ||
82 | break; | ||
83 | |||
84 | case 1: | ||
85 | error = 0; | ||
86 | break; | ||
87 | |||
88 | default: | ||
89 | error = uptodate; | ||
90 | } | ||
91 | |||
92 | if (error) | ||
93 | floppy->failed_pc = NULL; | ||
94 | /* Why does this happen? */ | ||
95 | if (!rq) | ||
96 | return 0; | ||
97 | if (!blk_special_request(rq)) { | ||
98 | /* our real local end request function */ | ||
99 | ide_end_request(drive, uptodate, nsecs); | ||
100 | return 0; | ||
101 | } | ||
102 | rq->errors = error; | ||
103 | /* fixme: need to move this local also */ | ||
104 | ide_end_drive_cmd(drive, 0, 0); | ||
105 | return 0; | ||
106 | } | ||
107 | |||
108 | static void idefloppy_update_buffers(ide_drive_t *drive, | 64 | static void idefloppy_update_buffers(ide_drive_t *drive, |
109 | struct ide_atapi_pc *pc) | 65 | struct ide_atapi_pc *pc) |
110 | { | 66 | { |
@@ -112,22 +68,23 @@ static void idefloppy_update_buffers(ide_drive_t *drive, | |||
112 | struct bio *bio = rq->bio; | 68 | struct bio *bio = rq->bio; |
113 | 69 | ||
114 | while ((bio = rq->bio) != NULL) | 70 | while ((bio = rq->bio) != NULL) |
115 | ide_floppy_end_request(drive, 1, 0); | 71 | ide_complete_rq(drive, 0, ide_rq_bytes(rq)); |
116 | } | 72 | } |
117 | 73 | ||
118 | static void ide_floppy_callback(ide_drive_t *drive, int dsc) | 74 | static int ide_floppy_callback(ide_drive_t *drive, int dsc) |
119 | { | 75 | { |
120 | struct ide_disk_obj *floppy = drive->driver_data; | 76 | struct ide_disk_obj *floppy = drive->driver_data; |
121 | struct ide_atapi_pc *pc = drive->pc; | 77 | struct ide_atapi_pc *pc = drive->pc; |
78 | struct request *rq = pc->rq; | ||
122 | int uptodate = pc->error ? 0 : 1; | 79 | int uptodate = pc->error ? 0 : 1; |
123 | 80 | ||
124 | ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__); | 81 | ide_debug_log(IDE_DBG_FUNC, "enter"); |
125 | 82 | ||
126 | if (floppy->failed_pc == pc) | 83 | if (drive->failed_pc == pc) |
127 | floppy->failed_pc = NULL; | 84 | drive->failed_pc = NULL; |
128 | 85 | ||
129 | if (pc->c[0] == GPCMD_READ_10 || pc->c[0] == GPCMD_WRITE_10 || | 86 | if (pc->c[0] == GPCMD_READ_10 || pc->c[0] == GPCMD_WRITE_10 || |
130 | (pc->rq && blk_pc_request(pc->rq))) | 87 | (rq && blk_pc_request(rq))) |
131 | uptodate = 1; /* FIXME */ | 88 | uptodate = 1; /* FIXME */ |
132 | else if (pc->c[0] == GPCMD_REQUEST_SENSE) { | 89 | else if (pc->c[0] == GPCMD_REQUEST_SENSE) { |
133 | u8 *buf = pc->buf; | 90 | u8 *buf = pc->buf; |
@@ -139,19 +96,22 @@ static void ide_floppy_callback(ide_drive_t *drive, int dsc) | |||
139 | floppy->progress_indication = buf[15] & 0x80 ? | 96 | floppy->progress_indication = buf[15] & 0x80 ? |
140 | (u16)get_unaligned((u16 *)&buf[16]) : 0x10000; | 97 | (u16)get_unaligned((u16 *)&buf[16]) : 0x10000; |
141 | 98 | ||
142 | if (floppy->failed_pc) | 99 | if (drive->failed_pc) |
143 | ide_debug_log(IDE_DBG_PC, "pc = %x, ", | 100 | ide_debug_log(IDE_DBG_PC, "pc = %x", |
144 | floppy->failed_pc->c[0]); | 101 | drive->failed_pc->c[0]); |
145 | 102 | ||
146 | ide_debug_log(IDE_DBG_SENSE, "sense key = %x, asc = %x," | 103 | ide_debug_log(IDE_DBG_SENSE, "sense key = %x, asc = %x," |
147 | "ascq = %x\n", floppy->sense_key, | 104 | "ascq = %x", floppy->sense_key, |
148 | floppy->asc, floppy->ascq); | 105 | floppy->asc, floppy->ascq); |
149 | } else | 106 | } else |
150 | printk(KERN_ERR PFX "Error in REQUEST SENSE itself - " | 107 | printk(KERN_ERR PFX "Error in REQUEST SENSE itself - " |
151 | "Aborting request!\n"); | 108 | "Aborting request!\n"); |
152 | } | 109 | } |
153 | 110 | ||
154 | ide_floppy_end_request(drive, uptodate, 0); | 111 | if (blk_special_request(rq)) |
112 | rq->errors = uptodate ? 0 : IDE_DRV_ERROR_GENERAL; | ||
113 | |||
114 | return uptodate; | ||
155 | } | 115 | } |
156 | 116 | ||
157 | static void ide_floppy_report_error(struct ide_disk_obj *floppy, | 117 | static void ide_floppy_report_error(struct ide_disk_obj *floppy, |
@@ -170,14 +130,15 @@ static void ide_floppy_report_error(struct ide_disk_obj *floppy, | |||
170 | 130 | ||
171 | } | 131 | } |
172 | 132 | ||
173 | static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive, | 133 | static ide_startstop_t ide_floppy_issue_pc(ide_drive_t *drive, |
174 | struct ide_atapi_pc *pc) | 134 | struct ide_cmd *cmd, |
135 | struct ide_atapi_pc *pc) | ||
175 | { | 136 | { |
176 | struct ide_disk_obj *floppy = drive->driver_data; | 137 | struct ide_disk_obj *floppy = drive->driver_data; |
177 | 138 | ||
178 | if (floppy->failed_pc == NULL && | 139 | if (drive->failed_pc == NULL && |
179 | pc->c[0] != GPCMD_REQUEST_SENSE) | 140 | pc->c[0] != GPCMD_REQUEST_SENSE) |
180 | floppy->failed_pc = pc; | 141 | drive->failed_pc = pc; |
181 | 142 | ||
182 | /* Set the current packet command */ | 143 | /* Set the current packet command */ |
183 | drive->pc = pc; | 144 | drive->pc = pc; |
@@ -186,18 +147,18 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive, | |||
186 | if (!(pc->flags & PC_FLAG_SUPPRESS_ERROR)) | 147 | if (!(pc->flags & PC_FLAG_SUPPRESS_ERROR)) |
187 | ide_floppy_report_error(floppy, pc); | 148 | ide_floppy_report_error(floppy, pc); |
188 | /* Giving up */ | 149 | /* Giving up */ |
189 | pc->error = IDEFLOPPY_ERROR_GENERAL; | 150 | pc->error = IDE_DRV_ERROR_GENERAL; |
190 | 151 | ||
191 | floppy->failed_pc = NULL; | 152 | drive->failed_pc = NULL; |
192 | drive->pc_callback(drive, 0); | 153 | drive->pc_callback(drive, 0); |
193 | return ide_stopped; | 154 | return ide_stopped; |
194 | } | 155 | } |
195 | 156 | ||
196 | ide_debug_log(IDE_DBG_FUNC, "%s: Retry #%d\n", __func__, pc->retries); | 157 | ide_debug_log(IDE_DBG_FUNC, "retry #%d", pc->retries); |
197 | 158 | ||
198 | pc->retries++; | 159 | pc->retries++; |
199 | 160 | ||
200 | return ide_issue_pc(drive); | 161 | return ide_issue_pc(drive, cmd); |
201 | } | 162 | } |
202 | 163 | ||
203 | void ide_floppy_create_read_capacity_cmd(struct ide_atapi_pc *pc) | 164 | void ide_floppy_create_read_capacity_cmd(struct ide_atapi_pc *pc) |
@@ -242,8 +203,7 @@ static void idefloppy_create_rw_cmd(ide_drive_t *drive, | |||
242 | int blocks = rq->nr_sectors / floppy->bs_factor; | 203 | int blocks = rq->nr_sectors / floppy->bs_factor; |
243 | int cmd = rq_data_dir(rq); | 204 | int cmd = rq_data_dir(rq); |
244 | 205 | ||
245 | ide_debug_log(IDE_DBG_FUNC, "%s: block: %d, blocks: %d\n", __func__, | 206 | ide_debug_log(IDE_DBG_FUNC, "block: %d, blocks: %d", block, blocks); |
246 | block, blocks); | ||
247 | 207 | ||
248 | ide_init_pc(pc); | 208 | ide_init_pc(pc); |
249 | pc->c[0] = cmd == READ ? GPCMD_READ_10 : GPCMD_WRITE_10; | 209 | pc->c[0] = cmd == READ ? GPCMD_READ_10 : GPCMD_WRITE_10; |
@@ -285,34 +245,34 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive, | |||
285 | { | 245 | { |
286 | struct ide_disk_obj *floppy = drive->driver_data; | 246 | struct ide_disk_obj *floppy = drive->driver_data; |
287 | ide_hwif_t *hwif = drive->hwif; | 247 | ide_hwif_t *hwif = drive->hwif; |
248 | struct ide_cmd cmd; | ||
288 | struct ide_atapi_pc *pc; | 249 | struct ide_atapi_pc *pc; |
289 | 250 | ||
290 | ide_debug_log(IDE_DBG_FUNC, "%s: dev: %s, cmd: 0x%x, cmd_type: %x, " | 251 | if (drive->debug_mask & IDE_DBG_RQ) |
291 | "errors: %d\n", | 252 | blk_dump_rq_flags(rq, (rq->rq_disk |
292 | __func__, rq->rq_disk ? rq->rq_disk->disk_name : "?", | 253 | ? rq->rq_disk->disk_name |
293 | rq->cmd[0], rq->cmd_type, rq->errors); | 254 | : "dev?")); |
294 | |||
295 | ide_debug_log(IDE_DBG_FUNC, "%s: sector: %ld, nr_sectors: %ld, " | ||
296 | "current_nr_sectors: %d\n", | ||
297 | __func__, (long)rq->sector, rq->nr_sectors, | ||
298 | rq->current_nr_sectors); | ||
299 | 255 | ||
300 | if (rq->errors >= ERROR_MAX) { | 256 | if (rq->errors >= ERROR_MAX) { |
301 | if (floppy->failed_pc) | 257 | if (drive->failed_pc) { |
302 | ide_floppy_report_error(floppy, floppy->failed_pc); | 258 | ide_floppy_report_error(floppy, drive->failed_pc); |
303 | else | 259 | drive->failed_pc = NULL; |
260 | } else | ||
304 | printk(KERN_ERR PFX "%s: I/O error\n", drive->name); | 261 | printk(KERN_ERR PFX "%s: I/O error\n", drive->name); |
305 | 262 | ||
306 | ide_floppy_end_request(drive, 0, 0); | 263 | if (blk_special_request(rq)) { |
307 | return ide_stopped; | 264 | rq->errors = 0; |
265 | ide_complete_rq(drive, 0, blk_rq_bytes(rq)); | ||
266 | return ide_stopped; | ||
267 | } else | ||
268 | goto out_end; | ||
308 | } | 269 | } |
309 | if (blk_fs_request(rq)) { | 270 | if (blk_fs_request(rq)) { |
310 | if (((long)rq->sector % floppy->bs_factor) || | 271 | if (((long)rq->sector % floppy->bs_factor) || |
311 | (rq->nr_sectors % floppy->bs_factor)) { | 272 | (rq->nr_sectors % floppy->bs_factor)) { |
312 | printk(KERN_ERR PFX "%s: unsupported r/w rq size\n", | 273 | printk(KERN_ERR PFX "%s: unsupported r/w rq size\n", |
313 | drive->name); | 274 | drive->name); |
314 | ide_floppy_end_request(drive, 0, 0); | 275 | goto out_end; |
315 | return ide_stopped; | ||
316 | } | 276 | } |
317 | pc = &floppy->queued_pc; | 277 | pc = &floppy->queued_pc; |
318 | idefloppy_create_rw_cmd(drive, pc, rq, (unsigned long)block); | 278 | idefloppy_create_rw_cmd(drive, pc, rq, (unsigned long)block); |
@@ -323,21 +283,33 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive, | |||
323 | idefloppy_blockpc_cmd(floppy, pc, rq); | 283 | idefloppy_blockpc_cmd(floppy, pc, rq); |
324 | } else { | 284 | } else { |
325 | blk_dump_rq_flags(rq, PFX "unsupported command in queue"); | 285 | blk_dump_rq_flags(rq, PFX "unsupported command in queue"); |
326 | ide_floppy_end_request(drive, 0, 0); | 286 | goto out_end; |
327 | return ide_stopped; | ||
328 | } | 287 | } |
329 | 288 | ||
289 | memset(&cmd, 0, sizeof(cmd)); | ||
290 | |||
291 | if (rq_data_dir(rq)) | ||
292 | cmd.tf_flags |= IDE_TFLAG_WRITE; | ||
293 | |||
294 | cmd.rq = rq; | ||
295 | |||
330 | if (blk_fs_request(rq) || pc->req_xfer) { | 296 | if (blk_fs_request(rq) || pc->req_xfer) { |
331 | ide_init_sg_cmd(drive, rq); | 297 | ide_init_sg_cmd(&cmd, rq->nr_sectors << 9); |
332 | ide_map_sg(drive, rq); | 298 | ide_map_sg(drive, &cmd); |
333 | } | 299 | } |
334 | 300 | ||
335 | pc->sg = hwif->sg_table; | 301 | pc->sg = hwif->sg_table; |
336 | pc->sg_cnt = hwif->sg_nents; | 302 | pc->sg_cnt = cmd.sg_nents; |
337 | 303 | ||
338 | pc->rq = rq; | 304 | pc->rq = rq; |
339 | 305 | ||
340 | return idefloppy_issue_pc(drive, pc); | 306 | return ide_floppy_issue_pc(drive, &cmd, pc); |
307 | out_end: | ||
308 | drive->failed_pc = NULL; | ||
309 | if (blk_fs_request(rq) == 0 && rq->errors == 0) | ||
310 | rq->errors = -EIO; | ||
311 | ide_complete_rq(drive, -EIO, ide_rq_bytes(rq)); | ||
312 | return ide_stopped; | ||
341 | } | 313 | } |
342 | 314 | ||
343 | /* | 315 | /* |
@@ -438,8 +410,9 @@ static int ide_floppy_get_capacity(ide_drive_t *drive) | |||
438 | length = be16_to_cpup((__be16 *)&pc.buf[desc_start + 6]); | 410 | length = be16_to_cpup((__be16 *)&pc.buf[desc_start + 6]); |
439 | 411 | ||
440 | ide_debug_log(IDE_DBG_PROBE, "Descriptor %d: %dkB, %d blocks, " | 412 | ide_debug_log(IDE_DBG_PROBE, "Descriptor %d: %dkB, %d blocks, " |
441 | "%d sector size\n", | 413 | "%d sector size", |
442 | i, blocks * length / 1024, blocks, length); | 414 | i, blocks * length / 1024, |
415 | blocks, length); | ||
443 | 416 | ||
444 | if (i) | 417 | if (i) |
445 | continue; | 418 | continue; |
@@ -495,8 +468,8 @@ static int ide_floppy_get_capacity(ide_drive_t *drive) | |||
495 | "in drive\n", drive->name); | 468 | "in drive\n", drive->name); |
496 | break; | 469 | break; |
497 | } | 470 | } |
498 | ide_debug_log(IDE_DBG_PROBE, "Descriptor 0 Code: %d\n", | 471 | ide_debug_log(IDE_DBG_PROBE, "Descriptor 0 Code: %d", |
499 | pc.buf[desc_start + 4] & 0x03); | 472 | pc.buf[desc_start + 4] & 0x03); |
500 | } | 473 | } |
501 | 474 | ||
502 | /* Clik! disk does not support get_flexible_disk_page */ | 475 | /* Clik! disk does not support get_flexible_disk_page */ |
@@ -575,6 +548,5 @@ const struct ide_disk_ops ide_atapi_disk_ops = { | |||
575 | .init_media = ide_floppy_init_media, | 548 | .init_media = ide_floppy_init_media, |
576 | .set_doorlock = ide_set_media_lock, | 549 | .set_doorlock = ide_set_media_lock, |
577 | .do_request = ide_floppy_do_request, | 550 | .do_request = ide_floppy_do_request, |
578 | .end_request = ide_floppy_end_request, | ||
579 | .ioctl = ide_floppy_ioctl, | 551 | .ioctl = ide_floppy_ioctl, |
580 | }; | 552 | }; |
diff --git a/drivers/ide/ide-gd.c b/drivers/ide/ide-gd.c index 047109419902..1aebdf1a4f58 100644 --- a/drivers/ide/ide-gd.c +++ b/drivers/ide/ide-gd.c | |||
@@ -145,11 +145,6 @@ static ide_startstop_t ide_gd_do_request(ide_drive_t *drive, | |||
145 | return drive->disk_ops->do_request(drive, rq, sector); | 145 | return drive->disk_ops->do_request(drive, rq, sector); |
146 | } | 146 | } |
147 | 147 | ||
148 | static int ide_gd_end_request(ide_drive_t *drive, int uptodate, int nrsecs) | ||
149 | { | ||
150 | return drive->disk_ops->end_request(drive, uptodate, nrsecs); | ||
151 | } | ||
152 | |||
153 | static struct ide_driver ide_gd_driver = { | 148 | static struct ide_driver ide_gd_driver = { |
154 | .gen_driver = { | 149 | .gen_driver = { |
155 | .owner = THIS_MODULE, | 150 | .owner = THIS_MODULE, |
@@ -162,7 +157,6 @@ static struct ide_driver ide_gd_driver = { | |||
162 | .shutdown = ide_gd_shutdown, | 157 | .shutdown = ide_gd_shutdown, |
163 | .version = IDE_GD_VERSION, | 158 | .version = IDE_GD_VERSION, |
164 | .do_request = ide_gd_do_request, | 159 | .do_request = ide_gd_do_request, |
165 | .end_request = ide_gd_end_request, | ||
166 | #ifdef CONFIG_IDE_PROC_FS | 160 | #ifdef CONFIG_IDE_PROC_FS |
167 | .proc_entries = ide_disk_proc_entries, | 161 | .proc_entries = ide_disk_proc_entries, |
168 | .proc_devsets = ide_disk_proc_devsets, | 162 | .proc_devsets = ide_disk_proc_devsets, |
@@ -182,7 +176,7 @@ static int ide_gd_open(struct block_device *bdev, fmode_t mode) | |||
182 | 176 | ||
183 | drive = idkp->drive; | 177 | drive = idkp->drive; |
184 | 178 | ||
185 | ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__); | 179 | ide_debug_log(IDE_DBG_FUNC, "enter"); |
186 | 180 | ||
187 | idkp->openers++; | 181 | idkp->openers++; |
188 | 182 | ||
@@ -232,7 +226,7 @@ static int ide_gd_release(struct gendisk *disk, fmode_t mode) | |||
232 | struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj); | 226 | struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj); |
233 | ide_drive_t *drive = idkp->drive; | 227 | ide_drive_t *drive = idkp->drive; |
234 | 228 | ||
235 | ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__); | 229 | ide_debug_log(IDE_DBG_FUNC, "enter"); |
236 | 230 | ||
237 | if (idkp->openers == 1) | 231 | if (idkp->openers == 1) |
238 | drive->disk_ops->flush(drive); | 232 | drive->disk_ops->flush(drive); |
diff --git a/drivers/ide/ide-gd.h b/drivers/ide/ide-gd.h index b604bdd318a1..55970772bd04 100644 --- a/drivers/ide/ide-gd.h +++ b/drivers/ide/ide-gd.h | |||
@@ -8,7 +8,7 @@ | |||
8 | #define IDE_GD_DEBUG_LOG 0 | 8 | #define IDE_GD_DEBUG_LOG 0 |
9 | 9 | ||
10 | #if IDE_GD_DEBUG_LOG | 10 | #if IDE_GD_DEBUG_LOG |
11 | #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, args) | 11 | #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) |
12 | #else | 12 | #else |
13 | #define ide_debug_log(lvl, fmt, args...) do {} while (0) | 13 | #define ide_debug_log(lvl, fmt, args...) do {} while (0) |
14 | #endif | 14 | #endif |
@@ -20,8 +20,6 @@ struct ide_disk_obj { | |||
20 | struct device dev; | 20 | struct device dev; |
21 | unsigned int openers; /* protected by BKL for now */ | 21 | unsigned int openers; /* protected by BKL for now */ |
22 | 22 | ||
23 | /* Last failed packet command */ | ||
24 | struct ide_atapi_pc *failed_pc; | ||
25 | /* used for blk_{fs,pc}_request() requests */ | 23 | /* used for blk_{fs,pc}_request() requests */ |
26 | struct ide_atapi_pc queued_pc; | 24 | struct ide_atapi_pc queued_pc; |
27 | 25 | ||
diff --git a/drivers/ide/ide-generic.c b/drivers/ide/ide-generic.c index 81a5282ce1eb..9d03e8211536 100644 --- a/drivers/ide/ide-generic.c +++ b/drivers/ide/ide-generic.c | |||
@@ -32,6 +32,10 @@ static int probe_mask; | |||
32 | module_param(probe_mask, int, 0); | 32 | module_param(probe_mask, int, 0); |
33 | MODULE_PARM_DESC(probe_mask, "probe mask for legacy ISA IDE ports"); | 33 | MODULE_PARM_DESC(probe_mask, "probe mask for legacy ISA IDE ports"); |
34 | 34 | ||
35 | static const struct ide_port_info ide_generic_port_info = { | ||
36 | .host_flags = IDE_HFLAG_NO_DMA, | ||
37 | }; | ||
38 | |||
35 | static ssize_t store_add(struct class *cls, const char *buf, size_t n) | 39 | static ssize_t store_add(struct class *cls, const char *buf, size_t n) |
36 | { | 40 | { |
37 | unsigned int base, ctl; | 41 | unsigned int base, ctl; |
@@ -46,7 +50,7 @@ static ssize_t store_add(struct class *cls, const char *buf, size_t n) | |||
46 | hw.irq = irq; | 50 | hw.irq = irq; |
47 | hw.chipset = ide_generic; | 51 | hw.chipset = ide_generic; |
48 | 52 | ||
49 | rc = ide_host_add(NULL, hws, NULL); | 53 | rc = ide_host_add(&ide_generic_port_info, hws, NULL); |
50 | if (rc) | 54 | if (rc) |
51 | return rc; | 55 | return rc; |
52 | 56 | ||
@@ -184,7 +188,7 @@ static int __init ide_generic_init(void) | |||
184 | #endif | 188 | #endif |
185 | hw.chipset = ide_generic; | 189 | hw.chipset = ide_generic; |
186 | 190 | ||
187 | rc = ide_host_add(NULL, hws, NULL); | 191 | rc = ide_host_add(&ide_generic_port_info, hws, NULL); |
188 | if (rc) { | 192 | if (rc) { |
189 | release_region(io_addr + 0x206, 1); | 193 | release_region(io_addr + 0x206, 1); |
190 | release_region(io_addr, 8); | 194 | release_region(io_addr, 8); |
diff --git a/drivers/ide/ide-h8300.c b/drivers/ide/ide-h8300.c index 9270d3255ee0..ff8339ed59ab 100644 --- a/drivers/ide/ide-h8300.c +++ b/drivers/ide/ide-h8300.c | |||
@@ -44,53 +44,53 @@ static u16 mm_inw(unsigned long a) | |||
44 | return r; | 44 | return r; |
45 | } | 45 | } |
46 | 46 | ||
47 | static void h8300_tf_load(ide_drive_t *drive, ide_task_t *task) | 47 | static void h8300_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) |
48 | { | 48 | { |
49 | ide_hwif_t *hwif = drive->hwif; | 49 | ide_hwif_t *hwif = drive->hwif; |
50 | struct ide_io_ports *io_ports = &hwif->io_ports; | 50 | struct ide_io_ports *io_ports = &hwif->io_ports; |
51 | struct ide_taskfile *tf = &task->tf; | 51 | struct ide_taskfile *tf = &cmd->tf; |
52 | u8 HIHI = (task->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; | 52 | u8 HIHI = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; |
53 | 53 | ||
54 | if (task->tf_flags & IDE_TFLAG_FLAGGED) | 54 | if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) |
55 | HIHI = 0xFF; | 55 | HIHI = 0xFF; |
56 | 56 | ||
57 | if (task->tf_flags & IDE_TFLAG_OUT_DATA) | 57 | if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) |
58 | mm_outw((tf->hob_data << 8) | tf->data, io_ports->data_addr); | 58 | mm_outw((tf->hob_data << 8) | tf->data, io_ports->data_addr); |
59 | 59 | ||
60 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) | 60 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) |
61 | outb(tf->hob_feature, io_ports->feature_addr); | 61 | outb(tf->hob_feature, io_ports->feature_addr); |
62 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) | 62 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) |
63 | outb(tf->hob_nsect, io_ports->nsect_addr); | 63 | outb(tf->hob_nsect, io_ports->nsect_addr); |
64 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) | 64 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) |
65 | outb(tf->hob_lbal, io_ports->lbal_addr); | 65 | outb(tf->hob_lbal, io_ports->lbal_addr); |
66 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) | 66 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) |
67 | outb(tf->hob_lbam, io_ports->lbam_addr); | 67 | outb(tf->hob_lbam, io_ports->lbam_addr); |
68 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) | 68 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) |
69 | outb(tf->hob_lbah, io_ports->lbah_addr); | 69 | outb(tf->hob_lbah, io_ports->lbah_addr); |
70 | 70 | ||
71 | if (task->tf_flags & IDE_TFLAG_OUT_FEATURE) | 71 | if (cmd->tf_flags & IDE_TFLAG_OUT_FEATURE) |
72 | outb(tf->feature, io_ports->feature_addr); | 72 | outb(tf->feature, io_ports->feature_addr); |
73 | if (task->tf_flags & IDE_TFLAG_OUT_NSECT) | 73 | if (cmd->tf_flags & IDE_TFLAG_OUT_NSECT) |
74 | outb(tf->nsect, io_ports->nsect_addr); | 74 | outb(tf->nsect, io_ports->nsect_addr); |
75 | if (task->tf_flags & IDE_TFLAG_OUT_LBAL) | 75 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAL) |
76 | outb(tf->lbal, io_ports->lbal_addr); | 76 | outb(tf->lbal, io_ports->lbal_addr); |
77 | if (task->tf_flags & IDE_TFLAG_OUT_LBAM) | 77 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAM) |
78 | outb(tf->lbam, io_ports->lbam_addr); | 78 | outb(tf->lbam, io_ports->lbam_addr); |
79 | if (task->tf_flags & IDE_TFLAG_OUT_LBAH) | 79 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAH) |
80 | outb(tf->lbah, io_ports->lbah_addr); | 80 | outb(tf->lbah, io_ports->lbah_addr); |
81 | 81 | ||
82 | if (task->tf_flags & IDE_TFLAG_OUT_DEVICE) | 82 | if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) |
83 | outb((tf->device & HIHI) | drive->select, | 83 | outb((tf->device & HIHI) | drive->select, |
84 | io_ports->device_addr); | 84 | io_ports->device_addr); |
85 | } | 85 | } |
86 | 86 | ||
87 | static void h8300_tf_read(ide_drive_t *drive, ide_task_t *task) | 87 | static void h8300_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) |
88 | { | 88 | { |
89 | ide_hwif_t *hwif = drive->hwif; | 89 | ide_hwif_t *hwif = drive->hwif; |
90 | struct ide_io_ports *io_ports = &hwif->io_ports; | 90 | struct ide_io_ports *io_ports = &hwif->io_ports; |
91 | struct ide_taskfile *tf = &task->tf; | 91 | struct ide_taskfile *tf = &cmd->tf; |
92 | 92 | ||
93 | if (task->tf_flags & IDE_TFLAG_IN_DATA) { | 93 | if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) { |
94 | u16 data = mm_inw(io_ports->data_addr); | 94 | u16 data = mm_inw(io_ports->data_addr); |
95 | 95 | ||
96 | tf->data = data & 0xff; | 96 | tf->data = data & 0xff; |
@@ -100,31 +100,31 @@ static void h8300_tf_read(ide_drive_t *drive, ide_task_t *task) | |||
100 | /* be sure we're looking at the low order bits */ | 100 | /* be sure we're looking at the low order bits */ |
101 | outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); | 101 | outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); |
102 | 102 | ||
103 | if (task->tf_flags & IDE_TFLAG_IN_FEATURE) | 103 | if (cmd->tf_flags & IDE_TFLAG_IN_FEATURE) |
104 | tf->feature = inb(io_ports->feature_addr); | 104 | tf->feature = inb(io_ports->feature_addr); |
105 | if (task->tf_flags & IDE_TFLAG_IN_NSECT) | 105 | if (cmd->tf_flags & IDE_TFLAG_IN_NSECT) |
106 | tf->nsect = inb(io_ports->nsect_addr); | 106 | tf->nsect = inb(io_ports->nsect_addr); |
107 | if (task->tf_flags & IDE_TFLAG_IN_LBAL) | 107 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAL) |
108 | tf->lbal = inb(io_ports->lbal_addr); | 108 | tf->lbal = inb(io_ports->lbal_addr); |
109 | if (task->tf_flags & IDE_TFLAG_IN_LBAM) | 109 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAM) |
110 | tf->lbam = inb(io_ports->lbam_addr); | 110 | tf->lbam = inb(io_ports->lbam_addr); |
111 | if (task->tf_flags & IDE_TFLAG_IN_LBAH) | 111 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAH) |
112 | tf->lbah = inb(io_ports->lbah_addr); | 112 | tf->lbah = inb(io_ports->lbah_addr); |
113 | if (task->tf_flags & IDE_TFLAG_IN_DEVICE) | 113 | if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE) |
114 | tf->device = inb(io_ports->device_addr); | 114 | tf->device = inb(io_ports->device_addr); |
115 | 115 | ||
116 | if (task->tf_flags & IDE_TFLAG_LBA48) { | 116 | if (cmd->tf_flags & IDE_TFLAG_LBA48) { |
117 | outb(ATA_DEVCTL_OBS | 0x80, io_ports->ctl_addr); | 117 | outb(ATA_DEVCTL_OBS | 0x80, io_ports->ctl_addr); |
118 | 118 | ||
119 | if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) | 119 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) |
120 | tf->hob_feature = inb(io_ports->feature_addr); | 120 | tf->hob_feature = inb(io_ports->feature_addr); |
121 | if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT) | 121 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT) |
122 | tf->hob_nsect = inb(io_ports->nsect_addr); | 122 | tf->hob_nsect = inb(io_ports->nsect_addr); |
123 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL) | 123 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL) |
124 | tf->hob_lbal = inb(io_ports->lbal_addr); | 124 | tf->hob_lbal = inb(io_ports->lbal_addr); |
125 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM) | 125 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM) |
126 | tf->hob_lbam = inb(io_ports->lbam_addr); | 126 | tf->hob_lbam = inb(io_ports->lbam_addr); |
127 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH) | 127 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH) |
128 | tf->hob_lbah = inb(io_ports->lbah_addr); | 128 | tf->hob_lbah = inb(io_ports->lbah_addr); |
129 | } | 129 | } |
130 | } | 130 | } |
@@ -143,13 +143,13 @@ static void mm_insw(unsigned long addr, void *buf, u32 len) | |||
143 | *bp = bswap(*(volatile u16 *)addr); | 143 | *bp = bswap(*(volatile u16 *)addr); |
144 | } | 144 | } |
145 | 145 | ||
146 | static void h8300_input_data(ide_drive_t *drive, struct request *rq, | 146 | static void h8300_input_data(ide_drive_t *drive, struct ide_cmd *cmd, |
147 | void *buf, unsigned int len) | 147 | void *buf, unsigned int len) |
148 | { | 148 | { |
149 | mm_insw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2); | 149 | mm_insw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2); |
150 | } | 150 | } |
151 | 151 | ||
152 | static void h8300_output_data(ide_drive_t *drive, struct request *rq, | 152 | static void h8300_output_data(ide_drive_t *drive, struct ide_cmd *cmd, |
153 | void *buf, unsigned int len) | 153 | void *buf, unsigned int len) |
154 | { | 154 | { |
155 | mm_outsw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2); | 155 | mm_outsw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2); |
diff --git a/drivers/ide/ide-io-std.c b/drivers/ide/ide-io-std.c index 45b43dd49cda..2d9c6dc3f956 100644 --- a/drivers/ide/ide-io-std.c +++ b/drivers/ide/ide-io-std.c | |||
@@ -2,6 +2,13 @@ | |||
2 | #include <linux/kernel.h> | 2 | #include <linux/kernel.h> |
3 | #include <linux/ide.h> | 3 | #include <linux/ide.h> |
4 | 4 | ||
5 | #if defined(CONFIG_ARM) || defined(CONFIG_M68K) || defined(CONFIG_MIPS) || \ | ||
6 | defined(CONFIG_PARISC) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) | ||
7 | #include <asm/ide.h> | ||
8 | #else | ||
9 | #include <asm-generic/ide_iops.h> | ||
10 | #endif | ||
11 | |||
5 | /* | 12 | /* |
6 | * Conventional PIO operations for ATA devices | 13 | * Conventional PIO operations for ATA devices |
7 | */ | 14 | */ |
@@ -75,24 +82,24 @@ void ide_set_irq(ide_hwif_t *hwif, int on) | |||
75 | } | 82 | } |
76 | EXPORT_SYMBOL_GPL(ide_set_irq); | 83 | EXPORT_SYMBOL_GPL(ide_set_irq); |
77 | 84 | ||
78 | void ide_tf_load(ide_drive_t *drive, ide_task_t *task) | 85 | void ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) |
79 | { | 86 | { |
80 | ide_hwif_t *hwif = drive->hwif; | 87 | ide_hwif_t *hwif = drive->hwif; |
81 | struct ide_io_ports *io_ports = &hwif->io_ports; | 88 | struct ide_io_ports *io_ports = &hwif->io_ports; |
82 | struct ide_taskfile *tf = &task->tf; | 89 | struct ide_taskfile *tf = &cmd->tf; |
83 | void (*tf_outb)(u8 addr, unsigned long port); | 90 | void (*tf_outb)(u8 addr, unsigned long port); |
84 | u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0; | 91 | u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0; |
85 | u8 HIHI = (task->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; | 92 | u8 HIHI = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; |
86 | 93 | ||
87 | if (mmio) | 94 | if (mmio) |
88 | tf_outb = ide_mm_outb; | 95 | tf_outb = ide_mm_outb; |
89 | else | 96 | else |
90 | tf_outb = ide_outb; | 97 | tf_outb = ide_outb; |
91 | 98 | ||
92 | if (task->tf_flags & IDE_TFLAG_FLAGGED) | 99 | if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) |
93 | HIHI = 0xFF; | 100 | HIHI = 0xFF; |
94 | 101 | ||
95 | if (task->tf_flags & IDE_TFLAG_OUT_DATA) { | 102 | if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) { |
96 | u16 data = (tf->hob_data << 8) | tf->data; | 103 | u16 data = (tf->hob_data << 8) | tf->data; |
97 | 104 | ||
98 | if (mmio) | 105 | if (mmio) |
@@ -101,39 +108,39 @@ void ide_tf_load(ide_drive_t *drive, ide_task_t *task) | |||
101 | outw(data, io_ports->data_addr); | 108 | outw(data, io_ports->data_addr); |
102 | } | 109 | } |
103 | 110 | ||
104 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) | 111 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) |
105 | tf_outb(tf->hob_feature, io_ports->feature_addr); | 112 | tf_outb(tf->hob_feature, io_ports->feature_addr); |
106 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) | 113 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) |
107 | tf_outb(tf->hob_nsect, io_ports->nsect_addr); | 114 | tf_outb(tf->hob_nsect, io_ports->nsect_addr); |
108 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) | 115 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) |
109 | tf_outb(tf->hob_lbal, io_ports->lbal_addr); | 116 | tf_outb(tf->hob_lbal, io_ports->lbal_addr); |
110 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) | 117 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) |
111 | tf_outb(tf->hob_lbam, io_ports->lbam_addr); | 118 | tf_outb(tf->hob_lbam, io_ports->lbam_addr); |
112 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) | 119 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) |
113 | tf_outb(tf->hob_lbah, io_ports->lbah_addr); | 120 | tf_outb(tf->hob_lbah, io_ports->lbah_addr); |
114 | 121 | ||
115 | if (task->tf_flags & IDE_TFLAG_OUT_FEATURE) | 122 | if (cmd->tf_flags & IDE_TFLAG_OUT_FEATURE) |
116 | tf_outb(tf->feature, io_ports->feature_addr); | 123 | tf_outb(tf->feature, io_ports->feature_addr); |
117 | if (task->tf_flags & IDE_TFLAG_OUT_NSECT) | 124 | if (cmd->tf_flags & IDE_TFLAG_OUT_NSECT) |
118 | tf_outb(tf->nsect, io_ports->nsect_addr); | 125 | tf_outb(tf->nsect, io_ports->nsect_addr); |
119 | if (task->tf_flags & IDE_TFLAG_OUT_LBAL) | 126 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAL) |
120 | tf_outb(tf->lbal, io_ports->lbal_addr); | 127 | tf_outb(tf->lbal, io_ports->lbal_addr); |
121 | if (task->tf_flags & IDE_TFLAG_OUT_LBAM) | 128 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAM) |
122 | tf_outb(tf->lbam, io_ports->lbam_addr); | 129 | tf_outb(tf->lbam, io_ports->lbam_addr); |
123 | if (task->tf_flags & IDE_TFLAG_OUT_LBAH) | 130 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAH) |
124 | tf_outb(tf->lbah, io_ports->lbah_addr); | 131 | tf_outb(tf->lbah, io_ports->lbah_addr); |
125 | 132 | ||
126 | if (task->tf_flags & IDE_TFLAG_OUT_DEVICE) | 133 | if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) |
127 | tf_outb((tf->device & HIHI) | drive->select, | 134 | tf_outb((tf->device & HIHI) | drive->select, |
128 | io_ports->device_addr); | 135 | io_ports->device_addr); |
129 | } | 136 | } |
130 | EXPORT_SYMBOL_GPL(ide_tf_load); | 137 | EXPORT_SYMBOL_GPL(ide_tf_load); |
131 | 138 | ||
132 | void ide_tf_read(ide_drive_t *drive, ide_task_t *task) | 139 | void ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) |
133 | { | 140 | { |
134 | ide_hwif_t *hwif = drive->hwif; | 141 | ide_hwif_t *hwif = drive->hwif; |
135 | struct ide_io_ports *io_ports = &hwif->io_ports; | 142 | struct ide_io_ports *io_ports = &hwif->io_ports; |
136 | struct ide_taskfile *tf = &task->tf; | 143 | struct ide_taskfile *tf = &cmd->tf; |
137 | void (*tf_outb)(u8 addr, unsigned long port); | 144 | void (*tf_outb)(u8 addr, unsigned long port); |
138 | u8 (*tf_inb)(unsigned long port); | 145 | u8 (*tf_inb)(unsigned long port); |
139 | u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0; | 146 | u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0; |
@@ -146,7 +153,7 @@ void ide_tf_read(ide_drive_t *drive, ide_task_t *task) | |||
146 | tf_inb = ide_inb; | 153 | tf_inb = ide_inb; |
147 | } | 154 | } |
148 | 155 | ||
149 | if (task->tf_flags & IDE_TFLAG_IN_DATA) { | 156 | if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) { |
150 | u16 data; | 157 | u16 data; |
151 | 158 | ||
152 | if (mmio) | 159 | if (mmio) |
@@ -161,31 +168,31 @@ void ide_tf_read(ide_drive_t *drive, ide_task_t *task) | |||
161 | /* be sure we're looking at the low order bits */ | 168 | /* be sure we're looking at the low order bits */ |
162 | tf_outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); | 169 | tf_outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); |
163 | 170 | ||
164 | if (task->tf_flags & IDE_TFLAG_IN_FEATURE) | 171 | if (cmd->tf_flags & IDE_TFLAG_IN_FEATURE) |
165 | tf->feature = tf_inb(io_ports->feature_addr); | 172 | tf->feature = tf_inb(io_ports->feature_addr); |
166 | if (task->tf_flags & IDE_TFLAG_IN_NSECT) | 173 | if (cmd->tf_flags & IDE_TFLAG_IN_NSECT) |
167 | tf->nsect = tf_inb(io_ports->nsect_addr); | 174 | tf->nsect = tf_inb(io_ports->nsect_addr); |
168 | if (task->tf_flags & IDE_TFLAG_IN_LBAL) | 175 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAL) |
169 | tf->lbal = tf_inb(io_ports->lbal_addr); | 176 | tf->lbal = tf_inb(io_ports->lbal_addr); |
170 | if (task->tf_flags & IDE_TFLAG_IN_LBAM) | 177 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAM) |
171 | tf->lbam = tf_inb(io_ports->lbam_addr); | 178 | tf->lbam = tf_inb(io_ports->lbam_addr); |
172 | if (task->tf_flags & IDE_TFLAG_IN_LBAH) | 179 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAH) |
173 | tf->lbah = tf_inb(io_ports->lbah_addr); | 180 | tf->lbah = tf_inb(io_ports->lbah_addr); |
174 | if (task->tf_flags & IDE_TFLAG_IN_DEVICE) | 181 | if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE) |
175 | tf->device = tf_inb(io_ports->device_addr); | 182 | tf->device = tf_inb(io_ports->device_addr); |
176 | 183 | ||
177 | if (task->tf_flags & IDE_TFLAG_LBA48) { | 184 | if (cmd->tf_flags & IDE_TFLAG_LBA48) { |
178 | tf_outb(ATA_DEVCTL_OBS | 0x80, io_ports->ctl_addr); | 185 | tf_outb(ATA_DEVCTL_OBS | 0x80, io_ports->ctl_addr); |
179 | 186 | ||
180 | if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) | 187 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) |
181 | tf->hob_feature = tf_inb(io_ports->feature_addr); | 188 | tf->hob_feature = tf_inb(io_ports->feature_addr); |
182 | if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT) | 189 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT) |
183 | tf->hob_nsect = tf_inb(io_ports->nsect_addr); | 190 | tf->hob_nsect = tf_inb(io_ports->nsect_addr); |
184 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL) | 191 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL) |
185 | tf->hob_lbal = tf_inb(io_ports->lbal_addr); | 192 | tf->hob_lbal = tf_inb(io_ports->lbal_addr); |
186 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM) | 193 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM) |
187 | tf->hob_lbam = tf_inb(io_ports->lbam_addr); | 194 | tf->hob_lbam = tf_inb(io_ports->lbam_addr); |
188 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH) | 195 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH) |
189 | tf->hob_lbah = tf_inb(io_ports->lbah_addr); | 196 | tf->hob_lbah = tf_inb(io_ports->lbah_addr); |
190 | } | 197 | } |
191 | } | 198 | } |
@@ -212,7 +219,7 @@ static void ata_vlb_sync(unsigned long port) | |||
212 | * so if an odd len is specified, be sure that there's at least one | 219 | * so if an odd len is specified, be sure that there's at least one |
213 | * extra byte allocated for the buffer. | 220 | * extra byte allocated for the buffer. |
214 | */ | 221 | */ |
215 | void ide_input_data(ide_drive_t *drive, struct request *rq, void *buf, | 222 | void ide_input_data(ide_drive_t *drive, struct ide_cmd *cmd, void *buf, |
216 | unsigned int len) | 223 | unsigned int len) |
217 | { | 224 | { |
218 | ide_hwif_t *hwif = drive->hwif; | 225 | ide_hwif_t *hwif = drive->hwif; |
@@ -258,7 +265,7 @@ EXPORT_SYMBOL_GPL(ide_input_data); | |||
258 | /* | 265 | /* |
259 | * This is used for most PIO data transfers *to* the IDE interface | 266 | * This is used for most PIO data transfers *to* the IDE interface |
260 | */ | 267 | */ |
261 | void ide_output_data(ide_drive_t *drive, struct request *rq, void *buf, | 268 | void ide_output_data(ide_drive_t *drive, struct ide_cmd *cmd, void *buf, |
262 | unsigned int len) | 269 | unsigned int len) |
263 | { | 270 | { |
264 | ide_hwif_t *hwif = drive->hwif; | 271 | ide_hwif_t *hwif = drive->hwif; |
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 2e92497b58aa..1adc5e2e7fb3 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -40,7 +40,6 @@ | |||
40 | #include <linux/pci.h> | 40 | #include <linux/pci.h> |
41 | #include <linux/delay.h> | 41 | #include <linux/delay.h> |
42 | #include <linux/ide.h> | 42 | #include <linux/ide.h> |
43 | #include <linux/hdreg.h> | ||
44 | #include <linux/completion.h> | 43 | #include <linux/completion.h> |
45 | #include <linux/reboot.h> | 44 | #include <linux/reboot.h> |
46 | #include <linux/cdrom.h> | 45 | #include <linux/cdrom.h> |
@@ -55,25 +54,9 @@ | |||
55 | #include <asm/uaccess.h> | 54 | #include <asm/uaccess.h> |
56 | #include <asm/io.h> | 55 | #include <asm/io.h> |
57 | 56 | ||
58 | static int __ide_end_request(ide_drive_t *drive, struct request *rq, | 57 | int ide_end_rq(ide_drive_t *drive, struct request *rq, int error, |
59 | int uptodate, unsigned int nr_bytes, int dequeue) | 58 | unsigned int nr_bytes) |
60 | { | 59 | { |
61 | int ret = 1; | ||
62 | int error = 0; | ||
63 | |||
64 | if (uptodate <= 0) | ||
65 | error = uptodate ? uptodate : -EIO; | ||
66 | |||
67 | /* | ||
68 | * if failfast is set on a request, override number of sectors and | ||
69 | * complete the whole request right now | ||
70 | */ | ||
71 | if (blk_noretry_request(rq) && error) | ||
72 | nr_bytes = rq->hard_nr_sectors << 9; | ||
73 | |||
74 | if (!blk_fs_request(rq) && error && !rq->errors) | ||
75 | rq->errors = -EIO; | ||
76 | |||
77 | /* | 60 | /* |
78 | * decide whether to reenable DMA -- 3 is a random magic for now, | 61 | * decide whether to reenable DMA -- 3 is a random magic for now, |
79 | * if we DMA timeout more than 3 times, just stay in PIO | 62 | * if we DMA timeout more than 3 times, just stay in PIO |
@@ -84,127 +67,86 @@ static int __ide_end_request(ide_drive_t *drive, struct request *rq, | |||
84 | ide_dma_on(drive); | 67 | ide_dma_on(drive); |
85 | } | 68 | } |
86 | 69 | ||
87 | if (!blk_end_request(rq, error, nr_bytes)) | 70 | return blk_end_request(rq, error, nr_bytes); |
88 | ret = 0; | ||
89 | |||
90 | if (ret == 0 && dequeue) | ||
91 | drive->hwif->rq = NULL; | ||
92 | |||
93 | return ret; | ||
94 | } | 71 | } |
72 | EXPORT_SYMBOL_GPL(ide_end_rq); | ||
95 | 73 | ||
96 | /** | 74 | void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err) |
97 | * ide_end_request - complete an IDE I/O | ||
98 | * @drive: IDE device for the I/O | ||
99 | * @uptodate: | ||
100 | * @nr_sectors: number of sectors completed | ||
101 | * | ||
102 | * This is our end_request wrapper function. We complete the I/O | ||
103 | * update random number input and dequeue the request, which if | ||
104 | * it was tagged may be out of order. | ||
105 | */ | ||
106 | |||
107 | int ide_end_request (ide_drive_t *drive, int uptodate, int nr_sectors) | ||
108 | { | 75 | { |
109 | unsigned int nr_bytes = nr_sectors << 9; | 76 | struct ide_taskfile *tf = &cmd->tf; |
110 | struct request *rq = drive->hwif->rq; | 77 | struct request *rq = cmd->rq; |
111 | 78 | u8 tf_cmd = tf->command; | |
112 | if (!nr_bytes) { | 79 | |
113 | if (blk_pc_request(rq)) | 80 | tf->error = err; |
114 | nr_bytes = rq->data_len; | 81 | tf->status = stat; |
115 | else | 82 | |
116 | nr_bytes = rq->hard_cur_sectors << 9; | 83 | drive->hwif->tp_ops->tf_read(drive, cmd); |
84 | |||
85 | if ((cmd->tf_flags & IDE_TFLAG_CUSTOM_HANDLER) && | ||
86 | tf_cmd == ATA_CMD_IDLEIMMEDIATE) { | ||
87 | if (tf->lbal != 0xc4) { | ||
88 | printk(KERN_ERR "%s: head unload failed!\n", | ||
89 | drive->name); | ||
90 | ide_tf_dump(drive->name, tf); | ||
91 | } else | ||
92 | drive->dev_flags |= IDE_DFLAG_PARKED; | ||
117 | } | 93 | } |
118 | 94 | ||
119 | return __ide_end_request(drive, rq, uptodate, nr_bytes, 1); | 95 | if (rq && rq->cmd_type == REQ_TYPE_ATA_TASKFILE) |
120 | } | 96 | memcpy(rq->special, cmd, sizeof(*cmd)); |
121 | EXPORT_SYMBOL(ide_end_request); | ||
122 | 97 | ||
123 | /** | 98 | if (cmd->tf_flags & IDE_TFLAG_DYN) |
124 | * ide_end_dequeued_request - complete an IDE I/O | 99 | kfree(cmd); |
125 | * @drive: IDE device for the I/O | 100 | } |
126 | * @uptodate: | ||
127 | * @nr_sectors: number of sectors completed | ||
128 | * | ||
129 | * Complete an I/O that is no longer on the request queue. This | ||
130 | * typically occurs when we pull the request and issue a REQUEST_SENSE. | ||
131 | * We must still finish the old request but we must not tamper with the | ||
132 | * queue in the meantime. | ||
133 | * | ||
134 | * NOTE: This path does not handle barrier, but barrier is not supported | ||
135 | * on ide-cd anyway. | ||
136 | */ | ||
137 | 101 | ||
138 | int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, | 102 | /* obsolete, blk_rq_bytes() should be used instead */ |
139 | int uptodate, int nr_sectors) | 103 | unsigned int ide_rq_bytes(struct request *rq) |
140 | { | 104 | { |
141 | BUG_ON(!blk_rq_started(rq)); | 105 | if (blk_pc_request(rq)) |
142 | 106 | return rq->data_len; | |
143 | return __ide_end_request(drive, rq, uptodate, nr_sectors << 9, 0); | 107 | else |
108 | return rq->hard_cur_sectors << 9; | ||
144 | } | 109 | } |
145 | EXPORT_SYMBOL_GPL(ide_end_dequeued_request); | 110 | EXPORT_SYMBOL_GPL(ide_rq_bytes); |
146 | 111 | ||
147 | /** | 112 | int ide_complete_rq(ide_drive_t *drive, int error, unsigned int nr_bytes) |
148 | * ide_end_drive_cmd - end an explicit drive command | ||
149 | * @drive: command | ||
150 | * @stat: status bits | ||
151 | * @err: error bits | ||
152 | * | ||
153 | * Clean up after success/failure of an explicit drive command. | ||
154 | * These get thrown onto the queue so they are synchronized with | ||
155 | * real I/O operations on the drive. | ||
156 | * | ||
157 | * In LBA48 mode we have to read the register set twice to get | ||
158 | * all the extra information out. | ||
159 | */ | ||
160 | |||
161 | void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err) | ||
162 | { | 113 | { |
163 | ide_hwif_t *hwif = drive->hwif; | 114 | ide_hwif_t *hwif = drive->hwif; |
164 | struct request *rq = hwif->rq; | 115 | struct request *rq = hwif->rq; |
116 | int rc; | ||
165 | 117 | ||
166 | if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { | 118 | /* |
167 | ide_task_t *task = (ide_task_t *)rq->special; | 119 | * if failfast is set on a request, override number of sectors |
168 | 120 | * and complete the whole request right now | |
169 | if (task) { | 121 | */ |
170 | struct ide_taskfile *tf = &task->tf; | 122 | if (blk_noretry_request(rq) && error <= 0) |
171 | 123 | nr_bytes = rq->hard_nr_sectors << 9; | |
172 | tf->error = err; | ||
173 | tf->status = stat; | ||
174 | |||
175 | drive->hwif->tp_ops->tf_read(drive, task); | ||
176 | |||
177 | if (task->tf_flags & IDE_TFLAG_DYN) | ||
178 | kfree(task); | ||
179 | } | ||
180 | } else if (blk_pm_request(rq)) { | ||
181 | struct request_pm_state *pm = rq->data; | ||
182 | |||
183 | ide_complete_power_step(drive, rq); | ||
184 | if (pm->pm_step == IDE_PM_COMPLETED) | ||
185 | ide_complete_pm_request(drive, rq); | ||
186 | return; | ||
187 | } | ||
188 | |||
189 | hwif->rq = NULL; | ||
190 | 124 | ||
191 | rq->errors = err; | 125 | rc = ide_end_rq(drive, rq, error, nr_bytes); |
126 | if (rc == 0) | ||
127 | hwif->rq = NULL; | ||
192 | 128 | ||
193 | if (unlikely(blk_end_request(rq, (rq->errors ? -EIO : 0), | 129 | return rc; |
194 | blk_rq_bytes(rq)))) | ||
195 | BUG(); | ||
196 | } | 130 | } |
197 | EXPORT_SYMBOL(ide_end_drive_cmd); | 131 | EXPORT_SYMBOL(ide_complete_rq); |
198 | 132 | ||
199 | void ide_kill_rq(ide_drive_t *drive, struct request *rq) | 133 | void ide_kill_rq(ide_drive_t *drive, struct request *rq) |
200 | { | 134 | { |
201 | if (rq->rq_disk) { | 135 | u8 drv_req = blk_special_request(rq) && rq->rq_disk; |
202 | struct ide_driver *drv; | 136 | u8 media = drive->media; |
203 | 137 | ||
204 | drv = *(struct ide_driver **)rq->rq_disk->private_data; | 138 | drive->failed_pc = NULL; |
205 | drv->end_request(drive, 0, 0); | 139 | |
206 | } else | 140 | if ((media == ide_floppy || media == ide_tape) && drv_req) { |
207 | ide_end_request(drive, 0, 0); | 141 | rq->errors = 0; |
142 | ide_complete_rq(drive, 0, blk_rq_bytes(rq)); | ||
143 | } else { | ||
144 | if (media == ide_tape) | ||
145 | rq->errors = IDE_DRV_ERROR_GENERAL; | ||
146 | else if (blk_fs_request(rq) == 0 && rq->errors == 0) | ||
147 | rq->errors = -EIO; | ||
148 | ide_complete_rq(drive, -EIO, ide_rq_bytes(rq)); | ||
149 | } | ||
208 | } | 150 | } |
209 | 151 | ||
210 | static void ide_tf_set_specify_cmd(ide_drive_t *drive, struct ide_taskfile *tf) | 152 | static void ide_tf_set_specify_cmd(ide_drive_t *drive, struct ide_taskfile *tf) |
@@ -232,20 +174,20 @@ static void ide_tf_set_setmult_cmd(ide_drive_t *drive, struct ide_taskfile *tf) | |||
232 | static ide_startstop_t ide_disk_special(ide_drive_t *drive) | 174 | static ide_startstop_t ide_disk_special(ide_drive_t *drive) |
233 | { | 175 | { |
234 | special_t *s = &drive->special; | 176 | special_t *s = &drive->special; |
235 | ide_task_t args; | 177 | struct ide_cmd cmd; |
236 | 178 | ||
237 | memset(&args, 0, sizeof(ide_task_t)); | 179 | memset(&cmd, 0, sizeof(cmd)); |
238 | args.data_phase = TASKFILE_NO_DATA; | 180 | cmd.protocol = ATA_PROT_NODATA; |
239 | 181 | ||
240 | if (s->b.set_geometry) { | 182 | if (s->b.set_geometry) { |
241 | s->b.set_geometry = 0; | 183 | s->b.set_geometry = 0; |
242 | ide_tf_set_specify_cmd(drive, &args.tf); | 184 | ide_tf_set_specify_cmd(drive, &cmd.tf); |
243 | } else if (s->b.recalibrate) { | 185 | } else if (s->b.recalibrate) { |
244 | s->b.recalibrate = 0; | 186 | s->b.recalibrate = 0; |
245 | ide_tf_set_restore_cmd(drive, &args.tf); | 187 | ide_tf_set_restore_cmd(drive, &cmd.tf); |
246 | } else if (s->b.set_multmode) { | 188 | } else if (s->b.set_multmode) { |
247 | s->b.set_multmode = 0; | 189 | s->b.set_multmode = 0; |
248 | ide_tf_set_setmult_cmd(drive, &args.tf); | 190 | ide_tf_set_setmult_cmd(drive, &cmd.tf); |
249 | } else if (s->all) { | 191 | } else if (s->all) { |
250 | int special = s->all; | 192 | int special = s->all; |
251 | s->all = 0; | 193 | s->all = 0; |
@@ -253,10 +195,10 @@ static ide_startstop_t ide_disk_special(ide_drive_t *drive) | |||
253 | return ide_stopped; | 195 | return ide_stopped; |
254 | } | 196 | } |
255 | 197 | ||
256 | args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE | | 198 | cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE | |
257 | IDE_TFLAG_CUSTOM_HANDLER; | 199 | IDE_TFLAG_CUSTOM_HANDLER; |
258 | 200 | ||
259 | do_rw_taskfile(drive, &args); | 201 | do_rw_taskfile(drive, &cmd); |
260 | 202 | ||
261 | return ide_started; | 203 | return ide_started; |
262 | } | 204 | } |
@@ -286,33 +228,29 @@ static ide_startstop_t do_special (ide_drive_t *drive) | |||
286 | return ide_stopped; | 228 | return ide_stopped; |
287 | } | 229 | } |
288 | 230 | ||
289 | void ide_map_sg(ide_drive_t *drive, struct request *rq) | 231 | void ide_map_sg(ide_drive_t *drive, struct ide_cmd *cmd) |
290 | { | 232 | { |
291 | ide_hwif_t *hwif = drive->hwif; | 233 | ide_hwif_t *hwif = drive->hwif; |
292 | struct scatterlist *sg = hwif->sg_table; | 234 | struct scatterlist *sg = hwif->sg_table; |
235 | struct request *rq = cmd->rq; | ||
293 | 236 | ||
294 | if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { | 237 | if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { |
295 | sg_init_one(sg, rq->buffer, rq->nr_sectors * SECTOR_SIZE); | 238 | sg_init_one(sg, rq->buffer, rq->nr_sectors * SECTOR_SIZE); |
296 | hwif->sg_nents = 1; | 239 | cmd->sg_nents = 1; |
297 | } else if (!rq->bio) { | 240 | } else if (!rq->bio) { |
298 | sg_init_one(sg, rq->data, rq->data_len); | 241 | sg_init_one(sg, rq->data, rq->data_len); |
299 | hwif->sg_nents = 1; | 242 | cmd->sg_nents = 1; |
300 | } else { | 243 | } else |
301 | hwif->sg_nents = blk_rq_map_sg(drive->queue, rq, sg); | 244 | cmd->sg_nents = blk_rq_map_sg(drive->queue, rq, sg); |
302 | } | ||
303 | } | 245 | } |
304 | |||
305 | EXPORT_SYMBOL_GPL(ide_map_sg); | 246 | EXPORT_SYMBOL_GPL(ide_map_sg); |
306 | 247 | ||
307 | void ide_init_sg_cmd(ide_drive_t *drive, struct request *rq) | 248 | void ide_init_sg_cmd(struct ide_cmd *cmd, unsigned int nr_bytes) |
308 | { | 249 | { |
309 | ide_hwif_t *hwif = drive->hwif; | 250 | cmd->nbytes = cmd->nleft = nr_bytes; |
310 | 251 | cmd->cursg_ofs = 0; | |
311 | hwif->nsect = hwif->nleft = rq->nr_sectors; | 252 | cmd->cursg = NULL; |
312 | hwif->cursg_ofs = 0; | ||
313 | hwif->cursg = NULL; | ||
314 | } | 253 | } |
315 | |||
316 | EXPORT_SYMBOL_GPL(ide_init_sg_cmd); | 254 | EXPORT_SYMBOL_GPL(ide_init_sg_cmd); |
317 | 255 | ||
318 | /** | 256 | /** |
@@ -330,24 +268,15 @@ EXPORT_SYMBOL_GPL(ide_init_sg_cmd); | |||
330 | static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, | 268 | static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, |
331 | struct request *rq) | 269 | struct request *rq) |
332 | { | 270 | { |
333 | ide_hwif_t *hwif = drive->hwif; | 271 | struct ide_cmd *cmd = rq->special; |
334 | ide_task_t *task = rq->special; | 272 | |
335 | 273 | if (cmd) { | |
336 | if (task) { | 274 | if (cmd->protocol == ATA_PROT_PIO) { |
337 | hwif->data_phase = task->data_phase; | 275 | ide_init_sg_cmd(cmd, rq->nr_sectors << 9); |
338 | 276 | ide_map_sg(drive, cmd); | |
339 | switch (hwif->data_phase) { | ||
340 | case TASKFILE_MULTI_OUT: | ||
341 | case TASKFILE_OUT: | ||
342 | case TASKFILE_MULTI_IN: | ||
343 | case TASKFILE_IN: | ||
344 | ide_init_sg_cmd(drive, rq); | ||
345 | ide_map_sg(drive, rq); | ||
346 | default: | ||
347 | break; | ||
348 | } | 277 | } |
349 | 278 | ||
350 | return do_rw_taskfile(drive, task); | 279 | return do_rw_taskfile(drive, cmd); |
351 | } | 280 | } |
352 | 281 | ||
353 | /* | 282 | /* |
@@ -357,8 +286,8 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, | |||
357 | #ifdef DEBUG | 286 | #ifdef DEBUG |
358 | printk("%s: DRIVE_CMD (null)\n", drive->name); | 287 | printk("%s: DRIVE_CMD (null)\n", drive->name); |
359 | #endif | 288 | #endif |
360 | ide_end_drive_cmd(drive, hwif->tp_ops->read_status(hwif), | 289 | rq->errors = 0; |
361 | ide_read_error(drive)); | 290 | ide_complete_rq(drive, 0, blk_rq_bytes(rq)); |
362 | 291 | ||
363 | return ide_stopped; | 292 | return ide_stopped; |
364 | } | 293 | } |
@@ -376,9 +305,7 @@ static ide_startstop_t ide_special_rq(ide_drive_t *drive, struct request *rq) | |||
376 | case REQ_DRIVE_RESET: | 305 | case REQ_DRIVE_RESET: |
377 | return ide_do_reset(drive); | 306 | return ide_do_reset(drive); |
378 | default: | 307 | default: |
379 | blk_dump_rq_flags(rq, "ide_special_rq - bad request"); | 308 | BUG(); |
380 | ide_end_request(drive, 0, 0); | ||
381 | return ide_stopped; | ||
382 | } | 309 | } |
383 | } | 310 | } |
384 | 311 | ||
@@ -438,7 +365,7 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq) | |||
438 | startstop = ide_start_power_step(drive, rq); | 365 | startstop = ide_start_power_step(drive, rq); |
439 | if (startstop == ide_stopped && | 366 | if (startstop == ide_stopped && |
440 | pm->pm_step == IDE_PM_COMPLETED) | 367 | pm->pm_step == IDE_PM_COMPLETED) |
441 | ide_complete_pm_request(drive, rq); | 368 | ide_complete_pm_rq(drive, rq); |
442 | return startstop; | 369 | return startstop; |
443 | } else if (!rq->rq_disk && blk_special_request(rq)) | 370 | } else if (!rq->rq_disk && blk_special_request(rq)) |
444 | /* | 371 | /* |
@@ -501,8 +428,8 @@ static inline int ide_lock_host(struct ide_host *host, ide_hwif_t *hwif) | |||
501 | if (host->host_flags & IDE_HFLAG_SERIALIZE) { | 428 | if (host->host_flags & IDE_HFLAG_SERIALIZE) { |
502 | rc = test_and_set_bit_lock(IDE_HOST_BUSY, &host->host_busy); | 429 | rc = test_and_set_bit_lock(IDE_HOST_BUSY, &host->host_busy); |
503 | if (rc == 0) { | 430 | if (rc == 0) { |
504 | /* for atari only */ | 431 | if (host->get_lock) |
505 | ide_get_lock(ide_intr, hwif); | 432 | host->get_lock(ide_intr, hwif); |
506 | } | 433 | } |
507 | } | 434 | } |
508 | return rc; | 435 | return rc; |
@@ -511,8 +438,8 @@ static inline int ide_lock_host(struct ide_host *host, ide_hwif_t *hwif) | |||
511 | static inline void ide_unlock_host(struct ide_host *host) | 438 | static inline void ide_unlock_host(struct ide_host *host) |
512 | { | 439 | { |
513 | if (host->host_flags & IDE_HFLAG_SERIALIZE) { | 440 | if (host->host_flags & IDE_HFLAG_SERIALIZE) { |
514 | /* for atari only */ | 441 | if (host->release_lock) |
515 | ide_release_lock(); | 442 | host->release_lock(); |
516 | clear_bit_unlock(IDE_HOST_BUSY, &host->host_busy); | 443 | clear_bit_unlock(IDE_HOST_BUSY, &host->host_busy); |
517 | } | 444 | } |
518 | } | 445 | } |
@@ -724,6 +651,7 @@ void ide_timer_expiry (unsigned long data) | |||
724 | } | 651 | } |
725 | } | 652 | } |
726 | hwif->handler = NULL; | 653 | hwif->handler = NULL; |
654 | hwif->expiry = NULL; | ||
727 | /* | 655 | /* |
728 | * We need to simulate a real interrupt when invoking | 656 | * We need to simulate a real interrupt when invoking |
729 | * the handler() function, which means we need to | 657 | * the handler() function, which means we need to |
@@ -739,7 +667,8 @@ void ide_timer_expiry (unsigned long data) | |||
739 | } else if (drive_is_ready(drive)) { | 667 | } else if (drive_is_ready(drive)) { |
740 | if (drive->waiting_for_dma) | 668 | if (drive->waiting_for_dma) |
741 | hwif->dma_ops->dma_lost_irq(drive); | 669 | hwif->dma_ops->dma_lost_irq(drive); |
742 | (void)ide_ack_intr(hwif); | 670 | if (hwif->ack_intr) |
671 | hwif->ack_intr(hwif); | ||
743 | printk(KERN_WARNING "%s: lost interrupt\n", | 672 | printk(KERN_WARNING "%s: lost interrupt\n", |
744 | drive->name); | 673 | drive->name); |
745 | startstop = handler(drive); | 674 | startstop = handler(drive); |
@@ -840,6 +769,7 @@ static void unexpected_intr(int irq, ide_hwif_t *hwif) | |||
840 | irqreturn_t ide_intr (int irq, void *dev_id) | 769 | irqreturn_t ide_intr (int irq, void *dev_id) |
841 | { | 770 | { |
842 | ide_hwif_t *hwif = (ide_hwif_t *)dev_id; | 771 | ide_hwif_t *hwif = (ide_hwif_t *)dev_id; |
772 | struct ide_host *host = hwif->host; | ||
843 | ide_drive_t *uninitialized_var(drive); | 773 | ide_drive_t *uninitialized_var(drive); |
844 | ide_handler_t *handler; | 774 | ide_handler_t *handler; |
845 | unsigned long flags; | 775 | unsigned long flags; |
@@ -847,14 +777,14 @@ irqreturn_t ide_intr (int irq, void *dev_id) | |||
847 | irqreturn_t irq_ret = IRQ_NONE; | 777 | irqreturn_t irq_ret = IRQ_NONE; |
848 | int plug_device = 0; | 778 | int plug_device = 0; |
849 | 779 | ||
850 | if (hwif->host->host_flags & IDE_HFLAG_SERIALIZE) { | 780 | if (host->host_flags & IDE_HFLAG_SERIALIZE) { |
851 | if (hwif != hwif->host->cur_port) | 781 | if (hwif != host->cur_port) |
852 | goto out_early; | 782 | goto out_early; |
853 | } | 783 | } |
854 | 784 | ||
855 | spin_lock_irqsave(&hwif->lock, flags); | 785 | spin_lock_irqsave(&hwif->lock, flags); |
856 | 786 | ||
857 | if (!ide_ack_intr(hwif)) | 787 | if (hwif->ack_intr && hwif->ack_intr(hwif) == 0) |
858 | goto out; | 788 | goto out; |
859 | 789 | ||
860 | handler = hwif->handler; | 790 | handler = hwif->handler; |
@@ -871,27 +801,19 @@ irqreturn_t ide_intr (int irq, void *dev_id) | |||
871 | * | 801 | * |
872 | * For PCI, we cannot tell the difference, | 802 | * For PCI, we cannot tell the difference, |
873 | * so in that case we just ignore it and hope it goes away. | 803 | * so in that case we just ignore it and hope it goes away. |
874 | * | ||
875 | * FIXME: unexpected_intr should be hwif-> then we can | ||
876 | * remove all the ifdef PCI crap | ||
877 | */ | 804 | */ |
878 | #ifdef CONFIG_BLK_DEV_IDEPCI | 805 | if ((host->irq_flags & IRQF_SHARED) == 0) { |
879 | if (hwif->chipset != ide_pci) | ||
880 | #endif /* CONFIG_BLK_DEV_IDEPCI */ | ||
881 | { | ||
882 | /* | 806 | /* |
883 | * Probably not a shared PCI interrupt, | 807 | * Probably not a shared PCI interrupt, |
884 | * so we can safely try to do something about it: | 808 | * so we can safely try to do something about it: |
885 | */ | 809 | */ |
886 | unexpected_intr(irq, hwif); | 810 | unexpected_intr(irq, hwif); |
887 | #ifdef CONFIG_BLK_DEV_IDEPCI | ||
888 | } else { | 811 | } else { |
889 | /* | 812 | /* |
890 | * Whack the status register, just in case | 813 | * Whack the status register, just in case |
891 | * we have a leftover pending IRQ. | 814 | * we have a leftover pending IRQ. |
892 | */ | 815 | */ |
893 | (void)hwif->tp_ops->read_status(hwif); | 816 | (void)hwif->tp_ops->read_status(hwif); |
894 | #endif /* CONFIG_BLK_DEV_IDEPCI */ | ||
895 | } | 817 | } |
896 | goto out; | 818 | goto out; |
897 | } | 819 | } |
@@ -909,6 +831,7 @@ irqreturn_t ide_intr (int irq, void *dev_id) | |||
909 | goto out; | 831 | goto out; |
910 | 832 | ||
911 | hwif->handler = NULL; | 833 | hwif->handler = NULL; |
834 | hwif->expiry = NULL; | ||
912 | hwif->req_gen++; | 835 | hwif->req_gen++; |
913 | del_timer(&hwif->timer); | 836 | del_timer(&hwif->timer); |
914 | spin_unlock(&hwif->lock); | 837 | spin_unlock(&hwif->lock); |
diff --git a/drivers/ide/ide-ioctls.c b/drivers/ide/ide-ioctls.c index 1be263eb9c07..770142767437 100644 --- a/drivers/ide/ide-ioctls.c +++ b/drivers/ide/ide-ioctls.c | |||
@@ -111,13 +111,13 @@ static int ide_set_nice_ioctl(ide_drive_t *drive, unsigned long arg) | |||
111 | return 0; | 111 | return 0; |
112 | } | 112 | } |
113 | 113 | ||
114 | static int ide_cmd_ioctl(ide_drive_t *drive, unsigned cmd, unsigned long arg) | 114 | static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg) |
115 | { | 115 | { |
116 | u8 *buf = NULL; | 116 | u8 *buf = NULL; |
117 | int bufsize = 0, err = 0; | 117 | int bufsize = 0, err = 0; |
118 | u8 args[4], xfer_rate = 0; | 118 | u8 args[4], xfer_rate = 0; |
119 | ide_task_t tfargs; | 119 | struct ide_cmd cmd; |
120 | struct ide_taskfile *tf = &tfargs.tf; | 120 | struct ide_taskfile *tf = &cmd.tf; |
121 | u16 *id = drive->id; | 121 | u16 *id = drive->id; |
122 | 122 | ||
123 | if (NULL == (void *) arg) { | 123 | if (NULL == (void *) arg) { |
@@ -134,24 +134,24 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned cmd, unsigned long arg) | |||
134 | if (copy_from_user(args, (void __user *)arg, 4)) | 134 | if (copy_from_user(args, (void __user *)arg, 4)) |
135 | return -EFAULT; | 135 | return -EFAULT; |
136 | 136 | ||
137 | memset(&tfargs, 0, sizeof(ide_task_t)); | 137 | memset(&cmd, 0, sizeof(cmd)); |
138 | tf->feature = args[2]; | 138 | tf->feature = args[2]; |
139 | if (args[0] == ATA_CMD_SMART) { | 139 | if (args[0] == ATA_CMD_SMART) { |
140 | tf->nsect = args[3]; | 140 | tf->nsect = args[3]; |
141 | tf->lbal = args[1]; | 141 | tf->lbal = args[1]; |
142 | tf->lbam = 0x4f; | 142 | tf->lbam = 0x4f; |
143 | tf->lbah = 0xc2; | 143 | tf->lbah = 0xc2; |
144 | tfargs.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_IN_NSECT; | 144 | cmd.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_IN_NSECT; |
145 | } else { | 145 | } else { |
146 | tf->nsect = args[1]; | 146 | tf->nsect = args[1]; |
147 | tfargs.tf_flags = IDE_TFLAG_OUT_FEATURE | | 147 | cmd.tf_flags = IDE_TFLAG_OUT_FEATURE | IDE_TFLAG_OUT_NSECT | |
148 | IDE_TFLAG_OUT_NSECT | IDE_TFLAG_IN_NSECT; | 148 | IDE_TFLAG_IN_NSECT; |
149 | } | 149 | } |
150 | tf->command = args[0]; | 150 | tf->command = args[0]; |
151 | tfargs.data_phase = args[3] ? TASKFILE_IN : TASKFILE_NO_DATA; | 151 | cmd.protocol = args[3] ? ATA_PROT_PIO : ATA_PROT_NODATA; |
152 | 152 | ||
153 | if (args[3]) { | 153 | if (args[3]) { |
154 | tfargs.tf_flags |= IDE_TFLAG_IO_16BIT; | 154 | cmd.tf_flags |= IDE_TFLAG_IO_16BIT; |
155 | bufsize = SECTOR_SIZE * args[3]; | 155 | bufsize = SECTOR_SIZE * args[3]; |
156 | buf = kzalloc(bufsize, GFP_KERNEL); | 156 | buf = kzalloc(bufsize, GFP_KERNEL); |
157 | if (buf == NULL) | 157 | if (buf == NULL) |
@@ -172,7 +172,7 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned cmd, unsigned long arg) | |||
172 | } | 172 | } |
173 | } | 173 | } |
174 | 174 | ||
175 | err = ide_raw_taskfile(drive, &tfargs, buf, args[3]); | 175 | err = ide_raw_taskfile(drive, &cmd, buf, args[3]); |
176 | 176 | ||
177 | args[0] = tf->status; | 177 | args[0] = tf->status; |
178 | args[1] = tf->error; | 178 | args[1] = tf->error; |
@@ -194,25 +194,25 @@ abort: | |||
194 | return err; | 194 | return err; |
195 | } | 195 | } |
196 | 196 | ||
197 | static int ide_task_ioctl(ide_drive_t *drive, unsigned cmd, unsigned long arg) | 197 | static int ide_task_ioctl(ide_drive_t *drive, unsigned long arg) |
198 | { | 198 | { |
199 | void __user *p = (void __user *)arg; | 199 | void __user *p = (void __user *)arg; |
200 | int err = 0; | 200 | int err = 0; |
201 | u8 args[7]; | 201 | u8 args[7]; |
202 | ide_task_t task; | 202 | struct ide_cmd cmd; |
203 | 203 | ||
204 | if (copy_from_user(args, p, 7)) | 204 | if (copy_from_user(args, p, 7)) |
205 | return -EFAULT; | 205 | return -EFAULT; |
206 | 206 | ||
207 | memset(&task, 0, sizeof(task)); | 207 | memset(&cmd, 0, sizeof(cmd)); |
208 | memcpy(&task.tf_array[7], &args[1], 6); | 208 | memcpy(&cmd.tf_array[7], &args[1], 6); |
209 | task.tf.command = args[0]; | 209 | cmd.tf.command = args[0]; |
210 | task.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; | 210 | cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; |
211 | 211 | ||
212 | err = ide_no_data_taskfile(drive, &task); | 212 | err = ide_no_data_taskfile(drive, &cmd); |
213 | 213 | ||
214 | args[0] = task.tf.command; | 214 | args[0] = cmd.tf.command; |
215 | memcpy(&args[1], &task.tf_array[7], 6); | 215 | memcpy(&args[1], &cmd.tf_array[7], 6); |
216 | 216 | ||
217 | if (copy_to_user(p, args, 7)) | 217 | if (copy_to_user(p, args, 7)) |
218 | err = -EFAULT; | 218 | err = -EFAULT; |
@@ -262,17 +262,17 @@ int generic_ide_ioctl(ide_drive_t *drive, struct block_device *bdev, | |||
262 | if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO)) | 262 | if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO)) |
263 | return -EACCES; | 263 | return -EACCES; |
264 | if (drive->media == ide_disk) | 264 | if (drive->media == ide_disk) |
265 | return ide_taskfile_ioctl(drive, cmd, arg); | 265 | return ide_taskfile_ioctl(drive, arg); |
266 | return -ENOMSG; | 266 | return -ENOMSG; |
267 | #endif | 267 | #endif |
268 | case HDIO_DRIVE_CMD: | 268 | case HDIO_DRIVE_CMD: |
269 | if (!capable(CAP_SYS_RAWIO)) | 269 | if (!capable(CAP_SYS_RAWIO)) |
270 | return -EACCES; | 270 | return -EACCES; |
271 | return ide_cmd_ioctl(drive, cmd, arg); | 271 | return ide_cmd_ioctl(drive, arg); |
272 | case HDIO_DRIVE_TASK: | 272 | case HDIO_DRIVE_TASK: |
273 | if (!capable(CAP_SYS_RAWIO)) | 273 | if (!capable(CAP_SYS_RAWIO)) |
274 | return -EACCES; | 274 | return -EACCES; |
275 | return ide_task_ioctl(drive, cmd, arg); | 275 | return ide_task_ioctl(drive, arg); |
276 | case HDIO_DRIVE_RESET: | 276 | case HDIO_DRIVE_RESET: |
277 | if (!capable(CAP_SYS_ADMIN)) | 277 | if (!capable(CAP_SYS_ADMIN)) |
278 | return -EACCES; | 278 | return -EACCES; |
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index 317c5dadd7c0..5403e4a44be4 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
@@ -31,15 +31,15 @@ void SELECT_DRIVE(ide_drive_t *drive) | |||
31 | { | 31 | { |
32 | ide_hwif_t *hwif = drive->hwif; | 32 | ide_hwif_t *hwif = drive->hwif; |
33 | const struct ide_port_ops *port_ops = hwif->port_ops; | 33 | const struct ide_port_ops *port_ops = hwif->port_ops; |
34 | ide_task_t task; | 34 | struct ide_cmd cmd; |
35 | 35 | ||
36 | if (port_ops && port_ops->selectproc) | 36 | if (port_ops && port_ops->selectproc) |
37 | port_ops->selectproc(drive); | 37 | port_ops->selectproc(drive); |
38 | 38 | ||
39 | memset(&task, 0, sizeof(task)); | 39 | memset(&cmd, 0, sizeof(cmd)); |
40 | task.tf_flags = IDE_TFLAG_OUT_DEVICE; | 40 | cmd.tf_flags = IDE_TFLAG_OUT_DEVICE; |
41 | 41 | ||
42 | drive->hwif->tp_ops->tf_load(drive, &task); | 42 | drive->hwif->tp_ops->tf_load(drive, &cmd); |
43 | } | 43 | } |
44 | 44 | ||
45 | void SELECT_MASK(ide_drive_t *drive, int mask) | 45 | void SELECT_MASK(ide_drive_t *drive, int mask) |
@@ -52,14 +52,14 @@ void SELECT_MASK(ide_drive_t *drive, int mask) | |||
52 | 52 | ||
53 | u8 ide_read_error(ide_drive_t *drive) | 53 | u8 ide_read_error(ide_drive_t *drive) |
54 | { | 54 | { |
55 | ide_task_t task; | 55 | struct ide_cmd cmd; |
56 | 56 | ||
57 | memset(&task, 0, sizeof(task)); | 57 | memset(&cmd, 0, sizeof(cmd)); |
58 | task.tf_flags = IDE_TFLAG_IN_FEATURE; | 58 | cmd.tf_flags = IDE_TFLAG_IN_FEATURE; |
59 | 59 | ||
60 | drive->hwif->tp_ops->tf_read(drive, &task); | 60 | drive->hwif->tp_ops->tf_read(drive, &cmd); |
61 | 61 | ||
62 | return task.tf.error; | 62 | return cmd.tf.error; |
63 | } | 63 | } |
64 | EXPORT_SYMBOL_GPL(ide_read_error); | 64 | EXPORT_SYMBOL_GPL(ide_read_error); |
65 | 65 | ||
@@ -329,7 +329,7 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed) | |||
329 | u16 *id = drive->id, i; | 329 | u16 *id = drive->id, i; |
330 | int error = 0; | 330 | int error = 0; |
331 | u8 stat; | 331 | u8 stat; |
332 | ide_task_t task; | 332 | struct ide_cmd cmd; |
333 | 333 | ||
334 | #ifdef CONFIG_BLK_DEV_IDEDMA | 334 | #ifdef CONFIG_BLK_DEV_IDEDMA |
335 | if (hwif->dma_ops) /* check if host supports DMA */ | 335 | if (hwif->dma_ops) /* check if host supports DMA */ |
@@ -361,12 +361,12 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed) | |||
361 | udelay(1); | 361 | udelay(1); |
362 | tp_ops->set_irq(hwif, 0); | 362 | tp_ops->set_irq(hwif, 0); |
363 | 363 | ||
364 | memset(&task, 0, sizeof(task)); | 364 | memset(&cmd, 0, sizeof(cmd)); |
365 | task.tf_flags = IDE_TFLAG_OUT_FEATURE | IDE_TFLAG_OUT_NSECT; | 365 | cmd.tf_flags = IDE_TFLAG_OUT_FEATURE | IDE_TFLAG_OUT_NSECT; |
366 | task.tf.feature = SETFEATURES_XFER; | 366 | cmd.tf.feature = SETFEATURES_XFER; |
367 | task.tf.nsect = speed; | 367 | cmd.tf.nsect = speed; |
368 | 368 | ||
369 | tp_ops->tf_load(drive, &task); | 369 | tp_ops->tf_load(drive, &cmd); |
370 | 370 | ||
371 | tp_ops->exec_command(hwif, ATA_CMD_SET_FEATURES); | 371 | tp_ops->exec_command(hwif, ATA_CMD_SET_FEATURES); |
372 | 372 | ||
@@ -425,26 +425,25 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed) | |||
425 | * See also ide_execute_command | 425 | * See also ide_execute_command |
426 | */ | 426 | */ |
427 | void __ide_set_handler(ide_drive_t *drive, ide_handler_t *handler, | 427 | void __ide_set_handler(ide_drive_t *drive, ide_handler_t *handler, |
428 | unsigned int timeout, ide_expiry_t *expiry) | 428 | unsigned int timeout) |
429 | { | 429 | { |
430 | ide_hwif_t *hwif = drive->hwif; | 430 | ide_hwif_t *hwif = drive->hwif; |
431 | 431 | ||
432 | BUG_ON(hwif->handler); | 432 | BUG_ON(hwif->handler); |
433 | hwif->handler = handler; | 433 | hwif->handler = handler; |
434 | hwif->expiry = expiry; | ||
435 | hwif->timer.expires = jiffies + timeout; | 434 | hwif->timer.expires = jiffies + timeout; |
436 | hwif->req_gen_timer = hwif->req_gen; | 435 | hwif->req_gen_timer = hwif->req_gen; |
437 | add_timer(&hwif->timer); | 436 | add_timer(&hwif->timer); |
438 | } | 437 | } |
439 | 438 | ||
440 | void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, | 439 | void ide_set_handler(ide_drive_t *drive, ide_handler_t *handler, |
441 | unsigned int timeout, ide_expiry_t *expiry) | 440 | unsigned int timeout) |
442 | { | 441 | { |
443 | ide_hwif_t *hwif = drive->hwif; | 442 | ide_hwif_t *hwif = drive->hwif; |
444 | unsigned long flags; | 443 | unsigned long flags; |
445 | 444 | ||
446 | spin_lock_irqsave(&hwif->lock, flags); | 445 | spin_lock_irqsave(&hwif->lock, flags); |
447 | __ide_set_handler(drive, handler, timeout, expiry); | 446 | __ide_set_handler(drive, handler, timeout); |
448 | spin_unlock_irqrestore(&hwif->lock, flags); | 447 | spin_unlock_irqrestore(&hwif->lock, flags); |
449 | } | 448 | } |
450 | EXPORT_SYMBOL(ide_set_handler); | 449 | EXPORT_SYMBOL(ide_set_handler); |
@@ -452,10 +451,9 @@ EXPORT_SYMBOL(ide_set_handler); | |||
452 | /** | 451 | /** |
453 | * ide_execute_command - execute an IDE command | 452 | * ide_execute_command - execute an IDE command |
454 | * @drive: IDE drive to issue the command against | 453 | * @drive: IDE drive to issue the command against |
455 | * @command: command byte to write | 454 | * @cmd: command |
456 | * @handler: handler for next phase | 455 | * @handler: handler for next phase |
457 | * @timeout: timeout for command | 456 | * @timeout: timeout for command |
458 | * @expiry: handler to run on timeout | ||
459 | * | 457 | * |
460 | * Helper function to issue an IDE command. This handles the | 458 | * Helper function to issue an IDE command. This handles the |
461 | * atomicity requirements, command timing and ensures that the | 459 | * atomicity requirements, command timing and ensures that the |
@@ -463,15 +461,18 @@ EXPORT_SYMBOL(ide_set_handler); | |||
463 | * should go via this function or do equivalent locking. | 461 | * should go via this function or do equivalent locking. |
464 | */ | 462 | */ |
465 | 463 | ||
466 | void ide_execute_command(ide_drive_t *drive, u8 cmd, ide_handler_t *handler, | 464 | void ide_execute_command(ide_drive_t *drive, struct ide_cmd *cmd, |
467 | unsigned timeout, ide_expiry_t *expiry) | 465 | ide_handler_t *handler, unsigned timeout) |
468 | { | 466 | { |
469 | ide_hwif_t *hwif = drive->hwif; | 467 | ide_hwif_t *hwif = drive->hwif; |
470 | unsigned long flags; | 468 | unsigned long flags; |
471 | 469 | ||
472 | spin_lock_irqsave(&hwif->lock, flags); | 470 | spin_lock_irqsave(&hwif->lock, flags); |
473 | __ide_set_handler(drive, handler, timeout, expiry); | 471 | if ((cmd->protocol != ATAPI_PROT_DMA && |
474 | hwif->tp_ops->exec_command(hwif, cmd); | 472 | cmd->protocol != ATAPI_PROT_PIO) || |
473 | (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT)) | ||
474 | __ide_set_handler(drive, handler, timeout); | ||
475 | hwif->tp_ops->exec_command(hwif, cmd->tf.command); | ||
475 | /* | 476 | /* |
476 | * Drive takes 400nS to respond, we must avoid the IRQ being | 477 | * Drive takes 400nS to respond, we must avoid the IRQ being |
477 | * serviced before that. | 478 | * serviced before that. |
@@ -481,19 +482,6 @@ void ide_execute_command(ide_drive_t *drive, u8 cmd, ide_handler_t *handler, | |||
481 | ndelay(400); | 482 | ndelay(400); |
482 | spin_unlock_irqrestore(&hwif->lock, flags); | 483 | spin_unlock_irqrestore(&hwif->lock, flags); |
483 | } | 484 | } |
484 | EXPORT_SYMBOL(ide_execute_command); | ||
485 | |||
486 | void ide_execute_pkt_cmd(ide_drive_t *drive) | ||
487 | { | ||
488 | ide_hwif_t *hwif = drive->hwif; | ||
489 | unsigned long flags; | ||
490 | |||
491 | spin_lock_irqsave(&hwif->lock, flags); | ||
492 | hwif->tp_ops->exec_command(hwif, ATA_CMD_PACKET); | ||
493 | ndelay(400); | ||
494 | spin_unlock_irqrestore(&hwif->lock, flags); | ||
495 | } | ||
496 | EXPORT_SYMBOL_GPL(ide_execute_pkt_cmd); | ||
497 | 485 | ||
498 | /* | 486 | /* |
499 | * ide_wait_not_busy() waits for the currently selected device on the hwif | 487 | * ide_wait_not_busy() waits for the currently selected device on the hwif |
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index f6c683dd2987..217b7fdf2b17 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c | |||
@@ -34,19 +34,19 @@ void ide_toggle_bounce(ide_drive_t *drive, int on) | |||
34 | static void ide_dump_opcode(ide_drive_t *drive) | 34 | static void ide_dump_opcode(ide_drive_t *drive) |
35 | { | 35 | { |
36 | struct request *rq = drive->hwif->rq; | 36 | struct request *rq = drive->hwif->rq; |
37 | ide_task_t *task = NULL; | 37 | struct ide_cmd *cmd = NULL; |
38 | 38 | ||
39 | if (!rq) | 39 | if (!rq) |
40 | return; | 40 | return; |
41 | 41 | ||
42 | if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) | 42 | if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) |
43 | task = rq->special; | 43 | cmd = rq->special; |
44 | 44 | ||
45 | printk(KERN_ERR "ide: failed opcode was: "); | 45 | printk(KERN_ERR "ide: failed opcode was: "); |
46 | if (task == NULL) | 46 | if (cmd == NULL) |
47 | printk(KERN_CONT "unknown\n"); | 47 | printk(KERN_CONT "unknown\n"); |
48 | else | 48 | else |
49 | printk(KERN_CONT "0x%02x\n", task->tf.command); | 49 | printk(KERN_CONT "0x%02x\n", cmd->tf.command); |
50 | } | 50 | } |
51 | 51 | ||
52 | u64 ide_get_lba_addr(struct ide_taskfile *tf, int lba48) | 52 | u64 ide_get_lba_addr(struct ide_taskfile *tf, int lba48) |
@@ -66,18 +66,18 @@ EXPORT_SYMBOL_GPL(ide_get_lba_addr); | |||
66 | 66 | ||
67 | static void ide_dump_sector(ide_drive_t *drive) | 67 | static void ide_dump_sector(ide_drive_t *drive) |
68 | { | 68 | { |
69 | ide_task_t task; | 69 | struct ide_cmd cmd; |
70 | struct ide_taskfile *tf = &task.tf; | 70 | struct ide_taskfile *tf = &cmd.tf; |
71 | u8 lba48 = !!(drive->dev_flags & IDE_DFLAG_LBA48); | 71 | u8 lba48 = !!(drive->dev_flags & IDE_DFLAG_LBA48); |
72 | 72 | ||
73 | memset(&task, 0, sizeof(task)); | 73 | memset(&cmd, 0, sizeof(cmd)); |
74 | if (lba48) | 74 | if (lba48) |
75 | task.tf_flags = IDE_TFLAG_IN_LBA | IDE_TFLAG_IN_HOB_LBA | | 75 | cmd.tf_flags = IDE_TFLAG_IN_LBA | IDE_TFLAG_IN_HOB_LBA | |
76 | IDE_TFLAG_LBA48; | 76 | IDE_TFLAG_LBA48; |
77 | else | 77 | else |
78 | task.tf_flags = IDE_TFLAG_IN_LBA | IDE_TFLAG_IN_DEVICE; | 78 | cmd.tf_flags = IDE_TFLAG_IN_LBA | IDE_TFLAG_IN_DEVICE; |
79 | 79 | ||
80 | drive->hwif->tp_ops->tf_read(drive, &task); | 80 | drive->hwif->tp_ops->tf_read(drive, &cmd); |
81 | 81 | ||
82 | if (lba48 || (tf->device & ATA_LBA)) | 82 | if (lba48 || (tf->device & ATA_LBA)) |
83 | printk(KERN_CONT ", LBAsect=%llu", | 83 | printk(KERN_CONT ", LBAsect=%llu", |
diff --git a/drivers/ide/ide-park.c b/drivers/ide/ide-park.c index f30e52152fcb..9490b446519f 100644 --- a/drivers/ide/ide-park.c +++ b/drivers/ide/ide-park.c | |||
@@ -1,6 +1,5 @@ | |||
1 | #include <linux/kernel.h> | 1 | #include <linux/kernel.h> |
2 | #include <linux/ide.h> | 2 | #include <linux/ide.h> |
3 | #include <linux/hdreg.h> | ||
4 | #include <linux/jiffies.h> | 3 | #include <linux/jiffies.h> |
5 | #include <linux/blkdev.h> | 4 | #include <linux/blkdev.h> |
6 | 5 | ||
@@ -63,10 +62,10 @@ out: | |||
63 | 62 | ||
64 | ide_startstop_t ide_do_park_unpark(ide_drive_t *drive, struct request *rq) | 63 | ide_startstop_t ide_do_park_unpark(ide_drive_t *drive, struct request *rq) |
65 | { | 64 | { |
66 | ide_task_t task; | 65 | struct ide_cmd cmd; |
67 | struct ide_taskfile *tf = &task.tf; | 66 | struct ide_taskfile *tf = &cmd.tf; |
68 | 67 | ||
69 | memset(&task, 0, sizeof(task)); | 68 | memset(&cmd, 0, sizeof(cmd)); |
70 | if (rq->cmd[0] == REQ_PARK_HEADS) { | 69 | if (rq->cmd[0] == REQ_PARK_HEADS) { |
71 | drive->sleep = *(unsigned long *)rq->special; | 70 | drive->sleep = *(unsigned long *)rq->special; |
72 | drive->dev_flags |= IDE_DFLAG_SLEEPING; | 71 | drive->dev_flags |= IDE_DFLAG_SLEEPING; |
@@ -75,14 +74,16 @@ ide_startstop_t ide_do_park_unpark(ide_drive_t *drive, struct request *rq) | |||
75 | tf->lbal = 0x4c; | 74 | tf->lbal = 0x4c; |
76 | tf->lbam = 0x4e; | 75 | tf->lbam = 0x4e; |
77 | tf->lbah = 0x55; | 76 | tf->lbah = 0x55; |
78 | task.tf_flags |= IDE_TFLAG_CUSTOM_HANDLER; | 77 | cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; |
79 | } else /* cmd == REQ_UNPARK_HEADS */ | 78 | } else /* cmd == REQ_UNPARK_HEADS */ |
80 | tf->command = ATA_CMD_CHK_POWER; | 79 | tf->command = ATA_CMD_CHK_POWER; |
81 | 80 | ||
82 | task.tf_flags |= IDE_TFLAG_TF | IDE_TFLAG_DEVICE; | 81 | cmd.tf_flags |= IDE_TFLAG_CUSTOM_HANDLER; |
83 | task.rq = rq; | 82 | cmd.protocol = ATA_PROT_NODATA; |
84 | drive->hwif->data_phase = task.data_phase = TASKFILE_NO_DATA; | 83 | |
85 | return do_rw_taskfile(drive, &task); | 84 | cmd.rq = rq; |
85 | |||
86 | return do_rw_taskfile(drive, &cmd); | ||
86 | } | 87 | } |
87 | 88 | ||
88 | ssize_t ide_park_show(struct device *dev, struct device_attribute *attr, | 89 | ssize_t ide_park_show(struct device *dev, struct device_attribute *attr, |
diff --git a/drivers/ide/ide-pm.c b/drivers/ide/ide-pm.c index 60538d9c84ee..ebf2d21ebdcb 100644 --- a/drivers/ide/ide-pm.c +++ b/drivers/ide/ide-pm.c | |||
@@ -1,6 +1,5 @@ | |||
1 | #include <linux/kernel.h> | 1 | #include <linux/kernel.h> |
2 | #include <linux/ide.h> | 2 | #include <linux/ide.h> |
3 | #include <linux/hdreg.h> | ||
4 | 3 | ||
5 | int generic_ide_suspend(struct device *dev, pm_message_t mesg) | 4 | int generic_ide_suspend(struct device *dev, pm_message_t mesg) |
6 | { | 5 | { |
@@ -8,7 +7,7 @@ int generic_ide_suspend(struct device *dev, pm_message_t mesg) | |||
8 | ide_hwif_t *hwif = drive->hwif; | 7 | ide_hwif_t *hwif = drive->hwif; |
9 | struct request *rq; | 8 | struct request *rq; |
10 | struct request_pm_state rqpm; | 9 | struct request_pm_state rqpm; |
11 | ide_task_t args; | 10 | struct ide_cmd cmd; |
12 | int ret; | 11 | int ret; |
13 | 12 | ||
14 | /* call ACPI _GTM only once */ | 13 | /* call ACPI _GTM only once */ |
@@ -16,10 +15,10 @@ int generic_ide_suspend(struct device *dev, pm_message_t mesg) | |||
16 | ide_acpi_get_timing(hwif); | 15 | ide_acpi_get_timing(hwif); |
17 | 16 | ||
18 | memset(&rqpm, 0, sizeof(rqpm)); | 17 | memset(&rqpm, 0, sizeof(rqpm)); |
19 | memset(&args, 0, sizeof(args)); | 18 | memset(&cmd, 0, sizeof(cmd)); |
20 | rq = blk_get_request(drive->queue, READ, __GFP_WAIT); | 19 | rq = blk_get_request(drive->queue, READ, __GFP_WAIT); |
21 | rq->cmd_type = REQ_TYPE_PM_SUSPEND; | 20 | rq->cmd_type = REQ_TYPE_PM_SUSPEND; |
22 | rq->special = &args; | 21 | rq->special = &cmd; |
23 | rq->data = &rqpm; | 22 | rq->data = &rqpm; |
24 | rqpm.pm_step = IDE_PM_START_SUSPEND; | 23 | rqpm.pm_step = IDE_PM_START_SUSPEND; |
25 | if (mesg.event == PM_EVENT_PRETHAW) | 24 | if (mesg.event == PM_EVENT_PRETHAW) |
@@ -42,7 +41,7 @@ int generic_ide_resume(struct device *dev) | |||
42 | ide_hwif_t *hwif = drive->hwif; | 41 | ide_hwif_t *hwif = drive->hwif; |
43 | struct request *rq; | 42 | struct request *rq; |
44 | struct request_pm_state rqpm; | 43 | struct request_pm_state rqpm; |
45 | ide_task_t args; | 44 | struct ide_cmd cmd; |
46 | int err; | 45 | int err; |
47 | 46 | ||
48 | /* call ACPI _PS0 / _STM only once */ | 47 | /* call ACPI _PS0 / _STM only once */ |
@@ -54,11 +53,11 @@ int generic_ide_resume(struct device *dev) | |||
54 | ide_acpi_exec_tfs(drive); | 53 | ide_acpi_exec_tfs(drive); |
55 | 54 | ||
56 | memset(&rqpm, 0, sizeof(rqpm)); | 55 | memset(&rqpm, 0, sizeof(rqpm)); |
57 | memset(&args, 0, sizeof(args)); | 56 | memset(&cmd, 0, sizeof(cmd)); |
58 | rq = blk_get_request(drive->queue, READ, __GFP_WAIT); | 57 | rq = blk_get_request(drive->queue, READ, __GFP_WAIT); |
59 | rq->cmd_type = REQ_TYPE_PM_RESUME; | 58 | rq->cmd_type = REQ_TYPE_PM_RESUME; |
60 | rq->cmd_flags |= REQ_PREEMPT; | 59 | rq->cmd_flags |= REQ_PREEMPT; |
61 | rq->special = &args; | 60 | rq->special = &cmd; |
62 | rq->data = &rqpm; | 61 | rq->data = &rqpm; |
63 | rqpm.pm_step = IDE_PM_START_RESUME; | 62 | rqpm.pm_step = IDE_PM_START_RESUME; |
64 | rqpm.pm_state = PM_EVENT_ON; | 63 | rqpm.pm_state = PM_EVENT_ON; |
@@ -109,9 +108,9 @@ void ide_complete_power_step(ide_drive_t *drive, struct request *rq) | |||
109 | ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *rq) | 108 | ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *rq) |
110 | { | 109 | { |
111 | struct request_pm_state *pm = rq->data; | 110 | struct request_pm_state *pm = rq->data; |
112 | ide_task_t *args = rq->special; | 111 | struct ide_cmd *cmd = rq->special; |
113 | 112 | ||
114 | memset(args, 0, sizeof(*args)); | 113 | memset(cmd, 0, sizeof(*cmd)); |
115 | 114 | ||
116 | switch (pm->pm_step) { | 115 | switch (pm->pm_step) { |
117 | case IDE_PM_FLUSH_CACHE: /* Suspend step 1 (flush cache) */ | 116 | case IDE_PM_FLUSH_CACHE: /* Suspend step 1 (flush cache) */ |
@@ -124,12 +123,12 @@ ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *rq) | |||
124 | return ide_stopped; | 123 | return ide_stopped; |
125 | } | 124 | } |
126 | if (ata_id_flush_ext_enabled(drive->id)) | 125 | if (ata_id_flush_ext_enabled(drive->id)) |
127 | args->tf.command = ATA_CMD_FLUSH_EXT; | 126 | cmd->tf.command = ATA_CMD_FLUSH_EXT; |
128 | else | 127 | else |
129 | args->tf.command = ATA_CMD_FLUSH; | 128 | cmd->tf.command = ATA_CMD_FLUSH; |
130 | goto out_do_tf; | 129 | goto out_do_tf; |
131 | case IDE_PM_STANDBY: /* Suspend step 2 (standby) */ | 130 | case IDE_PM_STANDBY: /* Suspend step 2 (standby) */ |
132 | args->tf.command = ATA_CMD_STANDBYNOW1; | 131 | cmd->tf.command = ATA_CMD_STANDBYNOW1; |
133 | goto out_do_tf; | 132 | goto out_do_tf; |
134 | case IDE_PM_RESTORE_PIO: /* Resume step 1 (restore PIO) */ | 133 | case IDE_PM_RESTORE_PIO: /* Resume step 1 (restore PIO) */ |
135 | ide_set_max_pio(drive); | 134 | ide_set_max_pio(drive); |
@@ -142,7 +141,7 @@ ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *rq) | |||
142 | ide_complete_power_step(drive, rq); | 141 | ide_complete_power_step(drive, rq); |
143 | return ide_stopped; | 142 | return ide_stopped; |
144 | case IDE_PM_IDLE: /* Resume step 2 (idle) */ | 143 | case IDE_PM_IDLE: /* Resume step 2 (idle) */ |
145 | args->tf.command = ATA_CMD_IDLEIMMEDIATE; | 144 | cmd->tf.command = ATA_CMD_IDLEIMMEDIATE; |
146 | goto out_do_tf; | 145 | goto out_do_tf; |
147 | case IDE_PM_RESTORE_DMA: /* Resume step 3 (restore DMA) */ | 146 | case IDE_PM_RESTORE_DMA: /* Resume step 3 (restore DMA) */ |
148 | /* | 147 | /* |
@@ -160,27 +159,34 @@ ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *rq) | |||
160 | } | 159 | } |
161 | 160 | ||
162 | pm->pm_step = IDE_PM_COMPLETED; | 161 | pm->pm_step = IDE_PM_COMPLETED; |
162 | |||
163 | return ide_stopped; | 163 | return ide_stopped; |
164 | 164 | ||
165 | out_do_tf: | 165 | out_do_tf: |
166 | args->tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; | 166 | cmd->tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; |
167 | args->data_phase = TASKFILE_NO_DATA; | 167 | cmd->protocol = ATA_PROT_NODATA; |
168 | return do_rw_taskfile(drive, args); | 168 | |
169 | return do_rw_taskfile(drive, cmd); | ||
169 | } | 170 | } |
170 | 171 | ||
171 | /** | 172 | /** |
172 | * ide_complete_pm_request - end the current Power Management request | 173 | * ide_complete_pm_rq - end the current Power Management request |
173 | * @drive: target drive | 174 | * @drive: target drive |
174 | * @rq: request | 175 | * @rq: request |
175 | * | 176 | * |
176 | * This function cleans up the current PM request and stops the queue | 177 | * This function cleans up the current PM request and stops the queue |
177 | * if necessary. | 178 | * if necessary. |
178 | */ | 179 | */ |
179 | void ide_complete_pm_request(ide_drive_t *drive, struct request *rq) | 180 | void ide_complete_pm_rq(ide_drive_t *drive, struct request *rq) |
180 | { | 181 | { |
181 | struct request_queue *q = drive->queue; | 182 | struct request_queue *q = drive->queue; |
183 | struct request_pm_state *pm = rq->data; | ||
182 | unsigned long flags; | 184 | unsigned long flags; |
183 | 185 | ||
186 | ide_complete_power_step(drive, rq); | ||
187 | if (pm->pm_step != IDE_PM_COMPLETED) | ||
188 | return; | ||
189 | |||
184 | #ifdef DEBUG_PM | 190 | #ifdef DEBUG_PM |
185 | printk("%s: completing PM request, %s\n", drive->name, | 191 | printk("%s: completing PM request, %s\n", drive->name, |
186 | blk_pm_suspend_request(rq) ? "suspend" : "resume"); | 192 | blk_pm_suspend_request(rq) ? "suspend" : "resume"); |
diff --git a/drivers/ide/ide-pnp.c b/drivers/ide/ide-pnp.c index bac9b392b689..6e80b774e88a 100644 --- a/drivers/ide/ide-pnp.c +++ b/drivers/ide/ide-pnp.c | |||
@@ -27,6 +27,10 @@ static struct pnp_device_id idepnp_devices[] = { | |||
27 | {.id = ""} | 27 | {.id = ""} |
28 | }; | 28 | }; |
29 | 29 | ||
30 | static const struct ide_port_info ide_pnp_port_info = { | ||
31 | .host_flags = IDE_HFLAG_NO_DMA, | ||
32 | }; | ||
33 | |||
30 | static int idepnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) | 34 | static int idepnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) |
31 | { | 35 | { |
32 | struct ide_host *host; | 36 | struct ide_host *host; |
@@ -60,7 +64,7 @@ static int idepnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) | |||
60 | hw.irq = pnp_irq(dev, 0); | 64 | hw.irq = pnp_irq(dev, 0); |
61 | hw.chipset = ide_generic; | 65 | hw.chipset = ide_generic; |
62 | 66 | ||
63 | rc = ide_host_add(NULL, hws, &host); | 67 | rc = ide_host_add(&ide_pnp_port_info, hws, &host); |
64 | if (rc) | 68 | if (rc) |
65 | goto out; | 69 | goto out; |
66 | 70 | ||
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 974067043fba..548864510ba9 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -228,15 +228,9 @@ static void do_identify(ide_drive_t *drive, u8 cmd, u16 *id) | |||
228 | m[ATA_ID_PROD_LEN - 1] = '\0'; | 228 | m[ATA_ID_PROD_LEN - 1] = '\0'; |
229 | 229 | ||
230 | if (strstr(m, "E X A B Y T E N E S T")) | 230 | if (strstr(m, "E X A B Y T E N E S T")) |
231 | goto err_misc; | 231 | drive->dev_flags &= ~IDE_DFLAG_PRESENT; |
232 | 232 | else | |
233 | drive->dev_flags |= IDE_DFLAG_PRESENT; | 233 | drive->dev_flags |= IDE_DFLAG_PRESENT; |
234 | drive->dev_flags &= ~IDE_DFLAG_DEAD; | ||
235 | |||
236 | return; | ||
237 | err_misc: | ||
238 | kfree(id); | ||
239 | drive->dev_flags &= ~IDE_DFLAG_PRESENT; | ||
240 | } | 234 | } |
241 | 235 | ||
242 | /** | 236 | /** |
@@ -289,13 +283,13 @@ int ide_dev_read_id(ide_drive_t *drive, u8 cmd, u16 *id) | |||
289 | * identify command to be sure of reply | 283 | * identify command to be sure of reply |
290 | */ | 284 | */ |
291 | if (cmd == ATA_CMD_ID_ATAPI) { | 285 | if (cmd == ATA_CMD_ID_ATAPI) { |
292 | ide_task_t task; | 286 | struct ide_cmd cmd; |
293 | 287 | ||
294 | memset(&task, 0, sizeof(task)); | 288 | memset(&cmd, 0, sizeof(cmd)); |
295 | /* disable DMA & overlap */ | 289 | /* disable DMA & overlap */ |
296 | task.tf_flags = IDE_TFLAG_OUT_FEATURE; | 290 | cmd.tf_flags = IDE_TFLAG_OUT_FEATURE; |
297 | 291 | ||
298 | tp_ops->tf_load(drive, &task); | 292 | tp_ops->tf_load(drive, &cmd); |
299 | } | 293 | } |
300 | 294 | ||
301 | /* ask drive for ID */ | 295 | /* ask drive for ID */ |
@@ -343,14 +337,14 @@ int ide_busy_sleep(ide_hwif_t *hwif, unsigned long timeout, int altstatus) | |||
343 | 337 | ||
344 | static u8 ide_read_device(ide_drive_t *drive) | 338 | static u8 ide_read_device(ide_drive_t *drive) |
345 | { | 339 | { |
346 | ide_task_t task; | 340 | struct ide_cmd cmd; |
347 | 341 | ||
348 | memset(&task, 0, sizeof(task)); | 342 | memset(&cmd, 0, sizeof(cmd)); |
349 | task.tf_flags = IDE_TFLAG_IN_DEVICE; | 343 | cmd.tf_flags = IDE_TFLAG_IN_DEVICE; |
350 | 344 | ||
351 | drive->hwif->tp_ops->tf_read(drive, &task); | 345 | drive->hwif->tp_ops->tf_read(drive, &cmd); |
352 | 346 | ||
353 | return task.tf.device; | 347 | return cmd.tf.device; |
354 | } | 348 | } |
355 | 349 | ||
356 | /** | 350 | /** |
@@ -505,8 +499,7 @@ static u8 probe_for_drive(ide_drive_t *drive) | |||
505 | } | 499 | } |
506 | 500 | ||
507 | if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0) | 501 | if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0) |
508 | /* drive not found */ | 502 | goto out_free; |
509 | return 0; | ||
510 | 503 | ||
511 | /* identification failed? */ | 504 | /* identification failed? */ |
512 | if ((drive->dev_flags & IDE_DFLAG_ID_READ) == 0) { | 505 | if ((drive->dev_flags & IDE_DFLAG_ID_READ) == 0) { |
@@ -530,7 +523,7 @@ static u8 probe_for_drive(ide_drive_t *drive) | |||
530 | } | 523 | } |
531 | 524 | ||
532 | if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0) | 525 | if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0) |
533 | return 0; | 526 | goto out_free; |
534 | 527 | ||
535 | /* The drive wasn't being helpful. Add generic info only */ | 528 | /* The drive wasn't being helpful. Add generic info only */ |
536 | if ((drive->dev_flags & IDE_DFLAG_ID_READ) == 0) { | 529 | if ((drive->dev_flags & IDE_DFLAG_ID_READ) == 0) { |
@@ -543,7 +536,10 @@ static u8 probe_for_drive(ide_drive_t *drive) | |||
543 | ide_disk_init_mult_count(drive); | 536 | ide_disk_init_mult_count(drive); |
544 | } | 537 | } |
545 | 538 | ||
546 | return !!(drive->dev_flags & IDE_DFLAG_PRESENT); | 539 | return 1; |
540 | out_free: | ||
541 | kfree(drive->id); | ||
542 | return 0; | ||
547 | } | 543 | } |
548 | 544 | ||
549 | static void hwif_release_dev(struct device *dev) | 545 | static void hwif_release_dev(struct device *dev) |
@@ -841,34 +837,19 @@ static int ide_port_setup_devices(ide_hwif_t *hwif) | |||
841 | static int init_irq (ide_hwif_t *hwif) | 837 | static int init_irq (ide_hwif_t *hwif) |
842 | { | 838 | { |
843 | struct ide_io_ports *io_ports = &hwif->io_ports; | 839 | struct ide_io_ports *io_ports = &hwif->io_ports; |
844 | irq_handler_t irq_handler; | 840 | struct ide_host *host = hwif->host; |
845 | int sa = 0; | 841 | irq_handler_t irq_handler = host->irq_handler; |
842 | int sa = host->irq_flags; | ||
846 | 843 | ||
847 | irq_handler = hwif->host->irq_handler; | ||
848 | if (irq_handler == NULL) | 844 | if (irq_handler == NULL) |
849 | irq_handler = ide_intr; | 845 | irq_handler = ide_intr; |
850 | 846 | ||
851 | #if defined(__mc68000__) | ||
852 | sa = IRQF_SHARED; | ||
853 | #endif /* __mc68000__ */ | ||
854 | |||
855 | if (hwif->chipset == ide_pci) | ||
856 | sa = IRQF_SHARED; | ||
857 | |||
858 | if (io_ports->ctl_addr) | 847 | if (io_ports->ctl_addr) |
859 | hwif->tp_ops->set_irq(hwif, 1); | 848 | hwif->tp_ops->set_irq(hwif, 1); |
860 | 849 | ||
861 | if (request_irq(hwif->irq, irq_handler, sa, hwif->name, hwif)) | 850 | if (request_irq(hwif->irq, irq_handler, sa, hwif->name, hwif)) |
862 | goto out_up; | 851 | goto out_up; |
863 | 852 | ||
864 | if (!hwif->rqsize) { | ||
865 | if ((hwif->host_flags & IDE_HFLAG_NO_LBA48) || | ||
866 | (hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA)) | ||
867 | hwif->rqsize = 256; | ||
868 | else | ||
869 | hwif->rqsize = 65536; | ||
870 | } | ||
871 | |||
872 | #if !defined(__mc68000__) | 853 | #if !defined(__mc68000__) |
873 | printk(KERN_INFO "%s at 0x%03lx-0x%03lx,0x%03lx on irq %d", hwif->name, | 854 | printk(KERN_INFO "%s at 0x%03lx-0x%03lx,0x%03lx on irq %d", hwif->name, |
874 | io_ports->data_addr, io_ports->status_addr, | 855 | io_ports->data_addr, io_ports->status_addr, |
@@ -1080,7 +1061,7 @@ static void ide_init_port(ide_hwif_t *hwif, unsigned int port, | |||
1080 | hwif->tp_ops = d->tp_ops; | 1061 | hwif->tp_ops = d->tp_ops; |
1081 | 1062 | ||
1082 | /* ->set_pio_mode for DTC2278 is currently limited to port 0 */ | 1063 | /* ->set_pio_mode for DTC2278 is currently limited to port 0 */ |
1083 | if (hwif->chipset != ide_dtc2278 || hwif->channel == 0) | 1064 | if ((hwif->host_flags & IDE_HFLAG_DTC2278) == 0 || hwif->channel == 0) |
1084 | hwif->port_ops = d->port_ops; | 1065 | hwif->port_ops = d->port_ops; |
1085 | 1066 | ||
1086 | hwif->swdma_mask = d->swdma_mask; | 1067 | hwif->swdma_mask = d->swdma_mask; |
@@ -1114,6 +1095,13 @@ static void ide_init_port(ide_hwif_t *hwif, unsigned int port, | |||
1114 | 1095 | ||
1115 | if (d->max_sectors) | 1096 | if (d->max_sectors) |
1116 | hwif->rqsize = d->max_sectors; | 1097 | hwif->rqsize = d->max_sectors; |
1098 | else { | ||
1099 | if ((hwif->host_flags & IDE_HFLAG_NO_LBA48) || | ||
1100 | (hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA)) | ||
1101 | hwif->rqsize = 256; | ||
1102 | else | ||
1103 | hwif->rqsize = 65536; | ||
1104 | } | ||
1117 | 1105 | ||
1118 | /* call chipset specific routine for each enabled port */ | 1106 | /* call chipset specific routine for each enabled port */ |
1119 | if (d->init_hwif) | 1107 | if (d->init_hwif) |
@@ -1326,6 +1314,8 @@ struct ide_host *ide_host_alloc(const struct ide_port_info *d, hw_regs_t **hws) | |||
1326 | 1314 | ||
1327 | if (d) { | 1315 | if (d) { |
1328 | host->init_chipset = d->init_chipset; | 1316 | host->init_chipset = d->init_chipset; |
1317 | host->get_lock = d->get_lock; | ||
1318 | host->release_lock = d->release_lock; | ||
1329 | host->host_flags = d->host_flags; | 1319 | host->host_flags = d->host_flags; |
1330 | } | 1320 | } |
1331 | 1321 | ||
@@ -1372,20 +1362,15 @@ int ide_host_register(struct ide_host *host, const struct ide_port_info *d, | |||
1372 | ide_init_port_hw(hwif, hws[i]); | 1362 | ide_init_port_hw(hwif, hws[i]); |
1373 | ide_port_apply_params(hwif); | 1363 | ide_port_apply_params(hwif); |
1374 | 1364 | ||
1375 | if (d == NULL) { | 1365 | if ((i & 1) && mate) { |
1376 | mate = NULL; | 1366 | hwif->mate = mate; |
1377 | } else { | 1367 | mate->mate = hwif; |
1378 | if ((i & 1) && mate) { | ||
1379 | hwif->mate = mate; | ||
1380 | mate->mate = hwif; | ||
1381 | } | ||
1382 | |||
1383 | mate = (i & 1) ? NULL : hwif; | ||
1384 | |||
1385 | ide_init_port(hwif, i & 1, d); | ||
1386 | ide_port_cable_detect(hwif); | ||
1387 | } | 1368 | } |
1388 | 1369 | ||
1370 | mate = (i & 1) ? NULL : hwif; | ||
1371 | |||
1372 | ide_init_port(hwif, i & 1, d); | ||
1373 | ide_port_cable_detect(hwif); | ||
1389 | ide_port_init_devices(hwif); | 1374 | ide_port_init_devices(hwif); |
1390 | } | 1375 | } |
1391 | 1376 | ||
@@ -1396,8 +1381,8 @@ int ide_host_register(struct ide_host *host, const struct ide_port_info *d, | |||
1396 | if (ide_probe_port(hwif) == 0) | 1381 | if (ide_probe_port(hwif) == 0) |
1397 | hwif->present = 1; | 1382 | hwif->present = 1; |
1398 | 1383 | ||
1399 | if (hwif->chipset != ide_4drives || !hwif->mate || | 1384 | if ((hwif->host_flags & IDE_HFLAG_4DRIVES) == 0 || |
1400 | !hwif->mate->present) { | 1385 | hwif->mate == NULL || hwif->mate->present == 0) { |
1401 | if (ide_register_port(hwif)) { | 1386 | if (ide_register_port(hwif)) { |
1402 | ide_disable_port(hwif); | 1387 | ide_disable_port(hwif); |
1403 | continue; | 1388 | continue; |
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c index 417cde56eafd..10a88bf3eefa 100644 --- a/drivers/ide/ide-proc.c +++ b/drivers/ide/ide-proc.c | |||
@@ -194,20 +194,20 @@ ide_devset_get(xfer_rate, current_speed); | |||
194 | 194 | ||
195 | static int set_xfer_rate (ide_drive_t *drive, int arg) | 195 | static int set_xfer_rate (ide_drive_t *drive, int arg) |
196 | { | 196 | { |
197 | ide_task_t task; | 197 | struct ide_cmd cmd; |
198 | int err; | 198 | int err; |
199 | 199 | ||
200 | if (arg < XFER_PIO_0 || arg > XFER_UDMA_6) | 200 | if (arg < XFER_PIO_0 || arg > XFER_UDMA_6) |
201 | return -EINVAL; | 201 | return -EINVAL; |
202 | 202 | ||
203 | memset(&task, 0, sizeof(task)); | 203 | memset(&cmd, 0, sizeof(cmd)); |
204 | task.tf.command = ATA_CMD_SET_FEATURES; | 204 | cmd.tf.command = ATA_CMD_SET_FEATURES; |
205 | task.tf.feature = SETFEATURES_XFER; | 205 | cmd.tf.feature = SETFEATURES_XFER; |
206 | task.tf.nsect = (u8)arg; | 206 | cmd.tf.nsect = (u8)arg; |
207 | task.tf_flags = IDE_TFLAG_OUT_FEATURE | IDE_TFLAG_OUT_NSECT | | 207 | cmd.tf_flags = IDE_TFLAG_OUT_FEATURE | IDE_TFLAG_OUT_NSECT | |
208 | IDE_TFLAG_IN_NSECT; | 208 | IDE_TFLAG_IN_NSECT; |
209 | 209 | ||
210 | err = ide_no_data_taskfile(drive, &task); | 210 | err = ide_no_data_taskfile(drive, &cmd); |
211 | 211 | ||
212 | if (!err) { | 212 | if (!err) { |
213 | ide_set_xfer_rate(drive, (u8) arg); | 213 | ide_set_xfer_rate(drive, (u8) arg); |
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 4e6181c7bbda..64dfa7458f8d 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -152,11 +152,6 @@ struct idetape_bh { | |||
152 | #define IDETAPE_LU_RETENSION_MASK 2 | 152 | #define IDETAPE_LU_RETENSION_MASK 2 |
153 | #define IDETAPE_LU_EOT_MASK 4 | 153 | #define IDETAPE_LU_EOT_MASK 4 |
154 | 154 | ||
155 | /* Error codes returned in rq->errors to the higher part of the driver. */ | ||
156 | #define IDETAPE_ERROR_GENERAL 101 | ||
157 | #define IDETAPE_ERROR_FILEMARK 102 | ||
158 | #define IDETAPE_ERROR_EOD 103 | ||
159 | |||
160 | /* Structures related to the SELECT SENSE / MODE SENSE packet commands. */ | 155 | /* Structures related to the SELECT SENSE / MODE SENSE packet commands. */ |
161 | #define IDETAPE_BLOCK_DESCRIPTOR 0 | 156 | #define IDETAPE_BLOCK_DESCRIPTOR 0 |
162 | #define IDETAPE_CAPABILITIES_PAGE 0x2a | 157 | #define IDETAPE_CAPABILITIES_PAGE 0x2a |
@@ -171,14 +166,6 @@ typedef struct ide_tape_obj { | |||
171 | struct gendisk *disk; | 166 | struct gendisk *disk; |
172 | struct device dev; | 167 | struct device dev; |
173 | 168 | ||
174 | /* | ||
175 | * failed_pc points to the last failed packet command, or contains | ||
176 | * NULL if we do not need to retry any packet command. This is | ||
177 | * required since an additional packet command is needed before the | ||
178 | * retry, to get detailed information on what went wrong. | ||
179 | */ | ||
180 | /* Last failed packet command */ | ||
181 | struct ide_atapi_pc *failed_pc; | ||
182 | /* used by REQ_IDETAPE_{READ,WRITE} requests */ | 169 | /* used by REQ_IDETAPE_{READ,WRITE} requests */ |
183 | struct ide_atapi_pc queued_pc; | 170 | struct ide_atapi_pc queued_pc; |
184 | 171 | ||
@@ -245,9 +232,6 @@ typedef struct ide_tape_obj { | |||
245 | /* Wasted space in each stage */ | 232 | /* Wasted space in each stage */ |
246 | int excess_bh_size; | 233 | int excess_bh_size; |
247 | 234 | ||
248 | /* protects the ide-tape queue */ | ||
249 | spinlock_t lock; | ||
250 | |||
251 | /* Measures average tape speed */ | 235 | /* Measures average tape speed */ |
252 | unsigned long avg_time; | 236 | unsigned long avg_time; |
253 | int avg_size; | 237 | int avg_size; |
@@ -400,7 +384,7 @@ static void idetape_update_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc) | |||
400 | static void idetape_analyze_error(ide_drive_t *drive, u8 *sense) | 384 | static void idetape_analyze_error(ide_drive_t *drive, u8 *sense) |
401 | { | 385 | { |
402 | idetape_tape_t *tape = drive->driver_data; | 386 | idetape_tape_t *tape = drive->driver_data; |
403 | struct ide_atapi_pc *pc = tape->failed_pc; | 387 | struct ide_atapi_pc *pc = drive->failed_pc; |
404 | 388 | ||
405 | tape->sense_key = sense[2] & 0xF; | 389 | tape->sense_key = sense[2] & 0xF; |
406 | tape->asc = sense[12]; | 390 | tape->asc = sense[12]; |
@@ -433,19 +417,19 @@ static void idetape_analyze_error(ide_drive_t *drive, u8 *sense) | |||
433 | } | 417 | } |
434 | } | 418 | } |
435 | if (pc->c[0] == READ_6 && (sense[2] & 0x80)) { | 419 | if (pc->c[0] == READ_6 && (sense[2] & 0x80)) { |
436 | pc->error = IDETAPE_ERROR_FILEMARK; | 420 | pc->error = IDE_DRV_ERROR_FILEMARK; |
437 | pc->flags |= PC_FLAG_ABORT; | 421 | pc->flags |= PC_FLAG_ABORT; |
438 | } | 422 | } |
439 | if (pc->c[0] == WRITE_6) { | 423 | if (pc->c[0] == WRITE_6) { |
440 | if ((sense[2] & 0x40) || (tape->sense_key == 0xd | 424 | if ((sense[2] & 0x40) || (tape->sense_key == 0xd |
441 | && tape->asc == 0x0 && tape->ascq == 0x2)) { | 425 | && tape->asc == 0x0 && tape->ascq == 0x2)) { |
442 | pc->error = IDETAPE_ERROR_EOD; | 426 | pc->error = IDE_DRV_ERROR_EOD; |
443 | pc->flags |= PC_FLAG_ABORT; | 427 | pc->flags |= PC_FLAG_ABORT; |
444 | } | 428 | } |
445 | } | 429 | } |
446 | if (pc->c[0] == READ_6 || pc->c[0] == WRITE_6) { | 430 | if (pc->c[0] == READ_6 || pc->c[0] == WRITE_6) { |
447 | if (tape->sense_key == 8) { | 431 | if (tape->sense_key == 8) { |
448 | pc->error = IDETAPE_ERROR_EOD; | 432 | pc->error = IDE_DRV_ERROR_EOD; |
449 | pc->flags |= PC_FLAG_ABORT; | 433 | pc->flags |= PC_FLAG_ABORT; |
450 | } | 434 | } |
451 | if (!(pc->flags & PC_FLAG_ABORT) && | 435 | if (!(pc->flags & PC_FLAG_ABORT) && |
@@ -477,52 +461,23 @@ static void ide_tape_kfree_buffer(idetape_tape_t *tape) | |||
477 | } | 461 | } |
478 | } | 462 | } |
479 | 463 | ||
480 | static int idetape_end_request(ide_drive_t *drive, int uptodate, int nr_sects) | ||
481 | { | ||
482 | struct request *rq = drive->hwif->rq; | ||
483 | idetape_tape_t *tape = drive->driver_data; | ||
484 | unsigned long flags; | ||
485 | int error; | ||
486 | |||
487 | debug_log(DBG_PROCS, "Enter %s\n", __func__); | ||
488 | |||
489 | switch (uptodate) { | ||
490 | case 0: error = IDETAPE_ERROR_GENERAL; break; | ||
491 | case 1: error = 0; break; | ||
492 | default: error = uptodate; | ||
493 | } | ||
494 | rq->errors = error; | ||
495 | if (error) | ||
496 | tape->failed_pc = NULL; | ||
497 | |||
498 | if (!blk_special_request(rq)) { | ||
499 | ide_end_request(drive, uptodate, nr_sects); | ||
500 | return 0; | ||
501 | } | ||
502 | |||
503 | spin_lock_irqsave(&tape->lock, flags); | ||
504 | |||
505 | ide_end_drive_cmd(drive, 0, 0); | ||
506 | |||
507 | spin_unlock_irqrestore(&tape->lock, flags); | ||
508 | return 0; | ||
509 | } | ||
510 | |||
511 | static void ide_tape_handle_dsc(ide_drive_t *); | 464 | static void ide_tape_handle_dsc(ide_drive_t *); |
512 | 465 | ||
513 | static void ide_tape_callback(ide_drive_t *drive, int dsc) | 466 | static int ide_tape_callback(ide_drive_t *drive, int dsc) |
514 | { | 467 | { |
515 | idetape_tape_t *tape = drive->driver_data; | 468 | idetape_tape_t *tape = drive->driver_data; |
516 | struct ide_atapi_pc *pc = drive->pc; | 469 | struct ide_atapi_pc *pc = drive->pc; |
470 | struct request *rq = drive->hwif->rq; | ||
517 | int uptodate = pc->error ? 0 : 1; | 471 | int uptodate = pc->error ? 0 : 1; |
472 | int err = uptodate ? 0 : IDE_DRV_ERROR_GENERAL; | ||
518 | 473 | ||
519 | debug_log(DBG_PROCS, "Enter %s\n", __func__); | 474 | debug_log(DBG_PROCS, "Enter %s\n", __func__); |
520 | 475 | ||
521 | if (dsc) | 476 | if (dsc) |
522 | ide_tape_handle_dsc(drive); | 477 | ide_tape_handle_dsc(drive); |
523 | 478 | ||
524 | if (tape->failed_pc == pc) | 479 | if (drive->failed_pc == pc) |
525 | tape->failed_pc = NULL; | 480 | drive->failed_pc = NULL; |
526 | 481 | ||
527 | if (pc->c[0] == REQUEST_SENSE) { | 482 | if (pc->c[0] == REQUEST_SENSE) { |
528 | if (uptodate) | 483 | if (uptodate) |
@@ -531,7 +486,6 @@ static void ide_tape_callback(ide_drive_t *drive, int dsc) | |||
531 | printk(KERN_ERR "ide-tape: Error in REQUEST SENSE " | 486 | printk(KERN_ERR "ide-tape: Error in REQUEST SENSE " |
532 | "itself - Aborting request!\n"); | 487 | "itself - Aborting request!\n"); |
533 | } else if (pc->c[0] == READ_6 || pc->c[0] == WRITE_6) { | 488 | } else if (pc->c[0] == READ_6 || pc->c[0] == WRITE_6) { |
534 | struct request *rq = drive->hwif->rq; | ||
535 | int blocks = pc->xferred / tape->blk_size; | 489 | int blocks = pc->xferred / tape->blk_size; |
536 | 490 | ||
537 | tape->avg_size += blocks * tape->blk_size; | 491 | tape->avg_size += blocks * tape->blk_size; |
@@ -546,8 +500,10 @@ static void ide_tape_callback(ide_drive_t *drive, int dsc) | |||
546 | tape->first_frame += blocks; | 500 | tape->first_frame += blocks; |
547 | rq->current_nr_sectors -= blocks; | 501 | rq->current_nr_sectors -= blocks; |
548 | 502 | ||
549 | if (pc->error) | 503 | if (pc->error) { |
550 | uptodate = pc->error; | 504 | uptodate = 0; |
505 | err = pc->error; | ||
506 | } | ||
551 | } else if (pc->c[0] == READ_POSITION && uptodate) { | 507 | } else if (pc->c[0] == READ_POSITION && uptodate) { |
552 | u8 *readpos = pc->buf; | 508 | u8 *readpos = pc->buf; |
553 | 509 | ||
@@ -561,6 +517,7 @@ static void ide_tape_callback(ide_drive_t *drive, int dsc) | |||
561 | "to the tape\n"); | 517 | "to the tape\n"); |
562 | clear_bit(IDE_AFLAG_ADDRESS_VALID, &drive->atapi_flags); | 518 | clear_bit(IDE_AFLAG_ADDRESS_VALID, &drive->atapi_flags); |
563 | uptodate = 0; | 519 | uptodate = 0; |
520 | err = IDE_DRV_ERROR_GENERAL; | ||
564 | } else { | 521 | } else { |
565 | debug_log(DBG_SENSE, "Block Location - %u\n", | 522 | debug_log(DBG_SENSE, "Block Location - %u\n", |
566 | be32_to_cpup((__be32 *)&readpos[4])); | 523 | be32_to_cpup((__be32 *)&readpos[4])); |
@@ -571,7 +528,9 @@ static void ide_tape_callback(ide_drive_t *drive, int dsc) | |||
571 | } | 528 | } |
572 | } | 529 | } |
573 | 530 | ||
574 | idetape_end_request(drive, uptodate, 0); | 531 | rq->errors = err; |
532 | |||
533 | return uptodate; | ||
575 | } | 534 | } |
576 | 535 | ||
577 | /* | 536 | /* |
@@ -621,7 +580,7 @@ static int ide_tape_io_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc, | |||
621 | * | 580 | * |
622 | * The handling will be done in three stages: | 581 | * The handling will be done in three stages: |
623 | * | 582 | * |
624 | * 1. idetape_issue_pc will send the packet command to the drive, and will set | 583 | * 1. ide_tape_issue_pc will send the packet command to the drive, and will set |
625 | * the interrupt handler to ide_pc_intr. | 584 | * the interrupt handler to ide_pc_intr. |
626 | * | 585 | * |
627 | * 2. On each interrupt, ide_pc_intr will be called. This step will be | 586 | * 2. On each interrupt, ide_pc_intr will be called. This step will be |
@@ -649,8 +608,9 @@ static int ide_tape_io_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc, | |||
649 | * request. | 608 | * request. |
650 | */ | 609 | */ |
651 | 610 | ||
652 | static ide_startstop_t idetape_issue_pc(ide_drive_t *drive, | 611 | static ide_startstop_t ide_tape_issue_pc(ide_drive_t *drive, |
653 | struct ide_atapi_pc *pc) | 612 | struct ide_cmd *cmd, |
613 | struct ide_atapi_pc *pc) | ||
654 | { | 614 | { |
655 | idetape_tape_t *tape = drive->driver_data; | 615 | idetape_tape_t *tape = drive->driver_data; |
656 | 616 | ||
@@ -660,8 +620,8 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive, | |||
660 | "Two request sense in serial were issued\n"); | 620 | "Two request sense in serial were issued\n"); |
661 | } | 621 | } |
662 | 622 | ||
663 | if (tape->failed_pc == NULL && pc->c[0] != REQUEST_SENSE) | 623 | if (drive->failed_pc == NULL && pc->c[0] != REQUEST_SENSE) |
664 | tape->failed_pc = pc; | 624 | drive->failed_pc = pc; |
665 | 625 | ||
666 | /* Set the current packet command */ | 626 | /* Set the current packet command */ |
667 | drive->pc = pc; | 627 | drive->pc = pc; |
@@ -685,9 +645,9 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive, | |||
685 | tape->ascq); | 645 | tape->ascq); |
686 | } | 646 | } |
687 | /* Giving up */ | 647 | /* Giving up */ |
688 | pc->error = IDETAPE_ERROR_GENERAL; | 648 | pc->error = IDE_DRV_ERROR_GENERAL; |
689 | } | 649 | } |
690 | tape->failed_pc = NULL; | 650 | drive->failed_pc = NULL; |
691 | drive->pc_callback(drive, 0); | 651 | drive->pc_callback(drive, 0); |
692 | return ide_stopped; | 652 | return ide_stopped; |
693 | } | 653 | } |
@@ -695,7 +655,7 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive, | |||
695 | 655 | ||
696 | pc->retries++; | 656 | pc->retries++; |
697 | 657 | ||
698 | return ide_issue_pc(drive); | 658 | return ide_issue_pc(drive, cmd); |
699 | } | 659 | } |
700 | 660 | ||
701 | /* A mode sense command is used to "sense" tape parameters. */ | 661 | /* A mode sense command is used to "sense" tape parameters. */ |
@@ -746,8 +706,8 @@ static ide_startstop_t idetape_media_access_finished(ide_drive_t *drive) | |||
746 | } | 706 | } |
747 | pc->error = 0; | 707 | pc->error = 0; |
748 | } else { | 708 | } else { |
749 | pc->error = IDETAPE_ERROR_GENERAL; | 709 | pc->error = IDE_DRV_ERROR_GENERAL; |
750 | tape->failed_pc = NULL; | 710 | drive->failed_pc = NULL; |
751 | } | 711 | } |
752 | drive->pc_callback(drive, 0); | 712 | drive->pc_callback(drive, 0); |
753 | return ide_stopped; | 713 | return ide_stopped; |
@@ -790,6 +750,7 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive, | |||
790 | idetape_tape_t *tape = drive->driver_data; | 750 | idetape_tape_t *tape = drive->driver_data; |
791 | struct ide_atapi_pc *pc = NULL; | 751 | struct ide_atapi_pc *pc = NULL; |
792 | struct request *postponed_rq = tape->postponed_rq; | 752 | struct request *postponed_rq = tape->postponed_rq; |
753 | struct ide_cmd cmd; | ||
793 | u8 stat; | 754 | u8 stat; |
794 | 755 | ||
795 | debug_log(DBG_SENSE, "sector: %llu, nr_sectors: %lu," | 756 | debug_log(DBG_SENSE, "sector: %llu, nr_sectors: %lu," |
@@ -801,13 +762,15 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive, | |||
801 | /* We do not support buffer cache originated requests. */ | 762 | /* We do not support buffer cache originated requests. */ |
802 | printk(KERN_NOTICE "ide-tape: %s: Unsupported request in " | 763 | printk(KERN_NOTICE "ide-tape: %s: Unsupported request in " |
803 | "request queue (%d)\n", drive->name, rq->cmd_type); | 764 | "request queue (%d)\n", drive->name, rq->cmd_type); |
804 | ide_end_request(drive, 0, 0); | 765 | if (blk_fs_request(rq) == 0 && rq->errors == 0) |
766 | rq->errors = -EIO; | ||
767 | ide_complete_rq(drive, -EIO, ide_rq_bytes(rq)); | ||
805 | return ide_stopped; | 768 | return ide_stopped; |
806 | } | 769 | } |
807 | 770 | ||
808 | /* Retry a failed packet command */ | 771 | /* Retry a failed packet command */ |
809 | if (tape->failed_pc && drive->pc->c[0] == REQUEST_SENSE) { | 772 | if (drive->failed_pc && drive->pc->c[0] == REQUEST_SENSE) { |
810 | pc = tape->failed_pc; | 773 | pc = drive->failed_pc; |
811 | goto out; | 774 | goto out; |
812 | } | 775 | } |
813 | 776 | ||
@@ -815,7 +778,9 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive, | |||
815 | if (rq != postponed_rq) { | 778 | if (rq != postponed_rq) { |
816 | printk(KERN_ERR "ide-tape: ide-tape.c bug - " | 779 | printk(KERN_ERR "ide-tape: ide-tape.c bug - " |
817 | "Two DSC requests were queued\n"); | 780 | "Two DSC requests were queued\n"); |
818 | idetape_end_request(drive, 0, 0); | 781 | drive->failed_pc = NULL; |
782 | rq->errors = 0; | ||
783 | ide_complete_rq(drive, 0, blk_rq_bytes(rq)); | ||
819 | return ide_stopped; | 784 | return ide_stopped; |
820 | } | 785 | } |
821 | 786 | ||
@@ -881,7 +846,14 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive, | |||
881 | BUG(); | 846 | BUG(); |
882 | 847 | ||
883 | out: | 848 | out: |
884 | return idetape_issue_pc(drive, pc); | 849 | memset(&cmd, 0, sizeof(cmd)); |
850 | |||
851 | if (rq_data_dir(rq)) | ||
852 | cmd.tf_flags |= IDE_TFLAG_WRITE; | ||
853 | |||
854 | cmd.rq = rq; | ||
855 | |||
856 | return ide_tape_issue_pc(drive, &cmd, pc); | ||
885 | } | 857 | } |
886 | 858 | ||
887 | /* | 859 | /* |
@@ -1226,7 +1198,7 @@ static int idetape_queue_rw_tail(ide_drive_t *drive, int cmd, int blocks, | |||
1226 | 1198 | ||
1227 | if (tape->merge_bh) | 1199 | if (tape->merge_bh) |
1228 | idetape_init_merge_buffer(tape); | 1200 | idetape_init_merge_buffer(tape); |
1229 | if (errors == IDETAPE_ERROR_GENERAL) | 1201 | if (errors == IDE_DRV_ERROR_GENERAL) |
1230 | return -EIO; | 1202 | return -EIO; |
1231 | return ret; | 1203 | return ret; |
1232 | } | 1204 | } |
@@ -2192,8 +2164,6 @@ static void idetape_setup(ide_drive_t *drive, idetape_tape_t *tape, int minor) | |||
2192 | drive->pc_update_buffers = idetape_update_buffers; | 2164 | drive->pc_update_buffers = idetape_update_buffers; |
2193 | drive->pc_io_buffers = ide_tape_io_buffers; | 2165 | drive->pc_io_buffers = ide_tape_io_buffers; |
2194 | 2166 | ||
2195 | spin_lock_init(&tape->lock); | ||
2196 | |||
2197 | drive->dev_flags |= IDE_DFLAG_DSC_OVERLAP; | 2167 | drive->dev_flags |= IDE_DFLAG_DSC_OVERLAP; |
2198 | 2168 | ||
2199 | if (drive->hwif->host_flags & IDE_HFLAG_NO_DSC) { | 2169 | if (drive->hwif->host_flags & IDE_HFLAG_NO_DSC) { |
@@ -2325,7 +2295,6 @@ static struct ide_driver idetape_driver = { | |||
2325 | .remove = ide_tape_remove, | 2295 | .remove = ide_tape_remove, |
2326 | .version = IDETAPE_VERSION, | 2296 | .version = IDETAPE_VERSION, |
2327 | .do_request = idetape_do_request, | 2297 | .do_request = idetape_do_request, |
2328 | .end_request = idetape_end_request, | ||
2329 | #ifdef CONFIG_IDE_PROC_FS | 2298 | #ifdef CONFIG_IDE_PROC_FS |
2330 | .proc_entries = ide_tape_proc_entries, | 2299 | .proc_entries = ide_tape_proc_entries, |
2331 | .proc_devsets = ide_tape_proc_devsets, | 2300 | .proc_devsets = ide_tape_proc_devsets, |
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 16138bce84a7..84532be97c00 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c | |||
@@ -39,88 +39,86 @@ void ide_tf_dump(const char *s, struct ide_taskfile *tf) | |||
39 | 39 | ||
40 | int taskfile_lib_get_identify (ide_drive_t *drive, u8 *buf) | 40 | int taskfile_lib_get_identify (ide_drive_t *drive, u8 *buf) |
41 | { | 41 | { |
42 | ide_task_t args; | 42 | struct ide_cmd cmd; |
43 | 43 | ||
44 | memset(&args, 0, sizeof(ide_task_t)); | 44 | memset(&cmd, 0, sizeof(cmd)); |
45 | args.tf.nsect = 0x01; | 45 | cmd.tf.nsect = 0x01; |
46 | if (drive->media == ide_disk) | 46 | if (drive->media == ide_disk) |
47 | args.tf.command = ATA_CMD_ID_ATA; | 47 | cmd.tf.command = ATA_CMD_ID_ATA; |
48 | else | 48 | else |
49 | args.tf.command = ATA_CMD_ID_ATAPI; | 49 | cmd.tf.command = ATA_CMD_ID_ATAPI; |
50 | args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; | 50 | cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; |
51 | args.data_phase = TASKFILE_IN; | 51 | cmd.protocol = ATA_PROT_PIO; |
52 | return ide_raw_taskfile(drive, &args, buf, 1); | 52 | |
53 | return ide_raw_taskfile(drive, &cmd, buf, 1); | ||
53 | } | 54 | } |
54 | 55 | ||
55 | static ide_startstop_t task_no_data_intr(ide_drive_t *); | 56 | static ide_startstop_t task_no_data_intr(ide_drive_t *); |
56 | static ide_startstop_t pre_task_out_intr(ide_drive_t *, struct request *); | 57 | static ide_startstop_t pre_task_out_intr(ide_drive_t *, struct ide_cmd *); |
57 | static ide_startstop_t task_in_intr(ide_drive_t *); | 58 | static ide_startstop_t task_pio_intr(ide_drive_t *); |
58 | 59 | ||
59 | ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task) | 60 | ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *orig_cmd) |
60 | { | 61 | { |
61 | ide_hwif_t *hwif = drive->hwif; | 62 | ide_hwif_t *hwif = drive->hwif; |
62 | struct ide_taskfile *tf = &task->tf; | 63 | struct ide_cmd *cmd = &hwif->cmd; |
64 | struct ide_taskfile *tf = &cmd->tf; | ||
63 | ide_handler_t *handler = NULL; | 65 | ide_handler_t *handler = NULL; |
64 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; | 66 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; |
65 | const struct ide_dma_ops *dma_ops = hwif->dma_ops; | 67 | const struct ide_dma_ops *dma_ops = hwif->dma_ops; |
66 | 68 | ||
67 | if (task->data_phase == TASKFILE_MULTI_IN || | 69 | if (orig_cmd->protocol == ATA_PROT_PIO && |
68 | task->data_phase == TASKFILE_MULTI_OUT) { | 70 | (orig_cmd->tf_flags & IDE_TFLAG_MULTI_PIO) && |
69 | if (!drive->mult_count) { | 71 | drive->mult_count == 0) { |
70 | printk(KERN_ERR "%s: multimode not set!\n", | 72 | printk(KERN_ERR "%s: multimode not set!\n", drive->name); |
71 | drive->name); | 73 | return ide_stopped; |
72 | return ide_stopped; | ||
73 | } | ||
74 | } | 74 | } |
75 | 75 | ||
76 | if (task->tf_flags & IDE_TFLAG_FLAGGED) | 76 | if (orig_cmd->ftf_flags & IDE_FTFLAG_FLAGGED) |
77 | task->tf_flags |= IDE_TFLAG_FLAGGED_SET_IN_FLAGS; | 77 | orig_cmd->ftf_flags |= IDE_FTFLAG_SET_IN_FLAGS; |
78 | 78 | ||
79 | memcpy(&hwif->task, task, sizeof(*task)); | 79 | memcpy(cmd, orig_cmd, sizeof(*cmd)); |
80 | 80 | ||
81 | if ((task->tf_flags & IDE_TFLAG_DMA_PIO_FALLBACK) == 0) { | 81 | if ((cmd->tf_flags & IDE_TFLAG_DMA_PIO_FALLBACK) == 0) { |
82 | ide_tf_dump(drive->name, tf); | 82 | ide_tf_dump(drive->name, tf); |
83 | tp_ops->set_irq(hwif, 1); | 83 | tp_ops->set_irq(hwif, 1); |
84 | SELECT_MASK(drive, 0); | 84 | SELECT_MASK(drive, 0); |
85 | tp_ops->tf_load(drive, task); | 85 | tp_ops->tf_load(drive, cmd); |
86 | } | 86 | } |
87 | 87 | ||
88 | switch (task->data_phase) { | 88 | switch (cmd->protocol) { |
89 | case TASKFILE_MULTI_OUT: | 89 | case ATA_PROT_PIO: |
90 | case TASKFILE_OUT: | 90 | if (cmd->tf_flags & IDE_TFLAG_WRITE) { |
91 | tp_ops->exec_command(hwif, tf->command); | 91 | tp_ops->exec_command(hwif, tf->command); |
92 | ndelay(400); /* FIXME */ | 92 | ndelay(400); /* FIXME */ |
93 | return pre_task_out_intr(drive, task->rq); | 93 | return pre_task_out_intr(drive, cmd); |
94 | case TASKFILE_MULTI_IN: | 94 | } |
95 | case TASKFILE_IN: | 95 | handler = task_pio_intr; |
96 | handler = task_in_intr; | ||
97 | /* fall-through */ | 96 | /* fall-through */ |
98 | case TASKFILE_NO_DATA: | 97 | case ATA_PROT_NODATA: |
99 | if (handler == NULL) | 98 | if (handler == NULL) |
100 | handler = task_no_data_intr; | 99 | handler = task_no_data_intr; |
101 | ide_execute_command(drive, tf->command, handler, | 100 | ide_execute_command(drive, cmd, handler, WAIT_WORSTCASE); |
102 | WAIT_WORSTCASE, NULL); | ||
103 | return ide_started; | 101 | return ide_started; |
104 | default: | 102 | case ATA_PROT_DMA: |
105 | if ((drive->dev_flags & IDE_DFLAG_USING_DMA) == 0 || | 103 | if ((drive->dev_flags & IDE_DFLAG_USING_DMA) == 0 || |
106 | dma_ops->dma_setup(drive)) | 104 | ide_build_sglist(drive, cmd) == 0 || |
105 | dma_ops->dma_setup(drive, cmd)) | ||
107 | return ide_stopped; | 106 | return ide_stopped; |
108 | dma_ops->dma_exec_cmd(drive, tf->command); | 107 | hwif->expiry = dma_ops->dma_timer_expiry; |
108 | ide_execute_command(drive, cmd, ide_dma_intr, 2 * WAIT_CMD); | ||
109 | dma_ops->dma_start(drive); | 109 | dma_ops->dma_start(drive); |
110 | default: | ||
110 | return ide_started; | 111 | return ide_started; |
111 | } | 112 | } |
112 | } | 113 | } |
113 | EXPORT_SYMBOL_GPL(do_rw_taskfile); | 114 | EXPORT_SYMBOL_GPL(do_rw_taskfile); |
114 | 115 | ||
115 | /* | ||
116 | * Handler for commands without a data phase | ||
117 | */ | ||
118 | static ide_startstop_t task_no_data_intr(ide_drive_t *drive) | 116 | static ide_startstop_t task_no_data_intr(ide_drive_t *drive) |
119 | { | 117 | { |
120 | ide_hwif_t *hwif = drive->hwif; | 118 | ide_hwif_t *hwif = drive->hwif; |
121 | ide_task_t *task = &hwif->task; | 119 | struct ide_cmd *cmd = &hwif->cmd; |
122 | struct ide_taskfile *tf = &task->tf; | 120 | struct ide_taskfile *tf = &cmd->tf; |
123 | int custom = (task->tf_flags & IDE_TFLAG_CUSTOM_HANDLER) ? 1 : 0; | 121 | int custom = (cmd->tf_flags & IDE_TFLAG_CUSTOM_HANDLER) ? 1 : 0; |
124 | int retries = (custom && tf->command == ATA_CMD_INIT_DEV_PARAMS) ? 5 : 1; | 122 | int retries = (custom && tf->command == ATA_CMD_INIT_DEV_PARAMS) ? 5 : 1; |
125 | u8 stat; | 123 | u8 stat; |
126 | 124 | ||
@@ -142,28 +140,26 @@ static ide_startstop_t task_no_data_intr(ide_drive_t *drive) | |||
142 | } else if (custom && tf->command == ATA_CMD_INIT_DEV_PARAMS) { | 140 | } else if (custom && tf->command == ATA_CMD_INIT_DEV_PARAMS) { |
143 | if ((stat & (ATA_ERR | ATA_DRQ)) == 0) { | 141 | if ((stat & (ATA_ERR | ATA_DRQ)) == 0) { |
144 | ide_set_handler(drive, &task_no_data_intr, | 142 | ide_set_handler(drive, &task_no_data_intr, |
145 | WAIT_WORSTCASE, NULL); | 143 | WAIT_WORSTCASE); |
146 | return ide_started; | 144 | return ide_started; |
147 | } | 145 | } |
148 | } | 146 | } |
149 | return ide_error(drive, "task_no_data_intr", stat); | 147 | return ide_error(drive, "task_no_data_intr", stat); |
150 | /* calls ide_end_drive_cmd */ | ||
151 | } | 148 | } |
152 | 149 | ||
153 | if (!custom) | 150 | if (custom && tf->command == ATA_CMD_SET_MULTI) |
154 | ide_end_drive_cmd(drive, stat, ide_read_error(drive)); | ||
155 | else if (tf->command == ATA_CMD_IDLEIMMEDIATE) { | ||
156 | hwif->tp_ops->tf_read(drive, task); | ||
157 | if (tf->lbal != 0xc4) { | ||
158 | printk(KERN_ERR "%s: head unload failed!\n", | ||
159 | drive->name); | ||
160 | ide_tf_dump(drive->name, tf); | ||
161 | } else | ||
162 | drive->dev_flags |= IDE_DFLAG_PARKED; | ||
163 | ide_end_drive_cmd(drive, stat, ide_read_error(drive)); | ||
164 | } else if (tf->command == ATA_CMD_SET_MULTI) | ||
165 | drive->mult_count = drive->mult_req; | 151 | drive->mult_count = drive->mult_req; |
166 | 152 | ||
153 | if (custom == 0 || tf->command == ATA_CMD_IDLEIMMEDIATE || | ||
154 | tf->command == ATA_CMD_CHK_POWER) { | ||
155 | struct request *rq = hwif->rq; | ||
156 | |||
157 | if (blk_pm_request(rq)) | ||
158 | ide_complete_pm_rq(drive, rq); | ||
159 | else | ||
160 | ide_finish_cmd(drive, cmd, stat); | ||
161 | } | ||
162 | |||
167 | return ide_stopped; | 163 | return ide_stopped; |
168 | } | 164 | } |
169 | 165 | ||
@@ -192,12 +188,12 @@ static u8 wait_drive_not_busy(ide_drive_t *drive) | |||
192 | return stat; | 188 | return stat; |
193 | } | 189 | } |
194 | 190 | ||
195 | static void ide_pio_sector(ide_drive_t *drive, struct request *rq, | 191 | static void ide_pio_bytes(ide_drive_t *drive, struct ide_cmd *cmd, |
196 | unsigned int write) | 192 | unsigned int write, unsigned int nr_bytes) |
197 | { | 193 | { |
198 | ide_hwif_t *hwif = drive->hwif; | 194 | ide_hwif_t *hwif = drive->hwif; |
199 | struct scatterlist *sg = hwif->sg_table; | 195 | struct scatterlist *sg = hwif->sg_table; |
200 | struct scatterlist *cursg = hwif->cursg; | 196 | struct scatterlist *cursg = cmd->cursg; |
201 | struct page *page; | 197 | struct page *page; |
202 | #ifdef CONFIG_HIGHMEM | 198 | #ifdef CONFIG_HIGHMEM |
203 | unsigned long flags; | 199 | unsigned long flags; |
@@ -205,14 +201,14 @@ static void ide_pio_sector(ide_drive_t *drive, struct request *rq, | |||
205 | unsigned int offset; | 201 | unsigned int offset; |
206 | u8 *buf; | 202 | u8 *buf; |
207 | 203 | ||
208 | cursg = hwif->cursg; | 204 | cursg = cmd->cursg; |
209 | if (!cursg) { | 205 | if (!cursg) { |
210 | cursg = sg; | 206 | cursg = sg; |
211 | hwif->cursg = sg; | 207 | cmd->cursg = sg; |
212 | } | 208 | } |
213 | 209 | ||
214 | page = sg_page(cursg); | 210 | page = sg_page(cursg); |
215 | offset = cursg->offset + hwif->cursg_ofs * SECTOR_SIZE; | 211 | offset = cursg->offset + cmd->cursg_ofs; |
216 | 212 | ||
217 | /* get the current page and offset */ | 213 | /* get the current page and offset */ |
218 | page = nth_page(page, (offset >> PAGE_SHIFT)); | 214 | page = nth_page(page, (offset >> PAGE_SHIFT)); |
@@ -223,19 +219,19 @@ static void ide_pio_sector(ide_drive_t *drive, struct request *rq, | |||
223 | #endif | 219 | #endif |
224 | buf = kmap_atomic(page, KM_BIO_SRC_IRQ) + offset; | 220 | buf = kmap_atomic(page, KM_BIO_SRC_IRQ) + offset; |
225 | 221 | ||
226 | hwif->nleft--; | 222 | cmd->nleft -= nr_bytes; |
227 | hwif->cursg_ofs++; | 223 | cmd->cursg_ofs += nr_bytes; |
228 | 224 | ||
229 | if ((hwif->cursg_ofs * SECTOR_SIZE) == cursg->length) { | 225 | if (cmd->cursg_ofs == cursg->length) { |
230 | hwif->cursg = sg_next(hwif->cursg); | 226 | cmd->cursg = sg_next(cmd->cursg); |
231 | hwif->cursg_ofs = 0; | 227 | cmd->cursg_ofs = 0; |
232 | } | 228 | } |
233 | 229 | ||
234 | /* do the actual data transfer */ | 230 | /* do the actual data transfer */ |
235 | if (write) | 231 | if (write) |
236 | hwif->tp_ops->output_data(drive, rq, buf, SECTOR_SIZE); | 232 | hwif->tp_ops->output_data(drive, cmd, buf, nr_bytes); |
237 | else | 233 | else |
238 | hwif->tp_ops->input_data(drive, rq, buf, SECTOR_SIZE); | 234 | hwif->tp_ops->input_data(drive, cmd, buf, nr_bytes); |
239 | 235 | ||
240 | kunmap_atomic(buf, KM_BIO_SRC_IRQ); | 236 | kunmap_atomic(buf, KM_BIO_SRC_IRQ); |
241 | #ifdef CONFIG_HIGHMEM | 237 | #ifdef CONFIG_HIGHMEM |
@@ -243,188 +239,137 @@ static void ide_pio_sector(ide_drive_t *drive, struct request *rq, | |||
243 | #endif | 239 | #endif |
244 | } | 240 | } |
245 | 241 | ||
246 | static void ide_pio_multi(ide_drive_t *drive, struct request *rq, | 242 | static void ide_pio_multi(ide_drive_t *drive, struct ide_cmd *cmd, |
247 | unsigned int write) | 243 | unsigned int write) |
248 | { | 244 | { |
249 | unsigned int nsect; | 245 | unsigned int nsect; |
250 | 246 | ||
251 | nsect = min_t(unsigned int, drive->hwif->nleft, drive->mult_count); | 247 | nsect = min_t(unsigned int, cmd->nleft >> 9, drive->mult_count); |
252 | while (nsect--) | 248 | while (nsect--) |
253 | ide_pio_sector(drive, rq, write); | 249 | ide_pio_bytes(drive, cmd, write, SECTOR_SIZE); |
254 | } | 250 | } |
255 | 251 | ||
256 | static void ide_pio_datablock(ide_drive_t *drive, struct request *rq, | 252 | static void ide_pio_datablock(ide_drive_t *drive, struct ide_cmd *cmd, |
257 | unsigned int write) | 253 | unsigned int write) |
258 | { | 254 | { |
259 | u8 saved_io_32bit = drive->io_32bit; | 255 | u8 saved_io_32bit = drive->io_32bit; |
260 | 256 | ||
261 | if (rq->bio) /* fs request */ | 257 | if (cmd->tf_flags & IDE_TFLAG_FS) |
262 | rq->errors = 0; | 258 | cmd->rq->errors = 0; |
263 | 259 | ||
264 | if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { | 260 | if (cmd->tf_flags & IDE_TFLAG_IO_16BIT) |
265 | ide_task_t *task = rq->special; | 261 | drive->io_32bit = 0; |
266 | |||
267 | if (task->tf_flags & IDE_TFLAG_IO_16BIT) | ||
268 | drive->io_32bit = 0; | ||
269 | } | ||
270 | 262 | ||
271 | touch_softlockup_watchdog(); | 263 | touch_softlockup_watchdog(); |
272 | 264 | ||
273 | switch (drive->hwif->data_phase) { | 265 | if (cmd->tf_flags & IDE_TFLAG_MULTI_PIO) |
274 | case TASKFILE_MULTI_IN: | 266 | ide_pio_multi(drive, cmd, write); |
275 | case TASKFILE_MULTI_OUT: | 267 | else |
276 | ide_pio_multi(drive, rq, write); | 268 | ide_pio_bytes(drive, cmd, write, SECTOR_SIZE); |
277 | break; | ||
278 | default: | ||
279 | ide_pio_sector(drive, rq, write); | ||
280 | break; | ||
281 | } | ||
282 | 269 | ||
283 | drive->io_32bit = saved_io_32bit; | 270 | drive->io_32bit = saved_io_32bit; |
284 | } | 271 | } |
285 | 272 | ||
286 | static ide_startstop_t task_error(ide_drive_t *drive, struct request *rq, | 273 | static void ide_error_cmd(ide_drive_t *drive, struct ide_cmd *cmd) |
287 | const char *s, u8 stat) | ||
288 | { | 274 | { |
289 | if (rq->bio) { | 275 | if (cmd->tf_flags & IDE_TFLAG_FS) { |
290 | ide_hwif_t *hwif = drive->hwif; | 276 | int nr_bytes = cmd->nbytes - cmd->nleft; |
291 | int sectors = hwif->nsect - hwif->nleft; | 277 | |
292 | 278 | if (cmd->protocol == ATA_PROT_PIO && | |
293 | switch (hwif->data_phase) { | 279 | ((cmd->tf_flags & IDE_TFLAG_WRITE) || cmd->nleft == 0)) { |
294 | case TASKFILE_IN: | 280 | if (cmd->tf_flags & IDE_TFLAG_MULTI_PIO) |
295 | if (hwif->nleft) | 281 | nr_bytes -= drive->mult_count << 9; |
296 | break; | 282 | else |
297 | /* fall through */ | 283 | nr_bytes -= SECTOR_SIZE; |
298 | case TASKFILE_OUT: | ||
299 | sectors--; | ||
300 | break; | ||
301 | case TASKFILE_MULTI_IN: | ||
302 | if (hwif->nleft) | ||
303 | break; | ||
304 | /* fall through */ | ||
305 | case TASKFILE_MULTI_OUT: | ||
306 | sectors -= drive->mult_count; | ||
307 | default: | ||
308 | break; | ||
309 | } | 284 | } |
310 | 285 | ||
311 | if (sectors > 0) { | 286 | if (nr_bytes > 0) |
312 | struct ide_driver *drv; | 287 | ide_complete_rq(drive, 0, nr_bytes); |
313 | |||
314 | drv = *(struct ide_driver **)rq->rq_disk->private_data; | ||
315 | drv->end_request(drive, 1, sectors); | ||
316 | } | ||
317 | } | 288 | } |
318 | return ide_error(drive, s, stat); | ||
319 | } | ||
320 | |||
321 | void task_end_request(ide_drive_t *drive, struct request *rq, u8 stat) | ||
322 | { | ||
323 | if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { | ||
324 | u8 err = ide_read_error(drive); | ||
325 | |||
326 | ide_end_drive_cmd(drive, stat, err); | ||
327 | return; | ||
328 | } | ||
329 | |||
330 | if (rq->rq_disk) { | ||
331 | struct ide_driver *drv; | ||
332 | |||
333 | drv = *(struct ide_driver **)rq->rq_disk->private_data;; | ||
334 | drv->end_request(drive, 1, rq->nr_sectors); | ||
335 | } else | ||
336 | ide_end_request(drive, 1, rq->nr_sectors); | ||
337 | } | 289 | } |
338 | 290 | ||
339 | /* | 291 | void ide_finish_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat) |
340 | * We got an interrupt on a task_in case, but no errors and no DRQ. | ||
341 | * | ||
342 | * It might be a spurious irq (shared irq), but it might be a | ||
343 | * command that had no output. | ||
344 | */ | ||
345 | static ide_startstop_t task_in_unexpected(ide_drive_t *drive, struct request *rq, u8 stat) | ||
346 | { | 292 | { |
347 | /* Command all done? */ | 293 | struct request *rq = drive->hwif->rq; |
348 | if (OK_STAT(stat, ATA_DRDY, ATA_BUSY)) { | 294 | u8 err = ide_read_error(drive); |
349 | task_end_request(drive, rq, stat); | ||
350 | return ide_stopped; | ||
351 | } | ||
352 | 295 | ||
353 | /* Assume it was a spurious irq */ | 296 | ide_complete_cmd(drive, cmd, stat, err); |
354 | ide_set_handler(drive, &task_in_intr, WAIT_WORSTCASE, NULL); | 297 | rq->errors = err; |
355 | return ide_started; | 298 | ide_complete_rq(drive, err ? -EIO : 0, blk_rq_bytes(rq)); |
356 | } | 299 | } |
357 | 300 | ||
358 | /* | 301 | /* |
359 | * Handler for command with PIO data-in phase (Read/Read Multiple). | 302 | * Handler for command with PIO data phase. |
360 | */ | 303 | */ |
361 | static ide_startstop_t task_in_intr(ide_drive_t *drive) | 304 | static ide_startstop_t task_pio_intr(ide_drive_t *drive) |
362 | { | 305 | { |
363 | ide_hwif_t *hwif = drive->hwif; | 306 | ide_hwif_t *hwif = drive->hwif; |
364 | struct request *rq = hwif->rq; | 307 | struct ide_cmd *cmd = &drive->hwif->cmd; |
365 | u8 stat = hwif->tp_ops->read_status(hwif); | 308 | u8 stat = hwif->tp_ops->read_status(hwif); |
309 | u8 write = !!(cmd->tf_flags & IDE_TFLAG_WRITE); | ||
366 | 310 | ||
367 | /* Error? */ | 311 | if (write == 0) { |
368 | if (stat & ATA_ERR) | 312 | /* Error? */ |
369 | return task_error(drive, rq, __func__, stat); | 313 | if (stat & ATA_ERR) |
314 | goto out_err; | ||
370 | 315 | ||
371 | /* Didn't want any data? Odd. */ | 316 | /* Didn't want any data? Odd. */ |
372 | if ((stat & ATA_DRQ) == 0) | 317 | if ((stat & ATA_DRQ) == 0) { |
373 | return task_in_unexpected(drive, rq, stat); | 318 | /* Command all done? */ |
319 | if (OK_STAT(stat, ATA_DRDY, ATA_BUSY)) | ||
320 | goto out_end; | ||
374 | 321 | ||
375 | ide_pio_datablock(drive, rq, 0); | 322 | /* Assume it was a spurious irq */ |
323 | goto out_wait; | ||
324 | } | ||
325 | } else { | ||
326 | if (!OK_STAT(stat, DRIVE_READY, drive->bad_wstat)) | ||
327 | goto out_err; | ||
376 | 328 | ||
377 | /* Are we done? Check status and finish transfer. */ | 329 | /* Deal with unexpected ATA data phase. */ |
378 | if (!hwif->nleft) { | 330 | if (((stat & ATA_DRQ) == 0) ^ (cmd->nleft == 0)) |
379 | stat = wait_drive_not_busy(drive); | 331 | goto out_err; |
380 | if (!OK_STAT(stat, 0, BAD_STAT)) | ||
381 | return task_error(drive, rq, __func__, stat); | ||
382 | task_end_request(drive, rq, stat); | ||
383 | return ide_stopped; | ||
384 | } | 332 | } |
385 | 333 | ||
386 | /* Still data left to transfer. */ | 334 | if (write && cmd->nleft == 0) |
387 | ide_set_handler(drive, &task_in_intr, WAIT_WORSTCASE, NULL); | 335 | goto out_end; |
388 | 336 | ||
389 | return ide_started; | 337 | /* Still data left to transfer. */ |
390 | } | 338 | ide_pio_datablock(drive, cmd, write); |
391 | |||
392 | /* | ||
393 | * Handler for command with PIO data-out phase (Write/Write Multiple). | ||
394 | */ | ||
395 | static ide_startstop_t task_out_intr (ide_drive_t *drive) | ||
396 | { | ||
397 | ide_hwif_t *hwif = drive->hwif; | ||
398 | struct request *rq = hwif->rq; | ||
399 | u8 stat = hwif->tp_ops->read_status(hwif); | ||
400 | |||
401 | if (!OK_STAT(stat, DRIVE_READY, drive->bad_wstat)) | ||
402 | return task_error(drive, rq, __func__, stat); | ||
403 | 339 | ||
404 | /* Deal with unexpected ATA data phase. */ | 340 | /* Are we done? Check status and finish transfer. */ |
405 | if (((stat & ATA_DRQ) == 0) ^ !hwif->nleft) | 341 | if (write == 0 && cmd->nleft == 0) { |
406 | return task_error(drive, rq, __func__, stat); | 342 | stat = wait_drive_not_busy(drive); |
343 | if (!OK_STAT(stat, 0, BAD_STAT)) | ||
344 | goto out_err; | ||
407 | 345 | ||
408 | if (!hwif->nleft) { | 346 | goto out_end; |
409 | task_end_request(drive, rq, stat); | ||
410 | return ide_stopped; | ||
411 | } | 347 | } |
412 | 348 | out_wait: | |
413 | /* Still data left to transfer. */ | 349 | /* Still data left to transfer. */ |
414 | ide_pio_datablock(drive, rq, 1); | 350 | ide_set_handler(drive, &task_pio_intr, WAIT_WORSTCASE); |
415 | ide_set_handler(drive, &task_out_intr, WAIT_WORSTCASE, NULL); | ||
416 | |||
417 | return ide_started; | 351 | return ide_started; |
352 | out_end: | ||
353 | if ((cmd->tf_flags & IDE_TFLAG_FS) == 0) | ||
354 | ide_finish_cmd(drive, cmd, stat); | ||
355 | else | ||
356 | ide_complete_rq(drive, 0, cmd->rq->nr_sectors << 9); | ||
357 | return ide_stopped; | ||
358 | out_err: | ||
359 | ide_error_cmd(drive, cmd); | ||
360 | return ide_error(drive, __func__, stat); | ||
418 | } | 361 | } |
419 | 362 | ||
420 | static ide_startstop_t pre_task_out_intr(ide_drive_t *drive, struct request *rq) | 363 | static ide_startstop_t pre_task_out_intr(ide_drive_t *drive, |
364 | struct ide_cmd *cmd) | ||
421 | { | 365 | { |
422 | ide_startstop_t startstop; | 366 | ide_startstop_t startstop; |
423 | 367 | ||
424 | if (ide_wait_stat(&startstop, drive, ATA_DRQ, | 368 | if (ide_wait_stat(&startstop, drive, ATA_DRQ, |
425 | drive->bad_wstat, WAIT_DRQ)) { | 369 | drive->bad_wstat, WAIT_DRQ)) { |
426 | printk(KERN_ERR "%s: no DRQ after issuing %sWRITE%s\n", | 370 | printk(KERN_ERR "%s: no DRQ after issuing %sWRITE%s\n", |
427 | drive->name, drive->hwif->data_phase ? "MULT" : "", | 371 | drive->name, |
372 | (cmd->tf_flags & IDE_TFLAG_MULTI_PIO) ? "MULT" : "", | ||
428 | (drive->dev_flags & IDE_DFLAG_LBA48) ? "_EXT" : ""); | 373 | (drive->dev_flags & IDE_DFLAG_LBA48) ? "_EXT" : ""); |
429 | return startstop; | 374 | return startstop; |
430 | } | 375 | } |
@@ -432,13 +377,15 @@ static ide_startstop_t pre_task_out_intr(ide_drive_t *drive, struct request *rq) | |||
432 | if ((drive->dev_flags & IDE_DFLAG_UNMASK) == 0) | 377 | if ((drive->dev_flags & IDE_DFLAG_UNMASK) == 0) |
433 | local_irq_disable(); | 378 | local_irq_disable(); |
434 | 379 | ||
435 | ide_set_handler(drive, &task_out_intr, WAIT_WORSTCASE, NULL); | 380 | ide_set_handler(drive, &task_pio_intr, WAIT_WORSTCASE); |
436 | ide_pio_datablock(drive, rq, 1); | 381 | |
382 | ide_pio_datablock(drive, cmd, 1); | ||
437 | 383 | ||
438 | return ide_started; | 384 | return ide_started; |
439 | } | 385 | } |
440 | 386 | ||
441 | int ide_raw_taskfile(ide_drive_t *drive, ide_task_t *task, u8 *buf, u16 nsect) | 387 | int ide_raw_taskfile(ide_drive_t *drive, struct ide_cmd *cmd, u8 *buf, |
388 | u16 nsect) | ||
442 | { | 389 | { |
443 | struct request *rq; | 390 | struct request *rq; |
444 | int error; | 391 | int error; |
@@ -456,11 +403,11 @@ int ide_raw_taskfile(ide_drive_t *drive, ide_task_t *task, u8 *buf, u16 nsect) | |||
456 | rq->hard_nr_sectors = rq->nr_sectors = nsect; | 403 | rq->hard_nr_sectors = rq->nr_sectors = nsect; |
457 | rq->hard_cur_sectors = rq->current_nr_sectors = nsect; | 404 | rq->hard_cur_sectors = rq->current_nr_sectors = nsect; |
458 | 405 | ||
459 | if (task->tf_flags & IDE_TFLAG_WRITE) | 406 | if (cmd->tf_flags & IDE_TFLAG_WRITE) |
460 | rq->cmd_flags |= REQ_RW; | 407 | rq->cmd_flags |= REQ_RW; |
461 | 408 | ||
462 | rq->special = task; | 409 | rq->special = cmd; |
463 | task->rq = rq; | 410 | cmd->rq = rq; |
464 | 411 | ||
465 | error = blk_execute_rq(drive->queue, NULL, rq, 0); | 412 | error = blk_execute_rq(drive->queue, NULL, rq, 0); |
466 | blk_put_request(rq); | 413 | blk_put_request(rq); |
@@ -470,19 +417,19 @@ int ide_raw_taskfile(ide_drive_t *drive, ide_task_t *task, u8 *buf, u16 nsect) | |||
470 | 417 | ||
471 | EXPORT_SYMBOL(ide_raw_taskfile); | 418 | EXPORT_SYMBOL(ide_raw_taskfile); |
472 | 419 | ||
473 | int ide_no_data_taskfile(ide_drive_t *drive, ide_task_t *task) | 420 | int ide_no_data_taskfile(ide_drive_t *drive, struct ide_cmd *cmd) |
474 | { | 421 | { |
475 | task->data_phase = TASKFILE_NO_DATA; | 422 | cmd->protocol = ATA_PROT_NODATA; |
476 | 423 | ||
477 | return ide_raw_taskfile(drive, task, NULL, 0); | 424 | return ide_raw_taskfile(drive, cmd, NULL, 0); |
478 | } | 425 | } |
479 | EXPORT_SYMBOL_GPL(ide_no_data_taskfile); | 426 | EXPORT_SYMBOL_GPL(ide_no_data_taskfile); |
480 | 427 | ||
481 | #ifdef CONFIG_IDE_TASK_IOCTL | 428 | #ifdef CONFIG_IDE_TASK_IOCTL |
482 | int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) | 429 | int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg) |
483 | { | 430 | { |
484 | ide_task_request_t *req_task; | 431 | ide_task_request_t *req_task; |
485 | ide_task_t args; | 432 | struct ide_cmd cmd; |
486 | u8 *outbuf = NULL; | 433 | u8 *outbuf = NULL; |
487 | u8 *inbuf = NULL; | 434 | u8 *inbuf = NULL; |
488 | u8 *data_buf = NULL; | 435 | u8 *data_buf = NULL; |
@@ -536,53 +483,63 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) | |||
536 | } | 483 | } |
537 | } | 484 | } |
538 | 485 | ||
539 | memset(&args, 0, sizeof(ide_task_t)); | 486 | memset(&cmd, 0, sizeof(cmd)); |
540 | 487 | ||
541 | memcpy(&args.tf_array[0], req_task->hob_ports, HDIO_DRIVE_HOB_HDR_SIZE - 2); | 488 | memcpy(&cmd.tf_array[0], req_task->hob_ports, |
542 | memcpy(&args.tf_array[6], req_task->io_ports, HDIO_DRIVE_TASK_HDR_SIZE); | 489 | HDIO_DRIVE_HOB_HDR_SIZE - 2); |
490 | memcpy(&cmd.tf_array[6], req_task->io_ports, | ||
491 | HDIO_DRIVE_TASK_HDR_SIZE); | ||
543 | 492 | ||
544 | args.data_phase = req_task->data_phase; | 493 | cmd.tf_flags = IDE_TFLAG_IO_16BIT | IDE_TFLAG_DEVICE | |
494 | IDE_TFLAG_IN_TF; | ||
545 | 495 | ||
546 | args.tf_flags = IDE_TFLAG_IO_16BIT | IDE_TFLAG_DEVICE | | ||
547 | IDE_TFLAG_IN_TF; | ||
548 | if (drive->dev_flags & IDE_DFLAG_LBA48) | 496 | if (drive->dev_flags & IDE_DFLAG_LBA48) |
549 | args.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_IN_HOB); | 497 | cmd.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_IN_HOB); |
550 | 498 | ||
551 | if (req_task->out_flags.all) { | 499 | if (req_task->out_flags.all) { |
552 | args.tf_flags |= IDE_TFLAG_FLAGGED; | 500 | cmd.ftf_flags |= IDE_FTFLAG_FLAGGED; |
553 | 501 | ||
554 | if (req_task->out_flags.b.data) | 502 | if (req_task->out_flags.b.data) |
555 | args.tf_flags |= IDE_TFLAG_OUT_DATA; | 503 | cmd.ftf_flags |= IDE_FTFLAG_OUT_DATA; |
556 | 504 | ||
557 | if (req_task->out_flags.b.nsector_hob) | 505 | if (req_task->out_flags.b.nsector_hob) |
558 | args.tf_flags |= IDE_TFLAG_OUT_HOB_NSECT; | 506 | cmd.tf_flags |= IDE_TFLAG_OUT_HOB_NSECT; |
559 | if (req_task->out_flags.b.sector_hob) | 507 | if (req_task->out_flags.b.sector_hob) |
560 | args.tf_flags |= IDE_TFLAG_OUT_HOB_LBAL; | 508 | cmd.tf_flags |= IDE_TFLAG_OUT_HOB_LBAL; |
561 | if (req_task->out_flags.b.lcyl_hob) | 509 | if (req_task->out_flags.b.lcyl_hob) |
562 | args.tf_flags |= IDE_TFLAG_OUT_HOB_LBAM; | 510 | cmd.tf_flags |= IDE_TFLAG_OUT_HOB_LBAM; |
563 | if (req_task->out_flags.b.hcyl_hob) | 511 | if (req_task->out_flags.b.hcyl_hob) |
564 | args.tf_flags |= IDE_TFLAG_OUT_HOB_LBAH; | 512 | cmd.tf_flags |= IDE_TFLAG_OUT_HOB_LBAH; |
565 | 513 | ||
566 | if (req_task->out_flags.b.error_feature) | 514 | if (req_task->out_flags.b.error_feature) |
567 | args.tf_flags |= IDE_TFLAG_OUT_FEATURE; | 515 | cmd.tf_flags |= IDE_TFLAG_OUT_FEATURE; |
568 | if (req_task->out_flags.b.nsector) | 516 | if (req_task->out_flags.b.nsector) |
569 | args.tf_flags |= IDE_TFLAG_OUT_NSECT; | 517 | cmd.tf_flags |= IDE_TFLAG_OUT_NSECT; |
570 | if (req_task->out_flags.b.sector) | 518 | if (req_task->out_flags.b.sector) |
571 | args.tf_flags |= IDE_TFLAG_OUT_LBAL; | 519 | cmd.tf_flags |= IDE_TFLAG_OUT_LBAL; |
572 | if (req_task->out_flags.b.lcyl) | 520 | if (req_task->out_flags.b.lcyl) |
573 | args.tf_flags |= IDE_TFLAG_OUT_LBAM; | 521 | cmd.tf_flags |= IDE_TFLAG_OUT_LBAM; |
574 | if (req_task->out_flags.b.hcyl) | 522 | if (req_task->out_flags.b.hcyl) |
575 | args.tf_flags |= IDE_TFLAG_OUT_LBAH; | 523 | cmd.tf_flags |= IDE_TFLAG_OUT_LBAH; |
576 | } else { | 524 | } else { |
577 | args.tf_flags |= IDE_TFLAG_OUT_TF; | 525 | cmd.tf_flags |= IDE_TFLAG_OUT_TF; |
578 | if (args.tf_flags & IDE_TFLAG_LBA48) | 526 | if (cmd.tf_flags & IDE_TFLAG_LBA48) |
579 | args.tf_flags |= IDE_TFLAG_OUT_HOB; | 527 | cmd.tf_flags |= IDE_TFLAG_OUT_HOB; |
580 | } | 528 | } |
581 | 529 | ||
582 | if (req_task->in_flags.b.data) | 530 | if (req_task->in_flags.b.data) |
583 | args.tf_flags |= IDE_TFLAG_IN_DATA; | 531 | cmd.ftf_flags |= IDE_FTFLAG_IN_DATA; |
584 | 532 | ||
585 | switch(req_task->data_phase) { | 533 | if (req_task->req_cmd == IDE_DRIVE_TASK_RAW_WRITE) { |
534 | /* fixup data phase if needed */ | ||
535 | if (req_task->data_phase == TASKFILE_IN_DMAQ || | ||
536 | req_task->data_phase == TASKFILE_IN_DMA) | ||
537 | cmd.tf_flags |= IDE_TFLAG_WRITE; | ||
538 | } | ||
539 | |||
540 | cmd.protocol = ATA_PROT_DMA; | ||
541 | |||
542 | switch (req_task->data_phase) { | ||
586 | case TASKFILE_MULTI_OUT: | 543 | case TASKFILE_MULTI_OUT: |
587 | if (!drive->mult_count) { | 544 | if (!drive->mult_count) { |
588 | /* (hs): give up if multcount is not set */ | 545 | /* (hs): give up if multcount is not set */ |
@@ -592,11 +549,14 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) | |||
592 | err = -EPERM; | 549 | err = -EPERM; |
593 | goto abort; | 550 | goto abort; |
594 | } | 551 | } |
552 | cmd.tf_flags |= IDE_TFLAG_MULTI_PIO; | ||
595 | /* fall through */ | 553 | /* fall through */ |
596 | case TASKFILE_OUT: | 554 | case TASKFILE_OUT: |
555 | cmd.protocol = ATA_PROT_PIO; | ||
597 | /* fall through */ | 556 | /* fall through */ |
598 | case TASKFILE_OUT_DMAQ: | 557 | case TASKFILE_OUT_DMAQ: |
599 | case TASKFILE_OUT_DMA: | 558 | case TASKFILE_OUT_DMA: |
559 | cmd.tf_flags |= IDE_TFLAG_WRITE; | ||
600 | nsect = taskout / SECTOR_SIZE; | 560 | nsect = taskout / SECTOR_SIZE; |
601 | data_buf = outbuf; | 561 | data_buf = outbuf; |
602 | break; | 562 | break; |
@@ -609,8 +569,10 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) | |||
609 | err = -EPERM; | 569 | err = -EPERM; |
610 | goto abort; | 570 | goto abort; |
611 | } | 571 | } |
572 | cmd.tf_flags |= IDE_TFLAG_MULTI_PIO; | ||
612 | /* fall through */ | 573 | /* fall through */ |
613 | case TASKFILE_IN: | 574 | case TASKFILE_IN: |
575 | cmd.protocol = ATA_PROT_PIO; | ||
614 | /* fall through */ | 576 | /* fall through */ |
615 | case TASKFILE_IN_DMAQ: | 577 | case TASKFILE_IN_DMAQ: |
616 | case TASKFILE_IN_DMA: | 578 | case TASKFILE_IN_DMA: |
@@ -618,6 +580,7 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) | |||
618 | data_buf = inbuf; | 580 | data_buf = inbuf; |
619 | break; | 581 | break; |
620 | case TASKFILE_NO_DATA: | 582 | case TASKFILE_NO_DATA: |
583 | cmd.protocol = ATA_PROT_NODATA; | ||
621 | break; | 584 | break; |
622 | default: | 585 | default: |
623 | err = -EFAULT; | 586 | err = -EFAULT; |
@@ -627,7 +590,7 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) | |||
627 | if (req_task->req_cmd == IDE_DRIVE_TASK_NO_DATA) | 590 | if (req_task->req_cmd == IDE_DRIVE_TASK_NO_DATA) |
628 | nsect = 0; | 591 | nsect = 0; |
629 | else if (!nsect) { | 592 | else if (!nsect) { |
630 | nsect = (args.tf.hob_nsect << 8) | args.tf.nsect; | 593 | nsect = (cmd.tf.hob_nsect << 8) | cmd.tf.nsect; |
631 | 594 | ||
632 | if (!nsect) { | 595 | if (!nsect) { |
633 | printk(KERN_ERR "%s: in/out command without data\n", | 596 | printk(KERN_ERR "%s: in/out command without data\n", |
@@ -637,15 +600,14 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) | |||
637 | } | 600 | } |
638 | } | 601 | } |
639 | 602 | ||
640 | if (req_task->req_cmd == IDE_DRIVE_TASK_RAW_WRITE) | 603 | err = ide_raw_taskfile(drive, &cmd, data_buf, nsect); |
641 | args.tf_flags |= IDE_TFLAG_WRITE; | ||
642 | |||
643 | err = ide_raw_taskfile(drive, &args, data_buf, nsect); | ||
644 | 604 | ||
645 | memcpy(req_task->hob_ports, &args.tf_array[0], HDIO_DRIVE_HOB_HDR_SIZE - 2); | 605 | memcpy(req_task->hob_ports, &cmd.tf_array[0], |
646 | memcpy(req_task->io_ports, &args.tf_array[6], HDIO_DRIVE_TASK_HDR_SIZE); | 606 | HDIO_DRIVE_HOB_HDR_SIZE - 2); |
607 | memcpy(req_task->io_ports, &cmd.tf_array[6], | ||
608 | HDIO_DRIVE_TASK_HDR_SIZE); | ||
647 | 609 | ||
648 | if ((args.tf_flags & IDE_TFLAG_FLAGGED_SET_IN_FLAGS) && | 610 | if ((cmd.ftf_flags & IDE_FTFLAG_SET_IN_FLAGS) && |
649 | req_task->in_flags.all == 0) { | 611 | req_task->in_flags.all == 0) { |
650 | req_task->in_flags.all = IDE_TASKFILE_STD_IN_FLAGS; | 612 | req_task->in_flags.all = IDE_TASKFILE_STD_IN_FLAGS; |
651 | if (drive->dev_flags & IDE_DFLAG_LBA48) | 613 | if (drive->dev_flags & IDE_DFLAG_LBA48) |
diff --git a/drivers/ide/ide_arm.c b/drivers/ide/ide_arm.c index bdcac94d7c1f..cf6385446ece 100644 --- a/drivers/ide/ide_arm.c +++ b/drivers/ide/ide_arm.c | |||
@@ -18,6 +18,10 @@ | |||
18 | #define IDE_ARM_IO 0x1f0 | 18 | #define IDE_ARM_IO 0x1f0 |
19 | #define IDE_ARM_IRQ IRQ_HARDDISK | 19 | #define IDE_ARM_IRQ IRQ_HARDDISK |
20 | 20 | ||
21 | static const struct ide_port_info ide_arm_port_info = { | ||
22 | .host_flags = IDE_HFLAG_NO_DMA, | ||
23 | }; | ||
24 | |||
21 | static int __init ide_arm_init(void) | 25 | static int __init ide_arm_init(void) |
22 | { | 26 | { |
23 | unsigned long base = IDE_ARM_IO, ctl = IDE_ARM_IO + 0x206; | 27 | unsigned long base = IDE_ARM_IO, ctl = IDE_ARM_IO + 0x206; |
@@ -41,7 +45,7 @@ static int __init ide_arm_init(void) | |||
41 | hw.irq = IDE_ARM_IRQ; | 45 | hw.irq = IDE_ARM_IRQ; |
42 | hw.chipset = ide_generic; | 46 | hw.chipset = ide_generic; |
43 | 47 | ||
44 | return ide_host_add(NULL, hws, NULL); | 48 | return ide_host_add(&ide_arm_port_info, hws, NULL); |
45 | } | 49 | } |
46 | 50 | ||
47 | module_init(ide_arm_init); | 51 | module_init(ide_arm_init); |
diff --git a/drivers/ide/it821x.c b/drivers/ide/it821x.c index 6b9fc950b4af..0d4ac65cf949 100644 --- a/drivers/ide/it821x.c +++ b/drivers/ide/it821x.c | |||
@@ -508,10 +508,10 @@ static void it821x_quirkproc(ide_drive_t *drive) | |||
508 | static struct ide_dma_ops it821x_pass_through_dma_ops = { | 508 | static struct ide_dma_ops it821x_pass_through_dma_ops = { |
509 | .dma_host_set = ide_dma_host_set, | 509 | .dma_host_set = ide_dma_host_set, |
510 | .dma_setup = ide_dma_setup, | 510 | .dma_setup = ide_dma_setup, |
511 | .dma_exec_cmd = ide_dma_exec_cmd, | ||
512 | .dma_start = it821x_dma_start, | 511 | .dma_start = it821x_dma_start, |
513 | .dma_end = it821x_dma_end, | 512 | .dma_end = it821x_dma_end, |
514 | .dma_test_irq = ide_dma_test_irq, | 513 | .dma_test_irq = ide_dma_test_irq, |
514 | .dma_timer_expiry = ide_dma_sff_timer_expiry, | ||
515 | .dma_timeout = ide_dma_timeout, | 515 | .dma_timeout = ide_dma_timeout, |
516 | .dma_lost_irq = ide_dma_lost_irq, | 516 | .dma_lost_irq = ide_dma_lost_irq, |
517 | .dma_sff_read_status = ide_dma_sff_read_status, | 517 | .dma_sff_read_status = ide_dma_sff_read_status, |
diff --git a/drivers/ide/macide.c b/drivers/ide/macide.c index 3c60064f1d4f..4b1718e83283 100644 --- a/drivers/ide/macide.c +++ b/drivers/ide/macide.c | |||
@@ -80,6 +80,11 @@ static void __init macide_setup_ports(hw_regs_t *hw, unsigned long base, | |||
80 | hw->chipset = ide_generic; | 80 | hw->chipset = ide_generic; |
81 | } | 81 | } |
82 | 82 | ||
83 | static const struct ide_port_info macide_port_info = { | ||
84 | .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA, | ||
85 | .irq_flags = IRQF_SHARED, | ||
86 | }; | ||
87 | |||
83 | static const char *mac_ide_name[] = | 88 | static const char *mac_ide_name[] = |
84 | { "Quadra", "Powerbook", "Powerbook Baboon" }; | 89 | { "Quadra", "Powerbook", "Powerbook Baboon" }; |
85 | 90 | ||
@@ -122,7 +127,7 @@ static int __init macide_init(void) | |||
122 | 127 | ||
123 | macide_setup_ports(&hw, base, irq, ack_intr); | 128 | macide_setup_ports(&hw, base, irq, ack_intr); |
124 | 129 | ||
125 | return ide_host_add(NULL, hws, NULL); | 130 | return ide_host_add(&macide_port_info, hws, NULL); |
126 | } | 131 | } |
127 | 132 | ||
128 | module_init(macide_init); | 133 | module_init(macide_init); |
diff --git a/drivers/ide/ns87415.c b/drivers/ide/ns87415.c index ea48a3ee8063..7b65fe5bf449 100644 --- a/drivers/ide/ns87415.c +++ b/drivers/ide/ns87415.c | |||
@@ -61,12 +61,12 @@ static u8 superio_dma_sff_read_status(ide_hwif_t *hwif) | |||
61 | return superio_ide_inb(hwif->dma_base + ATA_DMA_STATUS); | 61 | return superio_ide_inb(hwif->dma_base + ATA_DMA_STATUS); |
62 | } | 62 | } |
63 | 63 | ||
64 | static void superio_tf_read(ide_drive_t *drive, ide_task_t *task) | 64 | static void superio_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) |
65 | { | 65 | { |
66 | struct ide_io_ports *io_ports = &drive->hwif->io_ports; | 66 | struct ide_io_ports *io_ports = &drive->hwif->io_ports; |
67 | struct ide_taskfile *tf = &task->tf; | 67 | struct ide_taskfile *tf = &cmd->tf; |
68 | 68 | ||
69 | if (task->tf_flags & IDE_TFLAG_IN_DATA) { | 69 | if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) { |
70 | u16 data = inw(io_ports->data_addr); | 70 | u16 data = inw(io_ports->data_addr); |
71 | 71 | ||
72 | tf->data = data & 0xff; | 72 | tf->data = data & 0xff; |
@@ -76,31 +76,31 @@ static void superio_tf_read(ide_drive_t *drive, ide_task_t *task) | |||
76 | /* be sure we're looking at the low order bits */ | 76 | /* be sure we're looking at the low order bits */ |
77 | outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); | 77 | outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); |
78 | 78 | ||
79 | if (task->tf_flags & IDE_TFLAG_IN_FEATURE) | 79 | if (cmd->tf_flags & IDE_TFLAG_IN_FEATURE) |
80 | tf->feature = inb(io_ports->feature_addr); | 80 | tf->feature = inb(io_ports->feature_addr); |
81 | if (task->tf_flags & IDE_TFLAG_IN_NSECT) | 81 | if (cmd->tf_flags & IDE_TFLAG_IN_NSECT) |
82 | tf->nsect = inb(io_ports->nsect_addr); | 82 | tf->nsect = inb(io_ports->nsect_addr); |
83 | if (task->tf_flags & IDE_TFLAG_IN_LBAL) | 83 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAL) |
84 | tf->lbal = inb(io_ports->lbal_addr); | 84 | tf->lbal = inb(io_ports->lbal_addr); |
85 | if (task->tf_flags & IDE_TFLAG_IN_LBAM) | 85 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAM) |
86 | tf->lbam = inb(io_ports->lbam_addr); | 86 | tf->lbam = inb(io_ports->lbam_addr); |
87 | if (task->tf_flags & IDE_TFLAG_IN_LBAH) | 87 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAH) |
88 | tf->lbah = inb(io_ports->lbah_addr); | 88 | tf->lbah = inb(io_ports->lbah_addr); |
89 | if (task->tf_flags & IDE_TFLAG_IN_DEVICE) | 89 | if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE) |
90 | tf->device = superio_ide_inb(io_ports->device_addr); | 90 | tf->device = superio_ide_inb(io_ports->device_addr); |
91 | 91 | ||
92 | if (task->tf_flags & IDE_TFLAG_LBA48) { | 92 | if (cmd->tf_flags & IDE_TFLAG_LBA48) { |
93 | outb(ATA_DEVCTL_OBS | 0x80, io_ports->ctl_addr); | 93 | outb(ATA_DEVCTL_OBS | 0x80, io_ports->ctl_addr); |
94 | 94 | ||
95 | if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) | 95 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) |
96 | tf->hob_feature = inb(io_ports->feature_addr); | 96 | tf->hob_feature = inb(io_ports->feature_addr); |
97 | if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT) | 97 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT) |
98 | tf->hob_nsect = inb(io_ports->nsect_addr); | 98 | tf->hob_nsect = inb(io_ports->nsect_addr); |
99 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL) | 99 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL) |
100 | tf->hob_lbal = inb(io_ports->lbal_addr); | 100 | tf->hob_lbal = inb(io_ports->lbal_addr); |
101 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM) | 101 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM) |
102 | tf->hob_lbam = inb(io_ports->lbam_addr); | 102 | tf->hob_lbam = inb(io_ports->lbam_addr); |
103 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH) | 103 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH) |
104 | tf->hob_lbah = inb(io_ports->lbah_addr); | 104 | tf->hob_lbah = inb(io_ports->lbah_addr); |
105 | } | 105 | } |
106 | } | 106 | } |
@@ -216,11 +216,11 @@ static int ns87415_dma_end(ide_drive_t *drive) | |||
216 | return (dma_stat & 7) != 4; | 216 | return (dma_stat & 7) != 4; |
217 | } | 217 | } |
218 | 218 | ||
219 | static int ns87415_dma_setup(ide_drive_t *drive) | 219 | static int ns87415_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) |
220 | { | 220 | { |
221 | /* select DMA xfer */ | 221 | /* select DMA xfer */ |
222 | ns87415_prepare_drive(drive, 1); | 222 | ns87415_prepare_drive(drive, 1); |
223 | if (!ide_dma_setup(drive)) | 223 | if (ide_dma_setup(drive, cmd) == 0) |
224 | return 0; | 224 | return 0; |
225 | /* DMA failed: select PIO xfer */ | 225 | /* DMA failed: select PIO xfer */ |
226 | ns87415_prepare_drive(drive, 0); | 226 | ns87415_prepare_drive(drive, 0); |
@@ -301,11 +301,11 @@ static const struct ide_port_ops ns87415_port_ops = { | |||
301 | static const struct ide_dma_ops ns87415_dma_ops = { | 301 | static const struct ide_dma_ops ns87415_dma_ops = { |
302 | .dma_host_set = ide_dma_host_set, | 302 | .dma_host_set = ide_dma_host_set, |
303 | .dma_setup = ns87415_dma_setup, | 303 | .dma_setup = ns87415_dma_setup, |
304 | .dma_exec_cmd = ide_dma_exec_cmd, | ||
305 | .dma_start = ide_dma_start, | 304 | .dma_start = ide_dma_start, |
306 | .dma_end = ns87415_dma_end, | 305 | .dma_end = ns87415_dma_end, |
307 | .dma_test_irq = ide_dma_test_irq, | 306 | .dma_test_irq = ide_dma_test_irq, |
308 | .dma_lost_irq = ide_dma_lost_irq, | 307 | .dma_lost_irq = ide_dma_lost_irq, |
308 | .dma_timer_expiry = ide_dma_sff_timer_expiry, | ||
309 | .dma_timeout = ide_dma_timeout, | 309 | .dma_timeout = ide_dma_timeout, |
310 | .dma_sff_read_status = superio_dma_sff_read_status, | 310 | .dma_sff_read_status = superio_dma_sff_read_status, |
311 | }; | 311 | }; |
diff --git a/drivers/ide/palm_bk3710.c b/drivers/ide/palm_bk3710.c index f38aac78044c..c7acca0b8733 100644 --- a/drivers/ide/palm_bk3710.c +++ b/drivers/ide/palm_bk3710.c | |||
@@ -347,7 +347,7 @@ static int __init palm_bk3710_probe(struct platform_device *pdev) | |||
347 | struct clk *clk; | 347 | struct clk *clk; |
348 | struct resource *mem, *irq; | 348 | struct resource *mem, *irq; |
349 | void __iomem *base; | 349 | void __iomem *base; |
350 | unsigned long rate; | 350 | unsigned long rate, mem_size; |
351 | int i, rc; | 351 | int i, rc; |
352 | hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; | 352 | hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; |
353 | 353 | ||
@@ -374,13 +374,18 @@ static int __init palm_bk3710_probe(struct platform_device *pdev) | |||
374 | return -ENODEV; | 374 | return -ENODEV; |
375 | } | 375 | } |
376 | 376 | ||
377 | if (request_mem_region(mem->start, mem->end - mem->start + 1, | 377 | mem_size = mem->end - mem->start + 1; |
378 | "palm_bk3710") == NULL) { | 378 | if (request_mem_region(mem->start, mem_size, "palm_bk3710") == NULL) { |
379 | printk(KERN_ERR "failed to request memory region\n"); | 379 | printk(KERN_ERR "failed to request memory region\n"); |
380 | return -EBUSY; | 380 | return -EBUSY; |
381 | } | 381 | } |
382 | 382 | ||
383 | base = IO_ADDRESS(mem->start); | 383 | base = ioremap(mem->start, mem_size); |
384 | if (!base) { | ||
385 | printk(KERN_ERR "failed to map IO memory\n"); | ||
386 | release_mem_region(mem->start, mem_size); | ||
387 | return -ENOMEM; | ||
388 | } | ||
384 | 389 | ||
385 | /* Configure the Palm Chip controller */ | 390 | /* Configure the Palm Chip controller */ |
386 | palm_bk3710_chipinit(base); | 391 | palm_bk3710_chipinit(base); |
diff --git a/drivers/ide/pdc202xx_old.c b/drivers/ide/pdc202xx_old.c index cba66ebce4e3..f7536d1943f7 100644 --- a/drivers/ide/pdc202xx_old.c +++ b/drivers/ide/pdc202xx_old.c | |||
@@ -331,11 +331,11 @@ static const struct ide_port_ops pdc2026x_port_ops = { | |||
331 | static const struct ide_dma_ops pdc20246_dma_ops = { | 331 | static const struct ide_dma_ops pdc20246_dma_ops = { |
332 | .dma_host_set = ide_dma_host_set, | 332 | .dma_host_set = ide_dma_host_set, |
333 | .dma_setup = ide_dma_setup, | 333 | .dma_setup = ide_dma_setup, |
334 | .dma_exec_cmd = ide_dma_exec_cmd, | ||
335 | .dma_start = ide_dma_start, | 334 | .dma_start = ide_dma_start, |
336 | .dma_end = ide_dma_end, | 335 | .dma_end = ide_dma_end, |
337 | .dma_test_irq = pdc202xx_dma_test_irq, | 336 | .dma_test_irq = pdc202xx_dma_test_irq, |
338 | .dma_lost_irq = pdc202xx_dma_lost_irq, | 337 | .dma_lost_irq = pdc202xx_dma_lost_irq, |
338 | .dma_timer_expiry = ide_dma_sff_timer_expiry, | ||
339 | .dma_timeout = pdc202xx_dma_timeout, | 339 | .dma_timeout = pdc202xx_dma_timeout, |
340 | .dma_sff_read_status = ide_dma_sff_read_status, | 340 | .dma_sff_read_status = ide_dma_sff_read_status, |
341 | }; | 341 | }; |
@@ -343,11 +343,11 @@ static const struct ide_dma_ops pdc20246_dma_ops = { | |||
343 | static const struct ide_dma_ops pdc2026x_dma_ops = { | 343 | static const struct ide_dma_ops pdc2026x_dma_ops = { |
344 | .dma_host_set = ide_dma_host_set, | 344 | .dma_host_set = ide_dma_host_set, |
345 | .dma_setup = ide_dma_setup, | 345 | .dma_setup = ide_dma_setup, |
346 | .dma_exec_cmd = ide_dma_exec_cmd, | ||
347 | .dma_start = pdc202xx_dma_start, | 346 | .dma_start = pdc202xx_dma_start, |
348 | .dma_end = pdc202xx_dma_end, | 347 | .dma_end = pdc202xx_dma_end, |
349 | .dma_test_irq = pdc202xx_dma_test_irq, | 348 | .dma_test_irq = pdc202xx_dma_test_irq, |
350 | .dma_lost_irq = pdc202xx_dma_lost_irq, | 349 | .dma_lost_irq = pdc202xx_dma_lost_irq, |
350 | .dma_timer_expiry = ide_dma_sff_timer_expiry, | ||
351 | .dma_timeout = pdc202xx_dma_timeout, | 351 | .dma_timeout = pdc202xx_dma_timeout, |
352 | .dma_sff_read_status = ide_dma_sff_read_status, | 352 | .dma_sff_read_status = ide_dma_sff_read_status, |
353 | }; | 353 | }; |
diff --git a/drivers/ide/pmac.c b/drivers/ide/pmac.c index 74625e821a43..2bfcfedaa076 100644 --- a/drivers/ide/pmac.c +++ b/drivers/ide/pmac.c | |||
@@ -404,7 +404,6 @@ kauai_lookup_timing(struct kauai_timing* table, int cycle_time) | |||
404 | #define IDE_WAKEUP_DELAY (1*HZ) | 404 | #define IDE_WAKEUP_DELAY (1*HZ) |
405 | 405 | ||
406 | static int pmac_ide_init_dma(ide_hwif_t *, const struct ide_port_info *); | 406 | static int pmac_ide_init_dma(ide_hwif_t *, const struct ide_port_info *); |
407 | static int pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq); | ||
408 | static void pmac_ide_selectproc(ide_drive_t *drive); | 407 | static void pmac_ide_selectproc(ide_drive_t *drive); |
409 | static void pmac_ide_kauai_selectproc(ide_drive_t *drive); | 408 | static void pmac_ide_kauai_selectproc(ide_drive_t *drive); |
410 | 409 | ||
@@ -1422,17 +1421,16 @@ out: | |||
1422 | * pmac_ide_build_dmatable builds the DBDMA command list | 1421 | * pmac_ide_build_dmatable builds the DBDMA command list |
1423 | * for a transfer and sets the DBDMA channel to point to it. | 1422 | * for a transfer and sets the DBDMA channel to point to it. |
1424 | */ | 1423 | */ |
1425 | static int | 1424 | static int pmac_ide_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd) |
1426 | pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq) | ||
1427 | { | 1425 | { |
1428 | ide_hwif_t *hwif = drive->hwif; | 1426 | ide_hwif_t *hwif = drive->hwif; |
1429 | pmac_ide_hwif_t *pmif = | 1427 | pmac_ide_hwif_t *pmif = |
1430 | (pmac_ide_hwif_t *)dev_get_drvdata(hwif->gendev.parent); | 1428 | (pmac_ide_hwif_t *)dev_get_drvdata(hwif->gendev.parent); |
1431 | struct dbdma_cmd *table; | 1429 | struct dbdma_cmd *table; |
1432 | int i, count = 0; | ||
1433 | volatile struct dbdma_regs __iomem *dma = pmif->dma_regs; | 1430 | volatile struct dbdma_regs __iomem *dma = pmif->dma_regs; |
1434 | struct scatterlist *sg; | 1431 | struct scatterlist *sg; |
1435 | int wr = (rq_data_dir(rq) == WRITE); | 1432 | int wr = !!(cmd->tf_flags & IDE_TFLAG_WRITE); |
1433 | int i = cmd->sg_nents, count = 0; | ||
1436 | 1434 | ||
1437 | /* DMA table is already aligned */ | 1435 | /* DMA table is already aligned */ |
1438 | table = (struct dbdma_cmd *) pmif->dma_table_cpu; | 1436 | table = (struct dbdma_cmd *) pmif->dma_table_cpu; |
@@ -1442,11 +1440,6 @@ pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq) | |||
1442 | while (readl(&dma->status) & RUN) | 1440 | while (readl(&dma->status) & RUN) |
1443 | udelay(1); | 1441 | udelay(1); |
1444 | 1442 | ||
1445 | hwif->sg_nents = i = ide_build_sglist(drive, rq); | ||
1446 | |||
1447 | if (!i) | ||
1448 | return 0; | ||
1449 | |||
1450 | /* Build DBDMA commands list */ | 1443 | /* Build DBDMA commands list */ |
1451 | sg = hwif->sg_table; | 1444 | sg = hwif->sg_table; |
1452 | while (i && sg_dma_len(sg)) { | 1445 | while (i && sg_dma_len(sg)) { |
@@ -1509,23 +1502,22 @@ use_pio_instead: | |||
1509 | * Prepare a DMA transfer. We build the DMA table, adjust the timings for | 1502 | * Prepare a DMA transfer. We build the DMA table, adjust the timings for |
1510 | * a read on KeyLargo ATA/66 and mark us as waiting for DMA completion | 1503 | * a read on KeyLargo ATA/66 and mark us as waiting for DMA completion |
1511 | */ | 1504 | */ |
1512 | static int | 1505 | static int pmac_ide_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) |
1513 | pmac_ide_dma_setup(ide_drive_t *drive) | ||
1514 | { | 1506 | { |
1515 | ide_hwif_t *hwif = drive->hwif; | 1507 | ide_hwif_t *hwif = drive->hwif; |
1516 | pmac_ide_hwif_t *pmif = | 1508 | pmac_ide_hwif_t *pmif = |
1517 | (pmac_ide_hwif_t *)dev_get_drvdata(hwif->gendev.parent); | 1509 | (pmac_ide_hwif_t *)dev_get_drvdata(hwif->gendev.parent); |
1518 | struct request *rq = hwif->rq; | ||
1519 | u8 unit = drive->dn & 1, ata4 = (pmif->kind == controller_kl_ata4); | 1510 | u8 unit = drive->dn & 1, ata4 = (pmif->kind == controller_kl_ata4); |
1511 | u8 write = !!(cmd->tf_flags & IDE_TFLAG_WRITE); | ||
1520 | 1512 | ||
1521 | if (!pmac_ide_build_dmatable(drive, rq)) { | 1513 | if (pmac_ide_build_dmatable(drive, cmd) == 0) { |
1522 | ide_map_sg(drive, rq); | 1514 | ide_map_sg(drive, cmd); |
1523 | return 1; | 1515 | return 1; |
1524 | } | 1516 | } |
1525 | 1517 | ||
1526 | /* Apple adds 60ns to wrDataSetup on reads */ | 1518 | /* Apple adds 60ns to wrDataSetup on reads */ |
1527 | if (ata4 && (pmif->timings[unit] & TR_66_UDMA_EN)) { | 1519 | if (ata4 && (pmif->timings[unit] & TR_66_UDMA_EN)) { |
1528 | writel(pmif->timings[unit] + (!rq_data_dir(rq) ? 0x00800000UL : 0), | 1520 | writel(pmif->timings[unit] + (write ? 0 : 0x00800000UL), |
1529 | PMAC_IDE_REG(IDE_TIMING_CONFIG)); | 1521 | PMAC_IDE_REG(IDE_TIMING_CONFIG)); |
1530 | (void)readl(PMAC_IDE_REG(IDE_TIMING_CONFIG)); | 1522 | (void)readl(PMAC_IDE_REG(IDE_TIMING_CONFIG)); |
1531 | } | 1523 | } |
@@ -1535,13 +1527,6 @@ pmac_ide_dma_setup(ide_drive_t *drive) | |||
1535 | return 0; | 1527 | return 0; |
1536 | } | 1528 | } |
1537 | 1529 | ||
1538 | static void | ||
1539 | pmac_ide_dma_exec_cmd(ide_drive_t *drive, u8 command) | ||
1540 | { | ||
1541 | /* issue cmd to drive */ | ||
1542 | ide_execute_command(drive, command, &ide_dma_intr, 2*WAIT_CMD, NULL); | ||
1543 | } | ||
1544 | |||
1545 | /* | 1530 | /* |
1546 | * Kick the DMA controller into life after the DMA command has been issued | 1531 | * Kick the DMA controller into life after the DMA command has been issued |
1547 | * to the drive. | 1532 | * to the drive. |
@@ -1662,7 +1647,6 @@ pmac_ide_dma_lost_irq (ide_drive_t *drive) | |||
1662 | static const struct ide_dma_ops pmac_dma_ops = { | 1647 | static const struct ide_dma_ops pmac_dma_ops = { |
1663 | .dma_host_set = pmac_ide_dma_host_set, | 1648 | .dma_host_set = pmac_ide_dma_host_set, |
1664 | .dma_setup = pmac_ide_dma_setup, | 1649 | .dma_setup = pmac_ide_dma_setup, |
1665 | .dma_exec_cmd = pmac_ide_dma_exec_cmd, | ||
1666 | .dma_start = pmac_ide_dma_start, | 1650 | .dma_start = pmac_ide_dma_start, |
1667 | .dma_end = pmac_ide_dma_end, | 1651 | .dma_end = pmac_ide_dma_end, |
1668 | .dma_test_irq = pmac_ide_dma_test_irq, | 1652 | .dma_test_irq = pmac_ide_dma_test_irq, |
diff --git a/drivers/ide/q40ide.c b/drivers/ide/q40ide.c index 9f9c0b3cc3a3..2a43a2f49633 100644 --- a/drivers/ide/q40ide.c +++ b/drivers/ide/q40ide.c | |||
@@ -72,26 +72,26 @@ static void q40_ide_setup_ports(hw_regs_t *hw, unsigned long base, | |||
72 | hw->chipset = ide_generic; | 72 | hw->chipset = ide_generic; |
73 | } | 73 | } |
74 | 74 | ||
75 | static void q40ide_input_data(ide_drive_t *drive, struct request *rq, | 75 | static void q40ide_input_data(ide_drive_t *drive, struct ide_cmd *cmd, |
76 | void *buf, unsigned int len) | 76 | void *buf, unsigned int len) |
77 | { | 77 | { |
78 | unsigned long data_addr = drive->hwif->io_ports.data_addr; | 78 | unsigned long data_addr = drive->hwif->io_ports.data_addr; |
79 | 79 | ||
80 | if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS) | 80 | if (drive->media == ide_disk && cmd && (cmd->tf_flags & IDE_TFLAG_FS)) |
81 | return insw(data_addr, buf, (len + 1) / 2); | 81 | return insw(data_addr, buf, (len + 1) / 2); |
82 | 82 | ||
83 | insw_swapw(data_addr, buf, (len + 1) / 2); | 83 | raw_insw_swapw((u16 *)data_addr, buf, (len + 1) / 2); |
84 | } | 84 | } |
85 | 85 | ||
86 | static void q40ide_output_data(ide_drive_t *drive, struct request *rq, | 86 | static void q40ide_output_data(ide_drive_t *drive, struct ide_cmd *cmd, |
87 | void *buf, unsigned int len) | 87 | void *buf, unsigned int len) |
88 | { | 88 | { |
89 | unsigned long data_addr = drive->hwif->io_ports.data_addr; | 89 | unsigned long data_addr = drive->hwif->io_ports.data_addr; |
90 | 90 | ||
91 | if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS) | 91 | if (drive->media == ide_disk && cmd && (cmd->tf_flags & IDE_TFLAG_FS)) |
92 | return outsw(data_addr, buf, (len + 1) / 2); | 92 | return outsw(data_addr, buf, (len + 1) / 2); |
93 | 93 | ||
94 | outsw_swapw(data_addr, buf, (len + 1) / 2); | 94 | raw_outsw_swapw((u16 *)data_addr, buf, (len + 1) / 2); |
95 | } | 95 | } |
96 | 96 | ||
97 | /* Q40 has a byte-swapped IDE interface */ | 97 | /* Q40 has a byte-swapped IDE interface */ |
@@ -111,7 +111,8 @@ static const struct ide_tp_ops q40ide_tp_ops = { | |||
111 | 111 | ||
112 | static const struct ide_port_info q40ide_port_info = { | 112 | static const struct ide_port_info q40ide_port_info = { |
113 | .tp_ops = &q40ide_tp_ops, | 113 | .tp_ops = &q40ide_tp_ops, |
114 | .host_flags = IDE_HFLAG_NO_DMA, | 114 | .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA, |
115 | .irq_flags = IRQF_SHARED, | ||
115 | }; | 116 | }; |
116 | 117 | ||
117 | /* | 118 | /* |
diff --git a/drivers/ide/sc1200.c b/drivers/ide/sc1200.c index dbdd2985a0d8..1c3a82914999 100644 --- a/drivers/ide/sc1200.c +++ b/drivers/ide/sc1200.c | |||
@@ -286,11 +286,11 @@ static const struct ide_port_ops sc1200_port_ops = { | |||
286 | static const struct ide_dma_ops sc1200_dma_ops = { | 286 | static const struct ide_dma_ops sc1200_dma_ops = { |
287 | .dma_host_set = ide_dma_host_set, | 287 | .dma_host_set = ide_dma_host_set, |
288 | .dma_setup = ide_dma_setup, | 288 | .dma_setup = ide_dma_setup, |
289 | .dma_exec_cmd = ide_dma_exec_cmd, | ||
290 | .dma_start = ide_dma_start, | 289 | .dma_start = ide_dma_start, |
291 | .dma_end = sc1200_dma_end, | 290 | .dma_end = sc1200_dma_end, |
292 | .dma_test_irq = ide_dma_test_irq, | 291 | .dma_test_irq = ide_dma_test_irq, |
293 | .dma_lost_irq = ide_dma_lost_irq, | 292 | .dma_lost_irq = ide_dma_lost_irq, |
293 | .dma_timer_expiry = ide_dma_sff_timer_expiry, | ||
294 | .dma_timeout = ide_dma_timeout, | 294 | .dma_timeout = ide_dma_timeout, |
295 | .dma_sff_read_status = ide_dma_sff_read_status, | 295 | .dma_sff_read_status = ide_dma_sff_read_status, |
296 | }; | 296 | }; |
diff --git a/drivers/ide/scc_pata.c b/drivers/ide/scc_pata.c index 8d2314b6327c..0cc137cfe76d 100644 --- a/drivers/ide/scc_pata.c +++ b/drivers/ide/scc_pata.c | |||
@@ -303,8 +303,9 @@ static void scc_dma_host_set(ide_drive_t *drive, int on) | |||
303 | } | 303 | } |
304 | 304 | ||
305 | /** | 305 | /** |
306 | * scc_ide_dma_setup - begin a DMA phase | 306 | * scc_dma_setup - begin a DMA phase |
307 | * @drive: target device | 307 | * @drive: target device |
308 | * @cmd: command | ||
308 | * | 309 | * |
309 | * Build an IDE DMA PRD (IDE speak for scatter gather table) | 310 | * Build an IDE DMA PRD (IDE speak for scatter gather table) |
310 | * and then set up the DMA transfer registers. | 311 | * and then set up the DMA transfer registers. |
@@ -313,21 +314,15 @@ static void scc_dma_host_set(ide_drive_t *drive, int on) | |||
313 | * is returned. | 314 | * is returned. |
314 | */ | 315 | */ |
315 | 316 | ||
316 | static int scc_dma_setup(ide_drive_t *drive) | 317 | static int scc_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) |
317 | { | 318 | { |
318 | ide_hwif_t *hwif = drive->hwif; | 319 | ide_hwif_t *hwif = drive->hwif; |
319 | struct request *rq = hwif->rq; | 320 | u32 rw = (cmd->tf_flags & IDE_TFLAG_WRITE) ? 0 : ATA_DMA_WR; |
320 | unsigned int reading; | ||
321 | u8 dma_stat; | 321 | u8 dma_stat; |
322 | 322 | ||
323 | if (rq_data_dir(rq)) | ||
324 | reading = 0; | ||
325 | else | ||
326 | reading = 1 << 3; | ||
327 | |||
328 | /* fall back to pio! */ | 323 | /* fall back to pio! */ |
329 | if (!ide_build_dmatable(drive, rq)) { | 324 | if (ide_build_dmatable(drive, cmd) == 0) { |
330 | ide_map_sg(drive, rq); | 325 | ide_map_sg(drive, cmd); |
331 | return 1; | 326 | return 1; |
332 | } | 327 | } |
333 | 328 | ||
@@ -335,7 +330,7 @@ static int scc_dma_setup(ide_drive_t *drive) | |||
335 | out_be32((void __iomem *)(hwif->dma_base + 8), hwif->dmatable_dma); | 330 | out_be32((void __iomem *)(hwif->dma_base + 8), hwif->dmatable_dma); |
336 | 331 | ||
337 | /* specify r/w */ | 332 | /* specify r/w */ |
338 | out_be32((void __iomem *)hwif->dma_base, reading); | 333 | out_be32((void __iomem *)hwif->dma_base, rw); |
339 | 334 | ||
340 | /* read DMA status for INTR & ERROR flags */ | 335 | /* read DMA status for INTR & ERROR flags */ |
341 | dma_stat = scc_dma_sff_read_status(hwif); | 336 | dma_stat = scc_dma_sff_read_status(hwif); |
@@ -666,52 +661,52 @@ static int __devinit init_setup_scc(struct pci_dev *dev, | |||
666 | return rc; | 661 | return rc; |
667 | } | 662 | } |
668 | 663 | ||
669 | static void scc_tf_load(ide_drive_t *drive, ide_task_t *task) | 664 | static void scc_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) |
670 | { | 665 | { |
671 | struct ide_io_ports *io_ports = &drive->hwif->io_ports; | 666 | struct ide_io_ports *io_ports = &drive->hwif->io_ports; |
672 | struct ide_taskfile *tf = &task->tf; | 667 | struct ide_taskfile *tf = &cmd->tf; |
673 | u8 HIHI = (task->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; | 668 | u8 HIHI = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; |
674 | 669 | ||
675 | if (task->tf_flags & IDE_TFLAG_FLAGGED) | 670 | if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) |
676 | HIHI = 0xFF; | 671 | HIHI = 0xFF; |
677 | 672 | ||
678 | if (task->tf_flags & IDE_TFLAG_OUT_DATA) | 673 | if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) |
679 | out_be32((void *)io_ports->data_addr, | 674 | out_be32((void *)io_ports->data_addr, |
680 | (tf->hob_data << 8) | tf->data); | 675 | (tf->hob_data << 8) | tf->data); |
681 | 676 | ||
682 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) | 677 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) |
683 | scc_ide_outb(tf->hob_feature, io_ports->feature_addr); | 678 | scc_ide_outb(tf->hob_feature, io_ports->feature_addr); |
684 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) | 679 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) |
685 | scc_ide_outb(tf->hob_nsect, io_ports->nsect_addr); | 680 | scc_ide_outb(tf->hob_nsect, io_ports->nsect_addr); |
686 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) | 681 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) |
687 | scc_ide_outb(tf->hob_lbal, io_ports->lbal_addr); | 682 | scc_ide_outb(tf->hob_lbal, io_ports->lbal_addr); |
688 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) | 683 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) |
689 | scc_ide_outb(tf->hob_lbam, io_ports->lbam_addr); | 684 | scc_ide_outb(tf->hob_lbam, io_ports->lbam_addr); |
690 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) | 685 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) |
691 | scc_ide_outb(tf->hob_lbah, io_ports->lbah_addr); | 686 | scc_ide_outb(tf->hob_lbah, io_ports->lbah_addr); |
692 | 687 | ||
693 | if (task->tf_flags & IDE_TFLAG_OUT_FEATURE) | 688 | if (cmd->tf_flags & IDE_TFLAG_OUT_FEATURE) |
694 | scc_ide_outb(tf->feature, io_ports->feature_addr); | 689 | scc_ide_outb(tf->feature, io_ports->feature_addr); |
695 | if (task->tf_flags & IDE_TFLAG_OUT_NSECT) | 690 | if (cmd->tf_flags & IDE_TFLAG_OUT_NSECT) |
696 | scc_ide_outb(tf->nsect, io_ports->nsect_addr); | 691 | scc_ide_outb(tf->nsect, io_ports->nsect_addr); |
697 | if (task->tf_flags & IDE_TFLAG_OUT_LBAL) | 692 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAL) |
698 | scc_ide_outb(tf->lbal, io_ports->lbal_addr); | 693 | scc_ide_outb(tf->lbal, io_ports->lbal_addr); |
699 | if (task->tf_flags & IDE_TFLAG_OUT_LBAM) | 694 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAM) |
700 | scc_ide_outb(tf->lbam, io_ports->lbam_addr); | 695 | scc_ide_outb(tf->lbam, io_ports->lbam_addr); |
701 | if (task->tf_flags & IDE_TFLAG_OUT_LBAH) | 696 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAH) |
702 | scc_ide_outb(tf->lbah, io_ports->lbah_addr); | 697 | scc_ide_outb(tf->lbah, io_ports->lbah_addr); |
703 | 698 | ||
704 | if (task->tf_flags & IDE_TFLAG_OUT_DEVICE) | 699 | if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) |
705 | scc_ide_outb((tf->device & HIHI) | drive->select, | 700 | scc_ide_outb((tf->device & HIHI) | drive->select, |
706 | io_ports->device_addr); | 701 | io_ports->device_addr); |
707 | } | 702 | } |
708 | 703 | ||
709 | static void scc_tf_read(ide_drive_t *drive, ide_task_t *task) | 704 | static void scc_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) |
710 | { | 705 | { |
711 | struct ide_io_ports *io_ports = &drive->hwif->io_ports; | 706 | struct ide_io_ports *io_ports = &drive->hwif->io_ports; |
712 | struct ide_taskfile *tf = &task->tf; | 707 | struct ide_taskfile *tf = &cmd->tf; |
713 | 708 | ||
714 | if (task->tf_flags & IDE_TFLAG_IN_DATA) { | 709 | if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) { |
715 | u16 data = (u16)in_be32((void *)io_ports->data_addr); | 710 | u16 data = (u16)in_be32((void *)io_ports->data_addr); |
716 | 711 | ||
717 | tf->data = data & 0xff; | 712 | tf->data = data & 0xff; |
@@ -721,36 +716,36 @@ static void scc_tf_read(ide_drive_t *drive, ide_task_t *task) | |||
721 | /* be sure we're looking at the low order bits */ | 716 | /* be sure we're looking at the low order bits */ |
722 | scc_ide_outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); | 717 | scc_ide_outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); |
723 | 718 | ||
724 | if (task->tf_flags & IDE_TFLAG_IN_FEATURE) | 719 | if (cmd->tf_flags & IDE_TFLAG_IN_FEATURE) |
725 | tf->feature = scc_ide_inb(io_ports->feature_addr); | 720 | tf->feature = scc_ide_inb(io_ports->feature_addr); |
726 | if (task->tf_flags & IDE_TFLAG_IN_NSECT) | 721 | if (cmd->tf_flags & IDE_TFLAG_IN_NSECT) |
727 | tf->nsect = scc_ide_inb(io_ports->nsect_addr); | 722 | tf->nsect = scc_ide_inb(io_ports->nsect_addr); |
728 | if (task->tf_flags & IDE_TFLAG_IN_LBAL) | 723 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAL) |
729 | tf->lbal = scc_ide_inb(io_ports->lbal_addr); | 724 | tf->lbal = scc_ide_inb(io_ports->lbal_addr); |
730 | if (task->tf_flags & IDE_TFLAG_IN_LBAM) | 725 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAM) |
731 | tf->lbam = scc_ide_inb(io_ports->lbam_addr); | 726 | tf->lbam = scc_ide_inb(io_ports->lbam_addr); |
732 | if (task->tf_flags & IDE_TFLAG_IN_LBAH) | 727 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAH) |
733 | tf->lbah = scc_ide_inb(io_ports->lbah_addr); | 728 | tf->lbah = scc_ide_inb(io_ports->lbah_addr); |
734 | if (task->tf_flags & IDE_TFLAG_IN_DEVICE) | 729 | if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE) |
735 | tf->device = scc_ide_inb(io_ports->device_addr); | 730 | tf->device = scc_ide_inb(io_ports->device_addr); |
736 | 731 | ||
737 | if (task->tf_flags & IDE_TFLAG_LBA48) { | 732 | if (cmd->tf_flags & IDE_TFLAG_LBA48) { |
738 | scc_ide_outb(ATA_DEVCTL_OBS | 0x80, io_ports->ctl_addr); | 733 | scc_ide_outb(ATA_DEVCTL_OBS | 0x80, io_ports->ctl_addr); |
739 | 734 | ||
740 | if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) | 735 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) |
741 | tf->hob_feature = scc_ide_inb(io_ports->feature_addr); | 736 | tf->hob_feature = scc_ide_inb(io_ports->feature_addr); |
742 | if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT) | 737 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT) |
743 | tf->hob_nsect = scc_ide_inb(io_ports->nsect_addr); | 738 | tf->hob_nsect = scc_ide_inb(io_ports->nsect_addr); |
744 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL) | 739 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL) |
745 | tf->hob_lbal = scc_ide_inb(io_ports->lbal_addr); | 740 | tf->hob_lbal = scc_ide_inb(io_ports->lbal_addr); |
746 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM) | 741 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM) |
747 | tf->hob_lbam = scc_ide_inb(io_ports->lbam_addr); | 742 | tf->hob_lbam = scc_ide_inb(io_ports->lbam_addr); |
748 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH) | 743 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH) |
749 | tf->hob_lbah = scc_ide_inb(io_ports->lbah_addr); | 744 | tf->hob_lbah = scc_ide_inb(io_ports->lbah_addr); |
750 | } | 745 | } |
751 | } | 746 | } |
752 | 747 | ||
753 | static void scc_input_data(ide_drive_t *drive, struct request *rq, | 748 | static void scc_input_data(ide_drive_t *drive, struct ide_cmd *cmd, |
754 | void *buf, unsigned int len) | 749 | void *buf, unsigned int len) |
755 | { | 750 | { |
756 | unsigned long data_addr = drive->hwif->io_ports.data_addr; | 751 | unsigned long data_addr = drive->hwif->io_ports.data_addr; |
@@ -766,7 +761,7 @@ static void scc_input_data(ide_drive_t *drive, struct request *rq, | |||
766 | scc_ide_insw(data_addr, buf, len / 2); | 761 | scc_ide_insw(data_addr, buf, len / 2); |
767 | } | 762 | } |
768 | 763 | ||
769 | static void scc_output_data(ide_drive_t *drive, struct request *rq, | 764 | static void scc_output_data(ide_drive_t *drive, struct ide_cmd *cmd, |
770 | void *buf, unsigned int len) | 765 | void *buf, unsigned int len) |
771 | { | 766 | { |
772 | unsigned long data_addr = drive->hwif->io_ports.data_addr; | 767 | unsigned long data_addr = drive->hwif->io_ports.data_addr; |
@@ -873,30 +868,26 @@ static const struct ide_port_ops scc_port_ops = { | |||
873 | static const struct ide_dma_ops scc_dma_ops = { | 868 | static const struct ide_dma_ops scc_dma_ops = { |
874 | .dma_host_set = scc_dma_host_set, | 869 | .dma_host_set = scc_dma_host_set, |
875 | .dma_setup = scc_dma_setup, | 870 | .dma_setup = scc_dma_setup, |
876 | .dma_exec_cmd = ide_dma_exec_cmd, | ||
877 | .dma_start = scc_dma_start, | 871 | .dma_start = scc_dma_start, |
878 | .dma_end = scc_dma_end, | 872 | .dma_end = scc_dma_end, |
879 | .dma_test_irq = scc_dma_test_irq, | 873 | .dma_test_irq = scc_dma_test_irq, |
880 | .dma_lost_irq = ide_dma_lost_irq, | 874 | .dma_lost_irq = ide_dma_lost_irq, |
881 | .dma_timeout = ide_dma_timeout, | 875 | .dma_timeout = ide_dma_timeout, |
876 | .dma_timer_expiry = ide_dma_sff_timer_expiry, | ||
882 | .dma_sff_read_status = scc_dma_sff_read_status, | 877 | .dma_sff_read_status = scc_dma_sff_read_status, |
883 | }; | 878 | }; |
884 | 879 | ||
885 | #define DECLARE_SCC_DEV(name_str) \ | 880 | static const struct ide_port_info scc_chipset __devinitdata = { |
886 | { \ | 881 | .name = "sccIDE", |
887 | .name = name_str, \ | 882 | .init_iops = init_iops_scc, |
888 | .init_iops = init_iops_scc, \ | 883 | .init_dma = scc_init_dma, |
889 | .init_dma = scc_init_dma, \ | 884 | .init_hwif = init_hwif_scc, |
890 | .init_hwif = init_hwif_scc, \ | 885 | .tp_ops = &scc_tp_ops, |
891 | .tp_ops = &scc_tp_ops, \ | 886 | .port_ops = &scc_port_ops, |
892 | .port_ops = &scc_port_ops, \ | 887 | .dma_ops = &scc_dma_ops, |
893 | .dma_ops = &scc_dma_ops, \ | 888 | .host_flags = IDE_HFLAG_SINGLE, |
894 | .host_flags = IDE_HFLAG_SINGLE, \ | 889 | .irq_flags = IRQF_SHARED, |
895 | .pio_mask = ATA_PIO4, \ | 890 | .pio_mask = ATA_PIO4, |
896 | } | ||
897 | |||
898 | static const struct ide_port_info scc_chipsets[] __devinitdata = { | ||
899 | /* 0 */ DECLARE_SCC_DEV("sccIDE"), | ||
900 | }; | 891 | }; |
901 | 892 | ||
902 | /** | 893 | /** |
@@ -910,7 +901,7 @@ static const struct ide_port_info scc_chipsets[] __devinitdata = { | |||
910 | 901 | ||
911 | static int __devinit scc_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 902 | static int __devinit scc_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
912 | { | 903 | { |
913 | return init_setup_scc(dev, &scc_chipsets[id->driver_data]); | 904 | return init_setup_scc(dev, &scc_chipset); |
914 | } | 905 | } |
915 | 906 | ||
916 | /** | 907 | /** |
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index 24bc884826fc..a19dbccd7617 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c | |||
@@ -558,6 +558,8 @@ int ide_pci_init_one(struct pci_dev *dev, const struct ide_port_info *d, | |||
558 | 558 | ||
559 | host->host_priv = priv; | 559 | host->host_priv = priv; |
560 | 560 | ||
561 | host->irq_flags = IRQF_SHARED; | ||
562 | |||
561 | pci_set_drvdata(dev, host); | 563 | pci_set_drvdata(dev, host); |
562 | 564 | ||
563 | ret = do_ide_setup_pci_device(dev, d, 1); | 565 | ret = do_ide_setup_pci_device(dev, d, 1); |
@@ -606,6 +608,8 @@ int ide_pci_init_two(struct pci_dev *dev1, struct pci_dev *dev2, | |||
606 | 608 | ||
607 | host->host_priv = priv; | 609 | host->host_priv = priv; |
608 | 610 | ||
611 | host->irq_flags = IRQF_SHARED; | ||
612 | |||
609 | pci_set_drvdata(pdev[0], host); | 613 | pci_set_drvdata(pdev[0], host); |
610 | pci_set_drvdata(pdev[1], host); | 614 | pci_set_drvdata(pdev[1], host); |
611 | 615 | ||
diff --git a/drivers/ide/sgiioc4.c b/drivers/ide/sgiioc4.c index fdb9d7037694..b12de8346c73 100644 --- a/drivers/ide/sgiioc4.c +++ b/drivers/ide/sgiioc4.c | |||
@@ -424,20 +424,13 @@ sgiioc4_configure_for_dma(int dma_direction, ide_drive_t * drive) | |||
424 | /* | Upper 32 bits - Zero |EOL| 15 unused | 16 Bit Length| */ | 424 | /* | Upper 32 bits - Zero |EOL| 15 unused | 16 Bit Length| */ |
425 | /* --------------------------------------------------------------------- */ | 425 | /* --------------------------------------------------------------------- */ |
426 | /* Creates the scatter gather list, DMA Table */ | 426 | /* Creates the scatter gather list, DMA Table */ |
427 | static unsigned int | 427 | static int sgiioc4_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd) |
428 | sgiioc4_build_dma_table(ide_drive_t * drive, struct request *rq, int ddir) | ||
429 | { | 428 | { |
430 | ide_hwif_t *hwif = drive->hwif; | 429 | ide_hwif_t *hwif = drive->hwif; |
431 | unsigned int *table = hwif->dmatable_cpu; | 430 | unsigned int *table = hwif->dmatable_cpu; |
432 | unsigned int count = 0, i = 1; | 431 | unsigned int count = 0, i = cmd->sg_nents; |
433 | struct scatterlist *sg; | 432 | struct scatterlist *sg = hwif->sg_table; |
434 | 433 | ||
435 | hwif->sg_nents = i = ide_build_sglist(drive, rq); | ||
436 | |||
437 | if (!i) | ||
438 | return 0; /* sglist of length Zero */ | ||
439 | |||
440 | sg = hwif->sg_table; | ||
441 | while (i && sg_dma_len(sg)) { | 434 | while (i && sg_dma_len(sg)) { |
442 | dma_addr_t cur_addr; | 435 | dma_addr_t cur_addr; |
443 | int cur_len; | 436 | int cur_len; |
@@ -490,24 +483,18 @@ use_pio_instead: | |||
490 | return 0; /* revert to PIO for this request */ | 483 | return 0; /* revert to PIO for this request */ |
491 | } | 484 | } |
492 | 485 | ||
493 | static int sgiioc4_dma_setup(ide_drive_t *drive) | 486 | static int sgiioc4_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) |
494 | { | 487 | { |
495 | struct request *rq = drive->hwif->rq; | ||
496 | unsigned int count = 0; | ||
497 | int ddir; | 488 | int ddir; |
489 | u8 write = !!(cmd->tf_flags & IDE_TFLAG_WRITE); | ||
498 | 490 | ||
499 | if (rq_data_dir(rq)) | 491 | if (sgiioc4_build_dmatable(drive, cmd) == 0) { |
500 | ddir = PCI_DMA_TODEVICE; | ||
501 | else | ||
502 | ddir = PCI_DMA_FROMDEVICE; | ||
503 | |||
504 | if (!(count = sgiioc4_build_dma_table(drive, rq, ddir))) { | ||
505 | /* try PIO instead of DMA */ | 492 | /* try PIO instead of DMA */ |
506 | ide_map_sg(drive, rq); | 493 | ide_map_sg(drive, cmd); |
507 | return 1; | 494 | return 1; |
508 | } | 495 | } |
509 | 496 | ||
510 | if (rq_data_dir(rq)) | 497 | if (write) |
511 | /* Writes TO the IOC4 FROM Main Memory */ | 498 | /* Writes TO the IOC4 FROM Main Memory */ |
512 | ddir = IOC4_DMA_READ; | 499 | ddir = IOC4_DMA_READ; |
513 | else | 500 | else |
@@ -557,6 +544,7 @@ static const struct ide_port_info sgiioc4_port_info __devinitconst = { | |||
557 | .port_ops = &sgiioc4_port_ops, | 544 | .port_ops = &sgiioc4_port_ops, |
558 | .dma_ops = &sgiioc4_dma_ops, | 545 | .dma_ops = &sgiioc4_dma_ops, |
559 | .host_flags = IDE_HFLAG_MMIO, | 546 | .host_flags = IDE_HFLAG_MMIO, |
547 | .irq_flags = IRQF_SHARED, | ||
560 | .mwdma_mask = ATA_MWDMA2_ONLY, | 548 | .mwdma_mask = ATA_MWDMA2_ONLY, |
561 | }; | 549 | }; |
562 | 550 | ||
diff --git a/drivers/ide/siimage.c b/drivers/ide/siimage.c index 1811ae9cd843..075cb1243b2a 100644 --- a/drivers/ide/siimage.c +++ b/drivers/ide/siimage.c | |||
@@ -711,10 +711,10 @@ static const struct ide_port_ops sil_sata_port_ops = { | |||
711 | static const struct ide_dma_ops sil_dma_ops = { | 711 | static const struct ide_dma_ops sil_dma_ops = { |
712 | .dma_host_set = ide_dma_host_set, | 712 | .dma_host_set = ide_dma_host_set, |
713 | .dma_setup = ide_dma_setup, | 713 | .dma_setup = ide_dma_setup, |
714 | .dma_exec_cmd = ide_dma_exec_cmd, | ||
715 | .dma_start = ide_dma_start, | 714 | .dma_start = ide_dma_start, |
716 | .dma_end = ide_dma_end, | 715 | .dma_end = ide_dma_end, |
717 | .dma_test_irq = siimage_dma_test_irq, | 716 | .dma_test_irq = siimage_dma_test_irq, |
717 | .dma_timer_expiry = ide_dma_sff_timer_expiry, | ||
718 | .dma_timeout = ide_dma_timeout, | 718 | .dma_timeout = ide_dma_timeout, |
719 | .dma_lost_irq = ide_dma_lost_irq, | 719 | .dma_lost_irq = ide_dma_lost_irq, |
720 | .dma_sff_read_status = ide_dma_sff_read_status, | 720 | .dma_sff_read_status = ide_dma_sff_read_status, |
diff --git a/drivers/ide/sl82c105.c b/drivers/ide/sl82c105.c index dba213c51baa..d25137b04e7a 100644 --- a/drivers/ide/sl82c105.c +++ b/drivers/ide/sl82c105.c | |||
@@ -293,11 +293,11 @@ static const struct ide_port_ops sl82c105_port_ops = { | |||
293 | static const struct ide_dma_ops sl82c105_dma_ops = { | 293 | static const struct ide_dma_ops sl82c105_dma_ops = { |
294 | .dma_host_set = ide_dma_host_set, | 294 | .dma_host_set = ide_dma_host_set, |
295 | .dma_setup = ide_dma_setup, | 295 | .dma_setup = ide_dma_setup, |
296 | .dma_exec_cmd = ide_dma_exec_cmd, | ||
297 | .dma_start = sl82c105_dma_start, | 296 | .dma_start = sl82c105_dma_start, |
298 | .dma_end = sl82c105_dma_end, | 297 | .dma_end = sl82c105_dma_end, |
299 | .dma_test_irq = ide_dma_test_irq, | 298 | .dma_test_irq = ide_dma_test_irq, |
300 | .dma_lost_irq = sl82c105_dma_lost_irq, | 299 | .dma_lost_irq = sl82c105_dma_lost_irq, |
300 | .dma_timer_expiry = ide_dma_sff_timer_expiry, | ||
301 | .dma_timeout = sl82c105_dma_timeout, | 301 | .dma_timeout = sl82c105_dma_timeout, |
302 | .dma_sff_read_status = ide_dma_sff_read_status, | 302 | .dma_sff_read_status = ide_dma_sff_read_status, |
303 | }; | 303 | }; |
diff --git a/drivers/ide/tc86c001.c b/drivers/ide/tc86c001.c index 84109f5a1632..427d4b3c2c63 100644 --- a/drivers/ide/tc86c001.c +++ b/drivers/ide/tc86c001.c | |||
@@ -182,11 +182,11 @@ static const struct ide_port_ops tc86c001_port_ops = { | |||
182 | static const struct ide_dma_ops tc86c001_dma_ops = { | 182 | static const struct ide_dma_ops tc86c001_dma_ops = { |
183 | .dma_host_set = ide_dma_host_set, | 183 | .dma_host_set = ide_dma_host_set, |
184 | .dma_setup = ide_dma_setup, | 184 | .dma_setup = ide_dma_setup, |
185 | .dma_exec_cmd = ide_dma_exec_cmd, | ||
186 | .dma_start = tc86c001_dma_start, | 185 | .dma_start = tc86c001_dma_start, |
187 | .dma_end = ide_dma_end, | 186 | .dma_end = ide_dma_end, |
188 | .dma_test_irq = ide_dma_test_irq, | 187 | .dma_test_irq = ide_dma_test_irq, |
189 | .dma_lost_irq = ide_dma_lost_irq, | 188 | .dma_lost_irq = ide_dma_lost_irq, |
189 | .dma_timer_expiry = ide_dma_sff_timer_expiry, | ||
190 | .dma_timeout = ide_dma_timeout, | 190 | .dma_timeout = ide_dma_timeout, |
191 | .dma_sff_read_status = ide_dma_sff_read_status, | 191 | .dma_sff_read_status = ide_dma_sff_read_status, |
192 | }; | 192 | }; |
diff --git a/drivers/ide/trm290.c b/drivers/ide/trm290.c index 1c09e549c423..ed1496845a93 100644 --- a/drivers/ide/trm290.c +++ b/drivers/ide/trm290.c | |||
@@ -176,18 +176,12 @@ static void trm290_selectproc (ide_drive_t *drive) | |||
176 | trm290_prepare_drive(drive, !!(drive->dev_flags & IDE_DFLAG_USING_DMA)); | 176 | trm290_prepare_drive(drive, !!(drive->dev_flags & IDE_DFLAG_USING_DMA)); |
177 | } | 177 | } |
178 | 178 | ||
179 | static void trm290_dma_exec_cmd(ide_drive_t *drive, u8 command) | 179 | static int trm290_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) |
180 | { | ||
181 | ide_execute_command(drive, command, &ide_dma_intr, WAIT_CMD, NULL); | ||
182 | } | ||
183 | |||
184 | static int trm290_dma_setup(ide_drive_t *drive) | ||
185 | { | 180 | { |
186 | ide_hwif_t *hwif = drive->hwif; | 181 | ide_hwif_t *hwif = drive->hwif; |
187 | struct request *rq = hwif->rq; | ||
188 | unsigned int count, rw; | 182 | unsigned int count, rw; |
189 | 183 | ||
190 | if (rq_data_dir(rq)) { | 184 | if (cmd->tf_flags & IDE_TFLAG_WRITE) { |
191 | #ifdef TRM290_NO_DMA_WRITES | 185 | #ifdef TRM290_NO_DMA_WRITES |
192 | /* always use PIO for writes */ | 186 | /* always use PIO for writes */ |
193 | trm290_prepare_drive(drive, 0); /* select PIO xfer */ | 187 | trm290_prepare_drive(drive, 0); /* select PIO xfer */ |
@@ -197,7 +191,9 @@ static int trm290_dma_setup(ide_drive_t *drive) | |||
197 | } else | 191 | } else |
198 | rw = 2; | 192 | rw = 2; |
199 | 193 | ||
200 | if (!(count = ide_build_dmatable(drive, rq))) { | 194 | count = ide_build_dmatable(drive, cmd); |
195 | if (count == 0) { | ||
196 | ide_map_sg(drive, cmd); | ||
201 | /* try PIO instead of DMA */ | 197 | /* try PIO instead of DMA */ |
202 | trm290_prepare_drive(drive, 0); /* select PIO xfer */ | 198 | trm290_prepare_drive(drive, 0); /* select PIO xfer */ |
203 | return 1; | 199 | return 1; |
@@ -314,7 +310,6 @@ static const struct ide_port_ops trm290_port_ops = { | |||
314 | static struct ide_dma_ops trm290_dma_ops = { | 310 | static struct ide_dma_ops trm290_dma_ops = { |
315 | .dma_host_set = trm290_dma_host_set, | 311 | .dma_host_set = trm290_dma_host_set, |
316 | .dma_setup = trm290_dma_setup, | 312 | .dma_setup = trm290_dma_setup, |
317 | .dma_exec_cmd = trm290_dma_exec_cmd, | ||
318 | .dma_start = trm290_dma_start, | 313 | .dma_start = trm290_dma_start, |
319 | .dma_end = trm290_dma_end, | 314 | .dma_end = trm290_dma_end, |
320 | .dma_test_irq = trm290_dma_test_irq, | 315 | .dma_test_irq = trm290_dma_test_irq, |
diff --git a/drivers/ide/tx4938ide.c b/drivers/ide/tx4938ide.c index d9095345f7ca..657a61890b1c 100644 --- a/drivers/ide/tx4938ide.c +++ b/drivers/ide/tx4938ide.c | |||
@@ -15,6 +15,8 @@ | |||
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
17 | #include <linux/io.h> | 17 | #include <linux/io.h> |
18 | |||
19 | #include <asm/ide.h> | ||
18 | #include <asm/txx9/tx4938.h> | 20 | #include <asm/txx9/tx4938.h> |
19 | 21 | ||
20 | static void tx4938ide_tune_ebusc(unsigned int ebus_ch, | 22 | static void tx4938ide_tune_ebusc(unsigned int ebus_ch, |
@@ -80,57 +82,57 @@ static void tx4938ide_outb(u8 value, unsigned long port) | |||
80 | __raw_writeb(value, (void __iomem *)port); | 82 | __raw_writeb(value, (void __iomem *)port); |
81 | } | 83 | } |
82 | 84 | ||
83 | static void tx4938ide_tf_load(ide_drive_t *drive, ide_task_t *task) | 85 | static void tx4938ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) |
84 | { | 86 | { |
85 | ide_hwif_t *hwif = drive->hwif; | 87 | ide_hwif_t *hwif = drive->hwif; |
86 | struct ide_io_ports *io_ports = &hwif->io_ports; | 88 | struct ide_io_ports *io_ports = &hwif->io_ports; |
87 | struct ide_taskfile *tf = &task->tf; | 89 | struct ide_taskfile *tf = &cmd->tf; |
88 | u8 HIHI = task->tf_flags & IDE_TFLAG_LBA48 ? 0xE0 : 0xEF; | 90 | u8 HIHI = cmd->tf_flags & IDE_TFLAG_LBA48 ? 0xE0 : 0xEF; |
89 | 91 | ||
90 | if (task->tf_flags & IDE_TFLAG_FLAGGED) | 92 | if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) |
91 | HIHI = 0xFF; | 93 | HIHI = 0xFF; |
92 | 94 | ||
93 | if (task->tf_flags & IDE_TFLAG_OUT_DATA) { | 95 | if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) { |
94 | u16 data = (tf->hob_data << 8) | tf->data; | 96 | u16 data = (tf->hob_data << 8) | tf->data; |
95 | 97 | ||
96 | /* no endian swap */ | 98 | /* no endian swap */ |
97 | __raw_writew(data, (void __iomem *)io_ports->data_addr); | 99 | __raw_writew(data, (void __iomem *)io_ports->data_addr); |
98 | } | 100 | } |
99 | 101 | ||
100 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) | 102 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) |
101 | tx4938ide_outb(tf->hob_feature, io_ports->feature_addr); | 103 | tx4938ide_outb(tf->hob_feature, io_ports->feature_addr); |
102 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) | 104 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) |
103 | tx4938ide_outb(tf->hob_nsect, io_ports->nsect_addr); | 105 | tx4938ide_outb(tf->hob_nsect, io_ports->nsect_addr); |
104 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) | 106 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) |
105 | tx4938ide_outb(tf->hob_lbal, io_ports->lbal_addr); | 107 | tx4938ide_outb(tf->hob_lbal, io_ports->lbal_addr); |
106 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) | 108 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) |
107 | tx4938ide_outb(tf->hob_lbam, io_ports->lbam_addr); | 109 | tx4938ide_outb(tf->hob_lbam, io_ports->lbam_addr); |
108 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) | 110 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) |
109 | tx4938ide_outb(tf->hob_lbah, io_ports->lbah_addr); | 111 | tx4938ide_outb(tf->hob_lbah, io_ports->lbah_addr); |
110 | 112 | ||
111 | if (task->tf_flags & IDE_TFLAG_OUT_FEATURE) | 113 | if (cmd->tf_flags & IDE_TFLAG_OUT_FEATURE) |
112 | tx4938ide_outb(tf->feature, io_ports->feature_addr); | 114 | tx4938ide_outb(tf->feature, io_ports->feature_addr); |
113 | if (task->tf_flags & IDE_TFLAG_OUT_NSECT) | 115 | if (cmd->tf_flags & IDE_TFLAG_OUT_NSECT) |
114 | tx4938ide_outb(tf->nsect, io_ports->nsect_addr); | 116 | tx4938ide_outb(tf->nsect, io_ports->nsect_addr); |
115 | if (task->tf_flags & IDE_TFLAG_OUT_LBAL) | 117 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAL) |
116 | tx4938ide_outb(tf->lbal, io_ports->lbal_addr); | 118 | tx4938ide_outb(tf->lbal, io_ports->lbal_addr); |
117 | if (task->tf_flags & IDE_TFLAG_OUT_LBAM) | 119 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAM) |
118 | tx4938ide_outb(tf->lbam, io_ports->lbam_addr); | 120 | tx4938ide_outb(tf->lbam, io_ports->lbam_addr); |
119 | if (task->tf_flags & IDE_TFLAG_OUT_LBAH) | 121 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAH) |
120 | tx4938ide_outb(tf->lbah, io_ports->lbah_addr); | 122 | tx4938ide_outb(tf->lbah, io_ports->lbah_addr); |
121 | 123 | ||
122 | if (task->tf_flags & IDE_TFLAG_OUT_DEVICE) | 124 | if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) |
123 | tx4938ide_outb((tf->device & HIHI) | drive->select, | 125 | tx4938ide_outb((tf->device & HIHI) | drive->select, |
124 | io_ports->device_addr); | 126 | io_ports->device_addr); |
125 | } | 127 | } |
126 | 128 | ||
127 | static void tx4938ide_tf_read(ide_drive_t *drive, ide_task_t *task) | 129 | static void tx4938ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) |
128 | { | 130 | { |
129 | ide_hwif_t *hwif = drive->hwif; | 131 | ide_hwif_t *hwif = drive->hwif; |
130 | struct ide_io_ports *io_ports = &hwif->io_ports; | 132 | struct ide_io_ports *io_ports = &hwif->io_ports; |
131 | struct ide_taskfile *tf = &task->tf; | 133 | struct ide_taskfile *tf = &cmd->tf; |
132 | 134 | ||
133 | if (task->tf_flags & IDE_TFLAG_IN_DATA) { | 135 | if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) { |
134 | u16 data; | 136 | u16 data; |
135 | 137 | ||
136 | /* no endian swap */ | 138 | /* no endian swap */ |
@@ -142,37 +144,37 @@ static void tx4938ide_tf_read(ide_drive_t *drive, ide_task_t *task) | |||
142 | /* be sure we're looking at the low order bits */ | 144 | /* be sure we're looking at the low order bits */ |
143 | tx4938ide_outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); | 145 | tx4938ide_outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); |
144 | 146 | ||
145 | if (task->tf_flags & IDE_TFLAG_IN_FEATURE) | 147 | if (cmd->tf_flags & IDE_TFLAG_IN_FEATURE) |
146 | tf->feature = tx4938ide_inb(io_ports->feature_addr); | 148 | tf->feature = tx4938ide_inb(io_ports->feature_addr); |
147 | if (task->tf_flags & IDE_TFLAG_IN_NSECT) | 149 | if (cmd->tf_flags & IDE_TFLAG_IN_NSECT) |
148 | tf->nsect = tx4938ide_inb(io_ports->nsect_addr); | 150 | tf->nsect = tx4938ide_inb(io_ports->nsect_addr); |
149 | if (task->tf_flags & IDE_TFLAG_IN_LBAL) | 151 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAL) |
150 | tf->lbal = tx4938ide_inb(io_ports->lbal_addr); | 152 | tf->lbal = tx4938ide_inb(io_ports->lbal_addr); |
151 | if (task->tf_flags & IDE_TFLAG_IN_LBAM) | 153 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAM) |
152 | tf->lbam = tx4938ide_inb(io_ports->lbam_addr); | 154 | tf->lbam = tx4938ide_inb(io_ports->lbam_addr); |
153 | if (task->tf_flags & IDE_TFLAG_IN_LBAH) | 155 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAH) |
154 | tf->lbah = tx4938ide_inb(io_ports->lbah_addr); | 156 | tf->lbah = tx4938ide_inb(io_ports->lbah_addr); |
155 | if (task->tf_flags & IDE_TFLAG_IN_DEVICE) | 157 | if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE) |
156 | tf->device = tx4938ide_inb(io_ports->device_addr); | 158 | tf->device = tx4938ide_inb(io_ports->device_addr); |
157 | 159 | ||
158 | if (task->tf_flags & IDE_TFLAG_LBA48) { | 160 | if (cmd->tf_flags & IDE_TFLAG_LBA48) { |
159 | tx4938ide_outb(ATA_DEVCTL_OBS | 0x80, io_ports->ctl_addr); | 161 | tx4938ide_outb(ATA_DEVCTL_OBS | 0x80, io_ports->ctl_addr); |
160 | 162 | ||
161 | if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) | 163 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) |
162 | tf->hob_feature = | 164 | tf->hob_feature = |
163 | tx4938ide_inb(io_ports->feature_addr); | 165 | tx4938ide_inb(io_ports->feature_addr); |
164 | if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT) | 166 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT) |
165 | tf->hob_nsect = tx4938ide_inb(io_ports->nsect_addr); | 167 | tf->hob_nsect = tx4938ide_inb(io_ports->nsect_addr); |
166 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL) | 168 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL) |
167 | tf->hob_lbal = tx4938ide_inb(io_ports->lbal_addr); | 169 | tf->hob_lbal = tx4938ide_inb(io_ports->lbal_addr); |
168 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM) | 170 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM) |
169 | tf->hob_lbam = tx4938ide_inb(io_ports->lbam_addr); | 171 | tf->hob_lbam = tx4938ide_inb(io_ports->lbam_addr); |
170 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH) | 172 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH) |
171 | tf->hob_lbah = tx4938ide_inb(io_ports->lbah_addr); | 173 | tf->hob_lbah = tx4938ide_inb(io_ports->lbah_addr); |
172 | } | 174 | } |
173 | } | 175 | } |
174 | 176 | ||
175 | static void tx4938ide_input_data_swap(ide_drive_t *drive, struct request *rq, | 177 | static void tx4938ide_input_data_swap(ide_drive_t *drive, struct ide_cmd *cmd, |
176 | void *buf, unsigned int len) | 178 | void *buf, unsigned int len) |
177 | { | 179 | { |
178 | unsigned long port = drive->hwif->io_ports.data_addr; | 180 | unsigned long port = drive->hwif->io_ports.data_addr; |
@@ -184,7 +186,7 @@ static void tx4938ide_input_data_swap(ide_drive_t *drive, struct request *rq, | |||
184 | __ide_flush_dcache_range((unsigned long)buf, roundup(len, 2)); | 186 | __ide_flush_dcache_range((unsigned long)buf, roundup(len, 2)); |
185 | } | 187 | } |
186 | 188 | ||
187 | static void tx4938ide_output_data_swap(ide_drive_t *drive, struct request *rq, | 189 | static void tx4938ide_output_data_swap(ide_drive_t *drive, struct ide_cmd *cmd, |
188 | void *buf, unsigned int len) | 190 | void *buf, unsigned int len) |
189 | { | 191 | { |
190 | unsigned long port = drive->hwif->io_ports.data_addr; | 192 | unsigned long port = drive->hwif->io_ports.data_addr; |
diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c index 40b0812a045c..e0e0a803dde3 100644 --- a/drivers/ide/tx4939ide.c +++ b/drivers/ide/tx4939ide.c | |||
@@ -18,6 +18,8 @@ | |||
18 | #include <linux/io.h> | 18 | #include <linux/io.h> |
19 | #include <linux/scatterlist.h> | 19 | #include <linux/scatterlist.h> |
20 | 20 | ||
21 | #include <asm/ide.h> | ||
22 | |||
21 | #define MODNAME "tx4939ide" | 23 | #define MODNAME "tx4939ide" |
22 | 24 | ||
23 | /* ATA Shadow Registers (8-bit except for Data which is 16-bit) */ | 25 | /* ATA Shadow Registers (8-bit except for Data which is 16-bit) */ |
@@ -230,7 +232,7 @@ static u8 tx4939ide_clear_dma_status(void __iomem *base) | |||
230 | 232 | ||
231 | #ifdef __BIG_ENDIAN | 233 | #ifdef __BIG_ENDIAN |
232 | /* custom ide_build_dmatable to handle swapped layout */ | 234 | /* custom ide_build_dmatable to handle swapped layout */ |
233 | static int tx4939ide_build_dmatable(ide_drive_t *drive, struct request *rq) | 235 | static int tx4939ide_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd) |
234 | { | 236 | { |
235 | ide_hwif_t *hwif = drive->hwif; | 237 | ide_hwif_t *hwif = drive->hwif; |
236 | u32 *table = (u32 *)hwif->dmatable_cpu; | 238 | u32 *table = (u32 *)hwif->dmatable_cpu; |
@@ -238,11 +240,7 @@ static int tx4939ide_build_dmatable(ide_drive_t *drive, struct request *rq) | |||
238 | int i; | 240 | int i; |
239 | struct scatterlist *sg; | 241 | struct scatterlist *sg; |
240 | 242 | ||
241 | hwif->sg_nents = ide_build_sglist(drive, rq); | 243 | for_each_sg(hwif->sg_table, sg, cmd->sg_nents, i) { |
242 | if (hwif->sg_nents == 0) | ||
243 | return 0; | ||
244 | |||
245 | for_each_sg(hwif->sg_table, sg, hwif->sg_nents, i) { | ||
246 | u32 cur_addr, cur_len, bcount; | 244 | u32 cur_addr, cur_len, bcount; |
247 | 245 | ||
248 | cur_addr = sg_dma_address(sg); | 246 | cur_addr = sg_dma_address(sg); |
@@ -289,23 +287,15 @@ use_pio_instead: | |||
289 | #define tx4939ide_build_dmatable ide_build_dmatable | 287 | #define tx4939ide_build_dmatable ide_build_dmatable |
290 | #endif | 288 | #endif |
291 | 289 | ||
292 | static int tx4939ide_dma_setup(ide_drive_t *drive) | 290 | static int tx4939ide_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) |
293 | { | 291 | { |
294 | ide_hwif_t *hwif = drive->hwif; | 292 | ide_hwif_t *hwif = drive->hwif; |
295 | void __iomem *base = TX4939IDE_BASE(hwif); | 293 | void __iomem *base = TX4939IDE_BASE(hwif); |
296 | struct request *rq = hwif->rq; | 294 | u8 rw = (cmd->tf_flags & IDE_TFLAG_WRITE) ? 0 : ATA_DMA_WR; |
297 | u8 reading; | ||
298 | int nent; | ||
299 | |||
300 | if (rq_data_dir(rq)) | ||
301 | reading = 0; | ||
302 | else | ||
303 | reading = ATA_DMA_WR; | ||
304 | 295 | ||
305 | /* fall back to PIO! */ | 296 | /* fall back to PIO! */ |
306 | nent = tx4939ide_build_dmatable(drive, rq); | 297 | if (tx4939ide_build_dmatable(drive, cmd) == 0) { |
307 | if (!nent) { | 298 | ide_map_sg(drive, cmd); |
308 | ide_map_sg(drive, rq); | ||
309 | return 1; | 299 | return 1; |
310 | } | 300 | } |
311 | 301 | ||
@@ -313,7 +303,7 @@ static int tx4939ide_dma_setup(ide_drive_t *drive) | |||
313 | tx4939ide_writel(hwif->dmatable_dma, base, TX4939IDE_PRD_Ptr); | 303 | tx4939ide_writel(hwif->dmatable_dma, base, TX4939IDE_PRD_Ptr); |
314 | 304 | ||
315 | /* specify r/w */ | 305 | /* specify r/w */ |
316 | tx4939ide_writeb(reading, base, TX4939IDE_DMA_Cmd); | 306 | tx4939ide_writeb(rw, base, TX4939IDE_DMA_Cmd); |
317 | 307 | ||
318 | /* clear INTR & ERROR flags */ | 308 | /* clear INTR & ERROR flags */ |
319 | tx4939ide_clear_dma_status(base); | 309 | tx4939ide_clear_dma_status(base); |
@@ -322,7 +312,9 @@ static int tx4939ide_dma_setup(ide_drive_t *drive) | |||
322 | 312 | ||
323 | tx4939ide_writew(SECTOR_SIZE / 2, base, drive->dn ? | 313 | tx4939ide_writew(SECTOR_SIZE / 2, base, drive->dn ? |
324 | TX4939IDE_Xfer_Cnt_2 : TX4939IDE_Xfer_Cnt_1); | 314 | TX4939IDE_Xfer_Cnt_2 : TX4939IDE_Xfer_Cnt_1); |
325 | tx4939ide_writew(rq->nr_sectors, base, TX4939IDE_Sec_Cnt); | 315 | |
316 | tx4939ide_writew(cmd->rq->nr_sectors, base, TX4939IDE_Sec_Cnt); | ||
317 | |||
326 | return 0; | 318 | return 0; |
327 | } | 319 | } |
328 | 320 | ||
@@ -437,7 +429,7 @@ static int tx4939ide_init_dma(ide_hwif_t *hwif, const struct ide_port_info *d) | |||
437 | return ide_allocate_dma_engine(hwif); | 429 | return ide_allocate_dma_engine(hwif); |
438 | } | 430 | } |
439 | 431 | ||
440 | static void tx4939ide_tf_load_fixup(ide_drive_t *drive, ide_task_t *task) | 432 | static void tx4939ide_tf_load_fixup(ide_drive_t *drive) |
441 | { | 433 | { |
442 | ide_hwif_t *hwif = drive->hwif; | 434 | ide_hwif_t *hwif = drive->hwif; |
443 | void __iomem *base = TX4939IDE_BASE(hwif); | 435 | void __iomem *base = TX4939IDE_BASE(hwif); |
@@ -465,59 +457,59 @@ static void tx4939ide_outb(u8 value, unsigned long port) | |||
465 | __raw_writeb(value, (void __iomem *)port); | 457 | __raw_writeb(value, (void __iomem *)port); |
466 | } | 458 | } |
467 | 459 | ||
468 | static void tx4939ide_tf_load(ide_drive_t *drive, ide_task_t *task) | 460 | static void tx4939ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) |
469 | { | 461 | { |
470 | ide_hwif_t *hwif = drive->hwif; | 462 | ide_hwif_t *hwif = drive->hwif; |
471 | struct ide_io_ports *io_ports = &hwif->io_ports; | 463 | struct ide_io_ports *io_ports = &hwif->io_ports; |
472 | struct ide_taskfile *tf = &task->tf; | 464 | struct ide_taskfile *tf = &cmd->tf; |
473 | u8 HIHI = task->tf_flags & IDE_TFLAG_LBA48 ? 0xE0 : 0xEF; | 465 | u8 HIHI = cmd->tf_flags & IDE_TFLAG_LBA48 ? 0xE0 : 0xEF; |
474 | 466 | ||
475 | if (task->tf_flags & IDE_TFLAG_FLAGGED) | 467 | if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) |
476 | HIHI = 0xFF; | 468 | HIHI = 0xFF; |
477 | 469 | ||
478 | if (task->tf_flags & IDE_TFLAG_OUT_DATA) { | 470 | if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) { |
479 | u16 data = (tf->hob_data << 8) | tf->data; | 471 | u16 data = (tf->hob_data << 8) | tf->data; |
480 | 472 | ||
481 | /* no endian swap */ | 473 | /* no endian swap */ |
482 | __raw_writew(data, (void __iomem *)io_ports->data_addr); | 474 | __raw_writew(data, (void __iomem *)io_ports->data_addr); |
483 | } | 475 | } |
484 | 476 | ||
485 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) | 477 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) |
486 | tx4939ide_outb(tf->hob_feature, io_ports->feature_addr); | 478 | tx4939ide_outb(tf->hob_feature, io_ports->feature_addr); |
487 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) | 479 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) |
488 | tx4939ide_outb(tf->hob_nsect, io_ports->nsect_addr); | 480 | tx4939ide_outb(tf->hob_nsect, io_ports->nsect_addr); |
489 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) | 481 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) |
490 | tx4939ide_outb(tf->hob_lbal, io_ports->lbal_addr); | 482 | tx4939ide_outb(tf->hob_lbal, io_ports->lbal_addr); |
491 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) | 483 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) |
492 | tx4939ide_outb(tf->hob_lbam, io_ports->lbam_addr); | 484 | tx4939ide_outb(tf->hob_lbam, io_ports->lbam_addr); |
493 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) | 485 | if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) |
494 | tx4939ide_outb(tf->hob_lbah, io_ports->lbah_addr); | 486 | tx4939ide_outb(tf->hob_lbah, io_ports->lbah_addr); |
495 | 487 | ||
496 | if (task->tf_flags & IDE_TFLAG_OUT_FEATURE) | 488 | if (cmd->tf_flags & IDE_TFLAG_OUT_FEATURE) |
497 | tx4939ide_outb(tf->feature, io_ports->feature_addr); | 489 | tx4939ide_outb(tf->feature, io_ports->feature_addr); |
498 | if (task->tf_flags & IDE_TFLAG_OUT_NSECT) | 490 | if (cmd->tf_flags & IDE_TFLAG_OUT_NSECT) |
499 | tx4939ide_outb(tf->nsect, io_ports->nsect_addr); | 491 | tx4939ide_outb(tf->nsect, io_ports->nsect_addr); |
500 | if (task->tf_flags & IDE_TFLAG_OUT_LBAL) | 492 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAL) |
501 | tx4939ide_outb(tf->lbal, io_ports->lbal_addr); | 493 | tx4939ide_outb(tf->lbal, io_ports->lbal_addr); |
502 | if (task->tf_flags & IDE_TFLAG_OUT_LBAM) | 494 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAM) |
503 | tx4939ide_outb(tf->lbam, io_ports->lbam_addr); | 495 | tx4939ide_outb(tf->lbam, io_ports->lbam_addr); |
504 | if (task->tf_flags & IDE_TFLAG_OUT_LBAH) | 496 | if (cmd->tf_flags & IDE_TFLAG_OUT_LBAH) |
505 | tx4939ide_outb(tf->lbah, io_ports->lbah_addr); | 497 | tx4939ide_outb(tf->lbah, io_ports->lbah_addr); |
506 | 498 | ||
507 | if (task->tf_flags & IDE_TFLAG_OUT_DEVICE) { | 499 | if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) { |
508 | tx4939ide_outb((tf->device & HIHI) | drive->select, | 500 | tx4939ide_outb((tf->device & HIHI) | drive->select, |
509 | io_ports->device_addr); | 501 | io_ports->device_addr); |
510 | tx4939ide_tf_load_fixup(drive, task); | 502 | tx4939ide_tf_load_fixup(drive); |
511 | } | 503 | } |
512 | } | 504 | } |
513 | 505 | ||
514 | static void tx4939ide_tf_read(ide_drive_t *drive, ide_task_t *task) | 506 | static void tx4939ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) |
515 | { | 507 | { |
516 | ide_hwif_t *hwif = drive->hwif; | 508 | ide_hwif_t *hwif = drive->hwif; |
517 | struct ide_io_ports *io_ports = &hwif->io_ports; | 509 | struct ide_io_ports *io_ports = &hwif->io_ports; |
518 | struct ide_taskfile *tf = &task->tf; | 510 | struct ide_taskfile *tf = &cmd->tf; |
519 | 511 | ||
520 | if (task->tf_flags & IDE_TFLAG_IN_DATA) { | 512 | if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) { |
521 | u16 data; | 513 | u16 data; |
522 | 514 | ||
523 | /* no endian swap */ | 515 | /* no endian swap */ |
@@ -529,32 +521,32 @@ static void tx4939ide_tf_read(ide_drive_t *drive, ide_task_t *task) | |||
529 | /* be sure we're looking at the low order bits */ | 521 | /* be sure we're looking at the low order bits */ |
530 | tx4939ide_outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); | 522 | tx4939ide_outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); |
531 | 523 | ||
532 | if (task->tf_flags & IDE_TFLAG_IN_FEATURE) | 524 | if (cmd->tf_flags & IDE_TFLAG_IN_FEATURE) |
533 | tf->feature = tx4939ide_inb(io_ports->feature_addr); | 525 | tf->feature = tx4939ide_inb(io_ports->feature_addr); |
534 | if (task->tf_flags & IDE_TFLAG_IN_NSECT) | 526 | if (cmd->tf_flags & IDE_TFLAG_IN_NSECT) |
535 | tf->nsect = tx4939ide_inb(io_ports->nsect_addr); | 527 | tf->nsect = tx4939ide_inb(io_ports->nsect_addr); |
536 | if (task->tf_flags & IDE_TFLAG_IN_LBAL) | 528 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAL) |
537 | tf->lbal = tx4939ide_inb(io_ports->lbal_addr); | 529 | tf->lbal = tx4939ide_inb(io_ports->lbal_addr); |
538 | if (task->tf_flags & IDE_TFLAG_IN_LBAM) | 530 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAM) |
539 | tf->lbam = tx4939ide_inb(io_ports->lbam_addr); | 531 | tf->lbam = tx4939ide_inb(io_ports->lbam_addr); |
540 | if (task->tf_flags & IDE_TFLAG_IN_LBAH) | 532 | if (cmd->tf_flags & IDE_TFLAG_IN_LBAH) |
541 | tf->lbah = tx4939ide_inb(io_ports->lbah_addr); | 533 | tf->lbah = tx4939ide_inb(io_ports->lbah_addr); |
542 | if (task->tf_flags & IDE_TFLAG_IN_DEVICE) | 534 | if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE) |
543 | tf->device = tx4939ide_inb(io_ports->device_addr); | 535 | tf->device = tx4939ide_inb(io_ports->device_addr); |
544 | 536 | ||
545 | if (task->tf_flags & IDE_TFLAG_LBA48) { | 537 | if (cmd->tf_flags & IDE_TFLAG_LBA48) { |
546 | tx4939ide_outb(ATA_DEVCTL_OBS | 0x80, io_ports->ctl_addr); | 538 | tx4939ide_outb(ATA_DEVCTL_OBS | 0x80, io_ports->ctl_addr); |
547 | 539 | ||
548 | if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) | 540 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) |
549 | tf->hob_feature = | 541 | tf->hob_feature = |
550 | tx4939ide_inb(io_ports->feature_addr); | 542 | tx4939ide_inb(io_ports->feature_addr); |
551 | if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT) | 543 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT) |
552 | tf->hob_nsect = tx4939ide_inb(io_ports->nsect_addr); | 544 | tf->hob_nsect = tx4939ide_inb(io_ports->nsect_addr); |
553 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL) | 545 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL) |
554 | tf->hob_lbal = tx4939ide_inb(io_ports->lbal_addr); | 546 | tf->hob_lbal = tx4939ide_inb(io_ports->lbal_addr); |
555 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM) | 547 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM) |
556 | tf->hob_lbam = tx4939ide_inb(io_ports->lbam_addr); | 548 | tf->hob_lbam = tx4939ide_inb(io_ports->lbam_addr); |
557 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH) | 549 | if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH) |
558 | tf->hob_lbah = tx4939ide_inb(io_ports->lbah_addr); | 550 | tf->hob_lbah = tx4939ide_inb(io_ports->lbah_addr); |
559 | } | 551 | } |
560 | } | 552 | } |
@@ -601,11 +593,12 @@ static const struct ide_tp_ops tx4939ide_tp_ops = { | |||
601 | 593 | ||
602 | #else /* __LITTLE_ENDIAN */ | 594 | #else /* __LITTLE_ENDIAN */ |
603 | 595 | ||
604 | static void tx4939ide_tf_load(ide_drive_t *drive, ide_task_t *task) | 596 | static void tx4939ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) |
605 | { | 597 | { |
606 | ide_tf_load(drive, task); | 598 | ide_tf_load(drive, cmd); |
607 | if (task->tf_flags & IDE_TFLAG_OUT_DEVICE) | 599 | |
608 | tx4939ide_tf_load_fixup(drive, task); | 600 | if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) |
601 | tx4939ide_tf_load_fixup(drive); | ||
609 | } | 602 | } |
610 | 603 | ||
611 | static const struct ide_tp_ops tx4939ide_tp_ops = { | 604 | static const struct ide_tp_ops tx4939ide_tp_ops = { |
@@ -634,11 +627,11 @@ static const struct ide_port_ops tx4939ide_port_ops = { | |||
634 | static const struct ide_dma_ops tx4939ide_dma_ops = { | 627 | static const struct ide_dma_ops tx4939ide_dma_ops = { |
635 | .dma_host_set = tx4939ide_dma_host_set, | 628 | .dma_host_set = tx4939ide_dma_host_set, |
636 | .dma_setup = tx4939ide_dma_setup, | 629 | .dma_setup = tx4939ide_dma_setup, |
637 | .dma_exec_cmd = ide_dma_exec_cmd, | ||
638 | .dma_start = ide_dma_start, | 630 | .dma_start = ide_dma_start, |
639 | .dma_end = tx4939ide_dma_end, | 631 | .dma_end = tx4939ide_dma_end, |
640 | .dma_test_irq = tx4939ide_dma_test_irq, | 632 | .dma_test_irq = tx4939ide_dma_test_irq, |
641 | .dma_lost_irq = ide_dma_lost_irq, | 633 | .dma_lost_irq = ide_dma_lost_irq, |
634 | .dma_timer_expiry = ide_dma_sff_timer_expiry, | ||
642 | .dma_timeout = ide_dma_timeout, | 635 | .dma_timeout = ide_dma_timeout, |
643 | .dma_sff_read_status = tx4939ide_dma_sff_read_status, | 636 | .dma_sff_read_status = tx4939ide_dma_sff_read_status, |
644 | }; | 637 | }; |
diff --git a/include/linux/ide.h b/include/linux/ide.h index 854eba8b2ba3..d5d832271f44 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -40,6 +40,13 @@ | |||
40 | #define ERROR_RESET 3 /* Reset controller every 4th retry */ | 40 | #define ERROR_RESET 3 /* Reset controller every 4th retry */ |
41 | #define ERROR_RECAL 1 /* Recalibrate every 2nd retry */ | 41 | #define ERROR_RECAL 1 /* Recalibrate every 2nd retry */ |
42 | 42 | ||
43 | /* Error codes returned in rq->errors to the higher part of the driver. */ | ||
44 | enum { | ||
45 | IDE_DRV_ERROR_GENERAL = 101, | ||
46 | IDE_DRV_ERROR_FILEMARK = 102, | ||
47 | IDE_DRV_ERROR_EOD = 103, | ||
48 | }; | ||
49 | |||
43 | /* | 50 | /* |
44 | * Definitions for accessing IDE controller registers | 51 | * Definitions for accessing IDE controller registers |
45 | */ | 52 | */ |
@@ -193,26 +200,8 @@ static inline void ide_std_init_ports(hw_regs_t *hw, | |||
193 | hw->io_ports.ctl_addr = ctl_addr; | 200 | hw->io_ports.ctl_addr = ctl_addr; |
194 | } | 201 | } |
195 | 202 | ||
196 | #if defined(CONFIG_ARM) || defined(CONFIG_M68K) || defined(CONFIG_MIPS) || \ | ||
197 | defined(CONFIG_PARISC) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) | ||
198 | #include <asm/ide.h> | ||
199 | #else | ||
200 | #include <asm-generic/ide_iops.h> | ||
201 | #endif | ||
202 | |||
203 | #define MAX_HWIFS 10 | 203 | #define MAX_HWIFS 10 |
204 | 204 | ||
205 | /* Currently only m68k, apus and m8xx need it */ | ||
206 | #ifndef IDE_ARCH_ACK_INTR | ||
207 | # define ide_ack_intr(hwif) (1) | ||
208 | #endif | ||
209 | |||
210 | /* Currently only Atari needs it */ | ||
211 | #ifndef IDE_ARCH_LOCK | ||
212 | # define ide_release_lock() do {} while (0) | ||
213 | # define ide_get_lock(hdlr, data) do {} while (0) | ||
214 | #endif /* IDE_ARCH_LOCK */ | ||
215 | |||
216 | /* | 205 | /* |
217 | * Now for the data we need to maintain per-drive: ide_drive_t | 206 | * Now for the data we need to maintain per-drive: ide_drive_t |
218 | */ | 207 | */ |
@@ -252,56 +241,52 @@ typedef enum { | |||
252 | 241 | ||
253 | enum { | 242 | enum { |
254 | IDE_TFLAG_LBA48 = (1 << 0), | 243 | IDE_TFLAG_LBA48 = (1 << 0), |
255 | IDE_TFLAG_FLAGGED = (1 << 2), | 244 | IDE_TFLAG_OUT_HOB_FEATURE = (1 << 1), |
256 | IDE_TFLAG_OUT_DATA = (1 << 3), | 245 | IDE_TFLAG_OUT_HOB_NSECT = (1 << 2), |
257 | IDE_TFLAG_OUT_HOB_FEATURE = (1 << 4), | 246 | IDE_TFLAG_OUT_HOB_LBAL = (1 << 3), |
258 | IDE_TFLAG_OUT_HOB_NSECT = (1 << 5), | 247 | IDE_TFLAG_OUT_HOB_LBAM = (1 << 4), |
259 | IDE_TFLAG_OUT_HOB_LBAL = (1 << 6), | 248 | IDE_TFLAG_OUT_HOB_LBAH = (1 << 5), |
260 | IDE_TFLAG_OUT_HOB_LBAM = (1 << 7), | ||
261 | IDE_TFLAG_OUT_HOB_LBAH = (1 << 8), | ||
262 | IDE_TFLAG_OUT_HOB = IDE_TFLAG_OUT_HOB_FEATURE | | 249 | IDE_TFLAG_OUT_HOB = IDE_TFLAG_OUT_HOB_FEATURE | |
263 | IDE_TFLAG_OUT_HOB_NSECT | | 250 | IDE_TFLAG_OUT_HOB_NSECT | |
264 | IDE_TFLAG_OUT_HOB_LBAL | | 251 | IDE_TFLAG_OUT_HOB_LBAL | |
265 | IDE_TFLAG_OUT_HOB_LBAM | | 252 | IDE_TFLAG_OUT_HOB_LBAM | |
266 | IDE_TFLAG_OUT_HOB_LBAH, | 253 | IDE_TFLAG_OUT_HOB_LBAH, |
267 | IDE_TFLAG_OUT_FEATURE = (1 << 9), | 254 | IDE_TFLAG_OUT_FEATURE = (1 << 6), |
268 | IDE_TFLAG_OUT_NSECT = (1 << 10), | 255 | IDE_TFLAG_OUT_NSECT = (1 << 7), |
269 | IDE_TFLAG_OUT_LBAL = (1 << 11), | 256 | IDE_TFLAG_OUT_LBAL = (1 << 8), |
270 | IDE_TFLAG_OUT_LBAM = (1 << 12), | 257 | IDE_TFLAG_OUT_LBAM = (1 << 9), |
271 | IDE_TFLAG_OUT_LBAH = (1 << 13), | 258 | IDE_TFLAG_OUT_LBAH = (1 << 10), |
272 | IDE_TFLAG_OUT_TF = IDE_TFLAG_OUT_FEATURE | | 259 | IDE_TFLAG_OUT_TF = IDE_TFLAG_OUT_FEATURE | |
273 | IDE_TFLAG_OUT_NSECT | | 260 | IDE_TFLAG_OUT_NSECT | |
274 | IDE_TFLAG_OUT_LBAL | | 261 | IDE_TFLAG_OUT_LBAL | |
275 | IDE_TFLAG_OUT_LBAM | | 262 | IDE_TFLAG_OUT_LBAM | |
276 | IDE_TFLAG_OUT_LBAH, | 263 | IDE_TFLAG_OUT_LBAH, |
277 | IDE_TFLAG_OUT_DEVICE = (1 << 14), | 264 | IDE_TFLAG_OUT_DEVICE = (1 << 11), |
278 | IDE_TFLAG_WRITE = (1 << 15), | 265 | IDE_TFLAG_WRITE = (1 << 12), |
279 | IDE_TFLAG_FLAGGED_SET_IN_FLAGS = (1 << 16), | 266 | IDE_TFLAG_CUSTOM_HANDLER = (1 << 13), |
280 | IDE_TFLAG_IN_DATA = (1 << 17), | 267 | IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 14), |
281 | IDE_TFLAG_CUSTOM_HANDLER = (1 << 18), | 268 | IDE_TFLAG_IN_HOB_FEATURE = (1 << 15), |
282 | IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 19), | 269 | IDE_TFLAG_IN_HOB_NSECT = (1 << 16), |
283 | IDE_TFLAG_IN_HOB_FEATURE = (1 << 20), | 270 | IDE_TFLAG_IN_HOB_LBAL = (1 << 17), |
284 | IDE_TFLAG_IN_HOB_NSECT = (1 << 21), | 271 | IDE_TFLAG_IN_HOB_LBAM = (1 << 18), |
285 | IDE_TFLAG_IN_HOB_LBAL = (1 << 22), | 272 | IDE_TFLAG_IN_HOB_LBAH = (1 << 19), |
286 | IDE_TFLAG_IN_HOB_LBAM = (1 << 23), | ||
287 | IDE_TFLAG_IN_HOB_LBAH = (1 << 24), | ||
288 | IDE_TFLAG_IN_HOB_LBA = IDE_TFLAG_IN_HOB_LBAL | | 273 | IDE_TFLAG_IN_HOB_LBA = IDE_TFLAG_IN_HOB_LBAL | |
289 | IDE_TFLAG_IN_HOB_LBAM | | 274 | IDE_TFLAG_IN_HOB_LBAM | |
290 | IDE_TFLAG_IN_HOB_LBAH, | 275 | IDE_TFLAG_IN_HOB_LBAH, |
291 | IDE_TFLAG_IN_HOB = IDE_TFLAG_IN_HOB_FEATURE | | 276 | IDE_TFLAG_IN_HOB = IDE_TFLAG_IN_HOB_FEATURE | |
292 | IDE_TFLAG_IN_HOB_NSECT | | 277 | IDE_TFLAG_IN_HOB_NSECT | |
293 | IDE_TFLAG_IN_HOB_LBA, | 278 | IDE_TFLAG_IN_HOB_LBA, |
294 | IDE_TFLAG_IN_FEATURE = (1 << 1), | 279 | IDE_TFLAG_IN_FEATURE = (1 << 20), |
295 | IDE_TFLAG_IN_NSECT = (1 << 25), | 280 | IDE_TFLAG_IN_NSECT = (1 << 21), |
296 | IDE_TFLAG_IN_LBAL = (1 << 26), | 281 | IDE_TFLAG_IN_LBAL = (1 << 22), |
297 | IDE_TFLAG_IN_LBAM = (1 << 27), | 282 | IDE_TFLAG_IN_LBAM = (1 << 23), |
298 | IDE_TFLAG_IN_LBAH = (1 << 28), | 283 | IDE_TFLAG_IN_LBAH = (1 << 24), |
299 | IDE_TFLAG_IN_LBA = IDE_TFLAG_IN_LBAL | | 284 | IDE_TFLAG_IN_LBA = IDE_TFLAG_IN_LBAL | |
300 | IDE_TFLAG_IN_LBAM | | 285 | IDE_TFLAG_IN_LBAM | |
301 | IDE_TFLAG_IN_LBAH, | 286 | IDE_TFLAG_IN_LBAH, |
302 | IDE_TFLAG_IN_TF = IDE_TFLAG_IN_NSECT | | 287 | IDE_TFLAG_IN_TF = IDE_TFLAG_IN_NSECT | |
303 | IDE_TFLAG_IN_LBA, | 288 | IDE_TFLAG_IN_LBA, |
304 | IDE_TFLAG_IN_DEVICE = (1 << 29), | 289 | IDE_TFLAG_IN_DEVICE = (1 << 25), |
305 | IDE_TFLAG_HOB = IDE_TFLAG_OUT_HOB | | 290 | IDE_TFLAG_HOB = IDE_TFLAG_OUT_HOB | |
306 | IDE_TFLAG_IN_HOB, | 291 | IDE_TFLAG_IN_HOB, |
307 | IDE_TFLAG_TF = IDE_TFLAG_OUT_TF | | 292 | IDE_TFLAG_TF = IDE_TFLAG_OUT_TF | |
@@ -309,9 +294,18 @@ enum { | |||
309 | IDE_TFLAG_DEVICE = IDE_TFLAG_OUT_DEVICE | | 294 | IDE_TFLAG_DEVICE = IDE_TFLAG_OUT_DEVICE | |
310 | IDE_TFLAG_IN_DEVICE, | 295 | IDE_TFLAG_IN_DEVICE, |
311 | /* force 16-bit I/O operations */ | 296 | /* force 16-bit I/O operations */ |
312 | IDE_TFLAG_IO_16BIT = (1 << 30), | 297 | IDE_TFLAG_IO_16BIT = (1 << 26), |
313 | /* ide_task_t was allocated using kmalloc() */ | 298 | /* struct ide_cmd was allocated using kmalloc() */ |
314 | IDE_TFLAG_DYN = (1 << 31), | 299 | IDE_TFLAG_DYN = (1 << 27), |
300 | IDE_TFLAG_FS = (1 << 28), | ||
301 | IDE_TFLAG_MULTI_PIO = (1 << 29), | ||
302 | }; | ||
303 | |||
304 | enum { | ||
305 | IDE_FTFLAG_FLAGGED = (1 << 0), | ||
306 | IDE_FTFLAG_SET_IN_FLAGS = (1 << 1), | ||
307 | IDE_FTFLAG_OUT_DATA = (1 << 2), | ||
308 | IDE_FTFLAG_IN_DATA = (1 << 3), | ||
315 | }; | 309 | }; |
316 | 310 | ||
317 | struct ide_taskfile { | 311 | struct ide_taskfile { |
@@ -343,16 +337,27 @@ struct ide_taskfile { | |||
343 | }; | 337 | }; |
344 | }; | 338 | }; |
345 | 339 | ||
346 | typedef struct ide_task_s { | 340 | struct ide_cmd { |
347 | union { | 341 | union { |
348 | struct ide_taskfile tf; | 342 | struct ide_taskfile tf; |
349 | u8 tf_array[14]; | 343 | u8 tf_array[14]; |
350 | }; | 344 | }; |
345 | u8 ftf_flags; /* for TASKFILE ioctl */ | ||
351 | u32 tf_flags; | 346 | u32 tf_flags; |
352 | int data_phase; | 347 | int protocol; |
348 | |||
349 | int sg_nents; /* number of sg entries */ | ||
350 | int orig_sg_nents; | ||
351 | int sg_dma_direction; /* DMA transfer direction */ | ||
352 | |||
353 | unsigned int nbytes; | ||
354 | unsigned int nleft; | ||
355 | struct scatterlist *cursg; | ||
356 | unsigned int cursg_ofs; | ||
357 | |||
353 | struct request *rq; /* copy of request */ | 358 | struct request *rq; /* copy of request */ |
354 | void *special; /* valid_t generally */ | 359 | void *special; /* valid_t generally */ |
355 | } ide_task_t; | 360 | }; |
356 | 361 | ||
357 | /* ATAPI packet command flags */ | 362 | /* ATAPI packet command flags */ |
358 | enum { | 363 | enum { |
@@ -364,8 +369,6 @@ enum { | |||
364 | PC_FLAG_DMA_IN_PROGRESS = (1 << 4), | 369 | PC_FLAG_DMA_IN_PROGRESS = (1 << 4), |
365 | PC_FLAG_DMA_ERROR = (1 << 5), | 370 | PC_FLAG_DMA_ERROR = (1 << 5), |
366 | PC_FLAG_WRITING = (1 << 6), | 371 | PC_FLAG_WRITING = (1 << 6), |
367 | /* command timed out */ | ||
368 | PC_FLAG_TIMEDOUT = (1 << 7), | ||
369 | }; | 372 | }; |
370 | 373 | ||
371 | /* | 374 | /* |
@@ -436,7 +439,6 @@ struct ide_disk_ops { | |||
436 | int); | 439 | int); |
437 | ide_startstop_t (*do_request)(struct ide_drive_s *, struct request *, | 440 | ide_startstop_t (*do_request)(struct ide_drive_s *, struct request *, |
438 | sector_t); | 441 | sector_t); |
439 | int (*end_request)(struct ide_drive_s *, int, int); | ||
440 | int (*ioctl)(struct ide_drive_s *, struct block_device *, | 442 | int (*ioctl)(struct ide_drive_s *, struct block_device *, |
441 | fmode_t, unsigned int, unsigned long); | 443 | fmode_t, unsigned int, unsigned long); |
442 | }; | 444 | }; |
@@ -512,8 +514,6 @@ enum { | |||
512 | IDE_DFLAG_NICE1 = (1 << 5), | 514 | IDE_DFLAG_NICE1 = (1 << 5), |
513 | /* device is physically present */ | 515 | /* device is physically present */ |
514 | IDE_DFLAG_PRESENT = (1 << 6), | 516 | IDE_DFLAG_PRESENT = (1 << 6), |
515 | /* device ejected hint */ | ||
516 | IDE_DFLAG_DEAD = (1 << 7), | ||
517 | /* id read from device (synthetic if not set) */ | 517 | /* id read from device (synthetic if not set) */ |
518 | IDE_DFLAG_ID_READ = (1 << 8), | 518 | IDE_DFLAG_ID_READ = (1 << 8), |
519 | IDE_DFLAG_NOPROBE = (1 << 9), | 519 | IDE_DFLAG_NOPROBE = (1 << 9), |
@@ -627,8 +627,11 @@ struct ide_drive_s { | |||
627 | /* current packet command */ | 627 | /* current packet command */ |
628 | struct ide_atapi_pc *pc; | 628 | struct ide_atapi_pc *pc; |
629 | 629 | ||
630 | /* last failed packet command */ | ||
631 | struct ide_atapi_pc *failed_pc; | ||
632 | |||
630 | /* callback for packet commands */ | 633 | /* callback for packet commands */ |
631 | void (*pc_callback)(struct ide_drive_s *, int); | 634 | int (*pc_callback)(struct ide_drive_s *, int); |
632 | 635 | ||
633 | void (*pc_update_buffers)(struct ide_drive_s *, struct ide_atapi_pc *); | 636 | void (*pc_update_buffers)(struct ide_drive_s *, struct ide_atapi_pc *); |
634 | int (*pc_io_buffers)(struct ide_drive_s *, struct ide_atapi_pc *, | 637 | int (*pc_io_buffers)(struct ide_drive_s *, struct ide_atapi_pc *, |
@@ -661,13 +664,13 @@ struct ide_tp_ops { | |||
661 | 664 | ||
662 | void (*set_irq)(struct hwif_s *, int); | 665 | void (*set_irq)(struct hwif_s *, int); |
663 | 666 | ||
664 | void (*tf_load)(ide_drive_t *, struct ide_task_s *); | 667 | void (*tf_load)(ide_drive_t *, struct ide_cmd *); |
665 | void (*tf_read)(ide_drive_t *, struct ide_task_s *); | 668 | void (*tf_read)(ide_drive_t *, struct ide_cmd *); |
666 | 669 | ||
667 | void (*input_data)(ide_drive_t *, struct request *, void *, | 670 | void (*input_data)(ide_drive_t *, struct ide_cmd *, |
668 | unsigned int); | 671 | void *, unsigned int); |
669 | void (*output_data)(ide_drive_t *, struct request *, void *, | 672 | void (*output_data)(ide_drive_t *, struct ide_cmd *, |
670 | unsigned int); | 673 | void *, unsigned int); |
671 | }; | 674 | }; |
672 | 675 | ||
673 | extern const struct ide_tp_ops default_tp_ops; | 676 | extern const struct ide_tp_ops default_tp_ops; |
@@ -711,12 +714,12 @@ struct ide_port_ops { | |||
711 | 714 | ||
712 | struct ide_dma_ops { | 715 | struct ide_dma_ops { |
713 | void (*dma_host_set)(struct ide_drive_s *, int); | 716 | void (*dma_host_set)(struct ide_drive_s *, int); |
714 | int (*dma_setup)(struct ide_drive_s *); | 717 | int (*dma_setup)(struct ide_drive_s *, struct ide_cmd *); |
715 | void (*dma_exec_cmd)(struct ide_drive_s *, u8); | ||
716 | void (*dma_start)(struct ide_drive_s *); | 718 | void (*dma_start)(struct ide_drive_s *); |
717 | int (*dma_end)(struct ide_drive_s *); | 719 | int (*dma_end)(struct ide_drive_s *); |
718 | int (*dma_test_irq)(struct ide_drive_s *); | 720 | int (*dma_test_irq)(struct ide_drive_s *); |
719 | void (*dma_lost_irq)(struct ide_drive_s *); | 721 | void (*dma_lost_irq)(struct ide_drive_s *); |
722 | int (*dma_timer_expiry)(struct ide_drive_s *); | ||
720 | void (*dma_timeout)(struct ide_drive_s *); | 723 | void (*dma_timeout)(struct ide_drive_s *); |
721 | /* | 724 | /* |
722 | * The following method is optional and only required to be | 725 | * The following method is optional and only required to be |
@@ -780,19 +783,8 @@ typedef struct hwif_s { | |||
780 | /* Scatter-gather list used to build the above */ | 783 | /* Scatter-gather list used to build the above */ |
781 | struct scatterlist *sg_table; | 784 | struct scatterlist *sg_table; |
782 | int sg_max_nents; /* Maximum number of entries in it */ | 785 | int sg_max_nents; /* Maximum number of entries in it */ |
783 | int sg_nents; /* Current number of entries in it */ | ||
784 | int orig_sg_nents; | ||
785 | int sg_dma_direction; /* dma transfer direction */ | ||
786 | |||
787 | /* data phase of the active command (currently only valid for PIO/DMA) */ | ||
788 | int data_phase; | ||
789 | 786 | ||
790 | struct ide_task_s task; /* current command */ | 787 | struct ide_cmd cmd; /* current command */ |
791 | |||
792 | unsigned int nsect; | ||
793 | unsigned int nleft; | ||
794 | struct scatterlist *cursg; | ||
795 | unsigned int cursg_ofs; | ||
796 | 788 | ||
797 | int rqsize; /* max sectors per request */ | 789 | int rqsize; /* max sectors per request */ |
798 | int irq; /* our irq number */ | 790 | int irq; /* our irq number */ |
@@ -850,9 +842,18 @@ struct ide_host { | |||
850 | ide_hwif_t *ports[MAX_HOST_PORTS + 1]; | 842 | ide_hwif_t *ports[MAX_HOST_PORTS + 1]; |
851 | unsigned int n_ports; | 843 | unsigned int n_ports; |
852 | struct device *dev[2]; | 844 | struct device *dev[2]; |
845 | |||
853 | int (*init_chipset)(struct pci_dev *); | 846 | int (*init_chipset)(struct pci_dev *); |
847 | |||
848 | void (*get_lock)(irq_handler_t, void *); | ||
849 | void (*release_lock)(void); | ||
850 | |||
854 | irq_handler_t irq_handler; | 851 | irq_handler_t irq_handler; |
852 | |||
855 | unsigned long host_flags; | 853 | unsigned long host_flags; |
854 | |||
855 | int irq_flags; | ||
856 | |||
856 | void *host_priv; | 857 | void *host_priv; |
857 | ide_hwif_t *cur_port; /* for hosts requiring serialization */ | 858 | ide_hwif_t *cur_port; /* for hosts requiring serialization */ |
858 | 859 | ||
@@ -869,7 +870,7 @@ typedef ide_startstop_t (ide_handler_t)(ide_drive_t *); | |||
869 | typedef int (ide_expiry_t)(ide_drive_t *); | 870 | typedef int (ide_expiry_t)(ide_drive_t *); |
870 | 871 | ||
871 | /* used by ide-cd, ide-floppy, etc. */ | 872 | /* used by ide-cd, ide-floppy, etc. */ |
872 | typedef void (xfer_func_t)(ide_drive_t *, struct request *rq, void *, unsigned); | 873 | typedef void (xfer_func_t)(ide_drive_t *, struct ide_cmd *, void *, unsigned); |
873 | 874 | ||
874 | extern struct mutex ide_setting_mtx; | 875 | extern struct mutex ide_setting_mtx; |
875 | 876 | ||
@@ -1045,10 +1046,11 @@ enum { | |||
1045 | }; | 1046 | }; |
1046 | 1047 | ||
1047 | /* DRV_NAME has to be defined in the driver before using the macro below */ | 1048 | /* DRV_NAME has to be defined in the driver before using the macro below */ |
1048 | #define __ide_debug_log(lvl, fmt, args...) \ | 1049 | #define __ide_debug_log(lvl, fmt, args...) \ |
1049 | { \ | 1050 | { \ |
1050 | if (unlikely(drive->debug_mask & lvl)) \ | 1051 | if (unlikely(drive->debug_mask & lvl)) \ |
1051 | printk(KERN_INFO DRV_NAME ": " fmt, ## args); \ | 1052 | printk(KERN_INFO DRV_NAME ": %s: " fmt "\n", \ |
1053 | __func__, ## args); \ | ||
1052 | } | 1054 | } |
1053 | 1055 | ||
1054 | /* | 1056 | /* |
@@ -1087,7 +1089,7 @@ int generic_ide_resume(struct device *); | |||
1087 | 1089 | ||
1088 | void ide_complete_power_step(ide_drive_t *, struct request *); | 1090 | void ide_complete_power_step(ide_drive_t *, struct request *); |
1089 | ide_startstop_t ide_start_power_step(ide_drive_t *, struct request *); | 1091 | ide_startstop_t ide_start_power_step(ide_drive_t *, struct request *); |
1090 | void ide_complete_pm_request(ide_drive_t *, struct request *); | 1092 | void ide_complete_pm_rq(ide_drive_t *, struct request *); |
1091 | void ide_check_pm_state(ide_drive_t *, struct request *); | 1093 | void ide_check_pm_state(ide_drive_t *, struct request *); |
1092 | 1094 | ||
1093 | /* | 1095 | /* |
@@ -1099,7 +1101,6 @@ void ide_check_pm_state(ide_drive_t *, struct request *); | |||
1099 | struct ide_driver { | 1101 | struct ide_driver { |
1100 | const char *version; | 1102 | const char *version; |
1101 | ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t); | 1103 | ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t); |
1102 | int (*end_request)(ide_drive_t *, int, int); | ||
1103 | struct device_driver gen_driver; | 1104 | struct device_driver gen_driver; |
1104 | int (*probe)(ide_drive_t *); | 1105 | int (*probe)(ide_drive_t *); |
1105 | void (*remove)(ide_drive_t *); | 1106 | void (*remove)(ide_drive_t *); |
@@ -1130,19 +1131,15 @@ int generic_ide_ioctl(ide_drive_t *, struct block_device *, unsigned, unsigned l | |||
1130 | extern int ide_vlb_clk; | 1131 | extern int ide_vlb_clk; |
1131 | extern int ide_pci_clk; | 1132 | extern int ide_pci_clk; |
1132 | 1133 | ||
1133 | int ide_end_request(ide_drive_t *, int, int); | 1134 | unsigned int ide_rq_bytes(struct request *); |
1134 | int ide_end_dequeued_request(ide_drive_t *, struct request *, int, int); | 1135 | int ide_end_rq(ide_drive_t *, struct request *, int, unsigned int); |
1135 | void ide_kill_rq(ide_drive_t *, struct request *); | 1136 | void ide_kill_rq(ide_drive_t *, struct request *); |
1136 | 1137 | ||
1137 | void __ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int, | 1138 | void __ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int); |
1138 | ide_expiry_t *); | 1139 | void ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int); |
1139 | void ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int, | ||
1140 | ide_expiry_t *); | ||
1141 | |||
1142 | void ide_execute_command(ide_drive_t *, u8, ide_handler_t *, unsigned int, | ||
1143 | ide_expiry_t *); | ||
1144 | 1140 | ||
1145 | void ide_execute_pkt_cmd(ide_drive_t *); | 1141 | void ide_execute_command(ide_drive_t *, struct ide_cmd *, ide_handler_t *, |
1142 | unsigned int); | ||
1146 | 1143 | ||
1147 | void ide_pad_transfer(ide_drive_t *, int, int); | 1144 | void ide_pad_transfer(ide_drive_t *, int, int); |
1148 | 1145 | ||
@@ -1164,7 +1161,8 @@ extern ide_startstop_t ide_do_reset (ide_drive_t *); | |||
1164 | extern int ide_devset_execute(ide_drive_t *drive, | 1161 | extern int ide_devset_execute(ide_drive_t *drive, |
1165 | const struct ide_devset *setting, int arg); | 1162 | const struct ide_devset *setting, int arg); |
1166 | 1163 | ||
1167 | extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); | 1164 | void ide_complete_cmd(ide_drive_t *, struct ide_cmd *, u8, u8); |
1165 | int ide_complete_rq(ide_drive_t *, int, unsigned int); | ||
1168 | 1166 | ||
1169 | void ide_tf_dump(const char *, struct ide_taskfile *); | 1167 | void ide_tf_dump(const char *, struct ide_taskfile *); |
1170 | 1168 | ||
@@ -1174,11 +1172,11 @@ u8 ide_read_altstatus(ide_hwif_t *); | |||
1174 | 1172 | ||
1175 | void ide_set_irq(ide_hwif_t *, int); | 1173 | void ide_set_irq(ide_hwif_t *, int); |
1176 | 1174 | ||
1177 | void ide_tf_load(ide_drive_t *, ide_task_t *); | 1175 | void ide_tf_load(ide_drive_t *, struct ide_cmd *); |
1178 | void ide_tf_read(ide_drive_t *, ide_task_t *); | 1176 | void ide_tf_read(ide_drive_t *, struct ide_cmd *); |
1179 | 1177 | ||
1180 | void ide_input_data(ide_drive_t *, struct request *, void *, unsigned int); | 1178 | void ide_input_data(ide_drive_t *, struct ide_cmd *, void *, unsigned int); |
1181 | void ide_output_data(ide_drive_t *, struct request *, void *, unsigned int); | 1179 | void ide_output_data(ide_drive_t *, struct ide_cmd *, void *, unsigned int); |
1182 | 1180 | ||
1183 | int ide_io_buffers(ide_drive_t *, struct ide_atapi_pc *, unsigned int, int); | 1181 | int ide_io_buffers(ide_drive_t *, struct ide_atapi_pc *, unsigned int, int); |
1184 | 1182 | ||
@@ -1224,16 +1222,16 @@ int ide_cd_expiry(ide_drive_t *); | |||
1224 | 1222 | ||
1225 | int ide_cd_get_xferlen(struct request *); | 1223 | int ide_cd_get_xferlen(struct request *); |
1226 | 1224 | ||
1227 | ide_startstop_t ide_issue_pc(ide_drive_t *); | 1225 | ide_startstop_t ide_issue_pc(ide_drive_t *, struct ide_cmd *); |
1228 | 1226 | ||
1229 | ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *); | 1227 | ide_startstop_t do_rw_taskfile(ide_drive_t *, struct ide_cmd *); |
1230 | 1228 | ||
1231 | void task_end_request(ide_drive_t *, struct request *, u8); | 1229 | void ide_finish_cmd(ide_drive_t *, struct ide_cmd *, u8); |
1232 | 1230 | ||
1233 | int ide_raw_taskfile(ide_drive_t *, ide_task_t *, u8 *, u16); | 1231 | int ide_raw_taskfile(ide_drive_t *, struct ide_cmd *, u8 *, u16); |
1234 | int ide_no_data_taskfile(ide_drive_t *, ide_task_t *); | 1232 | int ide_no_data_taskfile(ide_drive_t *, struct ide_cmd *); |
1235 | 1233 | ||
1236 | int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long); | 1234 | int ide_taskfile_ioctl(ide_drive_t *, unsigned long); |
1237 | 1235 | ||
1238 | int ide_dev_read_id(ide_drive_t *, u8, u16 *); | 1236 | int ide_dev_read_id(ide_drive_t *, u8, u16 *); |
1239 | 1237 | ||
@@ -1335,6 +1333,10 @@ enum { | |||
1335 | IDE_HFLAG_ERROR_STOPS_FIFO = (1 << 19), | 1333 | IDE_HFLAG_ERROR_STOPS_FIFO = (1 << 19), |
1336 | /* serialize ports */ | 1334 | /* serialize ports */ |
1337 | IDE_HFLAG_SERIALIZE = (1 << 20), | 1335 | IDE_HFLAG_SERIALIZE = (1 << 20), |
1336 | /* host is DTC2278 */ | ||
1337 | IDE_HFLAG_DTC2278 = (1 << 21), | ||
1338 | /* 4 devices on a single set of I/O ports */ | ||
1339 | IDE_HFLAG_4DRIVES = (1 << 22), | ||
1338 | /* host is TRM290 */ | 1340 | /* host is TRM290 */ |
1339 | IDE_HFLAG_TRM290 = (1 << 23), | 1341 | IDE_HFLAG_TRM290 = (1 << 23), |
1340 | /* use 32-bit I/O ops */ | 1342 | /* use 32-bit I/O ops */ |
@@ -1362,7 +1364,12 @@ enum { | |||
1362 | 1364 | ||
1363 | struct ide_port_info { | 1365 | struct ide_port_info { |
1364 | char *name; | 1366 | char *name; |
1367 | |||
1365 | int (*init_chipset)(struct pci_dev *); | 1368 | int (*init_chipset)(struct pci_dev *); |
1369 | |||
1370 | void (*get_lock)(irq_handler_t, void *); | ||
1371 | void (*release_lock)(void); | ||
1372 | |||
1366 | void (*init_iops)(ide_hwif_t *); | 1373 | void (*init_iops)(ide_hwif_t *); |
1367 | void (*init_hwif)(ide_hwif_t *); | 1374 | void (*init_hwif)(ide_hwif_t *); |
1368 | int (*init_dma)(ide_hwif_t *, | 1375 | int (*init_dma)(ide_hwif_t *, |
@@ -1379,6 +1386,9 @@ struct ide_port_info { | |||
1379 | u16 max_sectors; /* if < than the default one */ | 1386 | u16 max_sectors; /* if < than the default one */ |
1380 | 1387 | ||
1381 | u32 host_flags; | 1388 | u32 host_flags; |
1389 | |||
1390 | int irq_flags; | ||
1391 | |||
1382 | u8 pio_mask; | 1392 | u8 pio_mask; |
1383 | u8 swdma_mask; | 1393 | u8 swdma_mask; |
1384 | u8 mwdma_mask; | 1394 | u8 mwdma_mask; |
@@ -1398,8 +1408,8 @@ int ide_pci_resume(struct pci_dev *); | |||
1398 | #define ide_pci_resume NULL | 1408 | #define ide_pci_resume NULL |
1399 | #endif | 1409 | #endif |
1400 | 1410 | ||
1401 | void ide_map_sg(ide_drive_t *, struct request *); | 1411 | void ide_map_sg(ide_drive_t *, struct ide_cmd *); |
1402 | void ide_init_sg_cmd(ide_drive_t *, struct request *); | 1412 | void ide_init_sg_cmd(struct ide_cmd *, unsigned int); |
1403 | 1413 | ||
1404 | #define BAD_DMA_DRIVE 0 | 1414 | #define BAD_DMA_DRIVE 0 |
1405 | #define GOOD_DMA_DRIVE 1 | 1415 | #define GOOD_DMA_DRIVE 1 |
@@ -1433,18 +1443,18 @@ ide_startstop_t ide_dma_intr(ide_drive_t *); | |||
1433 | int ide_allocate_dma_engine(ide_hwif_t *); | 1443 | int ide_allocate_dma_engine(ide_hwif_t *); |
1434 | void ide_release_dma_engine(ide_hwif_t *); | 1444 | void ide_release_dma_engine(ide_hwif_t *); |
1435 | 1445 | ||
1436 | int ide_build_sglist(ide_drive_t *, struct request *); | 1446 | int ide_build_sglist(ide_drive_t *, struct ide_cmd *); |
1437 | void ide_destroy_dmatable(ide_drive_t *); | 1447 | void ide_destroy_dmatable(ide_drive_t *); |
1438 | 1448 | ||
1439 | #ifdef CONFIG_BLK_DEV_IDEDMA_SFF | 1449 | #ifdef CONFIG_BLK_DEV_IDEDMA_SFF |
1440 | int config_drive_for_dma(ide_drive_t *); | 1450 | int config_drive_for_dma(ide_drive_t *); |
1441 | extern int ide_build_dmatable(ide_drive_t *, struct request *); | 1451 | int ide_build_dmatable(ide_drive_t *, struct ide_cmd *); |
1442 | void ide_dma_host_set(ide_drive_t *, int); | 1452 | void ide_dma_host_set(ide_drive_t *, int); |
1443 | extern int ide_dma_setup(ide_drive_t *); | 1453 | int ide_dma_setup(ide_drive_t *, struct ide_cmd *); |
1444 | void ide_dma_exec_cmd(ide_drive_t *, u8); | ||
1445 | extern void ide_dma_start(ide_drive_t *); | 1454 | extern void ide_dma_start(ide_drive_t *); |
1446 | int ide_dma_end(ide_drive_t *); | 1455 | int ide_dma_end(ide_drive_t *); |
1447 | int ide_dma_test_irq(ide_drive_t *); | 1456 | int ide_dma_test_irq(ide_drive_t *); |
1457 | int ide_dma_sff_timer_expiry(ide_drive_t *); | ||
1448 | u8 ide_dma_sff_read_status(ide_hwif_t *); | 1458 | u8 ide_dma_sff_read_status(ide_hwif_t *); |
1449 | extern const struct ide_dma_ops sff_dma_ops; | 1459 | extern const struct ide_dma_ops sff_dma_ops; |
1450 | #else | 1460 | #else |
@@ -1465,8 +1475,11 @@ static inline void ide_dma_on(ide_drive_t *drive) { ; } | |||
1465 | static inline void ide_dma_verbose(ide_drive_t *drive) { ; } | 1475 | static inline void ide_dma_verbose(ide_drive_t *drive) { ; } |
1466 | static inline int ide_set_dma(ide_drive_t *drive) { return 1; } | 1476 | static inline int ide_set_dma(ide_drive_t *drive) { return 1; } |
1467 | static inline void ide_check_dma_crc(ide_drive_t *drive) { ; } | 1477 | static inline void ide_check_dma_crc(ide_drive_t *drive) { ; } |
1478 | static inline ide_startstop_t ide_dma_intr(ide_drive_t *drive) { return ide_stopped; } | ||
1468 | static inline ide_startstop_t ide_dma_timeout_retry(ide_drive_t *drive, int error) { return ide_stopped; } | 1479 | static inline ide_startstop_t ide_dma_timeout_retry(ide_drive_t *drive, int error) { return ide_stopped; } |
1469 | static inline void ide_release_dma_engine(ide_hwif_t *hwif) { ; } | 1480 | static inline void ide_release_dma_engine(ide_hwif_t *hwif) { ; } |
1481 | static inline int ide_build_sglist(ide_drive_t *drive, | ||
1482 | struct ide_cmd *cmd) { return 0; } | ||
1470 | #endif /* CONFIG_BLK_DEV_IDEDMA */ | 1483 | #endif /* CONFIG_BLK_DEV_IDEDMA */ |
1471 | 1484 | ||
1472 | #ifdef CONFIG_BLK_DEV_IDEACPI | 1485 | #ifdef CONFIG_BLK_DEV_IDEACPI |