Re: Error using DC315U to drive ScanJet 4c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Fredrik

Thanks for your help so far, and, please, don't give up - I know it's, 
probably, much easier for you to just through away the damn thing (dc315) 
and get something modern, but - what about the fun?:-)

On Thu, 16 Feb 2006, Fredrik Roubert wrote:

> On Wed 15 Feb 23:33 CET 2006, Guennadi Liakhovetski wrote:

...

> > Could you, please, remove / comment out these 2 lines and try again?
> 
> OK, this is the log from loading the new module until the second failed
> scan:

Looks like all those lengths / counters are somewhat less consistent than 
what I'd hoped for. Please, try the patch below on the top of your 
current version - it MUST trigger. With the vanilla 2.6.15 the first 
"reselect w/o disconnect" message, after each boot / insmod dc395x, was 
_always_ accompanied by requests to contact linux-scsi, right?

Thanks
Guennadi
---
Guennadi Liakhovetski

diff -u a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
--- a/drivers/scsi/dc395x.c	14 Feb 2006 06:25:54 -0000	1.1.1.9.4.2
+++ b/drivers/scsi/dc395x.c	16 Feb 2006 20:18:05 -0000
@@ -2269,7 +2269,7 @@
 	 * seem to be a bad idea, actually.
 	 */
 	if (!(srb->state & SRB_XFERPAD)) {
-		unsigned int d_left_counter;
+		unsigned int d_left_counter, sc, fc;
 		if (scsi_status & PARITYERROR) {
 			dprintkl(KERN_INFO, "data_in_phase0: (pid#%li) "
 				"Parity Error\n", srb->cmd->pid);
@@ -2306,18 +2306,18 @@
 				DC395x_read8(acb, TRM_S1040_DMA_FIFOSTAT));
 		}
 		/* Now: Check remainig data: The SCSI counters should tell us ... */
-		d_left_counter = DC395x_read32(acb, TRM_S1040_SCSI_COUNTER)
-		    + ((DC395x_read8(acb, TRM_S1040_SCSI_FIFOCNT) & 0x1f)
-		       << ((srb->dcb->sync_period & WIDE_SYNC) ? 1 :
-			   0));
+		sc = DC395x_read32(acb, TRM_S1040_SCSI_COUNTER);
+		fc = DC395x_read8(acb, TRM_S1040_SCSI_FIFOCNT);
+		d_left_counter = sc + ((fc & 0x1f) <<
+				       ((srb->dcb->sync_period & WIDE_SYNC) ? 1 : 0));
 		dprintkdbg(DBG_KG, "data_in_phase0: "
 			"SCSI{fifocnt=0x%02x%s ctr=0x%08x} "
 			"DMA{fifocnt=0x%02x fifostat=0x%02x ctr=0x%08x} "
 			"Remain{totxfer=%i scsi_fifo+ctr=%i}\n",
-			DC395x_read8(acb, TRM_S1040_SCSI_FIFOCNT),
+			fc,
 			(srb->dcb->sync_period & WIDE_SYNC) ? "words" : "bytes",
 			DC395x_read32(acb, TRM_S1040_SCSI_COUNTER),
-			DC395x_read8(acb, TRM_S1040_DMA_FIFOCNT),
+			fc,
 			DC395x_read8(acb, TRM_S1040_DMA_FIFOSTAT),
 			DC395x_read32(acb, TRM_S1040_DMA_CXCNT),
 			srb->total_xfer_length, d_left_counter);
@@ -2331,7 +2331,7 @@
 			/*sg_update_list (srb, d_left_counter); */
 			dprintkdbg(DBG_PIO, "data_in_phase0: PIO (%i %s) "
 				"for remaining %i bytes:",
-				DC395x_read8(acb, TRM_S1040_SCSI_FIFOCNT) & 0x1f,
+				fc & 0x1f,
 				(srb->dcb->sync_period & WIDE_SYNC) ?
 				    "words" : "bytes",
 				srb->total_xfer_length);
@@ -2339,6 +2339,9 @@
 				DC395x_write8(acb, TRM_S1040_SCSI_CONFIG2,
 					      CFG2_WIDEFIFO);
 
+			printk(KERN_INFO "%s[%d]: %u, %u, %u, %u, %x, %d\n", __FILE__, __LINE__,
+			       left_io, d_left_counter, sc, fc, srb->dcb->sync_period & WIDE_SYNC, srb->cmd->use_sg);
+
 			while (left_io) {
 				unsigned char *virt, *base = NULL;
 				unsigned long flags = 0;
@@ -2566,6 +2569,9 @@
 				DC395x_write8(acb, TRM_S1040_SCSI_CONFIG2,
 				     CFG2_WIDEFIFO);
 
+			printk(KERN_INFO "%s[%d]: %u, %x, %d\n", __FILE__, __LINE__,
+			       left_io, srb->dcb->sync_period & WIDE_SYNC, srb->cmd->use_sg);
+
 			while (left_io) {
 				unsigned char *virt, *base = NULL;
 				unsigned long flags = 0;
-
: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux