Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 112303
b: refs/heads/master
c: 2638b4d
h: refs/heads/master
i:
  112301: 65e58fb
  112299: 2260fa0
  112295: 57c708e
  112287: 45da381
v: v3
  • Loading branch information
Russell King authored and Russell King committed Sep 29, 2008
1 parent c0303dc commit 02e473f
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 39 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 01135d92c1a540cd3370f7cf3d1c762320b85034
refs/heads/master: 2638b4dbe768aba023a06acd8e7eba708bb76ee6
48 changes: 12 additions & 36 deletions trunk/arch/arm/common/dmabounce.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,45 +468,23 @@ void dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_addr,
}
EXPORT_SYMBOL(dma_sync_single_range_for_device);

void
dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
enum dma_data_direction dir)
int dmabounce_sync_for_cpu(struct device *dev, dma_addr_t addr,
unsigned long off, size_t sz, enum dma_data_direction dir)
{
struct scatterlist *s;
int i;

dev_dbg(dev, "%s(sg=%p,nents=%d,dir=%x)\n",
__func__, sg, nents, dir);

BUG_ON(dir == DMA_NONE);

for_each_sg(sg, s, nents, i) {
dma_addr_t dma_addr = s->dma_address;
unsigned int length = s->length;

sync_single(dev, dma_addr, length, dir);
}
dev_dbg(dev, "%s(dma=%#lx,off=%#lx,sz=%zx,dir=%x)\n",
__func__, addr, off, sz, dir);
return sync_single(dev, addr, off + sz, dir);
}
EXPORT_SYMBOL(dmabounce_sync_for_cpu);

void
dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nents,
enum dma_data_direction dir)
int dmabounce_sync_for_device(struct device *dev, dma_addr_t addr,
unsigned long off, size_t sz, enum dma_data_direction dir)
{
struct scatterlist *s;
int i;

dev_dbg(dev, "%s(sg=%p,nents=%d,dir=%x)\n",
__func__, sg, nents, dir);

BUG_ON(dir == DMA_NONE);

for_each_sg(sg, s, nents, i) {
dma_addr_t dma_addr = s->dma_address;
unsigned int length = s->length;

sync_single(dev, dma_addr, length, dir);
}
dev_dbg(dev, "%s(dma=%#lx,off=%#lx,sz=%zx,dir=%x)\n",
__func__, addr, off, sz, dir);
return sync_single(dev, addr, off + sz, dir);
}
EXPORT_SYMBOL(dmabounce_sync_for_device);

static int
dmabounce_init_pool(struct dmabounce_pool *pool, struct device *dev, const char *name,
Expand Down Expand Up @@ -618,8 +596,6 @@ dmabounce_unregister_dev(struct device *dev)

EXPORT_SYMBOL(dma_map_single);
EXPORT_SYMBOL(dma_unmap_single);
EXPORT_SYMBOL(dma_sync_sg_for_cpu);
EXPORT_SYMBOL(dma_sync_sg_for_device);
EXPORT_SYMBOL(dmabounce_register_dev);
EXPORT_SYMBOL(dmabounce_unregister_dev);

Expand Down
11 changes: 11 additions & 0 deletions trunk/arch/arm/include/asm/dma-mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,17 @@ extern void dmabounce_unregister_dev(struct device *);
*
*/
extern int dma_needs_bounce(struct device*, dma_addr_t, size_t);

/*
* Private functions
*/
int dmabounce_sync_for_cpu(struct device *, dma_addr_t, unsigned long,
size_t, enum dma_data_direction);
int dmabounce_sync_for_device(struct device *, dma_addr_t, unsigned long,
size_t, enum dma_data_direction);
#else
#define dmabounce_sync_for_cpu(dev,dma,off,sz,dir) (1)
#define dmabounce_sync_for_device(dev,dma,off,sz,dir) (1)
#endif /* CONFIG_DMABOUNCE */

#endif /* __KERNEL__ */
Expand Down
10 changes: 8 additions & 2 deletions trunk/arch/arm/mm/dma-mapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,6 @@ void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nents,
}
EXPORT_SYMBOL(dma_unmap_sg);

#ifndef CONFIG_DMABOUNCE
/**
* dma_sync_sg_for_cpu
* @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
Expand All @@ -586,6 +585,10 @@ void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
int i;

for_each_sg(sg, s, nents, i) {
if (!dmabounce_sync_for_cpu(dev, sg_dma_address(s), 0,
sg_dma_len(s), dir))
continue;

if (!arch_is_coherent())
dma_cache_maint(sg_virt(s), s->length, dir);
}
Expand All @@ -606,9 +609,12 @@ void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
int i;

for_each_sg(sg, s, nents, i) {
if (!dmabounce_sync_for_device(dev, sg_dma_address(s), 0,
sg_dma_len(s), dir))
continue;

if (!arch_is_coherent())
dma_cache_maint(sg_virt(s), s->length, dir);
}
}
EXPORT_SYMBOL(dma_sync_sg_for_device);
#endif

0 comments on commit 02e473f

Please sign in to comment.