scatterlist.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* MN10300 Scatterlist definitions
  2. *
  3. * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd.
  4. * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public Licence
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the Licence, or (at your option) any later version.
  10. */
  11. #ifndef _ASM_SCATTERLIST_H
  12. #define _ASM_SCATTERLIST_H
  13. #include <asm/types.h>
  14. /*
  15. * Drivers must set either ->address or (preferred) page and ->offset
  16. * to indicate where data must be transferred to/from.
  17. *
  18. * Using page is recommended since it handles highmem data as well as
  19. * low mem. ->address is restricted to data which has a virtual mapping, and
  20. * it will go away in the future. Updating to page can be automated very
  21. * easily -- something like
  22. *
  23. * sg->address = some_ptr;
  24. *
  25. * can be rewritten as
  26. *
  27. * sg_set_page(virt_to_page(some_ptr));
  28. * sg->offset = (unsigned long) some_ptr & ~PAGE_MASK;
  29. *
  30. * and that's it. There's no excuse for not highmem enabling YOUR driver. /jens
  31. */
  32. struct scatterlist {
  33. #ifdef CONFIG_DEBUG_SG
  34. unsigned long sg_magic;
  35. #endif
  36. unsigned long page_link;
  37. unsigned int offset; /* for highmem, page offset */
  38. dma_addr_t dma_address;
  39. unsigned int length;
  40. };
  41. #define ISA_DMA_THRESHOLD (0x00ffffff)
  42. /*
  43. * These macros should be used after a pci_map_sg call has been done
  44. * to get bus addresses of each of the SG entries and their lengths.
  45. * You should only work with the number of sg entries pci_map_sg
  46. * returns.
  47. */
  48. #define sg_dma_address(sg) ((sg)->dma_address)
  49. #define sg_dma_len(sg) ((sg)->length)
  50. #endif /* _ASM_SCATTERLIST_H */