From owner-freebsd-usb@FreeBSD.ORG Sat Nov 8 20:08:08 2008 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A7471065673; Sat, 8 Nov 2008 20:08:08 +0000 (UTC) (envelope-from xcllnt@mac.com) Received: from asmtpout011.mac.com (asmtpout011.mac.com [17.148.16.86]) by mx1.freebsd.org (Postfix) with ESMTP id 223CA8FC18; Sat, 8 Nov 2008 20:08:08 +0000 (UTC) (envelope-from xcllnt@mac.com) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Received: from rng-t43.jnpr.net (natint3.juniper.net [66.129.224.36]) by asmtp011.mac.com (Sun Java(tm) System Messaging Server 6.3-7.03 (built Aug 7 2008; 32bit)) with ESMTPSA id <0KA100J4S3TINS90@asmtp011.mac.com>; Sat, 08 Nov 2008 11:08:08 -0800 (PST) Message-id: <61594882-04B6-4DC9-AE16-FD3F0638EDCC@mac.com> From: Marcel Moolenaar To: Hans Petter Selasky In-reply-to: <200811081353.09697.hselasky@c2i.net> Date: Sat, 08 Nov 2008 11:08:02 -0800 References: <20081107082740.GA1334@icarus.home.lan> <20081108001128.GA1437@icarus.home.lan> <200811081023.10058.hselasky@freebsd.org> <200811081353.09697.hselasky@c2i.net> X-Mailer: Apple Mail (2.929.2) Cc: freebsd-current@freebsd.org, freebsd-usb@freebsd.org Subject: Re: (FWD) Serious busdma bug in -current in relation to USB harware. X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Nov 2008 20:08:08 -0000 On Nov 8, 2008, at 4:53 AM, Hans Petter Selasky wrote: > On Saturday 08 November 2008, Alexander Motin wrote: >> Hans Petter Selasky wrote: >>> http://perforce.freebsd.org/chv.cgi?CH=152649 >>> >>> Change 152649 by hselasky@hselasky_laptop001 on 2008/11/08 09:09:50 >>> >>> >>> Fix a serious BUSDMA bug: The initial virtual page offset is >>> not retained on the bounce pages, which is what the EHCI and >>> the OHCI expects. >> >> I'm sorry, but are you sure with this? If bounce page will have the >> same >> page offset as original data, then how bus_dma_tag_create()'s >> alignment >> parameter expected to work? What if data are misaligned, but hardware >> require alignment? > > Hi, > > I'm not saying that my patch is fully correct for all cases, but at > least it > solves the USB case. USB uses an alignment of 1-byte for data. Another way to look at it is that USB (at least EHCI) uses page-aligned data and that for the first descriptor you can optionally add an offset within the page. Effectively this gives you 1-byte alignment, but it comes with the restriction that on crossing the page boundary, all data comes from offset 0 on subsequent pages. -- Marcel Moolenaar xcllnt@mac.com