of_iommu.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 void of_iommu_init(void);
  11. extern struct iommu_ops *of_iommu_configure(struct device *dev,
  12. struct device_node *master_np);
  13. #else
  14. static inline int of_get_dma_window(struct device_node *dn, const char *prefix,
  15. int index, unsigned long *busno, dma_addr_t *addr,
  16. size_t *size)
  17. {
  18. return -EINVAL;
  19. }
  20. static inline void of_iommu_init(void) { }
  21. static inline struct iommu_ops *of_iommu_configure(struct device *dev,
  22. struct device_node *master_np)
  23. {
  24. return NULL;
  25. }
  26. #endif /* CONFIG_OF_IOMMU */
  27. void of_iommu_set_ops(struct device_node *np, struct iommu_ops *ops);
  28. struct iommu_ops *of_iommu_get_ops(struct device_node *np);
  29. extern struct of_device_id __iommu_of_table;
  30. typedef int (*of_iommu_init_fn)(struct device_node *);
  31. #define IOMMU_OF_DECLARE(name, compat, fn) \
  32. _OF_DECLARE(iommu, name, compat, fn, of_iommu_init_fn)
  33. #endif /* __OF_IOMMU_H */