linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robert Annessi <robert@annessi.at>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: linux-scsi@vger.kernel.org
Subject: Re: dc395x: Report
Date: Mon, 14 Aug 2006 17:01:50 +0200	[thread overview]
Message-ID: <44E0905E.1000003@annessi.at> (raw)
In-Reply-To: <Pine.LNX.4.60.0608132129120.3508@poirot.grange>


[-- Attachment #1.1: Type: text/plain, Size: 2720 bytes --]

On 08/13/06 21:47, Guennadi Liakhovetski wrote:
> Emn, sorry, I have to ask - are you sure this is the correct output 
> (applied the patch, recompiled and reloaded the driver)? The output looks 
> EXACTLY the same as last time, and this is pretty strange. Well, there is 

Yes, I'm sure I applied the patch and used that kernel (freshly built,
no modules used).


> still one semi-logical explanation I can come up with:
> 
> at first FIFOCNT = 1 and SCSICNT = 0xfffffe, therefore d_left_counter = 
> 0xfffffe + (1 << 1) = 0x1000000. Then after one loop iteration 
> d_left_counter = 0xffffff, and now FIFOCNT = 0x40. So we break out of the 
> loop with the above funny value of d_left_counter. If this is the case, 
> well, I don't know what this value of SCSICNT means and what to do with 
> it (in the absence of a datasheet).
> 
> To verify this could you, please, replace the printk at line 2335 with 
> this one:
> 
> 					printk(KERN_WARNING "dc395x: inconsistent counters: "
> 					       "FIFOCNT %u, SCSICNT %u, left %u, %s\n", fc, sc, d_left_counter,
> 					       srb->dcb->sync_period & WIDE_SYNC ?
> 					       "wide" : "narrow");



Here is the relevant output of dmesg with 2.6.18-rc4 (and your patches):

dc395x: Tekram DC395(U/UW/F), DC315(U) - ASIC TRM-S1040 v2.05, 2004/03/08
PCI: setting IRQ 11 as level-triggered
PCI: Found IRQ 11 for device 0000:00:02.0
dc395x: Used settings: AdapterID=07, Speed=0(20.0MHz), dev_mode=0x37
dc395x:                AdaptMode=0x4e, Tags=0(01), DelayReset=1s
dc395x: (Wide) Connectors: int68  Termination: Auto Low High
dc395x: Performing initial SCSI bus reset
scsi0 : Tekram DC395(U/UW/F), DC315(U) - ASIC TRM-S1040 v2.05, 2004/03/08
dc395x: Target 00: Wide16 Sync: 48ns Offset 15 (41.7 MB/s)
  Vendor: SEAGATE   Model: ST3146807LC       Rev: 0007
  Type:   Direct-Access                      ANSI SCSI revision: 03
SCSI device sda: 286749488 512-byte hdwr sectors (146816 MB)
dc395x: inconsistent counters: FIFOCNT 64, SCSICNT 16777214, left
16777215, wide
sda: Write Protect is off
sda: Mode Sense: ab 00 10 08
dc395x: inconsistent counters: FIFOCNT 64, SCSICNT 16777214, left
16777215, wide
SCSI device sda: drive cache: write back w/ FUA
SCSI device sda: 286749488 512-byte hdwr sectors (146816 MB)
dc395x: inconsistent counters: FIFOCNT 64, SCSICNT 16777214, left
16777215, wide
sda: Write Protect is off
sda: Mode Sense: ab 00 10 08
dc395x: inconsistent counters: FIFOCNT 64, SCSICNT 16777214, left
16777215, wide
SCSI device sda: drive cache: write back w/ FUA
 sda: unknown partition table
sd 0:0:0:0: Attached scsi disk sda


Just to make sure I attached the patch I used.

Regards,
Robert

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: linux-2.6.18-rc4-dc395x.patch --]
[-- Type: text/x-patch; name="linux-2.6.18-rc4-dc395x.patch", Size: 2250 bytes --]

diff -urN linux-2.6.18-rc4.orig/drivers/scsi/dc395x.c linux-2.6.18-rc4-dc395x/drivers/scsi/dc395x.c
--- linux-2.6.18-rc4.orig/drivers/scsi/dc395x.c	2006-08-13 23:30:21.000000000 +0200
+++ linux-2.6.18-rc4-dc395x/drivers/scsi/dc395x.c	2006-08-13 23:34:05.000000000 +0200
@@ -78,7 +78,7 @@
  * Set to disable parts of the driver
  */
 /*#define DC395x_NO_DISCONNECT*/
-/*#define DC395x_NO_TAGQ*/
+#define DC395x_NO_TAGQ
 /*#define DC395x_NO_SYNC*/
 /*#define DC395x_NO_WIDE*/
 
@@ -2123,7 +2123,7 @@
 		 */
 		if (srb->total_xfer_length > DC395x_LASTPIO)
 			d_left_counter +=
-			    DC395x_read32(acb, TRM_S1040_SCSI_COUNTER);
+			    DC395x_read32(acb, TRM_S1040_SCSI_COUNTER) & ((1 << 24) - 1);
 
 		/* Is this a good idea? */
 		/*clear_fifo(acb, "DOP1"); */
@@ -2253,7 +2253,7 @@
 				DC395x_read8(acb, TRM_S1040_DMA_FIFOSTAT));
 		}
 		/* Now: Check remainig data: The SCSI counters should tell us ... */
-		sc = DC395x_read32(acb, TRM_S1040_SCSI_COUNTER);
+		sc = DC395x_read32(acb, TRM_S1040_SCSI_COUNTER) & ((1 << 24) - 1);
 		fc = DC395x_read8(acb, TRM_S1040_SCSI_FIFOCNT);
 		d_left_counter = sc + ((fc & 0x1f)
 		       << ((srb->dcb->sync_period & WIDE_SYNC) ? 1 :
@@ -2307,6 +2307,14 @@
 
 				while (len) {
 					u8 byte;
+
+					fc = DC395x_read8(acb, TRM_S1040_SCSI_FIFOCNT);
+
+					if (fc == 0x40) {
+						left_io = 0;
+						break;
+					}
+
 					byte = DC395x_read8(acb, TRM_S1040_SCSI_FIFO);
 					*virt++ = byte;
 
@@ -2317,16 +2325,16 @@
 					sg_subtract_one(srb);
 
 					len--;
-
-					fc = DC395x_read8(acb, TRM_S1040_SCSI_FIFOCNT);
-
-					if (fc == 0x40) {
-						left_io = 0;
-						break;
-					}
 				}
 
-				WARN_ON((fc != 0x40) == !d_left_counter);
+				if (((fc != 0x40) && !d_left_counter) ||
+				    ((fc == 0x40) && d_left_counter &&
+				     (!(srb->dcb->sync_period & WIDE_SYNC)
+				      || d_left_counter != 1)))
+					printk(KERN_WARNING "dc395x: inconsistent counters: "
+					       "FIFOCNT %u, SCSICNT %u, left %u, %s\n", fc, sc, d_left_counter,
+					       srb->dcb->sync_period & WIDE_SYNC ?
+					       "wide" : "narrow");
 
 				if (fc == 0x40 && (srb->dcb->sync_period & WIDE_SYNC)) {
 					/* Read the last byte ... */

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

  reply	other threads:[~2006-08-14 15:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-01 11:54 dc395x: Report Robert Annessi
2006-08-01 23:24 ` Guennadi Liakhovetski
2006-08-02  9:35   ` Robert Annessi
2006-08-02  9:51   ` Robert Annessi
2006-08-02 10:11     ` Guennadi Liakhovetski
2006-08-02 14:52       ` Robert Annessi
2006-08-02 22:07         ` Guennadi Liakhovetski
2006-08-02 23:24           ` Robert Annessi
2006-08-12 18:06             ` Guennadi Liakhovetski
2006-08-13 18:35               ` Robert Annessi
2006-08-13 19:47                 ` Guennadi Liakhovetski
2006-08-14 15:01                   ` Robert Annessi [this message]
2006-08-17 20:57                     ` Guennadi Liakhovetski

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=44E0905E.1000003@annessi.at \
    --to=robert@annessi.at \
    --cc=g.liakhovetski@gmx.de \
    --cc=linux-scsi@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).