exynos_drm_iommu.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. #ifdef CONFIG_DRM_EXYNOS_IOMMU
  16. int drm_create_iommu_mapping(struct drm_device *drm_dev);
  17. void drm_release_iommu_mapping(struct drm_device *drm_dev);
  18. int drm_iommu_attach_device(struct drm_device *drm_dev,
  19. struct device *subdrv_dev);
  20. void drm_iommu_detach_device(struct drm_device *dev_dev,
  21. struct device *subdrv_dev);
  22. static inline bool is_drm_iommu_supported(struct drm_device *drm_dev)
  23. {
  24. #ifdef CONFIG_ARM_DMA_USE_IOMMU
  25. struct device *dev = drm_dev->dev;
  26. return dev->archdata.mapping ? true : false;
  27. #else
  28. return false;
  29. #endif
  30. }
  31. #else
  32. static inline int drm_create_iommu_mapping(struct drm_device *drm_dev)
  33. {
  34. return 0;
  35. }
  36. static inline void drm_release_iommu_mapping(struct drm_device *drm_dev)
  37. {
  38. }
  39. static inline int drm_iommu_attach_device(struct drm_device *drm_dev,
  40. struct device *subdrv_dev)
  41. {
  42. return 0;
  43. }
  44. static inline void drm_iommu_detach_device(struct drm_device *drm_dev,
  45. struct device *subdrv_dev)
  46. {
  47. }
  48. static inline bool is_drm_iommu_supported(struct drm_device *drm_dev)
  49. {
  50. return false;
  51. }
  52. #endif
  53. #endif