x86, pci-nommu: add map_page
This is a preparation of struct dma_mapping_ops unification. We use map_page and unmap_page instead of map_single and unmap_single. We will remove map_single hook in the last patch in this patchset. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
committed by
Ingo Molnar
parent
ffbbef5c06
commit
33feffd452
@@ -25,18 +25,25 @@ check_addr(char *name, struct device *hwdev, dma_addr_t bus, size_t size)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static dma_addr_t
|
static dma_addr_t nommu_map_page(struct device *dev, struct page *page,
|
||||||
nommu_map_single(struct device *hwdev, phys_addr_t paddr, size_t size,
|
unsigned long offset, size_t size,
|
||||||
int direction)
|
enum dma_data_direction dir,
|
||||||
|
struct dma_attrs *attrs)
|
||||||
{
|
{
|
||||||
dma_addr_t bus = paddr;
|
dma_addr_t bus = page_to_phys(page) + offset;
|
||||||
WARN_ON(size == 0);
|
WARN_ON(size == 0);
|
||||||
if (!check_addr("map_single", hwdev, bus, size))
|
if (!check_addr("map_single", dev, bus, size))
|
||||||
return bad_dma_address;
|
return bad_dma_address;
|
||||||
flush_write_buffers();
|
flush_write_buffers();
|
||||||
return bus;
|
return bus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static dma_addr_t nommu_map_single(struct device *hwdev, phys_addr_t paddr,
|
||||||
|
size_t size, int direction)
|
||||||
|
{
|
||||||
|
return nommu_map_page(hwdev, pfn_to_page(paddr >> PAGE_SHIFT),
|
||||||
|
paddr & ~PAGE_MASK, size, direction, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/* Map a set of buffers described by scatterlist in streaming
|
/* Map a set of buffers described by scatterlist in streaming
|
||||||
* mode for DMA. This is the scatter-gather version of the
|
* mode for DMA. This is the scatter-gather version of the
|
||||||
@@ -83,6 +90,7 @@ struct dma_mapping_ops nommu_dma_ops = {
|
|||||||
.free_coherent = nommu_free_coherent,
|
.free_coherent = nommu_free_coherent,
|
||||||
.map_single = nommu_map_single,
|
.map_single = nommu_map_single,
|
||||||
.map_sg = nommu_map_sg,
|
.map_sg = nommu_map_sg,
|
||||||
|
.map_page = nommu_map_page,
|
||||||
.is_phys = 1,
|
.is_phys = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user