Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Jan 2007 03:55:29 GMT
From:      Matt Jacob <mjacob@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 113190 for review
Message-ID:  <200701200355.l0K3tT3h081061@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=113190

Change 113190 by mjacob@mjexp on 2007/01/20 03:55:24

	Ah, fixed a stupidville bug: when we're looking for a new
	handle to allocate for an arriving device, don't pick one
	that's already in use (pending valid) as the firmware will
	be quite content to let you remap that handle to the new
	device. Then you trip over a bunch of other code which
	ends up nuking one device and putting the new device in
	*two* different positions in the virtual map. Gawd.

Affected files ...

.. //depot/projects/mjexp/sys/dev/isp/isp.c#9 edit

Differences ...

==== //depot/projects/mjexp/sys/dev/isp/isp.c#9 (text+ko) ====

@@ -3956,6 +3956,7 @@
 static uint16_t
 isp_nxt_handle(ispsoftc_t *isp, uint16_t handle)
 {
+	int i;
 	if (handle == NIL_HANDLE) {
 		if (FCPARAM(isp)->isp_topo == TOPO_F_PORT) {
 			handle = 0;
@@ -3982,9 +3983,16 @@
 	}
 	if (handle == FCPARAM(isp)->isp_loopid) {
 		return (isp_nxt_handle(isp, handle));
-	} else {
-		return (handle);
+	}
+	for (i = 0; i < MAX_FC_TARG; i++) {
+		if (FCPARAM(isp)->portdb[i].state == FC_PORTDB_STATE_NIL) {
+			continue;
+		}
+		if (FCPARAM(isp)->portdb[i].handle == handle) {
+			return (isp_nxt_handle(isp, handle));
+		}
 	}
+	return (handle);
 }
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200701200355.l0K3tT3h081061>