2009-05-14 06:56:33 +08:00
|
|
|
#ifndef __ASM_GENERIC_SCATTERLIST_H
|
|
|
|
#define __ASM_GENERIC_SCATTERLIST_H
|
|
|
|
|
|
|
|
#include <linux/types.h>
|
|
|
|
|
|
|
|
struct scatterlist {
|
|
|
|
#ifdef CONFIG_DEBUG_SG
|
|
|
|
unsigned long sg_magic;
|
|
|
|
#endif
|
|
|
|
unsigned long page_link;
|
|
|
|
unsigned int offset;
|
|
|
|
unsigned int length;
|
|
|
|
dma_addr_t dma_address;
|
2010-05-27 05:44:32 +08:00
|
|
|
#ifdef CONFIG_NEED_SG_DMA_LENGTH
|
2009-05-14 06:56:33 +08:00
|
|
|
unsigned int dma_length;
|
2010-05-27 05:44:32 +08:00
|
|
|
#endif
|
2009-05-14 06:56:33 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* These macros should be used after a dma_map_sg call has been done
|
|
|
|
* to get bus addresses of each of the SG entries and their lengths.
|
|
|
|
* You should only work with the number of sg entries pci_map_sg
|
|
|
|
* returns, or alternatively stop on the first sg_dma_len(sg) which
|
|
|
|
* is 0.
|
|
|
|
*/
|
|
|
|
#define sg_dma_address(sg) ((sg)->dma_address)
|
2010-05-27 05:44:32 +08:00
|
|
|
|
|
|
|
#ifdef CONFIG_NEED_SG_DMA_LENGTH
|
2009-05-14 06:56:33 +08:00
|
|
|
#define sg_dma_len(sg) ((sg)->dma_length)
|
|
|
|
#else
|
|
|
|
#define sg_dma_len(sg) ((sg)->length)
|
2010-05-27 05:44:32 +08:00
|
|
|
#endif
|
2009-05-14 06:56:33 +08:00
|
|
|
|
|
|
|
#endif /* __ASM_GENERIC_SCATTERLIST_H */
|