diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2010-05-26 17:44:32 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-27 12:12:54 -0400 |
commit | 18e98307de0d746cb0845ebf66535ce2184c25a2 (patch) | |
tree | eac998f31e3930ffc1f54e524a2a9bbc82b851e0 | |
parent | 204f3a04449a9a775e465f7d87bcab08f170e59e (diff) |
asm-generic: add NEED_SG_DMA_LENGTH to define sg_dma_len()
There are only two ways to define sg_dma_len(); use sg->dma_length or
sg->length. This patch introduces NEED_SG_DMA_LENGTH that enables
architectures to choose sg->dma_length or sg->length.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | arch/ia64/Kconfig | 3 | ||||
-rw-r--r-- | arch/sh/Kconfig | 3 | ||||
-rw-r--r-- | arch/sparc/Kconfig | 3 | ||||
-rw-r--r-- | arch/sparc/include/asm/scatterlist.h | 2 | ||||
-rw-r--r-- | arch/x86/Kconfig | 3 | ||||
-rw-r--r-- | include/asm-generic/scatterlist.h | 13 |
6 files changed, 17 insertions, 10 deletions
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index 9676100b83ee..f8afdd271f3d 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig | |||
@@ -56,6 +56,9 @@ config MMU | |||
56 | config NEED_DMA_MAP_STATE | 56 | config NEED_DMA_MAP_STATE |
57 | def_bool y | 57 | def_bool y |
58 | 58 | ||
59 | config NEED_SG_DMA_LENGTH | ||
60 | def_bool y | ||
61 | |||
59 | config SWIOTLB | 62 | config SWIOTLB |
60 | bool | 63 | bool |
61 | 64 | ||
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index 0e318c905eea..c5ee4ce60b57 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig | |||
@@ -186,6 +186,9 @@ config DMA_NONCOHERENT | |||
186 | config NEED_DMA_MAP_STATE | 186 | config NEED_DMA_MAP_STATE |
187 | def_bool DMA_NONCOHERENT | 187 | def_bool DMA_NONCOHERENT |
188 | 188 | ||
189 | config NEED_SG_DMA_LENGTH | ||
190 | def_bool y | ||
191 | |||
189 | source "init/Kconfig" | 192 | source "init/Kconfig" |
190 | 193 | ||
191 | source "kernel/Kconfig.freezer" | 194 | source "kernel/Kconfig.freezer" |
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index d6781ce687e2..6f1470baa314 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig | |||
@@ -133,6 +133,9 @@ config ZONE_DMA | |||
133 | config NEED_DMA_MAP_STATE | 133 | config NEED_DMA_MAP_STATE |
134 | def_bool y | 134 | def_bool y |
135 | 135 | ||
136 | config NEED_SG_DMA_LENGTH | ||
137 | def_bool y | ||
138 | |||
136 | config GENERIC_ISA_DMA | 139 | config GENERIC_ISA_DMA |
137 | bool | 140 | bool |
138 | default y if SPARC32 | 141 | default y if SPARC32 |
diff --git a/arch/sparc/include/asm/scatterlist.h b/arch/sparc/include/asm/scatterlist.h index 0fa0d6da2107..69d21bb052f1 100644 --- a/arch/sparc/include/asm/scatterlist.h +++ b/arch/sparc/include/asm/scatterlist.h | |||
@@ -1,8 +1,6 @@ | |||
1 | #ifndef _SPARC_SCATTERLIST_H | 1 | #ifndef _SPARC_SCATTERLIST_H |
2 | #define _SPARC_SCATTERLIST_H | 2 | #define _SPARC_SCATTERLIST_H |
3 | 3 | ||
4 | #define sg_dma_len(sg) ((sg)->dma_length) | ||
5 | |||
6 | #define ISA_DMA_THRESHOLD (~0UL) | 4 | #define ISA_DMA_THRESHOLD (~0UL) |
7 | 5 | ||
8 | #include <asm-generic/scatterlist.h> | 6 | #include <asm-generic/scatterlist.h> |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index e0c619c55b4e..5bdc143b1228 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -109,6 +109,9 @@ config SBUS | |||
109 | config NEED_DMA_MAP_STATE | 109 | config NEED_DMA_MAP_STATE |
110 | def_bool (X86_64 || DMAR || DMA_API_DEBUG) | 110 | def_bool (X86_64 || DMAR || DMA_API_DEBUG) |
111 | 111 | ||
112 | config NEED_SG_DMA_LENGTH | ||
113 | def_bool X86_64 | ||
114 | |||
112 | config GENERIC_ISA_DMA | 115 | config GENERIC_ISA_DMA |
113 | def_bool y | 116 | def_bool y |
114 | 117 | ||
diff --git a/include/asm-generic/scatterlist.h b/include/asm-generic/scatterlist.h index 51a7a43ab0ce..5e087944a659 100644 --- a/include/asm-generic/scatterlist.h +++ b/include/asm-generic/scatterlist.h | |||
@@ -11,7 +11,9 @@ struct scatterlist { | |||
11 | unsigned int offset; | 11 | unsigned int offset; |
12 | unsigned int length; | 12 | unsigned int length; |
13 | dma_addr_t dma_address; | 13 | dma_addr_t dma_address; |
14 | #ifdef CONFIG_NEED_SG_DMA_LENGTH | ||
14 | unsigned int dma_length; | 15 | unsigned int dma_length; |
16 | #endif | ||
15 | }; | 17 | }; |
16 | 18 | ||
17 | /* | 19 | /* |
@@ -22,17 +24,12 @@ struct scatterlist { | |||
22 | * is 0. | 24 | * is 0. |
23 | */ | 25 | */ |
24 | #define sg_dma_address(sg) ((sg)->dma_address) | 26 | #define sg_dma_address(sg) ((sg)->dma_address) |
25 | #ifndef sg_dma_len | 27 | |
26 | /* | 28 | #ifdef CONFIG_NEED_SG_DMA_LENGTH |
27 | * Normally, you have an iommu on 64 bit machines, but not on 32 bit | ||
28 | * machines. Architectures that are differnt should override this. | ||
29 | */ | ||
30 | #if __BITS_PER_LONG == 64 | ||
31 | #define sg_dma_len(sg) ((sg)->dma_length) | 29 | #define sg_dma_len(sg) ((sg)->dma_length) |
32 | #else | 30 | #else |
33 | #define sg_dma_len(sg) ((sg)->length) | 31 | #define sg_dma_len(sg) ((sg)->length) |
34 | #endif /* 64 bit */ | 32 | #endif |
35 | #endif /* sg_dma_len */ | ||
36 | 33 | ||
37 | #define ARCH_HAS_SG_CHAIN | 34 | #define ARCH_HAS_SG_CHAIN |
38 | 35 | ||