From owner-freebsd-usb@FreeBSD.ORG Thu Apr 24 15:36:58 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 93F23106566B; Thu, 24 Apr 2008 15:36:58 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe02.swip.net [212.247.154.33]) by mx1.freebsd.org (Postfix) with ESMTP id 3AC208FC1B; Thu, 24 Apr 2008 15:36:55 +0000 (UTC) (envelope-from hselasky@c2i.net) X-Cloudmark-Score: 0.000000 [] Received: from [62.113.133.152] (account mc467741@c2i.net [62.113.133.152] verified) by mailfe02.swip.net (CommuniGate Pro SMTP 5.1.13) with ESMTPA id 912991824; Thu, 24 Apr 2008 17:36:54 +0200 From: Hans Petter Selasky To: John Baldwin Date: Thu, 24 Apr 2008 17:38:09 +0200 User-Agent: KMail/1.9.7 References: <20080421171305.GA19840@eecs.harvard.edu> <200804240916.39607.hselasky@c2i.net> <200804240806.54354.jhb@freebsd.org> In-Reply-To: <200804240806.54354.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200804241738.09805.hselasky@c2i.net> Cc: freebsd-embedded@freebsd.org, freebsd-usb@freebsd.org, Geoffrey Mainland Subject: Re: Soekris 4826 USB failure on FreeBSD 7.0 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: Thu, 24 Apr 2008 15:36:58 -0000 On Thursday 24 April 2008, John Baldwin wrote: > > This would indicate a bug in the bus_dmamap_load() call (wrong length?) and > that is going to hose you when you do the bus_dmamap_sync() for systems > with bounce pages (not enough data will get copied back and forth?). You > need to track down the real bug and fix it rather than adding a hack in > your callback routine. Hi John, The minimum segment size is PAGE_SIZE bytes in my DMA-tag. Bus-dma starts counting at the memory location of the allocation. And not the memory location aligned to PAGE_SIZE bytes. Memory pages: |--------------|--------------| My allocation: |---------XXXXXXXXXXXXX-------| Sometimes when I allocate DMA memory I can end up having an allocation crossing two contiguous memory pages in physical memory. In those cases bus_dma does not give me the segment address of the second page in the segment list, because the allocation is less than PAGE_SIZE bytes. It fits within the values specified in the DMA tag. But in other cases, where the pages are not contiguous in RAM, bus_dma will return two different segment addresses. The question is: Is this a bug or is it a feature? --HPS