scatterlist.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef _ASM_SCATTERLIST_H
  2. #define _ASM_SCATTERLIST_H
  3. #include <asm/types.h>
  4. /*
  5. * Drivers must set either ->address or (preferred) page and ->offset
  6. * to indicate where data must be transferred to/from.
  7. *
  8. * Using page is recommended since it handles highmem data as well as
  9. * low mem. ->address is restricted to data which has a virtual mapping, and
  10. * it will go away in the future. Updating to page can be automated very
  11. * easily -- something like
  12. *
  13. * sg->address = some_ptr;
  14. *
  15. * can be rewritten as
  16. *
  17. * sg_set_buf(sg, some_ptr, length);
  18. *
  19. * and that's it. There's no excuse for not highmem enabling YOUR driver. /jens
  20. */
  21. struct scatterlist {
  22. #ifdef CONFIG_DEBUG_SG
  23. unsigned long sg_magic;
  24. #endif
  25. unsigned long page_link;
  26. unsigned int offset; /* for highmem, page offset */
  27. dma_addr_t dma_address;
  28. unsigned int length;
  29. };
  30. /*
  31. * These macros should be used after a pci_map_sg call has been done
  32. * to get bus addresses of each of the SG entries and their lengths.
  33. * You should only work with the number of sg entries pci_map_sg
  34. * returns, or alternatively stop on the first sg_dma_len(sg) which
  35. * is 0.
  36. */
  37. #define sg_dma_address(sg) ((sg)->dma_address)
  38. #define sg_dma_len(sg) ((sg)->length)
  39. #define ISA_DMA_THRESHOLD (0xffffffffUL)
  40. #endif /* !_ASM_SCATTERLIST_H */