blob: 28e98dec445e8c2469f8a9367d870d4c2a615e7e [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);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070047#else
48static inline struct iommu_domain
Laura Abbott9f4a8e62011-08-29 19:08:07 -070049 *msm_get_iommu_domain(int subsys_id) { return NULL; }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070050
Laura Abbott9f4a8e62011-08-29 19:08:07 -070051
52
53static 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
58static 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
63static inline unsigned long msm_subsystem_get_domain_no(int subsys_id)
64{
65 return 0xFFFFFFFF;
66}
67
68static inline unsigned long msm_subsystem_get_partition_no(int subsys_id)
69{
70 return 0xFFFFFFFF;
71}
72
73static inline int msm_use_iommu(void)
74{
75 return 0;
76}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070077#endif
78
79#endif