vserver 2.0 rc7
[linux-2.6.git] / drivers / scsi / libata-scsi.c
index 7f59ef6..7a4adc4 100644 (file)
@@ -305,7 +305,7 @@ void ata_to_sense_error(struct ata_queued_cmd *qc, u8 drv_stat)
        sb[0] = 0x70;
        sb[2] = MEDIUM_ERROR;
        sb[7] = 0x0A;
-       if (cmd->sc_data_direction == SCSI_DATA_READ) {
+       if (cmd->sc_data_direction == DMA_FROM_DEVICE) {
                sb[12] = 0x11; /* "unrecovered read error" */
                sb[13] = 0x04;
        } else {
@@ -347,7 +347,10 @@ int ata_scsi_slave_config(struct scsi_device *sdev)
                 */
                if ((dev->flags & ATA_DFLAG_LBA48) &&
                    ((dev->flags & ATA_DFLAG_LOCK_SECTORS) == 0)) {
-                       sdev->host->max_sectors = 2048;
+                       /*
+                        * do not overwrite sdev->host->max_sectors, since
+                        * other drives on this host may not support LBA48
+                        */
                        blk_queue_max_sectors(sdev->request_queue, 2048);
                }
        }
@@ -671,8 +674,8 @@ static void ata_scsi_translate(struct ata_port *ap, struct ata_device *dev,
                return;
 
        /* data is present; dma-map it */
-       if (cmd->sc_data_direction == SCSI_DATA_READ ||
-           cmd->sc_data_direction == SCSI_DATA_WRITE) {
+       if (cmd->sc_data_direction == DMA_FROM_DEVICE ||
+           cmd->sc_data_direction == DMA_TO_DEVICE) {
                if (unlikely(cmd->request_bufflen < 1)) {
                        printk(KERN_WARNING "ata%u(%u): WARNING: zero len r/w req\n",
                               ap->id, dev->devno);
@@ -944,7 +947,7 @@ unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf,
 }
 
 /**
- *     ata_scsiop_noop -
+ *     ata_scsiop_noop - Command handler that simply returns success.
  *     @args: device IDENTIFY data / SCSI command of interest.
  *     @rbuf: Response buffer, to which simulated SCSI cmd output is sent.
  *     @buflen: Response buffer length.
@@ -1038,7 +1041,12 @@ static unsigned int ata_msense_caching(u16 *id, u8 **ptr_io,
 
 static unsigned int ata_msense_ctl_mode(u8 **ptr_io, const u8 *last)
 {
-       const u8 page[] = {0xa, 0xa, 2, 0, 0, 0, 0, 0, 0xff, 0xff, 0, 30};
+       const u8 page[] = {0xa, 0xa, 6, 0, 0, 0, 0, 0, 0xff, 0xff, 0, 30};
+
+       /* byte 2: set the descriptor format sense data bit (bit 2)
+        * since we need to support returning this format for SAT
+        * commands and any SCSI commands against a 48b LBA device.
+        */
 
        ata_msense_push(ptr_io, last, page, sizeof(page));
        return sizeof(page);
@@ -1299,7 +1307,7 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc, u8 *scsicmd)
        struct scsi_cmnd *cmd = qc->scsicmd;
        struct ata_device *dev = qc->dev;
        int using_pio = (dev->flags & ATA_DFLAG_PIO);
-       int nodata = (cmd->sc_data_direction == SCSI_DATA_NONE);
+       int nodata = (cmd->sc_data_direction == DMA_NONE);
 
        if (!using_pio)
                /* Check whether ATAPI DMA is safe */
@@ -1311,7 +1319,7 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc, u8 *scsicmd)
        qc->complete_fn = atapi_qc_complete;
 
        qc->tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
-       if (cmd->sc_data_direction == SCSI_DATA_WRITE) {
+       if (cmd->sc_data_direction == DMA_TO_DEVICE) {
                qc->tf.flags |= ATA_TFLAG_WRITE;
                DPRINTK("direction: write\n");
        }
@@ -1335,7 +1343,7 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc, u8 *scsicmd)
 
 #ifdef ATAPI_ENABLE_DMADIR
                /* some SATA bridges need us to indicate data xfer direction */
-               if (cmd->sc_data_direction != SCSI_DATA_WRITE)
+               if (cmd->sc_data_direction != DMA_TO_DEVICE)
                        qc->tf.feature |= ATAPI_DMADIR;
 #endif
        }