コード例 #1
0
void cma_unmap_kernel(u32 phys_addr, size_t size, void *cpu_addr)
{
	struct page *page = phys_to_page(phys_addr);

	BUG_ON(unlikely(!pfn_valid(__phys_to_pfn(phys_addr))));

	size = PAGE_ALIGN(size);

	if (PageHighMem(page))
		__dma_free_remap(cpu_addr, size);
	else
		__dma_remap(page, size, pgprot_kernel);
}
コード例 #2
0
ファイル: dma-mapping.c プロジェクト: WayWingsDev/gopro-linux
/*
 * free a page as defined by the above mapping.
 * Must not be called with IRQs disabled.
 */
void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, dma_addr_t handle)
{
    WARN_ON(irqs_disabled());

    if (dma_release_from_coherent(dev, get_order(size), cpu_addr))
        return;

    size = PAGE_ALIGN(size);

    if (!arch_is_coherent())
        __dma_free_remap(cpu_addr, size);

    __dma_free_buffer(pfn_to_page(dma_to_pfn(dev, handle)), size);
}