busdma_machdep.c with more than 512M memory

Jayachandran C. c.jayachandran at gmail.com
Wed Sep 1 07:07:38 UTC 2010


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);

Thanks,
JC.


More information about the freebsd-mips mailing list