Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | */ |
| 12 | |
| 13 | #ifndef _ARCH_IOMMU_DOMAINS_H |
| 14 | #define _ARCH_IOMMU_DOMAINS_H |
| 15 | |
Laura Abbott | 9f4a8e6 | 2011-08-29 19:08:07 -0700 | [diff] [blame] | 16 | enum { |
| 17 | GLOBAL_DOMAIN, |
| 18 | MAX_DOMAINS |
| 19 | }; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 20 | |
Laura Abbott | 9f4a8e6 | 2011-08-29 19:08:07 -0700 | [diff] [blame] | 21 | enum { |
| 22 | VIDEO_FIRMWARE_POOL, |
| 23 | LOW_256MB_POOL, |
| 24 | HIGH_POOL, |
| 25 | }; |
| 26 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 27 | |
| 28 | #if defined(CONFIG_MSM_IOMMU) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 29 | |
Laura Abbott | 9f4a8e6 | 2011-08-29 19:08:07 -0700 | [diff] [blame] | 30 | extern struct iommu_domain *msm_get_iommu_domain(int domain_num); |
| 31 | |
| 32 | extern unsigned long msm_allocate_iova_address(unsigned int iommu_domain, |
| 33 | unsigned int partition_no, |
| 34 | unsigned long size, |
| 35 | unsigned long align); |
| 36 | |
| 37 | extern void msm_free_iova_address(unsigned long iova, |
| 38 | unsigned int iommu_domain, |
| 39 | unsigned int partition_no, |
| 40 | unsigned long size); |
| 41 | |
| 42 | extern unsigned long msm_subsystem_get_domain_no(int subsys_id); |
| 43 | |
| 44 | extern unsigned long msm_subsystem_get_partition_no(int subsys_id); |
| 45 | |
| 46 | extern int msm_use_iommu(void); |
Laura Abbott | e956cce | 2011-10-25 13:33:20 -0700 | [diff] [blame^] | 47 | |
| 48 | extern int msm_iommu_map_extra(struct iommu_domain *domain, |
| 49 | unsigned long start_iova, |
| 50 | unsigned long size, |
| 51 | int cached); |
| 52 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 53 | #else |
| 54 | static inline struct iommu_domain |
Laura Abbott | 9f4a8e6 | 2011-08-29 19:08:07 -0700 | [diff] [blame] | 55 | *msm_get_iommu_domain(int subsys_id) { return NULL; } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 56 | |
Laura Abbott | 9f4a8e6 | 2011-08-29 19:08:07 -0700 | [diff] [blame] | 57 | |
| 58 | |
| 59 | static inline unsigned long msm_allocate_iova_address(unsigned int iommu_domain, |
| 60 | unsigned int partition_no, |
| 61 | unsigned long size, |
| 62 | unsigned long align) { return 0; } |
| 63 | |
| 64 | static inline void msm_free_iova_address(unsigned long iova, |
| 65 | unsigned int iommu_domain, |
| 66 | unsigned int partition_no, |
| 67 | unsigned long size) { return; } |
| 68 | |
| 69 | static inline unsigned long msm_subsystem_get_domain_no(int subsys_id) |
| 70 | { |
| 71 | return 0xFFFFFFFF; |
| 72 | } |
| 73 | |
| 74 | static inline unsigned long msm_subsystem_get_partition_no(int subsys_id) |
| 75 | { |
| 76 | return 0xFFFFFFFF; |
| 77 | } |
| 78 | |
| 79 | static inline int msm_use_iommu(void) |
| 80 | { |
| 81 | return 0; |
| 82 | } |
Laura Abbott | e956cce | 2011-10-25 13:33:20 -0700 | [diff] [blame^] | 83 | |
| 84 | static inline int msm_iommu_map_extra(struct iommu_domain *domain, |
| 85 | unsigned long start_iova, |
| 86 | unsigned long size, |
| 87 | int cached) |
| 88 | { |
| 89 | return -ENODEV; |
| 90 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 91 | #endif |
| 92 | |
| 93 | #endif |