]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ide/ide-io.c
Merge branch 'for-linus' of git://oss.sgi.com:8090/xfs/xfs-2.6
[linux-2.6-omap-h63xx.git] / drivers / ide / ide-io.c
index 9560a8f4a86c853832d45b71ff09ca55994367dd..32eaa3f8051592f4ecb132ccaa08fb8ced966d60 100644 (file)
 #include <linux/device.h>
 #include <linux/kmod.h>
 #include <linux/scatterlist.h>
+#include <linux/bitops.h>
 
 #include <asm/byteorder.h>
 #include <asm/irq.h>
 #include <asm/uaccess.h>
 #include <asm/io.h>
-#include <asm/bitops.h>
 
 static int __ide_end_request(ide_drive_t *drive, struct request *rq,
                             int uptodate, unsigned int nr_bytes)
@@ -219,11 +219,11 @@ static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *
 
        case ide_pm_restore_dma:        /* Resume step 3 (restore DMA) */
                /*
-                * Right now, all we do is call hwif->ide_dma_check(drive),
+                * Right now, all we do is call ide_set_dma(drive),
                 * we could be smarter and check for current xfer_speed
                 * in struct drive etc...
                 */
-               if (drive->hwif->ide_dma_check == NULL)
+               if (drive->hwif->ide_dma_on == NULL)
                        break;
                drive->hwif->dma_off_quietly(drive);
                /*
@@ -322,41 +322,6 @@ static void ide_complete_pm_request (ide_drive_t *drive, struct request *rq)
        spin_unlock_irqrestore(&ide_lock, flags);
 }
 
-/*
- * FIXME: probably move this somewhere else, name is bad too :)
- */
-u64 ide_get_error_location(ide_drive_t *drive, char *args)
-{
-       u32 high, low;
-       u8 hcyl, lcyl, sect;
-       u64 sector;
-
-       high = 0;
-       hcyl = args[5];
-       lcyl = args[4];
-       sect = args[3];
-
-       if (ide_id_has_flush_cache_ext(drive->id)) {
-               low = (hcyl << 16) | (lcyl << 8) | sect;
-               HWIF(drive)->OUTB(drive->ctl|0x80, IDE_CONTROL_REG);
-               high = ide_read_24(drive);
-       } else {
-               u8 cur = HWIF(drive)->INB(IDE_SELECT_REG);
-               if (cur & 0x40) {
-                       high = cur & 0xf;
-                       low = (hcyl << 16) | (lcyl << 8) | sect;
-               } else {
-                       low = hcyl * drive->head * drive->sect;
-                       low += lcyl * drive->sect;
-                       low += sect - 1;
-               }
-       }
-
-       sector = ((u64) high << 24) | low;
-       return sector;
-}
-EXPORT_SYMBOL(ide_get_error_location);
-
 /**
  *     ide_end_drive_cmd       -       end an explicit drive command
  *     @drive: command 
@@ -519,7 +484,8 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8
                }
        }
 
-       if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ && hwif->err_stops_fifo == 0)
+       if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ &&
+           (hwif->host_flags & IDE_HFLAG_ERROR_STOPS_FIFO) == 0)
                try_to_flush_leftover_data(drive);
 
        if (rq->errors >= ERROR_MAX || blk_noretry_request(rq)) {
@@ -836,9 +802,17 @@ static ide_startstop_t do_special (ide_drive_t *drive)
                if (set_pio_mode_abuse(drive->hwif, req_pio)) {
                        if (hwif->set_pio_mode)
                                hwif->set_pio_mode(drive, req_pio);
-               } else
+               } else {
+                       int keep_dma = drive->using_dma;
+
                        ide_set_pio(drive, req_pio);
 
+                       if (hwif->host_flags & IDE_HFLAG_SET_PIO_MODE_KEEP_DMA) {
+                               if (keep_dma)
+                                       hwif->ide_dma_on(drive);
+                       }
+               }
+
                return ide_stopped;
        } else {
                if (drive->media == ide_disk)
@@ -873,7 +847,8 @@ void ide_init_sg_cmd(ide_drive_t *drive, struct request *rq)
        ide_hwif_t *hwif = drive->hwif;
 
        hwif->nsect = hwif->nleft = rq->nr_sectors;
-       hwif->cursg = hwif->cursg_ofs = 0;
+       hwif->cursg_ofs = 0;
+       hwif->cursg = NULL;
 }
 
 EXPORT_SYMBOL_GPL(ide_init_sg_cmd);