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