Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Mar 2017 10:28:04 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r315536 - head/sys/dev/isp
Message-ID:  <201703191028.v2JAS4Oh064738@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;
 



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