| Arnd Bergmann | aafe4db | 2009-05-13 22:56:33 +0000 | [diff] [blame] | 1 | #ifndef __ASM_GENERIC_SCATTERLIST_H | 
 | 2 | #define __ASM_GENERIC_SCATTERLIST_H | 
 | 3 |  | 
 | 4 | #include <linux/types.h> | 
 | 5 |  | 
 | 6 | struct scatterlist { | 
 | 7 | #ifdef CONFIG_DEBUG_SG | 
 | 8 | 	unsigned long	sg_magic; | 
 | 9 | #endif | 
 | 10 | 	unsigned long	page_link; | 
 | 11 | 	unsigned int	offset; | 
 | 12 | 	unsigned int	length; | 
 | 13 | 	dma_addr_t	dma_address; | 
| FUJITA Tomonori | 18e9830 | 2010-05-26 14:44:32 -0700 | [diff] [blame] | 14 | #ifdef CONFIG_NEED_SG_DMA_LENGTH | 
| Arnd Bergmann | aafe4db | 2009-05-13 22:56:33 +0000 | [diff] [blame] | 15 | 	unsigned int	dma_length; | 
| FUJITA Tomonori | 18e9830 | 2010-05-26 14:44:32 -0700 | [diff] [blame] | 16 | #endif | 
| Arnd Bergmann | aafe4db | 2009-05-13 22:56:33 +0000 | [diff] [blame] | 17 | }; | 
 | 18 |  | 
 | 19 | /* | 
 | 20 |  * These macros should be used after a dma_map_sg call has been done | 
 | 21 |  * to get bus addresses of each of the SG entries and their lengths. | 
 | 22 |  * You should only work with the number of sg entries pci_map_sg | 
 | 23 |  * returns, or alternatively stop on the first sg_dma_len(sg) which | 
 | 24 |  * is 0. | 
 | 25 |  */ | 
 | 26 | #define sg_dma_address(sg)	((sg)->dma_address) | 
| FUJITA Tomonori | 18e9830 | 2010-05-26 14:44:32 -0700 | [diff] [blame] | 27 |  | 
 | 28 | #ifdef CONFIG_NEED_SG_DMA_LENGTH | 
| Arnd Bergmann | aafe4db | 2009-05-13 22:56:33 +0000 | [diff] [blame] | 29 | #define sg_dma_len(sg)		((sg)->dma_length) | 
 | 30 | #else | 
 | 31 | #define sg_dma_len(sg)		((sg)->length) | 
| FUJITA Tomonori | 18e9830 | 2010-05-26 14:44:32 -0700 | [diff] [blame] | 32 | #endif | 
| Arnd Bergmann | aafe4db | 2009-05-13 22:56:33 +0000 | [diff] [blame] | 33 |  | 
| Arnd Bergmann | aafe4db | 2009-05-13 22:56:33 +0000 | [diff] [blame] | 34 | #endif /* __ASM_GENERIC_SCATTERLIST_H */ |