Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Bump default login time to 60 seconds. Move the s...



details:   https://anonhg.NetBSD.org/src/rev/378dd6c2e6b1
branches:  trunk
changeset: 480181:378dd6c2e6b1
user:      mjacob <mjacob%NetBSD.org@localhost>
date:      Thu Jan 06 03:02:11 2000 +0000

description:
Bump default login time to 60 seconds. Move the spot at
which we claim we've seen the loop up at least once so
that we don't hang forever coming up. Add in the basics
for MI target mode stuff. Force the outer layers to deal
with a FCP response coming back that has a CHECK CONDITION
but no sense data.

diffstat:

 sys/dev/ic/isp.c |  90 ++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 65 insertions(+), 25 deletions(-)

diffs (268 lines):

diff -r 90d15d8d5be6 -r 378dd6c2e6b1 sys/dev/ic/isp.c
--- a/sys/dev/ic/isp.c  Thu Jan 06 03:00:11 2000 +0000
+++ b/sys/dev/ic/isp.c  Thu Jan 06 03:02:11 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: isp.c,v 1.45 1999/12/20 00:39:16 mjacob Exp $ */
+/* $NetBSD: isp.c,v 1.46 2000/01/06 03:02:11 mjacob Exp $ */
 /*
  * Copyright (C) 1997, 1998, 1999 National Aeronautics & Space Administration
  * All rights reserved.
@@ -1007,7 +1007,6 @@
 #else
        fcp->isp_fwoptions = 0;
 #endif
-
        fcp->isp_fwoptions |= ICBOPT_FAIRNESS;
        /*
         * If this is a 2100 < revision 5, we have to turn off FAIRNESS.
@@ -1059,7 +1058,7 @@
        icbp->icb_retry_delay = fcp->isp_retry_delay;
        icbp->icb_retry_count = fcp->isp_retry_count;
        icbp->icb_hardaddr = loopid;
-       icbp->icb_logintime = 30;       /* 30 second login timeout */
+       icbp->icb_logintime = 60;       /* 60 second login timeout */
 
        if (fcp->isp_nodewwn) {
                u_int64_t pn;
@@ -1332,7 +1331,6 @@
        CFGPRINTF("%s: Loop ID %d, ALPA 0x%x Loop State 0x%x topology %s\n",
            isp->isp_name, fcp->isp_loopid, fcp->isp_alpa, fcp->isp_loopstate,
            tname);
-       fcp->loop_seen_once = 1;
        return (0);
 }
 
@@ -1394,6 +1392,7 @@
         * FL_PORT_ID times).
         */
        tport = fcp->tport;
+
        /*
         * make sure the temp port database is clean...
         */
@@ -1466,7 +1465,7 @@
                 * use) and then compare it to our saved database which
                 * never shifts.
                 */
-               if (isp_same_lportdb(lp, &fcp->portdb[target])) {
+               if (target >= 0 && isp_same_lportdb(lp, &fcp->portdb[target])) {
                        lp->valid = 1;
                }
        }
@@ -1758,6 +1757,12 @@
                isp_mboxcmd(isp, &mbs);
        }
 #endif
+       /*
+        * If we get here, we've for sure seen not only a valid loop
+        * but know what is or isn't on it, so mark this for usage
+        * in ispscsicmd.
+        */
+       fcp->loop_seen_once = 1;
        return (0);
 }
 
@@ -1908,11 +1913,17 @@
                 * If our loop state is such that we haven't yet received
                 * a "Port Database Changed" notification (after a LIP or
                 * a Loop Reset or firmware initialization), then defer
-                * sending commands for a little while.
+                * sending commands for a little while, but only if we've
+                * seen a valid loop at one point (otherwise we can get
+                * stuck at initialization time).
                 */
                if (fcp->isp_loopstate < LOOP_PDB_RCVD) {
                        XS_SETERR(xs, HBA_SELTIMEOUT);
-                       return (CMD_RQLATER);
+                       if (fcp->loop_seen_once) {
+                               return (CMD_RQLATER);
+                       } else {
+                               return (CMD_COMPLETE);
+                       }
                }
 
                /*
@@ -2192,12 +2203,25 @@
 
        case ISPCTL_FCLINK_TEST:
                return (isp_fclink_test(isp, FC_FW_READY_DELAY));
+
+       case ISPCTL_PDB_SYNC:
+               return (isp_pdb_sync(isp, -1));
+
 #ifdef ISP_TARGET_MODE
-       case ISPCTL_ENABLE_LUN:
-               return (isp_modify_lun, 1, arg));
-
-       case ISPCTL_MODIFY_LUN:
-               return (isp_modify_lun, 0, arg));
+       case ISPCTL_TOGGLE_TMODE:
+               if (IS_SCSI(isp)) {
+                       int ena = *(int *)arg;
+                       mbs.param[0] = MBOX_ENABLE_TARGET_MODE;
+                       mbs.param[1] = (ena)? ENABLE_TARGET_FLAG : 0;
+                       isp_mboxcmd(isp, &mbs);
+                       if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
+                               PRINTF("%s: cannot %sable target mode (0x%x)\n",
+                                   isp->isp_name, ena? "en" : "dis",
+                                   mbs.param[0]);
+                               break;
+                       }
+               }
+               return (0);
 #endif
        }
        return (-1);
@@ -2289,12 +2313,12 @@
                MemoryBarrier();
                /*
                 * Do any appropriate unswizzling of what the Qlogic f/w has
-                * written into memory so it makes sense to us.
+                * written into memory so it makes sense to us. This is a
+                * per-platform thing.
                 */
                ISP_UNSWIZZLE_RESPONSE(isp, sp);
                if (sp->req_header.rqs_entry_type != RQSTYPE_RESPONSE) {
                        if (isp_handle_other_response(isp, sp, &optr) == 0) {
-                               ISP_WRITE(isp, INMAILBOX5, optr);
                                continue;
                        }
                        /*
@@ -2303,7 +2327,6 @@
                         * not, something bad has happened.
                         */
                        if (sp->req_header.rqs_entry_type != RQSTYPE_REQUEST) {
-                               ISP_WRITE(isp, INMAILBOX5, optr);
                                PRINTF("%s: not RESPONSE in RESPONSE Queue "
                                    "(type 0x%x) @ idx %d (next %d)\n",
                                    isp->isp_name,
@@ -2384,11 +2407,14 @@
                                isp->isp_update |= (1 << XS_CHANNEL(xs));
                        }
                } else {
-                       if (XS_STS(xs) == SCSI_CHECK) {
+                       if (sp->req_scsi_status & RQCS_SV) {
+                               int amt = min(XS_SNSLEN(xs), sp->req_sense_len);
+                               MEMCPY(XS_SNSP(xs), sp->req_sense_data, amt);
                                XS_SNS_IS_VALID(xs);
-                               MEMCPY(XS_SNSP(xs), sp->req_sense_data,
-                                       XS_SNSLEN(xs));
                                sp->req_state_flags |= RQSF_GOT_SENSE;
+                       } else if (XS_STS(xs) == SCSI_CHECK) {
+                               IDPRINTF(1, ("%s: check condition with no sense"
+                                   " data\n", isp->isp_name));
                        }
                }
                if (XS_NOERR(xs) && XS_STS(xs) == SCSI_BUSY) {
@@ -2431,6 +2457,10 @@
                        ISP_DMAFREE(isp, xs, sp->req_handle);
                }
                /*
+                * Let the platforms cope.
+                */
+#if    0
+               /*
                 * XXX: If we have a check condition, but no Sense Data,
                 * XXX: mark it as an error (ARQ failed). We need to
                 * XXX: to do a more distinct job because there may
@@ -2443,6 +2473,7 @@
                                XS_SETERR(xs, HBA_ARQFAIL);
                        }
                }
+#endif
                if ((isp->isp_dblev >= 5) ||
                    (isp->isp_dblev > 2 && !XS_NOERR(xs))) {
                        PRINTF("%s(%d.%d): FIN dl%d resid%d STS %x",
@@ -2506,7 +2537,7 @@
        case ASYNC_BUS_RESET:
                isp->isp_sendmarker = (1 << bus);
 #ifdef ISP_TARGET_MODE
-               isp_target_async(isp, bus, ASYNC_BUS_RESET);
+               isp_target_async(isp, bus, mbox);
 #endif
                isp_async(isp, ISPASYNC_BUS_RESET, &bus);
                break;
@@ -2540,7 +2571,7 @@
                    isp->isp_name, bus);
                isp->isp_sendmarker = (1 << bus);
 #ifdef ISP_TARGET_MODE
-               isp_target_async(isp, bus, ASYNC_TIMEOUT_RESET);
+               isp_target_async(isp, bus, mbox);
 #endif
                break;
 
@@ -2548,7 +2579,7 @@
                PRINTF("%s: device reset on bus %d\n", isp->isp_name, bus);
                isp->isp_sendmarker = 1 << bus;
 #ifdef ISP_TARGET_MODE
-               isp_target_async(isp, bus, ASYNC_DEVICE_RESET);
+               isp_target_async(isp, bus, mbox);
 #endif
                break;
 
@@ -2626,6 +2657,9 @@
                isp->isp_sendmarker = 1;
                isp_mark_getpdb_all(isp);
                IDPRINTF(1, ("%s: LIP occurred\n", isp->isp_name));
+#ifdef ISP_TARGET_MODE
+               isp_target_async(isp, bus, mbox);
+#endif
                break;
 
        case ASYNC_LOOP_UP:
@@ -2634,6 +2668,9 @@
                ((fcparam *) isp->isp_param)->isp_loopstate = LOOP_LIP_RCVD;
                isp_mark_getpdb_all(isp);
                isp_async(isp, ISPASYNC_LOOP_UP, NULL);
+#ifdef ISP_TARGET_MODE
+               isp_target_async(isp, bus, mbox);
+#endif
                break;
 
        case ASYNC_LOOP_DOWN:
@@ -2642,6 +2679,9 @@
                ((fcparam *) isp->isp_param)->isp_loopstate = LOOP_NIL;
                isp_mark_getpdb_all(isp);
                isp_async(isp, ISPASYNC_LOOP_DOWN, NULL);
+#ifdef ISP_TARGET_MODE
+               isp_target_async(isp, bus, mbox);
+#endif
                break;
 
        case ASYNC_LOOP_RESET:
@@ -2651,7 +2691,7 @@
                isp_mark_getpdb_all(isp);
                PRINTF("%s: Loop RESET\n", isp->isp_name);
 #ifdef ISP_TARGET_MODE
-               isp_target_async(isp, bus, ASYNC_LOOP_RESET);
+               isp_target_async(isp, bus, mbox);
 #endif
                break;
 
@@ -2692,7 +2732,7 @@
 {
        switch (sp->req_header.rqs_entry_type) {
        case RQSTYPE_ATIO:
-       case RQSTYPE_CTIO0:
+       case RQSTYPE_CTIO:
        case RQSTYPE_ENABLE_LUN:
        case RQSTYPE_MODIFY_LUN:
        case RQSTYPE_NOTIFY:
@@ -2702,7 +2742,7 @@
        case RQSTYPE_CTIO2:
        case RQSTYPE_CTIO3:
 #ifdef ISP_TARGET_MODE
-               return (isp_target_entry(isp, sp));
+               return (isp_target_notify(isp, sp, optrp));
 #else
                /* FALLTHROUGH */
 #endif
@@ -3094,7 +3134,7 @@
        MAKNIB(0, 0),   /* 0x52: */
        MAKNIB(0, 0),   /* 0x53: */
        MAKNIB(8, 0),   /* 0x54: MBOX_EXEC_COMMAND_IOCB_A64 */
-       MAKNIB(0, 0),   /* 0x55: */
+       MAKNIB(2, 1),   /* 0x55: MBOX_ENABLE_TARGET_MODE */
        MAKNIB(0, 0),   /* 0x56: */
        MAKNIB(0, 0),   /* 0x57: */
        MAKNIB(0, 0),   /* 0x58: */



Home | Main Index | Thread Index | Old Index