blob: 033f14f4eb9207f71eeb0c9f025bacd5e814fd0c [file] [log] [blame]
Swathi Sridhar5924e982018-07-31 12:19:55 -07001/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
4 */
5
6#ifndef __MSM_TZ_SMMU_H__
7#define __MSM_TZ_SMMU_H__
8
9#include <linux/device.h>
10
11enum tz_smmu_device_id {
12 TZ_DEVICE_START = 0,
13 TZ_DEVICE_VIDEO = 0,
14 TZ_DEVICE_MDSS,
15 TZ_DEVICE_LPASS,
16 TZ_DEVICE_MDSS_BOOT,
17 TZ_DEVICE_USB1_HS,
18 TZ_DEVICE_OCMEM,
19 TZ_DEVICE_LPASS_CORE,
20 TZ_DEVICE_VPU,
21 TZ_DEVICE_COPSS_SMMU,
22 TZ_DEVICE_USB3_0,
23 TZ_DEVICE_USB3_1,
24 TZ_DEVICE_PCIE_0,
25 TZ_DEVICE_PCIE_1,
26 TZ_DEVICE_BCSS,
27 TZ_DEVICE_VCAP,
28 TZ_DEVICE_PCIE20,
29 TZ_DEVICE_IPA,
30 TZ_DEVICE_APPS,
31 TZ_DEVICE_GPU,
32 TZ_DEVICE_UFS,
33 TZ_DEVICE_ICE,
34 TZ_DEVICE_ROT,
35 TZ_DEVICE_VFE,
36 TZ_DEVICE_ANOC0,
37 TZ_DEVICE_ANOC1,
38 TZ_DEVICE_ANOC2,
39 TZ_DEVICE_CPP,
40 TZ_DEVICE_JPEG,
41 TZ_DEVICE_MAX,
42};
43
44#ifdef CONFIG_MSM_TZ_SMMU
45
46int msm_tz_smmu_atos_start(struct device *dev, int cb_num);
47int msm_tz_smmu_atos_end(struct device *dev, int cb_num);
48enum tz_smmu_device_id msm_dev_to_device_id(struct device *dev);
49int msm_tz_set_cb_format(enum tz_smmu_device_id sec_id, int cbndx);
50int msm_iommu_sec_pgtbl_init(void);
51int register_iommu_sec_ptbl(void);
52#else
53
54static inline int msm_tz_smmu_atos_start(struct device *dev, int cb_num)
55{
56 return 0;
57}
58
59static inline int msm_tz_smmu_atos_end(struct device *dev, int cb_num)
60{
61 return 0;
62}
63
64static inline enum tz_smmu_device_id msm_dev_to_device_id(struct device *dev)
65{
66 return -EINVAL;
67}
68
69static inline int msm_tz_set_cb_format(enum tz_smmu_device_id sec_id,
70 int cbndx)
71{
72 return -EINVAL;
73}
74
75static inline int msm_iommu_sec_pgtbl_init(void)
76{
77 return -EINVAL;
78}
79
80static inline int register_iommu_sec_ptbl(void)
81{
82 return -EINVAL;
83}
84
85static inline size_t msm_secure_smmu_unmap(struct iommu_domain *domain,
86 unsigned long iova,
87 size_t size)
88{
89 return -EINVAL;
90}
91
92static inline size_t msm_secure_smmu_map_sg(struct iommu_domain *domain,
93 unsigned long iova,
94 struct scatterlist *sg,
95 unsigned int nents, int prot)
96{
97 return -EINVAL;
98}
99
100static inline int msm_secure_smmu_map(struct iommu_domain *domain,
101 unsigned long iova,
102 phys_addr_t paddr, size_t size, int prot)
103{
104 return -EINVAL;
105}
106
107#endif /* CONFIG_MSM_TZ_SMMU */
108
109#endif /* __MSM_TZ_SMMU_H__ */