diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2008-08-22 03:29:10 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-08-22 04:18:26 -0400 |
commit | 421076e2bec1b917bdcf83da35b24f6349bf35db (patch) | |
tree | e0a68cdc86899ae11cf243397fa32acc1674db5c /arch/x86/kernel/pci-gart_64.c | |
parent | 0d8136ea509132c66155ca8a1e7cf60699f95c37 (diff) |
x86: dma_*_coherent rework patchset v2, fix
alloc_coherent dma_ops callback was added to GART, however, it doesn't
return a size aligned address wrt dma_alloc_coherent, as
DMA-mapping.txt defines. This patch fixes it.
This patch also removes unused gart_map_simple
(dma_mapping_ops->map_simple has gone).
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/pci-gart_64.c')
-rw-r--r-- | arch/x86/kernel/pci-gart_64.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c index 338c4f241559..4d0864900b8c 100644 --- a/arch/x86/kernel/pci-gart_64.c +++ b/arch/x86/kernel/pci-gart_64.c | |||
@@ -261,20 +261,6 @@ static dma_addr_t dma_map_area(struct device *dev, dma_addr_t phys_mem, | |||
261 | return iommu_bus_base + iommu_page*PAGE_SIZE + (phys_mem & ~PAGE_MASK); | 261 | return iommu_bus_base + iommu_page*PAGE_SIZE + (phys_mem & ~PAGE_MASK); |
262 | } | 262 | } |
263 | 263 | ||
264 | static dma_addr_t | ||
265 | gart_map_simple(struct device *dev, phys_addr_t paddr, size_t size, int dir) | ||
266 | { | ||
267 | dma_addr_t map; | ||
268 | unsigned long align_mask; | ||
269 | |||
270 | align_mask = (1UL << get_order(size)) - 1; | ||
271 | map = dma_map_area(dev, paddr, size, dir, align_mask); | ||
272 | |||
273 | flush_gart(); | ||
274 | |||
275 | return map; | ||
276 | } | ||
277 | |||
278 | /* Map a single area into the IOMMU */ | 264 | /* Map a single area into the IOMMU */ |
279 | static dma_addr_t | 265 | static dma_addr_t |
280 | gart_map_single(struct device *dev, phys_addr_t paddr, size_t size, int dir) | 266 | gart_map_single(struct device *dev, phys_addr_t paddr, size_t size, int dir) |
@@ -512,12 +498,21 @@ gart_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_addr, | |||
512 | gfp_t flag) | 498 | gfp_t flag) |
513 | { | 499 | { |
514 | void *vaddr; | 500 | void *vaddr; |
501 | unsigned long align_mask; | ||
515 | 502 | ||
516 | vaddr = (void *)__get_free_pages(flag | __GFP_ZERO, get_order(size)); | 503 | vaddr = (void *)__get_free_pages(flag | __GFP_ZERO, get_order(size)); |
517 | if (!vaddr) | 504 | if (!vaddr) |
518 | return NULL; | 505 | return NULL; |
519 | 506 | ||
520 | *dma_addr = gart_map_single(dev, __pa(vaddr), size, DMA_BIDIRECTIONAL); | 507 | align_mask = (1UL << get_order(size)) - 1; |
508 | |||
509 | if (!dev) | ||
510 | dev = &x86_dma_fallback_dev; | ||
511 | |||
512 | *dma_addr = dma_map_area(dev, __pa(vaddr), size, DMA_BIDIRECTIONAL, | ||
513 | align_mask); | ||
514 | flush_gart(); | ||
515 | |||
521 | if (*dma_addr != bad_dma_address) | 516 | if (*dma_addr != bad_dma_address) |
522 | return vaddr; | 517 | return vaddr; |
523 | 518 | ||