aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ide/ide-io.c41
-rw-r--r--drivers/ide/ide-taskfile.c28
-rw-r--r--include/linux/ide.h5
3 files changed, 38 insertions, 36 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 18ac1bd0811f..48c38b68bd36 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -637,32 +637,26 @@ static ide_startstop_t drive_cmd_intr (ide_drive_t *drive)
637 return ide_stopped; 637 return ide_stopped;
638} 638}
639 639
640static void ide_init_specify_cmd(ide_drive_t *drive, ide_task_t *task) 640static void ide_tf_set_specify_cmd(ide_drive_t *drive, struct ide_taskfile *tf)
641{ 641{
642 task->tf.nsect = drive->sect; 642 tf->nsect = drive->sect;
643 task->tf.lbal = drive->sect; 643 tf->lbal = drive->sect;
644 task->tf.lbam = drive->cyl; 644 tf->lbam = drive->cyl;
645 task->tf.lbah = drive->cyl >> 8; 645 tf->lbah = drive->cyl >> 8;
646 task->tf.device = ((drive->head - 1) | drive->select.all) & ~ATA_LBA; 646 tf->device = ((drive->head - 1) | drive->select.all) & ~ATA_LBA;
647 task->tf.command = WIN_SPECIFY; 647 tf->command = WIN_SPECIFY;
648
649 task->handler = &set_geometry_intr;
650} 648}
651 649
652static void ide_init_restore_cmd(ide_drive_t *drive, ide_task_t *task) 650static void ide_tf_set_restore_cmd(ide_drive_t *drive, struct ide_taskfile *tf)
653{ 651{
654 task->tf.nsect = drive->sect; 652 tf->nsect = drive->sect;
655 task->tf.command = WIN_RESTORE; 653 tf->command = WIN_RESTORE;
656
657 task->handler = &recal_intr;
658} 654}
659 655
660static void ide_init_setmult_cmd(ide_drive_t *drive, ide_task_t *task) 656static void ide_tf_set_setmult_cmd(ide_drive_t *drive, struct ide_taskfile *tf)
661{ 657{
662 task->tf.nsect = drive->mult_req; 658 tf->nsect = drive->mult_req;
663 task->tf.command = WIN_SETMULT; 659 tf->command = WIN_SETMULT;
664
665 task->handler = &set_multmode_intr;
666} 660}
667 661
668static ide_startstop_t ide_disk_special(ide_drive_t *drive) 662static ide_startstop_t ide_disk_special(ide_drive_t *drive)
@@ -675,15 +669,15 @@ static ide_startstop_t ide_disk_special(ide_drive_t *drive)
675 669
676 if (s->b.set_geometry) { 670 if (s->b.set_geometry) {
677 s->b.set_geometry = 0; 671 s->b.set_geometry = 0;
678 ide_init_specify_cmd(drive, &args); 672 ide_tf_set_specify_cmd(drive, &args.tf);
679 } else if (s->b.recalibrate) { 673 } else if (s->b.recalibrate) {
680 s->b.recalibrate = 0; 674 s->b.recalibrate = 0;
681 ide_init_restore_cmd(drive, &args); 675 ide_tf_set_restore_cmd(drive, &args.tf);
682 } else if (s->b.set_multmode) { 676 } else if (s->b.set_multmode) {
683 s->b.set_multmode = 0; 677 s->b.set_multmode = 0;
684 if (drive->mult_req > drive->id->max_multsect) 678 if (drive->mult_req > drive->id->max_multsect)
685 drive->mult_req = drive->id->max_multsect; 679 drive->mult_req = drive->id->max_multsect;
686 ide_init_setmult_cmd(drive, &args); 680 ide_tf_set_setmult_cmd(drive, &args.tf);
687 } else if (s->all) { 681 } else if (s->all) {
688 int special = s->all; 682 int special = s->all;
689 s->all = 0; 683 s->all = 0;
@@ -691,7 +685,8 @@ static ide_startstop_t ide_disk_special(ide_drive_t *drive)
691 return ide_stopped; 685 return ide_stopped;
692 } 686 }
693 687
694 args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; 688 args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE |
689 IDE_TFLAG_CUSTOM_HANDLER;
695 690
696 do_rw_taskfile(drive, &args); 691 do_rw_taskfile(drive, &args);
697 692
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index 835465d61f70..236f91f11a73 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -151,12 +151,15 @@ static int inline task_dma_ok(ide_task_t *task)
151} 151}
152 152
153static ide_startstop_t task_no_data_intr(ide_drive_t *); 153static ide_startstop_t task_no_data_intr(ide_drive_t *);
154static ide_startstop_t task_out_intr(ide_drive_t *); 154static ide_startstop_t set_geometry_intr(ide_drive_t *);
155static ide_startstop_t recal_intr(ide_drive_t *);
156static ide_startstop_t set_multmode_intr(ide_drive_t *);
155 157
156ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task) 158ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task)
157{ 159{
158 ide_hwif_t *hwif = HWIF(drive); 160 ide_hwif_t *hwif = HWIF(drive);
159 struct ide_taskfile *tf = &task->tf; 161 struct ide_taskfile *tf = &task->tf;
162 ide_handler_t *handler = NULL;
160 163
161 if (task->data_phase == TASKFILE_MULTI_IN || 164 if (task->data_phase == TASKFILE_MULTI_IN ||
162 task->data_phase == TASKFILE_MULTI_OUT) { 165 task->data_phase == TASKFILE_MULTI_OUT) {
@@ -175,19 +178,26 @@ ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task)
175 switch (task->data_phase) { 178 switch (task->data_phase) {
176 case TASKFILE_MULTI_OUT: 179 case TASKFILE_MULTI_OUT:
177 case TASKFILE_OUT: 180 case TASKFILE_OUT:
178 task->handler = task_out_intr;
179 hwif->OUTBSYNC(drive, tf->command, IDE_COMMAND_REG); 181 hwif->OUTBSYNC(drive, tf->command, IDE_COMMAND_REG);
180 ndelay(400); /* FIXME */ 182 ndelay(400); /* FIXME */
181 return pre_task_out_intr(drive, task->rq); 183 return pre_task_out_intr(drive, task->rq);
182 case TASKFILE_MULTI_IN: 184 case TASKFILE_MULTI_IN:
183 case TASKFILE_IN: 185 case TASKFILE_IN:
184 task->handler = task_in_intr; 186 handler = task_in_intr;
185 /* fall-through */ 187 /* fall-through */
186 case TASKFILE_NO_DATA: 188 case TASKFILE_NO_DATA:
189 if (handler == NULL)
190 handler = task_no_data_intr;
187 /* WIN_{SPECIFY,RESTORE,SETMULT} use custom handlers */ 191 /* WIN_{SPECIFY,RESTORE,SETMULT} use custom handlers */
188 if (task->handler == NULL) 192 if (task->tf_flags & IDE_TFLAG_CUSTOM_HANDLER) {
189 task->handler = task_no_data_intr; 193 switch (tf->command) {
190 ide_execute_command(drive, tf->command, task->handler, WAIT_WORSTCASE, NULL); 194 case WIN_SPECIFY: handler = set_geometry_intr; break;
195 case WIN_RESTORE: handler = recal_intr; break;
196 case WIN_SETMULT: handler = set_multmode_intr; break;
197 }
198 }
199 ide_execute_command(drive, tf->command, handler,
200 WAIT_WORSTCASE, NULL);
191 return ide_started; 201 return ide_started;
192 default: 202 default:
193 if (task_dma_ok(task) == 0 || drive->using_dma == 0 || 203 if (task_dma_ok(task) == 0 || drive->using_dma == 0 ||
@@ -202,7 +212,7 @@ ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task)
202/* 212/*
203 * set_multmode_intr() is invoked on completion of a WIN_SETMULT cmd. 213 * set_multmode_intr() is invoked on completion of a WIN_SETMULT cmd.
204 */ 214 */
205ide_startstop_t set_multmode_intr (ide_drive_t *drive) 215static ide_startstop_t set_multmode_intr(ide_drive_t *drive)
206{ 216{
207 ide_hwif_t *hwif = HWIF(drive); 217 ide_hwif_t *hwif = HWIF(drive);
208 u8 stat; 218 u8 stat;
@@ -220,7 +230,7 @@ ide_startstop_t set_multmode_intr (ide_drive_t *drive)
220/* 230/*
221 * set_geometry_intr() is invoked on completion of a WIN_SPECIFY cmd. 231 * set_geometry_intr() is invoked on completion of a WIN_SPECIFY cmd.
222 */ 232 */
223ide_startstop_t set_geometry_intr (ide_drive_t *drive) 233static ide_startstop_t set_geometry_intr(ide_drive_t *drive)
224{ 234{
225 ide_hwif_t *hwif = HWIF(drive); 235 ide_hwif_t *hwif = HWIF(drive);
226 int retries = 5; 236 int retries = 5;
@@ -243,7 +253,7 @@ ide_startstop_t set_geometry_intr (ide_drive_t *drive)
243/* 253/*
244 * recal_intr() is invoked on completion of a WIN_RESTORE (recalibrate) cmd. 254 * recal_intr() is invoked on completion of a WIN_RESTORE (recalibrate) cmd.
245 */ 255 */
246ide_startstop_t recal_intr (ide_drive_t *drive) 256static ide_startstop_t recal_intr(ide_drive_t *drive)
247{ 257{
248 ide_hwif_t *hwif = HWIF(drive); 258 ide_hwif_t *hwif = HWIF(drive);
249 u8 stat; 259 u8 stat;
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 5d675f172037..721c9d8f41a2 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -911,6 +911,7 @@ enum {
911 IDE_TFLAG_WRITE = (1 << 15), 911 IDE_TFLAG_WRITE = (1 << 15),
912 IDE_TFLAG_FLAGGED_SET_IN_FLAGS = (1 << 16), 912 IDE_TFLAG_FLAGGED_SET_IN_FLAGS = (1 << 16),
913 IDE_TFLAG_IN_DATA = (1 << 17), 913 IDE_TFLAG_IN_DATA = (1 << 17),
914 IDE_TFLAG_CUSTOM_HANDLER = (1 << 18),
914}; 915};
915 916
916struct ide_taskfile { 917struct ide_taskfile {
@@ -949,7 +950,6 @@ typedef struct ide_task_s {
949 }; 950 };
950 u32 tf_flags; 951 u32 tf_flags;
951 int data_phase; 952 int data_phase;
952 ide_handler_t *handler;
953 struct request *rq; /* copy of request */ 953 struct request *rq; /* copy of request */
954 void *special; /* valid_t generally */ 954 void *special; /* valid_t generally */
955} ide_task_t; 955} ide_task_t;
@@ -970,9 +970,6 @@ void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8);
970 */ 970 */
971extern ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *); 971extern ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *);
972 972
973extern ide_startstop_t set_multmode_intr(ide_drive_t *);
974extern ide_startstop_t set_geometry_intr(ide_drive_t *);
975extern ide_startstop_t recal_intr(ide_drive_t *);
976extern ide_startstop_t task_in_intr(ide_drive_t *); 973extern ide_startstop_t task_in_intr(ide_drive_t *);
977extern ide_startstop_t pre_task_out_intr(ide_drive_t *, struct request *); 974extern ide_startstop_t pre_task_out_intr(ide_drive_t *, struct request *);
978 975