From owner-svn-src-head@FreeBSD.ORG Wed Aug 19 14:39:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CDCE31065695; Wed, 19 Aug 2009 14:39:08 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BEF488FC61; Wed, 19 Aug 2009 14:39:08 +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 n7JEd88R057037; Wed, 19 Aug 2009 14:39:08 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7JEd892057035; Wed, 19 Aug 2009 14:39:08 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200908191439.n7JEd892057035@svn.freebsd.org> From: Rafal Jaworowski Date: Wed, 19 Aug 2009 14:39:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196380 - head/sys/dev/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Aug 2009 14:39:08 -0000 Author: raj Date: Wed Aug 19 14:39:08 2009 New Revision: 196380 URL: http://svn.freebsd.org/changeset/base/196380 Log: Fix USB cache sync operations for platforms with non-coherent DMA. - usb_pc_cpu_invalidate() is called between [consecutive] reads from a device, so a sequence of BUS_DMASYNC_POSTREAD and _PREREAD should be used. Note we cannot use or'ed shorthand ( _POSTREAD | _PREREAD) for BUS_DMASYNC flags, as the low level bus dma sync operation is implementation dependent and we cannot assume the required order of operations to be guaranteed. - usb_pc_cpu_flush() is called before writing to a device, so BUS_DMASYNC_PREWRITE should be used. Submitted by: Grzegorz Bernacki Reviewed by: HPS, arm@, usb@ ML Tested by: HPS, Mike Tancsa Approved by: re (kib) Obtained from: Semihalf Modified: head/sys/dev/usb/usb_busdma.c Modified: head/sys/dev/usb/usb_busdma.c ============================================================================== --- head/sys/dev/usb/usb_busdma.c Wed Aug 19 14:38:43 2009 (r196379) +++ head/sys/dev/usb/usb_busdma.c Wed Aug 19 14:39:08 2009 (r196380) @@ -679,8 +679,8 @@ usb_pc_cpu_invalidate(struct usb_page_ca /* nothing has been loaded into this page cache! */ return; } - bus_dmamap_sync(pc->tag, pc->map, - BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD); + bus_dmamap_sync(pc->tag, pc->map, BUS_DMASYNC_POSTREAD); + bus_dmamap_sync(pc->tag, pc->map, BUS_DMASYNC_PREREAD); } /*------------------------------------------------------------------------* @@ -693,8 +693,7 @@ usb_pc_cpu_flush(struct usb_page_cache * /* nothing has been loaded into this page cache! */ return; } - bus_dmamap_sync(pc->tag, pc->map, - BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); + bus_dmamap_sync(pc->tag, pc->map, BUS_DMASYNC_PREWRITE); } /*------------------------------------------------------------------------*