]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/ide/ide-disk.c
ide: remove ata_nsector_t, ata_data_t and atapi_bcount_t
[mirror_ubuntu-bionic-kernel.git] / drivers / ide / ide-disk.c
index b534fe97d47658649c34f49795dcd3f6973c6327..747dc602334676ca0cb9b9c2e1459a440a2e6386 100644 (file)
@@ -137,14 +137,12 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
 {
        ide_hwif_t *hwif        = HWIF(drive);
        unsigned int dma        = drive->using_dma;
+       u16 nsectors            = (u16)rq->nr_sectors;
        u8 lba48                = (drive->addressing == 1) ? 1 : 0;
        u8 command              = WIN_NOP;
-       ata_nsector_t           nsectors;
        ide_task_t              task;
        struct ide_taskfile     *tf = &task.tf;
 
-       nsectors.all            = (u16) rq->nr_sectors;
-
        if ((hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA) && lba48 && dma) {
                if (block + rq->nr_sectors > 1ULL << 28)
                        dma = 0;
@@ -159,20 +157,21 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
 
        memset(&task, 0, sizeof(task));
        task.tf_flags = IDE_TFLAG_NO_SELECT_MASK;  /* FIXME? */
+       task.tf_flags |= (IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE);
 
        if (drive->select.b.lba) {
                if (lba48) {
                        pr_debug("%s: LBA=0x%012llx\n", drive->name,
                                        (unsigned long long)block);
 
-                       tf->hob_nsect = nsectors.b.high;
+                       tf->hob_nsect = (nsectors >> 8) & 0xff;
                        tf->hob_lbal  = (u8)(block >> 24);
                        if (sizeof(block) != 4) {
                                tf->hob_lbam = (u8)((u64)block >> 32);
                                tf->hob_lbah = (u8)((u64)block >> 40);
                        }
 
-                       tf->nsect  = nsectors.b.low;
+                       tf->nsect  = nsectors & 0xff;
                        tf->lbal   = (u8) block;
                        tf->lbam   = (u8)(block >>  8);
                        tf->lbah   = (u8)(block >> 16);
@@ -182,9 +181,9 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
                                tf->hob_lbah, tf->hob_lbam, tf->hob_lbal,
                                tf->lbah, tf->lbam, tf->lbal);
 #endif
-                       task.tf_flags |= IDE_TFLAG_LBA48;
+                       task.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_OUT_HOB);
                } else {
-                       tf->nsect  = nsectors.b.low;
+                       tf->nsect  = nsectors & 0xff;
                        tf->lbal   = block;
                        tf->lbam   = block >>= 8;
                        tf->lbah   = block >>= 8;
@@ -199,7 +198,7 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
 
                pr_debug("%s: CHS=%u/%u/%u\n", drive->name, cyl, head, sect);
 
-               tf->nsect  = nsectors.b.low;
+               tf->nsect  = nsectors & 0xff;
                tf->lbal   = sect;
                tf->lbam   = cyl;
                tf->lbah   = cyl >> 8;
@@ -303,6 +302,9 @@ static u64 idedisk_read_native_max_address(ide_drive_t *drive, int lba48)
        else
                tf->command = WIN_READ_NATIVE_MAX;
        tf->device  = ATA_LBA;
+       args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE;
+       if (lba48)
+               args.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_OUT_HOB);
        /* submit command request */
        ide_no_data_taskfile(drive, &args);
 
@@ -348,6 +350,9 @@ static u64 idedisk_set_max_address(ide_drive_t *drive, u64 addr_req, int lba48)
                tf->command  = WIN_SET_MAX;
        }
        tf->device |= ATA_LBA;
+       args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE;
+       if (lba48)
+               args.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_OUT_HOB);
        /* submit command request */
        ide_no_data_taskfile(drive, &args);
        /* if OK, compute maximum address value */
@@ -496,6 +501,7 @@ static int smart_enable(ide_drive_t *drive)
        tf->lbam    = SMART_LCYL_PASS;
        tf->lbah    = SMART_HCYL_PASS;
        tf->command = WIN_SMART;
+       args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE;
        return ide_no_data_taskfile(drive, &args);
 }
 
@@ -510,6 +516,7 @@ static int get_smart_data(ide_drive_t *drive, u8 *buf, u8 sub_cmd)
        tf->lbam    = SMART_LCYL_PASS;
        tf->lbah    = SMART_HCYL_PASS;
        tf->command = WIN_SMART;
+       args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE;
        args.command_type                       = IDE_DRIVE_TASK_IN;
        args.data_phase                         = TASKFILE_IN;
        args.handler                            = &task_in_intr;
@@ -592,19 +599,21 @@ static ide_proc_entry_t idedisk_proc[] = {
 static void idedisk_prepare_flush(struct request_queue *q, struct request *rq)
 {
        ide_drive_t *drive = q->queuedata;
+       ide_task_t task;
 
-       memset(rq->cmd, 0, sizeof(rq->cmd));
-
+       memset(&task, 0, sizeof(task));
        if (ide_id_has_flush_cache_ext(drive->id) &&
            (drive->capacity64 >= (1UL << 28)))
-               rq->cmd[0] = WIN_FLUSH_CACHE_EXT;
+               task.tf.command = WIN_FLUSH_CACHE_EXT;
        else
-               rq->cmd[0] = WIN_FLUSH_CACHE;
-
+               task.tf.command = WIN_FLUSH_CACHE;
+       task.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE;
+       task.command_type = IDE_DRIVE_TASK_NO_DATA;
+       task.handler = task_no_data_intr;
 
-       rq->cmd_type = REQ_TYPE_ATA_TASK;
+       rq->cmd_type = REQ_TYPE_ATA_TASKFILE;
        rq->cmd_flags |= REQ_SOFTBARRIER;
-       rq->buffer = rq->cmd;
+       rq->special = &task;
 }
 
 /*
@@ -689,6 +698,7 @@ static int write_cache(ide_drive_t *drive, int arg)
                args.tf.feature = arg ?
                        SETFEATURES_EN_WCACHE : SETFEATURES_DIS_WCACHE;
                args.tf.command = WIN_SETFEATURES;
+               args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE;
                err = ide_no_data_taskfile(drive, &args);
                if (err == 0)
                        drive->wcache = arg;
@@ -708,6 +718,7 @@ static int do_idedisk_flushcache (ide_drive_t *drive)
                args.tf.command = WIN_FLUSH_CACHE_EXT;
        else
                args.tf.command = WIN_FLUSH_CACHE;
+       args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE;
        return ide_no_data_taskfile(drive, &args);
 }
 
@@ -722,6 +733,7 @@ static int set_acoustic (ide_drive_t *drive, int arg)
        args.tf.feature = arg ? SETFEATURES_EN_AAM : SETFEATURES_DIS_AAM;
        args.tf.nsect   = arg;
        args.tf.command = WIN_SETFEATURES;
+       args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE;
        ide_no_data_taskfile(drive, &args);
        drive->acoustic = arg;
        return 0;
@@ -984,6 +996,7 @@ static int idedisk_open(struct inode *inode, struct file *filp)
                ide_task_t args;
                memset(&args, 0, sizeof(ide_task_t));
                args.tf.command = WIN_DOORLOCK;
+               args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE;
                check_disk_change(inode->i_bdev);
                /*
                 * Ignore the return code from door_lock,
@@ -1009,6 +1022,7 @@ static int idedisk_release(struct inode *inode, struct file *filp)
                ide_task_t args;
                memset(&args, 0, sizeof(ide_task_t));
                args.tf.command = WIN_DOORUNLOCK;
+               args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE;
                if (drive->doorlocking && ide_no_data_taskfile(drive, &args))
                        drive->doorlocking = 0;
        }