Inki Dae | 0519f9a | 2012-10-20 07:53:42 -0700 | [diff] [blame] | 1 | /* exynos_drm_iommu.h |
| 2 | * |
| 3 | * Copyright (c) 2012 Samsung Electronics Co., Ltd. |
| 4 | * Authoer: Inki Dae <inki.dae@samsung.com> |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 7 | * copy of this software and associated documentation files (the "Software"), |
| 8 | * to deal in the Software without restriction, including without limitation |
| 9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 10 | * and/or sell copies of the Software, and to permit persons to whom the |
| 11 | * Software is furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice (including the next |
| 14 | * paragraph) shall be included in all copies or substantial portions of the |
| 15 | * Software. |
| 16 | * |
| 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 20 | * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
| 21 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 22 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 23 | * OTHER DEALINGS IN THE SOFTWARE. |
| 24 | */ |
| 25 | |
| 26 | #ifndef _EXYNOS_DRM_IOMMU_H_ |
| 27 | #define _EXYNOS_DRM_IOMMU_H_ |
| 28 | |
| 29 | #define EXYNOS_DEV_ADDR_START 0x20000000 |
| 30 | #define EXYNOS_DEV_ADDR_SIZE 0x40000000 |
| 31 | #define EXYNOS_DEV_ADDR_ORDER 0x4 |
| 32 | |
| 33 | #ifdef CONFIG_DRM_EXYNOS_IOMMU |
| 34 | |
| 35 | int drm_create_iommu_mapping(struct drm_device *drm_dev); |
| 36 | |
| 37 | void drm_release_iommu_mapping(struct drm_device *drm_dev); |
| 38 | |
| 39 | int drm_iommu_attach_device(struct drm_device *drm_dev, |
| 40 | struct device *subdrv_dev); |
| 41 | |
| 42 | void drm_iommu_detach_device(struct drm_device *dev_dev, |
| 43 | struct device *subdrv_dev); |
| 44 | |
| 45 | static inline bool is_drm_iommu_supported(struct drm_device *drm_dev) |
| 46 | { |
| 47 | #ifdef CONFIG_ARM_DMA_USE_IOMMU |
| 48 | struct device *dev = drm_dev->dev; |
| 49 | |
| 50 | return dev->archdata.mapping ? true : false; |
| 51 | #else |
| 52 | return false; |
| 53 | #endif |
| 54 | } |
| 55 | |
| 56 | #else |
| 57 | |
| 58 | struct dma_iommu_mapping; |
| 59 | static inline int drm_create_iommu_mapping(struct drm_device *drm_dev) |
| 60 | { |
| 61 | return 0; |
| 62 | } |
| 63 | |
| 64 | static inline void drm_release_iommu_mapping(struct drm_device *drm_dev) |
| 65 | { |
| 66 | } |
| 67 | |
| 68 | static inline int drm_iommu_attach_device(struct drm_device *drm_dev, |
| 69 | struct device *subdrv_dev) |
| 70 | { |
| 71 | return 0; |
| 72 | } |
| 73 | |
| 74 | static inline void drm_iommu_detach_device(struct drm_device *drm_dev, |
| 75 | struct device *subdrv_dev) |
| 76 | { |
| 77 | } |
| 78 | |
| 79 | static inline bool is_drm_iommu_supported(struct drm_device *drm_dev) |
| 80 | { |
| 81 | return false; |
| 82 | } |
| 83 | |
| 84 | #endif |
| 85 | #endif |