From owner-svn-src-head@freebsd.org Sun Mar 19 10:28:06 2017 Return-Path: Delivered-To: svn-src-head@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 03E6AD12011; Sun, 19 Mar 2017 10:28:06 +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 AF65BD8E; Sun, 19 Mar 2017 10:28:05 +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 v2JAS4dT064740; Sun, 19 Mar 2017 10:28:04 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2JAS4Oh064738; Sun, 19 Mar 2017 10:28:04 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201703191028.v2JAS4Oh064738@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 19 Mar 2017 10:28:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r315536 - head/sys/dev/isp X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Mar 2017 10:28:06 -0000 Author: mav Date: Sun Mar 19 10:28:04 2017 New Revision: 315536 URL: https://svnweb.freebsd.org/changeset/base/315536 Log: Move <= 23xx PDB workaround to generic code. It is chip-specific and has nothing to do with platform. MFC after: 2 weeks Modified: head/sys/dev/isp/isp_freebsd.c head/sys/dev/isp/isp_target.c Modified: head/sys/dev/isp/isp_freebsd.c ============================================================================== --- head/sys/dev/isp/isp_freebsd.c Sun Mar 19 10:26:00 2017 (r315535) +++ head/sys/dev/isp/isp_freebsd.c Sun Mar 19 10:28:04 2017 (r315536) @@ -1743,22 +1743,15 @@ isp_handle_platform_atio2(ispsoftc_t *is if (IS_2100(isp)) atiop->init_id = nphdl; else { - if ((isp_find_pdb_by_handle(isp, 0, nphdl, &lp) == 0 || - lp->state == FC_PORTDB_STATE_ZOMBIE)) { - uint64_t wwpn = - (((uint64_t) aep->at_wwpn[0]) << 48) | - (((uint64_t) aep->at_wwpn[1]) << 32) | - (((uint64_t) aep->at_wwpn[2]) << 16) | - (((uint64_t) aep->at_wwpn[3]) << 0); - isp_add_wwn_entry(isp, 0, wwpn, INI_NONE, - nphdl, PORT_ANY, 0); - if (fcp->isp_loopstate > LOOP_LTEST_DONE) - fcp->isp_loopstate = LOOP_LTEST_DONE; - isp_async(isp, ISPASYNC_CHANGE_NOTIFY, 0, - ISPASYNC_CHANGE_PDB, nphdl, 0x06, 0xff); - isp_find_pdb_by_handle(isp, 0, nphdl, &lp); + if (isp_find_pdb_by_handle(isp, 0, nphdl, &lp)) { + atiop->init_id = FC_PORTDB_TGT(isp, 0, lp); + } else { + isp_prt(isp, ISP_LOGTINFO, "%s: port %x isn't in PDB", + __func__, nphdl); + isp_dump_portdb(isp, 0); + isp_endcmd(isp, aep, NIL_HANDLE, 0, ECMD_TERMINATE, 0); + return; } - atiop->init_id = FC_PORTDB_TGT(isp, 0, lp); } atiop->cdb_len = ATIO2_CDBLEN; ISP_MEMCPY(atiop->cdb_io.cdb_bytes, aep->at_cdb, ATIO2_CDBLEN); Modified: head/sys/dev/isp/isp_target.c ============================================================================== --- head/sys/dev/isp/isp_target.c Sun Mar 19 10:26:00 2017 (r315535) +++ head/sys/dev/isp/isp_target.c Sun Mar 19 10:28:04 2017 (r315536) @@ -919,6 +919,7 @@ isp_handle_abts(ispsoftc_t *isp, abts_t static void isp_handle_atio2(ispsoftc_t *isp, at2_entry_t *aep) { + fcportdb_t *lp; int lun, iid; if (ISP_CAP_SCCFW(isp)) { @@ -975,9 +976,26 @@ isp_handle_atio2(ispsoftc_t *isp, at2_en break; case AT_CDB: /* Got a CDB */ - /* - * Punt to platform specific layer. - */ + + /* Make sure we have this inititor in port database. */ + if (!IS_2100(isp) && + (isp_find_pdb_by_handle(isp, 0, iid, &lp) == 0 || + lp->state == FC_PORTDB_STATE_ZOMBIE)) { + fcparam *fcp = FCPARAM(isp, 0); + uint64_t wwpn = + (((uint64_t) aep->at_wwpn[0]) << 48) | + (((uint64_t) aep->at_wwpn[1]) << 32) | + (((uint64_t) aep->at_wwpn[2]) << 16) | + (((uint64_t) aep->at_wwpn[3]) << 0); + isp_add_wwn_entry(isp, 0, wwpn, INI_NONE, + iid, PORT_ANY, 0); + if (fcp->isp_loopstate > LOOP_LTEST_DONE) + fcp->isp_loopstate = LOOP_LTEST_DONE; + isp_async(isp, ISPASYNC_CHANGE_NOTIFY, 0, + ISPASYNC_CHANGE_PDB, iid, 0x06, 0xff); + } + + /* Punt to platform specific layer. */ isp_async(isp, ISPASYNC_TARGET_ACTION, aep); break;