blob: 2d2d2fb477514a8cf4ab3c0838bcb84ce5f260db [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/* 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 Abbott9f4a8e62011-08-29 19:08:07 -070016enum {
17 GLOBAL_DOMAIN,
18 MAX_DOMAINS
19};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070020
Laura Abbott9f4a8e62011-08-29 19:08:07 -070021enum {
22 VIDEO_FIRMWARE_POOL,
Olav Hauganee365362012-02-16 09:31:37 -080023 VIDEO_MAIN_POOL,
24 VIDEO_MFC_POOL,
25 GEN_POOL,
Laura Abbott9f4a8e62011-08-29 19:08:07 -070026};
27
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070028
29#if defined(CONFIG_MSM_IOMMU)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070030
Laura Abbott9f4a8e62011-08-29 19:08:07 -070031extern struct iommu_domain *msm_get_iommu_domain(int domain_num);
32
33extern unsigned long msm_allocate_iova_address(unsigned int iommu_domain,
34 unsigned int partition_no,
35 unsigned long size,
36 unsigned long align);
37
38extern void msm_free_iova_address(unsigned long iova,
39 unsigned int iommu_domain,
40 unsigned int partition_no,
41 unsigned long size);
42
43extern unsigned long msm_subsystem_get_domain_no(int subsys_id);
44
45extern unsigned long msm_subsystem_get_partition_no(int subsys_id);
46
47extern int msm_use_iommu(void);
Laura Abbotte956cce2011-10-25 13:33:20 -070048
49extern int msm_iommu_map_extra(struct iommu_domain *domain,
50 unsigned long start_iova,
51 unsigned long size,
52 int cached);
53
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070054#else
55static inline struct iommu_domain
Laura Abbott9f4a8e62011-08-29 19:08:07 -070056 *msm_get_iommu_domain(int subsys_id) { return NULL; }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070057
Laura Abbott9f4a8e62011-08-29 19:08:07 -070058
59
60static 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
65static 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
70static inline unsigned long msm_subsystem_get_domain_no(int subsys_id)
71{
72 return 0xFFFFFFFF;
73}
74
75static inline unsigned long msm_subsystem_get_partition_no(int subsys_id)
76{
77 return 0xFFFFFFFF;
78}
79
80static inline int msm_use_iommu(void)
81{
82 return 0;
83}
Laura Abbotte956cce2011-10-25 13:33:20 -070084
85static 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 Huntsman3f2bc4d2011-08-16 17:27:22 -070092#endif
93
94#endif