diff options
author | Steve Lin <stlin@nvidia.com> | 2010-07-19 12:55:33 -0700 |
---|---|---|
committer | Gary King <gking@nvidia.com> | 2010-07-19 13:00:50 -0700 |
commit | cabc1827ba228b0901c7276979e990734385e980 (patch) | |
tree | 658318362f91e153ef03be501bc545c738db70ed /arch/arm/common | |
parent | 2c1b66f1ce1bd561aa3aadf13c776cf2fc4451f2 (diff) |
[ARM] dmabounce: check for alignment & aperture for bouncing
change 53f34260 accidentally deleted the code that checked the dma
address to determine if it needed to be bounced, so no bouncing was
performed.
revert this part of the change
Change-Id: Iae2d097c38e178c25132cacfe58c132736186c46
Reviewed-on: http://git-master/r/4053
Tested-by: Szming Lin <stlin@nvidia.com>
Reviewed-by: Gary King <gking@nvidia.com>
Diffstat (limited to 'arch/arm/common')
-rw-r--r-- | arch/arm/common/dmabounce.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/arch/arm/common/dmabounce.c b/arch/arm/common/dmabounce.c index 3b184d3cbcc3..aa0180390dd8 100644 --- a/arch/arm/common/dmabounce.c +++ b/arch/arm/common/dmabounce.c @@ -241,6 +241,25 @@ static inline dma_addr_t map_single_or_page(struct device *dev, void *ptr, else dma_addr = virt_to_dma(dev, ptr); + if (dev->dma_mask) { + unsigned long mask = *dev->dma_mask; + unsigned long limit; + + limit = (mask - 1) | mask; + limit = (limit + 1) & ~limit; + if (limit && size > limit) { + dev_err(dev, "DMA mapping too big (requested %#x " + "mask %#Lx)\n", size, *dev->dma_mask); + return ~0; + } + + /* + * Figure out if we need to bounce from the DMA mask. + */ + needs_bounce = (dma_addr & ~mask) || + (limit && (dma_addr + size > limit)); + } + if (device_info && (needs_bounce || dma_needs_bounce(dev, dma_addr, size))) { struct safe_buffer *buf; |