Commit 50035625 authored by Jeff Garzik's avatar Jeff Garzik

[libata] pio/dma flag bug fix, and cleanup

In the transfer-mode cleanup recently, the code that set flag
ATA_DFLAG_PIO disappeared.  Resurrect it.

Remove ATA_QCFLAG_DMA, it isn't needed.

Always set polling in the ->qc_issue function, rather than force
the user to do it when setting up an ata_queued_cmd.  This gives
maximum flexibility to the driver, letting the driver choose
whether or not to poll.
parent 0c558ca1
......@@ -1280,6 +1280,9 @@ static void ata_dev_set_mode(struct ata_port *ap, struct ata_device *dev)
if (!ata_dev_present(dev) || (ap->flags & ATA_FLAG_PORT_DISABLED))
return;
if (dev->xfer_shift == ATA_SHIFT_PIO)
dev->flags |= ATA_DFLAG_PIO;
ata_dev_set_xfermode(ap, dev);
base = base_from_shift(dev->xfer_shift);
......@@ -2333,8 +2336,6 @@ struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap,
ata_tf_init(ap, &qc->tf, dev->devno);
if (likely((dev->flags & ATA_DFLAG_PIO) == 0))
qc->flags |= ATA_QCFLAG_DMA;
if (dev->flags & ATA_DFLAG_LBA48)
qc->tf.flags |= ATA_TFLAG_LBA48;
}
......@@ -2473,6 +2474,7 @@ int ata_qc_issue_prot(struct ata_queued_cmd *qc)
break;
case ATA_PROT_ATAPI:
ata_qc_set_polling(qc);
ata_tf_to_host_nolock(ap, &qc->tf);
queue_work(ata_wq, &ap->packet_task);
break;
......
......@@ -979,6 +979,8 @@ void ata_scsi_badcmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), u8
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);
qc->tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
if (cmd->sc_data_direction == SCSI_DATA_WRITE) {
......@@ -992,14 +994,13 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc, u8 *scsicmd)
if (cmd->sc_data_direction == SCSI_DATA_NONE)
qc->tf.protocol = ATA_PROT_ATAPI;
/* PIO data xfer - polling */
else if ((qc->flags & ATA_QCFLAG_DMA) == 0) {
ata_qc_set_polling(qc);
/* PIO data xfer */
else if (using_pio) {
qc->tf.protocol = ATA_PROT_ATAPI;
qc->tf.lbam = (8 * 1024) & 0xff;
qc->tf.lbah = (8 * 1024) >> 8;
/* DMA data xfer - interrupt-driven */
/* DMA data xfer */
} else {
qc->tf.protocol = ATA_PROT_ATAPI_DMA;
qc->tf.feature |= ATAPI_PKT_DMA;
......
......@@ -110,7 +110,6 @@ enum {
ATA_FLAG_SATA_RESET = (1 << 7), /* use COMRESET */
ATA_QCFLAG_ACTIVE = (1 << 1), /* cmd not yet ack'd to scsi lyer */
ATA_QCFLAG_DMA = (1 << 2), /* data delivered via DMA */
ATA_QCFLAG_SG = (1 << 3), /* have s/g table? */
ATA_QCFLAG_SINGLE = (1 << 4), /* no s/g, just a single buffer */
ATA_QCFLAG_DMAMAP = ATA_QCFLAG_SG | ATA_QCFLAG_SINGLE,
......@@ -481,7 +480,6 @@ static inline u8 ata_wait_idle(struct ata_port *ap)
static inline void ata_qc_set_polling(struct ata_queued_cmd *qc)
{
qc->flags &= ~ATA_QCFLAG_DMA;
qc->tf.ctl |= ATA_NIEN;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment