Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev add isp1080 support and some basic PDB change stuff
details: https://anonhg.NetBSD.org/src/rev/2d822f9ce20b
branches: trunk
changeset: 467646:2d822f9ce20b
user: mjacob <mjacob%NetBSD.org@localhost>
date: Fri Mar 26 22:39:44 1999 +0000
description:
add isp1080 support and some basic PDB change stuff
diffstat:
sys/dev/ic/isp.c | 472 ++++++++++++++++++++++++++++-------------------
sys/dev/ic/isp_netbsd.c | 41 +++-
sys/dev/ic/isp_netbsd.h | 7 +-
sys/dev/ic/ispmbox.h | 4 +-
sys/dev/ic/ispreg.h | 31 ++-
sys/dev/ic/ispvar.h | 27 +-
sys/dev/pci/isp_pci.c | 4 +-
7 files changed, 351 insertions(+), 235 deletions(-)
diffs (truncated from 1294 to 300 lines):
diff -r 5e2a4c4faa0e -r 2d822f9ce20b sys/dev/ic/isp.c
--- a/sys/dev/ic/isp.c Fri Mar 26 22:36:02 1999 +0000
+++ b/sys/dev/ic/isp.c Fri Mar 26 22:39:44 1999 +0000
@@ -1,14 +1,12 @@
-/* $NetBSD: isp.c,v 1.33 1999/03/17 06:15:47 mjacob Exp $ */
-/* release_03_16_99 */
+/* $NetBSD: isp.c,v 1.34 1999/03/26 22:39:44 mjacob Exp $ */
+/* release_03_25_99 */
/*
* Machine and OS Independent (well, as best as possible)
* code for the Qlogic ISP SCSI adapters.
*
- *---------------------------------------
* Copyright (c) 1997, 1998 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
@@ -113,7 +111,7 @@
static void isp_fibre_init __P((struct ispsoftc *));
static void isp_mark_getpdb_all __P((struct ispsoftc *));
static int isp_getpdb __P((struct ispsoftc *, int, isp_pdb_t *));
-static int isp_fclink_test __P((struct ispsoftc *));
+static int isp_fclink_test __P((struct ispsoftc *, int));
static void isp_fw_state __P((struct ispsoftc *));
static void isp_dumpregs __P((struct ispsoftc *, const char *));
static void isp_dumpxflist __P((struct ispsoftc *));
@@ -189,11 +187,33 @@
if (IS_FC(isp)) {
revname = "2100";
} else if (IS_1080(isp)) {
+ u_int16_t l;
sdparam *sdp = isp->isp_param;
revname = "1080";
- sdp->isp_clock = 0; /* don't set clock */
- sdp->isp_diffmode = 1;
- sdp->isp_ultramode = 1;
+ sdp->isp_clock = 100;
+ l = ISP_READ(isp, SXP_PINS_DIFF) & ISP1080_MODE_MASK;
+ switch (l) {
+ case ISP1080_LVD_MODE:
+ sdp->isp_lvdmode = 1;
+ PRINTF("%s: LVD Mode\n", isp->isp_name);
+ break;
+ case ISP1080_HVD_MODE:
+ sdp->isp_diffmode = 1;
+ PRINTF("%s: Differential Mode\n", isp->isp_name);
+ break;
+ case ISP1080_SE_MODE:
+ sdp->isp_ultramode = 1;
+ PRINTF("%s: Single-Ended Mode\n", isp->isp_name);
+ break;
+ default:
+ /*
+ * Hmm. Up in a wierd mode. This means all SCSI I/O
+ * buffer lines are tristated, so we're in a lot of
+ * trouble if we don't set things up right.
+ */
+ PRINTF("%s: Illegal Mode 0x%x\n", isp->isp_name, l);
+ break;
+ }
} else {
sdparam *sdp = isp->isp_param;
i = ISP_READ(isp, BIU_CONF0) & BIU_CONF0_HW_MASK;
@@ -203,7 +223,7 @@
isp->isp_name, i);
/* FALLTHROUGH */
case 1:
- revname = "1020";
+ revname = "1020";
isp->isp_type = ISP_HA_SCSI_1020;
sdp->isp_clock = 40;
break;
@@ -213,7 +233,7 @@
* run the clock rate up for that unless told to
* do so by the Ultra Capable bits being set.
*/
- revname = "1020A";
+ revname = "1020A";
isp->isp_type = ISP_HA_SCSI_1020A;
sdp->isp_clock = 40;
break;
@@ -257,7 +277,7 @@
* even for the SBus version.
*/
sdp->isp_clock = 60;
- } else {
+ } else {
sdp->isp_ultramode = 0;
/*
* Clock is known. Gronk.
@@ -307,9 +327,9 @@
* Clear data && control DMA engines.
*/
ISP_WRITE(isp, CDMA_CONTROL,
- DMA_CNTRL_CLEAR_CHAN | DMA_CNTRL_RESET_INT);
+ DMA_CNTRL_CLEAR_CHAN | DMA_CNTRL_RESET_INT);
ISP_WRITE(isp, DDMA_CONTROL,
- DMA_CNTRL_CLEAR_CHAN | DMA_CNTRL_RESET_INT);
+ DMA_CNTRL_CLEAR_CHAN | DMA_CNTRL_RESET_INT);
} else {
@@ -386,11 +406,11 @@
}
#ifdef PTI_CARDS
if (((sdparam *) isp->isp_param)->isp_ultramode) {
- while(ISP_READ(isp, RISC_MTR) != 0x1313) {
+ while (ISP_READ(isp, RISC_MTR) != 0x1313) {
ISP_WRITE(isp, RISC_MTR, 0x1313);
ISP_WRITE(isp, HCCR, HCCR_CMD_STEP);
}
- } else {
+ } else {
ISP_WRITE(isp, RISC_MTR, 0x1212);
}
/*
@@ -550,7 +570,7 @@
PRINTF("%s: Board Revision %s, %s F/W Revision %d.%d\n",
isp->isp_name, revname, dodnld? "loaded" : "resident",
mbs.param[1], mbs.param[2]);
- if (isp->isp_type & ISP_HA_FC) {
+ if (IS_FC(isp)) {
if (ISP_READ(isp, BIU2100_CSR) & BIU2100_PCI64) {
PRINTF("%s: in 64-Bit PCI slot\n", isp->isp_name);
}
@@ -590,7 +610,7 @@
PRINTF("%s: can't setup dma mailboxes\n", isp->isp_name);
return;
}
-
+
/*
* If we're fibre, we have a completely different
* initialization method.
@@ -693,27 +713,25 @@
/*
* It is not quite clear when this changed over so that
* we could force narrow and async, so assume >= 7.55.
- *
- * Otherwise, a SCSI bus reset issued below will force
- * the back to the narrow, async state (but see note
- * below also). Technically we should also do without
- * Parity.
*/
if (isp->isp_fwrev >= ISP_FW_REV(7, 55)) {
sdf |= DPARM_NARROW | DPARM_ASYNC;
}
-
mbs.param[0] = MBOX_SET_TARGET_PARAMS;
mbs.param[1] = tgt << 8;
mbs.param[2] = sdf;
- mbs.param[3] = 0;
+ mbs.param[3] =
+ (sdp->isp_devparam[tgt].sync_offset << 8) |
+ (sdp->isp_devparam[tgt].sync_period);
isp_mboxcmd(isp, &mbs);
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
sdf = DPARM_SAFE_DFLT;
mbs.param[0] = MBOX_SET_TARGET_PARAMS;
mbs.param[1] = tgt << 8;
mbs.param[2] = sdf;
- mbs.param[3] = 0;
+ mbs.param[3] =
+ (sdp->isp_devparam[tgt].sync_offset << 8) |
+ (sdp->isp_devparam[tgt].sync_period);
isp_mboxcmd(isp, &mbs);
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
PRINTF("%s: failed even to set defaults for "
@@ -721,7 +739,33 @@
continue;
}
}
- sdp->isp_devparam[tgt].cur_dflags = sdf;
+ /*
+ * We don't update dev_flags with what we've set
+ * because that's not the ultimate goal setting.
+ * If we succeed with the command, we *do* update
+ * cur_dflags by getting target parameters.
+ */
+ mbs.param[0] = MBOX_GET_TARGET_PARAMS;
+ mbs.param[1] = (tgt << 8);
+ isp_mboxcmd(isp, &mbs);
+ if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
+ /*
+ * Urrr.... We'll set cur_dflags to DPARM_SAFE_DFLT so
+ * we don't try and do tags if tags aren't enabled.
+ */
+ sdp->isp_devparam[tgt].cur_dflags = DPARM_SAFE_DFLT;
+ } else {
+ sdp->isp_devparam[tgt].cur_dflags = mbs.param[2];
+ sdp->isp_devparam[tgt].cur_offset = mbs.param[3] >> 8;
+ sdp->isp_devparam[tgt].cur_period = mbs.param[3] & 0xff;
+ }
+ /*
+ * Ensure that we don't believe tagged queuing is enabled yet.
+ * It turns out that sometimes the ISP just ignores our
+ * attempts to set parameters for devices that it hasn't
+ * seen yet.
+ */
+ sdp->isp_devparam[tgt].cur_dflags &= ~DPARM_TQING;
maxlun = (isp->isp_fwrev >= ISP_FW_REV(7, 55))? 32 : 8;
for (lun = 0; lun < maxlun; lun++) {
@@ -770,25 +814,32 @@
isp->isp_reqidx = isp->isp_reqodx = 0;
/*
- * Turn on Fast Posting
+ * Turn on Fast Posting, LVD transitions
*/
-#ifndef ISP_NO_FASTPOST_SCSI
- if (isp->isp_fwrev >= ISP_FW_REV(7, 55)) {
+
+ if (IS_1080(isp) || isp->isp_fwrev >= ISP_FW_REV(7, 55)) {
mbs.param[0] = MBOX_SET_FW_FEATURES;
- mbs.param[1] = FW_FEATURE_FAST_POST;
- isp_mboxcmd(isp, &mbs);
- if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
- PRINTF("%s: unable to enable FAST Posting\n",
- isp->isp_name);
+#ifndef ISP_NO_FASTPOST_SCSI
+ mbs.param[1] |= FW_FEATURE_FAST_POST;
+#else
+ mbs.param[1] = 0;
+#endif
+ if (IS_1080(isp))
+ mbs.param[1] |= FW_FEATURE_LVD_NOTIFY;
+ if (mbs.param[1] != 0) {
+ isp_mboxcmd(isp, &mbs);
+ if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
+ PRINTF("%s: unable enable FW features\n",
+ isp->isp_name);
+ }
}
}
-#endif
/*
* Let the outer layers decide whether to issue a SCSI bus reset.
*/
#if 0
- /*
+ /*
* XXX: See whether or not for 7.55 F/W or later we
* XXX: can do without this, and see whether we should
* XXX: honor the NVRAM SCSI_RESET_DISABLE token.
@@ -944,6 +995,8 @@
isp->isp_state = ISP_INITSTATE;
fcp->isp_fwstate = FW_CONFIG_WAIT;
+ isp_mark_getpdb_all(isp);
+
#ifdef ISP_TARGET_MODE
if (isp_modify_lun(isp, 0, 1, 1)) {
PRINTF("%s: failed to enable target mode\n", isp->isp_name);
@@ -975,31 +1028,19 @@
int id;
isp_pdb_t *pdbp;
{
-#ifdef GETPDB_WORKING_YET
fcparam *fcp = (fcparam *) isp->isp_param;
mbreg_t mbs;
-
- /*
- * Get Port Queue Parameters first- this is
- * a Q&D way to see whether we're logged into
- * this port.
- */
- mbs.param[0] = MBOX_GET_DEV_QUEUE_PARAMS;
- mbs.param[1] = id << 8;
- mbs.param[2] = 0;
-#ifdef ISP2100_SCCLUN
- mbs.param[3] = 0;
-#endif
- isp_mboxcmd(isp, &mbs);
- if (mbs.param[0] != MBOX_COMMAND_COMPLETE)
- return (-1);
-
mbs.param[0] = MBOX_GET_PORT_DB;
mbs.param[1] = id << 8;
mbs.param[2] = (u_int16_t) (fcp->isp_scdma >> 16);
mbs.param[3] = (u_int16_t) (fcp->isp_scdma & 0xffff);
- mbs.param[4] = 0;
- mbs.param[5] = 0;
+ /*
+ * Unneeded. For the 2100, except for initializing f/w, registers
+ * 4/5 have to not be written to.
+ * mbs.param[4] = 0;
+ * mbs.param[5] = 0;
+ *
+ */
mbs.param[6] = 0;
mbs.param[7] = 0;
isp_mboxcmd(isp, &mbs);
@@ -1014,16 +1055,13 @@
case MBOX_COMMAND_PARAM_ERROR:
/* Not Logged In */
Home |
Main Index |
Thread Index |
Old Index