Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 May 2014 16:36:01 +0000 (UTC)
From:      "Kenneth D. Merry" <ken@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r266549 - in stable/9/sys/dev: mpr mps
Message-ID:  <201405221636.s4MGa1q1041817@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ken
Date: Thu May 22 16:36:01 2014
New Revision: 266549
URL: http://svnweb.freebsd.org/changeset/base/266549

Log:
  MFC mpr(4) changes: r265484, r265485, r265709 and r265712
  
    ------------------------------------------------------------------------
    r265484 | ken | 2014-05-06 23:11:16 -0600 (Tue, 06 May 2014) | 5 lines
  
    Remove some debugging code.
  
    Submitted by:	Steve McConnell <stephen.mcconnell@avagotech.com>
  
    ------------------------------------------------------------------------
    ------------------------------------------------------------------------
    r265485 | ken | 2014-05-06 23:14:48 -0600 (Tue, 06 May 2014) | 9 lines
  
    Hold the SIM lock when calling xpt_create_path() and xpt_action() in
    mprsas_SSU_to_SATA_devices().
  
    This fixes an assertion on shutdown with INVARIANTS enabled with SATA
    drives present on an IR firmware controller.
  
    Reviewed by:	Steve McConnell <stephen.mcconnell@avagotech.com>.
  
    ------------------------------------------------------------------------
    ------------------------------------------------------------------------
    r265709 | ken | 2014-05-08 14:28:22 -0600 (Thu, 08 May 2014) | 15 lines
  
    Fix TLR (Transport Layer Retry) support in the mps(4) and mpr(4) drivers.
  
    TLR is necessary for reliable communication with SAS tape drives.
  
    This was broken by change 246713 in the mps(4) driver.  It changed the
    cm_data field for SCSI I/O requests to point to the CCB instead of the data
    buffer.  So, instead, look at the CCB's data pointer to determine whether
    or not we're talking to a tape drive.
  
    Also, take the residual into account to make sure that we don't go off the
    end of the request.
  
    Sponsored by:	Spectra Logic Corporation
  
    ------------------------------------------------------------------------
    ------------------------------------------------------------------------
    r265712 | ken | 2014-05-08 14:46:46 -0600 (Thu, 08 May 2014) | 10 lines
  
    Add #ifdefs in the mpr(4) driver so that versions of stable/9 that
    have implemented the PIM_NOSCAN rescan functionality will have it
    enabled.
  
    This is a no-op for head.
  
    Reviewed by:	slm
    Sponsored by:	Spectra Logic Corporation
  
    ------------------------------------------------------------------------
  
  Sponsored by:	Spectra Logic, Avago

Modified:
  stable/9/sys/dev/mpr/mpr.c
  stable/9/sys/dev/mpr/mpr_sas.c
  stable/9/sys/dev/mpr/mpr_sas_lsi.c
  stable/9/sys/dev/mps/mps_sas.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/mpr/mpr.c
==============================================================================
--- stable/9/sys/dev/mpr/mpr.c	Thu May 22 16:34:00 2014	(r266548)
+++ stable/9/sys/dev/mpr/mpr.c	Thu May 22 16:36:01 2014	(r266549)
@@ -2182,8 +2182,6 @@ mpr_add_chain(struct mpr_command *cm, in
 	 * code other than 0.
 	 */
 	if (cm->cm_flags & MPR_CM_FLAGS_SGE_SIMPLE) {
-//SLM-test
-printf("Trying to add a chain element to an MPI SGL\n");
 		mpr_dprint(sc, MPR_ERROR, "A chain element cannot be added to "
 		    "an MPI SGL.\n");
 		return(ENOBUFS);

Modified: stable/9/sys/dev/mpr/mpr_sas.c
==============================================================================
--- stable/9/sys/dev/mpr/mpr_sas.c	Thu May 22 16:34:00 2014	(r266548)
+++ stable/9/sys/dev/mpr/mpr_sas.c	Thu May 22 16:36:01 2014	(r266549)
@@ -183,7 +183,8 @@ mprsas_startup_increment(struct mprsas_s
 			/* just starting, freeze the simq */
 			mpr_dprint(sassc->sc, MPR_INIT,
 			    "%s freezing simq\n", __func__);
-#if __FreeBSD_version >= 1000039
+#if (__FreeBSD_version >= 1000039) || \
+    ((__FreeBSD_version < 1000000) && (__FreeBSD_version >= 902502))
 			xpt_hold_boot();
 #endif
 			xpt_freeze_simq(sassc->sim, 1);
@@ -217,7 +218,8 @@ mprsas_startup_decrement(struct mprsas_s
 			    "%s releasing simq\n", __func__);
 			sassc->flags &= ~MPRSAS_IN_STARTUP;
 			xpt_release_simq(sassc->sim, 1);
-#if __FreeBSD_version >= 1000039
+#if (__FreeBSD_version >= 1000039) || \
+    ((__FreeBSD_version < 1000000) && (__FreeBSD_version >= 902502))
 			xpt_release_boot();
 #else
 			mprsas_rescan_target(sassc->sc, NULL);
@@ -974,7 +976,8 @@ mprsas_action(struct cam_sim *sim, union
 		cpi->version_num = 1;
 		cpi->hba_inquiry = PI_SDTR_ABLE|PI_TAG_ABLE|PI_WIDE_16;
 		cpi->target_sprt = 0;
-#if __FreeBSD_version >= 1000039
+#if (__FreeBSD_version >= 1000039) || \
+    ((__FreeBSD_version < 1000000) && (__FreeBSD_version >= 902502))
 		cpi->hba_misc = PIM_NOBUSRESET | PIM_UNMAPPED | PIM_NOSCAN;
 #else
 		cpi->hba_misc = PIM_NOBUSRESET | PIM_UNMAPPED;
@@ -2355,8 +2358,9 @@ mprsas_scsiio_complete(struct mpr_softc 
 		    (csio->cdb_io.cdb_bytes[1] & SI_EVPD) &&
 		    (csio->cdb_io.cdb_bytes[2] == SVPD_SUPPORTED_PAGE_LIST) &&
 		    ((csio->ccb_h.flags & CAM_DATA_MASK) == CAM_DATA_VADDR) &&
-		    (csio->data_ptr != NULL) && (((uint8_t *)cm->cm_data)[0] ==
-		    T_SEQUENTIAL) && (sc->control_TLR) &&
+		    (csio->data_ptr != NULL) &&
+		    ((csio->data_ptr[0] & 0x1f) == T_SEQUENTIAL) &&
+		    (sc->control_TLR) &&
 		    (sc->mapping_table[csio->ccb_h.target_id].device_info &
 		    MPI2_SAS_DEVICE_INFO_SSP_TARGET)) {
 			vpd_list = (struct scsi_vpd_supported_page_list *)
@@ -2367,6 +2371,7 @@ mprsas_scsiio_complete(struct mpr_softc 
 			TLR_on = (u8)MPI2_SCSIIO_CONTROL_TLR_ON;
 			alloc_len = ((u16)csio->cdb_io.cdb_bytes[3] << 8) +
 			    csio->cdb_io.cdb_bytes[4];
+			alloc_len -= csio->resid;
 			for (i = 0; i < MIN(vpd_list->length, alloc_len); i++) {
 				if (vpd_list->list[i] == 0x90) {
 					*TLR_bits = TLR_on;

Modified: stable/9/sys/dev/mpr/mpr_sas_lsi.c
==============================================================================
--- stable/9/sys/dev/mpr/mpr_sas_lsi.c	Thu May 22 16:34:00 2014	(r266548)
+++ stable/9/sys/dev/mpr/mpr_sas_lsi.c	Thu May 22 16:36:01 2014	(r266549)
@@ -801,7 +801,8 @@ mprsas_add_device(struct mpr_softc *sc, 
 		    "and connector name (%4s)\n", targ->encl_level,
 		    targ->connector_name);
 	}
-#if __FreeBSD_version < 1000039
+#if ((__FreeBSD_version >= 1000000) && (__FreeBSD_version < 1000039)) || \
+    (__FreeBSD_version < 902502)
 	if ((sassc->flags & MPRSAS_IN_STARTUP) == 0)
 #endif
 		mprsas_rescan_target(sc, targ);
@@ -992,7 +993,8 @@ mprsas_volume_add(struct mpr_softc *sc, 
 		free(lun, M_MPR);
 	}
 	SLIST_INIT(&targ->luns);
-#if __FreeBSD_version < 1000039
+#if ((__FreeBSD_version >= 1000000) && (__FreeBSD_version < 1000039)) || \
+    (__FreeBSD_version < 902502)
 	if ((sassc->flags & MPRSAS_IN_STARTUP) == 0)
 #endif
 		mprsas_rescan_target(sc, targ);
@@ -1026,6 +1028,8 @@ mprsas_SSU_to_SATA_devices(struct mpr_so
 	char path_str[64];
 	struct timeval cur_time, start_time;
 
+	mpr_lock(sc);
+
 	/*
 	 * For each LUN of each target, issue a StartStopUnit command to stop
 	 * the device.
@@ -1041,6 +1045,7 @@ mprsas_SSU_to_SATA_devices(struct mpr_so
 		SLIST_FOREACH(lun, &target->luns, lun_link) {
 			ccb = xpt_alloc_ccb_nowait();
 			if (ccb == NULL) {
+				mpr_unlock(sc);
 				mpr_dprint(sc, MPR_FAULT, "Unable to alloc "
 				    "CCB to stop unit.\n");
 				return;
@@ -1057,6 +1062,7 @@ mprsas_SSU_to_SATA_devices(struct mpr_so
 					mpr_dprint(sc, MPR_FAULT, "Unable to "
 					    "create LUN path to stop unit.\n");
 					xpt_free_ccb(ccb);
+					mpr_unlock(sc);
 					return;
 				}
 				xpt_path_string(ccb->ccb_h.path, path_str,
@@ -1092,6 +1098,8 @@ mprsas_SSU_to_SATA_devices(struct mpr_so
 		}
 	}
 
+	mpr_unlock(sc);
+
 	/*
 	 * Wait until all of the SSU commands have completed or time has
 	 * expired (60 seconds).  pause for 100ms each time through.  If any

Modified: stable/9/sys/dev/mps/mps_sas.c
==============================================================================
--- stable/9/sys/dev/mps/mps_sas.c	Thu May 22 16:34:00 2014	(r266548)
+++ stable/9/sys/dev/mps/mps_sas.c	Thu May 22 16:36:01 2014	(r266549)
@@ -2305,8 +2305,9 @@ mpssas_scsiio_complete(struct mps_softc 
 		    (csio->cdb_io.cdb_bytes[1] & SI_EVPD) &&
 		    (csio->cdb_io.cdb_bytes[2] == SVPD_SUPPORTED_PAGE_LIST) &&
 		    ((csio->ccb_h.flags & CAM_DATA_MASK) == CAM_DATA_VADDR) &&
-		    (csio->data_ptr != NULL) && (((uint8_t *)cm->cm_data)[0] ==
-		    T_SEQUENTIAL) && (sc->control_TLR) &&
+		    (csio->data_ptr != NULL) &&
+		    ((csio->data_ptr[0] & 0x1f) == T_SEQUENTIAL) &&
+		    (sc->control_TLR) &&
 		    (sc->mapping_table[csio->ccb_h.target_id].device_info &
 		    MPI2_SAS_DEVICE_INFO_SSP_TARGET)) {
 			vpd_list = (struct scsi_vpd_supported_page_list *)
@@ -2317,6 +2318,7 @@ mpssas_scsiio_complete(struct mps_softc 
 			TLR_on = (u8)MPI2_SCSIIO_CONTROL_TLR_ON;
 			alloc_len = ((u16)csio->cdb_io.cdb_bytes[3] << 8) +
 			    csio->cdb_io.cdb_bytes[4];
+			alloc_len -= csio->resid;
 			for (i = 0; i < MIN(vpd_list->length, alloc_len); i++) {
 				if (vpd_list->list[i] == 0x90) {
 					*TLR_bits = TLR_on;



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