Soekris 4826 USB failure on FreeBSD 7.0
Hans Petter Selasky
hselasky at c2i.net
Thu Apr 24 08:15:24 UTC 2008
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
More information about the freebsd-embedded
mailing list