Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic Add some more definitions appropriate for T10 sta...
details: https://anonhg.NetBSD.org/src/rev/d3afba2e17bf
branches: trunk
changeset: 750489:d3afba2e17bf
user: mjacob <mjacob%NetBSD.org@localhost>
date: Sun Jan 03 02:47:09 2010 +0000
description:
Add some more definitions appropriate for T10 standards
and use those cleaned up definitions.
Use 2100 style firmware loading if the load address and
load size is less than 64k. Some apparently buggy ROMs
out there choke otherwise.
Clean up some WWNN derivations from WWPN.
diffstat:
sys/dev/ic/isp.c | 102 ++++++++++++++++++++++++++--------------------
sys/dev/ic/isp_stds.h | 5 +-
sys/dev/ic/isp_tpublic.h | 6 +-
sys/dev/ic/ispmbox.h | 28 ++++++++++++-
4 files changed, 92 insertions(+), 49 deletions(-)
diffs (293 lines):
diff -r a8f5f446ace7 -r d3afba2e17bf sys/dev/ic/isp.c
--- a/sys/dev/ic/isp.c Sun Jan 03 01:07:19 2010 +0000
+++ b/sys/dev/ic/isp.c Sun Jan 03 02:47:09 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: isp.c,v 1.117 2009/06/25 23:44:01 mjacob Exp $ */
+/* $NetBSD: isp.c,v 1.118 2010/01/03 02:47:09 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.117 2009/06/25 23:44:01 mjacob Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isp.c,v 1.118 2010/01/03 02:47:09 mjacob Exp $");
#include <dev/ic/isp_netbsd.h>
#endif
#ifdef __FreeBSD__
@@ -784,15 +784,25 @@
}
MEMORYBARRIER(isp, SYNC_REQUEST, 0, ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)));
ISP_MEMZERO(&mbs, sizeof (mbs));
- mbs.param[0] = MBOX_LOAD_RISC_RAM;
- mbs.param[1] = la;
- mbs.param[2] = DMA_WD1(isp->isp_rquest_dma);
- mbs.param[3] = DMA_WD0(isp->isp_rquest_dma);
- mbs.param[4] = nw >> 16;
- mbs.param[5] = nw;
- mbs.param[6] = DMA_WD3(isp->isp_rquest_dma);
- mbs.param[7] = DMA_WD2(isp->isp_rquest_dma);
- mbs.param[8] = la >> 16;
+ if (la < 0x10000 && nw < 0x10000) {
+ mbs.param[0] = MBOX_LOAD_RISC_RAM_2100;
+ mbs.param[1] = la;
+ mbs.param[2] = DMA_WD1(isp->isp_rquest_dma);
+ mbs.param[3] = DMA_WD0(isp->isp_rquest_dma);
+ mbs.param[4] = nw;
+ mbs.param[6] = DMA_WD3(isp->isp_rquest_dma);
+ mbs.param[7] = DMA_WD2(isp->isp_rquest_dma);
+ } else {
+ mbs.param[0] = MBOX_LOAD_RISC_RAM;
+ mbs.param[1] = la;
+ mbs.param[2] = DMA_WD1(isp->isp_rquest_dma);
+ mbs.param[3] = DMA_WD0(isp->isp_rquest_dma);
+ mbs.param[4] = nw >> 16;
+ mbs.param[5] = nw;
+ mbs.param[6] = DMA_WD3(isp->isp_rquest_dma);
+ mbs.param[7] = DMA_WD2(isp->isp_rquest_dma);
+ mbs.param[8] = la >> 16;
+ }
mbs.logval = MBLOGALL;
isp_mboxcmd(isp, &mbs);
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
@@ -827,7 +837,7 @@
while (wi < ptr[3]) {
uint16_t *cp;
- uint32_t nw;
+ uint16_t nw;
nw = ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)) >> 1;
if (nw > wl) {
@@ -843,14 +853,24 @@
}
MEMORYBARRIER(isp, SYNC_REQUEST, 0, ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)));
ISP_MEMZERO(&mbs, sizeof (mbs));
- mbs.param[0] = MBOX_LOAD_RISC_RAM;
- mbs.param[1] = la;
- mbs.param[2] = DMA_WD1(isp->isp_rquest_dma);
- mbs.param[3] = DMA_WD0(isp->isp_rquest_dma);
- mbs.param[4] = nw;
- mbs.param[6] = DMA_WD3(isp->isp_rquest_dma);
- mbs.param[7] = DMA_WD2(isp->isp_rquest_dma);
- mbs.param[8] = la >> 16;
+ if (la < 0x10000) {
+ mbs.param[0] = MBOX_LOAD_RISC_RAM_2100;
+ mbs.param[1] = la;
+ mbs.param[2] = DMA_WD1(isp->isp_rquest_dma);
+ mbs.param[3] = DMA_WD0(isp->isp_rquest_dma);
+ mbs.param[4] = nw;
+ mbs.param[6] = DMA_WD3(isp->isp_rquest_dma);
+ mbs.param[7] = DMA_WD2(isp->isp_rquest_dma);
+ } else {
+ mbs.param[0] = MBOX_LOAD_RISC_RAM;
+ mbs.param[1] = la;
+ mbs.param[2] = DMA_WD1(isp->isp_rquest_dma);
+ mbs.param[3] = DMA_WD0(isp->isp_rquest_dma);
+ mbs.param[4] = nw;
+ mbs.param[6] = DMA_WD3(isp->isp_rquest_dma);
+ mbs.param[7] = DMA_WD2(isp->isp_rquest_dma);
+ mbs.param[8] = la >> 16;
+ }
mbs.logval = MBLOGALL;
isp_mboxcmd(isp, &mbs);
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
@@ -1528,24 +1548,18 @@
}
icbp->icb_maxfrmlen = DEFAULT_FRAMESIZE(isp);
- if (icbp->icb_maxfrmlen < ICB_MIN_FRMLEN ||
- icbp->icb_maxfrmlen > ICB_MAX_FRMLEN) {
- isp_prt(isp, ISP_LOGERR,
- "bad frame length (%d) from NVRAM- using %d",
- DEFAULT_FRAMESIZE(isp), ICB_DFLT_FRMLEN);
+ if (icbp->icb_maxfrmlen < ICB_MIN_FRMLEN || icbp->icb_maxfrmlen > ICB_MAX_FRMLEN) {
+ isp_prt(isp, ISP_LOGERR, "bad frame length (%d) from NVRAM- using %d", DEFAULT_FRAMESIZE(isp), ICB_DFLT_FRMLEN);
icbp->icb_maxfrmlen = ICB_DFLT_FRMLEN;
}
icbp->icb_maxalloc = fcp->isp_maxalloc;
if (icbp->icb_maxalloc < 1) {
- isp_prt(isp, ISP_LOGERR,
- "bad maximum allocation (%d)- using 16", fcp->isp_maxalloc);
+ isp_prt(isp, ISP_LOGERR, "bad maximum allocation (%d)- using 16", fcp->isp_maxalloc);
icbp->icb_maxalloc = 16;
}
icbp->icb_execthrottle = DEFAULT_EXEC_THROTTLE(isp);
if (icbp->icb_execthrottle < 1) {
- isp_prt(isp, ISP_LOGERR,
- "bad execution throttle of %d- using %d",
- DEFAULT_EXEC_THROTTLE(isp), ICB_DFLT_THROTTLE);
+ isp_prt(isp, ISP_LOGERR, "bad execution throttle of %d- using %d", DEFAULT_EXEC_THROTTLE(isp), ICB_DFLT_THROTTLE);
icbp->icb_execthrottle = ICB_DFLT_THROTTLE;
}
icbp->icb_retry_delay = fcp->isp_retry_delay;
@@ -1639,18 +1653,18 @@
/*
* For 22XX > 2.1.26 && 23XX, set some options.
- * XXX: Probably okay for newer 2100 f/w too.
*/
if (ISP_FW_NEWER_THAN(isp, 2, 26, 0)) {
- /*
- * Turn on LIP F8 async event (1)
- * Turn on generate AE 8013 on all LIP Resets (2)
- * Disable LIP F7 switching (8)
- */
MBSINIT(&mbs, MBOX_SET_FIRMWARE_OPTIONS, MBLOGALL, 0);
- mbs.param[1] = 0xb;
+ mbs.param[1] = IFCOPT1_DISF7SWTCH|IFCOPT1_LIPASYNC|IFCOPT1_LIPF8;
mbs.param[2] = 0;
mbs.param[3] = 0;
+ if (ISP_FW_NEWER_THAN(isp, 3, 16, 0)) {
+ mbs.param[1] |= IFCOPT1_EQFQASYNC|IFCOPT1_CTIO_RETRY;
+ if (fcp->role & ISP_ROLE_TARGET) {
+ mbs.param[3] = IFCOPT3_NOPRLI;
+ }
+ }
isp_mboxcmd(isp, &mbs);
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
return;
@@ -2074,8 +2088,7 @@
* or via FABRIC LOGIN/FABRIC LOGOUT for other cards.
*/
static int
-isp_plogx(ispsoftc_t *isp, int chan, uint16_t handle, uint32_t portid,
- int flags, int gs)
+isp_plogx(ispsoftc_t *isp, int chan, uint16_t handle, uint32_t portid, int flags, int gs)
{
mbreg_t mbs;
uint8_t q[QENTRY_LEN];
@@ -8274,6 +8287,8 @@
if ((wwn >> 60) == 0) {
wwn |= (((uint64_t) 2)<< 60);
}
+ } else {
+ wwn = fcp->isp_wwpn_nvram & ~((uint64_t) 0xfff << 48);
}
} else {
wwn &= ~((uint64_t) 0xfff << 48);
@@ -8339,11 +8354,6 @@
ISP2400_NVRAM_FIRMWARE_OPTIONS3(nvram_data));
wwn = ISP2400_NVRAM_PORT_NAME(nvram_data);
- if (wwn) {
- if ((wwn >> 60) != 2 && (wwn >> 60) != 5) {
- wwn = 0;
- }
- }
fcp->isp_wwpn_nvram = wwn;
wwn = ISP2400_NVRAM_NODE_NAME(nvram_data);
@@ -8352,6 +8362,10 @@
wwn = 0;
}
}
+ if (wwn == 0 && (fcp->isp_wwpn_nvram >> 60) == 2) {
+ wwn = fcp->isp_wwpn_nvram;
+ wwn &= ~((uint64_t) 0xfff << 48);
+ }
fcp->isp_wwnn_nvram = wwn;
if (ISP2400_NVRAM_EXCHANGE_COUNT(nvram_data)) {
diff -r a8f5f446ace7 -r d3afba2e17bf sys/dev/ic/isp_stds.h
--- a/sys/dev/ic/isp_stds.h Sun Jan 03 01:07:19 2010 +0000
+++ b/sys/dev/ic/isp_stds.h Sun Jan 03 02:47:09 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: isp_stds.h,v 1.3 2009/06/25 23:44:02 mjacob Exp $ */
+/* $NetBSD: isp_stds.h,v 1.4 2010/01/03 02:47:09 mjacob Exp $ */
/*-
* Copyright (c) 1997-2008 by Matthew Jacob
* All rights reserved.
@@ -155,6 +155,7 @@
#define FCP_SNSLEN_VALID 0x02
#define FCP_RSPLEN_VALID 0x01
+#define FCP_MAX_RSPLEN 0x8
/*
* FCP Response Code Definitions
* Source: NCITS T10, Project 1144D, Revision 08 (aka FCP2r08)
@@ -167,6 +168,8 @@
#define FCP_RSPNS_EROFS 3
#define FCP_RSPNS_TMF_REJECT 4
#define FCP_RSPNS_TMF_FAILED 5
+#define FCP_RSPNS_TMF_SUCCEEDED 8
+#define FCP_RSPNS_TMF_INCORRECT_LUN 9
/* unconverted miscellany */
diff -r a8f5f446ace7 -r d3afba2e17bf sys/dev/ic/isp_tpublic.h
--- a/sys/dev/ic/isp_tpublic.h Sun Jan 03 01:07:19 2010 +0000
+++ b/sys/dev/ic/isp_tpublic.h Sun Jan 03 02:47:09 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: isp_tpublic.h,v 1.18 2009/06/25 23:44:02 mjacob Exp $ */
+/* $NetBSD: isp_tpublic.h,v 1.19 2010/01/03 02:47:09 mjacob Exp $ */
/*-
* Copyright (c) 1997-2008 by Matthew Jacob
* All rights reserved.
@@ -58,7 +58,7 @@
QOUT_DISABLE, /* the argument is a pointer to a enadis_t */
QOUT_TMD_START, /* the argument is a pointer to a tmd_cmd_t */
QOUT_TMD_DONE, /* the argument is a pointer to a tmd_xact_t */
- QOUT_NOTIFY, /* the argument is a pointer to a isp_notify_t */
+ QOUT_NOTIFY, /* the argument is a pointer to a notify_t */
QOUT_HBA_UNREG /* the argument is a pointer to a hba_register_t */
} tact_e;
@@ -75,7 +75,7 @@
QIN_DISABLE, /* the argument is a pointer to a enadis_t */
QIN_TMD_CONT, /* the argument is a pointer to a tmd_xact_t */
QIN_TMD_FIN, /* the argument is a pointer to a tmd_cmd_t */
- QIN_NOTIFY_ACK, /* the argument is a pointer to a isp_notify_t */
+ QIN_NOTIFY_ACK, /* the argument is a pointer to a notify_t */
QIN_HBA_UNREG, /* the argument is a pointer to a hba_register_t */
} qact_e;
diff -r a8f5f446ace7 -r d3afba2e17bf sys/dev/ic/ispmbox.h
--- a/sys/dev/ic/ispmbox.h Sun Jan 03 01:07:19 2010 +0000
+++ b/sys/dev/ic/ispmbox.h Sun Jan 03 02:47:09 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ispmbox.h,v 1.53 2009/06/25 23:44:02 mjacob Exp $ */
+/* $NetBSD: ispmbox.h,v 1.54 2010/01/03 02:47:10 mjacob Exp $ */
/*
* Copyright (C) 1997, 1998, 1999 National Aeronautics & Space Administration
* All rights reserved.
@@ -247,12 +247,38 @@
#define ASYNC_RCV_ERR 0x8048
/*
+ * Firmware Options. There are a lot of them.
+ *
+ * IFCOPTN - ISP Fibre Channel Option Word N
+ */
+#define IFCOPT1_EQFQASYNC (1 << 13) /* enable QFULL notification */
+#define IFCOPT1_EAABSRCVD (1 << 12)
+#define IFCOPT1_RJTASYNC (1 << 11) /* enable 8018 notification */
+#define IFCOPT1_ENAPURE (1 << 10)
+#define IFCOPT1_ENA8017 (1 << 7)
+#define IFCOPT1_DISGPIO67 (1 << 6)
+#define IFCOPT1_LIPLOSSIMM (1 << 5)
+#define IFCOPT1_DISF7SWTCH (1 << 4)
+#define IFCOPT1_CTIO_RETRY (1 << 3)
+#define IFCOPT1_LIPASYNC (1 << 1)
+#define IFCOPT1_LIPF8 (1 << 0)
+
+#define IFCOPT2_LOOPBACK (1 << 1)
+#define IFCOPT2_ATIO3_ONLY (1 << 0)
+
+#define IFCOPT3_NOPRLI (1 << 4) /* disable automatic sending of PRLI on local loops */
+#define IFCOPT3_RNDASYNC (1 << 1)
+/*
* 2.01.31 2200 Only. Need Bit 13 in Mailbox 1 for Set Firmware Options
* mailbox command to enable this.
*/
#define ASYNC_QFULL_SENT 0x8049
/*
+ * Needs to be enabled
+ */
+#define ASYNC_AUTO_PLOGI_RJT 0x8018
+/*
* 24XX only
*/
#define ASYNC_RJT_SENT 0x8049
Home |
Main Index |
Thread Index |
Old Index