summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authormjacob <mjacob@cvs.openbsd.org>2001-10-06 22:45:53 +0000
committermjacob <mjacob@cvs.openbsd.org>2001-10-06 22:45:53 +0000
commitfa35731037d936d715e410a61480a162b6069d12 (patch)
tree32c1252e18a7698e35cfc1f60493d788e6fa1bae /sys/dev
parente12667d1172cfaad10cb05e7b7bf2ee636416b0c (diff)
Fix various 2300 (2Gb) last minute errata. Keep up with the jones' for
the target mode code.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/isp.c176
-rw-r--r--sys/dev/ic/isp_target.c91
-rw-r--r--sys/dev/ic/isp_target.h6
-rw-r--r--sys/dev/ic/ispmbox.h72
-rw-r--r--sys/dev/ic/ispvar.h14
-rw-r--r--sys/dev/pci/isp_pci.c6
6 files changed, 232 insertions, 133 deletions
diff --git a/sys/dev/ic/isp.c b/sys/dev/ic/isp.c
index dd29688dc2f..53deaf4244e 100644
--- a/sys/dev/ic/isp.c
+++ b/sys/dev/ic/isp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: isp.c,v 1.22 2001/09/01 07:16:39 mjacob Exp $ */
+/* $OpenBSD: isp.c,v 1.23 2001/10/06 22:45:52 mjacob Exp $ */
/*
* Machine and OS Independent (well, as best as possible)
* code for the Qlogic ISP SCSI adapters.
@@ -64,8 +64,6 @@
/*
* Local static data
*/
-static const char warnlun[] =
- "WARNING- cannot determine Expanded LUN capability- limiting to one LUN";
static const char portshift[] =
"Target %d Loop ID 0x%x (Port 0x%x) => Loop 0x%x (Port 0x%x)";
static const char portdup[] =
@@ -161,7 +159,6 @@ isp_reset(struct ispsoftc *isp)
isp->isp_state = ISP_NILSTATE;
-
/*
* Basic types (SCSI, FibreChannel and PCI or SBus)
* have been set in the MD code. We figure out more
@@ -184,7 +181,13 @@ isp_reset(struct ispsoftc *isp)
/*
* First see whether or not we're sitting in the ISP PROM.
* If we've just been reset, we'll have the string "ISP "
- * spread through outgoing mailbox registers 1-3.
+ * spread through outgoing mailbox registers 1-3. We do
+ * this for PCI cards because otherwise we really don't
+ * know what state the card is in and we could hang if
+ * we try this command otherwise.
+ *
+ * For SBus cards, we just do this because they almost
+ * certainly will be running firmware by now.
*/
if (ISP_READ(isp, OUTMAILBOX1) != 0x4953 ||
ISP_READ(isp, OUTMAILBOX2) != 0x5020 ||
@@ -194,10 +197,7 @@ isp_reset(struct ispsoftc *isp)
*/
ISP_WRITE(isp, HCCR, HCCR_CMD_RELEASE);
mbs.param[0] = MBOX_ABOUT_FIRMWARE;
- isp_mboxcmd(isp, &mbs, MBOX_COMMAND_ERROR);
- /*
- * This *shouldn't* fail.....
- */
+ isp_mboxcmd(isp, &mbs, MBLOGNONE);
if (mbs.param[0] == MBOX_COMMAND_COMPLETE) {
isp->isp_romfw_rev[0] = mbs.param[1];
isp->isp_romfw_rev[1] = mbs.param[2];
@@ -208,14 +208,22 @@ isp_reset(struct ispsoftc *isp)
}
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;
+ if (IS_2300(isp)) {
+ isp->isp_rqstinrp = BIU_REQINP;
+ isp->isp_rqstoutrp = BIU_REQOUTP;
+ isp->isp_respinrp = BIU_RSPINP;
+ isp->isp_respoutrp = BIU_RSPOUTP;
+ } else {
+ 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
@@ -232,10 +240,6 @@ isp_reset(struct ispsoftc *isp)
btype = "2200";
break;
case ISP_HA_FC_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:
@@ -544,15 +548,22 @@ again:
ISP_RESET1(isp);
/*
- * Wait for everything to finish firing up...
+ * Wait for everything to finish firing up.
+ *
+ * Avoid doing this on the 2312 because you can generate a PCI
+ * parity error (chip breakage).
*/
- loops = MBOX_DELAY_COUNT;
- while (ISP_READ(isp, OUTMAILBOX0) == MBOX_BUSY) {
- USEC_DELAY(100);
- if (--loops < 0) {
- isp_prt(isp, ISP_LOGERR,
- "MBOX_BUSY never cleared on reset");
- return;
+ if (IS_2300(isp)) {
+ USEC_DELAY(5);
+ } else {
+ loops = MBOX_DELAY_COUNT;
+ while (ISP_READ(isp, OUTMAILBOX0) == MBOX_BUSY) {
+ USEC_DELAY(100);
+ if (--loops < 0) {
+ isp_prt(isp, ISP_LOGERR,
+ "MBOX_BUSY never cleared on reset");
+ return;
+ }
}
}
@@ -675,22 +686,52 @@ again:
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
return;
}
+
+ /*
+ * The SBus firmware that we are using apparently does not return
+ * major, minor, micro revisions in the mailbox registers, which
+ * is really, really, annoying.
+ */
+ if (isp->isp_bustype == ISP_BT_SBUS) {
+ if (dodnld) {
+#ifdef ISP_TARGET_MODE
+ isp->isp_fwrev[0] = 7;
+ isp->isp_fwrev[1] = 55;
+#else
+ isp->isp_fwrev[0] = 1;
+ isp->isp_fwrev[1] = 37;
+#endif
+ isp->isp_fwrev[2] = 0;
+ }
+ } else {
+ isp->isp_fwrev[0] = mbs.param[1];
+ isp->isp_fwrev[1] = mbs.param[2];
+ isp->isp_fwrev[2] = mbs.param[3];
+ }
isp_prt(isp, ISP_LOGCONFIG,
"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]);
+ isp->isp_fwrev[0], isp->isp_fwrev[1], isp->isp_fwrev[2]);
+
if (IS_FC(isp)) {
- isp_prt(isp, ISP_LOGCONFIG, "Firmware Attributes = 0x%x",
- mbs.param[6]);
+ /*
+ * We do not believe firmware attributes for 2100 code less
+ * than 1.17.0.
+ */
+ if (IS_2100(isp) &&
+ (ISP_FW_REVX(isp->isp_fwrev) < ISP_FW_REV(1, 17, 0))) {
+ FCPARAM(isp)->isp_fwattr = 0;
+ } else {
+ FCPARAM(isp)->isp_fwattr = mbs.param[6];
+ isp_prt(isp, ISP_LOGDEBUG0,
+ "Firmware Attributes = 0x%x", mbs.param[6]);
+ }
if (ISP_READ(isp, BIU2100_CSR) & BIU2100_PCI64) {
isp_prt(isp, ISP_LOGCONFIG,
"Installed in 64-Bit PCI slot");
}
}
- 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]) {
isp_prt(isp, ISP_LOGCONFIG, "Last F/W revision was %d.%d.%d",
@@ -720,15 +761,15 @@ again:
/*
* Okay- now that we have new firmware running, we now (re)set our
* notion of how many luns we support. This is somewhat tricky because
- * if we haven't loaded firmware, we don't have an easy way of telling
- * how many luns we support.
- *
- * We'll make a simplifying assumption- if we loaded firmware, we
- * are running with expanded lun firmware, otherwise not.
+ * if we haven't loaded firmware, we sometimes do not have an easy way
+ * of knowing how many luns we support.
*
* Expanded lun firmware gives you 32 luns for SCSI cards and
* 65536 luns for Fibre Channel cards.
*
+ * It turns out that even for QLogic 2100s with ROM 1.10 and above
+ * we do get a firmware attributes word returned in mailbox register 6.
+ *
* Because the lun is in a a different position in the Request Queue
* Entry structure for Fibre Channel with expanded lun firmware, we
* can only support one lun (lun zero) when we don't know what kind
@@ -739,18 +780,17 @@ again:
* and released.
*/
if (touched == 0) {
- if (dodnld) {
- if (IS_SCSI(isp)) {
+ if (IS_SCSI(isp)) {
+ if (dodnld) {
isp->isp_maxluns = 32;
} else {
- isp->isp_maxluns = 65536;
+ isp->isp_maxluns = 8;
}
} else {
- if (IS_SCSI(isp)) {
- isp->isp_maxluns = 8;
+ if (FCPARAM(isp)->isp_fwattr & ISP_FW_ATTR_SCCLUN) {
+ isp->isp_maxluns = 65536;
} else {
- isp_prt(isp, ISP_LOGALL, warnlun);
- isp->isp_maxluns = 1;
+ isp->isp_maxluns = 16;
}
}
}
@@ -1173,27 +1213,34 @@ isp_fibre_init(struct ispsoftc *isp)
*/
switch(isp->isp_confopts & ISP_CFG_PORT_PREF) {
case ISP_CFG_NPORT:
- icbp->icb_xfwoptions = ICBXOPT_PTP_2_LOOP;
+ icbp->icb_xfwoptions |= ICBXOPT_PTP_2_LOOP;
break;
case ISP_CFG_NPORT_ONLY:
- icbp->icb_xfwoptions = ICBXOPT_PTP_ONLY;
+ icbp->icb_xfwoptions |= ICBXOPT_PTP_ONLY;
break;
case ISP_CFG_LPORT_ONLY:
- icbp->icb_xfwoptions = ICBXOPT_LOOP_ONLY;
+ icbp->icb_xfwoptions |= ICBXOPT_LOOP_ONLY;
break;
default:
- icbp->icb_xfwoptions = ICBXOPT_LOOP_2_PTP;
+ icbp->icb_xfwoptions |= ICBXOPT_LOOP_2_PTP;
break;
}
if (IS_2300(isp)) {
if (isp->isp_revision < 2) {
icbp->icb_fwoptions &= ~ICBOPT_FAST_POST;
}
- icbp->icb_xfwoptions |= ICBXOPT_RATE_AUTO;
+ if (isp->isp_confopts & ISP_CFG_ONEGB) {
+ icbp->icb_zfwoptions |= ICBZOPT_RATE_ONEGB;
+ } else if (isp->isp_confopts & ISP_CFG_TWOGB) {
+ icbp->icb_zfwoptions |= ICBZOPT_RATE_TWOGB;
+ } else {
+ icbp->icb_zfwoptions |= ICBZOPT_RATE_AUTO;
+ }
}
}
- if (IS_2200(isp) || IS_2300(isp)) {
+ if ((IS_2200(isp) && ISP_FW_REVX(isp->isp_fwrev) >=
+ ISP_FW_REV(2, 1, 26)) || IS_2300(isp)) {
/*
* Turn on LIP F8 async event (1)
* Turn on generate AE 8013 on all LIP Resets (2)
@@ -1549,6 +1596,20 @@ not_on_fabric:
fcp->portdb[FL_PORT_ID].valid = 0;
}
+ fcp->isp_gbspeed = 1;
+ if (IS_2300(isp)) {
+ mbs.param[0] = MBOX_GET_SET_DATA_RATE;
+ mbs.param[1] = MBGSD_GET_RATE;
+ /* mbs.param[2] undefined if we're just getting rate */
+ isp_mboxcmd(isp, &mbs, MBLOGALL);
+ if (mbs.param[0] == MBOX_COMMAND_COMPLETE) {
+ if (mbs.param[1] == MBGSD_TWOGB) {
+ isp_prt(isp, ISP_LOGINFO, "2Gb link speed/s");
+ fcp->isp_gbspeed = 2;
+ }
+ }
+ }
+
isp_prt(isp, ISP_LOGINFO, topology, fcp->isp_loopid, fcp->isp_alpa,
fcp->isp_portid, fcp->isp_loopstate, toponames[fcp->isp_topo]);
@@ -2678,7 +2739,7 @@ isp_start(XS_T *xs)
reqp->req_lun_trn = XS_LUN(xs);
reqp->req_cdblen = XS_CDBLEN(xs);
} else {
- if (isp->isp_maxluns > 16)
+ if (FCPARAM(isp)->isp_fwattr & ISP_FW_ATTR_SCCLUN)
t2reqp->req_scclun = XS_LUN(xs);
else
t2reqp->req_lun_trn = XS_LUN(xs);
@@ -2801,7 +2862,7 @@ isp_control(struct ispsoftc *isp, ispctl_t ctl, void *arg)
bus = XS_CHANNEL(xs);
mbs.param[0] = MBOX_ABORT;
if (IS_FC(isp)) {
- if (isp->isp_maxluns > 16) {
+ if (FCPARAM(isp)->isp_fwattr & ISP_FW_ATTR_SCCLUN) {
mbs.param[1] = tgt << 8;
mbs.param[4] = 0;
mbs.param[5] = 0;
@@ -3981,7 +4042,7 @@ static u_int16_t mbpscsi[] = {
ISPOPMAP(0x03, 0x07), /* 0x05: MBOX_READ_RAM_WORD */
ISPOPMAP(0x3f, 0x3f), /* 0x06: MBOX_MAILBOX_REG_TEST */
ISPOPMAP(0x03, 0x07), /* 0x07: MBOX_VERIFY_CHECKSUM */
- ISPOPMAP(0x01, 0x4f), /* 0x08: MBOX_ABOUT_FIRMWARE */
+ ISPOPMAP(0x01, 0x0f), /* 0x08: MBOX_ABOUT_FIRMWARE */
ISPOPMAP(0x00, 0x00), /* 0x09: */
ISPOPMAP(0x00, 0x00), /* 0x0a: */
ISPOPMAP(0x00, 0x00), /* 0x0b: */
@@ -4177,7 +4238,7 @@ static u_int16_t mbpfc[] = {
ISPOPMAP(0x03, 0x07), /* 0x05: MBOX_READ_RAM_WORD */
ISPOPMAP(0xff, 0xff), /* 0x06: MBOX_MAILBOX_REG_TEST */
ISPOPMAP(0x03, 0x05), /* 0x07: MBOX_VERIFY_CHECKSUM */
- ISPOPMAP(0x01, 0x0f), /* 0x08: MBOX_ABOUT_FIRMWARE */
+ ISPOPMAP(0x01, 0x4f), /* 0x08: MBOX_ABOUT_FIRMWARE */
ISPOPMAP(0xdf, 0x01), /* 0x09: LOAD RAM */
ISPOPMAP(0xdf, 0x01), /* 0x0a: DUMP RAM */
ISPOPMAP(0x00, 0x00), /* 0x0b: */
@@ -4209,7 +4270,7 @@ static u_int16_t mbpfc[] = {
ISPOPMAP(0x00, 0x00), /* 0x25: */
ISPOPMAP(0x00, 0x00), /* 0x26: */
ISPOPMAP(0x00, 0x00), /* 0x27: */
- ISPOPMAP(0x01, 0x3), /* 0x28: MBOX_GET_FIRMWARE_OPTIONS */
+ ISPOPMAP(0x01, 0x03), /* 0x28: MBOX_GET_FIRMWARE_OPTIONS */
ISPOPMAP(0x03, 0x07), /* 0x29: MBOX_GET_PORT_QUEUE_PARAMS */
ISPOPMAP(0x00, 0x00), /* 0x2a: */
ISPOPMAP(0x00, 0x00), /* 0x2b: */
@@ -4262,7 +4323,7 @@ static u_int16_t mbpfc[] = {
ISPOPMAP(0x00, 0x00), /* 0x5a: */
ISPOPMAP(0x00, 0x00), /* 0x5b: */
ISPOPMAP(0x00, 0x00), /* 0x5c: */
- ISPOPMAP(0x00, 0x00), /* 0x5d: */
+ ISPOPMAP(0x07, 0x03), /* 0x5d: MBOX_GET_SET_DATA_RATE */
ISPOPMAP(0x00, 0x00), /* 0x5e: */
ISPOPMAP(0x00, 0x00), /* 0x5f: */
ISPOPMAP(0xfd, 0x31), /* 0x60: MBOX_INIT_FIRMWARE */
@@ -4393,7 +4454,7 @@ static char *fc_mbcmd_names[] = {
NULL,
NULL,
NULL,
- NULL,
+ "GET/SET DATA RATE",
NULL,
NULL,
"INIT FIRMWARE",
@@ -5489,5 +5550,6 @@ isp_parse_nvram_2100(struct ispsoftc *isp, u_int8_t *nvram_data)
ISP2100_NVRAM_EXECUTION_THROTTLE(nvram_data);
fcp->isp_fwoptions = ISP2100_NVRAM_OPTIONS(nvram_data);
isp_prt(isp, ISP_LOGDEBUG0,
- "fwoptions from nvram are 0x%x", fcp->isp_fwoptions);
+ "NVRAM: maxfrmlen %d execthrottle %d fwoptions 0x%x",
+ fcp->isp_maxfrmlen, fcp->isp_execthrottle, fcp->isp_fwoptions);
}
diff --git a/sys/dev/ic/isp_target.c b/sys/dev/ic/isp_target.c
index 670b1b052c9..d51345d5b38 100644
--- a/sys/dev/ic/isp_target.c
+++ b/sys/dev/ic/isp_target.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: isp_target.c,v 1.5 2001/09/01 07:16:40 mjacob Exp $ */
+/* $OpenBSD: isp_target.c,v 1.6 2001/10/06 22:45:52 mjacob Exp $ */
/*
* Machine and OS Independent Target Mode Code for the Qlogic SCSI/FC adapters.
*
@@ -47,9 +47,11 @@
#ifdef ISP_TARGET_MODE
static const char atiocope[] =
- "ATIO returned for lun %d because it was in the middle of Bus Device Reset";
+ "ATIO returned for lun %d because it was in the middle of Bus Device Reset "
+ "on bus %d";
static const char atior[] =
- "ATIO returned for lun %d from initiator %d because a Bus Reset occurred";
+ "ATIO returned on for lun %d on from IID %d because a Bus Reset occurred "
+ "on bus %d";
static void isp_got_msg(struct ispsoftc *, int, in_entry_t *);
static void isp_got_msg_fc(struct ispsoftc *, int, in_fcentry_t *);
@@ -172,12 +174,18 @@ isp_target_notify(struct ispsoftc *isp, void *vptr, u_int16_t *optrp)
status = inotp->in_status & 0xff;
seqid = inotp->in_seqid;
if (IS_DUALBUS(isp)) {
- bus = (inotp->in_iid & 0x80) >> 7;
- inotp->in_iid &= ~0x80;
+ bus = GET_BUS_VAL(inotp->in_iid);
+ SET_BUS_VAL(inotp->in_iid, 0);
}
}
- isp_prt(isp, ISP_LOGTDEBUG1,
- "Immediate Notify, status=0x%x seqid=0x%x", status, seqid);
+ isp_prt(isp, ISP_LOGTDEBUG0,
+ "Immediate Notify On Bus %d, status=0x%x seqid=0x%x",
+ bus, status, seqid);
+
+ /*
+ * ACK it right away.
+ */
+ isp_notify_ack(isp, (status == IN_RESET)? NULL : vptr);
switch (status) {
case IN_RESET:
(void) isp_async(isp, ISPASYNC_BUS_RESET, &bus);
@@ -195,8 +203,9 @@ isp_target_notify(struct ispsoftc *isp, void *vptr, u_int16_t *optrp)
break;
case IN_ABORT_TASK:
isp_prt(isp, ISP_LOGWARN,
- "Abort Task for Initiator %d RX_ID 0x%x",
+ "Abort Task from IID %d RX_ID 0x%x",
inot_fcp->in_iid, seqid);
+ (void) isp_async(isp, ISPASYNC_TARGET_ACTION, &bus);
break;
case IN_PORT_LOGOUT:
isp_prt(isp, ISP_LOGWARN,
@@ -216,7 +225,6 @@ isp_target_notify(struct ispsoftc *isp, void *vptr, u_int16_t *optrp)
"bad status (0x%x) in isp_target_notify", status);
break;
}
- isp_notify_ack(isp, vptr);
break;
case RQSTYPE_NOTIFY_ACK:
@@ -301,7 +309,7 @@ isp_lun_cmd(struct ispsoftc *isp, int cmd, int bus, int tgt, int lun,
if (IS_SCSI(isp)) {
el.le_tgt = tgt;
el.le_lun = lun;
- } else if (isp->isp_maxluns <= 16) {
+ } else if ((FCPARAM(isp)->isp_fwattr & ISP_FW_ATTR_SCCLUN) == 0) {
el.le_lun = lun;
}
el.le_timeout = 2;
@@ -368,10 +376,10 @@ isp_target_put_atio(struct ispsoftc *isp, void *arg)
at2_entry_t *aep = arg;
atun._atio2.at_header.rqs_entry_type = RQSTYPE_ATIO2;
atun._atio2.at_header.rqs_entry_count = 1;
- if (isp->isp_maxluns > 16) {
+ if (FCPARAM(isp)->isp_fwattr & ISP_FW_ATTR_SCCLUN) {
atun._atio2.at_scclun = (u_int16_t) aep->at_scclun;
} else {
- atun._atio2.at_lun = (u_int8_t) aep->at_scclun;
+ atun._atio2.at_lun = (u_int8_t) aep->at_lun;
}
atun._atio2.at_status = CT_OK;
} else {
@@ -427,7 +435,7 @@ isp_endcmd(struct ispsoftc *isp, void *arg, u_int32_t code, u_int16_t hdl)
cto->ct_header.rqs_entry_type = RQSTYPE_CTIO2;
cto->ct_header.rqs_entry_count = 1;
cto->ct_iid = aep->at_iid;
- if (isp->isp_maxluns <= 16) {
+ if ((FCPARAM(isp)->isp_fwattr & ISP_FW_ATTR_SCCLUN) == 0) {
cto->ct_lun = aep->at_lun;
}
cto->ct_rxid = aep->at_rxid;
@@ -487,15 +495,19 @@ isp_target_async(struct ispsoftc *isp, int bus, int event)
* upstream, but these do not require any immediate notify actions
* so we return when done.
*/
+ case ASYNC_LIP_F8:
case ASYNC_LIP_OCCURRED:
case ASYNC_LOOP_UP:
case ASYNC_LOOP_DOWN:
- evt.ev_bus = bus;
- evt.ev_event = event;
- (void) isp_async(isp, ISPASYNC_TARGET_EVENT, &evt);
- return;
-
case ASYNC_LOOP_RESET:
+ case ASYNC_PTPMODE:
+ /*
+ * These don't require any immediate notify actions. We used
+ * treat them like SCSI Bus Resets, but that was just plain
+ * wrong. Let the normal CTIO completion report what occurred.
+ */
+ return;
+
case ASYNC_BUS_RESET:
case ASYNC_TIMEOUT_RESET:
if (IS_FC(isp)) {
@@ -567,13 +579,20 @@ isp_got_msg(struct ispsoftc *isp, int bus, in_entry_t *inp)
static void
isp_got_msg_fc(struct ispsoftc *isp, int bus, in_fcentry_t *inp)
{
+ int lun;
static const char f1[] = "%s from iid %d lun %d seq 0x%x";
static const char f2[] =
"unknown %s 0x%x lun %d iid %d task flags 0x%x seq 0x%x\n";
+ if (FCPARAM(isp)->isp_fwattr & ISP_FW_ATTR_SCCLUN) {
+ lun = inp->in_scclun;
+ } else {
+ lun = inp->in_lun;
+ }
+
if (inp->in_status != IN_MSG_RECEIVED) {
isp_prt(isp, ISP_LOGINFO, f2, "immediate notify status",
- inp->in_status, inp->in_lun, inp->in_iid,
+ inp->in_status, lun, inp->in_iid,
inp->in_task_flags, inp->in_seqid);
} else {
tmd_msg_t msg;
@@ -581,37 +600,33 @@ isp_got_msg_fc(struct ispsoftc *isp, int bus, in_fcentry_t *inp)
MEMZERO(&msg, sizeof (msg));
msg.nt_bus = bus;
msg.nt_iid = inp->in_iid;
- if (isp->isp_maxluns > 16) {
- msg.nt_lun = inp->in_scclun;
- } else {
- msg.nt_lun = inp->in_lun;
- }
msg.nt_tagval = inp->in_seqid;
+ msg.nt_lun = lun;
if (inp->in_task_flags & TASK_FLAGS_ABORT_TASK) {
isp_prt(isp, ISP_LOGINFO, f1, "ABORT TASK",
- inp->in_iid, inp->in_lun, inp->in_seqid);
+ inp->in_iid, msg.nt_lun, inp->in_seqid);
msg.nt_msg[0] = MSG_ABORT_TAG;
} else if (inp->in_task_flags & TASK_FLAGS_CLEAR_TASK_SET) {
isp_prt(isp, ISP_LOGINFO, f1, "CLEAR TASK SET",
- inp->in_iid, inp->in_lun, inp->in_seqid);
+ inp->in_iid, msg.nt_lun, inp->in_seqid);
msg.nt_msg[0] = MSG_CLEAR_QUEUE;
} else if (inp->in_task_flags & TASK_FLAGS_TARGET_RESET) {
isp_prt(isp, ISP_LOGINFO, f1, "TARGET RESET",
- inp->in_iid, inp->in_lun, inp->in_seqid);
+ inp->in_iid, msg.nt_lun, inp->in_seqid);
msg.nt_msg[0] = MSG_BUS_DEV_RESET;
} else if (inp->in_task_flags & TASK_FLAGS_CLEAR_ACA) {
isp_prt(isp, ISP_LOGINFO, f1, "CLEAR ACA",
- inp->in_iid, inp->in_lun, inp->in_seqid);
+ inp->in_iid, msg.nt_lun, inp->in_seqid);
/* ???? */
msg.nt_msg[0] = MSG_REL_RECOVERY;
} else if (inp->in_task_flags & TASK_FLAGS_TERMINATE_TASK) {
isp_prt(isp, ISP_LOGINFO, f1, "TERMINATE TASK",
- inp->in_iid, inp->in_lun, inp->in_seqid);
+ inp->in_iid, msg.nt_lun, inp->in_seqid);
msg.nt_msg[0] = MSG_TERM_IO_PROC;
} else {
isp_prt(isp, ISP_LOGWARN, f2, "task flag",
- inp->in_status, inp->in_lun, inp->in_iid,
+ inp->in_status, msg.nt_lun, inp->in_iid,
inp->in_task_flags, inp->in_seqid);
}
if (msg.nt_msg[0]) {
@@ -641,7 +656,7 @@ isp_notify_ack(struct ispsoftc *isp, void *arg)
in_fcentry_t *inp = arg;
MEMCPY(storage, arg, sizeof (isphdr_t));
na->na_iid = inp->in_iid;
- if (isp->isp_maxluns > 16) {
+ if (FCPARAM(isp)->isp_fwattr & ISP_FW_ATTR_SCCLUN) {
na->na_lun = inp->in_scclun;
} else {
na->na_lun = inp->in_lun;
@@ -727,7 +742,8 @@ isp_handle_atio(struct ispsoftc *isp, at_entry_t *aep)
* not increment it. Therefore we should never get
* this status here.
*/
- isp_prt(isp, ISP_LOGERR, atiocope, lun);
+ isp_prt(isp, ISP_LOGERR, atiocope, lun,
+ GET_BUS_VAL(aep->at_iid));
break;
case AT_CDB: /* Got a CDB */
@@ -747,7 +763,8 @@ isp_handle_atio(struct ispsoftc *isp, at_entry_t *aep)
* Ignore it because the async event will clear things
* up for us.
*/
- isp_prt(isp, ISP_LOGWARN, atior, lun, aep->at_iid);
+ isp_prt(isp, ISP_LOGWARN, atior, lun,
+ GET_IID_VAL(aep->at_iid), GET_BUS_VAL(aep->at_iid));
break;
@@ -765,7 +782,7 @@ isp_handle_atio2(struct ispsoftc *isp, at2_entry_t *aep)
{
int lun;
- if (isp->isp_maxluns > 16) {
+ if (FCPARAM(isp)->isp_fwattr & ISP_FW_ATTR_SCCLUN) {
lun = aep->at_scclun;
} else {
lun = aep->at_lun;
@@ -811,7 +828,7 @@ isp_handle_atio2(struct ispsoftc *isp, at2_entry_t *aep)
* not increment it. Therefore we should never get
* this status here.
*/
- isp_prt(isp, ISP_LOGERR, atiocope, lun);
+ isp_prt(isp, ISP_LOGERR, atiocope, lun, 0);
break;
case AT_CDB: /* Got a CDB */
@@ -830,7 +847,7 @@ isp_handle_atio2(struct ispsoftc *isp, at2_entry_t *aep)
* Ignore it because the async event will clear things
* up for us.
*/
- isp_prt(isp, ISP_LOGERR, atior, lun, aep->at_iid);
+ isp_prt(isp, ISP_LOGERR, atior, lun, aep->at_iid, 0);
break;
@@ -903,7 +920,7 @@ isp_handle_ctio(struct ispsoftc *isp, ct_entry_t *ct)
* set, then sends us an Immediate Notify entry.
*/
if (fmsg == NULL)
- fmsg = "ABORT TASK sent by Initiator";
+ fmsg = "ABORT TAG message sent by Initiator";
isp_prt(isp, ISP_LOGWARN, "CTIO destroyed by %s", fmsg);
break;
diff --git a/sys/dev/ic/isp_target.h b/sys/dev/ic/isp_target.h
index 3a2b6dfca1e..ba5b90d10e7 100644
--- a/sys/dev/ic/isp_target.h
+++ b/sys/dev/ic/isp_target.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: isp_target.h,v 1.7 2001/09/01 07:16:40 mjacob Exp $ */
+/* $OpenBSD: isp_target.h,v 1.8 2001/10/06 22:45:52 mjacob Exp $ */
/* @(#)isp_target.h 1.3 */
/*
@@ -335,8 +335,8 @@ typedef struct {
*/
#define GET_IID_VAL(x) (x & 0x3f)
#define GET_BUS_VAL(x) ((x >> 7) & 0x1)
-#define SET_IID_VAL(y, x) (y | (x & 0x3f))
-#define SET_BUS_VAL(y, x) (y | ((x & 0x1) << 7))
+#define SET_IID_VAL(y, x) y = ((y & ~0x3f) | (x & 0x3f))
+#define SET_BUS_VAL(y, x) y = ((y & 0x3f) | ((x & 0x1) << 7))
/*
* ct_flags values
diff --git a/sys/dev/ic/ispmbox.h b/sys/dev/ic/ispmbox.h
index 180f0a5e139..06ddd74149c 100644
--- a/sys/dev/ic/ispmbox.h
+++ b/sys/dev/ic/ispmbox.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ispmbox.h,v 1.14 2001/09/01 07:16:40 mjacob Exp $ */
+/* $OpenBSD: ispmbox.h,v 1.15 2001/10/06 22:45:52 mjacob Exp $ */
/*
* Mailbox and Queue Entry Definitions for for Qlogic ISP SCSI adapters.
*
@@ -107,37 +107,45 @@
#define FW_FEATURE_LVD_NOTIFY 0x2
#define FW_FEATURE_FAST_POST 0x1
-#define MBOX_ENABLE_TARGET_MODE 0x55
+#define MBOX_ENABLE_TARGET_MODE 0x0055
#define ENABLE_TARGET_FLAG 0x8000
#define ENABLE_TQING_FLAG 0x0004
#define ENABLE_MANDATORY_DISC 0x0002
-#define MBOX_GET_TARGET_STATUS 0x56
-
-/* These are for the ISP2100 FC cards */
-#define MBOX_GET_LOOP_ID 0x20
-#define MBOX_GET_FIRMWARE_OPTIONS 0x28
-#define MBOX_SET_FIRMWARE_OPTIONS 0x38
-#define MBOX_GET_RESOURCE_COUNT 0x42
-#define MBOX_ENHANCED_GET_PDB 0x47
-#define MBOX_EXEC_COMMAND_IOCB_A64 0x54
-#define MBOX_INIT_FIRMWARE 0x60
-#define MBOX_GET_INIT_CONTROL_BLOCK 0x61
-#define MBOX_INIT_LIP 0x62
-#define MBOX_GET_FC_AL_POSITION_MAP 0x63
-#define MBOX_GET_PORT_DB 0x64
-#define MBOX_CLEAR_ACA 0x65
-#define MBOX_TARGET_RESET 0x66
-#define MBOX_CLEAR_TASK_SET 0x67
-#define MBOX_ABORT_TASK_SET 0x68
-#define MBOX_GET_FW_STATE 0x69
-#define MBOX_GET_PORT_NAME 0x6a
-#define MBOX_GET_LINK_STATUS 0x6b
-#define MBOX_INIT_LIP_RESET 0x6c
-#define MBOX_SEND_SNS 0x6e
-#define MBOX_FABRIC_LOGIN 0x6f
-#define MBOX_SEND_CHANGE_REQUEST 0x70
-#define MBOX_FABRIC_LOGOUT 0x71
-#define MBOX_INIT_LIP_LOGIN 0x72
+#define MBOX_GET_TARGET_STATUS 0x0056
+
+/* These are for the ISP2X00 FC cards */
+#define MBOX_GET_LOOP_ID 0x0020
+#define MBOX_GET_FIRMWARE_OPTIONS 0x0028
+#define MBOX_SET_FIRMWARE_OPTIONS 0x0038
+#define MBOX_GET_RESOURCE_COUNT 0x0042
+#define MBOX_ENHANCED_GET_PDB 0x0047
+#define MBOX_EXEC_COMMAND_IOCB_A64 0x0054
+#define MBOX_INIT_FIRMWARE 0x0060
+#define MBOX_GET_INIT_CONTROL_BLOCK 0x0061
+#define MBOX_INIT_LIP 0x0062
+#define MBOX_GET_FC_AL_POSITION_MAP 0x0063
+#define MBOX_GET_PORT_DB 0x0064
+#define MBOX_CLEAR_ACA 0x0065
+#define MBOX_TARGET_RESET 0x0066
+#define MBOX_CLEAR_TASK_SET 0x0067
+#define MBOX_ABORT_TASK_SET 0x0068
+#define MBOX_GET_FW_STATE 0x0069
+#define MBOX_GET_PORT_NAME 0x006A
+#define MBOX_GET_LINK_STATUS 0x006B
+#define MBOX_INIT_LIP_RESET 0x006C
+#define MBOX_SEND_SNS 0x006E
+#define MBOX_FABRIC_LOGIN 0x006F
+#define MBOX_SEND_CHANGE_REQUEST 0x0070
+#define MBOX_FABRIC_LOGOUT 0x0071
+#define MBOX_INIT_LIP_LOGIN 0x0072
+
+#define MBOX_GET_SET_DATA_RATE 0x005D /* 23XX only */
+#define MBGSD_GET_RATE 0
+#define MBGSD_SET_RATE 1
+#define MBGSD_ONEGB 0
+#define MBGSD_TWOGB 1
+#define MBGSD_AUTO 2
+
#define ISP2100_SET_PCI_PARAM 0x00ff
@@ -654,9 +662,9 @@ typedef struct isp_icb {
#define ICBXOPT_RIO_32BIT_DELAY 4
/* These 3 only apply to the 2300 */
-#define ICBXOPT_RATE_ONEGB (0 << 14)
-#define ICBXOPT_RATE_TWOGB (1 << 14)
-#define ICBXOPT_RATE_AUTO (2 << 14)
+#define ICBZOPT_RATE_ONEGB (MBGSD_ONEGB << 14)
+#define ICBZOPT_RATE_TWOGB (MBGSD_TWOGB << 14)
+#define ICBZOPT_RATE_AUTO (MBGSD_AUTO << 14)
#define ICB_MIN_FRMLEN 256
diff --git a/sys/dev/ic/ispvar.h b/sys/dev/ic/ispvar.h
index 5011620dd3b..d826ce10926 100644
--- a/sys/dev/ic/ispvar.h
+++ b/sys/dev/ic/ispvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ispvar.h,v 1.17 2001/09/01 07:16:40 mjacob Exp $ */
+/* $OpenBSD: ispvar.h,v 1.18 2001/10/06 22:45:52 mjacob Exp $ */
/*
* Soft Definitions for for Qlogic ISP SCSI adapters.
*
@@ -244,7 +244,7 @@ typedef struct {
typedef struct {
u_int32_t isp_fwoptions : 16,
- : 2,
+ isp_gbspeed : 2,
isp_iid_set : 1,
loop_seen_once : 1,
isp_loopstate : 4, /* Current Loop State */
@@ -257,7 +257,7 @@ typedef struct {
u_int8_t isp_alpa; /* ALPA */
u_int32_t isp_portid;
volatile u_int16_t isp_lipseq; /* LIP sequence # */
- u_int16_t isp_xxxxxx;
+ u_int16_t isp_fwattr; /* firmware attributes */
u_int8_t isp_execthrottle;
u_int8_t isp_retry_delay;
u_int8_t isp_retry_count;
@@ -419,6 +419,8 @@ typedef struct ispsoftc {
*/
#define ISP_CFG_NORELOAD 0x80 /* don't download f/w */
#define ISP_CFG_NONVRAM 0x40 /* ignore NVRAM */
+#define ISP_CFG_TWOGB 0x20 /* force 2GB connection (23XX only) */
+#define ISP_CFG_ONEGB 0x10 /* force 1GB connection (23XX only) */
#define ISP_CFG_FULL_DUPLEX 0x01 /* Full Duplex (Fibre Channel only) */
#define ISP_CFG_OWNWWN 0x02 /* override NVRAM wwn */
#define ISP_CFG_PORT_PREF 0x0C /* Mask for Port Prefs (2200 only) */
@@ -464,7 +466,13 @@ typedef struct ispsoftc {
#define ISP_CODE_ORG 0x1000 /* default f/w code start */
#define ISP_CODE_ORG_2300 0x0800 /* ..except for 2300s */
#define ISP_FW_REV(maj, min, mic) ((maj << 24) | (min << 16) | mic)
+#define ISP_FW_MAJOR(code) ((code >> 24) & 0xff)
+#define ISP_FW_MINOR(code) ((code >> 16) & 0xff)
+#define ISP_FW_MICRO(code) ((code >> 8) & 0xff)
#define ISP_FW_REVX(xp) ((xp[0]<<24) | (xp[1] << 16) | xp[2])
+#define ISP_FW_MAJORX(xp) (xp[0])
+#define ISP_FW_MINORX(xp) (xp[1])
+#define ISP_FW_MICROX(xp) (xp[2])
/*
* Bus (implementation) types
diff --git a/sys/dev/pci/isp_pci.c b/sys/dev/pci/isp_pci.c
index b8d91ceafef..a28dae32fb1 100644
--- a/sys/dev/pci/isp_pci.c
+++ b/sys/dev/pci/isp_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: isp_pci.c,v 1.24 2001/09/29 01:23:54 mjacob Exp $ */
+/* $OpenBSD: isp_pci.c,v 1.25 2001/10/06 22:45:52 mjacob Exp $ */
/*
* PCI specific probe and attach routines for Qlogic ISP SCSI adapters.
*
@@ -774,6 +774,10 @@ isp_pci_rd_isr_2300(struct ispsoftc *isp, u_int16_t *isrp,
struct isp_pcisoftc *pcs = (struct isp_pcisoftc *) isp;
u_int32_t r2hisr;
+ if (!(BXR2(pcs, IspVirt2Off(isp, BIU_ISR)) & BIU2100_ISR_RISC_INT)) {
+ *isrp = 0;
+ return (0);
+ }
r2hisr = bus_space_read_4(pcs->pci_st, pcs->pci_sh,
IspVirt2Off(pcs, BIU_R2HSTSLO));
isp_prt(isp, ISP_LOGDEBUG3, "RISC2HOST ISR 0x%x", r2hisr);