PERFORCE change 106428 for review

Matt Jacob mjacob at FreeBSD.org
Wed Sep 20 18:09:36 PDT 2006


http://perforce.freebsd.org/chv.cgi?CH=106428

Change 106428 by mjacob at newisp on 2006/09/21 01:09:09

	Checkpoint some 24XX changes.

Affected files ...

.. //depot/projects/newisp/dev/isp/isp.c#12 edit
.. //depot/projects/newisp/dev/isp/isp_target.c#5 edit
.. //depot/projects/newisp/dev/isp/isp_target.h#7 edit
.. //depot/projects/newisp/dev/isp/ispmbox.h#5 edit
.. //depot/projects/newisp/dev/isp/ispvar.h#4 edit

Differences ...

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

@@ -4303,7 +4303,7 @@
 	 * We can't be getting this now.
 	 */
 	if (isp->isp_state != ISP_RUNSTATE) {
-		isp_prt(isp, ISP_LOGWARN,
+		isp_prt(isp, ISP_LOGINFO,
 		    "interrupt (ISR=%x SEMA=%x) when not ready", isr, sema);
 		/*
 		 * Thank you very much!  *Burrrp*!
@@ -4332,7 +4332,8 @@
 		 * Debug: to be taken out eventually
 		 */
 		if (isp->isp_residx != optr) {
-			isp_prt(isp, ISP_LOGWARN, "optr %x soft optr %x",
+			isp_prt(isp, ISP_LOGINFO,
+			    "isp_intr: hard optr=%x, soft optr %x",
 			    optr, isp->isp_residx);
 		}
 	} else {
@@ -5148,6 +5149,7 @@
 	case RQSTYPE_ATIO2:
 	case RQSTYPE_CTIO2:
 	case RQSTYPE_CTIO3:
+	case RQSTYPE_CTIO7:
 		isp->isp_rsltccmplt++;	/* count as a response completion */
 #ifdef	ISP_TARGET_MODE
 		if (isp_target_notify(isp, (ispstatusreq_t *) hp, optrp)) {

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

@@ -62,6 +62,7 @@
 static void isp_handle_atio2(ispsoftc_t *, at2_entry_t *);
 static void isp_handle_ctio(ispsoftc_t *, ct_entry_t *);
 static void isp_handle_ctio2(ispsoftc_t *, ct2_entry_t *);
+static void isp_handle_ctio7(ispsoftc_t *, ct7_entry_t *);
 
 /*
  * The Qlogic driver gets an interrupt to look at response queue entries.
@@ -117,9 +118,11 @@
 		at_entry_t	*atiop;
 		at2_entry_t	*at2iop;
 		at2e_entry_t	*at2eiop;
+		at7_entry_t	*at7iop;
 		ct_entry_t	*ctiop;
 		ct2_entry_t	*ct2iop;
 		ct2e_entry_t	*ct2eiop;
+		ct7_entry_t	*ct7iop;
 		lun_entry_t	*lunenp;
 		in_entry_t	*inotp;
 		in_fcentry_t	*inot_fcp;
@@ -132,9 +135,11 @@
 #define	atiop		unp.atiop
 #define	at2iop		unp.at2iop
 #define	at2eiop		unp.at2eiop
+#define	at7iop		unp.at7iop
 #define	ctiop		unp.ctiop
 #define	ct2iop		unp.ct2iop
 #define	ct2eiop		unp.ct2eiop
+#define	ct7iop		unp.ct7iop
 #define	lunenp		unp.lunenp
 #define	inotp		unp.inotp
 #define	inot_fcp	unp.inot_fcp
@@ -154,8 +159,14 @@
 
 	switch(type) {
 	case RQSTYPE_ATIO:
-		isp_get_atio(isp, atiop, (at_entry_t *) local);
-		isp_handle_atio(isp, (at_entry_t *) local);
+		if (IS_24XX(isp)) {
+			isp_get_atio7(isp, at7iop, (at7_entry_t *) local);
+			/* Punt directly to platform specific layer. */
+			(void) isp_async(isp, ISPASYNC_TARGET_ACTION, local);
+		} else {
+			isp_get_atio(isp, atiop, (at_entry_t *) local);
+			isp_handle_atio(isp, (at_entry_t *) local);
+		}
 		break;
 	case RQSTYPE_CTIO:
 		isp_get_ctio(isp, ctiop, (ct_entry_t *) local);
@@ -178,6 +189,10 @@
 		}
 		isp_handle_ctio2(isp, (ct2_entry_t *) local);
 		break;
+	case RQSTYPE_CTIO7:
+		isp_get_ctio7(isp, ct7iop, (ct7_entry_t *) local);
+		isp_handle_ctio7(isp, (ct7_entry_t *) local);
+		break;
 	case RQSTYPE_ENABLE_LUN:
 	case RQSTYPE_MODIFY_LUN:
 		isp_get_enable_lun(isp, lunenp, (lun_entry_t *) local);
@@ -283,9 +298,11 @@
 #undef	atiop
 #undef	at2iop
 #undef	at2eiop
+#undef	at7iop
 #undef	ctiop
 #undef	ct2iop
 #undef	ct2eiop
+#undef	ct7iop
 #undef	lunenp
 #undef	inotp
 #undef	inot_fcp
@@ -1319,4 +1336,149 @@
 		 */
 	}
 }
+
+static void
+isp_handle_ctio7(ispsoftc_t *isp, ct7_entry_t *ct)
+{
+	void *xs;
+	int pl = ISP_LOGTDEBUG2;
+	char *fmsg = NULL;
+
+	if (ct->ct_syshandle) {
+		xs = isp_find_xs_tgt(isp, ct->ct_syshandle);
+		if (xs == NULL) {
+			pl = ISP_LOGALL;
+		}
+	} else {
+		xs = NULL;
+	}
+
+	switch(ct->ct_nphdl) {
+	case CT7_BUS_ERROR:
+		isp_prt(isp, ISP_LOGERR, "PCI DMA Bus Error");
+		/* FALL Through */
+	case CT7_DATA_OVER:
+	case CT7_DATA_UNDER:
+	case CT7_OK:
+		/*
+		 * There are generally 2 possibilities as to why we'd get
+		 * this condition:
+		 * 	We sent or received data.
+		 * 	We sent status & command complete.
+		 */
+
+		break;
+
+	case CT7_RESET:
+		if (fmsg == NULL)
+			fmsg = "LIP Reset";
+		/*FALLTHROUGH*/
+	case CT7_ABORTED:
+		/*
+		 * When an Abort message is received the firmware goes to
+		 * Bus Free and returns all outstanding CTIOs with the status
+		 * set, then sends us an Immediate Notify entry.
+		 */
+		if (fmsg == NULL) {
+			fmsg = "ABORT";
+		}
+
+		isp_prt(isp, ISP_LOGTDEBUG0,
+		    "CTIO2 destroyed by %s: RX_ID=0x%x", fmsg, ct->ct_rxid);
+		break;
+
+	case CT7_TIMEOUT:
+		if (fmsg == NULL)
+			fmsg = "command";
+		isp_prt(isp, ISP_LOGERR, "Firmware timed out on %s", fmsg);
+		break;
+
+	case CT7_ERR:
+		fmsg = "Completed with Error";
+		/*FALLTHROUGH*/
+	case CT7_LOGOUT:
+		if (fmsg == NULL)
+			fmsg = "Port Logout";
+		/*FALLTHROUGH*/
+	case CT7_PORTUNAVAIL:
+		if (fmsg == NULL)
+			fmsg = "Port not available";
+		/*FALLTHROUGH*/
+	case CT7_PORTCHANGED:
+		if (fmsg == NULL)
+			fmsg = "Port Changed";
+		isp_prt(isp, ISP_LOGWARN, "CTIO returned by f/w- %s", fmsg);
+		break;
+
+	case CT7_INVRXID:
+		/*
+		 * CTIO rejected by the firmware because an invalid RX_ID.
+		 * Just print a message.
+		 */
+		isp_prt(isp, ISP_LOGWARN,
+		    "CTIO2 completed with Invalid RX_ID 0x%x", ct->ct_rxid);
+		break;
+
+	case CT7_REASSY_ERR:
+		isp_prt(isp, ISP_LOGWARN, "reassembly error");
+		break;
+
+	case CT7_SRR:
+		isp_prt(isp, ISP_LOGWARN, "SRR received");
+		break;
+
+	default:
+		isp_prt(isp, ISP_LOGERR, "Unknown CTIO2 status 0x%x",
+		    ct->ct_nphdl);
+		break;
+	}
+
+	if (xs == NULL) {
+		/*
+		 * There may be more than one CTIO for a data transfer,
+		 * or this may be a status CTIO we're not monitoring.
+		 *
+		 * The assumption is that they'll all be returned in the
+		 * order we got them.
+		 */
+		if (ct->ct_syshandle == 0) {
+			if ((ct->ct_flags & CT7_SENDSTATUS) == 0) {
+				isp_prt(isp, pl,
+				    "intermediate CTIO completed ok");
+			} else {
+				isp_prt(isp, pl,
+				    "unmonitored CTIO completed ok");
+			}
+		} else {
+			isp_prt(isp, pl,
+			    "NO xs for CTIO (handle 0x%x) status 0x%x",
+			    ct->ct_syshandle, ct->ct_nphdl);
+		}
+	} else {
+		if ((ct->ct_flags & CT2_DATAMASK) != CT2_NO_DATA) {
+			ISP_DMAFREE(isp, xs, ct->ct_syshandle);
+		}
+		if (ct->ct_flags & CT2_SENDSTATUS) {
+			/*
+			 * Sent status and command complete.
+			 *
+			 * We're now really done with this command, so we
+			 * punt to the platform dependent layers because
+			 * only there can we do the appropriate command
+			 * complete thread synchronization.
+			 */
+			isp_prt(isp, pl, "status CTIO complete");
+		} else {
+			/*
+			 * Final CTIO completed. Release DMA resources and
+			 * notify platform dependent layers.
+			 */
+			isp_prt(isp, pl, "data CTIO complete");
+		}
+		(void) isp_async(isp, ISPASYNC_TARGET_ACTION, ct);
+		/*
+		 * The platform layer will destroy the handle if appropriate.
+		 */
+	}
+}
 #endif

==== //depot/projects/newisp/dev/isp/isp_target.h#7 (text+ko) ====

@@ -723,7 +723,7 @@
 typedef struct {
 	isphdr_t	ct_header;
 	uint32_t	ct_syshandle;
-	uint16_t	ct_nphdl;
+	uint16_t	ct_nphdl;	/* status on returned CTIOs */
 	uint16_t	ct_timeout;
 	uint16_t	ct_seg_count;
 	uint8_t		ct_vpindex;
@@ -782,21 +782,21 @@
 /*
  * Type 7 CTIO status codes
  */
-#define CY7_OK		0x01	/* completed without error */
-#define CY7_ABORTED	0x02	/* aborted by host */
-#define CY7_ERR		0x04	/* see sense data for error */
-#define CY7_INVAL	0x06	/* request for disabled lun */
-#define	CY7_INVRXID	0x08	/* (FC only) Invalid RX_ID */
-#define	CY7_DATA_OVER	0x09	/* (FC only) Data Overrun */
-#define CY7_TIMEOUT	0x0B	/* timed out */
-#define CY7_RESET	0x0E	/* LIP Rset Received */
-#define	CY7_BUS_ERROR	0x10	/* DMA PCI Error */
+#define CT7_OK		0x01	/* completed without error */
+#define CT7_ABORTED	0x02	/* aborted by host */
+#define CT7_ERR		0x04	/* see sense data for error */
+#define CT7_INVAL	0x06	/* request for disabled lun */
+#define	CT7_INVRXID	0x08	/* (FC only) Invalid RX_ID */
+#define	CT7_DATA_OVER	0x09	/* (FC only) Data Overrun */
+#define CT7_TIMEOUT	0x0B	/* timed out */
+#define CT7_RESET	0x0E	/* LIP Rset Received */
+#define	CT7_BUS_ERROR	0x10	/* DMA PCI Error */
 #define	CT7_REASSY_ERR	0x11	/* DMA reassembly error */
-#define	CY7_DATA_UNDER	0x15	/* (FC only) Data Underrun */
-#define	CY7_PORTUNAVAIL	0x28	/* port not available */
-#define	CY7_LOGOUT	0x29	/* port logout */
-#define	CY7_PORTCHANGED	0x2A	/* port changed */
-#define	CY7_SRR		0x45	/* SRR Received */
+#define	CT7_DATA_UNDER	0x15	/* (FC only) Data Underrun */
+#define	CT7_PORTUNAVAIL	0x28	/* port not available */
+#define	CT7_LOGOUT	0x29	/* port logout */
+#define	CT7_PORTCHANGED	0x2A	/* port changed */
+#define	CT7_SRR		0x45	/* SRR Received */
 
 /*
  * Debug macros

==== //depot/projects/newisp/dev/isp/ispmbox.h#5 (text+ko) ====

@@ -315,6 +315,7 @@
 #define	RQSTYPE_CTIO1		0x0f	/* Target Mode */
 #define	RQSTYPE_STATUS_CONT	0x10
 #define	RQSTYPE_T2RQS		0x11
+#define	RQSTYPE_CTIO7		0x12
 #define	RQSTYPE_IP_XMIT		0x13
 #define	RQSTYPE_TSK_MGMT	0x14
 #define	RQSTYPE_T4RQS		0x15

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

@@ -495,6 +495,11 @@
 	void *			isp_result;
 	XS_DMA_ADDR_T		isp_rquest_dma;
 	XS_DMA_ADDR_T		isp_result_dma;
+#ifdef	ISP_TARGET_MODE
+	/* for 24XX only */
+	void *			isp_atioq;
+	XS_DMA_ADDR_T		isp_atioq_dma;
+#endif
 };
 
 #define	SDPARAM(isp)	((sdparam *) (isp)->isp_param)


More information about the p4-projects mailing list