aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libata-scsi.c
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-10-05 17:09:16 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-10-05 17:09:16 -0400
commita939c9631527053aa38aa8795a6f7203c7f20b69 (patch)
treeef7aabee7439909153ef05f2651d8f456dd39ce1 /drivers/scsi/libata-scsi.c
parenta15dbeb4772626a015337dea06da67095aec3862 (diff)
libata: move atapi_request_sense() to libata-scsi module
No content changes, just moving code around.
Diffstat (limited to 'drivers/scsi/libata-scsi.c')
-rw-r--r--drivers/scsi/libata-scsi.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index 1a1ef3429e55..c58a7a19780f 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -1479,6 +1479,52 @@ void ata_scsi_badcmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), u8
1479 done(cmd); 1479 done(cmd);
1480} 1480}
1481 1481
1482void atapi_request_sense(struct ata_port *ap, struct ata_device *dev,
1483 struct scsi_cmnd *cmd)
1484{
1485 DECLARE_COMPLETION(wait);
1486 struct ata_queued_cmd *qc;
1487 unsigned long flags;
1488 int rc;
1489
1490 DPRINTK("ATAPI request sense\n");
1491
1492 qc = ata_qc_new_init(ap, dev);
1493 BUG_ON(qc == NULL);
1494
1495 /* FIXME: is this needed? */
1496 memset(cmd->sense_buffer, 0, sizeof(cmd->sense_buffer));
1497
1498 ata_sg_init_one(qc, cmd->sense_buffer, sizeof(cmd->sense_buffer));
1499 qc->dma_dir = DMA_FROM_DEVICE;
1500
1501 memset(&qc->cdb, 0, ap->cdb_len);
1502 qc->cdb[0] = REQUEST_SENSE;
1503 qc->cdb[4] = SCSI_SENSE_BUFFERSIZE;
1504
1505 qc->tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
1506 qc->tf.command = ATA_CMD_PACKET;
1507
1508 qc->tf.protocol = ATA_PROT_ATAPI;
1509 qc->tf.lbam = (8 * 1024) & 0xff;
1510 qc->tf.lbah = (8 * 1024) >> 8;
1511 qc->nbytes = SCSI_SENSE_BUFFERSIZE;
1512
1513 qc->waiting = &wait;
1514 qc->complete_fn = ata_qc_complete_noop;
1515
1516 spin_lock_irqsave(&ap->host_set->lock, flags);
1517 rc = ata_qc_issue(qc);
1518 spin_unlock_irqrestore(&ap->host_set->lock, flags);
1519
1520 if (rc)
1521 ata_port_disable(ap);
1522 else
1523 wait_for_completion(&wait);
1524
1525 DPRINTK("EXIT\n");
1526}
1527
1482static int atapi_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat) 1528static int atapi_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat)
1483{ 1529{
1484 struct scsi_cmnd *cmd = qc->scsicmd; 1530 struct scsi_cmnd *cmd = qc->scsicmd;