From owner-svn-src-all@FreeBSD.ORG Thu May 2 14:37:24 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 802EE805; Thu, 2 May 2013 14:37:24 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 61AA11065; Thu, 2 May 2013 14:37:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r42EbOfA085187; Thu, 2 May 2013 14:37:24 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r42EbOZf085185; Thu, 2 May 2013 14:37:24 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201305021437.r42EbOZf085185@svn.freebsd.org> From: Steven Hartland Date: Thu, 2 May 2013 14:37:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r250181 - head/sys/cam/scsi X-SVN-Group: head 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.14 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, 02 May 2013 14:37:24 -0000 Author: smh Date: Thu May 2 14:37:23 2013 New Revision: 250181 URL: http://svnweb.freebsd.org/changeset/base/250181 Log: Use the existence of ATA Information VPD to determine if we should attempt to query ATA functionality via ATA Pass-Through (16) as this page is defined as "must" for SATL devices, hence indicating that the device is at least likely to support Pass-Through (16). This eliminates errors produced by CTL when ATA Pass-Through (16) fails. Switch ATA probe daerror call to SF_NO_PRINT to avoid errors printing out for devices which return invalid errors. Output details about supported and choosen delete method when verbose booted. Reviewed by: mav Approved by: pjd (mentor) MFC after: 1 week Modified: head/sys/cam/scsi/scsi_all.h head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_all.h ============================================================================== --- head/sys/cam/scsi/scsi_all.h Thu May 2 14:19:42 2013 (r250180) +++ head/sys/cam/scsi/scsi_all.h Thu May 2 14:37:23 2013 (r250181) @@ -1430,6 +1430,12 @@ struct scsi_diag_page { }; /* + * ATA Information VPD Page based on + * T10/2126-D Revision 04 + */ +#define SVPD_ATA_INFORMATION 0x89 + +/* * Block Device Characteristics VPD Page based on * T10/1799-D Revision 31 */ Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Thu May 2 14:19:42 2013 (r250180) +++ head/sys/cam/scsi/scsi_da.c Thu May 2 14:37:23 2013 (r250181) @@ -918,6 +918,7 @@ static off_t dadeletemaxsize(struct da_ da_delete_methods delete_method); static void dadeletemethodchoose(struct da_softc *softc, da_delete_methods default_method); +static void daprobedone(struct cam_periph *periph, union ccb *ccb); static periph_ctor_t daregister; static periph_dtor_t dacleanup; @@ -1680,6 +1681,65 @@ dadeletemaxsize(struct da_softc *softc, } static void +daprobedone(struct cam_periph *periph, union ccb *ccb) +{ + struct da_softc *softc; + + softc = (struct da_softc *)periph->softc; + + dadeletemethodchoose(softc, DA_DELETE_NONE); + + if (bootverbose && (softc->flags & DA_FLAG_PROBED) == 0) { + char buf[80]; + int i, sep; + + snprintf(buf, sizeof(buf), "Delete methods: <"); + sep = 0; + for (i = DA_DELETE_MIN; i <= DA_DELETE_MAX; i++) { + if (softc->delete_available & (1 << i)) { + if (sep) { + strlcat(buf, ",", sizeof(buf)); + } else { + sep = 1; + } + strlcat(buf, da_delete_method_names[i], + sizeof(buf)); + if (i == softc->delete_method) { + strlcat(buf, "(*)", sizeof(buf)); + } + } + } + if (sep == 0) { + if (softc->delete_method == DA_DELETE_NONE) + strlcat(buf, "NONE(*)", sizeof(buf)); + else + strlcat(buf, "DISABLED(*)", sizeof(buf)); + } + strlcat(buf, ">", sizeof(buf)); + printf("%s%d: %s\n", periph->periph_name, + periph->unit_number, buf); + } + + /* + * Since our peripheral may be invalidated by an error + * above or an external event, we must release our CCB + * before releasing the probe lock on the peripheral. + * The peripheral will only go away once the last lock + * is removed, and we need it around for the CCB release + * operation. + */ + xpt_release_ccb(ccb); + softc->state = DA_STATE_NORMAL; + daschedule(periph); + wakeup(&softc->disk->d_mediasize); + if ((softc->flags & DA_FLAG_PROBED) == 0) { + softc->flags |= DA_FLAG_PROBED; + cam_periph_unhold(periph); + } else + cam_periph_release_locked(periph); +} + +static void dadeletemethodchoose(struct da_softc *softc, da_delete_methods default_method) { int i, delete_method; @@ -2457,6 +2517,11 @@ out: { struct ata_params *ata_params; + if (!scsi_vpd_supported_page(periph, SVPD_ATA_INFORMATION)) { + daprobedone(periph, start_ccb); + break; + } + ata_params = (struct ata_params*) malloc(sizeof(*ata_params), M_SCSIDA, M_NOWAIT|M_ZERO); @@ -3121,7 +3186,7 @@ dadone(struct cam_periph *periph, union } else { int error; error = daerror(done_ccb, CAM_RETRY_SELTO, - SF_RETRY_UA|SF_QUIET_IR); + SF_RETRY_UA|SF_NO_PRINT); if (error == ERESTART) return; else if (error != 0) { @@ -3137,24 +3202,7 @@ dadone(struct cam_periph *periph, union } free(ata_params, M_SCSIDA); - dadeletemethodchoose(softc, DA_DELETE_NONE); - /* - * Since our peripheral may be invalidated by an error - * above or an external event, we must release our CCB - * before releasing the probe lock on the peripheral. - * The peripheral will only go away once the last lock - * is removed, and we need it around for the CCB release - * operation. - */ - xpt_release_ccb(done_ccb); - softc->state = DA_STATE_NORMAL; - daschedule(periph); - wakeup(&softc->disk->d_mediasize); - if ((softc->flags & DA_FLAG_PROBED) == 0) { - softc->flags |= DA_FLAG_PROBED; - cam_periph_unhold(periph); - } else - cam_periph_release_locked(periph); + daprobedone(periph, done_ccb); return; } case DA_CCB_WAITING: