From owner-svn-src-all@FreeBSD.ORG Tue Nov 17 19:42:07 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3962210656CB; Tue, 17 Nov 2009 19:42:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 26F688FC1D; Tue, 17 Nov 2009 19:42:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAHJg7gh033755; Tue, 17 Nov 2009 19:42:07 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAHJg7Z7033753; Tue, 17 Nov 2009 19:42:07 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200911171942.nAHJg7Z7033753@svn.freebsd.org> From: Alexander Motin Date: Tue, 17 Nov 2009 19:42:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199423 - stable/8/sys/dev/siis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 17 Nov 2009 19:42:07 -0000 Author: mav Date: Tue Nov 17 19:42:06 2009 New Revision: 199423 URL: http://svn.freebsd.org/changeset/base/199423 Log: MFC r198321 Freeze device queue on error to permit periph driver to do proper recovery. Modified: stable/8/sys/dev/siis/siis.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/siis/siis.c ============================================================================== --- stable/8/sys/dev/siis/siis.c Tue Nov 17 19:40:39 2009 (r199422) +++ stable/8/sys/dev/siis/siis.c Tue Nov 17 19:42:06 2009 (r199423) @@ -752,7 +752,12 @@ siis_ch_intr(void *data) if (ch->frozen) { union ccb *fccb = ch->frozen; ch->frozen = NULL; - fccb->ccb_h.status = CAM_REQUEUE_REQ | CAM_RELEASE_SIMQ; + fccb->ccb_h.status &= ~CAM_STATUS_MASK; + fccb->ccb_h.status |= CAM_REQUEUE_REQ | CAM_RELEASE_SIMQ; + if (!(fccb->ccb_h.status & CAM_DEV_QFRZN)) { + xpt_freeze_devq(fccb->ccb_h.path, 1); + fccb->ccb_h.status |= CAM_DEV_QFRZN; + } xpt_done(fccb); } if (estatus == SIIS_P_CMDERR_DEV || @@ -986,7 +991,12 @@ device_printf(dev, "%s is %08x ss %08x r if (ch->frozen) { union ccb *fccb = ch->frozen; ch->frozen = NULL; - fccb->ccb_h.status = CAM_REQUEUE_REQ | CAM_RELEASE_SIMQ; + fccb->ccb_h.status &= ~CAM_STATUS_MASK; + fccb->ccb_h.status |= CAM_REQUEUE_REQ | CAM_RELEASE_SIMQ; + if (!(fccb->ccb_h.status & CAM_DEV_QFRZN)) { + xpt_freeze_devq(fccb->ccb_h.path, 1); + fccb->ccb_h.status |= CAM_DEV_QFRZN; + } xpt_done(fccb); } /* Handle command with timeout. */ @@ -1044,11 +1054,17 @@ siis_end_transaction(struct siis_slot *s bus_dmamap_unload(ch->dma.data_tag, slot->dma.data_map); } /* Set proper result status. */ - ccb->ccb_h.status &= ~CAM_STATUS_MASK; if (et != SIIS_ERR_NONE || ch->recovery) { ch->eslots |= (1 << slot->slot); ccb->ccb_h.status |= CAM_RELEASE_SIMQ; } + /* In case of error, freeze device for proper recovery. */ + if (et != SIIS_ERR_NONE && + !(ccb->ccb_h.status & CAM_DEV_QFRZN)) { + xpt_freeze_devq(ccb->ccb_h.path, 1); + ccb->ccb_h.status |= CAM_DEV_QFRZN; + } + ccb->ccb_h.status &= ~CAM_STATUS_MASK; switch (et) { case SIIS_ERR_NONE: ccb->ccb_h.status |= CAM_REQ_CMP; @@ -1062,6 +1078,7 @@ siis_end_transaction(struct siis_slot *s ccb->ccb_h.status |= CAM_REQUEUE_REQ; break; case SIIS_ERR_TFE: + case SIIS_ERR_NCQ: if (ccb->ccb_h.func_code == XPT_SCSI_IO) { ccb->ccb_h.status |= CAM_SCSI_STATUS_ERROR; ccb->csio.scsi_status = SCSI_STATUS_CHECK_COND; @@ -1075,9 +1092,6 @@ siis_end_transaction(struct siis_slot *s case SIIS_ERR_TIMEOUT: ccb->ccb_h.status |= CAM_CMD_TIMEOUT; break; - case SIIS_ERR_NCQ: - ccb->ccb_h.status |= CAM_ATA_STATUS_ERROR; - break; default: ccb->ccb_h.status |= CAM_REQ_CMP_ERR; } @@ -1281,7 +1295,12 @@ siis_reset(device_t dev) if (ch->frozen) { union ccb *fccb = ch->frozen; ch->frozen = NULL; - fccb->ccb_h.status = CAM_REQUEUE_REQ | CAM_RELEASE_SIMQ; + fccb->ccb_h.status &= ~CAM_STATUS_MASK; + fccb->ccb_h.status |= CAM_REQUEUE_REQ | CAM_RELEASE_SIMQ; + if (!(fccb->ccb_h.status & CAM_DEV_QFRZN)) { + xpt_freeze_devq(fccb->ccb_h.path, 1); + fccb->ccb_h.status |= CAM_DEV_QFRZN; + } xpt_done(fccb); } /* Disable port interrupts */