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