exynos_drm_iommu.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* exynos_drm_iommu.h
  2. *
  3. * Copyright (c) 2012 Samsung Electronics Co., Ltd.
  4. * Authoer: Inki Dae <inki.dae@samsung.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License as published by the
  8. * Free Software Foundation; either version 2 of the License, or (at your
  9. * option) any later version.
  10. */
  11. #ifndef _EXYNOS_DRM_IOMMU_H_
  12. #define _EXYNOS_DRM_IOMMU_H_
  13. #define EXYNOS_DEV_ADDR_START 0x20000000
  14. #define EXYNOS_DEV_ADDR_SIZE 0x40000000
  15. #define EXYNOS_DEV_ADDR_ORDER 0x0
  16. #ifdef CONFIG_DRM_EXYNOS_IOMMU
  17. int drm_create_iommu_mapping(struct drm_device *drm_dev);
  18. void drm_release_iommu_mapping(struct drm_device *drm_dev);
  19. int drm_iommu_attach_device(struct drm_device *drm_dev,
  20. struct device *subdrv_dev);
  21. void drm_iommu_detach_device(struct drm_device *dev_dev,
  22. struct device *subdrv_dev);
  23. static inline bool is_drm_iommu_supported(struct drm_device *drm_dev)
  24. {
  25. #ifdef CONFIG_ARM_DMA_USE_IOMMU
  26. struct device *dev = drm_dev->dev;
  27. return dev->archdata.mapping ? true : false;
  28. #else
  29. return false;
  30. #endif
  31. }
  32. #else
  33. struct dma_iommu_mapping;
  34. static inline int drm_create_iommu_mapping(struct drm_device *drm_dev)
  35. {
  36. return 0;
  37. }
  38. static inline void drm_release_iommu_mapping(struct drm_device *drm_dev)
  39. {
  40. }
  41. static inline int drm_iommu_attach_device(struct drm_device *drm_dev,
  42. struct device *subdrv_dev)
  43. {
  44. return 0;
  45. }
  46. static inline void drm_iommu_detach_device(struct drm_device *drm_dev,
  47. struct device *subdrv_dev)
  48. {
  49. }
  50. static inline bool is_drm_iommu_supported(struct drm_device *drm_dev)
  51. {
  52. return false;
  53. }
  54. #endif
  55. #endif