iommu_common.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* $Id: iommu_common.h,v 1.5 2001/12/11 09:41:01 davem Exp $
  2. * iommu_common.h: UltraSparc SBUS/PCI common iommu declarations.
  3. *
  4. * Copyright (C) 1999 David S. Miller (davem@redhat.com)
  5. */
  6. #include <linux/kernel.h>
  7. #include <linux/types.h>
  8. #include <linux/sched.h>
  9. #include <linux/mm.h>
  10. #include <asm/iommu.h>
  11. #include <asm/scatterlist.h>
  12. /*
  13. * These give mapping size of each iommu pte/tlb.
  14. */
  15. #define IO_PAGE_SHIFT 13
  16. #define IO_PAGE_SIZE (1UL << IO_PAGE_SHIFT)
  17. #define IO_PAGE_MASK (~(IO_PAGE_SIZE-1))
  18. #define IO_PAGE_ALIGN(addr) (((addr)+IO_PAGE_SIZE-1)&IO_PAGE_MASK)
  19. #define IO_TSB_ENTRIES (128*1024)
  20. #define IO_TSB_SIZE (IO_TSB_ENTRIES * 8)
  21. /*
  22. * This is the hardwired shift in the iotlb tag/data parts.
  23. */
  24. #define IOMMU_PAGE_SHIFT 13
  25. /* You are _strongly_ advised to enable the following debugging code
  26. * any time you make changes to the sg code below, run it for a while
  27. * with filesystems mounted read-only before buying the farm... -DaveM
  28. */
  29. #undef VERIFY_SG
  30. #ifdef VERIFY_SG
  31. extern void verify_sglist(struct scatterlist *sg, int nents, iopte_t *iopte, int npages);
  32. #endif
  33. /* Two addresses are "virtually contiguous" if and only if:
  34. * 1) They are equal, or...
  35. * 2) They are both on a page boundary
  36. */
  37. #define VCONTIG(__X, __Y) (((__X) == (__Y)) || \
  38. (((__X) | (__Y)) << (64UL - PAGE_SHIFT)) == 0UL)
  39. extern unsigned long prepare_sg(struct scatterlist *sg, int nents);