From owner-svn-src-all@freebsd.org Tue May 3 08:03:52 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9851CB291F2; Tue, 3 May 2016 08:03:52 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5758B116E; Tue, 3 May 2016 08:03:52 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4383pS3044884; Tue, 3 May 2016 08:03:51 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4383pG8044882; Tue, 3 May 2016 08:03:51 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201605030803.u4383pG8044882@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 3 May 2016 08:03:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r298969 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 May 2016 08:03:52 -0000 Author: mav Date: Tue May 3 08:03:51 2016 New Revision: 298969 URL: https://svnweb.freebsd.org/changeset/base/298969 Log: MFC r297912: Respect NVRAM topology settings on 24xx and above chips. Modified: stable/10/sys/dev/isp/isp.c stable/10/sys/dev/isp/ispvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp.c ============================================================================== --- stable/10/sys/dev/isp/isp.c Tue May 3 08:03:07 2016 (r298968) +++ stable/10/sys/dev/isp/isp.c Tue May 3 08:03:51 2016 (r298969) @@ -1822,22 +1822,24 @@ isp_fibre_init(ispsoftc_t *isp) * Prefer or force Point-To-Point instead Loop? */ switch (isp->isp_confopts & ISP_CFG_PORT_PREF) { - case ISP_CFG_NPORT: + case ISP_CFG_LPORT_ONLY: icbp->icb_xfwoptions &= ~ICBXOPT_TOPO_MASK; - icbp->icb_xfwoptions |= ICBXOPT_PTP_2_LOOP; + icbp->icb_xfwoptions |= ICBXOPT_LOOP_ONLY; break; case ISP_CFG_NPORT_ONLY: icbp->icb_xfwoptions &= ~ICBXOPT_TOPO_MASK; icbp->icb_xfwoptions |= ICBXOPT_PTP_ONLY; break; - case ISP_CFG_LPORT_ONLY: + case ISP_CFG_LPORT: icbp->icb_xfwoptions &= ~ICBXOPT_TOPO_MASK; - icbp->icb_xfwoptions |= ICBXOPT_LOOP_ONLY; + icbp->icb_xfwoptions |= ICBXOPT_LOOP_2_PTP; + break; + case ISP_CFG_NPORT: + icbp->icb_xfwoptions &= ~ICBXOPT_TOPO_MASK; + icbp->icb_xfwoptions |= ICBXOPT_PTP_2_LOOP; break; default: - /* - * Let NVRAM settings define it if they are sane - */ + /* Let NVRAM settings define it if they are sane */ switch (icbp->icb_xfwoptions & ICBXOPT_TOPO_MASK) { case ICBXOPT_PTP_2_LOOP: case ICBXOPT_PTP_ONLY: @@ -2109,19 +2111,32 @@ isp_fibre_init_2400(ispsoftc_t *isp) } switch (isp->isp_confopts & ISP_CFG_PORT_PREF) { - case ISP_CFG_NPORT_ONLY: - icbp->icb_fwoptions2 &= ~ICB2400_OPT2_TOPO_MASK; - icbp->icb_fwoptions2 |= ICB2400_OPT2_PTP_ONLY; - break; case ISP_CFG_LPORT_ONLY: icbp->icb_fwoptions2 &= ~ICB2400_OPT2_TOPO_MASK; icbp->icb_fwoptions2 |= ICB2400_OPT2_LOOP_ONLY; break; - default: + case ISP_CFG_NPORT_ONLY: + icbp->icb_fwoptions2 &= ~ICB2400_OPT2_TOPO_MASK; + icbp->icb_fwoptions2 |= ICB2400_OPT2_PTP_ONLY; + break; + case ISP_CFG_NPORT: /* ISP_CFG_PTP_2_LOOP not available in 24XX/25XX */ + case ISP_CFG_LPORT: icbp->icb_fwoptions2 &= ~ICB2400_OPT2_TOPO_MASK; icbp->icb_fwoptions2 |= ICB2400_OPT2_LOOP_2_PTP; break; + default: + /* Let NVRAM settings define it if they are sane */ + switch (icbp->icb_fwoptions2 & ICB2400_OPT2_TOPO_MASK) { + case ICB2400_OPT2_LOOP_ONLY: + case ICB2400_OPT2_PTP_ONLY: + case ICB2400_OPT2_LOOP_2_PTP: + break; + default: + icbp->icb_fwoptions2 &= ~ICB2400_OPT2_TOPO_MASK; + icbp->icb_fwoptions2 |= ICB2400_OPT2_LOOP_2_PTP; + } + break; } switch (icbp->icb_fwoptions2 & ICB2400_OPT2_TIMER_MASK) { @@ -7807,23 +7822,23 @@ isp_setdfltfcparm(ispsoftc_t *isp, int c if (IS_24XX(isp)) { fcp->isp_fwoptions |= ICB2400_OPT1_FAIRNESS; fcp->isp_fwoptions |= ICB2400_OPT1_HARD_ADDRESS; - if (isp->isp_confopts & ISP_CFG_FULL_DUPLEX) { + if (isp->isp_confopts & ISP_CFG_FULL_DUPLEX) fcp->isp_fwoptions |= ICB2400_OPT1_FULL_DUPLEX; - } fcp->isp_fwoptions |= ICB2400_OPT1_BOTH_WWNS; + fcp->isp_xfwoptions |= ICB2400_OPT2_LOOP_2_PTP; fcp->isp_zfwoptions |= ICB2400_OPT3_RATE_AUTO; } else { fcp->isp_fwoptions |= ICBOPT_FAIRNESS; fcp->isp_fwoptions |= ICBOPT_PDBCHANGE_AE; fcp->isp_fwoptions |= ICBOPT_HARD_ADDRESS; - if (isp->isp_confopts & ISP_CFG_FULL_DUPLEX) { + if (isp->isp_confopts & ISP_CFG_FULL_DUPLEX) fcp->isp_fwoptions |= ICBOPT_FULL_DUPLEX; - } /* * Make sure this is turned off now until we get * extended options from NVRAM */ fcp->isp_fwoptions &= ~ICBOPT_EXTENDED; + fcp->isp_xfwoptions |= ICBXOPT_LOOP_2_PTP; fcp->isp_zfwoptions |= ICBZOPT_RATE_AUTO; } Modified: stable/10/sys/dev/isp/ispvar.h ============================================================================== --- stable/10/sys/dev/isp/ispvar.h Tue May 3 08:03:07 2016 (r298968) +++ stable/10/sys/dev/isp/ispvar.h Tue May 3 08:03:51 2016 (r298969) @@ -645,11 +645,12 @@ struct ispsoftc { * ISP Runtime Configuration Options */ #define ISP_CFG_FULL_DUPLEX 0x01 /* Full Duplex (Fibre Channel only) */ -#define ISP_CFG_PORT_PREF 0x0c /* Mask for Port Prefs (all FC except 2100) */ -#define ISP_CFG_LPORT 0x00 /* prefer {N/F}L-Port connection */ -#define ISP_CFG_NPORT 0x04 /* prefer {N/F}-Port connection */ -#define ISP_CFG_NPORT_ONLY 0x08 /* insist on {N/F}-Port connection */ -#define ISP_CFG_LPORT_ONLY 0x0c /* insist on {N/F}L-Port connection */ +#define ISP_CFG_PORT_PREF 0x0e /* Mask for Port Prefs (all FC except 2100) */ +#define ISP_CFG_PORT_DEF 0x00 /* prefer connection type from NVRAM */ +#define ISP_CFG_LPORT_ONLY 0x02 /* insist on {N/F}L-Port connection */ +#define ISP_CFG_NPORT_ONLY 0x04 /* insist on {N/F}-Port connection */ +#define ISP_CFG_LPORT 0x06 /* prefer {N/F}L-Port connection */ +#define ISP_CFG_NPORT 0x08 /* prefer {N/F}-Port connection */ #define ISP_CFG_1GB 0x10 /* force 1GB connection (23XX only) */ #define ISP_CFG_2GB 0x20 /* force 2GB connection (23XX only) */ #define ISP_CFG_NORELOAD 0x80 /* don't download f/w */