Subject: Re: scsi disk generic HBA error after reboot
To: Dan LaBell <dan4l-nospam@verizon.net>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: netbsd-help
Date: 04/15/2005 18:44:37
--wRRV7LY7NUeQGEoC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Fri, Apr 15, 2005 at 04:24:34AM -0400, Dan LaBell wrote:
> I posted about this before with the subject trm0: parity error in 2.0 
> after reboot.
> 
> I have 2 scsi drives that I plan to combine with ccd.  These drives are 
> ibm ultrastar 18xp's , they're 80pin, and I'm using 2 80->50pin 
> converters to use with with my
> Tekram DC395, I had no problems with in 1.6, but with 2.0 I find it 
> works OK on initial power up, but gives me generic HBA error, and 
> "trm0: parity error"  on subsequent boots.
> I now have both drives installed  (I was waiting on a railkit --they're 
> too tall to fit in my 3-1/2in bays. ), and started to playing with 
> jumper settings hoping maybe I could stumble on something that worked.  
> Besides finding combo's where it wouldn't work at all
> in 2.0 (instead of just 2nd boot ) I noticed some differences in dmesg 
> output, less
> drive info on first boot, on 2nd boot more info, "sync (50.00ns offset 
> 15), 16-bit (40.000MB/s) transfers"   I don't know that much about 
> scsi, some explaination about
> what is the sync line means might help -- I'd like to be able to jumper 
> my way around this and there are 2 jumpers related to sync, SP sync and 
> Dis Ti Sy.
> Also, can 50 pin do 16bit transfer?

No, and thay is probably your problem. For some reason, after a warm boot
the driver thinks the adapter is a Ultra-wide, and negotiate 16bit
transfers with the drive. This won't work accros a 50pin cable, a only 
8 of the 16 data pins are wired.


OK, I see the problem. The driver is ignoring the card's model or eeprom
setting for negotiating sync/wide, because the checks are not at the proper
place.
Please try the (untested) attached patch.

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--

--wRRV7LY7NUeQGEoC
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff

Index: trm.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/trm.c,v
retrieving revision 1.18
diff -u -r1.18 trm.c
--- trm.c	27 Feb 2005 00:27:34 -0000	1.18
+++ trm.c	15 Apr 2005 16:43:43 -0000
@@ -586,11 +586,6 @@
 		ti->config0 = tconf->config0;
 		ti->period = trm_clock_period[tconf->period & 0x07];
 		ti->flag = 0;
-		if ((ti->config0 & NTC_DO_WIDE_NEGO) != 0 &&
-		    (sc->sc_config & HCC_WIDE_CARD) != 0)
-			ti->flag |= WIDE_NEGO_ENABLE;
-		if ((ti->config0 & NTC_DO_SYNC_NEGO) != 0)
-			ti->flag |= SYNC_NEGO_ENABLE;
 		if ((ti->config0 & NTC_DO_DISCONNECT) != 0) {
 #ifdef notyet
 			if ((ti->config0 & NTC_DO_TAG_QUEUING) != 0)
@@ -799,12 +794,15 @@
 #endif
 				ti->flag &= ~USE_TAG_QUEUING;
 
-			if ((xm->xm_mode & PERIPH_CAP_WIDE16) != 0) {
+			if ((xm->xm_mode & PERIPH_CAP_WIDE16) != 0 && 
+			    (sc->sc_config & HCC_WIDE_CARD) != 0 && 
+			    (ti->config0 & NTC_DO_WIDE_NEGO) != 0) {
 				ti->flag |= WIDE_NEGO_ENABLE;
 				ti->flag &= ~WIDE_NEGO_DONE;
 			}
 
-			if ((xm->xm_mode & PERIPH_CAP_SYNC) != 0) {
+			if ((xm->xm_mode & PERIPH_CAP_SYNC) != 0 &&
+			    (ti->config0 & NTC_DO_SYNC_NEGO) != 0) {
 				ti->flag |= SYNC_NEGO_ENABLE;
 				ti->flag &= ~SYNC_NEGO_DONE;
 				ti->period = trm_clock_period[0];

--wRRV7LY7NUeQGEoC--