diff options
Diffstat (limited to 'arch/powerpc/kernel/dma_64.c')
-rw-r--r-- | arch/powerpc/kernel/dma_64.c | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/arch/powerpc/kernel/dma_64.c b/arch/powerpc/kernel/dma_64.c index 3a317cb0636a..ae5708e3a312 100644 --- a/arch/powerpc/kernel/dma_64.c +++ b/arch/powerpc/kernel/dma_64.c | |||
@@ -15,15 +15,6 @@ | |||
15 | * Generic iommu implementation | 15 | * Generic iommu implementation |
16 | */ | 16 | */ |
17 | 17 | ||
18 | static inline unsigned long device_to_mask(struct device *dev) | ||
19 | { | ||
20 | if (dev->dma_mask && *dev->dma_mask) | ||
21 | return *dev->dma_mask; | ||
22 | /* Assume devices without mask can take 32 bit addresses */ | ||
23 | return 0xfffffffful; | ||
24 | } | ||
25 | |||
26 | |||
27 | /* Allocates a contiguous real buffer and creates mappings over it. | 18 | /* Allocates a contiguous real buffer and creates mappings over it. |
28 | * Returns the virtual address of the buffer and sets dma_handle | 19 | * Returns the virtual address of the buffer and sets dma_handle |
29 | * to the dma address (mapping) of the first page. | 20 | * to the dma address (mapping) of the first page. |
@@ -50,32 +41,38 @@ static void dma_iommu_free_coherent(struct device *dev, size_t size, | |||
50 | */ | 41 | */ |
51 | static dma_addr_t dma_iommu_map_single(struct device *dev, void *vaddr, | 42 | static dma_addr_t dma_iommu_map_single(struct device *dev, void *vaddr, |
52 | size_t size, | 43 | size_t size, |
53 | enum dma_data_direction direction) | 44 | enum dma_data_direction direction, |
45 | struct dma_attrs *attrs) | ||
54 | { | 46 | { |
55 | return iommu_map_single(dev, dev->archdata.dma_data, vaddr, size, | 47 | return iommu_map_single(dev, dev->archdata.dma_data, vaddr, size, |
56 | device_to_mask(dev), direction); | 48 | device_to_mask(dev), direction, attrs); |
57 | } | 49 | } |
58 | 50 | ||
59 | 51 | ||
60 | static void dma_iommu_unmap_single(struct device *dev, dma_addr_t dma_handle, | 52 | static void dma_iommu_unmap_single(struct device *dev, dma_addr_t dma_handle, |
61 | size_t size, | 53 | size_t size, |
62 | enum dma_data_direction direction) | 54 | enum dma_data_direction direction, |
55 | struct dma_attrs *attrs) | ||
63 | { | 56 | { |
64 | iommu_unmap_single(dev->archdata.dma_data, dma_handle, size, direction); | 57 | iommu_unmap_single(dev->archdata.dma_data, dma_handle, size, direction, |
58 | attrs); | ||
65 | } | 59 | } |
66 | 60 | ||
67 | 61 | ||
68 | static int dma_iommu_map_sg(struct device *dev, struct scatterlist *sglist, | 62 | static int dma_iommu_map_sg(struct device *dev, struct scatterlist *sglist, |
69 | int nelems, enum dma_data_direction direction) | 63 | int nelems, enum dma_data_direction direction, |
64 | struct dma_attrs *attrs) | ||
70 | { | 65 | { |
71 | return iommu_map_sg(dev, sglist, nelems, | 66 | return iommu_map_sg(dev, dev->archdata.dma_data, sglist, nelems, |
72 | device_to_mask(dev), direction); | 67 | device_to_mask(dev), direction, attrs); |
73 | } | 68 | } |
74 | 69 | ||
75 | static void dma_iommu_unmap_sg(struct device *dev, struct scatterlist *sglist, | 70 | static void dma_iommu_unmap_sg(struct device *dev, struct scatterlist *sglist, |
76 | int nelems, enum dma_data_direction direction) | 71 | int nelems, enum dma_data_direction direction, |
72 | struct dma_attrs *attrs) | ||
77 | { | 73 | { |
78 | iommu_unmap_sg(dev->archdata.dma_data, sglist, nelems, direction); | 74 | iommu_unmap_sg(dev->archdata.dma_data, sglist, nelems, direction, |
75 | attrs); | ||
79 | } | 76 | } |
80 | 77 | ||
81 | /* We support DMA to/from any memory page via the iommu */ | 78 | /* We support DMA to/from any memory page via the iommu */ |
@@ -148,19 +145,22 @@ static void dma_direct_free_coherent(struct device *dev, size_t size, | |||
148 | 145 | ||
149 | static dma_addr_t dma_direct_map_single(struct device *dev, void *ptr, | 146 | static dma_addr_t dma_direct_map_single(struct device *dev, void *ptr, |
150 | size_t size, | 147 | size_t size, |
151 | enum dma_data_direction direction) | 148 | enum dma_data_direction direction, |
149 | struct dma_attrs *attrs) | ||
152 | { | 150 | { |
153 | return virt_to_abs(ptr) + get_dma_direct_offset(dev); | 151 | return virt_to_abs(ptr) + get_dma_direct_offset(dev); |
154 | } | 152 | } |
155 | 153 | ||
156 | static void dma_direct_unmap_single(struct device *dev, dma_addr_t dma_addr, | 154 | static void dma_direct_unmap_single(struct device *dev, dma_addr_t dma_addr, |
157 | size_t size, | 155 | size_t size, |
158 | enum dma_data_direction direction) | 156 | enum dma_data_direction direction, |
157 | struct dma_attrs *attrs) | ||
159 | { | 158 | { |
160 | } | 159 | } |
161 | 160 | ||
162 | static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, | 161 | static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, |
163 | int nents, enum dma_data_direction direction) | 162 | int nents, enum dma_data_direction direction, |
163 | struct dma_attrs *attrs) | ||
164 | { | 164 | { |
165 | struct scatterlist *sg; | 165 | struct scatterlist *sg; |
166 | int i; | 166 | int i; |
@@ -174,7 +174,8 @@ static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, | |||
174 | } | 174 | } |
175 | 175 | ||
176 | static void dma_direct_unmap_sg(struct device *dev, struct scatterlist *sg, | 176 | static void dma_direct_unmap_sg(struct device *dev, struct scatterlist *sg, |
177 | int nents, enum dma_data_direction direction) | 177 | int nents, enum dma_data_direction direction, |
178 | struct dma_attrs *attrs) | ||
178 | { | 179 | { |
179 | } | 180 | } |
180 | 181 | ||