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
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:
signature.asc
Description: OpenPGP digital signature