From owner-svn-src-stable-9@FreeBSD.ORG Tue Jun 18 14:35:10 2013 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 32211382; Tue, 18 Jun 2013 14:35:10 +0000 (UTC) (envelope-from marius@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 082901D9F; Tue, 18 Jun 2013 14:35:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5IEZ97A086487; Tue, 18 Jun 2013 14:35:09 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5IEZ9Ic086481; Tue, 18 Jun 2013 14:35:09 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201306181435.r5IEZ9Ic086481@svn.freebsd.org> From: Marius Strobl Date: Tue, 18 Jun 2013 14:35:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251940 - stable/9/sys/dev/ata X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Jun 2013 14:35:10 -0000 Author: marius Date: Tue Jun 18 14:35:09 2013 New Revision: 251940 URL: http://svnweb.freebsd.org/changeset/base/251940 Log: MFC: r247165 Fix command timeout caused by data underrun during fetching ATAPI sense data, introduced by r246713 (MFC'ed to stable/9 in r251874). There are two places where ata_request is filled in ATA_CAM: ata_cam_begin_transaction() and ata_cam_request_sense(). In the first case DMA should be done for addresses from the CCB. In second case, DMA should be done to the different address, the address of the sense buffer inside the CCB structure itself. Modified: stable/9/sys/dev/ata/ata-all.c stable/9/sys/dev/ata/ata-all.h stable/9/sys/dev/ata/ata-dma.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/ata/ata-all.c ============================================================================== --- stable/9/sys/dev/ata/ata-all.c Tue Jun 18 14:20:14 2013 (r251939) +++ stable/9/sys/dev/ata/ata-all.c Tue Jun 18 14:35:09 2013 (r251940) @@ -1695,6 +1695,7 @@ ata_cam_begin_transaction(device_t dev, request->timeout = (ccb->ccb_h.timeout + 999) / 1000; callout_init_mtx(&request->callout, &ch->state_mtx, CALLOUT_RETURNUNLOCKED); request->ccb = ccb; + request->flags |= ATA_R_DATA_IN_CCB; ch->running = request; ch->state = ATA_ACTIVE; Modified: stable/9/sys/dev/ata/ata-all.h ============================================================================== --- stable/9/sys/dev/ata/ata-all.h Tue Jun 18 14:20:14 2013 (r251939) +++ stable/9/sys/dev/ata/ata-all.h Tue Jun 18 14:35:09 2013 (r251940) @@ -398,6 +398,7 @@ struct ata_request { #define ATA_R_THREAD 0x00000800 #define ATA_R_DIRECT 0x00001000 #define ATA_R_NEEDRESULT 0x00002000 +#define ATA_R_DATA_IN_CCB 0x00004000 #define ATA_R_ATAPI16 0x00010000 #define ATA_R_ATAPI_INTR 0x00020000 Modified: stable/9/sys/dev/ata/ata-dma.c ============================================================================== --- stable/9/sys/dev/ata/ata-dma.c Tue Jun 18 14:20:14 2013 (r251939) +++ stable/9/sys/dev/ata/ata-dma.c Tue Jun 18 14:35:09 2013 (r251940) @@ -305,7 +305,7 @@ ata_dmaload(struct ata_request *request, dspa.dmatab = request->dma->sg; #ifdef ATA_CAM - if (request->ccb) + if (request->flags & ATA_R_DATA_IN_CCB) error = bus_dmamap_load_ccb(request->dma->data_tag, request->dma->data_map, request->ccb, ch->dma.setprd, &dspa, BUS_DMA_NOWAIT);