Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Mar 2017 06:45:00 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r314764 - stable/11/sys/dev/isp
Message-ID:  <201703060645.v266j0JB004987@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Mon Mar  6 06:45:00 2017
New Revision: 314764
URL: https://svnweb.freebsd.org/changeset/base/314764

Log:
  MFC r314326: Send TERMINATE to firmware when aborting active ATIO.

Modified:
  stable/11/sys/dev/isp/isp.c
  stable/11/sys/dev/isp/isp_freebsd.c
  stable/11/sys/dev/isp/isp_freebsd.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/isp/isp.c
==============================================================================
--- stable/11/sys/dev/isp/isp.c	Mon Mar  6 06:43:17 2017	(r314763)
+++ stable/11/sys/dev/isp/isp.c	Mon Mar  6 06:45:00 2017	(r314764)
@@ -7133,7 +7133,7 @@ static const uint32_t mbpfc[] = {
 	ISP_FC_OPMAP(0x00, 0x00),	/* 0x3f: */
 	ISP_FC_OPMAP(0x03, 0x01),	/* 0x40: MBOX_LOOP_PORT_BYPASS */
 	ISP_FC_OPMAP(0x03, 0x01),	/* 0x41: MBOX_LOOP_PORT_ENABLE */
-	ISP_FC_OPMAP_HALF(0x0, 0x01, 0x3, 0xcf),	/* 0x42: MBOX_GET_RESOURCE_COUNT */
+	ISP_FC_OPMAP_HALF(0x0, 0x01, 0x1f, 0xcf),	/* 0x42: MBOX_GET_RESOURCE_COUNT */
 	ISP_FC_OPMAP(0x01, 0x01),	/* 0x43: MBOX_REQUEST_OFFLINE_MODE */
 	ISP_FC_OPMAP(0x00, 0x00),	/* 0x44: */
 	ISP_FC_OPMAP(0x00, 0x00),	/* 0x45: */

Modified: stable/11/sys/dev/isp/isp_freebsd.c
==============================================================================
--- stable/11/sys/dev/isp/isp_freebsd.c	Mon Mar  6 06:43:17 2017	(r314763)
+++ stable/11/sys/dev/isp/isp_freebsd.c	Mon Mar  6 06:45:00 2017	(r314764)
@@ -1011,7 +1011,7 @@ isp_dump_atpd(ispsoftc_t *isp, int chan)
 		if (atp->state == ATPD_STATE_FREE)
 			continue;
 		isp_prt(isp, ISP_LOGALL, "Chan %d ATP [0x%x] origdlen %u bytes_xfrd %u lun %jx nphdl 0x%04x s_id 0x%06x d_id 0x%06x oxid 0x%04x state %s",
-		    chan, atp->tag, atp->orig_datalen, atp->bytes_xfered, (uintmax_t)atp->lun, atp->nphdl, atp->sid, atp->portid, atp->oxid, states[atp->state & 0x7]);
+		    chan, atp->tag, atp->orig_datalen, atp->bytes_xfered, (uintmax_t)atp->lun, atp->nphdl, atp->sid, atp->did, atp->oxid, states[atp->state & 0x7]);
 	}
 }
 
@@ -1344,8 +1344,8 @@ isp_target_start_ctio(ispsoftc_t *isp, u
 			ATPD_SET_SEQNO(cto, atp);
 			cto->ct_nphdl = atp->nphdl;
 			cto->ct_rxid = atp->tag;
-			cto->ct_iid_lo = atp->portid;
-			cto->ct_iid_hi = atp->portid >> 16;
+			cto->ct_iid_lo = atp->sid;
+			cto->ct_iid_hi = atp->sid >> 16;
 			cto->ct_oxid = atp->oxid;
 			cto->ct_vpidx = ISP_GET_VPIDX(isp, XS_CHANNEL(ccb));
 			cto->ct_timeout = (XS_TIME(ccb) + 999) / 1000;
@@ -2088,7 +2088,8 @@ isp_handle_platform_atio7(ispsoftc_t *is
 	atp->bytes_xfered = 0;
 	atp->lun = lun;
 	atp->nphdl = nphdl;
-	atp->portid = sid;
+	atp->sid = sid;
+	atp->did = did;
 	atp->oxid = aep->at_hdr.ox_id;
 	atp->rxid = aep->at_hdr.rx_id;
 	atp->cdb0 = atiop->cdb_io.cdb_bytes[0];
@@ -3269,7 +3270,23 @@ isp_abort_atio(ispsoftc_t *isp, union cc
 	/* Search for the ATIO among running. */
 	atp = isp_find_atpd(isp, XS_CHANNEL(accb), accb->atio.tag_id);
 	if (atp != NULL) {
-		/* XXX Send TERMINATE to firmware here. */
+		/* Send TERMINATE to firmware. */
+		if (!atp->dead && IS_24XX(isp)) {
+			uint8_t storage[QENTRY_LEN];
+			ct7_entry_t *cto = (ct7_entry_t *) storage;
+
+			ISP_MEMZERO(cto, sizeof (ct7_entry_t));
+			cto->ct_header.rqs_entry_type = RQSTYPE_CTIO7;
+			cto->ct_header.rqs_entry_count = 1;
+			cto->ct_nphdl = atp->nphdl;
+			cto->ct_rxid = atp->tag;
+			cto->ct_iid_lo = atp->sid;
+			cto->ct_iid_hi = atp->sid >> 16;
+			cto->ct_oxid = atp->oxid;
+			cto->ct_vpidx = XS_CHANNEL(accb);
+			cto->ct_flags = CT7_NOACK|CT7_TERMINATE;
+			isp_target_put_entry(isp, cto);
+		}
 		isp_put_atpd(isp, XS_CHANNEL(accb), atp);
 		ccb->ccb_h.status = CAM_REQ_CMP;
 	} else {

Modified: stable/11/sys/dev/isp/isp_freebsd.h
==============================================================================
--- stable/11/sys/dev/isp/isp_freebsd.h	Mon Mar  6 06:43:17 2017	(r314763)
+++ stable/11/sys/dev/isp/isp_freebsd.h	Mon Mar  6 06:45:00 2017	(r314764)
@@ -103,7 +103,7 @@ typedef struct atio_private_data {
 	lun_id_t	lun;
 	uint32_t	nphdl;
 	uint32_t	sid;
-	uint32_t	portid;
+	uint32_t	did;
 	uint16_t	rxid;	/* wire rxid */
 	uint16_t	oxid;	/* wire oxid */
 	uint16_t	word3;	/* PRLI word3 params */



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