blob: 48eae0c056372d211ce03468c9a630a8a5e936a9 [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,
23 LOW_256MB_POOL,
24 HIGH_POOL,
25};
26
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070027
28#if defined(CONFIG_MSM_IOMMU)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070029
Laura Abbott9f4a8e62011-08-29 19:08:07 -070030extern struct iommu_domain *msm_get_iommu_domain(int domain_num);
31
32extern unsigned long msm_allocate_iova_address(unsigned int iommu_domain,
33 unsigned int partition_no,
34 unsigned long size,
35 unsigned long align);
36
37extern void msm_free_iova_address(unsigned long iova,
38 unsigned int iommu_domain,
39 unsigned int partition_no,
40 unsigned long size);
41
42extern unsigned long msm_subsystem_get_domain_no(int subsys_id);
43
44extern unsigned long msm_subsystem_get_partition_no(int subsys_id);
45
46extern int msm_use_iommu(void);
Laura Abbotte956cce2011-10-25 13:33:20 -070047
48extern int msm_iommu_map_extra(struct iommu_domain *domain,
49 unsigned long start_iova,
50 unsigned long size,
51 int cached);
52
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070053#else
54static inline struct iommu_domain
Laura Abbott9f4a8e62011-08-29 19:08:07 -070055 *msm_get_iommu_domain(int subsys_id) { return NULL; }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070056
Laura Abbott9f4a8e62011-08-29 19:08:07 -070057
58
59static 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
64static 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
69static inline unsigned long msm_subsystem_get_domain_no(int subsys_id)
70{
71 return 0xFFFFFFFF;
72}
73
74static inline unsigned long msm_subsystem_get_partition_no(int subsys_id)
75{
76 return 0xFFFFFFFF;
77}
78
79static inline int msm_use_iommu(void)
80{
81 return 0;
82}
Laura Abbotte956cce2011-10-25 13:33:20 -070083
84static 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 Huntsman3f2bc4d2011-08-16 17:27:22 -070091#endif
92
93#endif