X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fswiotlb.c;h=a7381d55663a9f219f8313a4801614309ba9d207;hb=8380770c842faef3001e44662953d64ad9a93663;hp=10c13ad0d82d89dadebcee23951830d18599f0e0;hpb=31f6e1bd3b58c9a67e5ea0c2d372fbf5fc9e326d;p=linux-2.6-omap-h63xx.git diff --git a/lib/swiotlb.c b/lib/swiotlb.c index 10c13ad0d82..a7381d55663 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c @@ -357,7 +357,8 @@ map_single(struct device *hwdev, char *buffer, size_t size, int dir) * This is needed when we sync the memory. Then we sync the buffer if * needed. */ - io_tlb_orig_addr[index] = buffer; + for (i = 0; i < nslots; i++) + io_tlb_orig_addr[index+i] = buffer + (i << IO_TLB_SHIFT); if (dir == DMA_TO_DEVICE || dir == DMA_BIDIRECTIONAL) memcpy(dma_addr, buffer, size); @@ -418,6 +419,8 @@ sync_single(struct device *hwdev, char *dma_addr, size_t size, int index = (dma_addr - io_tlb_start) >> IO_TLB_SHIFT; char *buffer = io_tlb_orig_addr[index]; + buffer += ((unsigned long)dma_addr & ((1 << IO_TLB_SHIFT) - 1)); + switch (target) { case SYNC_FOR_CPU: if (likely(dir == DMA_FROM_DEVICE || dir == DMA_BIDIRECTIONAL))