scatterlist.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. unsigned int dma_length;
  13. };
  14. /*
  15. * These macros should be used after a dma_map_sg call has been done
  16. * to get bus addresses of each of the SG entries and their lengths.
  17. * You should only work with the number of sg entries pci_map_sg
  18. * returns, or alternatively stop on the first sg_dma_len(sg) which
  19. * is 0.
  20. */
  21. #define sg_dma_address(sg) ((sg)->dma_address)
  22. #ifndef sg_dma_len
  23. /*
  24. * Normally, you have an iommu on 64 bit machines, but not on 32 bit
  25. * machines. Architectures that are differnt should override this.
  26. */
  27. #if __BITS_PER_LONG == 64
  28. #define sg_dma_len(sg) ((sg)->dma_length)
  29. #else
  30. #define sg_dma_len(sg) ((sg)->length)
  31. #endif /* 64 bit */
  32. #endif /* sg_dma_len */
  33. #ifndef ISA_DMA_THRESHOLD
  34. #define ISA_DMA_THRESHOLD (~0UL)
  35. #endif
  36. #define ARCH_HAS_SG_CHAIN
  37. #endif /* __ASM_GENERIC_SCATTERLIST_H */