Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev Add support for 2 Gigabit cards (2300/2312). This ne...
details: https://anonhg.NetBSD.org/src/rev/d1cdbce9d86c
branches: trunk
changeset: 514398:d1cdbce9d86c
user: mjacob <mjacob%NetBSD.org@localhost>
date: Sat Sep 01 07:12:23 2001 +0000
description:
Add support for 2 Gigabit cards (2300/2312). This necessitated a change
in how interrupts are down- the 23XX has not only a different place to check
for an interrupt, but unlike all other QLogic cards, you have to read the
status as a 32 bit word- not 16 bit words. Rather than have device specific
functions as called from the core module (in isp_intr), it makes more sense
to have the platform/bus modules do the gruntwork of splitting out the
isr, semaphore register and the first outgoing mailbox register (if needed)
*prior* to calling isp_intr (if calling isp_intr is necessary at all).
diffstat:
sys/dev/ic/isp.c | 847 ++++++++++++++++++++++++++---------------------
sys/dev/ic/isp_netbsd.c | 50 +-
sys/dev/ic/isp_netbsd.h | 10 +-
sys/dev/ic/ispmbox.h | 52 ++-
sys/dev/ic/ispreg.h | 34 +-
sys/dev/ic/ispvar.h | 81 +++-
sys/dev/pci/isp_pci.c | 297 ++++++++++++----
sys/dev/sbus/isp_sbus.c | 52 ++-
8 files changed, 909 insertions(+), 514 deletions(-)
diffs (truncated from 2487 to 300 lines):
diff -r 6cd2e9f54095 -r d1cdbce9d86c sys/dev/ic/isp.c
--- a/sys/dev/ic/isp.c Sat Sep 01 03:02:31 2001 +0000
+++ b/sys/dev/ic/isp.c Sat Sep 01 07:12:23 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: isp.c,v 1.78 2001/07/06 16:15:38 mjacob Exp $ */
+/* $NetBSD: isp.c,v 1.79 2001/09/01 07:12:23 mjacob Exp $ */
/*
* This driver, which is contained in NetBSD in the files:
*
@@ -128,6 +128,14 @@
"Loop ID %d, AL_PA 0x%x, Port ID 0x%x, Loop State 0x%x, Topology '%s'";
static const char finmsg[] =
"(%d.%d.%d): FIN dl%d resid %d STS 0x%x SKEY %c XS_ERR=0x%x";
+static const char sc0[] =
+ "%s CHAN %d FTHRSH %d IID %d RESETD %d RETRYC %d RETRYD %d ASD 0x%x";
+static const char sc1[] =
+ "%s RAAN 0x%x DLAN 0x%x DDMAB 0x%x CDMAB 0x%x SELTIME %d MQD %d";
+static const char sc2[] = "%s CHAN %d TGT %d FLAGS 0x%x 0x%x/0x%x";
+static const char sc3[] = "Generated";
+static const char sc4[] = "NVRAM";
+
/*
* Local function prototypes.
*/
@@ -170,12 +178,14 @@
*
* Locking done elsewhere.
*/
+
void
isp_reset(struct ispsoftc *isp)
{
mbreg_t mbs;
+ u_int16_t code_org;
int loops, i, touched, dodnld = 1;
- char *revname = "????";
+ char *btype = "????";
isp->isp_state = ISP_NILSTATE;
@@ -183,7 +193,8 @@
/*
* Basic types (SCSI, FibreChannel and PCI or SBus)
* have been set in the MD code. We figure out more
- * here.
+ * here. Possibly more refined types based upon PCI
+ * identification. Chip revision has been gathered.
*
* After we've fired this chip up, zero out the conf1 register
* for SCSI adapters and do other settings for the 2100.
@@ -225,6 +236,14 @@
}
DISABLE_INTS(isp);
+ /*
+ * Set up default request/response queue in-pointer/out-pointer
+ * register indices.
+ */
+ isp->isp_rqstinrp = INMAILBOX4;
+ isp->isp_rqstoutrp = OUTMAILBOX4;
+ isp->isp_respinrp = OUTMAILBOX5;
+ isp->isp_respoutrp = INMAILBOX5;
/*
* Put the board into PAUSE mode (so we can read the SXP registers
@@ -235,13 +254,17 @@
if (IS_FC(isp)) {
switch (isp->isp_type) {
case ISP_HA_FC_2100:
- revname = "2100";
+ btype = "2100";
break;
case ISP_HA_FC_2200:
- revname = "2200";
+ btype = "2200";
break;
case ISP_HA_FC_2300:
- revname = "2300";
+ isp->isp_rqstinrp = BIU_REQINP;
+ isp->isp_rqstoutrp = BIU_REQOUTP;
+ isp->isp_respinrp = BIU_RSPINP;
+ isp->isp_respoutrp = BIU_RSPOUTP;
+ btype = "2300";
break;
default:
break;
@@ -256,7 +279,7 @@
ISP_WRITE(isp, BIU2100_CSR, BIU2100_RISC_REGS);
} else if (IS_1240(isp)) {
sdparam *sdp = isp->isp_param;
- revname = "1240";
+ btype = "1240";
isp->isp_clock = 60;
sdp->isp_ultramode = 1;
sdp++;
@@ -272,13 +295,13 @@
isp->isp_clock = 100;
if (IS_1280(isp))
- revname = "1280";
+ btype = "1280";
else if (IS_1080(isp))
- revname = "1080";
+ btype = "1080";
else if (IS_12160(isp))
- revname = "12160";
+ btype = "12160";
else
- revname = "<UNKLVD>";
+ btype = "<UNKLVD>";
l = ISP_READ(isp, SXP_PINS_DIFF) & ISP1080_MODE_MASK;
switch (l) {
@@ -333,7 +356,7 @@
isp_prt(isp, ISP_LOGALL, "Unknown Chip Type 0x%x", i);
/* FALLTHROUGH */
case 1:
- revname = "1020";
+ btype = "1020";
isp->isp_type = ISP_HA_SCSI_1020;
isp->isp_clock = 40;
break;
@@ -343,27 +366,27 @@
* run the clock rate up for that unless told to
* do so by the Ultra Capable bits being set.
*/
- revname = "1020A";
+ btype = "1020A";
isp->isp_type = ISP_HA_SCSI_1020A;
isp->isp_clock = 40;
break;
case 3:
- revname = "1040";
+ btype = "1040";
isp->isp_type = ISP_HA_SCSI_1040;
isp->isp_clock = 60;
break;
case 4:
- revname = "1040A";
+ btype = "1040A";
isp->isp_type = ISP_HA_SCSI_1040A;
isp->isp_clock = 60;
break;
case 5:
- revname = "1040B";
+ btype = "1040B";
isp->isp_type = ISP_HA_SCSI_1040B;
isp->isp_clock = 60;
break;
case 6:
- revname = "1040C";
+ btype = "1040C";
isp->isp_type = ISP_HA_SCSI_1040C;
isp->isp_clock = 60;
break;
@@ -613,11 +636,16 @@
dodnld = 0;
}
+ if (IS_2300(isp))
+ code_org = ISP_CODE_ORG_2300;
+ else
+ code_org = ISP_CODE_ORG;
+
if (dodnld) {
u_int16_t fwlen = isp->isp_mdvec->dv_ispfw[3];
for (i = 0; i < fwlen; i++) {
mbs.param[0] = MBOX_WRITE_RAM_WORD;
- mbs.param[1] = ISP_CODE_ORG + i;
+ mbs.param[1] = code_org + i;
mbs.param[2] = isp->isp_mdvec->dv_ispfw[i];
isp_mboxcmd(isp, &mbs, MBLOGNONE);
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
@@ -632,7 +660,7 @@
* Verify that it downloaded correctly.
*/
mbs.param[0] = MBOX_VERIFY_CHECKSUM;
- mbs.param[1] = ISP_CODE_ORG;
+ mbs.param[1] = code_org;
isp_mboxcmd(isp, &mbs, MBLOGNONE);
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
isp_prt(isp, ISP_LOGERR, "Ram Checksum Failure");
@@ -651,8 +679,9 @@
* we still need to (re)start it.
*/
+
mbs.param[0] = MBOX_EXEC_FIRMWARE;
- mbs.param[1] = ISP_CODE_ORG;
+ mbs.param[1] = code_org;
isp_mboxcmd(isp, &mbs, MBLOGNONE);
/* give it a chance to start */
USEC_SLEEP(isp, 500);
@@ -675,9 +704,9 @@
return;
}
isp_prt(isp, ISP_LOGCONFIG,
- "Board Revision %s, %s F/W Revision %d.%d.%d", revname,
- dodnld? "loaded" : "resident", mbs.param[1], mbs.param[2],
- mbs.param[3]);
+ "Board Type %s, Chip Revision 0x%x, %s F/W Revision %d.%d.%d",
+ btype, isp->isp_revision, dodnld? "loaded" : "resident",
+ mbs.param[1], mbs.param[2], mbs.param[3]);
if (IS_FC(isp)) {
isp_prt(isp, ISP_LOGCONFIG, "Firmware Attributes = 0x%x",
mbs.param[6]);
@@ -891,8 +920,8 @@
mbs.param[0] = MBOX_INIT_RES_QUEUE;
mbs.param[1] = RESULT_QUEUE_LEN(isp);
- mbs.param[2] = DMA_MSW(isp->isp_result_dma);
- mbs.param[3] = DMA_LSW(isp->isp_result_dma);
+ mbs.param[2] = DMA_WD1(isp->isp_result_dma);
+ mbs.param[3] = DMA_WD0(isp->isp_result_dma);
mbs.param[4] = 0;
mbs.param[5] = 0;
isp_mboxcmd(isp, &mbs, MBLOGALL);
@@ -903,8 +932,8 @@
mbs.param[0] = MBOX_INIT_REQ_QUEUE;
mbs.param[1] = RQUEST_QUEUE_LEN(isp);
- mbs.param[2] = DMA_MSW(isp->isp_rquest_dma);
- mbs.param[3] = DMA_LSW(isp->isp_rquest_dma);
+ mbs.param[2] = DMA_WD1(isp->isp_rquest_dma);
+ mbs.param[3] = DMA_WD0(isp->isp_rquest_dma);
mbs.param[4] = 0;
isp_mboxcmd(isp, &mbs, MBLOGALL);
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
@@ -966,7 +995,7 @@
/*
- * Set current per-target parameters to a safe minimum.
+ * Set current per-target parameters to an initial safe minimum.
*/
for (tgt = 0; tgt < MAX_TARGETS; tgt++) {
int lun;
@@ -976,19 +1005,16 @@
continue;
}
#ifndef ISP_TARGET_MODE
- if (tgt == sdp->isp_initiator_id) {
- sdf = DPARM_DEFAULT;
- } else {
- sdf = DPARM_SAFE_DFLT;
- /*
- * It is not quite clear when this changed over so that
- * we could force narrow and async for 1000/1020 cards,
- * but assume that this is only the case for loaded
- * firmware.
- */
- if (isp->isp_loaded_fw) {
- sdf |= DPARM_NARROW | DPARM_ASYNC;
- }
+ sdf = sdp->isp_devparam[tgt].goal_flags;
+ sdf &= DPARM_SAFE_DFLT;
+ /*
+ * It is not quite clear when this changed over so that
+ * we could force narrow and async for 1000/1020 cards,
+ * but assume that this is only the case for loaded
+ * firmware.
+ */
+ if (isp->isp_loaded_fw) {
+ sdf |= DPARM_NARROW | DPARM_ASYNC;
}
#else
/*
@@ -999,7 +1025,7 @@
* (as in narrow/async). What the f/w *should* do is
* use the initiator id settings to decide how to respond.
*/
- sdf = DPARM_DEFAULT;
+ sdp->isp_devparam[tgt].goal_flags = sdf = DPARM_DEFAULT;
#endif
mbs.param[0] = MBOX_SET_TARGET_PARAMS;
mbs.param[1] = (channel << 15) | (tgt << 8);
@@ -1008,11 +1034,11 @@
mbs.param[3] = 0;
} else {
mbs.param[3] =
- (sdp->isp_devparam[tgt].sync_offset << 8) |
- (sdp->isp_devparam[tgt].sync_period);
+ (sdp->isp_devparam[tgt].goal_offset << 8) |
+ (sdp->isp_devparam[tgt].goal_period);
}
isp_prt(isp, ISP_LOGDEBUG0,
- "bus %d set tgt %d flags 0x%x off 0x%x period 0x%x",
+ "Initial Settings bus%d tgt%d flags 0x%x off 0x%x per 0x%x",
channel, tgt, mbs.param[2], mbs.param[3] >> 8,
mbs.param[3] & 0xff);
isp_mboxcmd(isp, &mbs, MBLOGNONE);
@@ -1039,7 +1065,7 @@
* attempts to set parameters for devices that it hasn't
* seen yet.
*/
- sdp->isp_devparam[tgt].cur_dflags = sdf & ~DPARM_TQING;
+ sdp->isp_devparam[tgt].actv_flags = sdf & ~DPARM_TQING;
for (lun = 0; lun < (int) isp->isp_maxluns; lun++) {
mbs.param[0] = MBOX_SET_DEV_QUEUE_PARAMS;
mbs.param[1] = (channel << 15) | (tgt << 8) | lun;
Home |
Main Index |
Thread Index |
Old Index