libata passthru: support PIO multi commands
authorAlbert Lee <albertcc@tw.ibm.com>
Thu, 7 Jun 2007 07:49:22 +0000 (15:49 +0800)
committerJeff Garzik <jeff@garzik.org>
Sun, 10 Jun 2007 03:08:11 +0000 (23:08 -0400)
  support the pass through of PIO multi commands.

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/ata/libata-scsi.c
include/linux/ata.h

index f70431a4c9e902924babdbdfbb07763473fb398c..8a66ca5f9530a815c30712c2de28fbfe31942d51 100644 (file)
@@ -2551,10 +2551,6 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc)
        if (tf->protocol == ATA_PROT_DMA && dev->dma_mode == 0)
                goto invalid_fld;
 
-       if (cdb[1] & 0xe0)
-               /* PIO multi not supported yet */
-               goto invalid_fld;
-
        /*
         * 12 and 16 byte CDBs use different offsets to
         * provide the various register values.
@@ -2606,6 +2602,22 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc)
                tf->device = qc->dev->devno ?
                        tf->device | ATA_DEV1 : tf->device & ~ATA_DEV1;
 
+       /* sanity check for pio multi commands */
+       if ((cdb[1] & 0xe0) && !is_multi_taskfile(tf))
+               goto invalid_fld;
+
+       if (is_multi_taskfile(tf)) {
+               unsigned int multi_count = 1 << (cdb[1] >> 5);
+
+               /* compare the passed through multi_count
+                * with the cached multi_count of libata
+                */
+               if (multi_count != dev->multi_count)
+                       ata_dev_printk(dev, KERN_WARNING,
+                                      "invalid multi_count %u ignored\n",
+                                      multi_count);
+       }       
+
        /* READ/WRITE LONG use a non-standard sect_size */
        qc->sect_size = ATA_SECT_SIZE;
        switch (tf->command) {
index edb31bfff68fb3586097173f5dc61b7b215333ab..3e95e5c402d4c6dd815ce87653e088e99ad6cf75 100644 (file)
@@ -249,7 +249,7 @@ enum ata_tf_protocols {
        /* ATA taskfile protocols */
        ATA_PROT_UNKNOWN,       /* unknown/invalid */
        ATA_PROT_NODATA,        /* no data */
-       ATA_PROT_PIO,           /* PIO single sector */
+       ATA_PROT_PIO,           /* PIO data xfer */
        ATA_PROT_DMA,           /* DMA */
        ATA_PROT_NCQ,           /* NCQ */
        ATA_PROT_ATAPI,         /* packet command, PIO data xfer*/