From owner-svn-src-stable@freebsd.org Mon Nov 30 21:47:12 2015 Return-Path: Delivered-To: svn-src-stable@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 70A85A3D8D0; Mon, 30 Nov 2015 21:47:12 +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 2E45D18C9; Mon, 30 Nov 2015 21:47:12 +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 tAULlBjj074115; Mon, 30 Nov 2015 21:47:11 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tAULlBVg074114; Mon, 30 Nov 2015 21:47:11 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201511302147.tAULlBVg074114@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 30 Nov 2015 21:47:11 +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: r291523 - 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-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2015 21:47:12 -0000 Author: mav Date: Mon Nov 30 21:47:11 2015 New Revision: 291523 URL: https://svnweb.freebsd.org/changeset/base/291523 Log: MFC r291163: Explicitly call SEND CHANGE REQUEST for pre-24xx chips in target mode. While later firmware always registers for RSCN requests, older one does it only in initiator mode. But in target mode there RSCN can be the only way to detect gone intiator. Modified: stable/10/sys/dev/isp/isp.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp.c ============================================================================== --- stable/10/sys/dev/isp/isp.c Mon Nov 30 21:46:21 2015 (r291522) +++ stable/10/sys/dev/isp/isp.c Mon Nov 30 21:47:11 2015 (r291523) @@ -122,6 +122,7 @@ static int isp_gid_ft_sns(ispsoftc_t *, static int isp_gid_ft_ct_passthru(ispsoftc_t *, int); static int isp_scan_fabric(ispsoftc_t *, int); static int isp_login_device(ispsoftc_t *, int, uint32_t, isp_pdb_t *, uint16_t *); +static int isp_send_change_request(ispsoftc_t *, int); static int isp_register_fc4_type(ispsoftc_t *, int); static int isp_register_fc4_type_24xx(ispsoftc_t *, int); static int isp_register_fc4_features_24xx(ispsoftc_t *, int); @@ -2904,6 +2905,8 @@ isp_fclink_test(ispsoftc_t *isp, int cha } else { fcp->isp_sns_hdl = SNS_ID; r = isp_register_fc4_type(isp, chan); + if (r == 0 && fcp->role == ISP_ROLE_TARGET) + isp_send_change_request(isp, chan); } if (r) { isp_prt(isp, ISP_LOGWARN|ISP_LOG_SANCFG, "%s: register fc4 type failed", __func__); @@ -3733,6 +3736,18 @@ isp_login_device(ispsoftc_t *isp, int ch } static int +isp_send_change_request(ispsoftc_t *isp, int chan) +{ + mbreg_t mbs; + + MBSINIT(&mbs, MBOX_SEND_CHANGE_REQUEST, MBLOGALL, 500000); + mbs.param[1] = 0x03; + mbs.param[9] = chan; + isp_mboxcmd(isp, &mbs); + return (mbs.param[0] == MBOX_COMMAND_COMPLETE ? 0 : -1); +} + +static int isp_register_fc4_type(ispsoftc_t *isp, int chan) { fcparam *fcp = FCPARAM(isp, chan); @@ -5815,8 +5830,8 @@ isp_parse_async_fc(ispsoftc_t *isp, uint fcp = FCPARAM(isp, chan); if (fcp->role == ISP_ROLE_NONE) break; - if (fcp->isp_loopstate > LOOP_LSCAN_DONE) - fcp->isp_loopstate = LOOP_LSCAN_DONE; + if (fcp->isp_loopstate > LOOP_LTEST_DONE) + fcp->isp_loopstate = LOOP_LTEST_DONE; isp_async(isp, ISPASYNC_CHANGE_NOTIFY, chan, ISPASYNC_CHANGE_SNS, portid); break; @@ -6912,7 +6927,7 @@ static const uint32_t mbpfc[] = { ISP_FC_OPMAP(0x00, 0x00), /* 0x6d: */ ISP_FC_OPMAP(0xcf, 0x03), /* 0x6e: MBOX_SEND_SNS */ ISP_FC_OPMAP(0x0f, 0x07), /* 0x6f: MBOX_FABRIC_LOGIN */ - ISP_FC_OPMAP(0x03, 0x01), /* 0x70: MBOX_SEND_CHANGE_REQUEST */ + ISP_FC_OPMAP_HALF(0x02, 0x03, 0x00, 0x03), /* 0x70: MBOX_SEND_CHANGE_REQUEST */ ISP_FC_OPMAP(0x03, 0x03), /* 0x71: MBOX_FABRIC_LOGOUT */ ISP_FC_OPMAP(0x0f, 0x0f), /* 0x72: MBOX_INIT_LIP_LOGIN */ ISP_FC_OPMAP(0x00, 0x00), /* 0x73: */