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); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 47 | #else |
| 48 | static inline struct iommu_domain |
Laura Abbott | 9f4a8e6 | 2011-08-29 19:08:07 -0700 | [diff] [blame^] | 49 | *msm_get_iommu_domain(int subsys_id) { return NULL; } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 50 | |
Laura Abbott | 9f4a8e6 | 2011-08-29 19:08:07 -0700 | [diff] [blame^] | 51 | |
| 52 | |
| 53 | static inline unsigned long msm_allocate_iova_address(unsigned int iommu_domain, |
| 54 | unsigned int partition_no, |
| 55 | unsigned long size, |
| 56 | unsigned long align) { return 0; } |
| 57 | |
| 58 | static inline void msm_free_iova_address(unsigned long iova, |
| 59 | unsigned int iommu_domain, |
| 60 | unsigned int partition_no, |
| 61 | unsigned long size) { return; } |
| 62 | |
| 63 | static inline unsigned long msm_subsystem_get_domain_no(int subsys_id) |
| 64 | { |
| 65 | return 0xFFFFFFFF; |
| 66 | } |
| 67 | |
| 68 | static inline unsigned long msm_subsystem_get_partition_no(int subsys_id) |
| 69 | { |
| 70 | return 0xFFFFFFFF; |
| 71 | } |
| 72 | |
| 73 | static inline int msm_use_iommu(void) |
| 74 | { |
| 75 | return 0; |
| 76 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 77 | #endif |
| 78 | |
| 79 | #endif |