[PATCH 2/8] x86: add free_coherent dma_ops callback to GART driver

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Joerg Roedel
Date: Tuesday, August 19, 2008 - 7:32 am

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
 arch/x86/kernel/pci-gart_64.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
index 44a75a6..794d026 100644
--- a/arch/x86/kernel/pci-gart_64.c
+++ b/arch/x86/kernel/pci-gart_64.c
@@ -526,6 +526,15 @@ gart_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_addr,
 	return NULL;
 }
 
+/* free a coherent mapping */
+static void
+gart_free_coherent(struct device *dev, size_t size, void *vaddr,
+		   dma_addr_t dma_addr)
+{
+	gart_unmap_single(dev, dma_addr, size, DMA_BIDIRECTIONAL);
+	free_pages((unsigned long)vaddr, get_order(size));
+}
+
 static int no_agp;
 
 static __init unsigned long check_iommu_size(unsigned long aper, u64 aper_size)
@@ -729,6 +738,7 @@ static struct dma_mapping_ops gart_dma_ops = {
 	.map_sg				= gart_map_sg,
 	.unmap_sg			= gart_unmap_sg,
 	.alloc_coherent			= gart_alloc_coherent,
+	.free_coherent			= gart_free_coherent,
 };
 
 void gart_iommu_shutdown(void)
-- 
1.5.3.7


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/8] x86 dma_*_coherent rework patchset v2, Joerg Roedel, (Tue Aug 19, 7:32 am)
[PATCH 2/8] x86: add free_coherent dma_ops callback to GAR ..., Joerg Roedel, (Tue Aug 19, 7:32 am)
[PATCH 6/8] x86: cleanup dma_*_coherent functions, Joerg Roedel, (Tue Aug 19, 7:32 am)
Re: [PATCH 0/8] x86 dma_*_coherent rework patchset v2, Ingo Molnar, (Wed Aug 20, 2:46 am)
Re: [PATCH 0/8] x86 dma_*_coherent rework patchset v2, Jesse Barnes, (Wed Aug 20, 10:39 am)
Re: [PATCH 0/8] x86 dma_*_coherent rework patchset v2, Ingo Molnar, (Thu Aug 21, 5:00 am)
Re: [PATCH 0/8] x86 dma_*_coherent rework patchset v2, FUJITA Tomonori, (Thu Aug 21, 7:16 am)
Re: [PATCH 0/8] x86 dma_*_coherent rework patchset v2, FUJITA Tomonori, (Thu Aug 21, 7:16 am)
Re: [PATCH 0/8] x86 dma_*_coherent rework patchset v2, Jesse Barnes, (Thu Aug 21, 8:07 am)
Re: [PATCH 0/8] x86 dma_*_coherent rework patchset v2, FUJITA Tomonori, (Thu Aug 21, 8:12 am)
Re: [PATCH 0/8] x86 dma_*_coherent rework patchset v2, Joerg Roedel, (Thu Aug 21, 8:20 am)
Re: [PATCH 0/8] x86 dma_*_coherent rework patchset v2, Ingo Molnar, (Thu Aug 21, 11:44 pm)
Re: [PATCH 0/8] x86 dma_*_coherent rework patchset v2, FUJITA Tomonori, (Thu Aug 21, 11:57 pm)
Re: [PATCH 0/8] x86 dma_*_coherent rework patchset v2, Ingo Molnar, (Fri Aug 22, 12:04 am)
Re: [PATCH 0/8] x86 dma_*_coherent rework patchset v2, Ingo Molnar, (Fri Aug 22, 12:09 am)
Re: [PATCH 0/8] x86 dma_*_coherent rework patchset v2, FUJITA Tomonori, (Fri Aug 22, 12:29 am)
Re: [PATCH 0/8] x86 dma_*_coherent rework patchset v2, Ingo Molnar, (Fri Aug 22, 1:23 am)