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.13-1.15, 1.17-1.22 (via p...



details:   https://anonhg.NetBSD.org/src/rev/c72de6a7227f
branches:  netbsd-1-4
changeset: 470016:c72de6a7227f
user:      he <he%NetBSD.org@localhost>
date:      Sat Jan 08 22:43:15 2000 +0000

description:
Pull up revisions 1.13-1.15,1.17-1.22 (via patch, 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_netbsd.c |  653 +++++++++++++++++++++++++++++++----------------
 1 files changed, 429 insertions(+), 224 deletions(-)

diffs (truncated from 857 to 300 lines):

diff -r 4676142726fd -r c72de6a7227f sys/dev/ic/isp_netbsd.c
--- a/sys/dev/ic/isp_netbsd.c   Sat Jan 08 22:42:37 2000 +0000
+++ b/sys/dev/ic/isp_netbsd.c   Sat Jan 08 22:43:15 2000 +0000
@@ -1,65 +1,50 @@
-/* $NetBSD: isp_netbsd.c,v 1.12 1999/03/26 22:39:45 mjacob Exp $ */
-/* release_03_25_99 */
+/* $NetBSD: isp_netbsd.c,v 1.12.2.1 2000/01/08 22:43:15 he Exp $ */
 /*
  * Platform (NetBSD) dependent common attachment code for Qlogic adapters.
- *
- *---------------------------------------
- * Copyright (c) 1997, 1998 by Matthew Jacob
- * NASA/Ames Research Center
+ * Matthew Jacob <mjacob%nas.nasa.gov@localhost>
+ */
+/*
+ * 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.
- *
- * The author may be reached via electronic communications at
- *
- *  mjacob%nas.nasa.gov@localhost
- *  mjacob%feral.com@localhost
- *
- * or, via United States Postal Address
- *
- *  Matthew Jacob
- *  Feral Software
- *  2339 3rd Street
- *  Suite 24
- *  San Francisco, CA, 94107
+ * 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.
  */
 
 #include <dev/ic/isp_netbsd.h>
+#include <sys/scsiio.h>
 
 static void ispminphys __P((struct buf *));
+static int32_t ispcmd_slow __P((ISP_SCSI_XFER_T *));
 static int32_t ispcmd __P((ISP_SCSI_XFER_T *));
+static int
+ispioctl __P((struct scsipi_link *, u_long, caddr_t, int, struct proc *));
 
 static struct scsipi_device isp_dev = { NULL, NULL, NULL, NULL };
 static int isp_poll __P((struct ispsoftc *, ISP_SCSI_XFER_T *, int));
 static void isp_watch __P((void *));
+static void isp_command_requeue __P((void *));
 static void isp_internal_restart __P((void *));
 
-#define        FC_OPENINGS     RQUEST_QUEUE_LEN / (MAX_FC_TARG-1)
-#define        PI_OPENINGS     RQUEST_QUEUE_LEN / (MAX_TARGETS-1)
-
 /*
  * Complete attachment of hardware, include subdevices.
  */
@@ -68,24 +53,23 @@
        struct ispsoftc *isp;
 {
 
-       isp->isp_osinfo._adapter.scsipi_cmd = ispcmd;
        isp->isp_osinfo._adapter.scsipi_minphys = ispminphys;
+       isp->isp_osinfo._adapter.scsipi_ioctl = ispioctl;
 
        isp->isp_state = ISP_RUNSTATE;
-       isp->isp_osinfo._link.scsipi_scsi.channel = SCSI_CHANNEL_ONLY_ONE;
+       isp->isp_osinfo._link.scsipi_scsi.channel =
+           (IS_DUALBUS(isp))? 0 : SCSI_CHANNEL_ONLY_ONE;
        isp->isp_osinfo._link.adapter_softc = isp;
        isp->isp_osinfo._link.device = &isp_dev;
        isp->isp_osinfo._link.adapter = &isp->isp_osinfo._adapter;
-       TAILQ_INIT(&isp->isp_osinfo.waitq);
+       isp->isp_osinfo._link.openings = isp->isp_maxcmds;
+       TAILQ_INIT(&isp->isp_osinfo.waitq);     /* XXX 2nd Bus? */
 
-       if (isp->isp_type & ISP_HA_FC) {
+       if (IS_FC(isp)) {
                /*
                 * Give it another chance here to come alive...
                 */
-               fcparam *fcp = isp->isp_param;
-               if (fcp->isp_fwstate != FW_READY) {
-                       (void) isp_control(isp, ISPCTL_FCLINK_TEST, NULL);
-               }
+               isp->isp_osinfo._adapter.scsipi_cmd = ispcmd;
                isp->isp_osinfo._link.scsipi_scsi.max_target = MAX_FC_TARG-1;
 #ifdef ISP2100_SCCLUN
                /*
@@ -95,59 +79,83 @@
 #else
                isp->isp_osinfo._link.scsipi_scsi.max_lun = 15;
 #endif
-               isp->isp_osinfo._link.openings = FC_OPENINGS;
-               isp->isp_osinfo._link.scsipi_scsi.adapter_target =
-                       ((fcparam *)isp->isp_param)->isp_loopid;
+               /* set below */
        } else {
-               isp->isp_osinfo._link.openings = PI_OPENINGS;
+               sdparam *sdp = isp->isp_param;
+               isp->isp_osinfo._adapter.scsipi_cmd = ispcmd_slow;
                isp->isp_osinfo._link.scsipi_scsi.max_target = MAX_TARGETS-1;
-               if (isp->isp_bustype == ISP_BT_SBUS) {
-                       isp->isp_osinfo._link.scsipi_scsi.max_lun = 7;
-               } else {
-                       /*
-                        * Too much target breakage at present.
-                        */
-#if    0
-                       if (isp->isp_fwrev >= ISP_FW_REV(7,55))
-                               isp->isp_osinfo._link.scsipi_scsi.max_lun = 31;
-                       else
-#endif
-                               isp->isp_osinfo._link.scsipi_scsi.max_lun = 7;
+               isp->isp_osinfo._link.scsipi_scsi.max_lun = 7;
+               isp->isp_osinfo._link.scsipi_scsi.adapter_target =
+                   sdp->isp_initiator_id;
+               isp->isp_osinfo.discovered[0] = 1 << sdp->isp_initiator_id;
+               if (IS_DUALBUS(isp)) {
+                       isp->isp_osinfo._link_b = isp->isp_osinfo._link;
+                       sdp++;
+                       isp->isp_osinfo.discovered[1] =
+                           1 << sdp->isp_initiator_id;
+                       isp->isp_osinfo._link_b.scsipi_scsi.adapter_target =
+                           sdp->isp_initiator_id;
+                       isp->isp_osinfo._link_b.scsipi_scsi.channel = 1;
                }
-               isp->isp_osinfo._link.scsipi_scsi.adapter_target =
-                       ((sdparam *)isp->isp_param)->isp_initiator_id;
        }
-       if (isp->isp_osinfo._link.openings < 2)
-               isp->isp_osinfo._link.openings = 2;
        isp->isp_osinfo._link.type = BUS_SCSI;
 
        /*
         * Send a SCSI Bus Reset (used to be done as part of attach,
         * but now left to the OS outer layers).
-        *
-        * XXX: For now, skip resets for FC because the method by which
-        * XXX: we deal with loop down after issuing resets (which causes
-        * XXX: port logouts for all devices) needs interrupts to run so
-        * XXX: that async events happen.
         */
-       
-       if (isp->isp_type & ISP_HA_SCSI) {
-               (void) isp_control(isp, ISPCTL_RESET_BUS, NULL);
+       if (IS_SCSI(isp)) {
+               int bus = 0;
+               (void) isp_control(isp, ISPCTL_RESET_BUS, &bus);
+               if (IS_DUALBUS(isp)) {
+                       bus++;
+                       (void) isp_control(isp, ISPCTL_RESET_BUS, &bus);
+               }
                SYS_DELAY(2*1000000);
        } else {
-               ;
+               int i, j;
+               fcparam *fcp = isp->isp_param;
+               delay(2 * 1000000);
+               for (j = 0; j < 5; j++) {
+                       for (i = 0; i < 5; i++) {
+                               if (isp_control(isp, ISPCTL_FCLINK_TEST, NULL))
+                                       continue;
+#ifdef ISP2100_FABRIC
+                               /*
+                                * Wait extra time to see if the f/w
+                                * eventually completed an FLOGI that
+                                * will allow us to know we're on a
+                                * fabric.
+                                */
+                               if (fcp->isp_onfabric == 0) {
+                                       delay(1 * 1000000);
+                                       continue;
+                               }
+#endif
+                               break;
+                       }
+                       if (fcp->isp_fwstate == FW_READY &&
+                           fcp->isp_loopstate >= LOOP_PDB_RCVD) { 
+                               break;
+                       }
+               }
+               isp->isp_osinfo._link.scsipi_scsi.adapter_target =
+                       fcp->isp_loopid;
        }
 
        /*
         * Start the watchdog.
         */
        isp->isp_dogactive = 1;
-       timeout(isp_watch, isp, 30 * hz);
+       timeout(isp_watch, isp, WATCH_INTERVAL * hz);
 
        /*
         * And attach children (if any).
         */
        config_found((void *)isp, &isp->isp_osinfo._link, scsiprint);
+       if (IS_DUALBUS(isp)) {
+               config_found((void *)isp, &isp->isp_osinfo._link_b, scsiprint);
+       }
 }
 
 /*
@@ -171,40 +179,102 @@
        minphys(bp);
 }
 
-static int
+static int32_t
+ispcmd_slow(xs)
+       ISP_SCSI_XFER_T *xs;
+{
+       sdparam *sdp;
+       int tgt, chan, s;
+       u_int16_t flags;
+       struct ispsoftc *isp = XS_ISP(xs);
+
+       /*
+        * Have we completed discovery for this target on this adapter?
+        */
+       tgt = XS_TGT(xs);
+       chan = XS_CHANNEL(xs);
+       if ((xs->flags & SCSI_AUTOCONF) != 0 ||
+           (isp->isp_osinfo.discovered[chan] & (1 << tgt)) != 0) {
+               return (ispcmd(xs));
+       }
+
+       flags = DPARM_DEFAULT;
+       if (xs->sc_link->quirks & SDEV_NOSYNC) {
+               flags ^= DPARM_SYNC;
+#ifdef DEBUG
+       } else {
+               printf("%s: channel %d target %d can do SYNC xfers\n",
+                   isp->isp_name, chan, tgt);
+#endif
+       }
+       if (xs->sc_link->quirks & SDEV_NOWIDE) {
+               flags ^= DPARM_WIDE;
+#ifdef DEBUG
+       } else {
+               printf("%s: channel %d target %d can do WIDE xfers\n",
+                   isp->isp_name, chan, tgt);
+#endif
+       }
+       if (xs->sc_link->quirks & SDEV_NOTAG) {
+               flags ^= DPARM_TQING;
+#ifdef DEBUG
+       } else {
+               printf("%s: channel %d target %d can do TAGGED xfers\n",
+                   isp->isp_name, chan, tgt);
+#endif
+       }
+       /*
+        * Okay, we know about this device now,
+        * so mark parameters to be updated for it.
+        */
+       s = splbio();
+       isp->isp_osinfo.discovered[chan] |= (1 << tgt);
+       sdp = isp->isp_param;
+       sdp += chan;
+       sdp->isp_devparam[tgt].dev_flags = flags;
+       sdp->isp_devparam[tgt].dev_update = 1;
+       isp->isp_update |= (1 << chan);
+       splx(s);
+       return (ispcmd(xs));
+}



Home | Main Index | Thread Index | Old Index