summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authormjacob <mjacob@cvs.openbsd.org>2000-12-06 01:07:24 +0000
committermjacob <mjacob@cvs.openbsd.org>2000-12-06 01:07:24 +0000
commitc70f3f9f0bbbc52b0552703642baf6b5d4ea3975 (patch)
tree0a5ac0f3aee2621f25501c6b87ef8af732fca14a /sys/dev
parenta3c56baf1776d67e865aedba84545540a5da2da0 (diff)
Update isp codebase to current common head- USEC_SLEEP macro added,
instrumentation for interrupts, specific topology preferences for the 2200. Fix the hole in the OpenBSD port becuause there'd been no maxluns limit from the midlayer and have the command routine bounce commands > the maxluns for a particular controller (in particular, Qlogic FC cards where we can't tell when it hasn't been us that have loaded the F/W whether or not SCCLUN is in effect or not).
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/isp.c52
-rw-r--r--sys/dev/ic/isp_openbsd.c8
-rw-r--r--sys/dev/ic/isp_openbsd.h26
-rw-r--r--sys/dev/ic/ispvar.h14
4 files changed, 72 insertions, 28 deletions
diff --git a/sys/dev/ic/isp.c b/sys/dev/ic/isp.c
index 66c3403a77e..ef4c101a4dd 100644
--- a/sys/dev/ic/isp.c
+++ b/sys/dev/ic/isp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: isp.c,v 1.17 2000/10/16 01:01:58 mjacob Exp $ */
+/* $OpenBSD: isp.c,v 1.18 2000/12/06 01:07:21 mjacob Exp $ */
/*
* Machine and OS Independent (well, as best as possible)
* code for the Qlogic ISP SCSI adapters.
@@ -89,7 +89,7 @@ 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)";
+ "Not RESPONSE in RESPONSE Queue (type 0x%x) @ idx %d (next %d) nlooked %d";
static char *xact1 =
"HBA attempted queued transaction with disconnect not set for %d.%d.%d";
static char *xact2 =
@@ -376,6 +376,11 @@ isp_reset(isp)
}
/*
+ * Clear instrumentation
+ */
+ isp->isp_intcnt = isp->isp_intbogus = 0;
+
+ /*
* Do MD specific pre initialization
*/
ISP_RESET0(isp);
@@ -609,7 +614,7 @@ again:
mbs.param[1] = ISP_CODE_ORG;
isp_mboxcmd(isp, &mbs, MBLOGNONE);
/* give it a chance to start */
- USEC_DELAY(500);
+ USEC_SLEEP(isp, 500);
if (IS_SCSI(isp)) {
/*
@@ -1078,10 +1083,20 @@ isp_fibre_init(isp)
/*
* Prefer or force Point-To-Point instead Loop?
*/
- if (isp->isp_confopts & ISP_CFG_NPORT)
+ switch(isp->isp_confopts & ISP_CFG_PORT_PREF) {
+ case ISP_CFG_NPORT:
icbp->icb_xfwoptions = ICBXOPT_PTP_2_LOOP;
- else
+ break;
+ case ISP_CFG_NPORT_ONLY:
+ icbp->icb_xfwoptions = ICBXOPT_PTP_ONLY;
+ break;
+ case ISP_CFG_LPORT_ONLY:
+ icbp->icb_xfwoptions = ICBXOPT_LOOP_ONLY;
+ break;
+ default:
icbp->icb_xfwoptions = ICBXOPT_LOOP_2_PTP;
+ break;
+ }
}
icbp->icb_logintime = 60; /* 60 second login timeout */
@@ -1291,11 +1306,11 @@ isp_fclink_test(isp, usdelay)
count += 1000;
enano = (1000 * 1000) - enano;
while (enano > (u_int64_t) 4000000000U) {
- USEC_DELAY(4000000);
+ USEC_SLEEP(isp, 4000000);
enano -= (u_int64_t) 4000000000U;
}
wrk = enano;
- USEC_DELAY(wrk/1000);
+ USEC_SLEEP(isp, wrk/1000);
} else {
while (enano > (u_int64_t) 4000000000U) {
count += 4000000;
@@ -2487,7 +2502,9 @@ isp_intr(arg)
isp_prt(isp, ISP_LOGDEBUG3, "isp_intr isr %x sem %x", isr, sema);
isr &= INT_PENDING_MASK(isp);
sema &= BIU_SEMA_LOCK;
+ isp->isp_intcnt++;
if (isr == 0 && sema == 0) {
+ isp->isp_intbogus++;
return (0);
}
@@ -2622,7 +2639,12 @@ isp_intr(arg)
*/
if (sp->req_header.rqs_entry_type != RQSTYPE_REQUEST) {
isp_prt(isp, ISP_LOGERR, notresp,
- sp->req_header.rqs_entry_type, oop, optr);
+ sp->req_header.rqs_entry_type, oop, optr,
+ nlooked);
+ if (isp->isp_dblev & ISP_LOGDEBUG0) {
+ isp_print_bytes(isp, "Queue Entry",
+ QENTRY_LEN, sp);
+ }
MEMZERO(sp, sizeof (isphdr_t));
continue;
}
@@ -2850,6 +2872,9 @@ isp_parse_async(isp, mbox)
isp_prt(isp, ISP_LOGERR,
"Internal FW Error @ RISC Addr 0x%x", mbox);
isp_reinit(isp);
+#ifdef ISP_TARGET_MODE
+ isp_target_async(isp, bus, mbox);
+#endif
/* no point continuing after this */
return (-1);
@@ -3054,6 +3079,9 @@ isp_parse_async(isp, mbox)
case ISP_CONN_FATAL:
isp_prt(isp, ISP_LOGERR, "FATAL CONNECTION ERROR");
isp_reinit(isp);
+#ifdef ISP_TARGET_MODE
+ isp_target_async(isp, bus, ASYNC_SYSTEM_ERROR);
+#endif
/* no point continuing after this */
return (-1);
@@ -3127,7 +3155,7 @@ isp_parse_status(isp, sp, xs)
if ((sp->req_state_flags & RQSF_GOT_TARGET) == 0) {
isp_prt(isp, ISP_LOGDEBUG1,
"Selection Timeout for %d.%d.%d",
- XS_TGT(xs), XS_LUN(xs), XS_CHANNEL(xs));
+ XS_CHANNEL(xs), XS_TGT(xs), XS_LUN(xs));
if (XS_NOERR(xs)) {
XS_SETERR(xs, HBA_SELTIMEOUT);
}
@@ -3996,12 +4024,6 @@ isp_mboxcmd(isp, mbp, logmask)
ISP_WRITE(isp, HCCR, HCCR_CMD_SET_HOST_INT);
/*
- * Give the f/w a chance to pick this up.
- */
- USEC_DELAY(250);
-
-
- /*
* While we haven't finished the command, spin our wheels here.
*/
MBOX_WAIT_COMPLETE(isp);
diff --git a/sys/dev/ic/isp_openbsd.c b/sys/dev/ic/isp_openbsd.c
index eaa7402c86a..14e0ada0721 100644
--- a/sys/dev/ic/isp_openbsd.c
+++ b/sys/dev/ic/isp_openbsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: isp_openbsd.c,v 1.13 2000/10/16 22:45:00 mjacob Exp $ */
+/* $OpenBSD: isp_openbsd.c,v 1.14 2000/12/06 01:07:22 mjacob Exp $ */
/*
* Platform (OpenBSD) dependent common attachment code for Qlogic adapters.
*
@@ -296,6 +296,7 @@ ispcmd(xs)
struct ispsoftc *isp;
int result;
+
/*
* Make sure that there's *some* kind of sane setting.
*/
@@ -304,6 +305,11 @@ ispcmd(xs)
isp = XS_ISP(xs);
+ if (XS_LUN(xs) >= isp->isp_maxluns) {
+ xs->error = XS_SELTIMEOUT;;
+ return (COMPLETE);
+ }
+
ISP_LOCK(isp);
if (isp->isp_state < ISP_RUNSTATE) {
DISABLE_INTS(isp);
diff --git a/sys/dev/ic/isp_openbsd.h b/sys/dev/ic/isp_openbsd.h
index 1d8d2c511ae..92311aa2167 100644
--- a/sys/dev/ic/isp_openbsd.h
+++ b/sys/dev/ic/isp_openbsd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: isp_openbsd.h,v 1.10 2000/10/16 01:02:00 mjacob Exp $ */
+/* $OpenBSD: isp_openbsd.h,v 1.11 2000/12/06 01:07:23 mjacob Exp $ */
/*
* OpenBSD Specific definitions for the Qlogic ISP Host Adapter
*/
@@ -75,6 +75,14 @@ struct isposinfo {
struct scsi_xfer *wqf, *wqt;
struct timeout rqt;
};
+#define MUST_POLL(isp) \
+ (isp->isp_osinfo.onintstack || isp->isp_osinfo.no_mbox_ints)
+
+/*
+ * Locking macros...
+ */
+#define ISP_LOCK isp_lock
+#define ISP_UNLOCK isp_unlock
/*
* Required Macros/Defines
@@ -90,6 +98,12 @@ struct isposinfo {
#define SNPRINTF snprintf
#define STRNCAT strncat
#define USEC_DELAY(x) delay(x)
+#define USEC_SLEEP(isp, x) \
+ if (!MUST_POLL(isp)) \
+ ISP_UNLOCK(isp); \
+ delay(x); \
+ if (!MUST_POLL(isp)) \
+ ISP_LOCK(isp)
#define NANOTIME_T struct timeval
#define GET_NANOTIME microtime
@@ -234,14 +248,6 @@ static void isp_wait_complete __P((struct ispsoftc *));
* Driver wide data...
*/
-/*
- * Locking macros...
- */
-#define ISP_LOCK isp_lock
-#define ISP_UNLOCK isp_unlock
-#define ISP_ILOCK(x) isp_lock(x); isp->isp_osinfo.onintstack++
-#define ISP_IUNLOCK(x) isp->isp_osinfo.onintstack--; isp_unlock(x)
-
/*
* Platform private flags
*/
@@ -328,7 +334,7 @@ static inline void
isp_wait_complete(isp)
struct ispsoftc *isp;
{
- if (isp->isp_osinfo.onintstack || isp->isp_osinfo.no_mbox_ints) {
+ if (MUST_POLL(isp)) {
int usecs = 0;
while (usecs < 2 * 1000000) {
(void) isp_intr(isp);
diff --git a/sys/dev/ic/ispvar.h b/sys/dev/ic/ispvar.h
index c0daaa3ab6b..d7a96e7f3eb 100644
--- a/sys/dev/ic/ispvar.h
+++ b/sys/dev/ic/ispvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ispvar.h,v 1.12 2000/10/16 01:02:01 mjacob Exp $ */
+/* $OpenBSD: ispvar.h,v 1.13 2000/12/06 01:07:23 mjacob Exp $ */
/*
* Soft Definitions for for Qlogic ISP SCSI adapters.
*
@@ -337,6 +337,11 @@ typedef struct ispsoftc {
isp_dblev : 12, /* debug log mask */
isp_clock : 8, /* input clock */
isp_confopts : 8; /* config options */
+ /*
+ * Instrumentation
+ */
+ u_int64_t isp_intcnt; /* total int count */
+ u_int64_t isp_intbogus; /* spurious int count */
/*
* Volatile state
@@ -387,7 +392,11 @@ typedef struct ispsoftc {
#define ISP_CFG_NONVRAM 0x40 /* ignore NVRAM */
#define ISP_CFG_FULL_DUPLEX 0x01 /* Full Duplex (Fibre Channel only) */
#define ISP_CFG_OWNWWN 0x02 /* override NVRAM wwn */
-#define ISP_CFG_NPORT 0x04 /* try to force N- instead of L-Port */
+#define ISP_CFG_PORT_PREF 0x0C /* Mask for Port Prefs (2200 only) */
+#define ISP_CFG_LPORT 0x00 /* prefer {N/F}L-Port connection */
+#define ISP_CFG_NPORT 0x04 /* prefer {N/F}-Port connection */
+#define ISP_CFG_NPORT_ONLY 0x08 /* insist on {N/F}-Port connection */
+#define ISP_CFG_LPORT_ONLY 0x0C /* insist on {N/F}L-Port connection */
/*
* Firmware related defines
@@ -556,6 +565,7 @@ void isp_prt __P((struct ispsoftc *, int level, const char *, ...));
* SNPRINTF(buf, bufsize, fmt, ...) snprintf
* STRNCAT(dstbuf, size, srcbuf) strncat
* USEC_DELAY(usecs) microsecond spindelay function
+ * USEC_SLEEP(isp, usecs) microsecond sleep function
*
* NANOTIME_T nanosecond time type
*