aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/dma-iommu.c
diff options
context:
space:
mode:
authorBecky Bruce <beckyb@kernel.crashing.org>2009-09-21 04:26:35 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-09-24 01:31:43 -0400
commit738ef42e32fe95553a424c04016b936c9f6c9afb (patch)
treef45f21a92eacbb22bd3223c5ac725473c6ec1d72 /arch/powerpc/kernel/dma-iommu.c
parent1cebd7a0f62804ca24f7b7b35e8105000b9e879a (diff)
powerpc: Change archdata dma_data to a union
Sometimes this is used to hold a simple offset, and sometimes it is used to hold a pointer. This patch changes it to a union containing void * and dma_addr_t. get/set accessors are also provided, because it was getting a bit ugly to get to the actual data. Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/dma-iommu.c')
-rw-r--r--arch/powerpc/kernel/dma-iommu.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/arch/powerpc/kernel/dma-iommu.c b/arch/powerpc/kernel/dma-iommu.c
index 87ddb3fb948c..37771a518119 100644
--- a/arch/powerpc/kernel/dma-iommu.c
+++ b/arch/powerpc/kernel/dma-iommu.c
@@ -18,7 +18,7 @@
18static void *dma_iommu_alloc_coherent(struct device *dev, size_t size, 18static void *dma_iommu_alloc_coherent(struct device *dev, size_t size,
19 dma_addr_t *dma_handle, gfp_t flag) 19 dma_addr_t *dma_handle, gfp_t flag)
20{ 20{
21 return iommu_alloc_coherent(dev, dev->archdata.dma_data, size, 21 return iommu_alloc_coherent(dev, get_iommu_table_base(dev), size,
22 dma_handle, device_to_mask(dev), flag, 22 dma_handle, device_to_mask(dev), flag,
23 dev_to_node(dev)); 23 dev_to_node(dev));
24} 24}
@@ -26,7 +26,7 @@ static void *dma_iommu_alloc_coherent(struct device *dev, size_t size,
26static void dma_iommu_free_coherent(struct device *dev, size_t size, 26static void dma_iommu_free_coherent(struct device *dev, size_t size,
27 void *vaddr, dma_addr_t dma_handle) 27 void *vaddr, dma_addr_t dma_handle)
28{ 28{
29 iommu_free_coherent(dev->archdata.dma_data, size, vaddr, dma_handle); 29 iommu_free_coherent(get_iommu_table_base(dev), size, vaddr, dma_handle);
30} 30}
31 31
32/* Creates TCEs for a user provided buffer. The user buffer must be 32/* Creates TCEs for a user provided buffer. The user buffer must be
@@ -39,8 +39,8 @@ static dma_addr_t dma_iommu_map_page(struct device *dev, struct page *page,
39 enum dma_data_direction direction, 39 enum dma_data_direction direction,
40 struct dma_attrs *attrs) 40 struct dma_attrs *attrs)
41{ 41{
42 return iommu_map_page(dev, dev->archdata.dma_data, page, offset, size, 42 return iommu_map_page(dev, get_iommu_table_base(dev), page, offset,
43 device_to_mask(dev), direction, attrs); 43 size, device_to_mask(dev), direction, attrs);
44} 44}
45 45
46 46
@@ -48,7 +48,7 @@ static void dma_iommu_unmap_page(struct device *dev, dma_addr_t dma_handle,
48 size_t size, enum dma_data_direction direction, 48 size_t size, enum dma_data_direction direction,
49 struct dma_attrs *attrs) 49 struct dma_attrs *attrs)
50{ 50{
51 iommu_unmap_page(dev->archdata.dma_data, dma_handle, size, direction, 51 iommu_unmap_page(get_iommu_table_base(dev), dma_handle, size, direction,
52 attrs); 52 attrs);
53} 53}
54 54
@@ -57,7 +57,7 @@ static int dma_iommu_map_sg(struct device *dev, struct scatterlist *sglist,
57 int nelems, enum dma_data_direction direction, 57 int nelems, enum dma_data_direction direction,
58 struct dma_attrs *attrs) 58 struct dma_attrs *attrs)
59{ 59{
60 return iommu_map_sg(dev, dev->archdata.dma_data, sglist, nelems, 60 return iommu_map_sg(dev, get_iommu_table_base(dev), sglist, nelems,
61 device_to_mask(dev), direction, attrs); 61 device_to_mask(dev), direction, attrs);
62} 62}
63 63
@@ -65,14 +65,14 @@ static void dma_iommu_unmap_sg(struct device *dev, struct scatterlist *sglist,
65 int nelems, enum dma_data_direction direction, 65 int nelems, enum dma_data_direction direction,
66 struct dma_attrs *attrs) 66 struct dma_attrs *attrs)
67{ 67{
68 iommu_unmap_sg(dev->archdata.dma_data, sglist, nelems, direction, 68 iommu_unmap_sg(get_iommu_table_base(dev), sglist, nelems, direction,
69 attrs); 69 attrs);
70} 70}
71 71
72/* We support DMA to/from any memory page via the iommu */ 72/* We support DMA to/from any memory page via the iommu */
73static int dma_iommu_dma_supported(struct device *dev, u64 mask) 73static int dma_iommu_dma_supported(struct device *dev, u64 mask)
74{ 74{
75 struct iommu_table *tbl = dev->archdata.dma_data; 75 struct iommu_table *tbl = get_iommu_table_base(dev);
76 76
77 if (!tbl || tbl->it_offset > mask) { 77 if (!tbl || tbl->it_offset > mask) {
78 printk(KERN_INFO 78 printk(KERN_INFO