scatterlist.h 845 B

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