Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Mar 2017 16:15:18 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r316166 - stable/11/sys/dev/isp
Message-ID:  <201703291615.v2TGFIMB059570@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Wed Mar 29 16:15:18 2017
New Revision: 316166
URL: https://svnweb.freebsd.org/changeset/base/316166

Log:
  MFC r315536: Move <= 23xx PDB workaround to generic code.
  
  It is chip-specific and has nothing to do with platform.

Modified:
  stable/11/sys/dev/isp/isp_freebsd.c
  stable/11/sys/dev/isp/isp_target.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/isp/isp_freebsd.c
==============================================================================
--- stable/11/sys/dev/isp/isp_freebsd.c	Wed Mar 29 16:14:33 2017	(r316165)
+++ stable/11/sys/dev/isp/isp_freebsd.c	Wed Mar 29 16:15:18 2017	(r316166)
@@ -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: stable/11/sys/dev/isp/isp_target.c
==============================================================================
--- stable/11/sys/dev/isp/isp_target.c	Wed Mar 29 16:14:33 2017	(r316165)
+++ stable/11/sys/dev/isp/isp_target.c	Wed Mar 29 16:15:18 2017	(r316166)
@@ -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;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703291615.v2TGFIMB059570>