From owner-svn-src-all@FreeBSD.ORG Thu May 22 16:34:01 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B40B9E15; Thu, 22 May 2014 16:34:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A013223D2; Thu, 22 May 2014 16:34:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s4MGY1XU041498; Thu, 22 May 2014 16:34:01 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s4MGY0Wl041491; Thu, 22 May 2014 16:34:00 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201405221634.s4MGY0Wl041491@svn.freebsd.org> From: "Kenneth D. Merry" Date: Thu, 22 May 2014 16:34:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r266548 - in stable/10/sys/dev: mpr mps X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 May 2014 16:34:01 -0000 Author: ken Date: Thu May 22 16:34:00 2014 New Revision: 266548 URL: http://svnweb.freebsd.org/changeset/base/266548 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 ------------------------------------------------------------------------ ------------------------------------------------------------------------ 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 . ------------------------------------------------------------------------ ------------------------------------------------------------------------ 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/10/sys/dev/mpr/mpr.c stable/10/sys/dev/mpr/mpr_sas.c stable/10/sys/dev/mpr/mpr_sas_lsi.c stable/10/sys/dev/mps/mps_sas.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mpr/mpr.c ============================================================================== --- stable/10/sys/dev/mpr/mpr.c Thu May 22 16:30:32 2014 (r266547) +++ stable/10/sys/dev/mpr/mpr.c Thu May 22 16:34:00 2014 (r266548) @@ -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/10/sys/dev/mpr/mpr_sas.c ============================================================================== --- stable/10/sys/dev/mpr/mpr_sas.c Thu May 22 16:30:32 2014 (r266547) +++ stable/10/sys/dev/mpr/mpr_sas.c Thu May 22 16:34:00 2014 (r266548) @@ -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/10/sys/dev/mpr/mpr_sas_lsi.c ============================================================================== --- stable/10/sys/dev/mpr/mpr_sas_lsi.c Thu May 22 16:30:32 2014 (r266547) +++ stable/10/sys/dev/mpr/mpr_sas_lsi.c Thu May 22 16:34:00 2014 (r266548) @@ -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/10/sys/dev/mps/mps_sas.c ============================================================================== --- stable/10/sys/dev/mps/mps_sas.c Thu May 22 16:30:32 2014 (r266547) +++ stable/10/sys/dev/mps/mps_sas.c Thu May 22 16:34:00 2014 (r266548) @@ -2316,8 +2316,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 *) @@ -2328,6 +2329,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;