Subject: Re: SCSI drivers in install kernel
To: None <emre@module.vsrc.uab.edu>
From: Andrew Doran <ad@netbsd.org>
List: netbsd-users
Date: 04/01/2001 14:56:50
emre@module.vsrc.uab.edu wrote:

> mlx0 at pci0 dev 15 function 1: Mylex RAID (v4 interface)
> mlx0: interrupting at irq 11
> mlx0: DAC960PTL1, 1 channel, firmware 4.06-<-48, 8MB RAM
> ld0 at mlx0 unit 0: RAID5, online
> ld0: 34732 MB, 4427 cyl, 255 head, 63 sec, 512 bytes/sect x 71131136 sectors
> ld1 at mlx0 unit 2: RAID0, state unknown
> ld1: disabled
> ld2 at mlx0 unit 3: RAID0, state unknown
> ld2: disabled

[...]

That's certianly not right. Can you try the following, and post what it
spews?

Index: sys/dev/ic/mlx.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/ic/mlx.c,v
retrieving revision 1.5
diff -u -r1.5 sys/dev/ic/mlx.c
--- sys/dev/ic/mlx.c	2001/03/07 23:07:15	1.5
+++ sys/dev/ic/mlx.c	2001/04/01 14:54:48
@@ -402,8 +402,8 @@
 		}
 		mlx->mlx_enq2->me_firmware_id[0] = meo->me_fwmajor;
 		mlx->mlx_enq2->me_firmware_id[1] = meo->me_fwminor;
-		mlx->mlx_enq2->me_firmware_id[2] = '0';
-		mlx->mlx_enq2->me_firmware_id[3] = 0;
+		mlx->mlx_enq2->me_firmware_id[2] = 0;
+		mlx->mlx_enq2->me_firmware_id[3] = '0';
 		free(meo, M_DEVBUF);
 	}
 
@@ -514,7 +514,7 @@
 	    mlx->mlx_dv.dv_xname, model, me->me_actual_channels,
 	    me->me_actual_channels > 1 ? "s" : "",
 	    me->me_firmware_id[0], me->me_firmware_id[1],
-	    me->me_firmware_id[2], me->me_firmware_id[3],
+	    me->me_firmware_id[3], me->me_firmware_id[2],
 	    le32toh(me->me_mem_size) >> 20);
 }
 
@@ -524,12 +524,20 @@
 static void
 mlx_configure(struct mlx_softc *mlx, int waitok)
 {
+	struct mlx_enquiry *me;
 	struct mlx_enq_sys_drive *mes;
 	struct mlx_sysdrive *ms;
 	struct mlx_attach_args mlxa;
 	int i, nunits;
 	u_int size;
 
+	me = mlx_enquire(mlx, MLX_CMD_ENQUIRY, sizeof(struct mlx_enquiry),
+	    NULL, waitok);
+	if (me == NULL) {
+		printf("%s: ENQUIRY failed\n", mlx->mlx_dv.dv_xname);
+		return;
+	}
+
 	mes = mlx_enquire(mlx, MLX_CMD_ENQSYSDRIVE,
 	    sizeof(*mes) * MLX_MAX_DRIVES, NULL, waitok);
 	if (mes == NULL) {
@@ -538,17 +546,12 @@
 		return;
 	}
 
-	for (i = 0, nunits = 0; i < MLX_MAX_DRIVES; i++)
-		if (mes[i].sd_size != 0xffffffffU && mes[i].sd_size != 0)
-			nunits++;
-	if (nunits == 0)
-		nunits = 1;
-
 	/* Allow 1 queued command per unit while re-configuring. */
 	mlx_adjqparam(mlx, 1, 0);
 
 	ms = &mlx->mlx_sysdrive[0];
-	for (i = 0; i < MLX_MAX_DRIVES; i++, ms++) {
+	nunits = 0;
+	for (i = 0; i < me->me_num_sys_drvs; i++, ms++) {
 		size = le32toh(mes[i].sd_size);
 
 		/*
@@ -573,11 +576,15 @@
 		mlxa.mlxa_unit = i;
 		ms->ms_dv = config_found_sm(&mlx->mlx_dv, &mlxa, mlx_print,
 		    mlx_submatch);
+		nunits += (ms->ms_dv != NULL);
 	}
 
 	free(mes, M_DEVBUF);
-	mlx_adjqparam(mlx, mlx->mlx_max_queuecnt / nunits,
-	    mlx->mlx_max_queuecnt % nunits);
+	free(me, M_DEVBUF);
+
+	if (nunits != 0)
+		mlx_adjqparam(mlx, mlx->mlx_max_queuecnt / nunits,
+		    mlx->mlx_max_queuecnt % nunits);
 }
 
 /*