Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Core version 2.0 (platform version 1.0) rewrite of I...



details:   https://anonhg.NetBSD.org/src/rev/bc5b7f7feada
branches:  trunk
changeset: 495622:bc5b7f7feada
user:      mjacob <mjacob%NetBSD.org@localhost>
date:      Tue Aug 01 23:55:09 2000 +0000

description:
Core version 2.0 (platform version 1.0) rewrite of ISP driver. Some
interace cleanups, some new common functions. The major impact that
will be noticeable right away is that if you boot with not Fibre connected
to the FC cards, you no longer hang indefinitely.

diffstat:

 sys/dev/ic/isp.c        |  1923 ++++++++++++++++++++++++----------------------
 sys/dev/ic/isp_inline.h |   165 +--
 sys/dev/ic/isp_netbsd.c |   263 +++---
 sys/dev/ic/isp_netbsd.h |   425 ++++++---
 sys/dev/ic/isp_target.c |   244 ++---
 sys/dev/ic/isp_target.h |    11 +-
 sys/dev/ic/ispmbox.h    |     5 +-
 sys/dev/ic/ispreg.h     |     5 +-
 sys/dev/ic/ispvar.h     |   225 ++++-
 sys/dev/pci/isp_pci.c   |   316 ++++---
 sys/dev/sbus/isp_sbus.c |   118 +-
 11 files changed, 1990 insertions(+), 1710 deletions(-)

diffs (truncated from 6658 to 300 lines):

diff -r e4e499d8fd44 -r bc5b7f7feada sys/dev/ic/isp.c
--- a/sys/dev/ic/isp.c  Tue Aug 01 23:38:26 2000 +0000
+++ b/sys/dev/ic/isp.c  Tue Aug 01 23:55:09 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: isp.c,v 1.56 2000/07/19 22:18:02 mjacob Exp $ */
+/* $NetBSD: isp.c,v 1.57 2000/08/01 23:55:09 mjacob Exp $ */
 /*
  * Machine and OS Independent (well, as best as possible)
  * code for the Qlogic ISP SCSI adapters.
@@ -54,6 +54,9 @@
 #ifdef __linux__
 #include "isp_linux.h"
 #endif
+#ifdef __svr4__
+#include "isp_solaris.h"
+#endif
 
 /*
  * General defines
@@ -64,7 +67,44 @@
 /*
  * Local static data
  */
-
+static char *warnlun =
+    "WARNING- cannot determine Expanded LUN capability- limiting to one LUN";
+static char *portshift =
+    "Target %d Loop ID 0x%x (Port 0x%x) => Loop 0x%x (Port 0x%x)";
+static char *portdup =
+    "Target %d duplicates Target %d- killing off both";
+static char *retained = 
+    "Retaining Loop ID 0x%x for Target %d (Port 0x%x)";
+#ifdef ISP2100_FABRIC
+static char *lretained =
+    "Retained login of Target %d (Loop ID 0x%x) Port 0x%x";
+static char *plogout =
+    "Logging out Target %d at Loop ID 0x%x (Port 0x%x)";
+static char *plogierr =
+    "Command Error in PLOGI for Port 0x%x (0x%x)";
+static char *nopdb =
+    "Could not get PDB for Device @ Port 0x%x";
+static char *pdbmfail1 =
+    "PDB Loop ID info for Device @ Port 0x%x does not match up (0x%x)";
+static char *pdbmfail2 =
+    "PDB Port info for Device @ Port 0x%x does not match up (0x%x)";
+static char *ldumped =
+    "Target %d (Loop ID 0x%x) Port 0x%x dumped after login info mismatch";
+#endif
+static char *notresp =
+  "Not RESPONSE in RESPONSE Queue (type 0x%x) @ idx %d (next %d)";
+static char *xact1 =
+    "HBA attempted queued transaction with disconnect not set for %d.%d.%d";
+static char *xact2 =
+    "HBA attempted queued transaction to target routine %d on target %d bus %d";
+static char *xact3 =
+    "HBA attempted queued cmd for %d.%d.%d when queueing disabled";
+static char *pskip =
+    "SCSI phase skipped for target %d.%d.%d";
+static char *topology =
+    "Loop ID %d, AL_PA 0x%x, Port ID 0x%x, Loop State 0x%x, Topology '%s'";
+static char *finmsg =
+    "(%d.%d.%d): FIN dl%d resid%d STS 0x%x SKEY %c XS_ERR=0x%x";
 /*
  * Local function prototypes.
  */
@@ -72,7 +112,7 @@
 static int isp_handle_other_response
 __P((struct ispsoftc *, ispstatusreq_t *, u_int16_t *));
 static void isp_parse_status
-__P((struct ispsoftc *, ispstatusreq_t *, ISP_SCSI_XFER_T *));
+__P((struct ispsoftc *, ispstatusreq_t *, XS_T *));
 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));
@@ -81,14 +121,14 @@
 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 char *isp2100_fw_statename __P((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_mboxcmd __P((struct ispsoftc *, mbreg_t *));
+static void isp_mboxcmd __P((struct ispsoftc *, mbreg_t *, int));
 
 static void isp_update __P((struct ispsoftc *));
 static void isp_update_bus __P((struct ispsoftc *, int));
@@ -100,7 +140,6 @@
 static void isp_parse_nvram_12160 __P((struct ispsoftc *, int, u_int8_t *));
 static void isp_parse_nvram_2100 __P((struct ispsoftc *, u_int8_t *));
 
-
 /*
  * Reset Hardware.
  *
@@ -118,16 +157,14 @@
 
        isp->isp_state = ISP_NILSTATE;
 
+
        /*
         * Basic types (SCSI, FibreChannel and PCI or SBus)
         * have been set in the MD code. We figure out more
         * here.
-        */
-       isp->isp_dblev = DFLT_DBLEVEL;
-
-       /*
+        *
         * After we've fired this chip up, zero out the conf1 register
-        * for SCSI adapters and other settings for the 2100.
+        * for SCSI adapters and do other settings for the 2100.
         */
 
        /*
@@ -140,19 +177,27 @@
         */
        if ((touched = isp->isp_touched) == 0) {
                /*
-                * Just in case it was paused...
+                * First see whether or not we're sitting in the ISP PROM.
+                * If we've just been reset, we'll have the string "ISP   "
+                * spread through outgoing mailbox registers 1-3.
                 */
-               ISP_WRITE(isp, HCCR, HCCR_CMD_RELEASE);
-               mbs.param[0] = MBOX_ABOUT_FIRMWARE;
-               isp_mboxcmd(isp, &mbs);
-               /*
-                * 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];
+               if (ISP_READ(isp, OUTMAILBOX1) != 0x4953 ||
+                   ISP_READ(isp, OUTMAILBOX2) != 0x5020 ||
+                   ISP_READ(isp, OUTMAILBOX3) != 0x2020) {
+                       /*
+                        * Just in case it was paused...
+                        */
+                       ISP_WRITE(isp, HCCR, HCCR_CMD_RELEASE);
+                       mbs.param[0] = MBOX_ABOUT_FIRMWARE;
+                       isp_mboxcmd(isp, &mbs, MBLOGNONE);
+                       /*
+                        * This *shouldn't* fail.....
+                        */
+                       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_touched = 1;
        }
@@ -187,7 +232,7 @@
                 * XXX: Should probably do some bus sensing.
                 */
        } else if (IS_ULTRA2(isp)) {
-               static char *m = "%s: bus %d is in %s Mode\n";
+               static char *m = "bus %d is in %s Mode";
                u_int16_t l;
                sdparam *sdp = isp->isp_param;
 
@@ -206,19 +251,19 @@
                switch (l) {
                case ISP1080_LVD_MODE:
                        sdp->isp_lvdmode = 1;
-                       CFGPRINTF(m, isp->isp_name, 0, "LVD");
+                       isp_prt(isp, ISP_LOGCONFIG, m, 0, "LVD");
                        break;
                case ISP1080_HVD_MODE:
                        sdp->isp_diffmode = 1;
-                       CFGPRINTF(m, isp->isp_name, 0, "Differential");
+                       isp_prt(isp, ISP_LOGCONFIG, m, 0, "Differential");
                        break;
                case ISP1080_SE_MODE:
                        sdp->isp_ultramode = 1;
-                       CFGPRINTF(m, isp->isp_name, 0, "Single-Ended");
+                       isp_prt(isp, ISP_LOGCONFIG, m, 0, "Single-Ended");
                        break;
                default:
-                       CFGPRINTF("%s: unknown mode on bus %d (0x%x)\n",
-                           isp->isp_name, 0, l);
+                       isp_prt(isp, ISP_LOGERR,
+                           "unknown mode on bus %d (0x%x)", 0, l);
                        break;
                }
 
@@ -229,19 +274,21 @@
                        switch(l) {
                        case ISP1080_LVD_MODE:
                                sdp->isp_lvdmode = 1;
-                               CFGPRINTF(m, isp->isp_name, 1, "LVD");
+                               isp_prt(isp, ISP_LOGCONFIG, m, 1, "LVD");
                                break;
                        case ISP1080_HVD_MODE:
                                sdp->isp_diffmode = 1;
-                               CFGPRINTF(m, isp->isp_name, 1, "Differential");
+                               isp_prt(isp, ISP_LOGCONFIG,
+                                   m, 1, "Differential");
                                break;
                        case ISP1080_SE_MODE:
                                sdp->isp_ultramode = 1;
-                               CFGPRINTF(m, isp->isp_name, 1, "Single-Ended");
+                               isp_prt(isp, ISP_LOGCONFIG,
+                                   m, 1, "Single-Ended");
                                break;
                        default:
-                               CFGPRINTF("%s: unknown mode on bus %d (0x%x)\n",
-                                   isp->isp_name, 1, l);
+                               isp_prt(isp, ISP_LOGERR,
+                                   "unknown mode on bus %d (0x%x)", 1, l);
                                break;
                        }
                }
@@ -250,8 +297,7 @@
                i = ISP_READ(isp, BIU_CONF0) & BIU_CONF0_HW_MASK;
                switch (i) {
                default:
-                       PRINTF("%s: unknown chip rev. 0x%x- assuming a 1020\n",
-                           isp->isp_name, i);
+                       isp_prt(isp, ISP_LOGALL, "Unknown Chip Type 0x%x", i);
                        /* FALLTHROUGH */
                case 1:
                        revname = "1020";
@@ -294,7 +340,7 @@
                 * and/or differential mode.
                 */
                if (ISP_READ(isp, SXP_PINS_DIFF) & SXP_PINS_DIFF_MODE) {
-                       CFGPRINTF("%s: Differential Mode\n", isp->isp_name);
+                       isp_prt(isp, ISP_LOGCONFIG, "Differential Mode");
                        sdp->isp_diffmode = 1;
                } else {
                        sdp->isp_diffmode = 0;
@@ -306,7 +352,7 @@
                        i &= RISC_PSR_PCI_ULTRA;
                }
                if (i != 0) {
-                       CFGPRINTF("%s: Ultra Mode Capable\n", isp->isp_name);
+                       isp_prt(isp, ISP_LOGCONFIG, "Ultra Mode Capable");
                        sdp->isp_ultramode = 1;
                        /*
                         * If we're in Ultra Mode, we have to be 60Mhz clock-
@@ -349,15 +395,7 @@
                /*
                 * A slight delay...
                 */
-               SYS_DELAY(100);
-
-#if    0
-               PRINTF("%s: mbox0-5: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n",
-                   isp->isp_name, ISP_READ(isp, OUTMAILBOX0),
-                   ISP_READ(isp, OUTMAILBOX1), ISP_READ(isp, OUTMAILBOX2),
-                   ISP_READ(isp, OUTMAILBOX3), ISP_READ(isp, OUTMAILBOX4),
-                   ISP_READ(isp, OUTMAILBOX5));
-#endif
+               USEC_DELAY(100);
 
                /*
                 * Clear data && control DMA engines.
@@ -373,7 +411,7 @@
                /*
                 * A slight delay...
                 */
-               SYS_DELAY(100);
+               USEC_DELAY(100);
 
                /*
                 * Clear data && control DMA engines.
@@ -398,9 +436,9 @@
                        if (!(ISP_READ(isp, BIU2100_CSR) & BIU2100_SOFT_RESET))
                                break;
                }
-               SYS_DELAY(100);
+               USEC_DELAY(100);
                if (--loops < 0) {
-                       isp_dumpregs(isp, "chip reset timed out");
+                       ISP_DUMPREGS(isp, "chip reset timed out");
                        return;
                }
        }
@@ -420,7 +458,7 @@
         * Reset RISC Processor
         */
        ISP_WRITE(isp, HCCR, HCCR_CMD_RESET);
-       SYS_DELAY(100);
+       USEC_DELAY(100);
 
        /*
         * Establish some initial burst rate stuff.
@@ -472,10 +510,10 @@
         */
        loops = MBOX_DELAY_COUNT;
        while (ISP_READ(isp, OUTMAILBOX0) == MBOX_BUSY) {
-               SYS_DELAY(100);



Home | Main Index | Thread Index | Old Index