Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/sys/dev/ic Pull up revisions 1.66-1.73 (requested by mj...
details: https://anonhg.NetBSD.org/src/rev/a59f216cbe05
branches: netbsd-1-5
changeset: 490881:a59f216cbe05
user: he <he%NetBSD.org@localhost>
date: Fri Mar 16 19:13:01 2001 +0000
description:
Pull up revisions 1.66-1.73 (requested by mjacob):
Add ISPCTL_RUN_MBOXCMD control function and ISPASYNC_UNHANDLED_RESPONSE
async event. Call ISP_DUMPREGS on f/w erro. Correct problem in
bitmap for MBOX_DUMP_RAM. Remove ISP2100_FABRIC defines. When
resetting the Qlogic 2X00 units, reset the FPM (Fibre Protocol
Module) and FBM (Fibre Buffer Modules). Massively redo how loop
events are handled. Throw out ISP_CFG_NOINIT and do HBA roles
instead. Use a SNS REGISTER FC4 TYPE subcommand to register with
the name server. Don't attempt to modify strings that the compiler
might have marked readonly. Bad ANSI! No Biscuit! Do some -Wformat
patches. Fix longstanding bug in ICB initialization of WWNs.
Handles are u_int16_t now. ANSIfy.
diffstat:
sys/dev/ic/isp.c | 1498 +++++++++++++++++++++++++++++++++--------------------
1 files changed, 916 insertions(+), 582 deletions(-)
diffs (truncated from 2357 to 300 lines):
diff -r 306625d53109 -r a59f216cbe05 sys/dev/ic/isp.c
--- a/sys/dev/ic/isp.c Fri Mar 16 19:10:20 2001 +0000
+++ b/sys/dev/ic/isp.c Fri Mar 16 19:13:01 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: isp.c,v 1.53.2.3 2001/01/25 18:25:39 jhawk Exp $ */
+/* $NetBSD: isp.c,v 1.53.2.4 2001/03/16 19:13:01 he Exp $ */
/*
* This driver, which is contained in NetBSD in the files:
*
@@ -31,7 +31,7 @@
* Machine and OS Independent (well, as best as possible)
* code for the Qlogic ISP SCSI adapters.
*
- * Copyright (c) 1997, 1998, 1999 by Matthew Jacob
+ * Copyright (c) 1997, 1998, 1999, 2000, 2001 by Matthew Jacob
* NASA/Ames Research Center
* All rights reserved.
*
@@ -92,44 +92,42 @@
/*
* Local static data
*/
-static char *warnlun =
+static const char warnlun[] =
"WARNING- cannot determine Expanded LUN capability- limiting to one LUN";
-static char *portshift =
+static const char portshift[] =
"Target %d Loop ID 0x%x (Port 0x%x) => Loop 0x%x (Port 0x%x)";
-static char *portdup =
+static const char portdup[] =
"Target %d duplicates Target %d- killing off both";
-static char *retained =
+static const char retained[] =
"Retaining Loop ID 0x%x for Target %d (Port 0x%x)";
-#ifdef ISP2100_FABRIC
-static char *lretained =
+static const char lretained[] =
"Retained login of Target %d (Loop ID 0x%x) Port 0x%x";
-static char *plogout =
+static const char plogout[] =
"Logging out Target %d at Loop ID 0x%x (Port 0x%x)";
-static char *plogierr =
+static const char plogierr[] =
"Command Error in PLOGI for Port 0x%x (0x%x)";
-static char *nopdb =
+static const char nopdb[] =
"Could not get PDB for Device @ Port 0x%x";
-static char *pdbmfail1 =
+static const char pdbmfail1[] =
"PDB Loop ID info for Device @ Port 0x%x does not match up (0x%x)";
-static char *pdbmfail2 =
+static const char pdbmfail2[] =
"PDB Port info for Device @ Port 0x%x does not match up (0x%x)";
-static char *ldumped =
+static const char ldumped[] =
"Target %d (Loop ID 0x%x) Port 0x%x dumped after login info mismatch";
-#endif
-static char *notresp =
+static const char notresp[] =
"Not RESPONSE in RESPONSE Queue (type 0x%x) @ idx %d (next %d) nlooked %d";
-static char *xact1 =
+static const char xact1[] =
"HBA attempted queued transaction with disconnect not set for %d.%d.%d";
-static char *xact2 =
+static const char xact2[] =
"HBA attempted queued transaction to target routine %d on target %d bus %d";
-static char *xact3 =
+static const char xact3[] =
"HBA attempted queued cmd for %d.%d.%d when queueing disabled";
-static char *pskip =
+static const char pskip[] =
"SCSI phase skipped for target %d.%d.%d";
-static char *topology =
+static const char topology[] =
"Loop ID %d, AL_PA 0x%x, Port ID 0x%x, Loop State 0x%x, Topology '%s'";
-static char *finmsg =
- "(%d.%d.%d): FIN dl%d resid%d STS 0x%x SKEY %c XS_ERR=0x%x";
+static const char finmsg[] =
+ "(%d.%d.%d): FIN dl%d resid %d STS 0x%x SKEY %c XS_ERR=0x%x";
/*
* Local function prototypes.
*/
@@ -138,20 +136,20 @@
__P((struct ispsoftc *, ispstatusreq_t *, u_int16_t *));
static void isp_parse_status
__P((struct ispsoftc *, ispstatusreq_t *, XS_T *));
-static void isp_fastpost_complete __P((struct ispsoftc *, u_int32_t));
+static void isp_fastpost_complete __P((struct ispsoftc *, u_int16_t));
static void isp_scsi_init __P((struct ispsoftc *));
static void isp_scsi_channel_init __P((struct ispsoftc *, int));
static void isp_fibre_init __P((struct ispsoftc *));
static void isp_mark_getpdb_all __P((struct ispsoftc *));
+static int isp_getmap __P((struct ispsoftc *, fcpos_map_t *));
static int isp_getpdb __P((struct ispsoftc *, int, isp_pdb_t *));
static u_int64_t isp_get_portname __P((struct ispsoftc *, int, int));
static int isp_fclink_test __P((struct ispsoftc *, int));
static char *isp2100_fw_statename __P((int));
-static int isp_same_lportdb __P((struct lportdb *, struct lportdb *));
-static int isp_pdb_sync __P((struct ispsoftc *, int));
-#ifdef ISP2100_FABRIC
+static int isp_pdb_sync __P((struct ispsoftc *));
+static int isp_scan_loop __P((struct ispsoftc *));
static int isp_scan_fabric __P((struct ispsoftc *));
-#endif
+static void isp_register_fc4_type __P((struct ispsoftc *));
static void isp_fw_state __P((struct ispsoftc *));
static void isp_mboxcmd __P((struct ispsoftc *, mbreg_t *, int));
@@ -173,12 +171,11 @@
* Locking done elsewhere.
*/
void
-isp_reset(isp)
- struct ispsoftc *isp;
+isp_reset(struct ispsoftc *isp)
{
mbreg_t mbs;
int loops, i, touched, dodnld = 1;
- char *revname;
+ char *revname = "????";
isp->isp_state = ISP_NILSTATE;
@@ -230,22 +227,30 @@
DISABLE_INTS(isp);
/*
- * Put the board into PAUSE mode (so we can read the SXP registers).
+ * Put the board into PAUSE mode (so we can read the SXP registers
+ * or write FPM/FBM registers).
*/
ISP_WRITE(isp, HCCR, HCCR_CMD_PAUSE);
if (IS_FC(isp)) {
- revname = "2X00";
switch (isp->isp_type) {
case ISP_HA_FC_2100:
- revname[1] = '1';
+ revname = "2100";
break;
case ISP_HA_FC_2200:
- revname[1] = '2';
+ revname = "2200";
break;
default:
break;
}
+ /*
+ * While we're paused, reset the FPM module and FBM fifos.
+ */
+ ISP_WRITE(isp, BIU2100_CSR, BIU2100_FPM0_REGS);
+ ISP_WRITE(isp, FPM_DIAG_CONFIG, FPM_SOFT_RESET);
+ ISP_WRITE(isp, BIU2100_CSR, BIU2100_FB_REGS);
+ ISP_WRITE(isp, FBM_CMD, FBMCMD_FIFO_RESET_ALL);
+ ISP_WRITE(isp, BIU2100_CSR, BIU2100_RISC_REGS);
} else if (IS_1240(isp)) {
sdparam *sdp = isp->isp_param;
revname = "1240";
@@ -257,7 +262,7 @@
* XXX: Should probably do some bus sensing.
*/
} else if (IS_ULTRA2(isp)) {
- static char *m = "bus %d is in %s Mode";
+ static const char m[] = "bus %d is in %s Mode";
u_int16_t l;
sdparam *sdp = isp->isp_param;
@@ -489,6 +494,8 @@
*/
ISP_WRITE(isp, HCCR, HCCR_CMD_RESET);
USEC_DELAY(100);
+ /* Clear semaphore register (just to be sure) */
+ ISP_WRITE(isp, BIU_SEMA, 0);
/*
* Establish some initial burst rate stuff.
@@ -526,6 +533,9 @@
#endif
} else {
ISP_WRITE(isp, RISC_MTR2100, 0x1212);
+ if (IS_2200(isp)) {
+ ISP_WRITE(isp, HCCR, HCCR_2X00_DISABLE_PARITY_PAUSE);
+ }
}
ISP_WRITE(isp, HCCR, HCCR_CMD_RELEASE); /* release paused processor */
@@ -747,8 +757,7 @@
*/
void
-isp_init(isp)
- struct ispsoftc *isp;
+isp_init(struct ispsoftc *isp)
{
/*
* Must do this first to get defaults established.
@@ -757,18 +766,15 @@
if (IS_DUALBUS(isp)) {
isp_setdfltparm(isp, 1);
}
- if ((isp->isp_confopts & ISP_CFG_NOINIT) == 0) {
- if (IS_FC(isp)) {
- isp_fibre_init(isp);
- } else {
- isp_scsi_init(isp);
- }
+ if (IS_FC(isp)) {
+ isp_fibre_init(isp);
+ } else {
+ isp_scsi_init(isp);
}
}
static void
-isp_scsi_init(isp)
- struct ispsoftc *isp;
+isp_scsi_init(struct ispsoftc *isp)
{
sdparam *sdp_chan0, *sdp_chan1;
mbreg_t mbs;
@@ -779,6 +785,13 @@
sdp_chan1++;
}
+ /*
+ * If we have no role (neither target nor initiator), return.
+ */
+ if (isp->isp_role == ISP_ROLE_NONE) {
+ return;
+ }
+
/* First do overall per-card settings. */
/*
@@ -925,9 +938,7 @@
}
static void
-isp_scsi_channel_init(isp, channel)
- struct ispsoftc *isp;
- int channel;
+isp_scsi_channel_init(struct ispsoftc *isp, int channel)
{
sdparam *sdp;
mbreg_t mbs;
@@ -945,7 +956,8 @@
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
return;
}
- isp_prt(isp, ISP_LOGINFO, "Initiator ID is %d", sdp->isp_initiator_id);
+ isp_prt(isp, ISP_LOGINFO, "Initiator ID is %d on Channel %d",
+ sdp->isp_initiator_id, channel);
/*
@@ -1029,8 +1041,7 @@
* Locks are held before coming here.
*/
static void
-isp_fibre_init(isp)
- struct ispsoftc *isp;
+isp_fibre_init(struct ispsoftc *isp)
{
fcparam *fcp;
isp_icb_t *icbp;
@@ -1040,6 +1051,20 @@
fcp = isp->isp_param;
+ /*
+ * Do this *before* initializing the firmware.
+ */
+ isp_mark_getpdb_all(isp);
+ fcp->isp_fwstate = FW_CONFIG_WAIT;
+ fcp->isp_loopstate = LOOP_NIL;
+
+ /*
+ * If we have no role (neither target nor initiator), return.
+ */
+ if (isp->isp_role == ISP_ROLE_NONE) {
+ return;
+ }
+
loopid = DEFAULT_LOOPID(isp);
icbp = (isp_icb_t *) fcp->isp_scratch;
MEMZERO(icbp, sizeof (*icbp));
@@ -1074,11 +1099,19 @@
*/
fcp->isp_fwoptions |= ICBOPT_PDBCHANGE_AE;
+
/*
- * We don't set ICBOPT_PORTNAME because we want our
- * Node Name && Port Names to be distinct.
+ * Make sure that target role reflects into fwoptions.
*/
-
+ if (isp->isp_role & ISP_ROLE_TARGET) {
+ fcp->isp_fwoptions |= ICBOPT_TGT_ENABLE;
+ } else {
Home |
Main Index |
Thread Index |
Old Index