diff options
Diffstat (limited to 'drivers/ide/ide-taskfile.c')
-rw-r--r-- | drivers/ide/ide-taskfile.c | 70 |
1 files changed, 16 insertions, 54 deletions
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 9f9ad9fb6b89..9a846a0cd5a4 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c | |||
@@ -33,60 +33,18 @@ | |||
33 | #include <asm/uaccess.h> | 33 | #include <asm/uaccess.h> |
34 | #include <asm/io.h> | 34 | #include <asm/io.h> |
35 | 35 | ||
36 | void ide_tf_load(ide_drive_t *drive, ide_task_t *task) | 36 | void ide_tf_dump(const char *s, struct ide_taskfile *tf) |
37 | { | 37 | { |
38 | ide_hwif_t *hwif = drive->hwif; | ||
39 | struct ide_io_ports *io_ports = &hwif->io_ports; | ||
40 | struct ide_taskfile *tf = &task->tf; | ||
41 | u8 HIHI = (task->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; | ||
42 | |||
43 | if (task->tf_flags & IDE_TFLAG_FLAGGED) | ||
44 | HIHI = 0xFF; | ||
45 | |||
46 | #ifdef DEBUG | 38 | #ifdef DEBUG |
47 | printk("%s: tf: feat 0x%02x nsect 0x%02x lbal 0x%02x " | 39 | printk("%s: tf: feat 0x%02x nsect 0x%02x lbal 0x%02x " |
48 | "lbam 0x%02x lbah 0x%02x dev 0x%02x cmd 0x%02x\n", | 40 | "lbam 0x%02x lbah 0x%02x dev 0x%02x cmd 0x%02x\n", |
49 | drive->name, tf->feature, tf->nsect, tf->lbal, | 41 | s, tf->feature, tf->nsect, tf->lbal, |
50 | tf->lbam, tf->lbah, tf->device, tf->command); | 42 | tf->lbam, tf->lbah, tf->device, tf->command); |
51 | printk("%s: hob: nsect 0x%02x lbal 0x%02x " | 43 | printk("%s: hob: nsect 0x%02x lbal 0x%02x " |
52 | "lbam 0x%02x lbah 0x%02x\n", | 44 | "lbam 0x%02x lbah 0x%02x\n", |
53 | drive->name, tf->hob_nsect, tf->hob_lbal, | 45 | s, tf->hob_nsect, tf->hob_lbal, |
54 | tf->hob_lbam, tf->hob_lbah); | 46 | tf->hob_lbam, tf->hob_lbah); |
55 | #endif | 47 | #endif |
56 | |||
57 | ide_set_irq(drive, 1); | ||
58 | |||
59 | if ((task->tf_flags & IDE_TFLAG_NO_SELECT_MASK) == 0) | ||
60 | SELECT_MASK(drive, 0); | ||
61 | |||
62 | if (task->tf_flags & IDE_TFLAG_OUT_DATA) | ||
63 | hwif->OUTW((tf->hob_data << 8) | tf->data, io_ports->data_addr); | ||
64 | |||
65 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) | ||
66 | hwif->OUTB(tf->hob_feature, io_ports->feature_addr); | ||
67 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) | ||
68 | hwif->OUTB(tf->hob_nsect, io_ports->nsect_addr); | ||
69 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) | ||
70 | hwif->OUTB(tf->hob_lbal, io_ports->lbal_addr); | ||
71 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) | ||
72 | hwif->OUTB(tf->hob_lbam, io_ports->lbam_addr); | ||
73 | if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) | ||
74 | hwif->OUTB(tf->hob_lbah, io_ports->lbah_addr); | ||
75 | |||
76 | if (task->tf_flags & IDE_TFLAG_OUT_FEATURE) | ||
77 | hwif->OUTB(tf->feature, io_ports->feature_addr); | ||
78 | if (task->tf_flags & IDE_TFLAG_OUT_NSECT) | ||
79 | hwif->OUTB(tf->nsect, io_ports->nsect_addr); | ||
80 | if (task->tf_flags & IDE_TFLAG_OUT_LBAL) | ||
81 | hwif->OUTB(tf->lbal, io_ports->lbal_addr); | ||
82 | if (task->tf_flags & IDE_TFLAG_OUT_LBAM) | ||
83 | hwif->OUTB(tf->lbam, io_ports->lbam_addr); | ||
84 | if (task->tf_flags & IDE_TFLAG_OUT_LBAH) | ||
85 | hwif->OUTB(tf->lbah, io_ports->lbah_addr); | ||
86 | |||
87 | if (task->tf_flags & IDE_TFLAG_OUT_DEVICE) | ||
88 | hwif->OUTB((tf->device & HIHI) | drive->select.all, | ||
89 | io_ports->device_addr); | ||
90 | } | 48 | } |
91 | 49 | ||
92 | int taskfile_lib_get_identify (ide_drive_t *drive, u8 *buf) | 50 | int taskfile_lib_get_identify (ide_drive_t *drive, u8 *buf) |
@@ -149,8 +107,10 @@ ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task) | |||
149 | if (task->tf_flags & IDE_TFLAG_FLAGGED) | 107 | if (task->tf_flags & IDE_TFLAG_FLAGGED) |
150 | task->tf_flags |= IDE_TFLAG_FLAGGED_SET_IN_FLAGS; | 108 | task->tf_flags |= IDE_TFLAG_FLAGGED_SET_IN_FLAGS; |
151 | 109 | ||
152 | if ((task->tf_flags & IDE_TFLAG_DMA_PIO_FALLBACK) == 0) | 110 | if ((task->tf_flags & IDE_TFLAG_DMA_PIO_FALLBACK) == 0) { |
153 | ide_tf_load(drive, task); | 111 | ide_tf_dump(drive->name, tf); |
112 | hwif->tf_load(drive, task); | ||
113 | } | ||
154 | 114 | ||
155 | switch (task->data_phase) { | 115 | switch (task->data_phase) { |
156 | case TASKFILE_MULTI_OUT: | 116 | case TASKFILE_MULTI_OUT: |
@@ -283,7 +243,8 @@ static u8 wait_drive_not_busy(ide_drive_t *drive) | |||
283 | return stat; | 243 | return stat; |
284 | } | 244 | } |
285 | 245 | ||
286 | static void ide_pio_sector(ide_drive_t *drive, unsigned int write) | 246 | static void ide_pio_sector(ide_drive_t *drive, struct request *rq, |
247 | unsigned int write) | ||
287 | { | 248 | { |
288 | ide_hwif_t *hwif = drive->hwif; | 249 | ide_hwif_t *hwif = drive->hwif; |
289 | struct scatterlist *sg = hwif->sg_table; | 250 | struct scatterlist *sg = hwif->sg_table; |
@@ -323,9 +284,9 @@ static void ide_pio_sector(ide_drive_t *drive, unsigned int write) | |||
323 | 284 | ||
324 | /* do the actual data transfer */ | 285 | /* do the actual data transfer */ |
325 | if (write) | 286 | if (write) |
326 | hwif->ata_output_data(drive, buf, SECTOR_WORDS); | 287 | hwif->output_data(drive, rq, buf, SECTOR_SIZE); |
327 | else | 288 | else |
328 | hwif->ata_input_data(drive, buf, SECTOR_WORDS); | 289 | hwif->input_data(drive, rq, buf, SECTOR_SIZE); |
329 | 290 | ||
330 | kunmap_atomic(buf, KM_BIO_SRC_IRQ); | 291 | kunmap_atomic(buf, KM_BIO_SRC_IRQ); |
331 | #ifdef CONFIG_HIGHMEM | 292 | #ifdef CONFIG_HIGHMEM |
@@ -333,13 +294,14 @@ static void ide_pio_sector(ide_drive_t *drive, unsigned int write) | |||
333 | #endif | 294 | #endif |
334 | } | 295 | } |
335 | 296 | ||
336 | static void ide_pio_multi(ide_drive_t *drive, unsigned int write) | 297 | static void ide_pio_multi(ide_drive_t *drive, struct request *rq, |
298 | unsigned int write) | ||
337 | { | 299 | { |
338 | unsigned int nsect; | 300 | unsigned int nsect; |
339 | 301 | ||
340 | nsect = min_t(unsigned int, drive->hwif->nleft, drive->mult_count); | 302 | nsect = min_t(unsigned int, drive->hwif->nleft, drive->mult_count); |
341 | while (nsect--) | 303 | while (nsect--) |
342 | ide_pio_sector(drive, write); | 304 | ide_pio_sector(drive, rq, write); |
343 | } | 305 | } |
344 | 306 | ||
345 | static void ide_pio_datablock(ide_drive_t *drive, struct request *rq, | 307 | static void ide_pio_datablock(ide_drive_t *drive, struct request *rq, |
@@ -362,10 +324,10 @@ static void ide_pio_datablock(ide_drive_t *drive, struct request *rq, | |||
362 | switch (drive->hwif->data_phase) { | 324 | switch (drive->hwif->data_phase) { |
363 | case TASKFILE_MULTI_IN: | 325 | case TASKFILE_MULTI_IN: |
364 | case TASKFILE_MULTI_OUT: | 326 | case TASKFILE_MULTI_OUT: |
365 | ide_pio_multi(drive, write); | 327 | ide_pio_multi(drive, rq, write); |
366 | break; | 328 | break; |
367 | default: | 329 | default: |
368 | ide_pio_sector(drive, write); | 330 | ide_pio_sector(drive, rq, write); |
369 | break; | 331 | break; |
370 | } | 332 | } |
371 | 333 | ||