#include <linux/device.h>
#include <linux/dma-mapping.h>
-#include <asm/memory.h>
#include <asm/cacheflush.h>
#include <asm/tlbflush.h>
#include <asm/sizes.h>
pte = consistent_pte[idx] + off;
c->vm_pages = page;
- split_page(page, order);
-
/*
* Set the "dma handle"
*/
do {
BUG_ON(!pte_none(*pte));
+ set_page_count(page, 1);
/*
* x86 does not mark the pages reserved...
*/
* Free the otherwise unused pages.
*/
while (page < end) {
+ set_page_count(page, 1);
__free_page(page);
page++;
}
void *
dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp)
{
- if (arch_is_coherent()) {
- void *virt;
-
- virt = kmalloc(size, gfp);
- if (!virt)
- return NULL;
- *handle = virt_to_dma(dev, virt);
-
- return virt;
- }
-
return __dma_alloc(dev, size, handle, gfp,
pgprot_noncached(pgprot_kernel));
}
WARN_ON(irqs_disabled());
- if (arch_is_coherent()) {
- kfree(cpu_addr);
- return;
- }
-
size = PAGE_ALIGN(size);
spin_lock_irqsave(&consistent_lock, flags);