Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/sys/dev Complete rewrite of internals for isp core vers...
details: https://anonhg.NetBSD.org/src/rev/304349735f2c
branches: netbsd-1-5
changeset: 489296:304349735f2c
user: mjacob <mjacob%NetBSD.org@localhost>
date: Mon Aug 28 17:42:18 2000 +0000
description:
Complete rewrite of internals for isp core version 2.0.
Pullup to netbsd-1-5 approved by thorpej%netbsd.org@localhost.
diffstat:
sys/dev/ic/isp.c | 3283 +-
sys/dev/ic/isp_inline.h | 168 +-
sys/dev/ic/isp_netbsd.c | 619 +-
sys/dev/ic/isp_netbsd.h | 470 +-
sys/dev/ic/isp_target.c | 333 +-
sys/dev/ic/isp_target.h | 47 +-
sys/dev/ic/isp_tpublic.h | 31 +-
sys/dev/ic/ispmbox.h | 79 +-
sys/dev/ic/ispreg.h | 76 +-
sys/dev/ic/ispvar.h | 298 +-
sys/dev/microcode/isp/asm_1040.h | 3530 +++
sys/dev/microcode/isp/asm_1080.h | 4428 ++++
sys/dev/microcode/isp/asm_12160.h | 2465 ++
sys/dev/microcode/isp/asm_2100.h | 4657 +++++
sys/dev/microcode/isp/asm_2200.h | 5364 +++++
sys/dev/microcode/isp/asm_pci.h | 32639 ------------------------------------
sys/dev/pci/isp_pci.c | 395 +-
sys/dev/sbus/isp_sbus.c | 215 +-
18 files changed, 23921 insertions(+), 35176 deletions(-)
diffs (truncated from 62475 to 300 lines):
diff -r e1a7b204fc08 -r 304349735f2c sys/dev/ic/isp.c
--- a/sys/dev/ic/isp.c Mon Aug 28 16:16:24 2000 +0000
+++ b/sys/dev/ic/isp.c Mon Aug 28 17:42:18 2000 +0000
@@ -1,35 +1,64 @@
-/* $NetBSD: isp.c,v 1.53.2.1 2000/08/11 22:24:46 tls Exp $ */
+/* $NetBSD: isp.c,v 1.53.2.2 2000/08/28 17:45:07 mjacob Exp $ */
/*
- * Copyright (C) 1997, 1998, 1999 National Aeronautics & Space Administration
+ * This driver, which is contained in NetBSD in the files:
+ *
+ * sys/dev/ic/isp.c
+ * sys/dev/ic/ic/isp.c
+ * sys/dev/ic/ic/isp_inline.h
+ * sys/dev/ic/ic/isp_netbsd.c
+ * sys/dev/ic/ic/isp_netbsd.h
+ * sys/dev/ic/ic/isp_target.c
+ * sys/dev/ic/ic/isp_target.h
+ * sys/dev/ic/ic/isp_tpublic.h
+ * sys/dev/ic/ic/ispmbox.h
+ * sys/dev/ic/ic/ispreg.h
+ * sys/dev/ic/ic/ispvar.h
+ * sys/microcode/isp/asm_sbus.h
+ * sys/microcode/isp/asm_1040.h
+ * sys/microcode/isp/asm_1080.h
+ * sys/microcode/isp/asm_12160.h
+ * sys/microcode/isp/asm_2100.h
+ * sys/microcode/isp/asm_2200.h
+ * sys/pci/isp_pci.c
+ * sys/sbus/isp_sbus.c
+ *
+ * Is being actively maintained by Matthew Jacob (mjacob%netbsd.org@localhost).
+ * This driver also is shared source with FreeBSD, OpenBSD, Linux, Solaris,
+ * Linux versions. This tends to be an interesting maintenance problem.
+ *
+ * Please coordinate with Matthew Jacob on changes you wish to make here.
+ */
+/*
+ * Machine and OS Independent (well, as best as possible)
+ * code for the Qlogic ISP SCSI adapters.
+ *
+ * Copyright (c) 1997, 1998, 1999 by Matthew Jacob
+ * NASA/Ames Research Center
* 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, this list of conditions and the following disclaimer.
+ * notice immediately at the beginning of the file, without modification,
+ * 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 ``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>
+ * 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.
*/
/*
@@ -54,6 +83,9 @@
#ifdef __linux__
#include "isp_linux.h"
#endif
+#ifdef __svr4__
+#include "isp_solaris.h"
+#endif
/*
* General defines
@@ -64,7 +96,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 +141,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 +150,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 +169,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.
*
@@ -113,21 +181,19 @@
struct ispsoftc *isp;
{
mbreg_t mbs;
- int loops, i, dodnld = 1;
+ int loops, i, touched, dodnld = 1;
char *revname;
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.
*/
/*
@@ -138,21 +204,29 @@
* case, we don't really use this yet, but we may in
* the future.
*/
- 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 ((touched = isp->isp_touched) == 0) {
/*
- * If this fails, it probably means we're running
- * an old prom, if anything at all...
+ * 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.
*/
- 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 +261,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 +280,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 +303,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;
Home |
Main Index |
Thread Index |
Old Index