From owner-p4-projects@FreeBSD.ORG Sat Jan 20 03:55:30 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 069CF16A408; Sat, 20 Jan 2007 03:55:30 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D53A016A402 for ; Sat, 20 Jan 2007 03:55:29 +0000 (UTC) (envelope-from mjacob@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id C5EB013C45A for ; Sat, 20 Jan 2007 03:55:29 +0000 (UTC) (envelope-from mjacob@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id l0K3tT4T081064 for ; Sat, 20 Jan 2007 03:55:29 GMT (envelope-from mjacob@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id l0K3tT3h081061 for perforce@freebsd.org; Sat, 20 Jan 2007 03:55:29 GMT (envelope-from mjacob@freebsd.org) Date: Sat, 20 Jan 2007 03:55:29 GMT Message-Id: <200701200355.l0K3tT3h081061@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to mjacob@freebsd.org using -f From: Matt Jacob To: Perforce Change Reviews Cc: Subject: PERFORCE change 113190 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Jan 2007 03:55:30 -0000 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); } /*