a co-worker ported consistent_alloc() from ARM to MIPS.
We use it to allocate DMA buffers in unified memory in
a non-PCI system-on-a-chip embedded thingy.
Maybe we could have just used pci_alloc_consistent(), but
consistent_alloc() has the advantage of freeing unused
pages allocated due to __get_free_pages() power-of-two-
BTW, it seems that at least for CONFIG_SGI_IP27
pci_alloc_consistent() does not work for non-PCI DMA
buffers (hwdev == NULL). Anyway, the code for pci_alloc_consistent()
looks confusing because it seems to dereference a NULL pointer.
The attached patch works for us, but maybe someone
could comment if
a) it was a good idea to port it from ARM to MIPS
b) we made no gross mistakes (e.g. do we need to flush
the dcache? Currently it works without. Should we
c) if it is of use to other linux/MIPS users
One other thing:
The comments for dma_cache_wback_inv() in io.h seem
to lack a "memory" in "...makes caches and coherent...".
Also, dma_cache_wback() and dma_cache_wback_inv() seem to
be identical. Is this intentional?
Description: Text document