blob: 74e11155fe47bbddd2dc5bb033c543f810017f50 [file] [log] [blame]
Olav Hauganab77b1b2012-02-28 09:19:22 -08001/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
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 {
Olav Hauganab77b1b2012-02-28 09:19:22 -080017 VIDEO_DOMAIN,
Olav Haugan2d191032012-02-28 09:46:31 -080018 CAMERA_DOMAIN,
19 DISPLAY_DOMAIN,
20 ROTATOR_DOMAIN,
Laura Abbott9f4a8e62011-08-29 19:08:07 -070021 MAX_DOMAINS
22};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070023
Laura Abbott9f4a8e62011-08-29 19:08:07 -070024enum {
25 VIDEO_FIRMWARE_POOL,
Olav Hauganee365362012-02-16 09:31:37 -080026 VIDEO_MAIN_POOL,
Olav Hauganee365362012-02-16 09:31:37 -080027 GEN_POOL,
Laura Abbott9f4a8e62011-08-29 19:08:07 -070028};
29
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070030
31#if defined(CONFIG_MSM_IOMMU)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070032
Laura Abbott9f4a8e62011-08-29 19:08:07 -070033extern struct iommu_domain *msm_get_iommu_domain(int domain_num);
34
35extern unsigned long msm_allocate_iova_address(unsigned int iommu_domain,
36 unsigned int partition_no,
37 unsigned long size,
38 unsigned long align);
39
40extern void msm_free_iova_address(unsigned long iova,
41 unsigned int iommu_domain,
42 unsigned int partition_no,
43 unsigned long size);
44
Laura Abbott9f4a8e62011-08-29 19:08:07 -070045extern int msm_use_iommu(void);
Laura Abbotte956cce2011-10-25 13:33:20 -070046
47extern int msm_iommu_map_extra(struct iommu_domain *domain,
48 unsigned long start_iova,
49 unsigned long size,
50 int cached);
51
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070052#else
53static inline struct iommu_domain
Laura Abbott9f4a8e62011-08-29 19:08:07 -070054 *msm_get_iommu_domain(int subsys_id) { return NULL; }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070055
Laura Abbott9f4a8e62011-08-29 19:08:07 -070056
57
58static inline unsigned long msm_allocate_iova_address(unsigned int iommu_domain,
59 unsigned int partition_no,
60 unsigned long size,
61 unsigned long align) { return 0; }
62
63static inline void msm_free_iova_address(unsigned long iova,
64 unsigned int iommu_domain,
65 unsigned int partition_no,
66 unsigned long size) { return; }
67
Laura Abbott9f4a8e62011-08-29 19:08:07 -070068static inline int msm_use_iommu(void)
69{
70 return 0;
71}
Laura Abbotte956cce2011-10-25 13:33:20 -070072
73static inline int msm_iommu_map_extra(struct iommu_domain *domain,
74 unsigned long start_iova,
75 unsigned long size,
76 int cached)
77{
78 return -ENODEV;
79}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070080#endif
81
82#endif