Author: mav
Date: Wed Mar 29 16:15:52 2017
New Revision: 316167
URL: https://svnweb.freebsd.org/changeset/base/316167

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

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

Modified: stable/10/sys/dev/isp/isp_freebsd.c
==============================================================================
--- stable/10/sys/dev/isp/isp_freebsd.c Wed Mar 29 16:15:18 2017        
(r316166)
+++ stable/10/sys/dev/isp/isp_freebsd.c Wed Mar 29 16:15:52 2017        
(r316167)
@@ -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/10/sys/dev/isp/isp_target.c
==============================================================================
--- stable/10/sys/dev/isp/isp_target.c  Wed Mar 29 16:15:18 2017        
(r316166)
+++ stable/10/sys/dev/isp/isp_target.c  Wed Mar 29 16:15:52 2017        
(r316167)
@@ -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;
 
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to