*参照元 [#qad10e11] #backlinks *説明 [#w60d2ceb] -パス: [[linux-4.4.1/arch/arm64/mm/dma-mapping.c]] -FIXME: これは何? --説明 **引数 [#yabcff78] -struct device *dev -- --[[linux-4.4.1/device]] -struct vm_area_struct *vma -- --[[linux-4.4.1/vm_area_struct]] -void *cpu_addr -- -dma_addr_t dma_addr -- --[[linux-4.4.1/dma_addr_t]] -size_t size -- -struct dma_attrs *attrs -- --[[linux-4.4.1/dma_attrs]] **返り値 [#pf51406e] -int -- **参考 [#hba72796] *実装 [#fd3dbc82] static int __swiotlb_mmap(struct device *dev, struct vm_area_struct *vma, void *cpu_addr, dma_addr_t dma_addr, size_t size, struct dma_attrs *attrs) { int ret = -ENXIO; unsigned long nr_vma_pages = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; unsigned long nr_pages = PAGE_ALIGN(size) >> PAGE_SHIFT; unsigned long pfn = dma_to_phys(dev, dma_addr) >> PAGE_SHIFT; unsigned long off = vma->vm_pgoff; - --[[linux-4.4.1/PAGE_ALIGN()]] --[[linux-4.4.1/dma_to_phys()]] vma->vm_page_prot = __get_dma_pgprot(attrs, vma->vm_page_prot, is_device_dma_coherent(dev)); - --[[linux-4.4.1/__get_dma_pgprot()]] --[[linux-4.4.1/is_device_dma_coherent()]] if (dma_mmap_from_coherent(dev, vma, cpu_addr, size, &ret)) return ret; - --[[linux-4.4.1/dma_mmap_from_coherent()]] if (off < nr_pages && nr_vma_pages <= (nr_pages - off)) { ret = remap_pfn_range(vma, vma->vm_start, pfn + off, vma->vm_end - vma->vm_start, vma->vm_page_prot); } - --[[linux-4.4.1/remap_pfn_range()]] return ret; } *コメント [#qe2d308f]