Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Oct 2006 20:40:53 GMT
From:      Matt Jacob <mjacob@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 108242 for review
Message-ID:  <200610212040.k9LKerfS071527@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=108242

Change 108242 by mjacob@newisp on 2006/10/21 20:40:27


Affected files ...

.. //depot/projects/newisp/dev/isp/isp.c#21 edit
.. //depot/projects/newisp/dev/isp/isp_target.c#9 edit
.. //depot/projects/newisp/dev/isp/ispvar.h#9 edit

Differences ...

==== //depot/projects/newisp/dev/isp/isp.c#21 (text+ko) ====

@@ -961,6 +961,7 @@
 
 
 	MEMZERO(&mbs, sizeof (mbs));
+	mbs.timeout = 1000000;
 	mbs.param[0] = MBOX_EXEC_FIRMWARE;
 	if (IS_24XX(isp)) {
 		mbs.param[1] = code_org >> 16;
@@ -982,7 +983,6 @@
 	}
 
 	mbs.logval = MBLOGALL;
-	mbs.timeout = 2000000;
 	isp_mboxcmd(isp, &mbs);
 	if (IS_2322(isp) || IS_24XX(isp)) {
 		if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
@@ -993,7 +993,7 @@
 	/*
 	 * Give it a chance to finish starting up.
 	 */
-	USEC_DELAY(1000);
+	USEC_DELAY(250000);
 
 	if (IS_SCSI(isp)) {
 		/*
@@ -1043,7 +1043,7 @@
 		isp->isp_fwrev[2] = mbs.param[3];
 	}
 
-	isp_prt(isp, ISP_LOGCONFIG,
+	isp_prt(isp, ISP_LOGALL,
 	    "Board Type %s, Chip Revision 0x%x, %s F/W Revision %d.%d.%d",
 	    btype, isp->isp_revision, dodnld? "loaded" : "resident",
 	    isp->isp_fwrev[0], isp->isp_fwrev[1], isp->isp_fwrev[2]);
@@ -2288,18 +2288,18 @@
 		return (0);
 
 	case MBOX_COMMAND_ERROR:
-		isp_prt(isp, ISP_LOGERR,
+		isp_prt(isp, ISP_LOGINFO,
 		    "isp_port_login: error 0x%x in PLOGI to port 0x%06x",
 		    mbs.param[1], portid);
 		return (MBOX_COMMAND_ERROR);
 
 	case MBOX_ALL_IDS_USED:
-		isp_prt(isp, ISP_LOGERR,
+		isp_prt(isp, ISP_LOGINFO,
 		    "isp_port_login: all IDs used for fabric login");
 		return (MBOX_ALL_IDS_USED);
 
 	default:
-		isp_prt(isp, ISP_LOGERR,
+		isp_prt(isp, ISP_LOGINFO,
 		    "isp_port_login: error 0x%x on port login of 0x%06x@0x%0x",
 		    mbs.param[0], portid, handle);
 		return (mbs.param[0]);
@@ -2384,12 +2384,12 @@
 static uint64_t
 isp_get_portname(ispsoftc_t *isp, int loopid, int nodename)
 {
-	uint64_t wwn = 0;
+	uint64_t wwn = (uint64_t) -1;
 	mbreg_t mbs;
 
 	MEMZERO(&mbs, sizeof (mbs));
 	mbs.param[0] = MBOX_GET_PORT_NAME;
-	if (FCPARAM(isp)->isp_2klogin) {
+	if (FCPARAM(isp)->isp_2klogin || IS_24XX(isp)) {
 		mbs.param[1] = loopid;
 		mbs.ibits = (1 << 10);
 		if (nodename) {
@@ -2402,8 +2402,22 @@
 		}
 	}
 	mbs.logval = MBLOGALL & ~MBOX_COMMAND_PARAM_ERROR;
+	mbs.timeout = 30000;
 	isp_mboxcmd(isp, &mbs);
-	if (mbs.param[0] == MBOX_COMMAND_COMPLETE) {
+	if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
+		return (wwn);
+	}
+	if (IS_24XX(isp)) {
+		wwn =
+		    (((uint64_t)(mbs.param[2] >> 8))  << 56) |
+		    (((uint64_t)(mbs.param[2] & 0xff))	<< 48) |
+		    (((uint64_t)(mbs.param[3] >> 8))	<< 40) |
+		    (((uint64_t)(mbs.param[3] & 0xff))	<< 32) |
+		    (((uint64_t)(mbs.param[6] >> 8))	<< 24) |
+		    (((uint64_t)(mbs.param[6] & 0xff))	<< 16) |
+		    (((uint64_t)(mbs.param[7] >> 8))	<<  8) |
+		    (((uint64_t)(mbs.param[7] & 0xff)));
+	} else {
 		wwn =
 		    (((uint64_t)(mbs.param[2] & 0xff))  << 56) |
 		    (((uint64_t)(mbs.param[2] >> 8))	<< 48) |
@@ -3713,7 +3727,7 @@
 	}
 
 	if (i == lim) {
-		isp_prt(isp, ISP_LOGERR, "PLOGI 0x%06x failed", portid);
+		isp_prt(isp, ISP_LOGINFO, "PLOGI 0x%06x failed", portid);
 		return (-1);
 	}
 
@@ -3734,7 +3748,7 @@
 
 	if (p->handle != handle || p->portid != portid) {
 		isp_prt(isp, ISP_LOGERR,
-		    "new device 0x%06x@0x%x changed (0x%06x@0x%0x",
+		    "new device 0x%06x@0x%x changed (0x%06x@0x%0x)",
 		    portid, handle, p->portid, p->handle);
 		return (-1);
 	}
@@ -4363,6 +4377,17 @@
 		}
 		break;
 
+	case ISPCTL_GET_PORTNAME:
+	{
+		uint64_t *wwnp = arg;
+		int loopid = *wwnp;
+		*wwnp = isp_get_portname(isp, loopid, 0);
+		if (*wwnp == (uint64_t) -1) {
+			break;
+		} else {
+			return (0);
+		}
+	}
 	case ISPCTL_RUN_MBOXCMD:
 
 		isp_mboxcmd(isp, arg);

==== //depot/projects/newisp/dev/isp/isp_target.c#9 (text+ko) ====

@@ -183,7 +183,7 @@
 			len = at7iop->at_ta_len & 0xfffff;
 			if (len > (QENTRY_LEN - 8)) {
 				len -= (QENTRY_LEN - 8);
-				isp_prt(isp, ISP_LOGWARN,
+				isp_prt(isp, ISP_LOGINFO,
 				    "long IU length (%d) ignored", len);
 				while (len > 0) {
 					*optrp =  ISP_NXT_QENTRY(*optrp,
@@ -273,7 +273,7 @@
 				    &local);
 				break;
 			default:
-				isp_prt(isp, ISP_LOGERR,
+				isp_prt(isp, ISP_LOGINFO,
 				    "isp_target_notify: unknown status (0x%x)",
 				    status);
 				isp_notify_ack(isp, local);
@@ -316,7 +316,7 @@
 			}
 			break;
 		case IN_RSRC_UNAVAIL:
-			isp_prt(isp, ISP_LOGWARN, "Firmware out of ATIOs");
+			isp_prt(isp, ISP_LOGINFO, "Firmware out of ATIOs");
 			isp_notify_ack(isp, local);
 			break;
 		case IN_RESET:
@@ -345,7 +345,7 @@
 			(void) isp_async(isp, ISPASYNC_TARGET_ACTION, &local);
 			break;
 		default:
-			isp_prt(isp, ISP_LOGERR,
+			isp_prt(isp, ISP_LOGINFO,
 			    "isp_target_notify: unknown status (0x%x)",
 			    status);
 			isp_notify_ack(isp, local);
@@ -363,7 +363,7 @@
 			    (na_fcentry_24xx_t *) local);
 			nack_24xx = (na_fcentry_24xx_t *) local;
 			if (nack_24xx->na_status != NA_OK) {
-				level = ISP_LOGERR;
+				level = ISP_LOGINFO;
 			} else {
 				level = ISP_LOGTDEBUG1;
 			}
@@ -381,7 +381,7 @@
 			}
 			nack_fcp = (na_fcentry_t *)local;
 			if (nack_fcp->na_status != NA_OK) {
-				level = ISP_LOGERR;
+				level = ISP_LOGINFO;
 			} else {
 				level = ISP_LOGTDEBUG1;
 			}
@@ -392,7 +392,7 @@
 			isp_get_notify_ack(isp, nackp, (na_entry_t *)local);
 			nackp = (na_entry_t *)local;
 			if (nackp->na_status != NA_OK) {
-				level = ISP_LOGERR;
+				level = ISP_LOGINFO;
 			} else {
 				level = ISP_LOGTDEBUG1;
 			}
@@ -409,10 +409,11 @@
 	case RQSTYPE_ABTS_RSP:
 		isp_get_abts_rsp(isp, abts_rsp, (abts_rsp_t *)local);
 		abts_rsp = (abts_rsp_t *) local;
-		if (abts_rsp->abts_rsp_status)
-			level = ISP_LOGERR;
-		else
+		if (abts_rsp->abts_rsp_status) {
+			level = ISP_LOGINFO;
+		} else {
 			level = ISP_LOGTDEBUG0;
+		}
 		isp_prt(isp, level,
 		    "ABTS RSP response[0x%x]: status=0x%x sub=(0x%x 0x%x)",
 		    abts_rsp->abts_rsp_rxid_task, abts_rsp->abts_rsp_status,
@@ -658,6 +659,10 @@
 			cto->rsp.m1.ct_resp[12] = (code >> 24) & 0xff;
 			cto->rsp.m1.ct_resp[13] = (code >> 16) & 0xff;
 		}
+		if (aep->at_cmnd.cdb_dl.sf.fcp_cmnd_dl) {
+			cto->ct_resid = aep->at_cmnd.cdb_dl.sf.fcp_cmnd_dl;
+			cto->ct_scsi_status |= CT2_DATA_UNDER;
+		}
 		cto->ct_syshandle = hdl;
 	} else if (IS_FC(isp)) {
 		at2_entry_t *aep = arg;
@@ -730,8 +735,8 @@
 	if (!IS_24XX(isp)) {
 		return (-1);
 	}
-	isp_prt(isp, ISP_LOGTDEBUG0,
-	    "isp_terminate_cmd: tag 0x%0x is being terminated",
+	isp_prt(isp, ISP_LOGINFO,
+	    "isp_terminate_cmd: [0x%0x] is being terminated",
 	    tmd->cd_tagval);
 	MEMZERO(&local, sizeof (local));
 	cto->ct_header.rqs_entry_type = RQSTYPE_CTIO7;
@@ -1738,7 +1743,7 @@
 		 */
 		if (ct->ct_syshandle == 0) {
 			if (ct->ct_flags & CT7_TERMINATE) {
-				isp_prt(isp, ISP_LOGALL,
+				isp_prt(isp, ISP_LOGINFO,
 				    "termination of 0x%x complete",
 				    ct->ct_rxid);
 			} else if ((ct->ct_flags & CT7_SENDSTATUS) == 0) {

==== //depot/projects/newisp/dev/isp/ispvar.h#9 (text+ko) ====

@@ -755,6 +755,7 @@
 	ISPCTL_SCAN_LOOP,		/* (Re)scan Local Loop */
 	ISPCTL_PDB_SYNC,		/* Synchronize Port Database */
 	ISPCTL_SEND_LIP,		/* Send a LIP */
+	ISPCTL_GET_PORTNAME,		/* get portname from an N-port handle */
 	ISPCTL_RUN_MBOXCMD,		/* run a mailbox command */
 	ISPCTL_TOGGLE_TMODE,		/* toggle target mode */
 	ISPCTL_GET_PDB			/* get a single port database entry */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200610212040.k9LKerfS071527>