From owner-freebsd-usb@FreeBSD.ORG Thu Apr 24 07:15:22 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 C470C1065678 for ; Thu, 24 Apr 2008 07:15:22 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe14.swip.net [212.247.155.161]) by mx1.freebsd.org (Postfix) with ESMTP id 4AA318FC25 for ; Thu, 24 Apr 2008 07:15:22 +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 mailfe14.swip.net (CommuniGate Pro SMTP 5.1.13) with ESMTPA id 171340962; Thu, 24 Apr 2008 09:15:20 +0200 From: Hans Petter Selasky To: Geoffrey Mainland Date: Thu, 24 Apr 2008 09:16:38 +0200 User-Agent: KMail/1.9.7 References: <20080421171305.GA19840@eecs.harvard.edu> <200804231932.00765.hselasky@c2i.net> <20080424033452.GA39119@eecs.harvard.edu> In-Reply-To: <20080424033452.GA39119@eecs.harvard.edu> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200804240916.39607.hselasky@c2i.net> Cc: freebsd-usb@freebsd.org, freebsd-embedded@freebsd.org 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 07:15:22 -0000 On Thursday 24 April 2008, Geoffrey Mainland wrote: > On Wed, Apr 23, 2008 at 07:31:59PM +0200, Hans Petter Selasky wrote: > > On Tuesday 22 April 2008, Geoffrey Mainland wrote: > > > Wow, this turns out to be much worse than I thought...I've tracked down > > > the problem to the commit of the new physical memory allocator at Sat > > > Jun 16 04:57:05 2007 UTC. Before that, no kern/122380; after that, > > > kern/122380 applies. Any ideas where to go from here? > > > > Hi, > > > > I've sometimes seen that the USB HC's do not always support 32 address > > lines. Not sure if that is the case for you. Then all DMA memory has to > > be allocated at a lower physical memory address. You can easily check > > this by changing the parameters used when creating DMA tags in the USB > > code. > > > > --HPS > > The new page allocator obviously tickled a bug somewhere in the current > USB stack, but I'm happy to report that replacing it with the USB stack > from your subversion repository fixed everything. Thank you! This fix > has allowed me to move a large wireless testbed forward to FreeBSD 7. > > Geoff Hi, A wild guess of mine why the official USB stack in the 7-branch does not work: It might be that the loading of KVA into DMA is broken. I've found a couple of corner cases during my development where you have to generate the physaddr of the last page yourself in the busdma callback: static void usbd_pc_common_mem_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error, uint8_t isload) ... if (nseg < ((pc->page_offset_end + (USB_PAGE_SIZE - 1)) / USB_PAGE_SIZE)) { ext_seg = 1; } else { ext_seg = 0; } ... if (ext_seg && pc->ismultiseg) { (pg + 1)->physaddr = pg->physaddr + USB_PAGE_SIZE; } --HPS