All of lore.kernel.org
 help / color / mirror / Atom feed
* [libata] make ATAPI PIO work
@ 2004-10-18 21:29 Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; only message in thread
From: Bartlomiej Zolnierkiewicz @ 2004-10-18 21:29 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-ide

If "BSY=0, DRQ=0" condition happens on ATAPI just
complete the command as this condition happens for:
* the end of the PIO transfer (ie. REQUEST_SENSE
  seems to return only 18 of 96 requested bytes)
* unsupported ATAPI commands (ie. REPORT_LUNS)

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

diff -Nru a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
--- a/drivers/scsi/libata-core.c	2004-10-18 23:10:12 +02:00
+++ b/drivers/scsi/libata-core.c	2004-10-18 23:10:12 +02:00
@@ -2327,19 +2327,30 @@
 		}
 	}
 
-	/* handle BSY=0, DRQ=0 as error */
-	if ((status & ATA_DRQ) == 0) {
-		ap->pio_task_state = PIO_ST_ERR;
-		return;
-	}
-
 	qc = ata_qc_from_tag(ap, ap->active_tag);
 	assert(qc != NULL);
 
-	if (is_atapi_taskfile(&qc->tf))
+	if (is_atapi_taskfile(&qc->tf)) {
+		/* no more data to transfer or unsupported ATAPI command */
+		if ((status & ATA_DRQ) == 0) {
+			ap->pio_task_state = PIO_ST_IDLE;
+
+			ata_irq_on(ap);
+
+			ata_qc_complete(qc, status);
+			return;
+		}
+
 		atapi_pio_bytes(qc);
-	else
+	} else {
+		/* handle BSY=0, DRQ=0 as error */
+		if ((status & ATA_DRQ) == 0) {
+			ap->pio_task_state = PIO_ST_ERR;
+			return;
+		}
+
 		ata_pio_sector(qc);
+	}
 }
 
 static void ata_pio_error(struct ata_port *ap)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-10-18 21:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-18 21:29 [libata] make ATAPI PIO work Bartlomiej Zolnierkiewicz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.