mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ide-scsi driver starts DMA too soon
@ 2002-11-01 23:39 Khalid Aziz
  2002-11-02  1:13 ` Alan Cox
  0 siblings, 1 reply; 3+ messages in thread
From: Khalid Aziz @ 2002-11-01 23:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: marcelo, andre

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.

Marcelo, please apply.

--
Khalid

====================================================================
Khalid Aziz                                Linux and Open Source Lab
(970)898-9214                                        Hewlett-Packard
khalid@hp.com                                       Fort Collins, CO


-----------CUT HERE-------------CUT HERE-------------CUT HERE-----------
--- linux-2.4.19/drivers/scsi/ide-scsi.c	Fri Aug  2 18:39:44 2002
+++ linux-2.4.19.cd_dma/drivers/scsi/ide-scsi.c	Fri Nov  1 16:31:30 2002
@@ -397,6 +397,8 @@
 	idescsi_pc_t *pc = scsi->pc;
 	byte ireason;
 	ide_startstop_t startstop;
+	struct request *rq = pc->rq;
+	int dma_ok = 0;
 
 	if (ide_wait_stat (&startstop,drive,DRQ_STAT,BUSY_STAT,WAIT_READY)) {
 		printk (KERN_ERR "ide-scsi: Strange, packet command initiated yet DRQ isn't asserted\n");
@@ -407,8 +409,14 @@
 		printk (KERN_ERR "ide-scsi: (IO,CoD) != (0,1) while issuing a packet command\n");
 		return ide_do_reset (drive);
 	}
+	if (drive->using_dma && rq->bh)
+		dma_ok=!HWIF(drive)->dmaproc(test_bit (PC_WRITING, &pc->flags) ? ide_dma_write : ide_dma_read, drive);
 	ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), NULL);	/* Set the interrupt routine */
 	atapi_output_bytes (drive, scsi->pc->c, 12);			/* Send the actual packet */
+	if (dma_ok) {
+		set_bit (PC_DMA_IN_PROGRESS, &pc->flags);
+		(void) (HWIF(drive)->dmaproc(ide_dma_begin, drive));
+	}
 	return ide_started;
 }
 
@@ -437,10 +445,6 @@
 	OUT_BYTE (bcount >> 8,IDE_BCOUNTH_REG);
 	OUT_BYTE (bcount & 0xff,IDE_BCOUNTL_REG);
 
-	if (dma_ok) {
-		set_bit (PC_DMA_IN_PROGRESS, &pc->flags);
-		(void) (HWIF(drive)->dmaproc(ide_dma_begin, drive));
-	}
 	if (test_bit (IDESCSI_DRQ_INTERRUPT, &scsi->flags)) {
 		ide_set_handler (drive, &idescsi_transfer_pc, get_timeout(pc), NULL);
 		OUT_BYTE (WIN_PACKETCMD, IDE_COMMAND_REG);		/* Issue the packet command */

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ide-scsi driver starts DMA too soon
  2002-11-01 23:39 [PATCH] ide-scsi driver starts DMA too soon Khalid Aziz
@ 2002-11-02  1:13 ` Alan Cox
  2002-11-06 12:27   ` Marcelo Tosatti
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Cox @ 2002-11-02  1:13 UTC (permalink / raw)
  To: Khalid Aziz; +Cc: Linux Kernel Mailing List, Marcelo Tosatti, Andre Hedrick

On Fri, 2002-11-01 at 23:39, Khalid Aziz wrote:
> 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.
> 
> Marcelo, please apply.

Marcelo this is in 2.5, and 2.4-ac. Khalid is certainly correct although
making such a change in -rc rather than a pre does mean it wants extra
thought


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ide-scsi driver starts DMA too soon
  2002-11-02  1:13 ` Alan Cox
@ 2002-11-06 12:27   ` Marcelo Tosatti
  0 siblings, 0 replies; 3+ messages in thread
From: Marcelo Tosatti @ 2002-11-06 12:27 UTC (permalink / raw)
  To: Alan Cox; +Cc: Khalid Aziz, Linux Kernel Mailing List, Andre Hedrick



On 2 Nov 2002, Alan Cox wrote:

> On Fri, 2002-11-01 at 23:39, Khalid Aziz wrote:
> > 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.
> >
> > Marcelo, please apply.
>
> Marcelo this is in 2.5, and 2.4-ac. Khalid is certainly correct although
> making such a change in -rc rather than a pre does mean it wants extra
> thought

I prefer being safe and saving this one for 2.4.21-pre.

Thanks Khalid!


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-11-06 15:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-01 23:39 [PATCH] ide-scsi driver starts DMA too soon Khalid Aziz
2002-11-02  1:13 ` Alan Cox
2002-11-06 12:27   ` Marcelo Tosatti

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®