busdma_machdep.c with more than 512M memory

Jayachandran C. c.jayachandran at gmail.com
Mon Sep 6 07:34:20 UTC 2010


On Wed, Sep 1, 2010 at 12:37 PM, Jayachandran C.
<c.jayachandran at gmail.com> wrote:
> I was looking at a few crashes I see with PCI drivers, and I think it
> is caused by an issue in busdma_machdep.c where physical address is
> directly converted using MIPS_PHYS_TO_KSEG1. I have not looked at it
> in detail, but it looks obviously wrong.
>
> Any suggestions on how to fix thiis is welcome, it probably needs an
> uncached TLB entry. On 64bit we could use XKPHYS uncached.
>
>
> ---
>  632         if (newmap->flags & DMAMAP_UNCACHEABLE) {
>  633                 void *tmpaddr = (void *)*vaddr;
>  634
>  635                 if (tmpaddr) {
>  636                         tmpaddr = (void
> *)MIPS_PHYS_TO_KSEG1(vtophys(tmpaddr));
>  637                         newmap->origbuffer = *vaddr;
>  638                         newmap->allocbuffer = tmpaddr;
>  639                         mips_dcache_wbinv_range((vm_offset_t)*vaddr,
>  640                             dmat->maxsize);
>  641                         *vaddr = tmpaddr;
>  642                 }
> ---
> 1361                 bpage->busaddr = pmap_kextract(bpage->vaddr);
> 1362                 bpage->vaddr_nocache =
> 1363                     (vm_offset_t)MIPS_PHYS_TO_KSEG1(bpage->busaddr);
> 1364                 mtx_lock(&bounce_lock);

Based on Juli's suggestion, I have a patch (attached) to switch the
calls to pmap_mapdev/pmap_unmapdev.

Seems to work for me now, please review.

Thanks,
JC.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: busdma.patch
Type: text/x-patch
Size: 1542 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-mips/attachments/20100906/f000c1d5/busdma.bin


More information about the freebsd-mips mailing list