ide: switch ide_cmd_ioctl() to use REQ_TYPE_ATA_TASKFILE requests
[pandora-kernel.git] / drivers / ide / ide-iops.c
index 1064542..e2a7e95 100644 (file)
@@ -158,14 +158,6 @@ void default_hwif_mmiops (ide_hwif_t *hwif)
 
 EXPORT_SYMBOL(default_hwif_mmiops);
 
-u32 ide_read_24 (ide_drive_t *drive)
-{
-       u8 hcyl = HWIF(drive)->INB(IDE_HCYL_REG);
-       u8 lcyl = HWIF(drive)->INB(IDE_LCYL_REG);
-       u8 sect = HWIF(drive)->INB(IDE_SECTOR_REG);
-       return (hcyl<<16)|(lcyl<<8)|sect;
-}
-
 void SELECT_DRIVE (ide_drive_t *drive)
 {
        if (HWIF(drive)->selectproc)
@@ -627,7 +619,7 @@ no_80w:
 int ide_ata66_check (ide_drive_t *drive, ide_task_t *args)
 {
        if (args->tf.command == WIN_SETFEATURES &&
-           args->tf.lbal > XFER_UDMA_2 &&
+           args->tf.nsect > XFER_UDMA_2 &&
            args->tf.feature == SETFEATURES_XFER) {
                if (eighty_ninty_three(drive) == 0) {
                        printk(KERN_WARNING "%s: UDMA speeds >UDMA33 cannot "
@@ -647,7 +639,7 @@ int ide_ata66_check (ide_drive_t *drive, ide_task_t *args)
 int set_transfer (ide_drive_t *drive, ide_task_t *args)
 {
        if (args->tf.command == WIN_SETFEATURES &&
-           args->tf.lbal >= XFER_SW_DMA_0 &&
+           args->tf.nsect >= XFER_SW_DMA_0 &&
            args->tf.feature == SETFEATURES_XFER &&
            (drive->id->dma_ultra ||
             drive->id->dma_mword ||
@@ -696,8 +688,7 @@ int ide_driveid_update(ide_drive_t *drive)
         */
 
        SELECT_MASK(drive, 1);
-       if (IDE_CONTROL_REG)
-               hwif->OUTB(drive->ctl,IDE_CONTROL_REG);
+       ide_set_irq(drive, 1);
        msleep(50);
        hwif->OUTB(WIN_IDENTIFY, IDE_COMMAND_REG);
        timeout = jiffies + WAIT_WORSTCASE;
@@ -750,8 +741,8 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
 //             msleep(50);
 
 #ifdef CONFIG_BLK_DEV_IDEDMA
-       if (hwif->ide_dma_on)   /* check if host supports DMA */
-               hwif->dma_host_off(drive);
+       if (hwif->dma_host_set) /* check if host supports DMA */
+               hwif->dma_host_set(drive, 0);
 #endif
 
        /* Skip setting PIO flow-control modes on pre-EIDE drives */
@@ -780,13 +771,12 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
        SELECT_DRIVE(drive);
        SELECT_MASK(drive, 0);
        udelay(1);
-       if (IDE_CONTROL_REG)
-               hwif->OUTB(drive->ctl | 2, IDE_CONTROL_REG);
+       ide_set_irq(drive, 0);
        hwif->OUTB(speed, IDE_NSECTOR_REG);
        hwif->OUTB(SETFEATURES_XFER, IDE_FEATURE_REG);
        hwif->OUTBSYNC(drive, WIN_SETFEATURES, IDE_COMMAND_REG);
-       if ((IDE_CONTROL_REG) && (drive->quirk_list == 2))
-               hwif->OUTB(drive->ctl, IDE_CONTROL_REG);
+       if (drive->quirk_list == 2)
+               ide_set_irq(drive, 1);
 
        error = __ide_wait_stat(drive, drive->ready_stat,
                                BUSY_STAT|DRQ_STAT|ERR_STAT,
@@ -807,10 +797,11 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
 
  skip:
 #ifdef CONFIG_BLK_DEV_IDEDMA
-       if (speed >= XFER_SW_DMA_0)
-               hwif->dma_host_on(drive);
-       else if (hwif->ide_dma_on)      /* check if host supports DMA */
-               hwif->dma_off_quietly(drive);
+       if ((speed >= XFER_SW_DMA_0 || (hwif->host_flags & IDE_HFLAG_VDMA)) &&
+           drive->using_dma)
+               hwif->dma_host_set(drive, 1);
+       else if (hwif->dma_host_set)    /* check if host supports DMA */
+               ide_dma_off_quietly(drive);
 #endif
 
        switch(speed) {
@@ -1020,10 +1011,10 @@ static void check_dma_crc(ide_drive_t *drive)
 {
 #ifdef CONFIG_BLK_DEV_IDEDMA
        if (drive->crc_count) {
-               drive->hwif->dma_off_quietly(drive);
+               ide_dma_off_quietly(drive);
                ide_set_xfer_rate(drive, ide_auto_reduce_xfer(drive));
                if (drive->current_speed >= XFER_SW_DMA_0)
-                       (void) HWIF(drive)->ide_dma_on(drive);
+                       ide_dma_on(drive);
        } else
                ide_dma_off(drive);
 #endif