Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Apr 2008 09:16:38 +0200
From:      Hans Petter Selasky <hselasky@c2i.net>
To:        Geoffrey Mainland <mainland@eecs.harvard.edu>
Cc:        freebsd-usb@freebsd.org, freebsd-embedded@freebsd.org
Subject:   Re: Soekris 4826 USB failure on FreeBSD 7.0
Message-ID:  <200804240916.39607.hselasky@c2i.net>
In-Reply-To: <20080424033452.GA39119@eecs.harvard.edu>
References:  <20080421171305.GA19840@eecs.harvard.edu> <200804231932.00765.hselasky@c2i.net> <20080424033452.GA39119@eecs.harvard.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200804240916.39607.hselasky>