Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic Make firmware revision a triple. Clean up some FC...
details: https://anonhg.NetBSD.org/src/rev/585695c8658b
branches: trunk
changeset: 471530:585695c8658b
user: mjacob <mjacob%NetBSD.org@localhost>
date: Sun Apr 04 02:28:53 1999 +0000
description:
Make firmware revision a triple. Clean up some FC init stuff for
board versions with no BIOS. Separate mailbox interrupts from
IOCB interrupts. Read OUTMAILBOX5 while RISC_INT is active- not
after you clear it (potential race condition). Clear out older broken
BIG_ENDIAN goop. Don't negotiate narrow/async for LVD busses at startup
if already in LVD mode. Note usage of presumptive 1040C revision. For
all the LIP, PDB Changed, Loop UP/DOWN async events, mark fw state
as unknown as well as marking the need to do a getpdb on targets- after
a LIP for certain the f/w has to do PRLI/PLOGI for all targets again
and marking f/w state as unknown gives us a fighting chance to (start
to) hold up for that to complete.
diffstat:
sys/dev/ic/isp.c | 215 +++++++++++++++++++++++++++++++++++-------------------
1 files changed, 140 insertions(+), 75 deletions(-)
diffs (truncated from 470 to 300 lines):
diff -r 69d1148f1ba1 -r 585695c8658b sys/dev/ic/isp.c
--- a/sys/dev/ic/isp.c Sun Apr 04 01:32:44 1999 +0000
+++ b/sys/dev/ic/isp.c Sun Apr 04 02:28:53 1999 +0000
@@ -1,5 +1,5 @@
-/* $NetBSD: isp.c,v 1.34 1999/03/26 22:39:44 mjacob Exp $ */
-/* release_03_25_99 */
+/* $NetBSD: isp.c,v 1.35 1999/04/04 02:28:53 mjacob Exp $ */
+/* release_4_3_99 */
/*
* Machine and OS Independent (well, as best as possible)
* code for the Qlogic ISP SCSI adapters.
@@ -166,24 +166,40 @@
ISP_WRITE(isp, HCCR, HCCR_CMD_RELEASE);
mbs.param[0] = MBOX_ABOUT_FIRMWARE;
isp_mboxcmd(isp, &mbs);
- if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
- /*
- * If this fails, it probably means we're running
- * an old prom, if anything at all...
- */
- isp->isp_romfw_rev = 0;
- } else {
- isp->isp_romfw_rev =
- (((u_int16_t) mbs.param[1]) << 10) + mbs.param[2];
+ /*
+ * 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];
}
isp->isp_used = 1;
}
+ DISABLE_INTS(isp);
+
/*
* Put it into PAUSE mode.
*/
ISP_WRITE(isp, HCCR, HCCR_CMD_PAUSE);
+#if 0
+ /*
+ * Do a little register testing.
+ */
+ ISP_WRITE(isp, CDMA_COUNT, 0);
+ ISP_WRITE(isp, CDMA_ADDR0, 0xdead);
+ ISP_WRITE(isp, CDMA_ADDR1, 0xbeef);
+ ISP_WRITE(isp, CDMA_ADDR2, 0xffff);
+ ISP_WRITE(isp, CDMA_ADDR3, 0x1111);
+ PRINTF("%s: (0,dead,beef,ffff,1111):\n", isp->isp_name);
+ PRINTF("0x%x 0x%x 0x%x 0x%x 0x%x\n", ISP_READ(isp, CDMA_COUNT),
+ ISP_READ(isp, CDMA_ADDR0), ISP_READ(isp, CDMA_ADDR1),
+ ISP_READ(isp, CDMA_ADDR2), ISP_READ(isp, CDMA_ADDR3));
+#endif
+
if (IS_FC(isp)) {
revname = "2100";
} else if (IS_1080(isp)) {
@@ -252,6 +268,11 @@
isp->isp_type = ISP_HA_SCSI_1040B;
sdp->isp_clock = 60;
break;
+ case 6:
+ revname = "1040C(?)";
+ isp->isp_type = ISP_HA_SCSI_1040C;
+ sdp->isp_clock = 60;
+ break;
}
/*
* Now, while we're at it, gather info about ultra
@@ -431,10 +452,12 @@
*/
ISP_RESET1(isp);
+#if 0
/*
* Enable interrupts
*/
ENABLE_INTS(isp);
+#endif
/*
* Wait for everything to finish firing up...
@@ -567,18 +590,22 @@
isp_dumpregs(isp, "ABOUT FIRMWARE command failed");
return;
}
- PRINTF("%s: Board Revision %s, %s F/W Revision %d.%d\n",
+ PRINTF("%s: Board Revision %s, %s F/W Revision %d.%d.%d\n",
isp->isp_name, revname, dodnld? "loaded" : "resident",
- mbs.param[1], mbs.param[2]);
+ mbs.param[1], mbs.param[2], mbs.param[3]);
if (IS_FC(isp)) {
if (ISP_READ(isp, BIU2100_CSR) & BIU2100_PCI64) {
PRINTF("%s: in 64-Bit PCI slot\n", isp->isp_name);
}
}
- isp->isp_fwrev = (((u_int16_t) mbs.param[1]) << 10) + mbs.param[2];
- if (isp->isp_romfw_rev && dodnld) {
- PRINTF("%s: Last F/W revision was %d.%d\n", isp->isp_name,
- isp->isp_romfw_rev >> 10, isp->isp_romfw_rev & 0x3ff);
+ isp->isp_fwrev[0] = mbs.param[1];
+ isp->isp_fwrev[1] = mbs.param[2];
+ isp->isp_fwrev[2] = mbs.param[3];
+ if (isp->isp_romfw_rev[0] || isp->isp_romfw_rev[1] ||
+ isp->isp_romfw_rev[2]) {
+ PRINTF("%s: Last F/W revision was %d.%d.%d\n", isp->isp_name,
+ isp->isp_romfw_rev[0], isp->isp_romfw_rev[1],
+ isp->isp_romfw_rev[2]);
}
isp_fw_state(isp);
isp->isp_state = ISP_RESETSTATE;
@@ -709,13 +736,18 @@
if (sdp->isp_devparam[tgt].dev_enable == 0)
continue;
- sdf = DPARM_SAFE_DFLT;
- /*
- * It is not quite clear when this changed over so that
- * we could force narrow and async, so assume >= 7.55.
- */
- if (isp->isp_fwrev >= ISP_FW_REV(7, 55)) {
- sdf |= DPARM_NARROW | DPARM_ASYNC;
+ if (IS_1080(isp) && sdp->isp_lvdmode) {
+ sdf = DPARM_DEFAULT & ~DPARM_TQING;
+ } else {
+ sdf = DPARM_SAFE_DFLT;
+ /*
+ * It is not quite clear when this changed over so that
+ * we could force narrow and async, so assume >= 7.55.
+ */
+ if (ISP_FW_REVX(isp->isp_fwrev) >=
+ ISP_FW_REV(7, 55, 0)) {
+ sdf |= DPARM_NARROW | DPARM_ASYNC;
+ }
}
mbs.param[0] = MBOX_SET_TARGET_PARAMS;
mbs.param[1] = tgt << 8;
@@ -759,6 +791,8 @@
sdp->isp_devparam[tgt].cur_offset = mbs.param[3] >> 8;
sdp->isp_devparam[tgt].cur_period = mbs.param[3] & 0xff;
}
+ IDPRINTF(3, ("%s: set flags 0x%x got 0x%x back for target %d\n",
+ isp->isp_name, sdf, mbs.param[2], tgt));
/*
* Ensure that we don't believe tagged queuing is enabled yet.
* It turns out that sometimes the ISP just ignores our
@@ -766,8 +800,10 @@
* seen yet.
*/
sdp->isp_devparam[tgt].cur_dflags &= ~DPARM_TQING;
-
- maxlun = (isp->isp_fwrev >= ISP_FW_REV(7, 55))? 32 : 8;
+ if (ISP_FW_REVX(isp->isp_fwrev) >= ISP_FW_REV(7, 55, 0))
+ maxlun = 32;
+ else
+ maxlun = 8;
for (lun = 0; lun < maxlun; lun++) {
mbs.param[0] = MBOX_SET_DEV_QUEUE_PARAMS;
mbs.param[1] = (tgt << 8) | lun;
@@ -789,8 +825,8 @@
mbs.param[0] = MBOX_INIT_RES_QUEUE;
mbs.param[1] = RESULT_QUEUE_LEN;
- mbs.param[2] = (u_int16_t) (isp->isp_result_dma >> 16);
- mbs.param[3] = (u_int16_t) (isp->isp_result_dma & 0xffff);
+ mbs.param[2] = DMA_MSW(isp->isp_result_dma);
+ mbs.param[3] = DMA_LSW(isp->isp_result_dma);
mbs.param[4] = 0;
mbs.param[5] = 0;
isp_mboxcmd(isp, &mbs);
@@ -802,8 +838,8 @@
mbs.param[0] = MBOX_INIT_REQ_QUEUE;
mbs.param[1] = RQUEST_QUEUE_LEN;
- mbs.param[2] = (u_int16_t) (isp->isp_rquest_dma >> 16);
- mbs.param[3] = (u_int16_t) (isp->isp_rquest_dma & 0xffff);
+ mbs.param[2] = DMA_MSW(isp->isp_rquest_dma);
+ mbs.param[3] = DMA_LSW(isp->isp_rquest_dma);
mbs.param[4] = 0;
mbs.param[5] = 0;
isp_mboxcmd(isp, &mbs);
@@ -817,7 +853,8 @@
* Turn on Fast Posting, LVD transitions
*/
- if (IS_1080(isp) || isp->isp_fwrev >= ISP_FW_REV(7, 55)) {
+ if (IS_1080(isp) ||
+ ISP_FW_REVX(isp->isp_fwrev) >= ISP_FW_REV(7, 55, 0)) {
mbs.param[0] = MBOX_SET_FW_FEATURES;
#ifndef ISP_NO_FASTPOST_SCSI
mbs.param[1] |= FW_FEATURE_FAST_POST;
@@ -926,35 +963,46 @@
icbp->icb_maxfrmlen > ICB_MAX_FRMLEN) {
PRINTF("%s: bad frame length (%d) from NVRAM- using %d\n",
isp->isp_name, fcp->isp_maxfrmlen, ICB_DFLT_FRMLEN);
+ icbp->icb_maxfrmlen = ICB_DFLT_FRMLEN;
}
icbp->icb_maxalloc = fcp->isp_maxalloc;
+ if (icbp->icb_maxalloc < 16) {
+ PRINTF("%s: bad maximum allocation (%d)- using 16\n",
+ isp->isp_name, fcp->isp_maxalloc);
+ icbp->icb_maxalloc = 16;
+ }
icbp->icb_execthrottle = fcp->isp_execthrottle;
+ if (icbp->icb_execthrottle < 1) {
+ PRINTF("%s: bad execution throttle of %d- using 16\n",
+ isp->isp_name, fcp->isp_execthrottle);
+ icbp->icb_execthrottle = 16;
+ }
icbp->icb_retry_delay = fcp->isp_retry_delay;
icbp->icb_retry_count = fcp->isp_retry_count;
icbp->icb_hardaddr = loopid;
- MAKE_NODE_NAME_FROM_WWN(icbp->icb_nodename, fcp->isp_wwn);
- if (icbp->icb_fwoptions & ICBOPT_USE_PORTNAME) {
- u_int64_t portname = fcp->isp_wwn | (2LL << 56);
- MAKE_NODE_NAME_FROM_WWN(icbp->icb_nodename, portname);
+ if (fcp->isp_wwn) {
+ MAKE_NODE_NAME_FROM_WWN(icbp->icb_nodename, fcp->isp_wwn);
+ if (icbp->icb_fwoptions & ICBOPT_USE_PORTNAME) {
+ u_int64_t portname = fcp->isp_wwn | (2LL << 56);
+ MAKE_NODE_NAME_FROM_WWN(icbp->icb_nodename, portname);
+ }
+ } else {
+ fcp->isp_fwoptions &= ~(ICBOPT_USE_PORTNAME|ICBOPT_FULL_LOGIN);
}
icbp->icb_rqstqlen = RQUEST_QUEUE_LEN;
icbp->icb_rsltqlen = RESULT_QUEUE_LEN;
- icbp->icb_rqstaddr[RQRSP_ADDR0015] =
- (u_int16_t) (isp->isp_rquest_dma & 0xffff);
- icbp->icb_rqstaddr[RQRSP_ADDR1631] =
- (u_int16_t) (isp->isp_rquest_dma >> 16);
- icbp->icb_respaddr[RQRSP_ADDR0015] =
- (u_int16_t) (isp->isp_result_dma & 0xffff);
- icbp->icb_respaddr[RQRSP_ADDR1631] =
- (u_int16_t) (isp->isp_result_dma >> 16);
+ icbp->icb_rqstaddr[RQRSP_ADDR0015] = DMA_LSW(isp->isp_rquest_dma);
+ icbp->icb_rqstaddr[RQRSP_ADDR1631] = DMA_MSW(isp->isp_rquest_dma);
+ icbp->icb_respaddr[RQRSP_ADDR0015] = DMA_LSW(isp->isp_result_dma);
+ icbp->icb_respaddr[RQRSP_ADDR1631] = DMA_MSW(isp->isp_result_dma);
MemoryBarrier();
for (count = 0; count < 10; count++) {
mbs.param[0] = MBOX_INIT_FIRMWARE;
mbs.param[1] = 0;
- mbs.param[2] = (u_int16_t) (fcp->isp_scdma >> 16);
- mbs.param[3] = (u_int16_t) (fcp->isp_scdma & 0xffff);
+ mbs.param[2] = DMA_MSW(fcp->isp_scdma);
+ mbs.param[3] = DMA_LSW(fcp->isp_scdma);
mbs.param[4] = 0;
mbs.param[5] = 0;
mbs.param[6] = 0;
@@ -1032,8 +1080,8 @@
mbreg_t mbs;
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[2] = DMA_MSW(fcp->isp_scdma);
+ mbs.param[3] = DMA_LSW(fcp->isp_scdma);
/*
* Unneeded. For the 2100, except for initializing f/w, registers
* 4/5 have to not be written to.
@@ -1213,12 +1261,12 @@
if (isp->isp_sendmarker) {
u_int8_t niptr;
- ispmarkreq_t *marker = (ispmarkreq_t *) reqp;
-
- MEMZERO((void *) marker, sizeof (*marker));
- marker->req_header.rqs_entry_count = 1;
- marker->req_header.rqs_entry_type = RQSTYPE_MARKER;
- marker->req_modifier = SYNC_ALL;
+
+ MEMZERO((void *) reqp, sizeof (*reqp));
+ reqp->req_header.rqs_entry_count = 1;
+ reqp->req_header.rqs_entry_type = RQSTYPE_MARKER;
+ reqp->req_modifier = SYNC_ALL;
+ ISP_SBUSIFY_ISPHDR(isp, &reqp->req_header);
/*
* Unconditionally update the input pointer anyway.
@@ -1246,6 +1294,7 @@
}
reqp->req_header.rqs_flags = 0;
reqp->req_header.rqs_seqno = isp->isp_seqno++;
+ ISP_SBUSIFY_ISPHDR(isp, &reqp->req_header);
for (rqidx = 0; rqidx < RQUEST_QUEUE_LEN; rqidx++) {
if (isp->isp_xflist[rqidx] == NULL)
@@ -1332,6 +1381,7 @@
return (i);
}
XS_SETERR(xs, HBA_NOERROR);
+ ISP_SBUSIFY_ISPREQ(isp, reqp);
MemoryBarrier();
Home |
Main Index |
Thread Index |
Old Index