Source-Changes-HG archive

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

[src/netbsd-1-4]: src/sys/dev/ic Pull up revisions 1.35-1.47 (requested by mj...



details:   https://anonhg.NetBSD.org/src/rev/4676142726fd
branches:  netbsd-1-4
changeset: 470015:4676142726fd
user:      he <he%NetBSD.org@localhost>
date:      Sat Jan 08 22:42:37 2000 +0000

description:
Pull up revisions 1.35-1.47 (requested by mjacob):
  Untangle Qlogic firmware copyright problems and update firmware.
  Untangle some MD support issues for said firmware. Add 1280 (Dual
  LVD), 1240 (Dual Ultra), 2200 (2nd Generation Qlogic FC chipset).
  Fix some synchronous negotiation problems for parallel SCSI.
  Firm up some Fabric Support issues.

diffstat:

 sys/dev/ic/isp.c |  3284 +++++++++++++++++++++++++++++++----------------------
 1 files changed, 1897 insertions(+), 1387 deletions(-)

diffs (truncated from 4627 to 300 lines):

diff -r 0538265c9d38 -r 4676142726fd sys/dev/ic/isp.c
--- a/sys/dev/ic/isp.c  Sat Jan 08 22:42:09 2000 +0000
+++ b/sys/dev/ic/isp.c  Sat Jan 08 22:42:37 2000 +0000
@@ -1,36 +1,35 @@
-/* $NetBSD: isp.c,v 1.34 1999/03/26 22:39:44 mjacob Exp $ */
-/* release_03_25_99 */
+/* $NetBSD: isp.c,v 1.34.2.1 2000/01/08 22:42:37 he Exp $ */
 /*
- * 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>
  */
 
 /*
@@ -65,67 +64,42 @@
 /*
  * Local static data
  */
-#ifdef ISP_TARGET_MODE
-static const char tgtiqd[36] = {
-       0x03, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00,
-       0x51, 0x4C, 0x4F, 0x47, 0x49, 0x43, 0x20, 0x20,
-#ifdef __NetBSD__
-       0x4E, 0x45, 0x54, 0x42, 0x53, 0x44, 0x20, 0x20,
-#else
-# ifdef        __FreeBSD__
-       0x46, 0x52, 0x45, 0x45, 0x42, 0x52, 0x44, 0x20,
-# else
-#  ifdef __OpenBSD__
-       0x4F, 0x50, 0x45, 0x4E, 0x42, 0x52, 0x44, 0x20,
-#  else
-#   ifdef linux
-       0x4C, 0x49, 0x4E, 0x55, 0x58, 0x20, 0x20, 0x20,
-#   else
-#   endif
-#  endif
-# endif
-#endif
-       0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x20, 0x20,
-       0x20, 0x20, 0x20, 0x31
-};
-#endif
-
 
 /*
  * Local function prototypes.
  */
 static int isp_parse_async __P((struct ispsoftc *, int));
 static int isp_handle_other_response
-__P((struct ispsoftc *, ispstatusreq_t *, u_int8_t *));
-#ifdef ISP_TARGET_MODE
-static int isp_modify_lun __P((struct ispsoftc *, int, int, int));
-static void isp_notify_ack __P((struct ispsoftc *, void *));
-static void isp_handle_atio __P((struct ispsoftc *, void *));
-static void isp_handle_atio2 __P((struct ispsoftc *, void *));
-static void isp_handle_ctio __P((struct ispsoftc *, void *));
-static void isp_handle_ctio2 __P((struct ispsoftc *, void *));
-#endif
+__P((struct ispsoftc *, ispstatusreq_t *, u_int16_t *));
 static void isp_parse_status
 __P((struct ispsoftc *, ispstatusreq_t *, ISP_SCSI_XFER_T *));
-static void isp_fastpost_complete __P((struct ispsoftc *, int));
+static void isp_fastpost_complete __P((struct ispsoftc *, u_int32_t));
+static void isp_scsi_init __P((struct ispsoftc *));
+static void isp_scsi_channel_init __P((struct ispsoftc *, int));
 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 *));
 static void isp_mboxcmd __P((struct ispsoftc *, mbreg_t *));
 
-static void isp_update  __P((struct ispsoftc *));
-static void isp_setdfltparm __P((struct ispsoftc *));
+static void isp_update __P((struct ispsoftc *));
+static void isp_update_bus __P((struct ispsoftc *, int));
+static void isp_setdfltparm __P((struct ispsoftc *, int));
 static int isp_read_nvram __P((struct ispsoftc *));
 static void isp_rdnvram_word __P((struct ispsoftc *, int, u_int16_t *));
 
 /*
  * Reset Hardware.
  *
- * Hit the chip over the head, download new f/w and set it running.
+ * Hit the chip over the head, download new f/w if available and set it running.
  *
  * Locking done elsewhere.
  */
@@ -159,61 +133,106 @@
         * case, we don't really use this yet, but we may in
         * the future.
         */
-       if (isp->isp_used == 0) {
+       if (isp->isp_touched == 0) {
                /*
                 * Just in case it was paused...
                 */
                ISP_WRITE(isp, HCCR, HCCR_CMD_RELEASE);
                mbs.param[0] = MBOX_ABOUT_FIRMWARE;
                isp_mboxcmd(isp, &mbs);
-               if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
-                       /*
-                        * If this fails, it probably means we're running
-                        * an old prom, if anything at all...
-                        */
-                       isp->isp_romfw_rev = 0;
-               } else {
-                       isp->isp_romfw_rev =
-                           (((u_int16_t) mbs.param[1]) << 10) + mbs.param[2];
+               /*
+                * If this fails, it probably means we're running
+                * an old prom, if anything at all...
+                */
+               if (mbs.param[0] == MBOX_COMMAND_COMPLETE) {
+                       isp->isp_romfw_rev[0] = mbs.param[1];
+                       isp->isp_romfw_rev[1] = mbs.param[2];
+                       isp->isp_romfw_rev[2] = mbs.param[3];
                }
-               isp->isp_used = 1;
+               isp->isp_touched = 1;
        }
 
+       DISABLE_INTS(isp);
+
        /*
-        * Put it into PAUSE mode.
+        * Put the board into PAUSE mode (so we can read the SXP registers).
         */
        ISP_WRITE(isp, HCCR, HCCR_CMD_PAUSE);
 
        if (IS_FC(isp)) {
-               revname = "2100";
-       } else if (IS_1080(isp)) {
+               revname = "2X00";
+               switch (isp->isp_type) {
+               case ISP_HA_FC_2100:
+                       revname[1] = '1';
+                       break;
+               case ISP_HA_FC_2200:
+                       revname[1] = '2';
+                       break;
+               default:
+                       break;
+               }
+       } else if (IS_1240(isp)) {
+               sdparam *sdp = isp->isp_param;
+               revname = "1240";
+               isp->isp_clock = 60;
+               sdp->isp_ultramode = 1;
+               sdp++;
+               sdp->isp_ultramode = 1;
+               /*
+                * XXX: Should probably do some bus sensing.
+                */
+       } else if (IS_ULTRA2(isp)) {
+               static char *m = "%s: bus %d is in %s Mode\n";
                u_int16_t l;
                sdparam *sdp = isp->isp_param;
+
+               isp->isp_clock = 100;
+
                revname = "1080";
-               sdp->isp_clock = 100;
                l = ISP_READ(isp, SXP_PINS_DIFF) & ISP1080_MODE_MASK;
                switch (l) {
                case ISP1080_LVD_MODE:
                        sdp->isp_lvdmode = 1;
-                       PRINTF("%s: LVD Mode\n", isp->isp_name);
+                       CFGPRINTF(m, isp->isp_name, 0, "LVD");
                        break;
                case ISP1080_HVD_MODE:
                        sdp->isp_diffmode = 1;
-                       PRINTF("%s: Differential Mode\n", isp->isp_name);
+                       CFGPRINTF(m, isp->isp_name, 0, "Differential");
                        break;
                case ISP1080_SE_MODE:
                        sdp->isp_ultramode = 1;
-                       PRINTF("%s: Single-Ended Mode\n", isp->isp_name);
+                       CFGPRINTF(m, isp->isp_name, 0, "Single-Ended");
                        break;
                default:
-                       /*
-                        * Hmm. Up in a wierd mode. This means all SCSI I/O
-                        * buffer lines are tristated, so we're in a lot of
-                        * trouble if we don't set things up right.
-                        */
-                       PRINTF("%s: Illegal Mode 0x%x\n", isp->isp_name, l);
+                       CFGPRINTF("%s: unknown mode on bus %d (0x%x)\n",
+                           isp->isp_name, 0, l);
                        break;
                }
+
+               if (IS_1280(isp)) {
+                       sdp++;
+                       revname[1] = '2';
+                       l = ISP_READ(isp, SXP_PINS_DIFF|SXP_BANK1_SELECT);
+                       l &= ISP1080_MODE_MASK;
+                       switch(l) {
+                       case ISP1080_LVD_MODE:
+                               sdp->isp_lvdmode = 1;
+                               CFGPRINTF(m, isp->isp_name, 1, "LVD");
+                               break;
+                       case ISP1080_HVD_MODE:
+                               sdp->isp_diffmode = 1;
+                               CFGPRINTF(m, isp->isp_name, 1, "Differential");
+                               break;
+                       case ISP1080_SE_MODE:
+                               sdp->isp_ultramode = 1;
+                               CFGPRINTF(m, isp->isp_name, 1, "Single-Ended");
+                               break;
+                       default:
+                               CFGPRINTF("%s: unknown mode on bus %d (0x%x)\n",
+                                   isp->isp_name, 1, l);
+                               break;
+                       }
+               }
        } else {
                sdparam *sdp = isp->isp_param;
                i = ISP_READ(isp, BIU_CONF0) & BIU_CONF0_HW_MASK;
@@ -225,7 +244,7 @@
                case 1:
                        revname = "1020";
                        isp->isp_type = ISP_HA_SCSI_1020;
-                       sdp->isp_clock = 40;
+                       isp->isp_clock = 40;
                        break;
                case 2:
                        /*
@@ -235,30 +254,35 @@
                         */
                        revname = "1020A";
                        isp->isp_type = ISP_HA_SCSI_1020A;
-                       sdp->isp_clock = 40;
+                       isp->isp_clock = 40;
                        break;
                case 3:
                        revname = "1040";
                        isp->isp_type = ISP_HA_SCSI_1040;
-                       sdp->isp_clock = 60;
+                       isp->isp_clock = 60;
                        break;
                case 4:
                        revname = "1040A";
                        isp->isp_type = ISP_HA_SCSI_1040A;
-                       sdp->isp_clock = 60;
+                       isp->isp_clock = 60;



Home | Main Index | Thread Index | Old Index