blob: ead4c22b8bd6efb1fd64ae217df6e08ab45c58b8 [file] [log] [blame]
Pritesh Raithathac88654f2017-01-02 20:11:32 +05301/*
Antonio Nino Diaz14ba9632018-03-08 10:57:43 +00002 * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
Pritesh Raithathac88654f2017-01-02 20:11:32 +05303 *
Antonio Nino Diaz14ba9632018-03-08 10:57:43 +00004 * SPDX-License-Identifier: BSD-3-Clause
Pritesh Raithathac88654f2017-01-02 20:11:32 +05305 */
6
7#include <bl_common.h>
8#include <smmu.h>
9#include <tegra_def.h>
10
11/*******************************************************************************
12 * Array to hold SMMU context for Tegra186
13 ******************************************************************************/
14static __attribute__((aligned(16))) smmu_regs_t tegra186_smmu_context[] = {
15 _START_OF_TABLE_,
16 mc_make_sid_security_cfg(SCEW),
17 mc_make_sid_security_cfg(AFIR),
18 mc_make_sid_security_cfg(NVDISPLAYR1),
19 mc_make_sid_security_cfg(XUSB_DEVR),
20 mc_make_sid_security_cfg(VICSRD1),
21 mc_make_sid_security_cfg(NVENCSWR),
22 mc_make_sid_security_cfg(TSECSRDB),
23 mc_make_sid_security_cfg(AXISW),
24 mc_make_sid_security_cfg(SDMMCWAB),
25 mc_make_sid_security_cfg(AONDMAW),
26 mc_make_sid_security_cfg(GPUSWR2),
27 mc_make_sid_security_cfg(SATAW),
28 mc_make_sid_security_cfg(UFSHCW),
29 mc_make_sid_security_cfg(AFIW),
30 mc_make_sid_security_cfg(SDMMCR),
31 mc_make_sid_security_cfg(SCEDMAW),
32 mc_make_sid_security_cfg(UFSHCR),
33 mc_make_sid_security_cfg(SDMMCWAA),
34 mc_make_sid_security_cfg(APEDMAW),
35 mc_make_sid_security_cfg(SESWR),
36 mc_make_sid_security_cfg(MPCORER),
37 mc_make_sid_security_cfg(PTCR),
38 mc_make_sid_security_cfg(BPMPW),
39 mc_make_sid_security_cfg(ETRW),
40 mc_make_sid_security_cfg(GPUSRD),
41 mc_make_sid_security_cfg(VICSWR),
42 mc_make_sid_security_cfg(SCEDMAR),
43 mc_make_sid_security_cfg(HDAW),
44 mc_make_sid_security_cfg(ISPWA),
45 mc_make_sid_security_cfg(EQOSW),
46 mc_make_sid_security_cfg(XUSB_HOSTW),
47 mc_make_sid_security_cfg(TSECSWR),
48 mc_make_sid_security_cfg(SDMMCRAA),
49 mc_make_sid_security_cfg(APER),
50 mc_make_sid_security_cfg(VIW),
51 mc_make_sid_security_cfg(APEW),
52 mc_make_sid_security_cfg(AXISR),
53 mc_make_sid_security_cfg(SDMMCW),
54 mc_make_sid_security_cfg(BPMPDMAW),
55 mc_make_sid_security_cfg(ISPRA),
56 mc_make_sid_security_cfg(NVDECSWR),
57 mc_make_sid_security_cfg(XUSB_DEVW),
58 mc_make_sid_security_cfg(NVDECSRD),
59 mc_make_sid_security_cfg(MPCOREW),
60 mc_make_sid_security_cfg(NVDISPLAYR),
61 mc_make_sid_security_cfg(BPMPDMAR),
62 mc_make_sid_security_cfg(NVJPGSWR),
63 mc_make_sid_security_cfg(NVDECSRD1),
64 mc_make_sid_security_cfg(TSECSRD),
65 mc_make_sid_security_cfg(NVJPGSRD),
66 mc_make_sid_security_cfg(SDMMCWA),
67 mc_make_sid_security_cfg(SCER),
68 mc_make_sid_security_cfg(XUSB_HOSTR),
69 mc_make_sid_security_cfg(VICSRD),
70 mc_make_sid_security_cfg(AONDMAR),
71 mc_make_sid_security_cfg(AONW),
72 mc_make_sid_security_cfg(SDMMCRA),
73 mc_make_sid_security_cfg(HOST1XDMAR),
74 mc_make_sid_security_cfg(EQOSR),
75 mc_make_sid_security_cfg(SATAR),
76 mc_make_sid_security_cfg(BPMPR),
77 mc_make_sid_security_cfg(HDAR),
78 mc_make_sid_security_cfg(SDMMCRAB),
79 mc_make_sid_security_cfg(ETRR),
80 mc_make_sid_security_cfg(AONR),
81 mc_make_sid_security_cfg(APEDMAR),
82 mc_make_sid_security_cfg(SESRD),
83 mc_make_sid_security_cfg(NVENCSRD),
84 mc_make_sid_security_cfg(GPUSWR),
85 mc_make_sid_security_cfg(TSECSWRB),
86 mc_make_sid_security_cfg(ISPWB),
87 mc_make_sid_security_cfg(GPUSRD2),
88 mc_make_sid_override_cfg(APER),
89 mc_make_sid_override_cfg(VICSRD),
90 mc_make_sid_override_cfg(NVENCSRD),
91 mc_make_sid_override_cfg(NVJPGSWR),
92 mc_make_sid_override_cfg(AONW),
93 mc_make_sid_override_cfg(BPMPR),
94 mc_make_sid_override_cfg(BPMPW),
95 mc_make_sid_override_cfg(HDAW),
96 mc_make_sid_override_cfg(NVDISPLAYR1),
97 mc_make_sid_override_cfg(APEDMAR),
98 mc_make_sid_override_cfg(AFIR),
99 mc_make_sid_override_cfg(AXISR),
100 mc_make_sid_override_cfg(VICSRD1),
101 mc_make_sid_override_cfg(TSECSRD),
102 mc_make_sid_override_cfg(BPMPDMAW),
103 mc_make_sid_override_cfg(MPCOREW),
104 mc_make_sid_override_cfg(XUSB_HOSTR),
105 mc_make_sid_override_cfg(GPUSWR),
106 mc_make_sid_override_cfg(XUSB_DEVR),
107 mc_make_sid_override_cfg(UFSHCW),
108 mc_make_sid_override_cfg(XUSB_HOSTW),
109 mc_make_sid_override_cfg(SDMMCWAB),
110 mc_make_sid_override_cfg(SATAW),
111 mc_make_sid_override_cfg(SCEDMAR),
112 mc_make_sid_override_cfg(HOST1XDMAR),
113 mc_make_sid_override_cfg(SDMMCWA),
114 mc_make_sid_override_cfg(APEDMAW),
115 mc_make_sid_override_cfg(SESWR),
116 mc_make_sid_override_cfg(AXISW),
117 mc_make_sid_override_cfg(AONDMAW),
118 mc_make_sid_override_cfg(TSECSWRB),
119 mc_make_sid_override_cfg(MPCORER),
120 mc_make_sid_override_cfg(ISPWB),
121 mc_make_sid_override_cfg(AONR),
122 mc_make_sid_override_cfg(BPMPDMAR),
123 mc_make_sid_override_cfg(HDAR),
124 mc_make_sid_override_cfg(SDMMCRA),
125 mc_make_sid_override_cfg(ETRW),
126 mc_make_sid_override_cfg(GPUSWR2),
127 mc_make_sid_override_cfg(EQOSR),
128 mc_make_sid_override_cfg(TSECSWR),
129 mc_make_sid_override_cfg(ETRR),
130 mc_make_sid_override_cfg(NVDECSRD),
131 mc_make_sid_override_cfg(TSECSRDB),
132 mc_make_sid_override_cfg(SDMMCRAA),
133 mc_make_sid_override_cfg(NVDECSRD1),
134 mc_make_sid_override_cfg(SDMMCR),
135 mc_make_sid_override_cfg(NVJPGSRD),
136 mc_make_sid_override_cfg(SCEDMAW),
137 mc_make_sid_override_cfg(SDMMCWAA),
138 mc_make_sid_override_cfg(APEW),
139 mc_make_sid_override_cfg(AONDMAR),
140 mc_make_sid_override_cfg(PTCR),
141 mc_make_sid_override_cfg(SCER),
142 mc_make_sid_override_cfg(ISPRA),
143 mc_make_sid_override_cfg(ISPWA),
144 mc_make_sid_override_cfg(VICSWR),
145 mc_make_sid_override_cfg(SESRD),
146 mc_make_sid_override_cfg(SDMMCW),
147 mc_make_sid_override_cfg(SDMMCRAB),
148 mc_make_sid_override_cfg(EQOSW),
149 mc_make_sid_override_cfg(GPUSRD2),
150 mc_make_sid_override_cfg(SCEW),
151 mc_make_sid_override_cfg(GPUSRD),
152 mc_make_sid_override_cfg(NVDECSWR),
153 mc_make_sid_override_cfg(XUSB_DEVW),
154 mc_make_sid_override_cfg(SATAR),
155 mc_make_sid_override_cfg(NVDISPLAYR),
156 mc_make_sid_override_cfg(VIW),
157 mc_make_sid_override_cfg(UFSHCR),
158 mc_make_sid_override_cfg(NVENCSWR),
159 mc_make_sid_override_cfg(AFIW),
160 smmu_make_gnsr0_nsec_cfg(CR0),
161 smmu_make_gnsr0_sec_cfg(IDR0),
162 smmu_make_gnsr0_sec_cfg(IDR1),
163 smmu_make_gnsr0_sec_cfg(IDR2),
164 smmu_make_gnsr0_nsec_cfg(GFSR),
165 smmu_make_gnsr0_nsec_cfg(GFSYNR0),
166 smmu_make_gnsr0_nsec_cfg(GFSYNR1),
167 smmu_make_gnsr0_nsec_cfg(TLBGSTATUS),
168 smmu_make_gnsr0_nsec_cfg(PIDR2),
169 smmu_make_smrg_group(0),
170 smmu_make_smrg_group(1),
171 smmu_make_smrg_group(2),
172 smmu_make_smrg_group(3),
173 smmu_make_smrg_group(4),
174 smmu_make_smrg_group(5),
175 smmu_make_smrg_group(6),
176 smmu_make_smrg_group(7),
177 smmu_make_smrg_group(8),
178 smmu_make_smrg_group(9),
179 smmu_make_smrg_group(10),
180 smmu_make_smrg_group(11),
181 smmu_make_smrg_group(12),
182 smmu_make_smrg_group(13),
183 smmu_make_smrg_group(14),
184 smmu_make_smrg_group(15),
185 smmu_make_smrg_group(16),
186 smmu_make_smrg_group(17),
187 smmu_make_smrg_group(18),
188 smmu_make_smrg_group(19),
189 smmu_make_smrg_group(20),
190 smmu_make_smrg_group(21),
191 smmu_make_smrg_group(22),
192 smmu_make_smrg_group(23),
193 smmu_make_smrg_group(24),
194 smmu_make_smrg_group(25),
195 smmu_make_smrg_group(26),
196 smmu_make_smrg_group(27),
197 smmu_make_smrg_group(28),
198 smmu_make_smrg_group(29),
199 smmu_make_smrg_group(30),
200 smmu_make_smrg_group(31),
201 smmu_make_smrg_group(32),
202 smmu_make_smrg_group(33),
203 smmu_make_smrg_group(34),
204 smmu_make_smrg_group(35),
205 smmu_make_smrg_group(36),
206 smmu_make_smrg_group(37),
207 smmu_make_smrg_group(38),
208 smmu_make_smrg_group(39),
209 smmu_make_smrg_group(40),
210 smmu_make_smrg_group(41),
211 smmu_make_smrg_group(42),
212 smmu_make_smrg_group(43),
213 smmu_make_smrg_group(44),
214 smmu_make_smrg_group(45),
215 smmu_make_smrg_group(46),
216 smmu_make_smrg_group(47),
217 smmu_make_smrg_group(48),
218 smmu_make_smrg_group(49),
219 smmu_make_smrg_group(50),
220 smmu_make_smrg_group(51),
221 smmu_make_smrg_group(52),
222 smmu_make_smrg_group(53),
223 smmu_make_smrg_group(54),
224 smmu_make_smrg_group(55),
225 smmu_make_smrg_group(56),
226 smmu_make_smrg_group(57),
227 smmu_make_smrg_group(58),
228 smmu_make_smrg_group(59),
229 smmu_make_smrg_group(60),
230 smmu_make_smrg_group(61),
231 smmu_make_smrg_group(62),
232 smmu_make_smrg_group(63),
233 smmu_make_cb_group(0),
234 smmu_make_cb_group(1),
235 smmu_make_cb_group(2),
236 smmu_make_cb_group(3),
237 smmu_make_cb_group(4),
238 smmu_make_cb_group(5),
239 smmu_make_cb_group(6),
240 smmu_make_cb_group(7),
241 smmu_make_cb_group(8),
242 smmu_make_cb_group(9),
243 smmu_make_cb_group(10),
244 smmu_make_cb_group(11),
245 smmu_make_cb_group(12),
246 smmu_make_cb_group(13),
247 smmu_make_cb_group(14),
248 smmu_make_cb_group(15),
249 smmu_make_cb_group(16),
250 smmu_make_cb_group(17),
251 smmu_make_cb_group(18),
252 smmu_make_cb_group(19),
253 smmu_make_cb_group(20),
254 smmu_make_cb_group(21),
255 smmu_make_cb_group(22),
256 smmu_make_cb_group(23),
257 smmu_make_cb_group(24),
258 smmu_make_cb_group(25),
259 smmu_make_cb_group(26),
260 smmu_make_cb_group(27),
261 smmu_make_cb_group(28),
262 smmu_make_cb_group(29),
263 smmu_make_cb_group(30),
264 smmu_make_cb_group(31),
265 smmu_make_cb_group(32),
266 smmu_make_cb_group(33),
267 smmu_make_cb_group(34),
268 smmu_make_cb_group(35),
269 smmu_make_cb_group(36),
270 smmu_make_cb_group(37),
271 smmu_make_cb_group(38),
272 smmu_make_cb_group(39),
273 smmu_make_cb_group(40),
274 smmu_make_cb_group(41),
275 smmu_make_cb_group(42),
276 smmu_make_cb_group(43),
277 smmu_make_cb_group(44),
278 smmu_make_cb_group(45),
279 smmu_make_cb_group(46),
280 smmu_make_cb_group(47),
281 smmu_make_cb_group(48),
282 smmu_make_cb_group(49),
283 smmu_make_cb_group(50),
284 smmu_make_cb_group(51),
285 smmu_make_cb_group(52),
286 smmu_make_cb_group(53),
287 smmu_make_cb_group(54),
288 smmu_make_cb_group(55),
289 smmu_make_cb_group(56),
290 smmu_make_cb_group(57),
291 smmu_make_cb_group(58),
292 smmu_make_cb_group(59),
293 smmu_make_cb_group(60),
294 smmu_make_cb_group(61),
295 smmu_make_cb_group(62),
296 smmu_make_cb_group(63),
297 smmu_bypass_cfg, /* TBU settings */
298 _END_OF_TABLE_,
299};
300
301/*******************************************************************************
302 * Handler to return the pointer to the SMMU's context struct
303 ******************************************************************************/
304smmu_regs_t *plat_get_smmu_ctx(void)
305{
306 /* index of _END_OF_TABLE_ */
307 tegra186_smmu_context[0].val = ARRAY_SIZE(tegra186_smmu_context) - 1;
308
309 return tegra186_smmu_context;
310}