Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Change to approved NASA/Ames copyright. Add Fabri...



details:   https://anonhg.NetBSD.org/src/rev/3dc3c2fe3eb8
branches:  trunk
changeset: 474407:3dc3c2fe3eb8
user:      mjacob <mjacob%NetBSD.org@localhost>
date:      Mon Jul 05 20:31:35 1999 +0000

description:
Change to approved NASA/Ames copyright. Add Fabric support. Fix SCCLUN support.
Add code that tries to track LoopID shifting.

diffstat:

 sys/dev/ic/isp.c        |  882 +++++++++++++++++++++++++++++++++++++++--------
 sys/dev/ic/isp_netbsd.c |  169 ++++----
 sys/dev/ic/isp_netbsd.h |   62 +-
 sys/dev/ic/ispmbox.h    |  108 +++--
 sys/dev/ic/ispreg.h     |   43 +-
 sys/dev/ic/ispvar.h     |  146 ++++---
 6 files changed, 1026 insertions(+), 384 deletions(-)

diffs (truncated from 2030 to 300 lines):

diff -r ea78b2335052 -r 3dc3c2fe3eb8 sys/dev/ic/isp.c
--- a/sys/dev/ic/isp.c  Mon Jul 05 20:28:11 1999 +0000
+++ b/sys/dev/ic/isp.c  Mon Jul 05 20:31:35 1999 +0000
@@ -1,36 +1,35 @@
-/* $NetBSD: isp.c,v 1.36 1999/05/12 18:59:23 mjacob Exp $ */
-/* release_5_11_99 */
+/* $NetBSD: isp.c,v 1.37 1999/07/05 20:31:35 mjacob Exp $ */
+/* release_6_5_99 */
 /*
- * Machine and OS Independent (well, as best as possible)
- * code for the Qlogic ISP SCSI adapters.
- *
- * Copyright (c) 1997, 1998 by Matthew Jacob
- * NASA/Ames Research Center
+ * Copyright (C) 1997, 1998, 1999 National Aeronautics & Space Administration
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
- *    notice immediately at the beginning of the file, without modification,
- *    this list of conditions, and the following disclaimer.
+ *    notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
+ *    derived from this software without specific prior written permission
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ * Machine and OS Independent (well, as best as possible)
+ * code for the Qlogic ISP SCSI adapters.
+ * Matthew Jacob <mjacob%nas.nasa.gov@localhost>
  */
 
 /*
@@ -113,7 +112,13 @@
 static void isp_fibre_init __P((struct ispsoftc *));
 static void isp_mark_getpdb_all __P((struct ispsoftc *));
 static int isp_getpdb __P((struct ispsoftc *, int, isp_pdb_t *));
+static u_int64_t isp_get_portname __P((struct ispsoftc *, int, int));
 static int isp_fclink_test __P((struct ispsoftc *, int));
+static int isp_same_lportdb __P((struct lportdb *, struct lportdb *));
+static int isp_pdb_sync __P((struct ispsoftc *, int));
+#ifdef ISP2100_FABRIC
+static int isp_scan_fabric __P((struct ispsoftc *));
+#endif
 static void isp_fw_state __P((struct ispsoftc *));
 static void isp_dumpregs __P((struct ispsoftc *, const char *));
 static void isp_dumpxflist __P((struct ispsoftc *));
@@ -184,27 +189,32 @@
        DISABLE_INTS(isp);
 
        /*
-        * Put it into PAUSE mode.
+        * Put the board into PAUSE mode.
         */
        ISP_WRITE(isp, HCCR, HCCR_CMD_PAUSE);
 
-#if    0
-       /*
-        * Do a little register testing.
-        */
-       ISP_WRITE(isp, CDMA_COUNT, 0);
-       ISP_WRITE(isp, CDMA_ADDR0, 0xdead);
-       ISP_WRITE(isp, CDMA_ADDR1, 0xbeef);
-       ISP_WRITE(isp, CDMA_ADDR2, 0xffff);
-       ISP_WRITE(isp, CDMA_ADDR3, 0x1111);
-       PRINTF("%s: (0,dead,beef,ffff,1111):\n", isp->isp_name);
-       PRINTF("0x%x 0x%x 0x%x 0x%x 0x%x\n", ISP_READ(isp, CDMA_COUNT),
-           ISP_READ(isp, CDMA_ADDR0), ISP_READ(isp, CDMA_ADDR1),
-           ISP_READ(isp, CDMA_ADDR2), ISP_READ(isp, CDMA_ADDR3));
+       if (IS_FC(isp)) {
+               revname = "2X00";
+               switch (isp->isp_type) {
+               case ISP_HA_FC_2100:
+                       revname[1] = '1';
+                       break;
+               case ISP_HA_FC_2200:
+                       revname[1] = '2';
+                       /*
+                        * Resident firmware for the 2200 appears to have
+                        * SCCLUN enabled.
+                        */
+#ifndef        ISP2100_SCCLUN
+                       if (isp->isp_mdvec->dv_fwlen == 0) {
+                               PRINTF("%s: WARNING- using resident f/w without"
+                                   " SCCLUN support defined\n", isp->isp_name);
+                       }
 #endif
-
-       if (IS_FC(isp)) {
-               revname = "2100";
+                       break;
+               default:
+                       break;
+               }
        } else if (IS_12X0(isp)) {
                revname = "12X0";
                isp->isp_clock = 60;
@@ -494,7 +504,7 @@
                return;
        }
 
-       if (isp->isp_type & ISP_HA_SCSI) {
+       if (IS_SCSI(isp)) {
                mbs.param[0] = MBOX_MAILBOX_REG_TEST;
                mbs.param[1] = 0xdead;
                mbs.param[2] = 0xbeef;
@@ -960,7 +970,7 @@
        fcparam *fcp;
        isp_icb_t *icbp;
        mbreg_t mbs;
-       int count, loopid;
+       int loopid;
 
        fcp = isp->isp_param;
 
@@ -973,21 +983,11 @@
         * best way to figure this out XXX
         */
 #ifndef        __i386__
-       loopid = DEFAULT_LOOPID;
+       loopid = DEFAULT_LOOPID(isp);
 #else
        loopid = fcp->isp_loopid;
 #endif
 
-#if    defined(ISP2100_FABRIC) && defined(ISP2100_SCCLUN)
-       PRINTF("%s: Fabric Support, Expanded Lun Support\n", isp->isp_name);
-#endif
-#if    defined(ISP2100_FABRIC) && !defined(ISP2100_SCCLUN)
-       PRINTF("%s: Fabric Support\n", isp->isp_name);
-#endif
-#if    !defined(ISP2100_FABRIC) && defined(ISP2100_SCCLUN)
-       PRINTF("%s: Expanded Lun Support\n", isp->isp_name);
-#endif
-
        icbp = (isp_icb_t *) fcp->isp_scratch;
        MEMZERO(icbp, sizeof (*icbp));
 
@@ -997,18 +997,34 @@
 #else
        fcp->isp_fwoptions = 0;
 #endif
-       fcp->isp_fwoptions |= ICBOPT_INI_ADISC|ICBOPT_FAIRNESS;
+       fcp->isp_fwoptions |= ICBOPT_FAIRNESS;
        fcp->isp_fwoptions |= ICBOPT_PDBCHANGE_AE;
        fcp->isp_fwoptions |= ICBOPT_HARD_ADDRESS;
+#ifdef ISP2100_FABRIC
+#if    0
+       /*
+        * Do not use FULL LOGIN- it resets the loop too much.
+        */
+       fcp->isp_fwoptions |= ICBOPT_FULL_LOGIN;
+#endif
+#endif
+#if    0
+       /*
+        * Don't use this either
+        */
+       fcp->isp_fwoptions |= ICBOPT_INI_ADISC;
+#endif
 #ifndef        ISP_NO_FASTPOST_FC
        fcp->isp_fwoptions |= ICBOPT_FAST_POST;
 #endif
-#ifdef CHECKME
-       fcp->isp_fwoptions |= ICBOPT_USE_PORTNAME;
-#endif
-#ifdef ISP2100_FABRIC
-       fcp->isp_fwoptions |= ICBOPT_FULL_LOGIN;
-#endif
+
+       if (isp->isp_confopts & ISP_CFG_FULL_DUPLEX)
+               fcp->isp_fwoptions |= ICBOPT_FULL_DUPLEX;
+
+       /*
+        * We don't set ICBOPT_PORTNAME because we want our
+        * Node Name && Port Names to be distinct.
+        */
 
        icbp->icb_fwoptions = fcp->isp_fwoptions;
        icbp->icb_maxfrmlen = fcp->isp_maxfrmlen;
@@ -1019,7 +1035,7 @@
                icbp->icb_maxfrmlen = ICB_DFLT_FRMLEN;
        }
        icbp->icb_maxalloc = fcp->isp_maxalloc;
-       if (icbp->icb_maxalloc < 16) {
+       if (icbp->icb_maxalloc < 1) {
                PRINTF("%s: bad maximum allocation (%d)- using 16\n",
                     isp->isp_name, fcp->isp_maxalloc);
                icbp->icb_maxalloc = 16;
@@ -1028,21 +1044,37 @@
        if (icbp->icb_execthrottle < 1) {
                PRINTF("%s: bad execution throttle of %d- using 16\n",
                    isp->isp_name, fcp->isp_execthrottle);
-               icbp->icb_execthrottle = 16;
+               icbp->icb_execthrottle = ICB_DFLT_THROTTLE;
        }
        icbp->icb_retry_delay = fcp->isp_retry_delay;
        icbp->icb_retry_count = fcp->isp_retry_count;
        icbp->icb_hardaddr = loopid;
 
-       if (fcp->isp_wwn) {
-               MAKE_NODE_NAME_FROM_WWN(icbp->icb_nodename, fcp->isp_wwn);
-               if (icbp->icb_fwoptions & ICBOPT_USE_PORTNAME) {
-                       u_int64_t portname = fcp->isp_wwn | (2LL << 56);
-                       MAKE_NODE_NAME_FROM_WWN(icbp->icb_nodename, portname);
+       if (fcp->isp_nodewwn) {
+               u_int64_t pn;
+               MAKE_NODE_NAME_FROM_WWN(icbp->icb_nodename, fcp->isp_nodewwn);
+               if (fcp->isp_portwwn) {
+                       pn = fcp->isp_portwwn;
+               } else {
+                       pn = fcp->isp_nodewwn |
+                           (((u_int64_t)(isp->isp_unit+1)) << 56);
+               }
+               /*
+                * If the top nibble is 2, we can construct a port name
+                * from the node name by setting a nonzero instance in
+                * bits 56..59. Otherwise, we need to make it identical
+                * to Node name...
+                */
+               if ((fcp->isp_nodewwn >> 60) == 2) {
+                       MAKE_NODE_NAME_FROM_WWN(icbp->icb_portname, pn);
+               } else {
+                       MAKE_NODE_NAME_FROM_WWN(icbp->icb_portname,
+                           fcp->isp_nodewwn);
                }
        } else {
                fcp->isp_fwoptions &= ~(ICBOPT_USE_PORTNAME|ICBOPT_FULL_LOGIN);
        }
+
        icbp->icb_rqstqlen = RQUEST_QUEUE_LEN;
        icbp->icb_rsltqlen = RESULT_QUEUE_LEN;
        icbp->icb_rqstaddr[RQRSP_ADDR0015] = DMA_LSW(isp->isp_rquest_dma);
@@ -1051,7 +1083,7 @@
        icbp->icb_respaddr[RQRSP_ADDR1631] = DMA_MSW(isp->isp_result_dma);
        MemoryBarrier();
 
-       for (count = 0; count < 10; count++) {
+       for (;;) {
                mbs.param[0] = MBOX_INIT_FIRMWARE;
                mbs.param[1] = 0;
                mbs.param[2] = DMA_MSW(fcp->isp_scdma);
@@ -1060,32 +1092,19 @@
                mbs.param[5] = 0;
                mbs.param[6] = 0;
                mbs.param[7] = 0;
-
                isp_mboxcmd(isp, &mbs);
-
-               switch (mbs.param[0]) {
-               case MBOX_COMMAND_COMPLETE:
-                       count = 10;
-                       break;
-               case ASYNC_PDB_CHANGED:
-                       isp_mark_getpdb_all(isp);
-                       /* FALL THROUGH */
-               case ASYNC_LIP_OCCURRED:
-               case ASYNC_LOOP_UP:
-               case ASYNC_LOOP_DOWN:
-               case ASYNC_LOOP_RESET:
-               case ASYNC_CHANGE_NOTIFY:
-                       if (count > 9) {
-                               PRINTF("%s: too many retries to get going- "
-                                   "giving up\n", isp->isp_name);
-                               return;
+               if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
+                       PRINTF("%s: INIT FIRMWARE failed (code 0x%x)\n",
+                           isp->isp_name, mbs.param[0]);
+                       if (mbs.param[0] & 0xc000) {
+                               SYS_DELAY(1000);
+                               continue;
                        }
-                       break;



Home | Main Index | Thread Index | Old Index