include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[safe/jmp/linux-2.6] / drivers / ata / libata-scsi.c
index 340a616..0088cde 100644 (file)
@@ -33,6 +33,7 @@
  *
  */
 
+#include <linux/slab.h>
 #include <linux/kernel.h>
 #include <linux/blkdev.h>
 #include <linux/spinlock.h>
@@ -1097,7 +1098,7 @@ static int ata_scsi_dev_config(struct scsi_device *sdev,
                dev->flags |= ATA_DFLAG_NO_UNLOAD;
 
        /* configure max sectors */
-       blk_queue_max_sectors(sdev->request_queue, dev->max_sectors);
+       blk_queue_max_hw_sectors(sdev->request_queue, dev->max_sectors);
 
        if (dev->class == ATA_DEV_ATAPI) {
                struct request_queue *q = sdev->request_queue;
@@ -1208,6 +1209,7 @@ void ata_scsi_slave_destroy(struct scsi_device *sdev)
  *     ata_scsi_change_queue_depth - SCSI callback for queue depth config
  *     @sdev: SCSI device to configure queue depth for
  *     @queue_depth: new queue depth
+ *     @reason: calling context
  *
  *     This is libata standard hostt->change_queue_depth callback.
  *     SCSI will call into this callback when user tries to set queue
@@ -1219,12 +1221,16 @@ void ata_scsi_slave_destroy(struct scsi_device *sdev)
  *     RETURNS:
  *     Newly configured queue depth.
  */
-int ata_scsi_change_queue_depth(struct scsi_device *sdev, int queue_depth)
+int ata_scsi_change_queue_depth(struct scsi_device *sdev, int queue_depth,
+                               int reason)
 {
        struct ata_port *ap = ata_shost_to_port(sdev->host);
        struct ata_device *dev;
        unsigned long flags;
 
+       if (reason != SCSI_QDEPTH_DEFAULT)
+               return -EOPNOTSUPP;
+
        if (queue_depth < 1 || queue_depth == sdev->queue_depth)
                return sdev->queue_depth;
 
@@ -2115,8 +2121,10 @@ static unsigned int ata_scsiop_inq_b0(struct ata_scsi_args *args, u8 *rbuf)
         * that we support some form of unmap - in thise case via WRITE SAME
         * with the unmap bit set.
         */
-       if (ata_id_has_trim(args->id))
+       if (ata_id_has_trim(args->id)) {
+               put_unaligned_be32(65535 * 512 / 8, &rbuf[20]);
                put_unaligned_be32(1, &rbuf[28]);
+       }
 
        return 0;
 }
@@ -2411,8 +2419,12 @@ static unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf)
                rbuf[14] = (lowest_aligned >> 8) & 0x3f;
                rbuf[15] = lowest_aligned;
 
-               if (ata_id_has_trim(args->id))
-                       rbuf[14] |= 0x80;
+               if (ata_id_has_trim(args->id)) {
+                       rbuf[14] |= 0x80; /* TPE */
+
+                       if (ata_id_has_zero_after_trim(args->id))
+                               rbuf[14] |= 0x40; /* TPRZ */
+               }
        }
 
        return 0;
@@ -2864,7 +2876,7 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc)
         * write indication (used for PIO/DMA setup), result TF is
         * copied back and we don't whine too much about its failure.
         */
-       tf->flags = ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
+       tf->flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
        if (scmd->sc_data_direction == DMA_TO_DEVICE)
                tf->flags |= ATA_TFLAG_WRITE;
 
@@ -2966,7 +2978,7 @@ static unsigned int ata_scsi_write_same_xlat(struct ata_queued_cmd *qc)
                goto invalid_fld;
 
        buf = page_address(sg_page(scsi_sglist(scmd)));
-       size = ata_set_lba_range_entries(buf, 512 / 8, block, n_block);
+       size = ata_set_lba_range_entries(buf, 512, block, n_block);
 
        tf->protocol = ATA_PROT_DMA;
        tf->hob_feature = 0;
@@ -3011,7 +3023,7 @@ static inline ata_xlat_func_t ata_get_xlat_func(struct ata_device *dev, u8 cmd)
        case WRITE_16:
                return ata_scsi_rw_xlat;
 
-       case 0x93 /*WRITE_SAME_16*/:
+       case WRITE_SAME_16:
                return ata_scsi_write_same_xlat;
 
        case SYNCHRONIZE_CACHE: