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/15/2003 22:41:09
--rwEMma7ioTxnRzrJ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Sun, Jun 15, 2003 at 10:18:23PM +0200, Anthony Mallet wrote:
> Manuel Bouyer writes:
> | No, it's not. The problem seems to be that async is not handled properly
> | any more.
> 
> Weird because with the patch I can either play audio CD or mount iso9660
> partitions.

Yes, because it tells the adapter to not even try to negociate sync for this
device. The problem here seems to be that the adapter claims the device is
sync after negotiation, even for async devices.

> I also have a scanner which works in async mode (but that's
> on another controller).

which suggests the problem is in the HBA driver and not the mid-layer code.

> 
> | As far as I can see, nothing changed in the scsipi code that could explain
> | this. The problem may be in the HBA code.
> 
> I saw something in scsiconf.c, rev. 1.202:
> 
> -               if (periph->periph_version >= 3) { /* SPC-2 */
> +               /* SPC-2 */
> +               if (periph->periph_version >= 3 &&
> +                   !(quirks & PQUIRK_CAP_NODT)){
> 
> But that might not be relevant.

it's not, it changes behavior only for devices with the PQUIRK_CAP_NODT
quirk, which isn't the case for your CD.

> 
> | Can you post the boot message for your scsi controller ?
> 
> You mean the dmesg? That's an Adaptec 2940.
> 
> ahc0 at pci0 dev 10 function 0
> ahc0: interrupting at irq 12
> ahc0: aic7880: Ultra Wide Channel A, SCSI Id=7, 16/253 SCBs

OK, the ahc driver changed on 2003/04/19.
Can you try the attached patch ?

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

--rwEMma7ioTxnRzrJ
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 20:40:12
@@ -1038,7 +1038,8 @@
 			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)
+		if (tinfo->curr.ppr_options & MSG_EXT_PPR_DT_REQ &&
+		    tinfo->curr.period)
 			xm.xm_mode |= PERIPH_CAP_DT;
 		scsipi_async_event(chan, ASYNC_EVENT_XFER_MODE, &xm);
 		break;

--rwEMma7ioTxnRzrJ--