From owner-p4-projects@FreeBSD.ORG Fri Feb 23 21:54:43 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 05C0316A405; Fri, 23 Feb 2007 21:54:43 +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 998EC16A401 for ; Fri, 23 Feb 2007 21:54:42 +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 8827813C46B for ; Fri, 23 Feb 2007 21:54:42 +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 l1NLsgFE014453 for ; Fri, 23 Feb 2007 21:54:42 GMT (envelope-from mjacob@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id l1NLsgjw014450 for perforce@freebsd.org; Fri, 23 Feb 2007 21:54:42 GMT (envelope-from mjacob@freebsd.org) Date: Fri, 23 Feb 2007 21:54:42 GMT Message-Id: <200702232154.l1NLsgjw014450@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 114912 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: Fri, 23 Feb 2007 21:54:43 -0000 http://perforce.freebsd.org/chv.cgi?CH=114912 Change 114912 by mjacob@mjexp on 2007/02/23 21:54:39 Don't attempt to load illegal hard loop addresses into an ICB. This shows up on card restarts, and usually for 2200-2300 cards. What happens is that we start up, attempting to acquire a hard address. We end up instead being an F-port topology, which reports out a loop id of 0xff (or 0xffff for 2K Login f/w). Then, if we restart, we end up telling the card to go off an acquire this loop address, which the card then rejects. Bah. Compilation fixes from Solaris port. Affected files ... .. //depot/projects/mjexp/sys/dev/isp/isp.c#13 edit Differences ... ==== //depot/projects/mjexp/sys/dev/isp/isp.c#13 (text+ko) ==== @@ -1555,6 +1555,7 @@ fcparam *fcp; isp_icb_t local, *icbp = &local; mbreg_t mbs; + int ownloopid; uint64_t nwwn, pwwn; fcp = isp->isp_param; @@ -1630,25 +1631,17 @@ icbp->icb_retry_delay = fcp->isp_retry_delay; icbp->icb_retry_count = fcp->isp_retry_count; icbp->icb_hardaddr = fcp->isp_loopid; + ownloopid = (isp->isp_confopts & ISP_CFG_OWNLOOPID) != 0; if (icbp->icb_hardaddr > 125) { - /* - * We end up with these Loop IDs for F-Port topologies - */ - if (icbp->icb_hardaddr != 0xff && - icbp->icb_hardaddr != 0x800 && - icbp->icb_hardaddr != 0xffff) { - isp_prt(isp, ISP_LOGERR, - "bad hard address %u- resetting to zero", - icbp->icb_hardaddr); - icbp->icb_hardaddr = 0; - } + icbp->icb_hardaddr = 0; + ownloopid = 0; } /* * Our life seems so much better with 2200s and later with * the latest f/w if we set Hard Address. */ - if (ISP_FW_NEWER_THAN(isp, 2, 2, 5)) { + if (ownloopid || ISP_FW_NEWER_THAN(isp, 2, 2, 5)) { icbp->icb_fwoptions |= ICBOPT_HARD_ADDRESS; } @@ -1800,6 +1793,7 @@ isp_mboxcmd(isp, &mbs); FC_SCRATCH_RELEASE(isp); if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { + isp_print_bytes(isp, "isp_fibre_init", sizeof (*icbp), icbp); return; } isp->isp_reqidx = 0; @@ -1818,6 +1812,7 @@ fcparam *fcp; isp_icb_2400_t local, *icbp = &local; mbreg_t mbs; + int ownloopid; uint64_t nwwn, pwwn; fcp = isp->isp_param; @@ -1886,21 +1881,12 @@ icbp->icb_fwoptions1 = fcp->isp_fwoptions; icbp->icb_hardaddr = fcp->isp_loopid; + ownloopid = (isp->isp_confopts & ISP_CFG_OWNLOOPID) != 0; if (icbp->icb_hardaddr > 125) { - /* - * We end up with these Loop IDs for F-Port topologies - */ - if (icbp->icb_hardaddr != 0xff && - icbp->icb_hardaddr != 0x800 && - icbp->icb_hardaddr != 0xffff) { - isp_prt(isp, ISP_LOGERR, - "bad hard address %u- resetting to zero", - icbp->icb_hardaddr); - icbp->icb_hardaddr = 0; - } + icbp->icb_hardaddr = 0; + ownloopid = 0; } - - if (isp->isp_confopts & ISP_CFG_OWNLOOPID) { + if (ownloopid) { icbp->icb_fwoptions1 |= ICB2400_OPT1_HARD_ADDRESS; } @@ -2280,7 +2266,6 @@ "isp_plogi_old: portid 0x%06x already logged in as %u", portid, mbs.param[1]); return (MBOX_PORT_ID_USED | (mbs.param[1] << 16)); - break; case MBOX_LOOP_ID_USED: isp_prt(isp, ISP_LOGDEBUG0, @@ -2963,19 +2948,17 @@ /* * Check to make sure it's still a valid entry. The 24XX seems * to return a portid but not a WWPN/WWNN or role for devices - * which shift on a loop, or have a WWPN/WWNN but no portid. + * which shift on a loop. */ if (tmp.node_wwn == 0 || tmp.port_wwn == 0 || tmp.portid == 0) { - if (isp->isp_dblev & ISP_LOGSANCFG) { - int a, b, c; - a = !(tmp.node_wwn == 0); - b = !(tmp.port_wwn == 0); - c = !(tmp.portid == 0); - isp_prt(isp, ISP_LOGALL, - "bad pdb (%1d%1d%1d) @ handle 0x%x", - a, b, c, handle); - isp_dump_portdb(isp); - } + int a, b, c; + a = (tmp.node_wwn == 0); + b = (tmp.port_wwn == 0); + c = (tmp.portid == 0); + isp_prt(isp, ISP_LOGWARN, + "bad pdb (%1d%1d%1d) @ handle 0x%x", a, b, c, + handle); + isp_dump_portdb(isp); continue; } @@ -4576,7 +4559,6 @@ if ((IS_FC(isp) && mbox != ASYNC_RIO_RESP) || isp->isp_state != ISP_RUNSTATE) { goto out; - return; } } @@ -7523,11 +7505,11 @@ for (loops = 0; loops < 5000; loops++) { USEC_DELAY(10); tmp = ISP_READ(isp, BIU2400_FLASH_ADDR); - if ((tmp & (1 << 31)) != 0) { + if ((tmp & (1U << 31)) != 0) { break; } } - if (tmp & (1 << 31)) { + if (tmp & (1U << 31)) { tmp = ISP_READ(isp, BIU2400_FLASH_DATA); *rp = tmp; } else {