of_iommu.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef __OF_IOMMU_H
  2. #define __OF_IOMMU_H
  3. #include <linux/device.h>
  4. #include <linux/iommu.h>
  5. #include <linux/of.h>
  6. #ifdef CONFIG_OF_IOMMU
  7. extern int of_get_dma_window(struct device_node *dn, const char *prefix,
  8. int index, unsigned long *busno, dma_addr_t *addr,
  9. size_t *size);
  10. extern const struct iommu_ops *of_iommu_configure(struct device *dev,
  11. struct device_node *master_np);
  12. #else
  13. static inline int of_get_dma_window(struct device_node *dn, const char *prefix,
  14. int index, unsigned long *busno, dma_addr_t *addr,
  15. size_t *size)
  16. {
  17. return -EINVAL;
  18. }
  19. static inline const struct iommu_ops *of_iommu_configure(struct device *dev,
  20. struct device_node *master_np)
  21. {
  22. return NULL;
  23. }
  24. #endif /* CONFIG_OF_IOMMU */
  25. void of_iommu_set_ops(struct device_node *np, const struct iommu_ops *ops);
  26. const struct iommu_ops *of_iommu_get_ops(struct device_node *np);
  27. extern struct of_device_id __iommu_of_table;
  28. typedef int (*of_iommu_init_fn)(struct device_node *);
  29. #define IOMMU_OF_DECLARE(name, compat, fn) \
  30. _OF_DECLARE(iommu, name, compat, fn, of_iommu_init_fn)
  31. #endif /* __OF_IOMMU_H */