aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asm-arm/dma-mapping.h10
-rw-r--r--include/asm-avr32/dma-mapping.h7
-rw-r--r--include/asm-blackfin/scatterlist.h1
-rw-r--r--include/asm-frv/scatterlist.h8
-rw-r--r--include/asm-m68knommu/scatterlist.h1
-rw-r--r--include/asm-parisc/scatterlist.h2
-rw-r--r--include/asm-powerpc/dma-mapping.h10
-rw-r--r--include/asm-sh/dma-mapping.h12
-rw-r--r--include/asm-sh64/dma-mapping.h12
9 files changed, 28 insertions, 35 deletions
diff --git a/include/asm-arm/dma-mapping.h b/include/asm-arm/dma-mapping.h
index 1eb8aac43228..e99406a7bece 100644
--- a/include/asm-arm/dma-mapping.h
+++ b/include/asm-arm/dma-mapping.h
@@ -5,7 +5,7 @@
5 5
6#include <linux/mm.h> /* need struct page */ 6#include <linux/mm.h> /* need struct page */
7 7
8#include <asm/scatterlist.h> 8#include <linux/scatterlist.h>
9 9
10/* 10/*
11 * DMA-consistent mapping functions. These allocate/free a region of 11 * DMA-consistent mapping functions. These allocate/free a region of
@@ -274,8 +274,8 @@ dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
274 for (i = 0; i < nents; i++, sg++) { 274 for (i = 0; i < nents; i++, sg++) {
275 char *virt; 275 char *virt;
276 276
277 sg->dma_address = page_to_dma(dev, sg->page) + sg->offset; 277 sg->dma_address = page_to_dma(dev, sg_page(sg)) + sg->offset;
278 virt = page_address(sg->page) + sg->offset; 278 virt = sg_virt(sg);
279 279
280 if (!arch_is_coherent()) 280 if (!arch_is_coherent())
281 dma_cache_maint(virt, sg->length, dir); 281 dma_cache_maint(virt, sg->length, dir);
@@ -371,7 +371,7 @@ dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
371 int i; 371 int i;
372 372
373 for (i = 0; i < nents; i++, sg++) { 373 for (i = 0; i < nents; i++, sg++) {
374 char *virt = page_address(sg->page) + sg->offset; 374 char *virt = sg_virt(sg);
375 if (!arch_is_coherent()) 375 if (!arch_is_coherent())
376 dma_cache_maint(virt, sg->length, dir); 376 dma_cache_maint(virt, sg->length, dir);
377 } 377 }
@@ -384,7 +384,7 @@ dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nents,
384 int i; 384 int i;
385 385
386 for (i = 0; i < nents; i++, sg++) { 386 for (i = 0; i < nents; i++, sg++) {
387 char *virt = page_address(sg->page) + sg->offset; 387 char *virt = sg_virt(sg);
388 if (!arch_is_coherent()) 388 if (!arch_is_coherent())
389 dma_cache_maint(virt, sg->length, dir); 389 dma_cache_maint(virt, sg->length, dir);
390 } 390 }
diff --git a/include/asm-avr32/dma-mapping.h b/include/asm-avr32/dma-mapping.h
index 81e342636ac4..a7131630c057 100644
--- a/include/asm-avr32/dma-mapping.h
+++ b/include/asm-avr32/dma-mapping.h
@@ -217,8 +217,8 @@ dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
217 for (i = 0; i < nents; i++) { 217 for (i = 0; i < nents; i++) {
218 char *virt; 218 char *virt;
219 219
220 sg[i].dma_address = page_to_bus(sg[i].page) + sg[i].offset; 220 sg[i].dma_address = page_to_bus(sg_page(&sg[i])) + sg[i].offset;
221 virt = page_address(sg[i].page) + sg[i].offset; 221 virt = sg_virt(&sg[i]);
222 dma_cache_sync(dev, virt, sg[i].length, direction); 222 dma_cache_sync(dev, virt, sg[i].length, direction);
223 } 223 }
224 224
@@ -327,8 +327,7 @@ dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
327 int i; 327 int i;
328 328
329 for (i = 0; i < nents; i++) { 329 for (i = 0; i < nents; i++) {
330 dma_cache_sync(dev, page_address(sg[i].page) + sg[i].offset, 330 dma_cache_sync(dev, sg_virt(&sg[i]), sg[i].length, direction);
331 sg[i].length, direction);
332 } 331 }
333} 332}
334 333
diff --git a/include/asm-blackfin/scatterlist.h b/include/asm-blackfin/scatterlist.h
index 32128d53469b..04f448711cd0 100644
--- a/include/asm-blackfin/scatterlist.h
+++ b/include/asm-blackfin/scatterlist.h
@@ -20,7 +20,6 @@ struct scatterlist {
20 * returns, or alternatively stop on the first sg_dma_len(sg) which 20 * returns, or alternatively stop on the first sg_dma_len(sg) which
21 * is 0. 21 * is 0.
22 */ 22 */
23#define sg_address(sg) (page_address((sg)->page) + (sg)->offset)
24#define sg_dma_address(sg) ((sg)->dma_address) 23#define sg_dma_address(sg) ((sg)->dma_address)
25#define sg_dma_len(sg) ((sg)->length) 24#define sg_dma_len(sg) ((sg)->length)
26 25
diff --git a/include/asm-frv/scatterlist.h b/include/asm-frv/scatterlist.h
index f7da007b763c..99ba76edc42a 100644
--- a/include/asm-frv/scatterlist.h
+++ b/include/asm-frv/scatterlist.h
@@ -4,19 +4,19 @@
4#include <asm/types.h> 4#include <asm/types.h>
5 5
6/* 6/*
7 * Drivers must set either ->address or (preferred) ->page and ->offset 7 * Drivers must set either ->address or (preferred) page and ->offset
8 * to indicate where data must be transferred to/from. 8 * to indicate where data must be transferred to/from.
9 * 9 *
10 * Using ->page is recommended since it handles highmem data as well as 10 * Using page is recommended since it handles highmem data as well as
11 * low mem. ->address is restricted to data which has a virtual mapping, and 11 * low mem. ->address is restricted to data which has a virtual mapping, and
12 * it will go away in the future. Updating to ->page can be automated very 12 * it will go away in the future. Updating to page can be automated very
13 * easily -- something like 13 * easily -- something like
14 * 14 *
15 * sg->address = some_ptr; 15 * sg->address = some_ptr;
16 * 16 *
17 * can be rewritten as 17 * can be rewritten as
18 * 18 *
19 * sg->page = virt_to_page(some_ptr); 19 * sg_set_page(virt_to_page(some_ptr));
20 * sg->offset = (unsigned long) some_ptr & ~PAGE_MASK; 20 * sg->offset = (unsigned long) some_ptr & ~PAGE_MASK;
21 * 21 *
22 * and that's it. There's no excuse for not highmem enabling YOUR driver. /jens 22 * and that's it. There's no excuse for not highmem enabling YOUR driver. /jens
diff --git a/include/asm-m68knommu/scatterlist.h b/include/asm-m68knommu/scatterlist.h
index 10942840e88f..afc4788b0d2c 100644
--- a/include/asm-m68knommu/scatterlist.h
+++ b/include/asm-m68knommu/scatterlist.h
@@ -14,7 +14,6 @@ struct scatterlist {
14 unsigned int length; 14 unsigned int length;
15}; 15};
16 16
17#define sg_address(sg) (page_address((sg)->page) + (sg)->offset)
18#define sg_dma_address(sg) ((sg)->dma_address) 17#define sg_dma_address(sg) ((sg)->dma_address)
19#define sg_dma_len(sg) ((sg)->length) 18#define sg_dma_len(sg) ((sg)->length)
20 19
diff --git a/include/asm-parisc/scatterlist.h b/include/asm-parisc/scatterlist.h
index cd3cfdf82289..62269b31ebf4 100644
--- a/include/asm-parisc/scatterlist.h
+++ b/include/asm-parisc/scatterlist.h
@@ -18,7 +18,7 @@ struct scatterlist {
18 __u32 iova_length; /* bytes mapped */ 18 __u32 iova_length; /* bytes mapped */
19}; 19};
20 20
21#define sg_virt_addr(sg) ((unsigned long)(page_address(sg->page) + sg->offset)) 21#define sg_virt_addr(sg) ((unsigned long)sg_virt(sg))
22#define sg_dma_address(sg) ((sg)->iova) 22#define sg_dma_address(sg) ((sg)->iova)
23#define sg_dma_len(sg) ((sg)->iova_length) 23#define sg_dma_len(sg) ((sg)->iova_length)
24 24
diff --git a/include/asm-powerpc/dma-mapping.h b/include/asm-powerpc/dma-mapping.h
index 65be95dd03a5..ff52013c0e2d 100644
--- a/include/asm-powerpc/dma-mapping.h
+++ b/include/asm-powerpc/dma-mapping.h
@@ -285,9 +285,9 @@ dma_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
285 BUG_ON(direction == DMA_NONE); 285 BUG_ON(direction == DMA_NONE);
286 286
287 for_each_sg(sgl, sg, nents, i) { 287 for_each_sg(sgl, sg, nents, i) {
288 BUG_ON(!sg->page); 288 BUG_ON(!sg_page(sg));
289 __dma_sync_page(sg->page, sg->offset, sg->length, direction); 289 __dma_sync_page(sg_page(sg), sg->offset, sg->length, direction);
290 sg->dma_address = page_to_bus(sg->page) + sg->offset; 290 sg->dma_address = page_to_bus(sg_page(sg)) + sg->offset;
291 } 291 }
292 292
293 return nents; 293 return nents;
@@ -328,7 +328,7 @@ static inline void dma_sync_sg_for_cpu(struct device *dev,
328 BUG_ON(direction == DMA_NONE); 328 BUG_ON(direction == DMA_NONE);
329 329
330 for_each_sg(sgl, sg, nents, i) 330 for_each_sg(sgl, sg, nents, i)
331 __dma_sync_page(sg->page, sg->offset, sg->length, direction); 331 __dma_sync_page(sg_page(sg), sg->offset, sg->length, direction);
332} 332}
333 333
334static inline void dma_sync_sg_for_device(struct device *dev, 334static inline void dma_sync_sg_for_device(struct device *dev,
@@ -341,7 +341,7 @@ static inline void dma_sync_sg_for_device(struct device *dev,
341 BUG_ON(direction == DMA_NONE); 341 BUG_ON(direction == DMA_NONE);
342 342
343 for_each_sg(sgl, sg, nents, i) 343 for_each_sg(sgl, sg, nents, i)
344 __dma_sync_page(sg->page, sg->offset, sg->length, direction); 344 __dma_sync_page(sg_page(sg), sg->offset, sg->length, direction);
345} 345}
346 346
347static inline int dma_mapping_error(dma_addr_t dma_addr) 347static inline int dma_mapping_error(dma_addr_t dma_addr)
diff --git a/include/asm-sh/dma-mapping.h b/include/asm-sh/dma-mapping.h
index 84fefdaa01a5..fcea067f7a9c 100644
--- a/include/asm-sh/dma-mapping.h
+++ b/include/asm-sh/dma-mapping.h
@@ -2,7 +2,7 @@
2#define __ASM_SH_DMA_MAPPING_H 2#define __ASM_SH_DMA_MAPPING_H
3 3
4#include <linux/mm.h> 4#include <linux/mm.h>
5#include <asm/scatterlist.h> 5#include <linux/scatterlist.h>
6#include <asm/cacheflush.h> 6#include <asm/cacheflush.h>
7#include <asm/io.h> 7#include <asm/io.h>
8 8
@@ -85,10 +85,9 @@ static inline int dma_map_sg(struct device *dev, struct scatterlist *sg,
85 85
86 for (i = 0; i < nents; i++) { 86 for (i = 0; i < nents; i++) {
87#if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT) 87#if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT)
88 dma_cache_sync(dev, page_address(sg[i].page) + sg[i].offset, 88 dma_cache_sync(dev, sg_virt(&sg[i]), sg[i].length, dir);
89 sg[i].length, dir);
90#endif 89#endif
91 sg[i].dma_address = page_to_phys(sg[i].page) + sg[i].offset; 90 sg[i].dma_address = sg_phys(&sg[i]);
92 } 91 }
93 92
94 return nents; 93 return nents;
@@ -138,10 +137,9 @@ static inline void dma_sync_sg(struct device *dev, struct scatterlist *sg,
138 137
139 for (i = 0; i < nelems; i++) { 138 for (i = 0; i < nelems; i++) {
140#if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT) 139#if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT)
141 dma_cache_sync(dev, page_address(sg[i].page) + sg[i].offset, 140 dma_cache_sync(dev, sg_virt(&sg[i]), sg[i].length, dir);
142 sg[i].length, dir);
143#endif 141#endif
144 sg[i].dma_address = page_to_phys(sg[i].page) + sg[i].offset; 142 sg[i].dma_address = sg_phys(&sg[i]);
145 } 143 }
146} 144}
147 145
diff --git a/include/asm-sh64/dma-mapping.h b/include/asm-sh64/dma-mapping.h
index e661857f98dc..1438b763a5ea 100644
--- a/include/asm-sh64/dma-mapping.h
+++ b/include/asm-sh64/dma-mapping.h
@@ -2,7 +2,7 @@
2#define __ASM_SH_DMA_MAPPING_H 2#define __ASM_SH_DMA_MAPPING_H
3 3
4#include <linux/mm.h> 4#include <linux/mm.h>
5#include <asm/scatterlist.h> 5#include <linux/scatterlist.h>
6#include <asm/io.h> 6#include <asm/io.h>
7 7
8struct pci_dev; 8struct pci_dev;
@@ -71,10 +71,9 @@ static inline int dma_map_sg(struct device *dev, struct scatterlist *sg,
71 71
72 for (i = 0; i < nents; i++) { 72 for (i = 0; i < nents; i++) {
73#if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT) 73#if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT)
74 dma_cache_sync(dev, page_address(sg[i].page) + sg[i].offset, 74 dma_cache_sync(dev, sg_virt(&sg[i]), sg[i].length, dir);
75 sg[i].length, dir);
76#endif 75#endif
77 sg[i].dma_address = page_to_phys(sg[i].page) + sg[i].offset; 76 sg[i].dma_address = sg_phys(&sg[i]);
78 } 77 }
79 78
80 return nents; 79 return nents;
@@ -124,10 +123,9 @@ static inline void dma_sync_sg(struct device *dev, struct scatterlist *sg,
124 123
125 for (i = 0; i < nelems; i++) { 124 for (i = 0; i < nelems; i++) {
126#if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT) 125#if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT)
127 dma_cache_sync(dev, page_address(sg[i].page) + sg[i].offset, 126 dma_cache_sync(dev, sg_virt(&sg[i]), sg[i].length, dir);
128 sg[i].length, dir);
129#endif 127#endif
130 sg[i].dma_address = page_to_phys(sg[i].page) + sg[i].offset; 128 sg[i].dma_address = sg_phys(&sg[i]);
131 } 129 }
132} 130}
133 131