summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormjacob <mjacob@FreeBSD.org>2001-09-03 03:09:48 +0000
committermjacob <mjacob@FreeBSD.org>2001-09-03 03:09:48 +0000
commit6fb9ceec699cd6d1ec5bbad7dd1503b487b8f718 (patch)
treecab168b6f71b2aaff591b96c9c203ef8b1bc454c /sys
parentbee4897b1ae3474badd77f48105e26c21751cb56 (diff)
downloadFreeBSD-src-6fb9ceec699cd6d1ec5bbad7dd1503b487b8f718.zip
FreeBSD-src-6fb9ceec699cd6d1ec5bbad7dd1503b487b8f718.tar.gz
Clarify issues about whether we have SCCLUN (65535 luns) or non-SCCLUN (16
luns) firmware for the Fibre Channel cards. We used to assume that if we didn't download firmware, we couldn't know what the firmware capability with respect to SCCLUNs is- and it's important because the lun field changes in the request queue entry based upon which firmware it is. At any rate, we *do* get back firmware attributes in mailbox register 6 when we do ABOUT FIRMWARE for all 2200/2300 cards- and for 2100 cards with at least 1.17.0 firmware. So- we now assume non-SCCLUN behaviour for 2100 cards with firmware < 1.17.0- and we check the firmware attributes for other cards (loaded firmware or not). This also allows us to get rid of the crappy test of isp_maxluns > 16- we simply can check firmware attributes for SCCLUN behaviour. This required an 'oops' fix to the outgoing mailbox count field for ABOUT FIRMWARE for FC cards. Also- while here, hardwire firmware revisions for loaded code for SBus cards. Apparently the 1.35 or 1.37 f/w we've been loading into isp1000 just doesn't report firmware revisions out to mailbox regs 1, 2 and 3 like everyone else. Grumble. Not that this fix hardly matters for FreeBSD. MFC after: 4 weeks
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/isp/isp.c93
1 files changed, 62 insertions, 31 deletions
diff --git a/sys/dev/isp/isp.c b/sys/dev/isp/isp.c
index 783fcea..8e6e5af 100644
--- a/sys/dev/isp/isp.c
+++ b/sys/dev/isp/isp.c
@@ -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,6 +208,7 @@ isp_reset(struct ispsoftc *isp)
}
DISABLE_INTS(isp);
+
/*
* Set up default request/response queue in-pointer/out-pointer
* register indices.
@@ -675,22 +676,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 +751,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 +770,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;
}
}
}
@@ -1193,7 +1223,8 @@ isp_fibre_init(struct ispsoftc *isp)
}
}
- 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)
@@ -2678,7 +2709,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 +2832,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 +4012,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 +4208,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: */
OpenPOWER on IntegriCloud