2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-23 20:53:53 +08:00

microblaze: Moved __dma_sync() to dma-mapping.h

__dma_sync_page() was replaced by __dma_sync(), and parameters of calls to
the new function were adjusted to match __dma_sync()'s format.

Signed-off-by: Eli Billauer <eli.billauer@gmail.com>
Signed-off-by: Michal Simek <monstr@monstr.eu>
This commit is contained in:
Eli Billauer 2011-09-11 22:43:06 +03:00 committed by Michal Simek
parent 2309f7cfca
commit cf560c1801
2 changed files with 21 additions and 21 deletions

View File

@ -28,12 +28,12 @@
#include <linux/dma-attrs.h> #include <linux/dma-attrs.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm-generic/dma-coherent.h> #include <asm-generic/dma-coherent.h>
#include <asm/cacheflush.h>
#define DMA_ERROR_CODE (~(dma_addr_t)0x0) #define DMA_ERROR_CODE (~(dma_addr_t)0x0)
#define __dma_alloc_coherent(dev, gfp, size, handle) NULL #define __dma_alloc_coherent(dev, gfp, size, handle) NULL
#define __dma_free_coherent(size, addr) ((void)0) #define __dma_free_coherent(size, addr) ((void)0)
#define __dma_sync(addr, size, rw) ((void)0)
static inline unsigned long device_to_mask(struct device *dev) static inline unsigned long device_to_mask(struct device *dev)
{ {
@ -95,6 +95,22 @@ static inline int dma_set_mask(struct device *dev, u64 dma_mask)
#include <asm-generic/dma-mapping-common.h> #include <asm-generic/dma-mapping-common.h>
static inline void __dma_sync(unsigned long paddr,
size_t size, enum dma_data_direction direction)
{
switch (direction) {
case DMA_TO_DEVICE:
case DMA_BIDIRECTIONAL:
flush_dcache_range(paddr, paddr + size);
break;
case DMA_FROM_DEVICE:
invalidate_dcache_range(paddr, paddr + size);
break;
default:
BUG();
}
}
static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
{ {
struct dma_map_ops *ops = get_dma_ops(dev); struct dma_map_ops *ops = get_dma_ops(dev);
@ -135,7 +151,7 @@ static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
enum dma_data_direction direction) enum dma_data_direction direction)
{ {
BUG_ON(direction == DMA_NONE); BUG_ON(direction == DMA_NONE);
__dma_sync(vaddr, size, (int)direction); __dma_sync(virt_to_phys(vaddr), size, (int)direction);
} }
#endif /* _ASM_MICROBLAZE_DMA_MAPPING_H */ #endif /* _ASM_MICROBLAZE_DMA_MAPPING_H */

View File

@ -11,7 +11,6 @@
#include <linux/gfp.h> #include <linux/gfp.h>
#include <linux/dma-debug.h> #include <linux/dma-debug.h>
#include <asm/bug.h> #include <asm/bug.h>
#include <asm/cacheflush.h>
/* /*
* Generic direct DMA implementation * Generic direct DMA implementation
@ -21,21 +20,6 @@
* can set archdata.dma_data to an unsigned long holding the offset. By * can set archdata.dma_data to an unsigned long holding the offset. By
* default the offset is PCI_DRAM_OFFSET. * default the offset is PCI_DRAM_OFFSET.
*/ */
static inline void __dma_sync_page(unsigned long paddr, unsigned long offset,
size_t size, enum dma_data_direction direction)
{
switch (direction) {
case DMA_TO_DEVICE:
case DMA_BIDIRECTIONAL:
flush_dcache_range(paddr + offset, paddr + offset + size);
break;
case DMA_FROM_DEVICE:
invalidate_dcache_range(paddr + offset, paddr + offset + size);
break;
default:
BUG();
}
}
static unsigned long get_dma_direct_offset(struct device *dev) static unsigned long get_dma_direct_offset(struct device *dev)
{ {
@ -91,7 +75,7 @@ static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl,
/* FIXME this part of code is untested */ /* FIXME this part of code is untested */
for_each_sg(sgl, sg, nents, i) { for_each_sg(sgl, sg, nents, i) {
sg->dma_address = sg_phys(sg) + get_dma_direct_offset(dev); sg->dma_address = sg_phys(sg) + get_dma_direct_offset(dev);
__dma_sync_page(page_to_phys(sg_page(sg)), sg->offset, __dma_sync(page_to_phys(sg_page(sg)) + sg->offset,
sg->length, direction); sg->length, direction);
} }
@ -116,7 +100,7 @@ static inline dma_addr_t dma_direct_map_page(struct device *dev,
enum dma_data_direction direction, enum dma_data_direction direction,
struct dma_attrs *attrs) struct dma_attrs *attrs)
{ {
__dma_sync_page(page_to_phys(page), offset, size, direction); __dma_sync(page_to_phys(page) + offset, size, direction);
return page_to_phys(page) + offset + get_dma_direct_offset(dev); return page_to_phys(page) + offset + get_dma_direct_offset(dev);
} }
@ -131,7 +115,7 @@ static inline void dma_direct_unmap_page(struct device *dev,
* phys_to_virt is here because in __dma_sync_page is __virt_to_phys and * phys_to_virt is here because in __dma_sync_page is __virt_to_phys and
* dma_address is physical address * dma_address is physical address
*/ */
__dma_sync_page(dma_address, 0 , size, direction); __dma_sync(dma_address, size, direction);
} }
struct dma_map_ops dma_direct_ops = { struct dma_map_ops dma_direct_ops = {