Skip to content

Commit

Permalink
asm-generic: add NEED_SG_DMA_LENGTH to define sg_dma_len()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
FUJITA Tomonori authored and Linus Torvalds committed May 27, 2010
1 parent 204f3a0 commit 18e9830
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 10 deletions.
3 changes: 3 additions & 0 deletions arch/ia64/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ config MMU
config NEED_DMA_MAP_STATE
def_bool y

config NEED_SG_DMA_LENGTH
def_bool y

config SWIOTLB
bool

Expand Down
3 changes: 3 additions & 0 deletions arch/sh/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ config DMA_NONCOHERENT
config NEED_DMA_MAP_STATE
def_bool DMA_NONCOHERENT

config NEED_SG_DMA_LENGTH
def_bool y

source "init/Kconfig"

source "kernel/Kconfig.freezer"
Expand Down
3 changes: 3 additions & 0 deletions arch/sparc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ config ZONE_DMA
config NEED_DMA_MAP_STATE
def_bool y

config NEED_SG_DMA_LENGTH
def_bool y

config GENERIC_ISA_DMA
bool
default y if SPARC32
Expand Down
2 changes: 0 additions & 2 deletions arch/sparc/include/asm/scatterlist.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#ifndef _SPARC_SCATTERLIST_H
#define _SPARC_SCATTERLIST_H

#define sg_dma_len(sg) ((sg)->dma_length)

#define ISA_DMA_THRESHOLD (~0UL)

#include <asm-generic/scatterlist.h>
Expand Down
3 changes: 3 additions & 0 deletions arch/x86/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ config SBUS
config NEED_DMA_MAP_STATE
def_bool (X86_64 || DMAR || DMA_API_DEBUG)

config NEED_SG_DMA_LENGTH
def_bool X86_64

config GENERIC_ISA_DMA
def_bool y

Expand Down
13 changes: 5 additions & 8 deletions include/asm-generic/scatterlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ struct scatterlist {
unsigned int offset;
unsigned int length;
dma_addr_t dma_address;
#ifdef CONFIG_NEED_SG_DMA_LENGTH
unsigned int dma_length;
#endif
};

/*
Expand All @@ -22,17 +24,12 @@ struct scatterlist {
* is 0.
*/
#define sg_dma_address(sg) ((sg)->dma_address)
#ifndef sg_dma_len
/*
* Normally, you have an iommu on 64 bit machines, but not on 32 bit
* machines. Architectures that are differnt should override this.
*/
#if __BITS_PER_LONG == 64

#ifdef CONFIG_NEED_SG_DMA_LENGTH
#define sg_dma_len(sg) ((sg)->dma_length)
#else
#define sg_dma_len(sg) ((sg)->length)
#endif /* 64 bit */
#endif /* sg_dma_len */
#endif

#define ARCH_HAS_SG_CHAIN

Expand Down

0 comments on commit 18e9830

Please sign in to comment.