Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Various changes to allow for overriding just loopid ...



details:   https://anonhg.NetBSD.org/src/rev/561acc29bc71
branches:  trunk
changeset: 535248:561acc29bc71
user:      mjacob <mjacob%NetBSD.org@localhost>
date:      Mon Aug 12 21:33:39 2002 +0000

description:
Various changes to allow for overriding just loopid and/or iid.
Fix a random 23XX ISR reading bug. Be chattier about HBA_BOTCH
errors. More f/w cashdump layering.

diffstat:

 sys/dev/ic/isp.c        |  38 ++++++++++++++++++++++++--------------
 sys/dev/ic/isp_ioctl.h  |  25 ++++++++++++++++++++++++-
 sys/dev/ic/isp_netbsd.c |  20 ++++++++++++++++++--
 sys/dev/ic/isp_target.h |   6 +++---
 sys/dev/ic/ispmbox.h    |   3 ++-
 sys/dev/ic/ispvar.h     |   3 ++-
 sys/dev/pci/isp_pci.c   |  21 +++++++++++++++++----
 7 files changed, 90 insertions(+), 26 deletions(-)

diffs (truncated from 317 to 300 lines):

diff -r 04e0206eb18f -r 561acc29bc71 sys/dev/ic/isp.c
--- a/sys/dev/ic/isp.c  Mon Aug 12 21:26:27 2002 +0000
+++ b/sys/dev/ic/isp.c  Mon Aug 12 21:33:39 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: isp.c,v 1.95 2002/06/15 00:16:26 mjacob Exp $ */
+/* $NetBSD: isp.c,v 1.96 2002/08/12 21:33:39 mjacob Exp $ */
 /*
  * This driver, which is contained in NetBSD in the files:
  *
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: isp.c,v 1.95 2002/06/15 00:16:26 mjacob Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isp.c,v 1.96 2002/08/12 21:33:39 mjacob Exp $");
 
 #ifdef __NetBSD__
 #include <dev/ic/isp_netbsd.h>
@@ -2841,12 +2841,6 @@
        }
 
        FC_SCRATCH_RELEASE(isp);
-       /*
-        * XXX: Workaround for some bogus fabric registrants
-        */
-       if (ftype) {
-               (void) isp_scan_fabric(isp, 0);
-       }
        fcp->isp_loopstate = LOOP_FSCAN_DONE;
        return (0);
 }
@@ -3919,9 +3913,20 @@
                isp_async(isp, ISPASYNC_BUS_RESET, &bus);
                break;
        case ASYNC_SYSTEM_ERROR:
+#ifdef ISP_FW_CRASH_DUMP
+               /*
+                * If we have crash dumps enabled, it's up to the handler
+                * for isp_async to reinit stuff and restart the firmware
+                * after performing the crash dump. The reason we do things
+                * this way is that we may need to activate a kernel thread
+                * to do all the crash dump goop.
+                */
+               isp_async(isp, ISPASYNC_FW_CRASH, NULL);
+#else
                isp_async(isp, ISPASYNC_FW_CRASH, NULL);
                isp_reinit(isp);
                isp_async(isp, ISPASYNC_FW_RESTARTED, NULL);
+#endif
                rval = -1;
                break;
 
@@ -5959,8 +5964,9 @@
                ISP_NVRAM_FIFO_THRESHOLD(nvram_data) |
                (ISP_NVRAM_FIFO_THRESHOLD_128(nvram_data) << 2);
 
-       sdp->isp_initiator_id =
-               ISP_NVRAM_INITIATOR_ID(nvram_data);
+       if ((isp->isp_confopts & ISP_CFG_OWNLOOPID) == 0)
+               sdp->isp_initiator_id =
+                       ISP_NVRAM_INITIATOR_ID(nvram_data);
 
        sdp->isp_bus_reset_delay =
                ISP_NVRAM_BUS_RESET_DELAY(nvram_data);
@@ -6085,8 +6091,9 @@
        sdp->isp_fifo_threshold =
            ISP1080_NVRAM_FIFO_THRESHOLD(nvram_data);
 
-       sdp->isp_initiator_id =
-           ISP1080_NVRAM_INITIATOR_ID(nvram_data, bus);
+       if ((isp->isp_confopts & ISP_CFG_OWNLOOPID) == 0)
+               sdp->isp_initiator_id =
+                   ISP1080_NVRAM_INITIATOR_ID(nvram_data, bus);
 
        sdp->isp_bus_reset_delay =
            ISP1080_NVRAM_BUS_RESET_DELAY(nvram_data, bus);
@@ -6176,8 +6183,9 @@
        sdp->isp_fifo_threshold =
            ISP12160_NVRAM_FIFO_THRESHOLD(nvram_data);
 
-       sdp->isp_initiator_id =
-           ISP12160_NVRAM_INITIATOR_ID(nvram_data, bus);
+       if ((isp->isp_confopts & ISP_CFG_OWNLOOPID) == 0)
+               sdp->isp_initiator_id =
+                   ISP12160_NVRAM_INITIATOR_ID(nvram_data, bus);
 
        sdp->isp_bus_reset_delay =
            ISP12160_NVRAM_BUS_RESET_DELAY(nvram_data, bus);
@@ -6492,6 +6500,7 @@
        *ptr++ = isp->isp_mboxtmp[2];
        isp_prt(isp, ISP_LOGALL, "isp_fw_dump: SRAM dumped succesfully");
        FCPARAM(isp)->isp_dump_data[0] = isp->isp_type; /* now used */
+       (void) isp_async(isp, ISPASYNC_FW_DUMPED, 0);
 }
 
 static void
@@ -6654,6 +6663,7 @@
        *ptr++ = mbs.param[2];
        isp_prt(isp, ISP_LOGALL, "isp_fw_dump: SRAM dumped succesfully");
        FCPARAM(isp)->isp_dump_data[0] = isp->isp_type; /* now used */
+       (void) isp_async(isp, ISPASYNC_FW_DUMPED, 0);
 }
 
 void
diff -r 04e0206eb18f -r 561acc29bc71 sys/dev/ic/isp_ioctl.h
--- a/sys/dev/ic/isp_ioctl.h    Mon Aug 12 21:26:27 2002 +0000
+++ b/sys/dev/ic/isp_ioctl.h    Mon Aug 12 21:33:39 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: isp_ioctl.h,v 1.4 2002/06/15 00:17:07 mjacob Exp $ */
+/* $NetBSD: isp_ioctl.h,v 1.5 2002/08/12 21:33:40 mjacob Exp $ */
 /*
  * Copyright (c) 2001 by Matthew Jacob
  *
@@ -156,3 +156,26 @@
 #define        ISP_TOPO_FPORT          4       /* F-port */
 
 #define        ISP_FC_GETHINFO _IOR(ISP_IOC, 12, struct isp_hba_device)
+/*
+ * Set some internal parameters. This doesn't take effect until
+ * the chip is reset.
+ *
+ * Each parameter is generalized to be a name string with an integer value.
+ *
+ * Known parameters are:
+ *
+ *     Name                            Value Range
+ *     
+ *     "framelength"                   512,1024,2048
+ *     "exec_throttle"                 16..255
+ *     "fullduplex"                    0,1
+ *     "loopid"                        0..125
+ */
+
+struct isp_fc_param {
+       char            param_name[16]; /* null terminated */
+       u_int32_t       parameter;
+};
+
+#define        ISP_GET_FC_PARAM        _IOWR(ISP_IOC, 98, struct isp_fc_param)
+#define        ISP_SET_FC_PARAM        _IOWR(ISP_IOC, 99, struct isp_fc_param)
diff -r 04e0206eb18f -r 561acc29bc71 sys/dev/ic/isp_netbsd.c
--- a/sys/dev/ic/isp_netbsd.c   Mon Aug 12 21:26:27 2002 +0000
+++ b/sys/dev/ic/isp_netbsd.c   Mon Aug 12 21:33:39 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: isp_netbsd.c,v 1.55 2002/06/15 00:20:18 mjacob Exp $ */
+/* $NetBSD: isp_netbsd.c,v 1.56 2002/08/12 21:33:40 mjacob Exp $ */
 /*
  * This driver, which is contained in NetBSD in the files:
  *
@@ -59,7 +59,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: isp_netbsd.c,v 1.55 2002/06/15 00:20:18 mjacob Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isp_netbsd.c,v 1.56 2002/08/12 21:33:40 mjacob Exp $");
 
 #include <dev/ic/isp_netbsd.h>
 #include <sys/scsiio.h>
@@ -404,6 +404,7 @@
                if (isp->isp_state != ISP_INITSTATE) {
                        ENABLE_INTS(isp);
                        ISP_UNLOCK(isp);
+                       isp_prt(isp, ISP_LOGERR, "isp not at init state");
                        XS_SETERR(xs, HBA_BOTCH);
                        scsipi_done(xs);
                        return;
@@ -622,6 +623,7 @@
                        isp_reinit(isp);
                }
                if (XS_NOERR(xs)) {
+                       isp_prt(isp, ISP_LOGERR, "polled command timed out");
                        XS_SETERR(xs, HBA_BOTCH);
                }
        }
@@ -654,6 +656,10 @@
                                scsipi_channel_timed_thaw(&isp->isp_chanB);
                        }
                }
+if (xs->error == XS_DRIVER_STUFFUP) {
+isp_prt(isp, ISP_LOGERR, "BOTCHED cmd for %d.%d.%d cmd 0x%x datalen %ld",
+XS_CHANNEL(xs), XS_TGT(xs), XS_LUN(xs), XS_CDBP(xs)[0], (long) XS_XFRLEN(xs));
+}
                scsipi_done(xs);
        }
 }
@@ -1100,7 +1106,17 @@
                 isp_prt(isp, ISP_LOGERR,
                     "Internal Firmware Error on bus %d @ RISC Address 0x%x",
                     mbox6, mbox1);
+#ifdef ISP_FW_CRASH_DUMP
+               if (IS_FC(isp)) {
+                       if (isp->isp_osinfo.blocked == 0) {
+                               isp->isp_osinfo.blocked = 1;
+                               scsipi_channel_freeze(&isp->isp_chanA, 1);
+                       }
+                       isp_fw_dump(isp);
+               }
                isp_reinit(isp);
+               isp_async(isp, ISPASYNC_FW_RESTART, NULL);
+#endif
                break;
        }
        default:
diff -r 04e0206eb18f -r 561acc29bc71 sys/dev/ic/isp_target.h
--- a/sys/dev/ic/isp_target.h   Mon Aug 12 21:26:27 2002 +0000
+++ b/sys/dev/ic/isp_target.h   Mon Aug 12 21:33:39 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: isp_target.h,v 1.18 2002/05/17 18:49:43 mjacob Exp $ */
+/* $NetBSD: isp_target.h,v 1.19 2002/08/12 21:33:40 mjacob Exp $ */
 /*
  * This driver, which is contained in NetBSD in the files:
  *
@@ -551,8 +551,8 @@
  * Enable/Disable/Modify a logical unit.
  * (softc, cmd, bus, tgt, lun, cmd_cnt, inotify_cnt, opaque)
  */
-#define        DFLT_CMND_CNT   32
-#define        DFLT_INOT_CNT   4
+#define        DFLT_CMND_CNT   0xfe    /* unmonitored */
+#define        DFLT_INOT_CNT   16
 int isp_lun_cmd(struct ispsoftc *, int, int, int, int, int, int, u_int32_t);
 
 /*
diff -r 04e0206eb18f -r 561acc29bc71 sys/dev/ic/ispmbox.h
--- a/sys/dev/ic/ispmbox.h      Mon Aug 12 21:26:27 2002 +0000
+++ b/sys/dev/ic/ispmbox.h      Mon Aug 12 21:33:39 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ispmbox.h,v 1.41 2002/05/17 18:49:43 mjacob Exp $ */
+/* $NetBSD: ispmbox.h,v 1.42 2002/08/12 21:33:40 mjacob Exp $ */
 /*
  * This driver, which is contained in NetBSD in the files:
  *
@@ -834,6 +834,7 @@
 
 #define        FC4_IP          5 /* ISO/EEC 8802-2 LLC/SNAP "Out of Order Delivery" */
 #define        FC4_SCSI        8 /* SCSI-3 via Fivre Channel Protocol (FCP) */
+#define        FC4_FC_SVC      0x20    /* Fibre Channel Services */
 
 #define        SNS_GA_NXT      0x100
 #define        SNS_GPN_ID      0x112
diff -r 04e0206eb18f -r 561acc29bc71 sys/dev/ic/ispvar.h
--- a/sys/dev/ic/ispvar.h       Mon Aug 12 21:26:27 2002 +0000
+++ b/sys/dev/ic/ispvar.h       Mon Aug 12 21:33:39 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ispvar.h,v 1.56 2002/06/15 00:18:02 mjacob Exp $ */
+/* $NetBSD: ispvar.h,v 1.57 2002/08/12 21:33:41 mjacob Exp $ */
 /*
  * This driver, which is contained in NetBSD in the files:
  *
@@ -758,6 +758,7 @@
        ISPASYNC_CONF_CHANGE,           /* Platform Configuration Change */
        ISPASYNC_UNHANDLED_RESPONSE,    /* Unhandled Response Entry */
        ISPASYNC_FW_CRASH,              /* Firmware has crashed */
+       ISPASYNC_FW_DUMPED,             /* Firmware crashdump taken */
        ISPASYNC_FW_RESTARTED           /* Firmware has been restarted */
 } ispasync_t;
 int isp_async(struct ispsoftc *, ispasync_t, void *);
diff -r 04e0206eb18f -r 561acc29bc71 sys/dev/pci/isp_pci.c
--- a/sys/dev/pci/isp_pci.c     Mon Aug 12 21:26:27 2002 +0000
+++ b/sys/dev/pci/isp_pci.c     Mon Aug 12 21:33:39 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: isp_pci.c,v 1.81 2002/06/15 00:11:36 mjacob Exp $ */
+/* $NetBSD: isp_pci.c,v 1.82 2002/08/12 21:33:41 mjacob Exp $ */
 /*
  * This driver, which is contained in NetBSD in the files:
  *
@@ -57,7 +57,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: isp_pci.c,v 1.81 2002/06/15 00:11:36 mjacob Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isp_pci.c,v 1.82 2002/08/12 21:33:41 mjacob Exp $");
 
 #include <dev/ic/isp_netbsd.h>
 #include <dev/pci/pcireg.h>
@@ -747,11 +747,23 @@
        case ISPR2HST_MBX_OK:
        case ISPR2HST_MBX_FAIL:
        case ISPR2HST_ASYNC_EVENT:
+               *isrp = r2hisr & 0xffff;
+               *mbox0p = (r2hisr >> 16);
+               *semap = 1;
+               return (1);
        case ISPR2HST_RIO_16:
+               *isrp = r2hisr & 0xffff;
+               *mbox0p = ASYNC_RIO1;
+               *semap = 1;
+               return (1);
        case ISPR2HST_FPOST:
+               *isrp = r2hisr & 0xffff;
+               *mbox0p = ASYNC_CMD_CMPLT;
+               *semap = 1;
+               return (1);
        case ISPR2HST_FPOST_CTIO:
                *isrp = r2hisr & 0xffff;
-               *mbox0p = (r2hisr >> 16);
+               *mbox0p = ASYNC_CTIO_DONE;
                *semap = 1;
                return (1);
        case ISPR2HST_RSPQ_UPDATE:



Home | Main Index | Thread Index | Old Index