omap-iommu.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * omap iommu: simple virtual address space management
  3. *
  4. * Copyright (C) 2008-2009 Nokia Corporation
  5. *
  6. * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #ifndef _INTEL_IOMMU_H_
  13. #define _INTEL_IOMMU_H_
  14. struct iovm_struct {
  15. struct omap_iommu *iommu; /* iommu object which this belongs to */
  16. u32 da_start; /* area definition */
  17. u32 da_end;
  18. u32 flags; /* IOVMF_: see below */
  19. struct list_head list; /* linked in ascending order */
  20. const struct sg_table *sgt; /* keep 'page' <-> 'da' mapping */
  21. void *va; /* mpu side mapped address */
  22. };
  23. #define MMU_RAM_ENDIAN_SHIFT 9
  24. #define MMU_RAM_ENDIAN_LITTLE (0 << MMU_RAM_ENDIAN_SHIFT)
  25. #define MMU_RAM_ELSZ_8 (0 << MMU_RAM_ELSZ_SHIFT)
  26. #define IOVMF_ENDIAN_LITTLE MMU_RAM_ENDIAN_LITTLE
  27. #define MMU_RAM_ELSZ_SHIFT 7
  28. #define IOVMF_ELSZ_8 MMU_RAM_ELSZ_8
  29. struct iommu_domain;
  30. extern struct iovm_struct *omap_find_iovm_area(struct device *dev, u32 da);
  31. extern u32
  32. omap_iommu_vmap(struct iommu_domain *domain, struct device *dev, u32 da,
  33. const struct sg_table *sgt, u32 flags);
  34. extern struct sg_table *omap_iommu_vunmap(struct iommu_domain *domain,
  35. struct device *dev, u32 da);
  36. extern u32
  37. omap_iommu_vmalloc(struct iommu_domain *domain, struct device *dev,
  38. u32 da, size_t bytes, u32 flags);
  39. extern void
  40. omap_iommu_vfree(struct iommu_domain *domain, struct device *dev,
  41. const u32 da);
  42. extern void *omap_da_to_va(struct device *dev, u32 da);
  43. extern void omap_iommu_save_ctx(struct device *dev);
  44. extern void omap_iommu_restore_ctx(struct device *dev);
  45. #endif