Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev Update isp driver to be in sync with other platforms...
details: https://anonhg.NetBSD.org/src/rev/e78c9f69e01d
branches: trunk
changeset: 762782:e78c9f69e01d
user: mjacob <mjacob%NetBSD.org@localhost>
date: Mon Feb 28 17:17:55 2011 +0000
description:
Update isp driver to be in sync with other platforms. Mostly very minor changes
with effectively zero impact on NetBSD.
diffstat:
sys/dev/ic/isp.c | 125 +++++++++++++++++++++++++++-------------------
sys/dev/ic/isp_library.c | 16 +++---
sys/dev/ic/isp_netbsd.h | 5 +-
sys/dev/ic/ispvar.h | 14 +++--
sys/dev/pci/isp_pci.c | 6 +-
5 files changed, 96 insertions(+), 70 deletions(-)
diffs (truncated from 496 to 300 lines):
diff -r 5f3d83127807 -r e78c9f69e01d sys/dev/ic/isp.c
--- a/sys/dev/ic/isp.c Mon Feb 28 16:56:39 2011 +0000
+++ b/sys/dev/ic/isp.c Mon Feb 28 17:17:55 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: isp.c,v 1.121 2010/03/26 20:52:00 mjacob Exp $ */
+/* $NetBSD: isp.c,v 1.122 2011/02/28 17:17:55 mjacob Exp $ */
/*
* Machine and OS Independent (well, as best as possible)
* code for the Qlogic ISP SCSI adapters.
@@ -43,7 +43,7 @@
*/
#ifdef __NetBSD__
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: isp.c,v 1.121 2010/03/26 20:52:00 mjacob Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isp.c,v 1.122 2011/02/28 17:17:55 mjacob Exp $");
#include <dev/ic/isp_netbsd.h>
#endif
#ifdef __FreeBSD__
@@ -778,7 +778,7 @@
ISP_IOXPUT_32(isp, ptr[wi++], &cp[i]);
wl--;
}
- MEMORYBARRIER(isp, SYNC_REQUEST, 0, ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)));
+ MEMORYBARRIER(isp, SYNC_REQUEST, 0, ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)), -1);
ISP_MEMZERO(&mbs, sizeof (mbs));
if (la < 0x10000 && nw < 0x10000) {
mbs.param[0] = MBOX_LOAD_RISC_RAM_2100;
@@ -847,7 +847,7 @@
ISP_IOXPUT_16(isp, ptr[wi++], &cp[i]);
wl--;
}
- MEMORYBARRIER(isp, SYNC_REQUEST, 0, ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)));
+ MEMORYBARRIER(isp, SYNC_REQUEST, 0, ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)), -1);
ISP_MEMZERO(&mbs, sizeof (mbs));
if (la < 0x10000) {
mbs.param[0] = MBOX_LOAD_RISC_RAM_2100;
@@ -1717,7 +1717,7 @@
isp_prt(isp, ISP_LOGDEBUG0, "INIT F/W from %p (%08x%08x)",
fcp->isp_scratch, (uint32_t) ((uint64_t)fcp->isp_scdma >> 32),
(uint32_t) fcp->isp_scdma);
- MEMORYBARRIER(isp, SYNC_SFORDEV, 0, sizeof (*icbp));
+ MEMORYBARRIER(isp, SYNC_SFORDEV, 0, sizeof (*icbp), 0);
isp_mboxcmd(isp, &mbs);
FC_SCRATCH_RELEASE(isp, 0);
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
@@ -2009,7 +2009,7 @@
mbs.param[6] = DMA_WD3(fcp->isp_scdma);
mbs.param[7] = DMA_WD2(fcp->isp_scdma);
isp_prt(isp, ISP_LOGDEBUG0, "INIT F/W from %04x%04x%04x%04x", DMA_WD3(fcp->isp_scdma), DMA_WD2(fcp->isp_scdma), DMA_WD1(fcp->isp_scdma), DMA_WD0(fcp->isp_scdma));
- MEMORYBARRIER(isp, SYNC_SFORDEV, 0, sizeof (*icbp));
+ MEMORYBARRIER(isp, SYNC_SFORDEV, 0, sizeof (*icbp), 0);
isp_mboxcmd(isp, &mbs);
FC_SCRATCH_RELEASE(isp, 0);
@@ -2126,13 +2126,13 @@
mbs.param[3] = DMA_WD0(fcp->isp_scdma);
mbs.param[6] = DMA_WD3(fcp->isp_scdma);
mbs.param[7] = DMA_WD2(fcp->isp_scdma);
- MEMORYBARRIER(isp, SYNC_SFORDEV, 0, QENTRY_LEN);
+ MEMORYBARRIER(isp, SYNC_SFORDEV, 0, QENTRY_LEN, chan);
isp_mboxcmd(isp, &mbs);
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
rval = mbs.param[0];
goto out;
}
- MEMORYBARRIER(isp, SYNC_SFORCPU, QENTRY_LEN, QENTRY_LEN);
+ MEMORYBARRIER(isp, SYNC_SFORCPU, QENTRY_LEN, QENTRY_LEN, chan);
scp += QENTRY_LEN;
isp_get_plogx(isp, (isp_plogx_t *) scp, plp);
if (isp->isp_dblev & ISP_LOGDEBUG1) {
@@ -2325,7 +2325,7 @@
return (-1);
}
}
- MEMORYBARRIER(isp, SYNC_SFORDEV, 0, sizeof (un));
+ MEMORYBARRIER(isp, SYNC_SFORDEV, 0, sizeof (un), chan);
isp_mboxcmd(isp, &mbs);
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
if (dolock) {
@@ -3216,7 +3216,7 @@
rq->snscb_fc4_type = FC4_SCSI;
isp_put_gid_ft_request(isp, rq, fcp->isp_scratch);
- MEMORYBARRIER(isp, SYNC_SFORDEV, 0, SNS_GID_FT_REQ_SIZE);
+ MEMORYBARRIER(isp, SYNC_SFORDEV, 0, SNS_GID_FT_REQ_SIZE, chan);
MBSINIT(&mbs, MBOX_SEND_SNS, MBLOGALL, 10000000);
mbs.param[0] = MBOX_SEND_SNS;
@@ -3311,12 +3311,12 @@
mbs.param[3] = DMA_WD0(fcp->isp_scdma + CTXOFF);
mbs.param[6] = DMA_WD3(fcp->isp_scdma + CTXOFF);
mbs.param[7] = DMA_WD2(fcp->isp_scdma + CTXOFF);
- MEMORYBARRIER(isp, SYNC_SFORDEV, XTXOFF, 2 * QENTRY_LEN);
+ MEMORYBARRIER(isp, SYNC_SFORDEV, XTXOFF, 2 * QENTRY_LEN, chan);
isp_mboxcmd(isp, &mbs);
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
return (-1);
}
- MEMORYBARRIER(isp, SYNC_SFORCPU, ZTXOFF, QENTRY_LEN);
+ MEMORYBARRIER(isp, SYNC_SFORCPU, ZTXOFF, QENTRY_LEN, chan);
pt = &un.plocal;
isp_get_ct_pt(isp, (isp_ct_pt_t *) &scp[ZTXOFF], pt);
if (isp->isp_dblev & ISP_LOGDEBUG1) {
@@ -3329,7 +3329,7 @@
chan, pt->ctp_status);
return (-1);
}
- MEMORYBARRIER(isp, SYNC_SFORCPU, IGPOFF, GIDLEN + 16);
+ MEMORYBARRIER(isp, SYNC_SFORCPU, IGPOFF, GIDLEN + 16, chan);
if (isp->isp_dblev & ISP_LOGDEBUG1) {
isp_print_bytes(isp, "CT response", GIDLEN+16, &scp[IGPOFF]);
}
@@ -3415,7 +3415,7 @@
return (0);
}
- MEMORYBARRIER(isp, SYNC_SFORCPU, IGPOFF, GIDLEN);
+ MEMORYBARRIER(isp, SYNC_SFORCPU, IGPOFF, GIDLEN, chan);
rs0 = (sns_gid_ft_rsp_t *) ((uint8_t *)fcp->isp_scratch+IGPOFF);
rs1 = (sns_gid_ft_rsp_t *) ((uint8_t *)fcp->isp_scratch+OGPOFF);
isp_get_gid_ft_response(isp, rs0, rs1, NGENT);
@@ -3937,14 +3937,18 @@
i = lim;
}
break;
- } else if (r != MBOX_LOOP_ID_USED) {
+ } else if ((r & 0xffff) == MBOX_LOOP_ID_USED) {
+ /*
+ * Try the next loop id.
+ */
+ *ohp = handle;
+ handle = isp_nxt_handle(isp, chan, handle);
+ } else {
+ /*
+ * Give up.
+ */
i = lim;
break;
- } else if (r == MBOX_TIMEOUT) {
- return (-1);
- } else {
- *ohp = handle;
- handle = isp_nxt_handle(isp, chan, *ohp);
}
}
@@ -4005,7 +4009,7 @@
mbs.param[3] = DMA_WD0(fcp->isp_scdma);
mbs.param[6] = DMA_WD3(fcp->isp_scdma);
mbs.param[7] = DMA_WD2(fcp->isp_scdma);
- MEMORYBARRIER(isp, SYNC_SFORDEV, 0, SNS_RFT_ID_REQ_SIZE);
+ MEMORYBARRIER(isp, SYNC_SFORDEV, 0, SNS_RFT_ID_REQ_SIZE, chan);
isp_mboxcmd(isp, &mbs);
FC_SCRATCH_RELEASE(isp, chan);
if (mbs.param[0] == MBOX_COMMAND_COMPLETE) {
@@ -4091,13 +4095,13 @@
mbs.param[3] = DMA_WD0(fcp->isp_scdma + CTXOFF);
mbs.param[6] = DMA_WD3(fcp->isp_scdma + CTXOFF);
mbs.param[7] = DMA_WD2(fcp->isp_scdma + CTXOFF);
- MEMORYBARRIER(isp, SYNC_SFORDEV, XTXOFF, 2 * QENTRY_LEN);
+ MEMORYBARRIER(isp, SYNC_SFORDEV, XTXOFF, 2 * QENTRY_LEN, chan);
isp_mboxcmd(isp, &mbs);
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
FC_SCRATCH_RELEASE(isp, chan);
return (-1);
}
- MEMORYBARRIER(isp, SYNC_SFORCPU, ZTXOFF, QENTRY_LEN);
+ MEMORYBARRIER(isp, SYNC_SFORCPU, ZTXOFF, QENTRY_LEN, chan);
pt = &un.plocal;
isp_get_ct_pt(isp, (isp_ct_pt_t *) &scp[ZTXOFF], pt);
if (isp->isp_dblev & ISP_LOGDEBUG1) {
@@ -4181,7 +4185,7 @@
isp_start(XS_T *xs)
{
ispsoftc_t *isp;
- uint32_t handle;
+ uint32_t handle, cdblen;
uint8_t local[QENTRY_LEN];
ispreq_t *reqp;
void *cdbp, *qep;
@@ -4314,8 +4318,7 @@
reqp->req_header.rqs_entry_type = RQSTYPE_REQUEST;
}
}
- /* reqp->req_header.rqs_flags = 0; */
- /* reqp->req_header.rqs_seqno = 0; */
+
if (IS_24XX(isp)) {
int ttype;
if (XS_TAG_P(xs)) {
@@ -4364,39 +4367,57 @@
reqp->req_flags = XS_TAG_TYPE(xs);
}
}
- cdbp = reqp->req_cdb;
+
tptr = &reqp->req_time;
+ /*
+ * NB: we do not support long CDBs
+ */
+ cdblen = XS_CDBLEN(xs);
+
if (IS_SCSI(isp)) {
reqp->req_target = target | (XS_CHANNEL(xs) << 7);
reqp->req_lun_trn = XS_LUN(xs);
- reqp->req_cdblen = XS_CDBLEN(xs);
+ cdblen = ISP_MIN(cdblen, sizeof (reqp->req_cdb));
+ cdbp = reqp->req_cdb;
+ reqp->req_cdblen = cdblen;
} else if (IS_24XX(isp)) {
+ ispreqt7_t *t7 = (ispreqt7_t *)local;
fcportdb_t *lp;
lp = &FCPARAM(isp, XS_CHANNEL(xs))->portdb[hdlidx];
- ((ispreqt7_t *)reqp)->req_nphdl = target;
- ((ispreqt7_t *)reqp)->req_tidlo = lp->portid;
- ((ispreqt7_t *)reqp)->req_tidhi = lp->portid >> 16;
- ((ispreqt7_t *)reqp)->req_vpidx = ISP_GET_VPIDX(isp, XS_CHANNEL(xs));
+ t7->req_nphdl = target;
+ t7->req_tidlo = lp->portid;
+ t7->req_tidhi = lp->portid >> 16;
+ t7->req_vpidx = ISP_GET_VPIDX(isp, XS_CHANNEL(xs));
if (XS_LUN(xs) > 256) {
- ((ispreqt7_t *)reqp)->req_lun[0] = XS_LUN(xs) >> 8;
- ((ispreqt7_t *)reqp)->req_lun[0] |= 0x40;
- }
- ((ispreqt7_t *)reqp)->req_lun[1] = XS_LUN(xs);
- cdbp = ((ispreqt7_t *)reqp)->req_cdb;
- tptr = &((ispreqt7_t *)reqp)->req_time;
+ t7->req_lun[0] = XS_LUN(xs) >> 8;
+ t7->req_lun[0] |= 0x40;
+ }
+ t7->req_lun[1] = XS_LUN(xs);
+ tptr = &t7->req_time;
+ cdbp = t7->req_cdb;
+ cdblen = ISP_MIN(cdblen, sizeof (t7->req_cdb));
} else if (ISP_CAP_2KLOGIN(isp)) {
- ((ispreqt2e_t *)reqp)->req_target = target;
- ((ispreqt2e_t *)reqp)->req_scclun = XS_LUN(xs);
+ ispreqt2e_t *t2e = (ispreqt2e_t *)local;
+ t2e->req_target = target;
+ t2e->req_scclun = XS_LUN(xs);
+ cdbp = t2e->req_cdb;
+ cdblen = ISP_MIN(cdblen, sizeof (t2e->req_cdb));
} else if (ISP_CAP_SCCFW(isp)) {
- ((ispreqt2_t *)reqp)->req_target = target;
- ((ispreqt2_t *)reqp)->req_scclun = XS_LUN(xs);
+ ispreqt2_t *t2 = (ispreqt2_t *)local;
+ t2->req_target = target;
+ t2->req_scclun = XS_LUN(xs);
+ cdbp = t2->req_cdb;
+ cdblen = ISP_MIN(cdblen, sizeof (t2->req_cdb));
} else {
- ((ispreqt2_t *)reqp)->req_target = target;
- ((ispreqt2_t *)reqp)->req_lun_trn = XS_LUN(xs);
- }
- ISP_MEMCPY(cdbp, XS_CDBP(xs), XS_CDBLEN(xs));
+ ispreqt2_t *t2 = (ispreqt2_t *)local;
+ t2->req_target = target;
+ t2->req_lun_trn = XS_LUN(xs);
+ cdbp = t2->req_cdb;
+ cdblen = ISP_MIN(cdblen, sizeof (t2->req_cdb));
+ }
+ ISP_MEMCPY(cdbp, XS_CDBP(xs), cdblen);
*tptr = XS_TIME(xs) / 1000;
if (*tptr == 0 && XS_TIME(xs)) {
@@ -4532,7 +4553,7 @@
break;
}
isp_put_24xx_tmf(isp, tmf, fcp->isp_scratch);
- MEMORYBARRIER(isp, SYNC_SFORDEV, 0, QENTRY_LEN);
+ MEMORYBARRIER(isp, SYNC_SFORDEV, 0, QENTRY_LEN, chan);
fcp->sendmarker = 1;
isp_mboxcmd(isp, &mbs);
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
@@ -4540,7 +4561,7 @@
break;
}
MEMORYBARRIER(isp, SYNC_SFORCPU, QENTRY_LEN,
- QENTRY_LEN);
+ QENTRY_LEN, chan);
sp = (isp24xx_statusreq_t *) local;
isp_get_24xx_response(isp,
&((isp24xx_statusreq_t *)fcp->isp_scratch)[1], sp);
@@ -4636,14 +4657,14 @@
ab2 = (isp24xx_abrt_t *)
&((uint8_t *)fcp->isp_scratch)[QENTRY_LEN];
ab2->abrt_nphdl = 0xdeaf;
- MEMORYBARRIER(isp, SYNC_SFORDEV, 0, 2 * QENTRY_LEN);
+ MEMORYBARRIER(isp, SYNC_SFORDEV, 0, 2 * QENTRY_LEN, chan);
isp_mboxcmd(isp, &mbs);
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
FC_SCRATCH_RELEASE(isp, chan);
break;
}
MEMORYBARRIER(isp, SYNC_SFORCPU, QENTRY_LEN,
- QENTRY_LEN);
+ QENTRY_LEN, chan);
Home |
Main Index |
Thread Index |
Old Index