mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: davej@codemonkey.org.uk
To: torvalds@transmeta.com
Cc: axboe@suse.de, alan@redhat.com, linux-kernel@vger.kernel.org
Subject: Avoid ide-scsi from starting DMA too soon
Date: Thu, 15 May 2003 04:31:01 +0100	[thread overview]
Message-ID: <200305150331.h4F3V1Pv000529@deviant.impure.org.uk> (raw)

This went into 2.4 with the following comments..

ide-scsi driver starts DMA as soon as it writes the ATAPI PACKET command
in command register and before sending the ATAPI command. This will
cause problems on many drives. Right way to do it is to start DMA after
sending the ATAPI command. I am attaching a patch that fixes this. This
patch will allow many more CD-RW drives to work reliably in DMA mode
than do today

Alan's comment to this diff previously..
"Thats the least of the 2.5 ide-scsi problems, but yes its probably one to add"

--- bk-linus/drivers/scsi/ide-scsi.c	2003-04-10 06:01:23.000000000 +0100
+++ linux-2.5/drivers/scsi/ide-scsi.c	2003-05-15 03:55:52.000000000 +0100
@@ -78,6 +78,7 @@ typedef struct idescsi_pc_s {
 #define PC_DMA_IN_PROGRESS		0	/* 1 while DMA in progress */
 #define PC_WRITING			1	/* Data direction */
 #define PC_TRANSFORM			2	/* transform SCSI commands */
+#define PC_DMA_OK			4	/* Use DMA */
 
 /*
  *	SCSI command transformation layer
@@ -494,6 +495,10 @@ static ide_startstop_t idescsi_transfer_
 	ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), NULL);
 	/* Send the actual packet */
 	atapi_output_bytes(drive, scsi->pc->c, 12);
+	if (test_bit (PC_DMA_OK, &pc->flags)) {
+		set_bit (PC_DMA_IN_PROGRESS, &pc->flags);
+		(void) (HWIF(drive)->ide_dma_begin(drive));
+	}
 	return ide_started;
 }
 
@@ -527,10 +532,9 @@ static ide_startstop_t idescsi_issue_pc 
 	HWIF(drive)->OUTB(bcount.b.high, IDE_BCOUNTH_REG);
 	HWIF(drive)->OUTB(bcount.b.low, IDE_BCOUNTL_REG);
 
-	if (feature.b.dma) {
-		set_bit(PC_DMA_IN_PROGRESS, &pc->flags);
-		(void) (HWIF(drive)->ide_dma_begin(drive));
-	}
+	if (feature.b.dma)
+		set_bit(PC_DMA_OK, &pc->flags);
+
 	if (test_bit(IDESCSI_DRQ_INTERRUPT, &scsi->flags)) {
 		if (HWGROUP(drive)->handler != NULL)
 			BUG();

                 reply	other threads:[~2003-05-15  3:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200305150331.h4F3V1Pv000529@deviant.impure.org.uk \
    --to=davej@codemonkey.org.uk \
    --cc=alan@redhat.com \
    --cc=axboe@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®