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, |
Olav Haugan | ee36536 | 2012-02-16 09:31:37 -0800 | [diff] [blame^] | 23 | VIDEO_MAIN_POOL, |
| 24 | VIDEO_MFC_POOL, |
| 25 | GEN_POOL, |
Laura Abbott | 9f4a8e6 | 2011-08-29 19:08:07 -0700 | [diff] [blame] | 26 | }; |
| 27 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 28 | |
| 29 | #if defined(CONFIG_MSM_IOMMU) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 30 | |
Laura Abbott | 9f4a8e6 | 2011-08-29 19:08:07 -0700 | [diff] [blame] | 31 | extern struct iommu_domain *msm_get_iommu_domain(int domain_num); |
| 32 | |
| 33 | extern unsigned long msm_allocate_iova_address(unsigned int iommu_domain, |
| 34 | unsigned int partition_no, |
| 35 | unsigned long size, |
| 36 | unsigned long align); |
| 37 | |
| 38 | extern void msm_free_iova_address(unsigned long iova, |
| 39 | unsigned int iommu_domain, |
| 40 | unsigned int partition_no, |
| 41 | unsigned long size); |
| 42 | |
| 43 | extern unsigned long msm_subsystem_get_domain_no(int subsys_id); |
| 44 | |
| 45 | extern unsigned long msm_subsystem_get_partition_no(int subsys_id); |
| 46 | |
| 47 | extern int msm_use_iommu(void); |
Laura Abbott | e956cce | 2011-10-25 13:33:20 -0700 | [diff] [blame] | 48 | |
| 49 | extern int msm_iommu_map_extra(struct iommu_domain *domain, |
| 50 | unsigned long start_iova, |
| 51 | unsigned long size, |
| 52 | int cached); |
| 53 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 54 | #else |
| 55 | static inline struct iommu_domain |
Laura Abbott | 9f4a8e6 | 2011-08-29 19:08:07 -0700 | [diff] [blame] | 56 | *msm_get_iommu_domain(int subsys_id) { return NULL; } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 57 | |
Laura Abbott | 9f4a8e6 | 2011-08-29 19:08:07 -0700 | [diff] [blame] | 58 | |
| 59 | |
| 60 | static inline unsigned long msm_allocate_iova_address(unsigned int iommu_domain, |
| 61 | unsigned int partition_no, |
| 62 | unsigned long size, |
| 63 | unsigned long align) { return 0; } |
| 64 | |
| 65 | static inline void msm_free_iova_address(unsigned long iova, |
| 66 | unsigned int iommu_domain, |
| 67 | unsigned int partition_no, |
| 68 | unsigned long size) { return; } |
| 69 | |
| 70 | static inline unsigned long msm_subsystem_get_domain_no(int subsys_id) |
| 71 | { |
| 72 | return 0xFFFFFFFF; |
| 73 | } |
| 74 | |
| 75 | static inline unsigned long msm_subsystem_get_partition_no(int subsys_id) |
| 76 | { |
| 77 | return 0xFFFFFFFF; |
| 78 | } |
| 79 | |
| 80 | static inline int msm_use_iommu(void) |
| 81 | { |
| 82 | return 0; |
| 83 | } |
Laura Abbott | e956cce | 2011-10-25 13:33:20 -0700 | [diff] [blame] | 84 | |
| 85 | static inline int msm_iommu_map_extra(struct iommu_domain *domain, |
| 86 | unsigned long start_iova, |
| 87 | unsigned long size, |
| 88 | int cached) |
| 89 | { |
| 90 | return -ENODEV; |
| 91 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 92 | #endif |
| 93 | |
| 94 | #endif |