Subject: Re: kern/21893: division by zero in scsipi_sync_factor_to_freq(): one more quirk in scsiconf.c ?
To: Anthony Mallet <anthony.mallet@useless-ficus.net>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: netbsd-bugs
Date: 06/16/2003 00:23:16
--YZ5djTAD1cGYuMQK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Sun, Jun 15, 2003 at 11:58:13PM +0200, Anthony Mallet wrote:
> Manuel Bouyer writes:
> | OK, the ahc driver changed on 2003/04/19.
> | Can you try the attached patch ?
> 
> This doesn't change anything. Actually, it looks like the function
> ahc_send_async() is never called: I added many printf around and none
> ever printed anything.
> 
> bt in ddb tells me that the function which is called is ahc_action(),
> which in turn calls scsipi_async_event() on line 402.
> Hope this helps...

Yes, it does. Now I think I understand what's happening.
Please try the attached patch

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

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

Index: aic7xxx_osm.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/aic7xxx_osm.c,v
retrieving revision 1.8
diff -u -r1.8 aic7xxx_osm.c
--- aic7xxx_osm.c	2003/05/01 23:00:20	1.8
+++ aic7xxx_osm.c	2003/06/15 22:22:35
@@ -398,8 +398,20 @@
 		 * so that it can print a message.
 		 */
 		if (!ahc_update_neg_request(ahc, &devinfo, tstate,
-		    tinfo, AHC_NEG_IF_NON_ASYNC) && first)
+		    tinfo, AHC_NEG_IF_NON_ASYNC) && first) {
+			xm->xm_mode = 0;
+			xm->xm_period = tinfo->curr.period;
+			xm->xm_offset = tinfo->curr.offset;
+			if (tinfo->curr.width == MSG_EXT_WDTR_BUS_16_BIT)
+				xm->xm_mode |= PERIPH_CAP_WIDE16;
+			if (tinfo->curr.period)
+				xm->xm_mode |= PERIPH_CAP_SYNC;
+			if (tstate->tagenable & devinfo.target_mask)
+				xm->xm_mode |= PERIPH_CAP_TQING;
+			if (tinfo->curr.ppr_options & MSG_EXT_PPR_DT_REQ)
+				xm->xm_mode |= PERIPH_CAP_DT;
 			scsipi_async_event(chan, ASYNC_EVENT_XFER_MODE, xm);
+		}
 		splx(s);
 	    }
 	}

--YZ5djTAD1cGYuMQK--