aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-io.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-io.c')
-rw-r--r--drivers/ide/ide-io.c68
1 files changed, 5 insertions, 63 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index ecfb87c10097..ec709269c066 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -543,30 +543,6 @@ static ide_startstop_t ide_disk_special(ide_drive_t *drive)
543 return ide_started; 543 return ide_started;
544} 544}
545 545
546/*
547 * handle HDIO_SET_PIO_MODE ioctl abusers here, eventually it will go away
548 */
549static int set_pio_mode_abuse(ide_hwif_t *hwif, u8 req_pio)
550{
551 switch (req_pio) {
552 case 202:
553 case 201:
554 case 200:
555 case 102:
556 case 101:
557 case 100:
558 return (hwif->host_flags & IDE_HFLAG_ABUSE_DMA_MODES) ? 1 : 0;
559 case 9:
560 case 8:
561 return (hwif->host_flags & IDE_HFLAG_ABUSE_PREFETCH) ? 1 : 0;
562 case 7:
563 case 6:
564 return (hwif->host_flags & IDE_HFLAG_ABUSE_FAST_DEVSEL) ? 1 : 0;
565 default:
566 return 0;
567 }
568}
569
570/** 546/**
571 * do_special - issue some special commands 547 * do_special - issue some special commands
572 * @drive: drive the command is for 548 * @drive: drive the command is for
@@ -584,46 +560,12 @@ static ide_startstop_t do_special (ide_drive_t *drive)
584#ifdef DEBUG 560#ifdef DEBUG
585 printk("%s: do_special: 0x%02x\n", drive->name, s->all); 561 printk("%s: do_special: 0x%02x\n", drive->name, s->all);
586#endif 562#endif
587 if (s->b.set_tune) { 563 if (drive->media == ide_disk)
588 ide_hwif_t *hwif = drive->hwif; 564 return ide_disk_special(drive);
589 const struct ide_port_ops *port_ops = hwif->port_ops;
590 u8 req_pio = drive->tune_req;
591
592 s->b.set_tune = 0;
593
594 if (set_pio_mode_abuse(drive->hwif, req_pio)) {
595 /*
596 * take ide_lock for IDE_DFLAG_[NO_]UNMASK/[NO_]IO_32BIT
597 */
598 if (req_pio == 8 || req_pio == 9) {
599 unsigned long flags;
600
601 spin_lock_irqsave(&ide_lock, flags);
602 port_ops->set_pio_mode(drive, req_pio);
603 spin_unlock_irqrestore(&ide_lock, flags);
604 } else
605 port_ops->set_pio_mode(drive, req_pio);
606 } else {
607 int keep_dma =
608 !!(drive->dev_flags & IDE_DFLAG_USING_DMA);
609
610 ide_set_pio(drive, req_pio);
611
612 if (hwif->host_flags & IDE_HFLAG_SET_PIO_MODE_KEEP_DMA) {
613 if (keep_dma)
614 ide_dma_on(drive);
615 }
616 }
617
618 return ide_stopped;
619 } else {
620 if (drive->media == ide_disk)
621 return ide_disk_special(drive);
622 565
623 s->all = 0; 566 s->all = 0;
624 drive->mult_req = 0; 567 drive->mult_req = 0;
625 return ide_stopped; 568 return ide_stopped;
626 }
627} 569}
628 570
629void ide_map_sg(ide_drive_t *drive, struct request *rq) 571void ide_map_sg(ide_drive_t *drive, struct request *rq)