forked from luck/tmp_suning_uos_patched
MIPS: Synchronize dma_map_page and dma_map_single
Synchronize dma_map_page/dma_unmap_page and dma_map_single/dma_unmap_single. This will reduce unnecessary writebacks and invalidates. [Ralf: make dma_unmap_page an inline function.] Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:
parent
47740eb887
commit
4f29c057aa
|
@ -24,8 +24,13 @@ extern int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
|
|||
enum dma_data_direction direction);
|
||||
extern dma_addr_t dma_map_page(struct device *dev, struct page *page,
|
||||
unsigned long offset, size_t size, enum dma_data_direction direction);
|
||||
extern void dma_unmap_page(struct device *dev, dma_addr_t dma_address,
|
||||
size_t size, enum dma_data_direction direction);
|
||||
|
||||
static inline void dma_unmap_page(struct device *dev, dma_addr_t dma_address,
|
||||
size_t size, enum dma_data_direction direction)
|
||||
{
|
||||
dma_unmap_single(dev, dma_address, size, direction);
|
||||
}
|
||||
|
||||
extern void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
|
||||
int nhwentries, enum dma_data_direction direction);
|
||||
extern void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
|
||||
|
|
|
@ -209,7 +209,7 @@ dma_addr_t dma_map_page(struct device *dev, struct page *page,
|
|||
unsigned long addr;
|
||||
|
||||
addr = (unsigned long) page_address(page) + offset;
|
||||
dma_cache_wback_inv(addr, size);
|
||||
__dma_sync(addr, size, direction);
|
||||
}
|
||||
|
||||
return plat_map_dma_mem_page(dev, page) + offset;
|
||||
|
@ -217,23 +217,6 @@ dma_addr_t dma_map_page(struct device *dev, struct page *page,
|
|||
|
||||
EXPORT_SYMBOL(dma_map_page);
|
||||
|
||||
void dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
BUG_ON(direction == DMA_NONE);
|
||||
|
||||
if (!plat_device_is_coherent(dev) && direction != DMA_TO_DEVICE) {
|
||||
unsigned long addr;
|
||||
|
||||
addr = dma_addr_to_virt(dma_address);
|
||||
dma_cache_wback_inv(addr, size);
|
||||
}
|
||||
|
||||
plat_unmap_dma_mem(dev, dma_address);
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(dma_unmap_page);
|
||||
|
||||
void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user