1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved
4  *
5  * The driver handles Error's from Control Backbone(CBB) generated due to
6  * illegal accesses. When an error is reported from a NOC within CBB,
7  * the driver checks ErrVld status of all three Error Logger's of that NOC.
8  * It then prints debug information about failed transaction using ErrLog
9  * registers of error logger which has ErrVld set. Currently, SLV, DEC,
10  * TMO, SEC, UNS are the codes which are supported by CBB.
11  */
12 
13 #include <linux/clk.h>
14 #include <linux/cpufeature.h>
15 #include <linux/debugfs.h>
16 #include <linux/module.h>
17 #include <linux/of.h>
18 #include <linux/of_address.h>
19 #include <linux/platform_device.h>
20 #include <linux/device.h>
21 #include <linux/io.h>
22 #include <linux/interrupt.h>
23 #include <linux/ioport.h>
24 #include <soc/tegra/fuse.h>
25 #include <soc/tegra/tegra-cbb.h>
26 
27 #define ERRLOGGER_0_ID_COREID_0     0x00000000
28 #define ERRLOGGER_0_ID_REVISIONID_0 0x00000004
29 #define ERRLOGGER_0_FAULTEN_0       0x00000008
30 #define ERRLOGGER_0_ERRVLD_0        0x0000000c
31 #define ERRLOGGER_0_ERRCLR_0        0x00000010
32 #define ERRLOGGER_0_ERRLOG0_0       0x00000014
33 #define ERRLOGGER_0_ERRLOG1_0       0x00000018
34 #define ERRLOGGER_0_RSVD_00_0       0x0000001c
35 #define ERRLOGGER_0_ERRLOG3_0       0x00000020
36 #define ERRLOGGER_0_ERRLOG4_0       0x00000024
37 #define ERRLOGGER_0_ERRLOG5_0       0x00000028
38 #define ERRLOGGER_0_STALLEN_0       0x00000038
39 
40 #define ERRLOGGER_1_ID_COREID_0     0x00000080
41 #define ERRLOGGER_1_ID_REVISIONID_0 0x00000084
42 #define ERRLOGGER_1_FAULTEN_0       0x00000088
43 #define ERRLOGGER_1_ERRVLD_0        0x0000008c
44 #define ERRLOGGER_1_ERRCLR_0        0x00000090
45 #define ERRLOGGER_1_ERRLOG0_0       0x00000094
46 #define ERRLOGGER_1_ERRLOG1_0       0x00000098
47 #define ERRLOGGER_1_RSVD_00_0       0x0000009c
48 #define ERRLOGGER_1_ERRLOG3_0       0x000000a0
49 #define ERRLOGGER_1_ERRLOG4_0       0x000000a4
50 #define ERRLOGGER_1_ERRLOG5_0       0x000000a8
51 #define ERRLOGGER_1_STALLEN_0       0x000000b8
52 
53 #define ERRLOGGER_2_ID_COREID_0     0x00000100
54 #define ERRLOGGER_2_ID_REVISIONID_0 0x00000104
55 #define ERRLOGGER_2_FAULTEN_0       0x00000108
56 #define ERRLOGGER_2_ERRVLD_0        0x0000010c
57 #define ERRLOGGER_2_ERRCLR_0        0x00000110
58 #define ERRLOGGER_2_ERRLOG0_0       0x00000114
59 #define ERRLOGGER_2_ERRLOG1_0       0x00000118
60 #define ERRLOGGER_2_RSVD_00_0       0x0000011c
61 #define ERRLOGGER_2_ERRLOG3_0       0x00000120
62 #define ERRLOGGER_2_ERRLOG4_0       0x00000124
63 #define ERRLOGGER_2_ERRLOG5_0       0x00000128
64 #define ERRLOGGER_2_STALLEN_0       0x00000138
65 
66 #define CBB_NOC_INITFLOW GENMASK(23, 20)
67 #define CBB_NOC_TARGFLOW GENMASK(19, 16)
68 #define CBB_NOC_TARG_SUBRANGE GENMASK(15, 9)
69 #define CBB_NOC_SEQID GENMASK(8, 0)
70 
71 #define BPMP_NOC_INITFLOW GENMASK(20, 18)
72 #define BPMP_NOC_TARGFLOW GENMASK(17, 13)
73 #define BPMP_NOC_TARG_SUBRANGE GENMASK(12, 9)
74 #define BPMP_NOC_SEQID GENMASK(8, 0)
75 
76 #define AON_NOC_INITFLOW GENMASK(22, 21)
77 #define AON_NOC_TARGFLOW GENMASK(20, 15)
78 #define AON_NOC_TARG_SUBRANGE GENMASK(14, 9)
79 #define AON_NOC_SEQID GENMASK(8, 0)
80 
81 #define SCE_NOC_INITFLOW GENMASK(21, 19)
82 #define SCE_NOC_TARGFLOW GENMASK(18, 14)
83 #define SCE_NOC_TARG_SUBRANGE GENMASK(13, 9)
84 #define SCE_NOC_SEQID GENMASK(8, 0)
85 
86 #define CBB_NOC_AXCACHE GENMASK(3, 0)
87 #define CBB_NOC_NON_MOD GENMASK(4, 4)
88 #define CBB_NOC_AXPROT GENMASK(7, 5)
89 #define CBB_NOC_FALCONSEC GENMASK(9, 8)
90 #define CBB_NOC_GRPSEC GENMASK(16, 10)
91 #define CBB_NOC_VQC GENMASK(18, 17)
92 #define CBB_NOC_MSTR_ID GENMASK(22, 19)
93 #define CBB_NOC_AXI_ID GENMASK(30, 23)
94 
95 #define CLUSTER_NOC_AXCACHE GENMASK(3, 0)
96 #define CLUSTER_NOC_AXPROT GENMASK(6, 4)
97 #define CLUSTER_NOC_FALCONSEC GENMASK(8, 7)
98 #define CLUSTER_NOC_GRPSEC GENMASK(15, 9)
99 #define CLUSTER_NOC_VQC GENMASK(17, 16)
100 #define CLUSTER_NOC_MSTR_ID GENMASK(21, 18)
101 
102 #define CBB_ERR_OPC GENMASK(4, 1)
103 #define CBB_ERR_ERRCODE GENMASK(10, 8)
104 #define CBB_ERR_LEN1 GENMASK(27, 16)
105 
106 #define DMAAPB_X_RAW_INTERRUPT_STATUS 0x2ec
107 
108 struct tegra194_cbb_packet_header {
109 	bool lock;   // [0]
110 	u8 opc;      // [4:1]
111 	u8 errcode;  // [10:8]= RD, RDW, RDL, RDX, WR, WRW, WRC, PRE, URG
112 	u16 len1;    // [27:16]
113 	bool format; // [31]  = 1 -> FlexNoC versions 2.7 & above
114 };
115 
116 struct tegra194_cbb_aperture {
117 	u8 initflow;
118 	u8 targflow;
119 	u8 targ_subrange;
120 	u8 init_mapping;
121 	u32 init_localaddress;
122 	u8 targ_mapping;
123 	u32 targ_localaddress;
124 	u16 seqid;
125 };
126 
127 struct tegra194_cbb_userbits {
128 	u8 axcache;
129 	u8 non_mod;
130 	u8 axprot;
131 	u8 falconsec;
132 	u8 grpsec;
133 	u8 vqc;
134 	u8 mstr_id;
135 	u8 axi_id;
136 };
137 
138 struct tegra194_cbb_noc_data {
139 	const char *name;
140 	bool erd_mask_inband_err;
141 	const char * const *master_id;
142 	unsigned int max_aperture;
143 	const struct tegra194_cbb_aperture *noc_aperture;
144 	const char * const *routeid_initflow;
145 	const char * const *routeid_targflow;
146 	void (*parse_routeid)(struct tegra194_cbb_aperture *info, u64 routeid);
147 	void (*parse_userbits)(struct tegra194_cbb_userbits *usrbits, u32 elog_5);
148 };
149 
150 struct tegra194_axi2apb_bridge {
151 	struct resource res;
152 	void __iomem *base;
153 };
154 
155 struct tegra194_cbb {
156 	struct tegra_cbb base;
157 
158 	const struct tegra194_cbb_noc_data *noc;
159 	struct resource *res;
160 
161 	void __iomem *regs;
162 	unsigned int num_intr;
163 	unsigned int sec_irq;
164 	unsigned int nonsec_irq;
165 	u32 errlog0;
166 	u32 errlog1;
167 	u32 errlog2;
168 	u32 errlog3;
169 	u32 errlog4;
170 	u32 errlog5;
171 
172 	struct tegra194_axi2apb_bridge *bridges;
173 	unsigned int num_bridges;
174 };
175 
to_tegra194_cbb(struct tegra_cbb * cbb)176 static inline struct tegra194_cbb *to_tegra194_cbb(struct tegra_cbb *cbb)
177 {
178 	return container_of(cbb, struct tegra194_cbb, base);
179 }
180 
181 static LIST_HEAD(cbb_list);
182 static DEFINE_SPINLOCK(cbb_lock);
183 
184 static const char * const tegra194_cbb_trantype[] = {
185 	"RD  - Read, Incrementing",
186 	"RDW - Read, Wrap",			/* Not Supported */
187 	"RDX - Exclusive Read",			/* Not Supported */
188 	"RDL - Linked Read",			/* Not Supported */
189 	"WR  - Write, Incrementing",
190 	"WRW - Write, Wrap",			/* Not Supported */
191 	"WRC - Exclusive Write",		/* Not Supported */
192 	"PRE - Preamble Sequence for Fixed Accesses"
193 };
194 
195 static const char * const tegra194_axi2apb_error[] = {
196 	"SFIFONE - Status FIFO Not Empty interrupt",
197 	"SFIFOF - Status FIFO Full interrupt",
198 	"TIM - Timer(Timeout) interrupt",
199 	"SLV - SLVERR interrupt",
200 	"NULL",
201 	"ERBF - Early response buffer Full interrupt",
202 	"NULL",
203 	"RDFIFOF - Read Response FIFO Full interrupt",
204 	"WRFIFOF - Write Response FIFO Full interrupt",
205 	"CH0DFIFOF - Ch0 Data FIFO Full interrupt",
206 	"CH1DFIFOF - Ch1 Data FIFO Full interrupt",
207 	"CH2DFIFOF - Ch2 Data FIFO Full interrupt",
208 	"UAT - Unsupported alignment type error",
209 	"UBS - Unsupported burst size error",
210 	"UBE - Unsupported Byte Enable error",
211 	"UBT - Unsupported burst type error",
212 	"BFS - Block Firewall security error",
213 	"ARFS - Address Range Firewall security error",
214 	"CH0RFIFOF - Ch0 Request FIFO Full interrupt",
215 	"CH1RFIFOF - Ch1 Request FIFO Full interrupt",
216 	"CH2RFIFOF - Ch2 Request FIFO Full interrupt"
217 };
218 
219 static const char * const tegra194_master_id[] = {
220 	[0x0] = "CCPLEX",
221 	[0x1] = "CCPLEX_DPMU",
222 	[0x2] = "BPMP",
223 	[0x3] = "AON",
224 	[0x4] = "SCE",
225 	[0x5] = "GPCDMA_PERIPHERAL",
226 	[0x6] = "TSECA",
227 	[0x7] = "TSECB",
228 	[0x8] = "JTAGM_DFT",
229 	[0x9] = "CORESIGHT_AXIAP",
230 	[0xa] = "APE",
231 	[0xb] = "PEATR",
232 	[0xc] = "NVDEC",
233 	[0xd] = "RCE",
234 	[0xe] = "NVDEC1"
235 };
236 
237 static const struct tegra_cbb_error tegra194_cbb_errors[] = {
238 	{
239 		.code = "SLV",
240 		.source = "Target",
241 		.desc = "Target error detected by CBB slave"
242 	}, {
243 		.code = "DEC",
244 		.source = "Initiator NIU",
245 		.desc = "Address decode error"
246 	}, {
247 		.code = "UNS",
248 		.source = "Target NIU",
249 		.desc = "Unsupported request. Not a valid transaction"
250 	}, {
251 		.code = "DISC", /* Not Supported by CBB */
252 		.source = "Power Disconnect",
253 		.desc = "Disconnected target or domain"
254 	}, {
255 		.code = "SEC",
256 		.source = "Initiator NIU or Firewall",
257 		.desc = "Security violation. Firewall error"
258 	}, {
259 		.code = "HIDE", /* Not Supported by CBB */
260 		.source = "Firewall",
261 		.desc = "Hidden security violation, reported as OK to initiator"
262 	}, {
263 		.code = "TMO",
264 		.source = "Target NIU",
265 		.desc = "Target time-out error"
266 	}, {
267 		.code = "RSV",
268 		.source = "None",
269 		.desc = "Reserved"
270 	}
271 };
272 
273 /*
274  * CBB NOC aperture lookup table as per file "cbb_central_noc_Structure.info".
275  */
276 static const char * const tegra194_cbbcentralnoc_routeid_initflow[] = {
277 	[0x0] = "aon_p2ps/I/aon",
278 	[0x1] = "ape_p2ps/I/ape_p2ps",
279 	[0x2] = "bpmp_p2ps/I/bpmp_p2ps",
280 	[0x3] = "ccroc_p2ps/I/ccroc_p2ps",
281 	[0x4] = "csite_p2ps/I/0",
282 	[0x5] = "gpcdma_mmio_p2ps/I/0",
283 	[0x6] = "jtag_p2ps/I/0",
284 	[0x7] = "nvdec1_p2ps/I/0",
285 	[0x8] = "nvdec_p2ps/I/0",
286 	[0x9] = "rce_p2ps/I/rce_p2ps",
287 	[0xa] = "sce_p2ps/I/sce_p2ps",
288 	[0xb] = "tseca_p2ps/I/0",
289 	[0xc] = "tsecb_p2ps/I/0",
290 	[0xd] = "RESERVED",
291 	[0xe] = "RESERVED",
292 	[0xf] = "RESERVED"
293 };
294 
295 static const char * const tegra194_cbbcentralnoc_routeid_targflow[] = {
296 	[0x0] = "SVC/T/intreg",
297 	[0x1] = "axis_satellite_axi2apb_p2pm/T/axis_satellite_axi2apb_p2pm",
298 	[0x2] = "axis_satellite_grout/T/axis_satellite_grout",
299 	[0x3] = "cbb_firewall/T/cbb_firewall",
300 	[0x4] = "gpu_p2pm/T/gpu_p2pm",
301 	[0x5] = "host1x_p2pm/T/host1x_p2pm",
302 	[0x6] = "sapb_3_p2pm/T/sapb_3_p2pm",
303 	[0x7] = "smmu0_p2pm/T/smmu0_p2pm",
304 	[0x8] = "smmu1_p2pm/T/smmu1_p2pm",
305 	[0x9] = "smmu2_p2pm/T/smmu2_p2pm",
306 	[0xa] = "stm_p2pm/T/stm_p2pm",
307 	[0xb] = "RESERVED",
308 	[0xc] = "RESERVED",
309 	[0xd] = "RESERVED",
310 	[0xe] = "RESERVED",
311 	[0xf] = "RESERVED"
312 };
313 
314 /*
315  * Fields of CBB NOC lookup table:
316  * Init flow, Targ flow, Targ subrange, Init mapping, Init localAddress,
317  *                                              Targ mapping, Targ localAddress
318  * ----------------------------------------------------------------------------
319  */
320 static const struct tegra194_cbb_aperture tegra194_cbbcentralnoc_apert_lookup[] = {
321 	{ 0x0, 0x0, 0x00, 0x0, 0x02300000,  0, 0x00000000 },
322 	{ 0x0, 0x1, 0x00, 0x0, 0x02003000,  0, 0x02003000 },
323 	{ 0x0, 0x1, 0x01, 0x0, 0x02006000,  2, 0x02006000 },
324 	{ 0x0, 0x1, 0x02, 0x0, 0x02016000,  3, 0x02016000 },
325 	{ 0x0, 0x1, 0x03, 0x0, 0x0201d000,  4, 0x0201d000 },
326 	{ 0x0, 0x1, 0x04, 0x0, 0x0202b000,  6, 0x0202b000 },
327 	{ 0x0, 0x1, 0x05, 0x0, 0x02434000, 20, 0x02434000 },
328 	{ 0x0, 0x1, 0x06, 0x0, 0x02436000, 21, 0x02436000 },
329 	{ 0x0, 0x1, 0x07, 0x0, 0x02438000, 22, 0x02438000 },
330 	{ 0x0, 0x1, 0x08, 0x0, 0x02445000, 24, 0x02445000 },
331 	{ 0x0, 0x1, 0x09, 0x0, 0x02446000, 25, 0x02446000 },
332 	{ 0x0, 0x1, 0x0a, 0x0, 0x02004000,  1, 0x02004000 },
333 	{ 0x0, 0x1, 0x0b, 0x0, 0x0201e000,  5, 0x0201e000 },
334 	{ 0x0, 0x1, 0x0c, 0x0, 0x0202c000,  7, 0x0202c000 },
335 	{ 0x0, 0x1, 0x0d, 0x0, 0x02204000,  8, 0x02204000 },
336 	{ 0x0, 0x1, 0x0e, 0x0, 0x02214000,  9, 0x02214000 },
337 	{ 0x0, 0x1, 0x0f, 0x0, 0x02224000, 10, 0x02224000 },
338 	{ 0x0, 0x1, 0x10, 0x0, 0x02234000, 11, 0x02234000 },
339 	{ 0x0, 0x1, 0x11, 0x0, 0x02244000, 12, 0x02244000 },
340 	{ 0x0, 0x1, 0x12, 0x0, 0x02254000, 13, 0x02254000 },
341 	{ 0x0, 0x1, 0x13, 0x0, 0x02264000, 14, 0x02264000 },
342 	{ 0x0, 0x1, 0x14, 0x0, 0x02274000, 15, 0x02274000 },
343 	{ 0x0, 0x1, 0x15, 0x0, 0x02284000, 16, 0x02284000 },
344 	{ 0x0, 0x1, 0x16, 0x0, 0x0243a000, 23, 0x0243a000 },
345 	{ 0x0, 0x1, 0x17, 0x0, 0x02370000, 17, 0x02370000 },
346 	{ 0x0, 0x1, 0x18, 0x0, 0x023d0000, 18, 0x023d0000 },
347 	{ 0x0, 0x1, 0x19, 0x0, 0x023e0000, 19, 0x023e0000 },
348 	{ 0x0, 0x1, 0x1a, 0x0, 0x02450000, 26, 0x02450000 },
349 	{ 0x0, 0x1, 0x1b, 0x0, 0x02460000, 27, 0x02460000 },
350 	{ 0x0, 0x1, 0x1c, 0x0, 0x02490000, 28, 0x02490000 },
351 	{ 0x0, 0x1, 0x1d, 0x0, 0x03130000, 31, 0x03130000 },
352 	{ 0x0, 0x1, 0x1e, 0x0, 0x03160000, 32, 0x03160000 },
353 	{ 0x0, 0x1, 0x1f, 0x0, 0x03270000, 33, 0x03270000 },
354 	{ 0x0, 0x1, 0x20, 0x0, 0x032e0000, 35, 0x032e0000 },
355 	{ 0x0, 0x1, 0x21, 0x0, 0x03300000, 36, 0x03300000 },
356 	{ 0x0, 0x1, 0x22, 0x0, 0x13090000, 40, 0x13090000 },
357 	{ 0x0, 0x1, 0x23, 0x0, 0x20120000, 43, 0x20120000 },
358 	{ 0x0, 0x1, 0x24, 0x0, 0x20170000, 44, 0x20170000 },
359 	{ 0x0, 0x1, 0x25, 0x0, 0x20190000, 45, 0x20190000 },
360 	{ 0x0, 0x1, 0x26, 0x0, 0x201b0000, 46, 0x201b0000 },
361 	{ 0x0, 0x1, 0x27, 0x0, 0x20250000, 47, 0x20250000 },
362 	{ 0x0, 0x1, 0x28, 0x0, 0x20260000, 48, 0x20260000 },
363 	{ 0x0, 0x1, 0x29, 0x0, 0x20420000, 49, 0x20420000 },
364 	{ 0x0, 0x1, 0x2a, 0x0, 0x20460000, 50, 0x20460000 },
365 	{ 0x0, 0x1, 0x2b, 0x0, 0x204f0000, 51, 0x204f0000 },
366 	{ 0x0, 0x1, 0x2c, 0x0, 0x20520000, 52, 0x20520000 },
367 	{ 0x0, 0x1, 0x2d, 0x0, 0x20580000, 53, 0x20580000 },
368 	{ 0x0, 0x1, 0x2e, 0x0, 0x205a0000, 54, 0x205a0000 },
369 	{ 0x0, 0x1, 0x2f, 0x0, 0x205c0000, 55, 0x205c0000 },
370 	{ 0x0, 0x1, 0x30, 0x0, 0x20690000, 56, 0x20690000 },
371 	{ 0x0, 0x1, 0x31, 0x0, 0x20770000, 57, 0x20770000 },
372 	{ 0x0, 0x1, 0x32, 0x0, 0x20790000, 58, 0x20790000 },
373 	{ 0x0, 0x1, 0x33, 0x0, 0x20880000, 59, 0x20880000 },
374 	{ 0x0, 0x1, 0x34, 0x0, 0x20990000, 62, 0x20990000 },
375 	{ 0x0, 0x1, 0x35, 0x0, 0x20e10000, 65, 0x20e10000 },
376 	{ 0x0, 0x1, 0x36, 0x0, 0x20e70000, 66, 0x20e70000 },
377 	{ 0x0, 0x1, 0x37, 0x0, 0x20e80000, 67, 0x20e80000 },
378 	{ 0x0, 0x1, 0x38, 0x0, 0x20f30000, 68, 0x20f30000 },
379 	{ 0x0, 0x1, 0x39, 0x0, 0x20f50000, 69, 0x20f50000 },
380 	{ 0x0, 0x1, 0x3a, 0x0, 0x20fc0000, 70, 0x20fc0000 },
381 	{ 0x0, 0x1, 0x3b, 0x0, 0x21110000, 72, 0x21110000 },
382 	{ 0x0, 0x1, 0x3c, 0x0, 0x21270000, 73, 0x21270000 },
383 	{ 0x0, 0x1, 0x3d, 0x0, 0x21290000, 74, 0x21290000 },
384 	{ 0x0, 0x1, 0x3e, 0x0, 0x21840000, 75, 0x21840000 },
385 	{ 0x0, 0x1, 0x3f, 0x0, 0x21880000, 76, 0x21880000 },
386 	{ 0x0, 0x1, 0x40, 0x0, 0x218d0000, 77, 0x218d0000 },
387 	{ 0x0, 0x1, 0x41, 0x0, 0x21950000, 78, 0x21950000 },
388 	{ 0x0, 0x1, 0x42, 0x0, 0x21960000, 79, 0x21960000 },
389 	{ 0x0, 0x1, 0x43, 0x0, 0x21a10000, 80, 0x21a10000 },
390 	{ 0x0, 0x1, 0x44, 0x0, 0x024a0000, 29, 0x024a0000 },
391 	{ 0x0, 0x1, 0x45, 0x0, 0x024c0000, 30, 0x024c0000 },
392 	{ 0x0, 0x1, 0x46, 0x0, 0x032c0000, 34, 0x032c0000 },
393 	{ 0x0, 0x1, 0x47, 0x0, 0x03400000, 37, 0x03400000 },
394 	{ 0x0, 0x1, 0x48, 0x0, 0x130a0000, 41, 0x130a0000 },
395 	{ 0x0, 0x1, 0x49, 0x0, 0x130c0000, 42, 0x130c0000 },
396 	{ 0x0, 0x1, 0x4a, 0x0, 0x208a0000, 60, 0x208a0000 },
397 	{ 0x0, 0x1, 0x4b, 0x0, 0x208c0000, 61, 0x208c0000 },
398 	{ 0x0, 0x1, 0x4c, 0x0, 0x209a0000, 63, 0x209a0000 },
399 	{ 0x0, 0x1, 0x4d, 0x0, 0x21a40000, 81, 0x21a40000 },
400 	{ 0x0, 0x1, 0x4e, 0x0, 0x03440000, 38, 0x03440000 },
401 	{ 0x0, 0x1, 0x4f, 0x0, 0x20d00000, 64, 0x20d00000 },
402 	{ 0x0, 0x1, 0x50, 0x0, 0x21000000, 71, 0x21000000 },
403 	{ 0x0, 0x1, 0x51, 0x0, 0x0b000000, 39, 0x0b000000 },
404 	{ 0x0, 0x2, 0x00, 0x0, 0x00000000,  0, 0x00000000 },
405 	{ 0x0, 0x3, 0x00, 0x0, 0x02340000,  0, 0x00000000 },
406 	{ 0x0, 0x4, 0x00, 0x0, 0x17000000,  0, 0x17000000 },
407 	{ 0x0, 0x4, 0x01, 0x0, 0x18000000,  1, 0x18000000 },
408 	{ 0x0, 0x5, 0x00, 0x0, 0x13e80000,  1, 0x13e80000 },
409 	{ 0x0, 0x5, 0x01, 0x0, 0x15810000, 12, 0x15810000 },
410 	{ 0x0, 0x5, 0x02, 0x0, 0x15840000, 14, 0x15840000 },
411 	{ 0x0, 0x5, 0x03, 0x0, 0x15a40000, 17, 0x15a40000 },
412 	{ 0x0, 0x5, 0x04, 0x0, 0x13f00000,  3, 0x13f00000 },
413 	{ 0x0, 0x5, 0x05, 0x0, 0x15820000, 13, 0x15820000 },
414 	{ 0x0, 0x5, 0x06, 0x0, 0x13ec0000,  2, 0x13ec0000 },
415 	{ 0x0, 0x5, 0x07, 0x0, 0x15200000,  6, 0x15200000 },
416 	{ 0x0, 0x5, 0x08, 0x0, 0x15340000,  7, 0x15340000 },
417 	{ 0x0, 0x5, 0x09, 0x0, 0x15380000,  8, 0x15380000 },
418 	{ 0x0, 0x5, 0x0a, 0x0, 0x15500000, 10, 0x15500000 },
419 	{ 0x0, 0x5, 0x0b, 0x0, 0x155c0000, 11, 0x155c0000 },
420 	{ 0x0, 0x5, 0x0c, 0x0, 0x15a00000, 16, 0x15a00000 },
421 	{ 0x0, 0x5, 0x0d, 0x0, 0x13e00000,  0, 0x13e00000 },
422 	{ 0x0, 0x5, 0x0e, 0x0, 0x15100000,  5, 0x15100000 },
423 	{ 0x0, 0x5, 0x0f, 0x0, 0x15480000,  9, 0x15480000 },
424 	{ 0x0, 0x5, 0x10, 0x0, 0x15880000, 15, 0x15880000 },
425 	{ 0x0, 0x5, 0x11, 0x0, 0x15a80000, 18, 0x15a80000 },
426 	{ 0x0, 0x5, 0x12, 0x0, 0x15b00000, 19, 0x15b00000 },
427 	{ 0x0, 0x5, 0x13, 0x0, 0x14800000,  4, 0x14800000 },
428 	{ 0x0, 0x5, 0x14, 0x0, 0x15c00000, 20, 0x15c00000 },
429 	{ 0x0, 0x5, 0x15, 0x0, 0x16000000, 21, 0x16000000 },
430 	{ 0x0, 0x6, 0x00, 0x0, 0x02000000,  4, 0x02000000 },
431 	{ 0x0, 0x6, 0x01, 0x0, 0x02007000,  5, 0x02007000 },
432 	{ 0x0, 0x6, 0x02, 0x0, 0x02008000,  6, 0x02008000 },
433 	{ 0x0, 0x6, 0x03, 0x0, 0x02013000,  7, 0x02013000 },
434 	{ 0x0, 0x6, 0x04, 0x0, 0x0201c000,  8, 0x0201c000 },
435 	{ 0x0, 0x6, 0x05, 0x0, 0x02020000,  9, 0x02020000 },
436 	{ 0x0, 0x6, 0x06, 0x0, 0x0202a000, 10, 0x0202a000 },
437 	{ 0x0, 0x6, 0x07, 0x0, 0x0202e000, 11, 0x0202e000 },
438 	{ 0x0, 0x6, 0x08, 0x0, 0x06400000, 33, 0x06400000 },
439 	{ 0x0, 0x6, 0x09, 0x0, 0x02038000, 12, 0x02038000 },
440 	{ 0x0, 0x6, 0x0a, 0x0, 0x00100000,  0, 0x00100000 },
441 	{ 0x0, 0x6, 0x0b, 0x0, 0x023b0000, 13, 0x023b0000 },
442 	{ 0x0, 0x6, 0x0c, 0x0, 0x02800000, 16, 0x02800000 },
443 	{ 0x0, 0x6, 0x0d, 0x0, 0x030e0000, 22, 0x030e0000 },
444 	{ 0x0, 0x6, 0x0e, 0x0, 0x03800000, 23, 0x03800000 },
445 	{ 0x0, 0x6, 0x0f, 0x0, 0x03980000, 25, 0x03980000 },
446 	{ 0x0, 0x6, 0x10, 0x0, 0x03a60000, 26, 0x03a60000 },
447 	{ 0x0, 0x6, 0x11, 0x0, 0x03d80000, 31, 0x03d80000 },
448 	{ 0x0, 0x6, 0x12, 0x0, 0x20000000, 36, 0x20000000 },
449 	{ 0x0, 0x6, 0x13, 0x0, 0x20050000, 38, 0x20050000 },
450 	{ 0x0, 0x6, 0x14, 0x0, 0x201e0000, 40, 0x201e0000 },
451 	{ 0x0, 0x6, 0x15, 0x0, 0x20280000, 42, 0x20280000 },
452 	{ 0x0, 0x6, 0x16, 0x0, 0x202c0000, 43, 0x202c0000 },
453 	{ 0x0, 0x6, 0x17, 0x0, 0x20390000, 44, 0x20390000 },
454 	{ 0x0, 0x6, 0x18, 0x0, 0x20430000, 45, 0x20430000 },
455 	{ 0x0, 0x6, 0x19, 0x0, 0x20440000, 46, 0x20440000 },
456 	{ 0x0, 0x6, 0x1a, 0x0, 0x204e0000, 47, 0x204e0000 },
457 	{ 0x0, 0x6, 0x1b, 0x0, 0x20550000, 48, 0x20550000 },
458 	{ 0x0, 0x6, 0x1c, 0x0, 0x20570000, 49, 0x20570000 },
459 	{ 0x0, 0x6, 0x1d, 0x0, 0x20590000, 50, 0x20590000 },
460 	{ 0x0, 0x6, 0x1e, 0x0, 0x20730000, 52, 0x20730000 },
461 	{ 0x0, 0x6, 0x1f, 0x0, 0x209f0000, 54, 0x209f0000 },
462 	{ 0x0, 0x6, 0x20, 0x0, 0x20e20000, 55, 0x20e20000 },
463 	{ 0x0, 0x6, 0x21, 0x0, 0x20ed0000, 56, 0x20ed0000 },
464 	{ 0x0, 0x6, 0x22, 0x0, 0x20fd0000, 57, 0x20fd0000 },
465 	{ 0x0, 0x6, 0x23, 0x0, 0x21120000, 59, 0x21120000 },
466 	{ 0x0, 0x6, 0x24, 0x0, 0x211a0000, 60, 0x211a0000 },
467 	{ 0x0, 0x6, 0x25, 0x0, 0x21850000, 61, 0x21850000 },
468 	{ 0x0, 0x6, 0x26, 0x0, 0x21860000, 62, 0x21860000 },
469 	{ 0x0, 0x6, 0x27, 0x0, 0x21890000, 63, 0x21890000 },
470 	{ 0x0, 0x6, 0x28, 0x0, 0x21970000, 64, 0x21970000 },
471 	{ 0x0, 0x6, 0x29, 0x0, 0x21990000, 65, 0x21990000 },
472 	{ 0x0, 0x6, 0x2a, 0x0, 0x21a00000, 66, 0x21a00000 },
473 	{ 0x0, 0x6, 0x2b, 0x0, 0x21a90000, 68, 0x21a90000 },
474 	{ 0x0, 0x6, 0x2c, 0x0, 0x21ac0000, 70, 0x21ac0000 },
475 	{ 0x0, 0x6, 0x2d, 0x0, 0x01f80000,  3, 0x01f80000 },
476 	{ 0x0, 0x6, 0x2e, 0x0, 0x024e0000, 14, 0x024e0000 },
477 	{ 0x0, 0x6, 0x2f, 0x0, 0x030c0000, 21, 0x030c0000 },
478 	{ 0x0, 0x6, 0x30, 0x0, 0x03820000, 24, 0x03820000 },
479 	{ 0x0, 0x6, 0x31, 0x0, 0x03aa0000, 27, 0x03aa0000 },
480 	{ 0x0, 0x6, 0x32, 0x0, 0x03c80000, 29, 0x03c80000 },
481 	{ 0x0, 0x6, 0x33, 0x0, 0x130e0000, 34, 0x130e0000 },
482 	{ 0x0, 0x6, 0x34, 0x0, 0x20020000, 37, 0x20020000 },
483 	{ 0x0, 0x6, 0x35, 0x0, 0x20060000, 39, 0x20060000 },
484 	{ 0x0, 0x6, 0x36, 0x0, 0x20200000, 41, 0x20200000 },
485 	{ 0x0, 0x6, 0x37, 0x0, 0x206a0000, 51, 0x206a0000 },
486 	{ 0x0, 0x6, 0x38, 0x0, 0x20740000, 53, 0x20740000 },
487 	{ 0x0, 0x6, 0x39, 0x0, 0x20fe0000, 58, 0x20fe0000 },
488 	{ 0x0, 0x6, 0x3a, 0x0, 0x21a20000, 67, 0x21a20000 },
489 	{ 0x0, 0x6, 0x3b, 0x0, 0x21aa0000, 69, 0x21aa0000 },
490 	{ 0x0, 0x6, 0x3c, 0x0, 0x02b80000, 17, 0x02b80000 },
491 	{ 0x0, 0x6, 0x3d, 0x0, 0x03080000, 20, 0x03080000 },
492 	{ 0x0, 0x6, 0x3e, 0x0, 0x13100000, 35, 0x13100000 },
493 	{ 0x0, 0x6, 0x3f, 0x0, 0x01f00000,  2, 0x01f00000 },
494 	{ 0x0, 0x6, 0x40, 0x0, 0x03000000, 19, 0x03000000 },
495 	{ 0x0, 0x6, 0x41, 0x0, 0x03c00000, 28, 0x03c00000 },
496 	{ 0x0, 0x6, 0x42, 0x0, 0x03d00000, 30, 0x03d00000 },
497 	{ 0x0, 0x6, 0x43, 0x0, 0x01700000,  1, 0x01700000 },
498 	{ 0x0, 0x6, 0x44, 0x0, 0x02c00000, 18, 0x02c00000 },
499 	{ 0x0, 0x6, 0x45, 0x0, 0x02600000, 15, 0x02600000 },
500 	{ 0x0, 0x6, 0x46, 0x0, 0x06000000, 32, 0x06000000 },
501 	{ 0x0, 0x6, 0x47, 0x0, 0x24000000, 71, 0x24000000 },
502 	{ 0x0, 0x7, 0x00, 0x0, 0x12000000,  0, 0x12000000 },
503 	{ 0x0, 0x8, 0x00, 0x0, 0x11000000,  0, 0x11000000 },
504 	{ 0x0, 0x9, 0x00, 0x0, 0x10000000,  0, 0x10000000 },
505 	{ 0x0, 0xa, 0x00, 0x0, 0x22000000,  0, 0x22000000 }
506 };
507 
508 /*
509  * BPMP NOC aperture lookup table as per file "BPMP_NOC_Structure.info".
510  */
511 static const char * const tegra194_bpmpnoc_routeid_initflow[] = {
512 	[0x0] = "cbb_i/I/0",
513 	[0x1] = "cpu_m_i/I/0",
514 	[0x2] = "cpu_p_i/I/0",
515 	[0x3] = "cvc_i/I/0",
516 	[0x4] = "dma_m_i/I/0",
517 	[0x5] = "dma_p_i/I/0",
518 	[0x6] = "RESERVED",
519 	[0x7] = "RESERVED"
520 };
521 
522 static const char * const tegra194_bpmpnoc_routeid_targflow[] = {
523 	[0x00] = "multiport0_t/T/actmon",
524 	[0x01] = "multiport0_t/T/ast_0",
525 	[0x02] = "multiport0_t/T/ast_1",
526 	[0x03] = "multiport0_t/T/atcm_cfg",
527 	[0x04] = "multiport0_t/T/car",
528 	[0x05] = "multiport0_t/T/central_pwr_mgr",
529 	[0x06] = "multiport0_t/T/central_vtg_ctlr",
530 	[0x07] = "multiport0_t/T/cfg",
531 	[0x08] = "multiport0_t/T/dma",
532 	[0x09] = "multiport0_t/T/err_collator",
533 	[0x0a] = "multiport0_t/T/err_collator_car",
534 	[0x0b] = "multiport0_t/T/fpga_misc",
535 	[0x0c] = "multiport0_t/T/fpga_uart",
536 	[0x0d] = "multiport0_t/T/gte",
537 	[0x0e] = "multiport0_t/T/hsp",
538 	[0x0f] = "multiport0_t/T/misc",
539 	[0x10] = "multiport0_t/T/pm",
540 	[0x11] = "multiport0_t/T/simon0",
541 	[0x12] = "multiport0_t/T/simon1",
542 	[0x13] = "multiport0_t/T/simon2",
543 	[0x14] = "multiport0_t/T/simon3",
544 	[0x15] = "multiport0_t/T/simon4",
545 	[0x16] = "multiport0_t/T/soc_therm",
546 	[0x17] = "multiport0_t/T/tke",
547 	[0x18] = "multiport0_t/T/vic_0",
548 	[0x19] = "multiport0_t/T/vic_1",
549 	[0x1a] = "ast0_t/T/0",
550 	[0x1b] = "ast1_t/T/0",
551 	[0x1c] = "bpmp_noc_firewall/T/0",
552 	[0x1d] = "cbb_t/T/0",
553 	[0x1e] = "cpu_t/T/0",
554 	[0x1f] = "svc_t/T/0"
555 };
556 
557 /*
558  * Fields of BPMP NOC lookup table:
559  * Init flow, Targ flow, Targ subrange, Init mapping, Init localAddress,
560  *                                              Targ mapping, Targ localAddress
561  * ----------------------------------------------------------------------------
562  */
563 static const struct tegra194_cbb_aperture tegra194_bpmpnoc_apert_lookup[] = {
564 	{ 0x0, 0x1c, 0x0, 0x0, 0x0d640000, 0,  0x00000000 },
565 	{ 0x0, 0x1e, 0x0, 0x0, 0x0d400000, 0,  0x0d400000 },
566 	{ 0x0, 0x00, 0x0, 0x0, 0x0d230000, 0,  0x00000000 },
567 	{ 0x0, 0x01, 0x0, 0x0, 0x0d040000, 0,  0x00000000 },
568 	{ 0x0, 0x02, 0x0, 0x0, 0x0d050000, 0,  0x00000000 },
569 	{ 0x0, 0x03, 0x0, 0x0, 0x0d000000, 0,  0x00000000 },
570 	{ 0x0, 0x04, 0x0, 0x0, 0x20ae0000, 3,  0x000e0000 },
571 	{ 0x0, 0x04, 0x1, 0x0, 0x20ac0000, 2,  0x000c0000 },
572 	{ 0x0, 0x04, 0x2, 0x0, 0x20a80000, 1,  0x00080000 },
573 	{ 0x0, 0x04, 0x3, 0x0, 0x20a00000, 0,  0x00000000 },
574 	{ 0x0, 0x05, 0x0, 0x0, 0x0d2a0000, 0,  0x00000000 },
575 	{ 0x0, 0x06, 0x0, 0x0, 0x0d290000, 0,  0x00000000 },
576 	{ 0x0, 0x07, 0x0, 0x0, 0x0d2c0000, 0,  0x00000000 },
577 	{ 0x0, 0x08, 0x0, 0x0, 0x0d0e0000, 4,  0x00080000 },
578 	{ 0x0, 0x08, 0x1, 0x0, 0x0d060000, 0,  0x00000000 },
579 	{ 0x0, 0x08, 0x2, 0x0, 0x0d080000, 1,  0x00020000 },
580 	{ 0x0, 0x08, 0x3, 0x0, 0x0d0a0000, 2,  0x00040000 },
581 	{ 0x0, 0x08, 0x4, 0x0, 0x0d0c0000, 3,  0x00060000 },
582 	{ 0x0, 0x09, 0x0, 0x0, 0x0d650000, 0,  0x00000000 },
583 	{ 0x0, 0x0a, 0x0, 0x0, 0x20af0000, 0,  0x00000000 },
584 	{ 0x0, 0x0b, 0x0, 0x0, 0x0d3e0000, 0,  0x00000000 },
585 	{ 0x0, 0x0c, 0x0, 0x0, 0x0d3d0000, 0,  0x00000000 },
586 	{ 0x0, 0x0d, 0x0, 0x0, 0x0d1e0000, 0,  0x00000000 },
587 	{ 0x0, 0x0e, 0x0, 0x0, 0x0d150000, 0,  0x00000000 },
588 	{ 0x0, 0x0e, 0x1, 0x0, 0x0d160000, 1,  0x00010000 },
589 	{ 0x0, 0x0e, 0x2, 0x0, 0x0d170000, 2,  0x00020000 },
590 	{ 0x0, 0x0e, 0x3, 0x0, 0x0d180000, 3,  0x00030000 },
591 	{ 0x0, 0x0e, 0x4, 0x0, 0x0d190000, 4,  0x00040000 },
592 	{ 0x0, 0x0e, 0x5, 0x0, 0x0d1a0000, 5,  0x00050000 },
593 	{ 0x0, 0x0e, 0x6, 0x0, 0x0d1b0000, 6,  0x00060000 },
594 	{ 0x0, 0x0e, 0x7, 0x0, 0x0d1c0000, 7,  0x00070000 },
595 	{ 0x0, 0x0e, 0x8, 0x0, 0x0d1d0000, 8,  0x00080000 },
596 	{ 0x0, 0x0f, 0x0, 0x0, 0x0d660000, 0,  0x00000000 },
597 	{ 0x0, 0x10, 0x0, 0x0, 0x0d1f0000, 0,  0x00000000 },
598 	{ 0x0, 0x10, 0x1, 0x0, 0x0d200000, 1,  0x00010000 },
599 	{ 0x0, 0x10, 0x2, 0x0, 0x0d210000, 2,  0x00020000 },
600 	{ 0x0, 0x10, 0x3, 0x0, 0x0d220000, 3,  0x00030000 },
601 	{ 0x0, 0x11, 0x0, 0x0, 0x0d240000, 0,  0x00000000 },
602 	{ 0x0, 0x12, 0x0, 0x0, 0x0d250000, 0,  0x00000000 },
603 	{ 0x0, 0x13, 0x0, 0x0, 0x0d260000, 0,  0x00000000 },
604 	{ 0x0, 0x14, 0x0, 0x0, 0x0d270000, 0,  0x00000000 },
605 	{ 0x0, 0x15, 0x0, 0x0, 0x0d2b0000, 0,  0x00000000 },
606 	{ 0x0, 0x16, 0x0, 0x0, 0x0d280000, 0,  0x00000000 },
607 	{ 0x0, 0x17, 0x0, 0x0, 0x0d0f0000, 0,  0x00000000 },
608 	{ 0x0, 0x17, 0x1, 0x0, 0x0d100000, 1,  0x00010000 },
609 	{ 0x0, 0x17, 0x2, 0x0, 0x0d110000, 2,  0x00020000 },
610 	{ 0x0, 0x17, 0x3, 0x0, 0x0d120000, 3,  0x00030000 },
611 	{ 0x0, 0x17, 0x4, 0x0, 0x0d130000, 4,  0x00040000 },
612 	{ 0x0, 0x17, 0x5, 0x0, 0x0d140000, 5,  0x00050000 },
613 	{ 0x0, 0x18, 0x0, 0x0, 0x0d020000, 0,  0x00000000 },
614 	{ 0x0, 0x19, 0x0, 0x0, 0x0d030000, 0,  0x00000000 },
615 	{ 0x0, 0x1f, 0x0, 0x0, 0x0d600000, 0,  0x00000000 },
616 	{ 0x0, 0x1f, 0x1, 0x0, 0x00000000, 0,  0x00000000 },
617 	{ 0x1, 0x1a, 0x0, 0x0, 0x40000000, 0,  0x40000000 },
618 	{ 0x1, 0x1a, 0x1, 0x1, 0x80000000, 1,  0x80000000 },
619 	{ 0x1, 0x1a, 0x2, 0x0, 0x00000000, 0,  0x00000000 },
620 	{ 0x2, 0x1c, 0x0, 0x0, 0x0d640000, 0,  0x00000000 },
621 	{ 0x2, 0x1d, 0x0, 0x0, 0x20b00000, 8,  0x20b00000 },
622 	{ 0x2, 0x1d, 0x1, 0x0, 0x20800000, 7,  0x20800000 },
623 	{ 0x2, 0x1d, 0x2, 0x0, 0x20c00000, 9,  0x20c00000 },
624 	{ 0x2, 0x1d, 0x3, 0x0, 0x0d800000, 3,  0x0d800000 },
625 	{ 0x2, 0x1d, 0x4, 0x0, 0x20000000, 6,  0x20000000 },
626 	{ 0x2, 0x1d, 0x5, 0x0, 0x0c000000, 2,  0x0c000000 },
627 	{ 0x2, 0x1d, 0x6, 0x0, 0x21000000, 10, 0x21000000 },
628 	{ 0x2, 0x1d, 0x7, 0x0, 0x0e000000, 4,  0x0e000000 },
629 	{ 0x2, 0x1d, 0x8, 0x0, 0x22000000, 11, 0x22000000 },
630 	{ 0x2, 0x1d, 0x9, 0x0, 0x08000000, 1,  0x08000000 },
631 	{ 0x2, 0x1d, 0xa, 0x0, 0x24000000, 12, 0x24000000 },
632 	{ 0x2, 0x1d, 0xb, 0x0, 0x00000000, 0,  0x00000000 },
633 	{ 0x2, 0x1d, 0xc, 0x0, 0x28000000, 13, 0x28000000 },
634 	{ 0x2, 0x1d, 0xd, 0x0, 0x10000000, 5,  0x10000000 },
635 	{ 0x2, 0x1d, 0xe, 0x0, 0x30000000, 14, 0x30000000 },
636 	{ 0x2, 0x00, 0x0, 0x0, 0x0d230000, 0,  0x00000000 },
637 	{ 0x2, 0x01, 0x0, 0x0, 0x0d040000, 0,  0x00000000 },
638 	{ 0x2, 0x02, 0x0, 0x0, 0x0d050000, 0,  0x00000000 },
639 	{ 0x2, 0x03, 0x0, 0x0, 0x0d000000, 0,  0x00000000 },
640 	{ 0x2, 0x04, 0x0, 0x0, 0x20ae0000, 3,  0x000e0000 },
641 	{ 0x2, 0x04, 0x1, 0x0, 0x20ac0000, 2,  0x000c0000 },
642 	{ 0x2, 0x04, 0x2, 0x0, 0x20a80000, 1,  0x00080000 },
643 	{ 0x2, 0x04, 0x3, 0x0, 0x20a00000, 0,  0x00000000 },
644 	{ 0x2, 0x05, 0x0, 0x0, 0x0d2a0000, 0,  0x00000000 },
645 	{ 0x2, 0x06, 0x0, 0x0, 0x0d290000, 0,  0x00000000 },
646 	{ 0x2, 0x07, 0x0, 0x0, 0x0d2c0000, 0,  0x00000000 },
647 	{ 0x2, 0x08, 0x0, 0x0, 0x0d0e0000, 4,  0x00080000 },
648 	{ 0x2, 0x08, 0x1, 0x0, 0x0d060000, 0,  0x00000000 },
649 	{ 0x2, 0x08, 0x2, 0x0, 0x0d080000, 1,  0x00020000 },
650 	{ 0x2, 0x08, 0x3, 0x0, 0x0d0a0000, 2,  0x00040000 },
651 	{ 0x2, 0x08, 0x4, 0x0, 0x0d0c0000, 3,  0x00060000 },
652 	{ 0x2, 0x09, 0x0, 0x0, 0x0d650000, 0,  0x00000000 },
653 	{ 0x2, 0x0a, 0x0, 0x0, 0x20af0000, 0,  0x00000000 },
654 	{ 0x2, 0x0b, 0x0, 0x0, 0x0d3e0000, 0,  0x00000000 },
655 	{ 0x2, 0x0c, 0x0, 0x0, 0x0d3d0000, 0,  0x00000000 },
656 	{ 0x2, 0x0d, 0x0, 0x0, 0x0d1e0000, 0,  0x00000000 },
657 	{ 0x2, 0x0e, 0x0, 0x0, 0x0d150000, 0,  0x00000000 },
658 	{ 0x2, 0x0e, 0x1, 0x0, 0x0d160000, 1,  0x00010000 },
659 	{ 0x2, 0x0e, 0x2, 0x0, 0x0d170000, 2,  0x00020000 },
660 	{ 0x2, 0x0e, 0x3, 0x0, 0x0d180000, 3,  0x00030000 },
661 	{ 0x2, 0x0e, 0x4, 0x0, 0x0d190000, 4,  0x00040000 },
662 	{ 0x2, 0x0e, 0x5, 0x0, 0x0d1a0000, 5,  0x00050000 },
663 	{ 0x2, 0x0e, 0x6, 0x0, 0x0d1b0000, 6,  0x00060000 },
664 	{ 0x2, 0x0e, 0x7, 0x0, 0x0d1c0000, 7,  0x00070000 },
665 	{ 0x2, 0x0e, 0x8, 0x0, 0x0d1d0000, 8,  0x00080000 },
666 	{ 0x2, 0x0f, 0x0, 0x0, 0x0d660000, 0,  0x00000000 },
667 	{ 0x2, 0x10, 0x0, 0x0, 0x0d1f0000, 0,  0x00000000 },
668 	{ 0x2, 0x10, 0x1, 0x0, 0x0d200000, 1,  0x00010000 },
669 	{ 0x2, 0x10, 0x2, 0x0, 0x0d210000, 2,  0x00020000 },
670 	{ 0x2, 0x10, 0x3, 0x0, 0x0d220000, 3,  0x00030000 },
671 	{ 0x2, 0x11, 0x0, 0x0, 0x0d240000, 0,  0x00000000 },
672 	{ 0x2, 0x12, 0x0, 0x0, 0x0d250000, 0,  0x00000000 },
673 	{ 0x2, 0x13, 0x0, 0x0, 0x0d260000, 0,  0x00000000 },
674 	{ 0x2, 0x14, 0x0, 0x0, 0x0d270000, 0,  0x00000000 },
675 	{ 0x2, 0x15, 0x0, 0x0, 0x0d2b0000, 0,  0x00000000 },
676 	{ 0x2, 0x16, 0x0, 0x0, 0x0d280000, 0,  0x00000000 },
677 	{ 0x2, 0x17, 0x0, 0x0, 0x0d0f0000, 0,  0x00000000 },
678 	{ 0x2, 0x17, 0x1, 0x0, 0x0d100000, 1,  0x00010000 },
679 	{ 0x2, 0x17, 0x2, 0x0, 0x0d110000, 2,  0x00020000 },
680 	{ 0x2, 0x17, 0x3, 0x0, 0x0d120000, 3,  0x00030000 },
681 	{ 0x2, 0x17, 0x4, 0x0, 0x0d130000, 4,  0x00040000 },
682 	{ 0x2, 0x17, 0x5, 0x0, 0x0d140000, 5,  0x00050000 },
683 	{ 0x2, 0x18, 0x0, 0x0, 0x0d020000, 0,  0x00000000 },
684 	{ 0x2, 0x19, 0x0, 0x0, 0x0d030000, 0,  0x00000000 },
685 	{ 0x2, 0x1f, 0x0, 0x0, 0x0d600000, 0,  0x00000000 },
686 	{ 0x2, 0x1f, 0x1, 0x0, 0x00000000, 0,  0x00000000 },
687 	{ 0x3, 0x1b, 0x0, 0x0, 0x40000000, 0,  0x40000000 },
688 	{ 0x3, 0x1b, 0x1, 0x1, 0x80000000, 1,  0x80000000 },
689 	{ 0x3, 0x1c, 0x0, 0x2, 0x0d640000, 0,  0x00000000 },
690 	{ 0x3, 0x1d, 0x0, 0x2, 0x20b00000, 8,  0x20b00000 },
691 	{ 0x3, 0x1d, 0x1, 0x2, 0x20800000, 7,  0x20800000 },
692 	{ 0x3, 0x1d, 0x2, 0x2, 0x20c00000, 9,  0x20c00000 },
693 	{ 0x3, 0x1d, 0x3, 0x2, 0x0d800000, 3,  0x0d800000 },
694 	{ 0x3, 0x1d, 0x4, 0x2, 0x20000000, 6,  0x20000000 },
695 	{ 0x3, 0x1d, 0x5, 0x2, 0x0c000000, 2,  0x0c000000 },
696 	{ 0x3, 0x1d, 0x6, 0x2, 0x21000000, 10, 0x21000000 },
697 	{ 0x3, 0x1d, 0x7, 0x2, 0x0e000000, 4,  0x0e000000 },
698 	{ 0x3, 0x1d, 0x8, 0x2, 0x22000000, 11, 0x22000000 },
699 	{ 0x3, 0x1d, 0x9, 0x2, 0x08000000, 1,  0x08000000 },
700 	{ 0x3, 0x1d, 0xa, 0x2, 0x24000000, 12, 0x24000000 },
701 	{ 0x3, 0x1d, 0xb, 0x2, 0x00000000, 0,  0x00000000 },
702 	{ 0x3, 0x1d, 0xc, 0x2, 0x28000000, 13, 0x28000000 },
703 	{ 0x3, 0x1d, 0xd, 0x2, 0x10000000, 5,  0x10000000 },
704 	{ 0x3, 0x1d, 0xe, 0x2, 0x30000000, 14, 0x30000000 },
705 	{ 0x3, 0x1e, 0x0, 0x2, 0x0d400000, 0,  0x0d400000 },
706 	{ 0x3, 0x00, 0x0, 0x2, 0x0d230000, 0,  0x00000000 },
707 	{ 0x3, 0x01, 0x0, 0x2, 0x0d040000, 0,  0x00000000 },
708 	{ 0x3, 0x02, 0x0, 0x2, 0x0d050000, 0,  0x00000000 },
709 	{ 0x3, 0x03, 0x0, 0x2, 0x0d000000, 0,  0x00000000 },
710 	{ 0x3, 0x04, 0x0, 0x2, 0x20ae0000, 3,  0x000e0000 },
711 	{ 0x3, 0x04, 0x1, 0x2, 0x20ac0000, 2,  0x000c0000 },
712 	{ 0x3, 0x04, 0x2, 0x2, 0x20a80000, 1,  0x00080000 },
713 	{ 0x3, 0x04, 0x3, 0x2, 0x20a00000, 0,  0x00000000 },
714 	{ 0x3, 0x05, 0x0, 0x2, 0x0d2a0000, 0,  0x00000000 },
715 	{ 0x3, 0x06, 0x0, 0x2, 0x0d290000, 0,  0x00000000 },
716 	{ 0x3, 0x07, 0x0, 0x2, 0x0d2c0000, 0,  0x00000000 },
717 	{ 0x3, 0x08, 0x0, 0x2, 0x0d0e0000, 4,  0x00080000 },
718 	{ 0x3, 0x08, 0x1, 0x2, 0x0d060000, 0,  0x00000000 },
719 	{ 0x3, 0x08, 0x2, 0x2, 0x0d080000, 1,  0x00020000 },
720 	{ 0x3, 0x08, 0x3, 0x2, 0x0d0a0000, 2,  0x00040000 },
721 	{ 0x3, 0x08, 0x4, 0x2, 0x0d0c0000, 3,  0x00060000 },
722 	{ 0x3, 0x09, 0x0, 0x2, 0x0d650000, 0,  0x00000000 },
723 	{ 0x3, 0x0a, 0x0, 0x2, 0x20af0000, 0,  0x00000000 },
724 	{ 0x3, 0x0b, 0x0, 0x2, 0x0d3e0000, 0,  0x00000000 },
725 	{ 0x3, 0x0c, 0x0, 0x2, 0x0d3d0000, 0,  0x00000000 },
726 	{ 0x3, 0x0d, 0x0, 0x2, 0x0d1e0000, 0,  0x00000000 },
727 	{ 0x3, 0x0e, 0x0, 0x2, 0x0d150000, 0,  0x00000000 },
728 	{ 0x3, 0x0e, 0x1, 0x2, 0x0d160000, 1,  0x00010000 },
729 	{ 0x3, 0x0e, 0x2, 0x2, 0x0d170000, 2,  0x00020000 },
730 	{ 0x3, 0x0e, 0x3, 0x2, 0x0d180000, 3,  0x00030000 },
731 	{ 0x3, 0x0e, 0x4, 0x2, 0x0d190000, 4,  0x00040000 },
732 	{ 0x3, 0x0e, 0x5, 0x2, 0x0d1a0000, 5,  0x00050000 },
733 	{ 0x3, 0x0e, 0x6, 0x2, 0x0d1b0000, 6,  0x00060000 },
734 	{ 0x3, 0x0e, 0x7, 0x2, 0x0d1c0000, 7,  0x00070000 },
735 	{ 0x3, 0x0e, 0x8, 0x2, 0x0d1d0000, 8,  0x00080000 },
736 	{ 0x3, 0x0f, 0x0, 0x2, 0x0d660000, 0,  0x00000000 },
737 	{ 0x3, 0x10, 0x0, 0x2, 0x0d1f0000, 0,  0x00000000 },
738 	{ 0x3, 0x10, 0x1, 0x2, 0x0d200000, 1,  0x00010000 },
739 	{ 0x3, 0x10, 0x2, 0x2, 0x0d210000, 2,  0x00020000 },
740 	{ 0x3, 0x10, 0x3, 0x2, 0x0d220000, 3,  0x00030000 },
741 	{ 0x3, 0x11, 0x0, 0x2, 0x0d240000, 0,  0x00000000 },
742 	{ 0x3, 0x12, 0x0, 0x2, 0x0d250000, 0,  0x00000000 },
743 	{ 0x3, 0x13, 0x0, 0x2, 0x0d260000, 0,  0x00000000 },
744 	{ 0x3, 0x14, 0x0, 0x2, 0x0d270000, 0,  0x00000000 },
745 	{ 0x3, 0x15, 0x0, 0x2, 0x0d2b0000, 0,  0x00000000 },
746 	{ 0x3, 0x16, 0x0, 0x2, 0x0d280000, 0,  0x00000000 },
747 	{ 0x3, 0x17, 0x0, 0x2, 0x0d0f0000, 0,  0x00000000 },
748 	{ 0x3, 0x17, 0x1, 0x2, 0x0d100000, 1,  0x00010000 },
749 	{ 0x3, 0x17, 0x2, 0x2, 0x0d110000, 2,  0x00020000 },
750 	{ 0x3, 0x17, 0x3, 0x2, 0x0d120000, 3,  0x00030000 },
751 	{ 0x3, 0x17, 0x4, 0x2, 0x0d130000, 4,  0x00040000 },
752 	{ 0x3, 0x17, 0x5, 0x2, 0x0d140000, 5,  0x00050000 },
753 	{ 0x3, 0x18, 0x0, 0x2, 0x0d020000, 0,  0x00000000 },
754 	{ 0x3, 0x19, 0x0, 0x2, 0x0d030000, 0,  0x00000000 },
755 	{ 0x3, 0x1f, 0x0, 0x2, 0x0d600000, 0,  0x00000000 },
756 	{ 0x3, 0x1f, 0x1, 0x0, 0x00000000, 0,  0x00000000 },
757 	{ 0x4, 0x1b, 0x0, 0x0, 0x40000000, 0,  0x40000000 },
758 	{ 0x4, 0x1b, 0x1, 0x1, 0x80000000, 1,  0x80000000 },
759 	{ 0x4, 0x1e, 0x0, 0x2, 0x0d400000, 0,  0x0d400000 },
760 	{ 0x4, 0x1e, 0x1, 0x0, 0x00000000, 0,  0x00000000 },
761 	{ 0x5, 0x1c, 0x0, 0x0, 0x0d640000, 0,  0x00000000 },
762 	{ 0x5, 0x1d, 0x0, 0x0, 0x20b00000, 8,  0x20b00000 },
763 	{ 0x5, 0x1d, 0x1, 0x0, 0x20800000, 7,  0x20800000 },
764 	{ 0x5, 0x1d, 0x2, 0x0, 0x20c00000, 9,  0x20c00000 },
765 	{ 0x5, 0x1d, 0x3, 0x0, 0x0d800000, 3,  0x0d800000 },
766 	{ 0x5, 0x1d, 0x4, 0x0, 0x20000000, 6,  0x20000000 },
767 	{ 0x5, 0x1d, 0x5, 0x0, 0x0c000000, 2,  0x0c000000 },
768 	{ 0x5, 0x1d, 0x6, 0x0, 0x21000000, 10, 0x21000000 },
769 	{ 0x5, 0x1d, 0x7, 0x0, 0x0e000000, 4,  0x0e000000 },
770 	{ 0x5, 0x1d, 0x8, 0x0, 0x22000000, 11, 0x22000000 },
771 	{ 0x5, 0x1d, 0x9, 0x0, 0x08000000, 1,  0x08000000 },
772 	{ 0x5, 0x1d, 0xa, 0x0, 0x24000000, 12, 0x24000000 },
773 	{ 0x5, 0x1d, 0xb, 0x0, 0x00000000, 0,  0x00000000 },
774 	{ 0x5, 0x1d, 0xc, 0x0, 0x28000000, 13, 0x28000000 },
775 	{ 0x5, 0x1d, 0xd, 0x0, 0x10000000, 5,  0x10000000 },
776 	{ 0x5, 0x1d, 0xe, 0x0, 0x30000000, 14, 0x30000000 },
777 	{ 0x5, 0x00, 0x0, 0x0, 0x0d230000, 0,  0x00000000 },
778 	{ 0x5, 0x01, 0x0, 0x0, 0x0d040000, 0,  0x00000000 },
779 	{ 0x5, 0x02, 0x0, 0x0, 0x0d050000, 0,  0x00000000 },
780 	{ 0x5, 0x03, 0x0, 0x0, 0x0d000000, 0,  0x00000000 },
781 	{ 0x5, 0x04, 0x0, 0x0, 0x20ae0000, 3,  0x000e0000 },
782 	{ 0x5, 0x04, 0x1, 0x0, 0x20ac0000, 2,  0x000c0000 },
783 	{ 0x5, 0x04, 0x2, 0x0, 0x20a80000, 1,  0x00080000 },
784 	{ 0x5, 0x04, 0x3, 0x0, 0x20a00000, 0,  0x00000000 },
785 	{ 0x5, 0x05, 0x0, 0x0, 0x0d2a0000, 0,  0x00000000 },
786 	{ 0x5, 0x06, 0x0, 0x0, 0x0d290000, 0,  0x00000000 },
787 	{ 0x5, 0x07, 0x0, 0x0, 0x0d2c0000, 0,  0x00000000 },
788 	{ 0x5, 0x08, 0x0, 0x0, 0x0d0e0000, 4,  0x00080000 },
789 	{ 0x5, 0x08, 0x1, 0x0, 0x0d060000, 0,  0x00000000 },
790 	{ 0x5, 0x08, 0x2, 0x0, 0x0d080000, 1,  0x00020000 },
791 	{ 0x5, 0x08, 0x3, 0x0, 0x0d0a0000, 2,  0x00040000 },
792 	{ 0x5, 0x08, 0x4, 0x0, 0x0d0c0000, 3,  0x00060000 },
793 	{ 0x5, 0x09, 0x0, 0x0, 0x0d650000, 0,  0x00000000 },
794 	{ 0x5, 0x0a, 0x0, 0x0, 0x20af0000, 0,  0x00000000 },
795 	{ 0x5, 0x0b, 0x0, 0x0, 0x0d3e0000, 0,  0x00000000 },
796 	{ 0x5, 0x0c, 0x0, 0x0, 0x0d3d0000, 0,  0x00000000 },
797 	{ 0x5, 0x0d, 0x0, 0x0, 0x0d1e0000, 0,  0x00000000 },
798 	{ 0x5, 0x0e, 0x0, 0x0, 0x0d150000, 0,  0x00000000 },
799 	{ 0x5, 0x0e, 0x1, 0x0, 0x0d160000, 1,  0x00010000 },
800 	{ 0x5, 0x0e, 0x2, 0x0, 0x0d170000, 2,  0x00020000 },
801 	{ 0x5, 0x0e, 0x3, 0x0, 0x0d180000, 3,  0x00030000 },
802 	{ 0x5, 0x0e, 0x4, 0x0, 0x0d190000, 4,  0x00040000 },
803 	{ 0x5, 0x0e, 0x5, 0x0, 0x0d1a0000, 5,  0x00050000 },
804 	{ 0x5, 0x0e, 0x6, 0x0, 0x0d1b0000, 6,  0x00060000 },
805 	{ 0x5, 0x0e, 0x7, 0x0, 0x0d1c0000, 7,  0x00070000 },
806 	{ 0x5, 0x0e, 0x8, 0x0, 0x0d1d0000, 8,  0x00080000 },
807 	{ 0x5, 0x0f, 0x0, 0x0, 0x0d660000, 0,  0x00000000 },
808 	{ 0x5, 0x10, 0x0, 0x0, 0x0d1f0000, 0,  0x00000000 },
809 	{ 0x5, 0x10, 0x1, 0x0, 0x0d200000, 1,  0x00010000 },
810 	{ 0x5, 0x10, 0x2, 0x0, 0x0d210000, 2,  0x00020000 },
811 	{ 0x5, 0x10, 0x3, 0x0, 0x0d220000, 3,  0x00030000 },
812 	{ 0x5, 0x11, 0x0, 0x0, 0x0d240000, 0,  0x00000000 },
813 	{ 0x5, 0x12, 0x0, 0x0, 0x0d250000, 0,  0x00000000 },
814 	{ 0x5, 0x13, 0x0, 0x0, 0x0d260000, 0,  0x00000000 },
815 	{ 0x5, 0x14, 0x0, 0x0, 0x0d270000, 0,  0x00000000 },
816 	{ 0x5, 0x15, 0x0, 0x0, 0x0d2b0000, 0,  0x00000000 },
817 	{ 0x5, 0x16, 0x0, 0x0, 0x0d280000, 0,  0x00000000 },
818 	{ 0x5, 0x17, 0x0, 0x0, 0x0d0f0000, 0,  0x00000000 },
819 	{ 0x5, 0x17, 0x1, 0x0, 0x0d100000, 1,  0x00010000 },
820 	{ 0x5, 0x17, 0x2, 0x0, 0x0d110000, 2,  0x00020000 },
821 	{ 0x5, 0x17, 0x3, 0x0, 0x0d120000, 3,  0x00030000 },
822 	{ 0x5, 0x17, 0x4, 0x0, 0x0d130000, 4,  0x00040000 },
823 	{ 0x5, 0x17, 0x5, 0x0, 0x0d140000, 5,  0x00050000 },
824 	{ 0x5, 0x18, 0x0, 0x0, 0x0d020000, 0,  0x00000000 },
825 	{ 0x5, 0x19, 0x0, 0x0, 0x0d030000, 0,  0x00000000 },
826 	{ 0x5, 0x1f, 0x0, 0x0, 0x0d600000, 0,  0x00000000 },
827 	{ 0x5, 0x1f, 0x1, 0x0, 0x00000000, 0,  0x00000000 }
828 };
829 
830 /*
831  * AON NOC aperture lookup table as per file "AON_NOC_Structure.info".
832  */
833 static const char * const tegra194_aonnoc_routeid_initflow[] = {
834 	[0x0] = "cbb_i/I/0",
835 	[0x1] = "cpu_p_i/I/0",
836 	[0x2] = "dma_m_i/I/0",
837 	[0x3] = "dma_p_i/I/0"
838 };
839 
840 static const char * const tegra194_aonnoc_routeid_targflow[] = {
841 	[0x00] = "multiport1_t/T/aon_misc",
842 	[0x01] = "multiport1_t/T/avic0",
843 	[0x02] = "multiport1_t/T/avic1",
844 	[0x03] = "multiport1_t/T/can1",
845 	[0x04] = "multiport1_t/T/can2",
846 	[0x05] = "multiport1_t/T/dma",
847 	[0x06] = "multiport1_t/T/dmic",
848 	[0x07] = "multiport1_t/T/err_collator",
849 	[0x08] = "multiport1_t/T/fpga_misc",
850 	[0x09] = "multiport1_t/T/gte",
851 	[0x0a] = "multiport1_t/T/hsp",
852 	[0x0b] = "multiport1_t/T/i2c2",
853 	[0x0c] = "multiport1_t/T/i2c8",
854 	[0x0d] = "multiport1_t/T/pwm",
855 	[0x0e] = "multiport1_t/T/spi2",
856 	[0x0f] = "multiport1_t/T/tke",
857 	[0x10] = "multiport1_t/T/uartg",
858 	[0x11] = "RESERVED",
859 	[0x12] = "RESERVED",
860 	[0x13] = "RESERVED",
861 	[0x14] = "RESERVED",
862 	[0x15] = "RESERVED",
863 	[0x16] = "RESERVED",
864 	[0x17] = "RESERVED",
865 	[0x18] = "RESERVED",
866 	[0x19] = "RESERVED",
867 	[0x1a] = "RESERVED",
868 	[0x1b] = "RESERVED",
869 	[0x1c] = "RESERVED",
870 	[0x1d] = "RESERVED",
871 	[0x1e] = "RESERVED",
872 	[0x1f] = "RESERVED",
873 	[0x20] = "multiport0_t/T/aovc",
874 	[0x21] = "multiport0_t/T/atcm",
875 	[0x22] = "multiport0_t/T/cast",
876 	[0x23] = "multiport0_t/T/dast",
877 	[0x24] = "multiport0_t/T/err_collator_car",
878 	[0x25] = "multiport0_t/T/gpio",
879 	[0x26] = "multiport0_t/T/i2c10",
880 	[0x27] = "multiport0_t/T/mss",
881 	[0x28] = "multiport0_t/T/padctl_a12",
882 	[0x29] = "multiport0_t/T/padctl_a14",
883 	[0x2a] = "multiport0_t/T/padctl_a15",
884 	[0x2b] = "multiport0_t/T/rtc",
885 	[0x2c] = "multiport0_t/T/tsc",
886 	[0x2d] = "RESERVED",
887 	[0x2e] = "RESERVED",
888 	[0x2f] = "RESERVED",
889 	[0x30] = "multiport2_t/T/aon_vref_ro",
890 	[0x31] = "multiport2_t/T/aopm",
891 	[0x32] = "multiport2_t/T/car",
892 	[0x33] = "multiport2_t/T/pmc",
893 	[0x34] = "ast1_t/T/0",
894 	[0x35] = "cbb_t/T/0",
895 	[0x36] = "cpu_t/T/0",
896 	[0x37] = "firewall_t/T/0",
897 	[0x38] = "svc_t/T/0",
898 	[0x39] = "uartc/T/uartc",
899 	[0x3a] = "RESERVED",
900 	[0x3b] = "RESERVED",
901 	[0x3c] = "RESERVED",
902 	[0x3d] = "RESERVED",
903 	[0x3e] = "RESERVED",
904 	[0x3f] = "RESERVED"
905 };
906 
907 /*
908  * Fields of AON NOC lookup table:
909  * Init flow, Targ flow, Targ subrange, Init mapping, Init localAddress,
910  *                                              Targ mapping, Targ localAddress
911  * ----------------------------------------------------------------------------
912  */
913 static const struct tegra194_cbb_aperture tegra194_aonnoc_aperture_lookup[] = {
914 	{ 0x0, 0x37, 0x00, 0, 0x0c640000, 0,  0x00000000 },
915 	{ 0x0, 0x20, 0x00, 0, 0x0c3b0000, 0,  0x00000000 },
916 	{ 0x0, 0x21, 0x00, 0, 0x0c000000, 0,  0x00000000 },
917 	{ 0x0, 0x22, 0x00, 0, 0x0c040000, 0,  0x00000000 },
918 	{ 0x0, 0x23, 0x00, 0, 0x0c050000, 0,  0x00000000 },
919 	{ 0x0, 0x24, 0x00, 0, 0x20cf0000, 0,  0x00000000 },
920 	{ 0x0, 0x25, 0x00, 0, 0x0c2f0000, 0,  0x00000000 },
921 	{ 0x0, 0x26, 0x00, 0, 0x0c230000, 0,  0x00000000 },
922 	{ 0x0, 0x27, 0x00, 0, 0x0c350000, 0,  0x00000000 },
923 	{ 0x0, 0x28, 0x00, 0, 0x0c301000, 0,  0x00000000 },
924 	{ 0x0, 0x29, 0x00, 0, 0x0c302000, 0,  0x00000000 },
925 	{ 0x0, 0x2a, 0x00, 0, 0x0c303000, 0,  0x00000000 },
926 	{ 0x0, 0x2b, 0x00, 0, 0x0c2a0000, 0,  0x00000000 },
927 	{ 0x0, 0x2c, 0x00, 0, 0x0c2b0000, 0,  0x00000000 },
928 	{ 0x0, 0x2c, 0x01, 0, 0x0c2c0000, 1,  0x00010000 },
929 	{ 0x0, 0x2c, 0x02, 0, 0x0c2d0000, 2,  0x00020000 },
930 	{ 0x0, 0x2c, 0x03, 0, 0x0c2e0000, 3,  0x00030000 },
931 	{ 0x0, 0x00, 0x00, 0, 0x0c660000, 0,  0x00000000 },
932 	{ 0x0, 0x01, 0x00, 0, 0x0c020000, 0,  0x00000000 },
933 	{ 0x0, 0x02, 0x00, 0, 0x0c030000, 0,  0x00000000 },
934 	{ 0x0, 0x03, 0x00, 0, 0x0c310000, 0,  0x00000000 },
935 	{ 0x0, 0x04, 0x00, 0, 0x0c320000, 0,  0x00000000 },
936 	{ 0x0, 0x05, 0x00, 0, 0x0c0a0000, 2,  0x00040000 },
937 	{ 0x0, 0x05, 0x01, 0, 0x0c0b0000, 3,  0x00050000 },
938 	{ 0x0, 0x05, 0x02, 0, 0x0c0e0000, 5,  0x00080000 },
939 	{ 0x0, 0x05, 0x03, 0, 0x0c060000, 0,  0x00000000 },
940 	{ 0x0, 0x05, 0x04, 0, 0x0c080000, 1,  0x00020000 },
941 	{ 0x0, 0x05, 0x05, 0, 0x0c0c0000, 4,  0x00060000 },
942 	{ 0x0, 0x06, 0x00, 0, 0x0c330000, 0,  0x00000000 },
943 	{ 0x0, 0x07, 0x00, 0, 0x0c650000, 0,  0x00000000 },
944 	{ 0x0, 0x08, 0x00, 0, 0x0c3e0000, 0,  0x00000000 },
945 	{ 0x0, 0x09, 0x00, 0, 0x0c1e0000, 0,  0x00000000 },
946 	{ 0x0, 0x0a, 0x00, 0, 0x0c150000, 0,  0x00000000 },
947 	{ 0x0, 0x0a, 0x01, 0, 0x0c160000, 1,  0x00010000 },
948 	{ 0x0, 0x0a, 0x02, 0, 0x0c170000, 2,  0x00020000 },
949 	{ 0x0, 0x0a, 0x03, 0, 0x0c180000, 3,  0x00030000 },
950 	{ 0x0, 0x0a, 0x04, 0, 0x0c190000, 4,  0x00040000 },
951 	{ 0x0, 0x0a, 0x05, 0, 0x0c1a0000, 5,  0x00050000 },
952 	{ 0x0, 0x0a, 0x06, 0, 0x0c1b0000, 6,  0x00060000 },
953 	{ 0x0, 0x0a, 0x07, 0, 0x0c1c0000, 7,  0x00070000 },
954 	{ 0x0, 0x0a, 0x08, 0, 0x0c1d0000, 8,  0x00080000 },
955 	{ 0x0, 0x0b, 0x00, 0, 0x0c240000, 0,  0x00000000 },
956 	{ 0x0, 0x0c, 0x00, 0, 0x0c250000, 0,  0x00000000 },
957 	{ 0x0, 0x0d, 0x00, 0, 0x0c340000, 0,  0x00000000 },
958 	{ 0x0, 0x0e, 0x00, 0, 0x0c260000, 0,  0x00000000 },
959 	{ 0x0, 0x0f, 0x00, 0, 0x0c0f0000, 0,  0x00000000 },
960 	{ 0x0, 0x0f, 0x01, 0, 0x0c100000, 1,  0x00010000 },
961 	{ 0x0, 0x0f, 0x02, 0, 0x0c110000, 2,  0x00020000 },
962 	{ 0x0, 0x0f, 0x03, 0, 0x0c120000, 3,  0x00030000 },
963 	{ 0x0, 0x0f, 0x04, 0, 0x0c130000, 4,  0x00040000 },
964 	{ 0x0, 0x0f, 0x05, 0, 0x0c140000, 5,  0x00050000 },
965 	{ 0x0, 0x10, 0x00, 0, 0x0c290000, 0,  0x00000000 },
966 	{ 0x0, 0x30, 0x00, 0, 0x20ce0000, 0,  0x00000000 },
967 	{ 0x0, 0x31, 0x00, 0, 0x0c1f0000, 0,  0x00000000 },
968 	{ 0x0, 0x31, 0x01, 0, 0x0c200000, 1,  0x00010000 },
969 	{ 0x0, 0x31, 0x02, 0, 0x0c210000, 2,  0x00020000 },
970 	{ 0x0, 0x31, 0x03, 0, 0x0c220000, 3,  0x00030000 },
971 	{ 0x0, 0x32, 0x00, 0, 0x20cc0000, 3,  0x001c0000 },
972 	{ 0x0, 0x32, 0x01, 0, 0x20c80000, 2,  0x00180000 },
973 	{ 0x0, 0x32, 0x02, 0, 0x20c00000, 1,  0x00100000 },
974 	{ 0x0, 0x32, 0x03, 0, 0x20b00000, 0,  0x00000000 },
975 	{ 0x0, 0x33, 0x00, 0, 0x0c360000, 0,  0x00000000 },
976 	{ 0x0, 0x33, 0x01, 0, 0x0c370000, 1,  0x00010000 },
977 	{ 0x0, 0x33, 0x02, 0, 0x0c3a0000, 3,  0x00040000 },
978 	{ 0x0, 0x33, 0x03, 0, 0x0c380000, 2,  0x00020000 },
979 	{ 0x0, 0x38, 0x00, 0, 0x0c600000, 0,  0x00000000 },
980 	{ 0x0, 0x38, 0x01, 0, 0x00000000, 0,  0x00000000 },
981 	{ 0x0, 0x39, 0x00, 0, 0x0c280000, 0,  0x00000000 },
982 	{ 0x1, 0x35, 0x00, 0, 0x00000000, 0,  0x00000000 },
983 	{ 0x1, 0x35, 0x01, 0, 0x00100000, 1,  0x00100000 },
984 	{ 0x1, 0x35, 0x02, 0, 0x05a00000, 11, 0x05a00000 },
985 	{ 0x1, 0x35, 0x03, 0, 0x05b00000, 32, 0x05b00000 },
986 	{ 0x1, 0x35, 0x04, 0, 0x05c00000, 33, 0x05c00000 },
987 	{ 0x1, 0x35, 0x05, 0, 0x05d00000, 12, 0x05d00000 },
988 	{ 0x1, 0x35, 0x06, 0, 0x20000000, 19, 0x20000000 },
989 	{ 0x1, 0x35, 0x07, 0, 0x20100000, 20, 0x20100000 },
990 	{ 0x1, 0x35, 0x08, 0, 0x20a00000, 24, 0x20a00000 },
991 	{ 0x1, 0x35, 0x09, 0, 0x20d00000, 25, 0x20d00000 },
992 	{ 0x1, 0x35, 0x0a, 0, 0x00200000, 2,  0x00200000 },
993 	{ 0x1, 0x35, 0x0b, 0, 0x05800000, 10, 0x05800000 },
994 	{ 0x1, 0x35, 0x0c, 0, 0x05e00000, 13, 0x05e00000 },
995 	{ 0x1, 0x35, 0x0d, 0, 0x20200000, 21, 0x20200000 },
996 	{ 0x1, 0x35, 0x0e, 0, 0x20800000, 23, 0x20800000 },
997 	{ 0x1, 0x35, 0x0f, 0, 0x20e00000, 26, 0x20e00000 },
998 	{ 0x1, 0x35, 0x10, 0, 0x00400000, 3,  0x00400000 },
999 	{ 0x1, 0x35, 0x11, 0, 0x20400000, 22, 0x20400000 },
1000 	{ 0x1, 0x35, 0x12, 0, 0x00800000, 4,  0x00800000 },
1001 	{ 0x1, 0x35, 0x13, 0, 0x05000000, 9,  0x05000000 },
1002 	{ 0x1, 0x35, 0x14, 0, 0x0c800000, 34, 0x0c800000 },
1003 	{ 0x1, 0x35, 0x15, 0, 0x01000000, 5,  0x01000000 },
1004 	{ 0x1, 0x35, 0x16, 0, 0x03000000, 7,  0x03000000 },
1005 	{ 0x1, 0x35, 0x17, 0, 0x04000000, 8,  0x04000000 },
1006 	{ 0x1, 0x35, 0x18, 0, 0x0d000000, 16, 0x0d000000 },
1007 	{ 0x1, 0x35, 0x19, 0, 0x21000000, 27, 0x21000000 },
1008 	{ 0x1, 0x35, 0x1a, 0, 0x02000000, 6,  0x02000000 },
1009 	{ 0x1, 0x35, 0x1b, 0, 0x06000000, 14, 0x06000000 },
1010 	{ 0x1, 0x35, 0x1c, 0, 0x0e000000, 17, 0x0e000000 },
1011 	{ 0x1, 0x35, 0x1d, 0, 0x22000000, 28, 0x22000000 },
1012 	{ 0x1, 0x35, 0x1e, 0, 0x08000000, 15, 0x08000000 },
1013 	{ 0x1, 0x35, 0x1f, 0, 0x24000000, 29, 0x24000000 },
1014 	{ 0x1, 0x35, 0x20, 0, 0x28000000, 30, 0x28000000 },
1015 	{ 0x1, 0x35, 0x21, 0, 0x10000000, 18, 0x10000000 },
1016 	{ 0x1, 0x35, 0x22, 0, 0x30000000, 31, 0x30000000 },
1017 	{ 0x1, 0x37, 0x00, 0, 0x0c640000, 0,  0x00000000 },
1018 	{ 0x1, 0x20, 0x00, 0, 0x0c3b0000, 0,  0x00000000 },
1019 	{ 0x1, 0x21, 0x00, 0, 0x0c000000, 0,  0x00000000 },
1020 	{ 0x1, 0x22, 0x00, 0, 0x0c040000, 0,  0x00000000 },
1021 	{ 0x1, 0x23, 0x00, 0, 0x0c050000, 0,  0x00000000 },
1022 	{ 0x1, 0x24, 0x00, 0, 0x20cf0000, 0,  0x00000000 },
1023 	{ 0x1, 0x25, 0x00, 0, 0x0c2f0000, 0,  0x00000000 },
1024 	{ 0x1, 0x26, 0x00, 0, 0x0c230000, 0,  0x00000000 },
1025 	{ 0x1, 0x27, 0x00, 0, 0x0c350000, 0,  0x00000000 },
1026 	{ 0x1, 0x28, 0x00, 0, 0x0c301000, 0,  0x00000000 },
1027 	{ 0x1, 0x29, 0x00, 0, 0x0c302000, 0,  0x00000000 },
1028 	{ 0x1, 0x2a, 0x00, 0, 0x0c303000, 0,  0x00000000 },
1029 	{ 0x1, 0x2b, 0x00, 0, 0x0c2a0000, 0,  0x00000000 },
1030 	{ 0x1, 0x2c, 0x00, 0, 0x0c2b0000, 0,  0x00000000 },
1031 	{ 0x1, 0x2c, 0x01, 0, 0x0c2c0000, 1,  0x00010000 },
1032 	{ 0x1, 0x2c, 0x02, 0, 0x0c2d0000, 2,  0x00020000 },
1033 	{ 0x1, 0x2c, 0x03, 0, 0x0c2e0000, 3,  0x00030000 },
1034 	{ 0x1, 0x00, 0x00, 0, 0x0c660000, 0,  0x00000000 },
1035 	{ 0x1, 0x01, 0x00, 0, 0x0c020000, 0,  0x00000000 },
1036 	{ 0x1, 0x02, 0x00, 0, 0x0c030000, 0,  0x00000000 },
1037 	{ 0x1, 0x03, 0x00, 0, 0x0c310000, 0,  0x00000000 },
1038 	{ 0x1, 0x04, 0x00, 0, 0x0c320000, 0,  0x00000000 },
1039 	{ 0x1, 0x05, 0x00, 0, 0x0c0a0000, 2,  0x00040000 },
1040 	{ 0x1, 0x05, 0x01, 0, 0x0c0b0000, 3,  0x00050000 },
1041 	{ 0x1, 0x05, 0x02, 0, 0x0c0e0000, 5,  0x00080000 },
1042 	{ 0x1, 0x05, 0x03, 0, 0x0c060000, 0,  0x00000000 },
1043 	{ 0x1, 0x05, 0x04, 0, 0x0c080000, 1,  0x00020000 },
1044 	{ 0x1, 0x05, 0x05, 0, 0x0c0c0000, 4,  0x00060000 },
1045 	{ 0x1, 0x06, 0x00, 0, 0x0c330000, 0,  0x00000000 },
1046 	{ 0x1, 0x07, 0x00, 0, 0x0c650000, 0,  0x00000000 },
1047 	{ 0x1, 0x08, 0x00, 0, 0x0c3e0000, 0,  0x00000000 },
1048 	{ 0x1, 0x09, 0x00, 0, 0x0c1e0000, 0,  0x00000000 },
1049 	{ 0x1, 0x0a, 0x00, 0, 0x0c150000, 0,  0x00000000 },
1050 	{ 0x1, 0x0a, 0x01, 0, 0x0c160000, 1,  0x00010000 },
1051 	{ 0x1, 0x0a, 0x02, 0, 0x0c170000, 2,  0x00020000 },
1052 	{ 0x1, 0x0a, 0x03, 0, 0x0c180000, 3,  0x00030000 },
1053 	{ 0x1, 0x0a, 0x04, 0, 0x0c190000, 4,  0x00040000 },
1054 	{ 0x1, 0x0a, 0x05, 0, 0x0c1a0000, 5,  0x00050000 },
1055 	{ 0x1, 0x0a, 0x06, 0, 0x0c1b0000, 6,  0x00060000 },
1056 	{ 0x1, 0x0a, 0x07, 0, 0x0c1c0000, 7,  0x00070000 },
1057 	{ 0x1, 0x0a, 0x08, 0, 0x0c1d0000, 8,  0x00080000 },
1058 	{ 0x1, 0x0b, 0x00, 0, 0x0c240000, 0,  0x00000000 },
1059 	{ 0x1, 0x0c, 0x00, 0, 0x0c250000, 0,  0x00000000 },
1060 	{ 0x1, 0x0d, 0x00, 0, 0x0c340000, 0,  0x00000000 },
1061 	{ 0x1, 0x0e, 0x00, 0, 0x0c260000, 0,  0x00000000 },
1062 	{ 0x1, 0x0f, 0x00, 0, 0x0c0f0000, 0,  0x00000000 },
1063 	{ 0x1, 0x0f, 0x01, 0, 0x0c100000, 1,  0x00010000 },
1064 	{ 0x1, 0x0f, 0x02, 0, 0x0c110000, 2,  0x00020000 },
1065 	{ 0x1, 0x0f, 0x03, 0, 0x0c120000, 3,  0x00030000 },
1066 	{ 0x1, 0x0f, 0x04, 0, 0x0c130000, 4,  0x00040000 },
1067 	{ 0x1, 0x0f, 0x05, 0, 0x0c140000, 5,  0x00050000 },
1068 	{ 0x1, 0x10, 0x00, 0, 0x0c290000, 0,  0x00000000 },
1069 	{ 0x1, 0x30, 0x00, 0, 0x20ce0000, 0,  0x00000000 },
1070 	{ 0x1, 0x31, 0x00, 0, 0x0c1f0000, 0,  0x00000000 },
1071 	{ 0x1, 0x31, 0x01, 0, 0x0c200000, 1,  0x00010000 },
1072 	{ 0x1, 0x31, 0x02, 0, 0x0c210000, 2,  0x00020000 },
1073 	{ 0x1, 0x31, 0x03, 0, 0x0c220000, 3,  0x00030000 },
1074 	{ 0x1, 0x32, 0x00, 0, 0x20cc0000, 3,  0x001c0000 },
1075 	{ 0x1, 0x32, 0x01, 0, 0x20c80000, 2,  0x00180000 },
1076 	{ 0x1, 0x32, 0x02, 0, 0x20c00000, 1,  0x00100000 },
1077 	{ 0x1, 0x32, 0x03, 0, 0x20b00000, 0,  0x00000000 },
1078 	{ 0x1, 0x33, 0x00, 0, 0x0c360000, 0,  0x00000000 },
1079 	{ 0x1, 0x33, 0x01, 0, 0x0c370000, 1,  0x00010000 },
1080 	{ 0x1, 0x33, 0x02, 0, 0x0c3a0000, 3,  0x00040000 },
1081 	{ 0x1, 0x33, 0x03, 0, 0x0c380000, 2,  0x00020000 },
1082 	{ 0x1, 0x38, 0x00, 0, 0x0c600000, 0,  0x00000000 },
1083 	{ 0x1, 0x38, 0x01, 0, 0x00000000, 0,  0x00000000 },
1084 	{ 0x1, 0x39, 0x00, 0, 0x0c280000, 0,  0x00000000 },
1085 	{ 0x2, 0x34, 0x00, 0, 0x40000000, 0,  0x40000000 },
1086 	{ 0x2, 0x34, 0x01, 0, 0x80000000, 1,  0x80000000 },
1087 	{ 0x2, 0x36, 0x00, 0, 0x0c400000, 0,  0x0c400000 },
1088 	{ 0x2, 0x36, 0x01, 0, 0x00000000, 0,  0x00000000 },
1089 	{ 0x3, 0x35, 0x00, 0, 0x00000000, 0,  0x00000000 },
1090 	{ 0x3, 0x35, 0x01, 0, 0x00100000, 1,  0x00100000 },
1091 	{ 0x3, 0x35, 0x02, 0, 0x05a00000, 11, 0x05a00000 },
1092 	{ 0x3, 0x35, 0x03, 0, 0x05b00000, 32, 0x05b00000 },
1093 	{ 0x3, 0x35, 0x04, 0, 0x05c00000, 33, 0x05c00000 },
1094 	{ 0x3, 0x35, 0x05, 0, 0x05d00000, 12, 0x05d00000 },
1095 	{ 0x3, 0x35, 0x06, 0, 0x20000000, 19, 0x20000000 },
1096 	{ 0x3, 0x35, 0x07, 0, 0x20100000, 20, 0x20100000 },
1097 	{ 0x3, 0x35, 0x08, 0, 0x20a00000, 24, 0x20a00000 },
1098 	{ 0x3, 0x35, 0x09, 0, 0x20d00000, 25, 0x20d00000 },
1099 	{ 0x3, 0x35, 0x0a, 0, 0x00200000, 2,  0x00200000 },
1100 	{ 0x3, 0x35, 0x0b, 0, 0x05800000, 10, 0x05800000 },
1101 	{ 0x3, 0x35, 0x0c, 0, 0x05e00000, 13, 0x05e00000 },
1102 	{ 0x3, 0x35, 0x0d, 0, 0x20200000, 21, 0x20200000 },
1103 	{ 0x3, 0x35, 0x0e, 0, 0x20800000, 23, 0x20800000 },
1104 	{ 0x3, 0x35, 0x0f, 0, 0x20e00000, 26, 0x20e00000 },
1105 	{ 0x3, 0x35, 0x10, 0, 0x00400000, 3,  0x00400000 },
1106 	{ 0x3, 0x35, 0x11, 0, 0x20400000, 22, 0x20400000 },
1107 	{ 0x3, 0x35, 0x12, 0, 0x00800000, 4,  0x00800000 },
1108 	{ 0x3, 0x35, 0x13, 0, 0x50000000, 9,  0x05000000 },
1109 	{ 0x3, 0x35, 0x14, 0, 0xc0800000, 34, 0x0c800000 },
1110 	{ 0x3, 0x35, 0x15, 0, 0x10000000, 5,  0x01000000 },
1111 	{ 0x3, 0x35, 0x16, 0, 0x30000000, 7,  0x03000000 },
1112 	{ 0x3, 0x35, 0x17, 0, 0x04000000, 8,  0x04000000 },
1113 	{ 0x3, 0x35, 0x18, 0, 0x0d000000, 16, 0x0d000000 },
1114 	{ 0x3, 0x35, 0x19, 0, 0x21000000, 27, 0x21000000 },
1115 	{ 0x3, 0x35, 0x1a, 0, 0x02000000, 6,  0x02000000 },
1116 	{ 0x3, 0x35, 0x1b, 0, 0x06000000, 14, 0x06000000 },
1117 	{ 0x3, 0x35, 0x1c, 0, 0x0e000000, 17, 0x0e000000 },
1118 	{ 0x3, 0x35, 0x1d, 0, 0x22000000, 28, 0x22000000 },
1119 	{ 0x3, 0x35, 0x1e, 0, 0x08000000, 15, 0x08000000 },
1120 	{ 0x3, 0x35, 0x1f, 0, 0x24000000, 29, 0x24000000 },
1121 	{ 0x3, 0x35, 0x20, 0, 0x28000000, 30, 0x28000000 },
1122 	{ 0x3, 0x35, 0x21, 0, 0x10000000, 18, 0x10000000 },
1123 	{ 0x3, 0x35, 0x22, 0, 0x30000000, 31, 0x30000000 },
1124 	{ 0x3, 0x37, 0x00, 0, 0x0c640000, 0,  0x00000000 },
1125 	{ 0x3, 0x20, 0x00, 0, 0x0c3b0000, 0,  0x00000000 },
1126 	{ 0x3, 0x21, 0x00, 0, 0x0c000000, 0,  0x00000000 },
1127 	{ 0x3, 0x22, 0x00, 0, 0x0c040000, 0,  0x00000000 },
1128 	{ 0x3, 0x23, 0x00, 0, 0x0c050000, 0,  0x00000000 },
1129 	{ 0x3, 0x24, 0x00, 0, 0x20cf0000, 0,  0x00000000 },
1130 	{ 0x3, 0x25, 0x00, 0, 0x0c2f0000, 0,  0x00000000 },
1131 	{ 0x3, 0x26, 0x00, 0, 0x0c230000, 0,  0x00000000 },
1132 	{ 0x3, 0x27, 0x00, 0, 0x0c350000, 0,  0x00000000 },
1133 	{ 0x3, 0x28, 0x00, 0, 0x0c301000, 0,  0x00000000 },
1134 	{ 0x3, 0x29, 0x00, 0, 0x0c302000, 0,  0x00000000 },
1135 	{ 0x3, 0x2a, 0x00, 0, 0x0c303000, 0,  0x00000000 },
1136 	{ 0x3, 0x2b, 0x00, 0, 0x0c2a0000, 0,  0x00000000 },
1137 	{ 0x3, 0x2c, 0x00, 0, 0x0c2b0000, 0,  0x00000000 },
1138 	{ 0x3, 0x2c, 0x01, 0, 0x0c2c0000, 1,  0x00010000 },
1139 	{ 0x3, 0x2c, 0x02, 0, 0x0c2d0000, 2,  0x00020000 },
1140 	{ 0x3, 0x2c, 0x03, 0, 0x0c2e0000, 3,  0x00030000 },
1141 	{ 0x3, 0x00, 0x00, 0, 0x0c660000, 0,  0x00000000 },
1142 	{ 0x3, 0x01, 0x00, 0, 0x0c020000, 0,  0x00000000 },
1143 	{ 0x3, 0x02, 0x00, 0, 0x0c030000, 0,  0x00000000 },
1144 	{ 0x3, 0x03, 0x00, 0, 0x0c310000, 0,  0x00000000 },
1145 	{ 0x3, 0x04, 0x00, 0, 0x0c320000, 0,  0x00000000 },
1146 	{ 0x3, 0x05, 0x00, 0, 0x0c0a0000, 2,  0x00040000 },
1147 	{ 0x3, 0x05, 0x01, 0, 0x0c0b0000, 3,  0x00050000 },
1148 	{ 0x3, 0x05, 0x02, 0, 0x0c0e0000, 5,  0x00080000 },
1149 	{ 0x3, 0x05, 0x03, 0, 0x0c060000, 0,  0x00000000 },
1150 	{ 0x3, 0x05, 0x04, 0, 0x0c080000, 1,  0x00020000 },
1151 	{ 0x3, 0x05, 0x05, 0, 0x0c0c0000, 4,  0x00060000 },
1152 	{ 0x3, 0x06, 0x00, 0, 0x0c330000, 0,  0x00000000 },
1153 	{ 0x3, 0x07, 0x00, 0, 0x0c650000, 0,  0x00000000 },
1154 	{ 0x3, 0x08, 0x00, 0, 0x0c3e0000, 0,  0x00000000 },
1155 	{ 0x3, 0x09, 0x00, 0, 0x0c1e0000, 0,  0x00000000 },
1156 	{ 0x3, 0x0a, 0x00, 0, 0x0c150000, 0,  0x00000000 },
1157 	{ 0x3, 0x0a, 0x01, 0, 0x0c160000, 1,  0x00010000 },
1158 	{ 0x3, 0x0a, 0x02, 0, 0x0c170000, 2,  0x00020000 },
1159 	{ 0x3, 0x0a, 0x03, 0, 0x0c180000, 3,  0x00030000 },
1160 	{ 0x3, 0x0a, 0x04, 0, 0x0c190000, 4,  0x00040000 },
1161 	{ 0x3, 0x0a, 0x05, 0, 0x0c1a0000, 5,  0x00050000 },
1162 	{ 0x3, 0x0a, 0x06, 0, 0x0c1b0000, 6,  0x00060000 },
1163 	{ 0x3, 0x0a, 0x07, 0, 0x0c1c0000, 7,  0x00070000 },
1164 	{ 0x3, 0x0a, 0x08, 0, 0x0c1d0000, 8,  0x00080000 },
1165 	{ 0x3, 0x0b, 0x00, 0, 0x0c240000, 0,  0x00000000 },
1166 	{ 0x3, 0x0c, 0x00, 0, 0x0c250000, 0,  0x00000000 },
1167 	{ 0x3, 0x0d, 0x00, 0, 0x0c340000, 0,  0x00000000 },
1168 	{ 0x3, 0x0e, 0x00, 0, 0x0c260000, 0,  0x00000000 },
1169 	{ 0x3, 0x0f, 0x00, 0, 0x0c0f0000, 0,  0x00000000 },
1170 	{ 0x3, 0x0f, 0x01, 0, 0x0c100000, 1,  0x00010000 },
1171 	{ 0x3, 0x0f, 0x02, 0, 0x0c110000, 2,  0x00020000 },
1172 	{ 0x3, 0x0f, 0x03, 0, 0x0c120000, 3,  0x00030000 },
1173 	{ 0x3, 0x0f, 0x04, 0, 0x0c130000, 4,  0x00040000 },
1174 	{ 0x3, 0x0f, 0x05, 0, 0x0c140000, 5,  0x00050000 },
1175 	{ 0x3, 0x10, 0x00, 0, 0x0c290000, 0,  0x00000000 },
1176 	{ 0x3, 0x30, 0x00, 0, 0x20ce0000, 0,  0x00000000 },
1177 	{ 0x3, 0x31, 0x00, 0, 0x0c1f0000, 0,  0x00000000 },
1178 	{ 0x3, 0x31, 0x01, 0, 0x0c200000, 1,  0x00010000 },
1179 	{ 0x3, 0x31, 0x02, 0, 0x0c210000, 2,  0x00020000 },
1180 	{ 0x3, 0x31, 0x03, 0, 0x0c220000, 3,  0x00030000 },
1181 	{ 0x3, 0x32, 0x00, 0, 0x20cc0000, 3,  0x001c0000 },
1182 	{ 0x3, 0x32, 0x01, 0, 0x20c80000, 2,  0x00180000 },
1183 	{ 0x3, 0x32, 0x02, 0, 0x20c00000, 1,  0x00100000 },
1184 	{ 0x3, 0x32, 0x03, 0, 0x20b00000, 0,  0x00000000 },
1185 	{ 0x3, 0x33, 0x00, 0, 0x0c360000, 0,  0x00000000 },
1186 	{ 0x3, 0x33, 0x01, 0, 0x0c370000, 1,  0x00010000 },
1187 	{ 0x3, 0x33, 0x02, 0, 0x0c3a0000, 3,  0x00040000 },
1188 	{ 0x3, 0x33, 0x03, 0, 0x0c380000, 2,  0x00020000 },
1189 	{ 0x3, 0x38, 0x00, 0, 0x0c600000, 0,  0x00000000 },
1190 	{ 0x3, 0x38, 0x01, 0, 0x00000000, 0,  0x00000000 },
1191 	{ 0x3, 0x39, 0x00, 0, 0x0c280000, 0,  0x00000000 }
1192 };
1193 
1194 /*
1195  * SCE/RCE NOC aperture lookup table as per file "AON_NOC_Structure.info".
1196  */
1197 static const char * const tegra194_scenoc_routeid_initflow[] = {
1198 	[0x0] = "cbb_i/I/0",
1199 	[0x1] = "cpu_m_i/I/0",
1200 	[0x2] = "cpu_p_i/I/0",
1201 	[0x3] = "dma_m_i/I/0",
1202 	[0x4] = "dma_p_i/I/0",
1203 	[0x5] = "RESERVED",
1204 	[0x6] = "RESERVED",
1205 	[0x7] = "RESERVED"
1206 };
1207 
1208 static const char * const tegra194_scenoc_routeid_targflow[] = {
1209 	[0x00] = "multiport0_t/T/atcm_cfg",
1210 	[0x01] = "multiport0_t/T/car",
1211 	[0x02] = "multiport0_t/T/cast",
1212 	[0x03] = "multiport0_t/T/cfg",
1213 	[0x04] = "multiport0_t/T/dast",
1214 	[0x05] = "multiport0_t/T/dma",
1215 	[0x06] = "multiport0_t/T/err_collator",
1216 	[0x07] = "multiport0_t/T/err_collator_car",
1217 	[0x08] = "multiport0_t/T/fpga_misc",
1218 	[0x09] = "multiport0_t/T/fpga_uart",
1219 	[0x0a] = "multiport0_t/T/gte",
1220 	[0x0b] = "multiport0_t/T/hsp",
1221 	[0x0c] = "multiport0_t/T/misc",
1222 	[0x0d] = "multiport0_t/T/pm",
1223 	[0x0e] = "multiport0_t/T/tke",
1224 	[0x0f] = "RESERVED",
1225 	[0x10] = "multiport1_t/T/hsm",
1226 	[0x11] = "multiport1_t/T/vic0",
1227 	[0x12] = "multiport1_t/T/vic1",
1228 	[0x13] = "ast0_t/T/0",
1229 	[0x14] = "ast1_t/T/0",
1230 	[0x15] = "cbb_t/T/0",
1231 	[0x16] = "cpu_t/T/0",
1232 	[0x17] = "sce_noc_firewall/T/0",
1233 	[0x18] = "svc_t/T/0",
1234 	[0x19] = "RESERVED",
1235 	[0x1a] = "RESERVED",
1236 	[0x1b] = "RESERVED",
1237 	[0x1c] = "RESERVED",
1238 	[0x1d] = "RESERVED",
1239 	[0x1e] = "RESERVED",
1240 	[0x1f] = "RESERVED"
1241 };
1242 
1243 /*
1244  * Fields of SCE/RCE NOC lookup table:
1245  * Init flow, Targ flow, Targ subrange, Init mapping, Init localAddress,
1246  *                                              Targ mapping, Targ localAddress
1247  * ----------------------------------------------------------------------------
1248  */
1249 static const struct tegra194_cbb_aperture tegra194_scenoc_apert_lookup[] = {
1250 	{ 0x0, 0x16, 0x0,  0, 0x0b400000, 0,  0x0b400000 },
1251 	{ 0x0, 0x16, 0x1,  0, 0x0bc00000, 1,  0x0bc00000 },
1252 	{ 0x0, 0x0,  0x0,  0, 0x0b000000, 0,  0x00000000 },
1253 	{ 0x0, 0x0,  0x1,  0, 0x0b800000, 1,  0x00000000 },
1254 	{ 0x0, 0x1,  0x0,  0, 0x20de0000, 3,  0x000e0000 },
1255 	{ 0x0, 0x1,  0x1,  0, 0x210e0000, 7,  0x000e0000 },
1256 	{ 0x0, 0x1,  0x2,  0, 0x20dc0000, 2,  0x000c0000 },
1257 	{ 0x0, 0x1,  0x3,  0, 0x210c0000, 6,  0x000c0000 },
1258 	{ 0x0, 0x1,  0x4,  0, 0x20d80000, 1,  0x00080000 },
1259 	{ 0x0, 0x1,  0x5,  0, 0x21080000, 5,  0x00080000 },
1260 	{ 0x0, 0x1,  0x6,  0, 0x20d00000, 0,  0x00000000 },
1261 	{ 0x0, 0x1,  0x7,  0, 0x21000000, 4,  0x00000000 },
1262 	{ 0x0, 0x2,  0x0,  0, 0x0b040000, 0,  0x00000000 },
1263 	{ 0x0, 0x2,  0x1,  0, 0x0b840000, 1,  0x00000000 },
1264 	{ 0x0, 0x3,  0x0,  0, 0x0b230000, 0,  0x00000000 },
1265 	{ 0x0, 0x3,  0x1,  0, 0x0ba30000, 1,  0x00000000 },
1266 	{ 0x0, 0x4,  0x0,  0, 0x0b050000, 0,  0x00000000 },
1267 	{ 0x0, 0x4,  0x1,  0, 0x0b850000, 1,  0x00000000 },
1268 	{ 0x0, 0x5,  0x0,  0, 0x0b060000, 0,  0x00000000 },
1269 	{ 0x0, 0x5,  0x1,  0, 0x0b070000, 1,  0x00010000 },
1270 	{ 0x0, 0x5,  0x2,  0, 0x0b080000, 2,  0x00020000 },
1271 	{ 0x0, 0x5,  0x3,  0, 0x0b090000, 3,  0x00030000 },
1272 	{ 0x0, 0x5,  0x4,  0, 0x0b0a0000, 4,  0x00040000 },
1273 	{ 0x0, 0x5,  0x5,  0, 0x0b0b0000, 5,  0x00050000 },
1274 	{ 0x0, 0x5,  0x6,  0, 0x0b0c0000, 6,  0x00060000 },
1275 	{ 0x0, 0x5,  0x7,  0, 0x0b0d0000, 7,  0x00070000 },
1276 	{ 0x0, 0x5,  0x8,  0, 0x0b0e0000, 8,  0x00080000 },
1277 	{ 0x0, 0x5,  0x9,  0, 0x0b860000, 9,  0x00000000 },
1278 	{ 0x0, 0x5,  0xa,  0, 0x0b870000, 10, 0x00010000 },
1279 	{ 0x0, 0x5,  0xb,  0, 0x0b880000, 11, 0x00020000 },
1280 	{ 0x0, 0x5,  0xc,  0, 0x0b890000, 12, 0x00030000 },
1281 	{ 0x0, 0x5,  0xd,  0, 0x0b8a0000, 13, 0x00040000 },
1282 	{ 0x0, 0x5,  0xe,  0, 0x0b8b0000, 14, 0x00050000 },
1283 	{ 0x0, 0x5,  0xf,  0, 0x0b8c0000, 15, 0x00060000 },
1284 	{ 0x0, 0x5,  0x10, 0, 0x0b8d0000, 16, 0x00070000 },
1285 	{ 0x0, 0x5,  0x11, 0, 0x0b8e0000, 17, 0x00080000 },
1286 	{ 0x0, 0x6,  0x0,  0, 0x0b650000, 0,  0x00000000 },
1287 	{ 0x0, 0x6,  0x1,  0, 0x0be50000, 1,  0x00000000 },
1288 	{ 0x0, 0x7,  0x0,  0, 0x20df0000, 0,  0x00000000 },
1289 	{ 0x0, 0x7,  0x1,  0, 0x210f0000, 1,  0x00000000 },
1290 	{ 0x0, 0x8,  0x0,  0, 0x0b3e0000, 0,  0x00000000 },
1291 	{ 0x0, 0x8,  0x1,  0, 0x0bbe0000, 1,  0x00000000 },
1292 	{ 0x0, 0x9,  0x0,  0, 0x0b3d0000, 0,  0x00000000 },
1293 	{ 0x0, 0x9,  0x1,  0, 0x0bbd0000, 1,  0x00000000 },
1294 	{ 0x0, 0xa,  0x0,  0, 0x0b1e0000, 0,  0x00000000 },
1295 	{ 0x0, 0xa,  0x1,  0, 0x0b9e0000, 1,  0x00000000 },
1296 	{ 0x0, 0xb,  0x0,  0, 0x0b150000, 0,  0x00000000 },
1297 	{ 0x0, 0xb,  0x1,  0, 0x0b160000, 1,  0x00010000 },
1298 	{ 0x0, 0xb,  0x2,  0, 0x0b170000, 2,  0x00020000 },
1299 	{ 0x0, 0xb,  0x3,  0, 0x0b180000, 3,  0x00030000 },
1300 	{ 0x0, 0xb,  0x4,  0, 0x0b190000, 4,  0x00040000 },
1301 	{ 0x0, 0xb,  0x5,  0, 0x0b1a0000, 5,  0x00050000 },
1302 	{ 0x0, 0xb,  0x6,  0, 0x0b1b0000, 6,  0x00060000 },
1303 	{ 0x0, 0xb,  0x7,  0, 0x0b1c0000, 7,  0x00070000 },
1304 	{ 0x0, 0xb,  0x8,  0, 0x0b1d0000, 8,  0x00080000 },
1305 	{ 0x0, 0xb,  0x9,  0, 0x0b950000, 9,  0x00000000 },
1306 	{ 0x0, 0xb,  0xa,  0, 0x0b960000, 10, 0x00010000 },
1307 	{ 0x0, 0xb,  0xb,  0, 0x0b970000, 11, 0x00020000 },
1308 	{ 0x0, 0xb,  0xc,  0, 0x0b980000, 12, 0x00030000 },
1309 	{ 0x0, 0xb,  0xd,  0, 0x0b990000, 13, 0x00040000 },
1310 	{ 0x0, 0xb,  0xe,  0, 0x0b9a0000, 14, 0x00050000 },
1311 	{ 0x0, 0xb,  0xf,  0, 0x0b9b0000, 15, 0x00060000 },
1312 	{ 0x0, 0xb,  0x10, 0, 0x0b9c0000, 16, 0x00070000 },
1313 	{ 0x0, 0xb,  0x11, 0, 0x0b9d0000, 17, 0x00080000 },
1314 	{ 0x0, 0xc,  0x0,  0, 0x0b660000, 0,  0x00000000 },
1315 	{ 0x0, 0xc,  0x1,  0, 0x0be60000, 1,  0x00000000 },
1316 	{ 0x0, 0xd,  0x0,  0, 0x0b1f0000, 0,  0x00000000 },
1317 	{ 0x0, 0xd,  0x1,  0, 0x0b200000, 1,  0x00010000 },
1318 	{ 0x0, 0xd,  0x2,  0, 0x0b210000, 2,  0x00020000 },
1319 	{ 0x0, 0xd,  0x3,  0, 0x0b220000, 3,  0x00030000 },
1320 	{ 0x0, 0xd,  0x4,  0, 0x0b9f0000, 4,  0x00000000 },
1321 	{ 0x0, 0xd,  0x5,  0, 0x0ba00000, 5,  0x00010000 },
1322 	{ 0x0, 0xd,  0x6,  0, 0x0ba10000, 6,  0x00020000 },
1323 	{ 0x0, 0xd,  0x7,  0, 0x0ba20000, 7,  0x00030000 },
1324 	{ 0x0, 0xe,  0x0,  0, 0x0b0f0000, 0,  0x00000000 },
1325 	{ 0x0, 0xe,  0x1,  0, 0x0b100000, 1,  0x00010000 },
1326 	{ 0x0, 0xe,  0x2,  0, 0x0b110000, 2,  0x00020000 },
1327 	{ 0x0, 0xe,  0x3,  0, 0x0b120000, 3,  0x00030000 },
1328 	{ 0x0, 0xe,  0x4,  0, 0x0b130000, 4,  0x00040000 },
1329 	{ 0x0, 0xe,  0x5,  0, 0x0b140000, 5,  0x00050000 },
1330 	{ 0x0, 0xe,  0x6,  0, 0x0b8f0000, 6,  0x00000000 },
1331 	{ 0x0, 0xe,  0x7,  0, 0x0b900000, 7,  0x00010000 },
1332 	{ 0x0, 0xe,  0x8,  0, 0x0b910000, 8,  0x00020000 },
1333 	{ 0x0, 0xe,  0x9,  0, 0x0b920000, 9,  0x00030000 },
1334 	{ 0x0, 0xe,  0xa,  0, 0x0b930000, 10, 0x00040000 },
1335 	{ 0x0, 0xe,  0xb,  0, 0x0b940000, 11, 0x00050000 },
1336 	{ 0x0, 0x10, 0x0,  0, 0x0b240000, 0,  0x00000000 },
1337 	{ 0x0, 0x10, 0x1,  0, 0x0ba40000, 1,  0x00000000 },
1338 	{ 0x0, 0x11, 0x0,  0, 0x0b020000, 0,  0x00000000 },
1339 	{ 0x0, 0x11, 0x1,  0, 0x0b820000, 1,  0x00000000 },
1340 	{ 0x0, 0x12, 0x0,  0, 0x0b030000, 0,  0x00000000 },
1341 	{ 0x0, 0x12, 0x1,  0, 0x0b830000, 1,  0x00000000 },
1342 	{ 0x0, 0x17, 0x0,  0, 0x0b640000, 0,  0x00000000 },
1343 	{ 0x0, 0x17, 0x1,  0, 0x0be40000, 1,  0x00000000 },
1344 	{ 0x0, 0x18, 0x0,  0, 0x0b600000, 0,  0x00000000 },
1345 	{ 0x0, 0x18, 0x1,  0, 0x0be00000, 1,  0x00000000 },
1346 	{ 0x0, 0x18, 0x2,  0, 0x00000000, 0,  0x00000000 },
1347 	{ 0x0, 0x18, 0x3,  0, 0x00000000, 0,  0x00000000 },
1348 	{ 0x1, 0x13, 0x0,  0, 0x40000000, 0,  0x40000000 },
1349 	{ 0x1, 0x13, 0x1,  1, 0x80000000, 1,  0x80000000 },
1350 	{ 0x1, 0x13, 0x2,  0, 0x00000000, 0,  0x00000000 },
1351 	{ 0x2, 0x15, 0x0,  0, 0x20c00000, 8,  0x20c00000 },
1352 	{ 0x2, 0x15, 0x1,  0, 0x21100000, 22, 0x21100000 },
1353 	{ 0x2, 0x15, 0x2,  0, 0x20e00000, 9,  0x20e00000 },
1354 	{ 0x2, 0x15, 0x3,  0, 0x21200000, 23, 0x21200000 },
1355 	{ 0x2, 0x15, 0x4,  0, 0x20800000, 7,  0x20800000 },
1356 	{ 0x2, 0x15, 0x5,  0, 0x21400000, 24, 0x21400000 },
1357 	{ 0x2, 0x15, 0x6,  0, 0x0b000000, 18, 0x0b000000 },
1358 	{ 0x2, 0x15, 0x7,  0, 0x0b800000, 3,  0x0b800000 },
1359 	{ 0x2, 0x15, 0x8,  0, 0x20000000, 6,  0x20000000 },
1360 	{ 0x2, 0x15, 0x9,  0, 0x21800000, 25, 0x21800000 },
1361 	{ 0x2, 0x15, 0xa,  0, 0x0a000000, 2,  0x0a000000 },
1362 	{ 0x2, 0x15, 0xb,  0, 0x0a000000, 17, 0x0a000000 },
1363 	{ 0x2, 0x15, 0xc,  0, 0x20000000, 21, 0x20000000 },
1364 	{ 0x2, 0x15, 0xd,  0, 0x21000000, 10, 0x21000000 },
1365 	{ 0x2, 0x15, 0xe,  0, 0x08000000, 1,  0x08000000 },
1366 	{ 0x2, 0x15, 0xf,  0, 0x08000000, 16, 0x08000000 },
1367 	{ 0x2, 0x15, 0x10, 0, 0x22000000, 11, 0x22000000 },
1368 	{ 0x2, 0x15, 0x11, 0, 0x22000000, 26, 0x22000000 },
1369 	{ 0x2, 0x15, 0x12, 0, 0x0c000000, 4,  0x0c000000 },
1370 	{ 0x2, 0x15, 0x13, 0, 0x0c000000, 19, 0x0c000000 },
1371 	{ 0x2, 0x15, 0x14, 0, 0x24000000, 12, 0x24000000 },
1372 	{ 0x2, 0x15, 0x15, 0, 0x24000000, 27, 0x24000000 },
1373 	{ 0x2, 0x15, 0x16, 0, 0x00000000, 0,  0x00000000 },
1374 	{ 0x2, 0x15, 0x17, 0, 0x00000000, 15, 0x00000000 },
1375 	{ 0x2, 0x15, 0x18, 0, 0x28000000, 13, 0x28000000 },
1376 	{ 0x2, 0x15, 0x19, 0, 0x28000000, 28, 0x28000000 },
1377 	{ 0x2, 0x15, 0x1a, 0, 0x10000000, 5,  0x10000000 },
1378 	{ 0x2, 0x15, 0x1b, 0, 0x10000000, 20, 0x10000000 },
1379 	{ 0x2, 0x15, 0x1c, 0, 0x30000000, 14, 0x30000000 },
1380 	{ 0x2, 0x15, 0x1d, 0, 0x30000000, 29, 0x30000000 },
1381 	{ 0x2, 0x0,  0x0,  0, 0x0b000000, 0,  0x00000000 },
1382 	{ 0x2, 0x0,  0x1,  0, 0x0b800000, 1,  0x00000000 },
1383 	{ 0x2, 0x1,  0x0,  0, 0x20de0000, 3,  0x000e0000 },
1384 	{ 0x2, 0x1,  0x1,  0, 0x210e0000, 7,  0x000e0000 },
1385 	{ 0x2, 0x1,  0x2,  0, 0x20dc0000, 2,  0x000c0000 },
1386 	{ 0x2, 0x1,  0x3,  0, 0x210c0000, 6,  0x000c0000 },
1387 	{ 0x2, 0x1,  0x4,  0, 0x20d80000, 1,  0x00080000 },
1388 	{ 0x2, 0x1,  0x5,  0, 0x21080000, 5,  0x00080000 },
1389 	{ 0x2, 0x1,  0x6,  0, 0x20d00000, 0,  0x00000000 },
1390 	{ 0x2, 0x1,  0x7,  0, 0x21000000, 4,  0x00000000 },
1391 	{ 0x2, 0x2,  0x0,  0, 0x0b040000, 0,  0x00000000 },
1392 	{ 0x2, 0x2,  0x1,  0, 0x0b840000, 1,  0x00000000 },
1393 	{ 0x2, 0x3,  0x0,  0, 0x0b230000, 0,  0x00000000 },
1394 	{ 0x2, 0x3,  0x1,  0, 0x0ba30000, 1,  0x00000000 },
1395 	{ 0x2, 0x4,  0x0,  0, 0x0b050000, 0,  0x00000000 },
1396 	{ 0x2, 0x4,  0x1,  0, 0x0b850000, 1,  0x00000000 },
1397 	{ 0x2, 0x5,  0x0,  0, 0x0b060000, 0,  0x00000000 },
1398 	{ 0x2, 0x5,  0x1,  0, 0x0b070000, 1,  0x00010000 },
1399 	{ 0x2, 0x5,  0x2,  0, 0x0b080000, 2,  0x00020000 },
1400 	{ 0x2, 0x5,  0x3,  0, 0x0b090000, 3,  0x00030000 },
1401 	{ 0x2, 0x5,  0x4,  0, 0x0b0a0000, 4,  0x00040000 },
1402 	{ 0x2, 0x5,  0x5,  0, 0x0b0b0000, 5,  0x00050000 },
1403 	{ 0x2, 0x5,  0x6,  0, 0x0b0c0000, 6,  0x00060000 },
1404 	{ 0x2, 0x5,  0x7,  0, 0x0b0d0000, 7,  0x00070000 },
1405 	{ 0x2, 0x5,  0x8,  0, 0x0b0e0000, 8,  0x00080000 },
1406 	{ 0x2, 0x5,  0x9,  0, 0x0b860000, 9,  0x00000000 },
1407 	{ 0x2, 0x5,  0xa,  0, 0x0b870000, 10, 0x00010000 },
1408 	{ 0x2, 0x5,  0xb,  0, 0x0b880000, 11, 0x00020000 },
1409 	{ 0x2, 0x5,  0xc,  0, 0x0b890000, 12, 0x00030000 },
1410 	{ 0x2, 0x5,  0xd,  0, 0x0b8a0000, 13, 0x00040000 },
1411 	{ 0x2, 0x5,  0xe,  0, 0x0b8b0000, 14, 0x00050000 },
1412 	{ 0x2, 0x5,  0xf,  0, 0x0b8c0000, 15, 0x00060000 },
1413 	{ 0x2, 0x5,  0x10, 0, 0x0b8d0000, 16, 0x00070000 },
1414 	{ 0x2, 0x5,  0x11, 0, 0x0b8e0000, 17, 0x00080000 },
1415 	{ 0x2, 0x6,  0x0,  0, 0x0b650000, 0,  0x00000000 },
1416 	{ 0x2, 0x6,  0x1,  0, 0x0be50000, 1,  0x00000000 },
1417 	{ 0x2, 0x7,  0x0,  0, 0x20df0000, 0,  0x00000000 },
1418 	{ 0x2, 0x7,  0x1,  0, 0x210f0000, 1,  0x00000000 },
1419 	{ 0x2, 0x8,  0x0,  0, 0x0b3e0000, 0,  0x00000000 },
1420 	{ 0x2, 0x8,  0x1,  0, 0x0bbe0000, 1,  0x00000000 },
1421 	{ 0x2, 0x9,  0x0,  0, 0x0b3d0000, 0,  0x00000000 },
1422 	{ 0x2, 0x9,  0x1,  0, 0x0bbd0000, 1,  0x00000000 },
1423 	{ 0x2, 0xa,  0x0,  0, 0x0b1e0000, 0,  0x00000000 },
1424 	{ 0x2, 0xa,  0x1,  0, 0x0b9e0000, 1,  0x00000000 },
1425 	{ 0x2, 0xb,  0x0,  0, 0x0b150000, 0,  0x00000000 },
1426 	{ 0x2, 0xb,  0x1,  0, 0x0b160000, 1,  0x00010000 },
1427 	{ 0x2, 0xb,  0x2,  0, 0x0b170000, 2,  0x00020000 },
1428 	{ 0x2, 0xb,  0x3,  0, 0x0b180000, 3,  0x00030000 },
1429 	{ 0x2, 0xb,  0x4,  0, 0x0b190000, 4,  0x00040000 },
1430 	{ 0x2, 0xb,  0x5,  0, 0x0b1a0000, 5,  0x00050000 },
1431 	{ 0x2, 0xb,  0x6,  0, 0x0b1b0000, 6,  0x00060000 },
1432 	{ 0x2, 0xb,  0x7,  0, 0x0b1c0000, 7,  0x00070000 },
1433 	{ 0x2, 0xb,  0x8,  0, 0x0b1d0000, 8,  0x00080000 },
1434 	{ 0x2, 0xb,  0x9,  0, 0x0b950000, 9,  0x00000000 },
1435 	{ 0x2, 0xb,  0xa,  0, 0x0b960000, 10, 0x00010000 },
1436 	{ 0x2, 0xb,  0xb,  0, 0x0b970000, 11, 0x00020000 },
1437 	{ 0x2, 0xb,  0xc,  0, 0x0b980000, 12, 0x00030000 },
1438 	{ 0x2, 0xb,  0xd,  0, 0x0b990000, 13, 0x00040000 },
1439 	{ 0x2, 0xb,  0xe,  0, 0x0b9a0000, 14, 0x00050000 },
1440 	{ 0x2, 0xb,  0xf,  0, 0x0b9b0000, 15, 0x00060000 },
1441 	{ 0x2, 0xb,  0x10, 0, 0x0b9c0000, 16, 0x00070000 },
1442 	{ 0x2, 0xb,  0x11, 0, 0x0b9d0000, 17, 0x00080000 },
1443 	{ 0x2, 0xc,  0x0,  0, 0x0b660000, 0,  0x00000000 },
1444 	{ 0x2, 0xc,  0x1,  0, 0x0be60000, 1,  0x00000000 },
1445 	{ 0x2, 0xd,  0x0,  0, 0x0b1f0000, 0,  0x00000000 },
1446 	{ 0x2, 0xd,  0x1,  0, 0x0b200000, 1,  0x00010000 },
1447 	{ 0x2, 0xd,  0x2,  0, 0x0b210000, 2,  0x00020000 },
1448 	{ 0x2, 0xd,  0x3,  0, 0x0b220000, 3,  0x00030000 },
1449 	{ 0x2, 0xd,  0x4,  0, 0x0b9f0000, 4,  0x00000000 },
1450 	{ 0x2, 0xd,  0x5,  0, 0x0ba00000, 5,  0x00010000 },
1451 	{ 0x2, 0xd,  0x6,  0, 0x0ba10000, 6,  0x00020000 },
1452 	{ 0x2, 0xd,  0x7,  0, 0x0ba20000, 7,  0x00030000 },
1453 	{ 0x2, 0xe,  0x0,  0, 0x0b0f0000, 0,  0x00000000 },
1454 	{ 0x2, 0xe,  0x1,  0, 0x0b100000, 1,  0x00010000 },
1455 	{ 0x2, 0xe,  0x2,  0, 0x0b110000, 2,  0x00020000 },
1456 	{ 0x2, 0xe,  0x3,  0, 0x0b120000, 3,  0x00030000 },
1457 	{ 0x2, 0xe,  0x4,  0, 0x0b130000, 4,  0x00040000 },
1458 	{ 0x2, 0xe,  0x5,  0, 0x0b140000, 5,  0x00050000 },
1459 	{ 0x2, 0xe,  0x6,  0, 0x0b8f0000, 6,  0x00000000 },
1460 	{ 0x2, 0xe,  0x7,  0, 0x0b900000, 7,  0x00010000 },
1461 	{ 0x2, 0xe,  0x8,  0, 0x0b910000, 8,  0x00020000 },
1462 	{ 0x2, 0xe,  0x9,  0, 0x0b920000, 9,  0x00030000 },
1463 	{ 0x2, 0xe,  0xa,  0, 0x0b930000, 10, 0x00040000 },
1464 	{ 0x2, 0xe,  0xb,  0, 0x0b940000, 11, 0x00050000 },
1465 	{ 0x2, 0x10, 0x0,  0, 0x0b240000, 0,  0x00000000 },
1466 	{ 0x2, 0x10, 0x1,  0, 0x0ba40000, 1,  0x00000000 },
1467 	{ 0x2, 0x11, 0x0,  0, 0x0b020000, 0,  0x00000000 },
1468 	{ 0x2, 0x11, 0x1,  0, 0x0b820000, 1,  0x00000000 },
1469 	{ 0x2, 0x12, 0x0,  0, 0x0b030000, 0,  0x00000000 },
1470 	{ 0x2, 0x12, 0x1,  0, 0x0b830000, 1,  0x00000000 },
1471 	{ 0x2, 0x17, 0x0,  0, 0x0b640000, 0,  0x00000000 },
1472 	{ 0x2, 0x17, 0x1,  0, 0x0be40000, 1,  0x00000000 },
1473 	{ 0x2, 0x18, 0x0,  0, 0x0b600000, 0,  0x00000000 },
1474 	{ 0x2, 0x18, 0x1,  0, 0x0be00000, 1,  0x00000000 },
1475 	{ 0x2, 0x18, 0x2,  0, 0x00000000, 0,  0x00000000 },
1476 	{ 0x2, 0x18, 0x3,  0, 0x00000000, 0,  0x00000000 },
1477 	{ 0x3, 0x14, 0x0,  0, 0x40000000, 0,  0x40000000 },
1478 	{ 0x3, 0x14, 0x1,  1, 0x80000000, 1,  0x80000000 },
1479 	{ 0x3, 0x16, 0x0,  2, 0x0b400000, 0,  0x0b400000 },
1480 	{ 0x3, 0x16, 0x1,  2, 0x0bc00000, 1,  0x0bc00000 },
1481 	{ 0x3, 0x16, 0x2,  0, 0x00000000, 0,  0x00000000 },
1482 	{ 0x3, 0x16, 0x3,  0, 0x00000000, 0,  0x00000000 },
1483 	{ 0x4, 0x15, 0x0,  0, 0x20c00000, 8,  0x20c00000 },
1484 	{ 0x4, 0x15, 0x1,  0, 0x21100000, 22, 0x21100000 },
1485 	{ 0x4, 0x15, 0x2,  0, 0x20e00000, 9,  0x20e00000 },
1486 	{ 0x4, 0x15, 0x3,  0, 0x21200000, 23, 0x21200000 },
1487 	{ 0x4, 0x15, 0x4,  0, 0x20800000, 7,  0x20800000 },
1488 	{ 0x4, 0x15, 0x5,  0, 0x21400000, 24, 0x21400000 },
1489 	{ 0x4, 0x15, 0x6,  0, 0x0b000000, 18, 0x0b000000 },
1490 	{ 0x4, 0x15, 0x7,  0, 0x0b800000, 3,  0x0b800000 },
1491 	{ 0x4, 0x15, 0x8,  0, 0x20000000, 6,  0x20000000 },
1492 	{ 0x4, 0x15, 0x9,  0, 0x21800000, 25, 0x21800000 },
1493 	{ 0x4, 0x15, 0xa,  0, 0x0a000000, 2,  0x0a000000 },
1494 	{ 0x4, 0x15, 0xb,  0, 0x0a000000, 17, 0x0a000000 },
1495 	{ 0x4, 0x15, 0xc,  0, 0x20000000, 21, 0x20000000 },
1496 	{ 0x4, 0x15, 0xd,  0, 0x21000000, 10, 0x21000000 },
1497 	{ 0x4, 0x15, 0xe,  0, 0x08000000, 1,  0x08000000 },
1498 	{ 0x4, 0x15, 0xf,  0, 0x08000000, 16, 0x08000000 },
1499 	{ 0x4, 0x15, 0x10, 0, 0x22000000, 11, 0x22000000 },
1500 	{ 0x4, 0x15, 0x11, 0, 0x22000000, 26, 0x22000000 },
1501 	{ 0x4, 0x15, 0x12, 0, 0x0c000000, 4,  0x0c000000 },
1502 	{ 0x4, 0x15, 0x13, 0, 0x0c000000, 19, 0x0c000000 },
1503 	{ 0x4, 0x15, 0x14, 0, 0x24000000, 12, 0x24000000 },
1504 	{ 0x4, 0x15, 0x15, 0, 0x24000000, 27, 0x24000000 },
1505 	{ 0x4, 0x15, 0x16, 0, 0x00000000, 0,  0x00000000 },
1506 	{ 0x4, 0x15, 0x17, 0, 0x00000000, 15, 0x00000000 },
1507 	{ 0x4, 0x15, 0x18, 0, 0x28000000, 13, 0x28000000 },
1508 	{ 0x4, 0x15, 0x19, 0, 0x28000000, 28, 0x28000000 },
1509 	{ 0x4, 0x15, 0x1a, 0, 0x10000000, 5,  0x10000000 },
1510 	{ 0x4, 0x15, 0x1b, 0, 0x10000000, 20, 0x10000000 },
1511 	{ 0x4, 0x15, 0x1c, 0, 0x30000000, 14, 0x30000000 },
1512 	{ 0x4, 0x15, 0x1d, 0, 0x30000000, 29, 0x30000000 },
1513 	{ 0x4, 0x0,  0x0,  0, 0x0b000000, 0,  0x00000000 },
1514 	{ 0x4, 0x0,  0x1,  0, 0x0b800000, 1,  0x00000000 },
1515 	{ 0x4, 0x1,  0x0,  0, 0x20de0000, 3,  0x000e0000 },
1516 	{ 0x4, 0x1,  0x1,  0, 0x210e0000, 7,  0x000e0000 },
1517 	{ 0x4, 0x1,  0x2,  0, 0x20dc0000, 2,  0x000c0000 },
1518 	{ 0x4, 0x1,  0x3,  0, 0x210c0000, 6,  0x000c0000 },
1519 	{ 0x4, 0x1,  0x4,  0, 0x20d80000, 1,  0x00080000 },
1520 	{ 0x4, 0x1,  0x5,  0, 0x21080000, 5,  0x00080000 },
1521 	{ 0x4, 0x1,  0x6,  0, 0x20d00000, 0,  0x00000000 },
1522 	{ 0x4, 0x1,  0x7,  0, 0x21000000, 4,  0x00000000 },
1523 	{ 0x4, 0x2,  0x0,  0, 0x0b040000, 0,  0x00000000 },
1524 	{ 0x4, 0x2,  0x1,  0, 0x0b840000, 1,  0x00000000 },
1525 	{ 0x4, 0x3,  0x0,  0, 0x0b230000, 0,  0x00000000 },
1526 	{ 0x4, 0x3,  0x1,  0, 0x0ba30000, 1,  0x00000000 },
1527 	{ 0x4, 0x4,  0x0,  0, 0x0b050000, 0,  0x00000000 },
1528 	{ 0x4, 0x4,  0x1,  0, 0x0b850000, 1,  0x00000000 },
1529 	{ 0x4, 0x5,  0x0,  0, 0x0b060000, 0,  0x00000000 },
1530 	{ 0x4, 0x5,  0x1,  0, 0x0b070000, 1,  0x00010000 },
1531 	{ 0x4, 0x5,  0x2,  0, 0x0b080000, 2,  0x00020000 },
1532 	{ 0x4, 0x5,  0x3,  0, 0x0b090000, 3,  0x00030000 },
1533 	{ 0x4, 0x5,  0x4,  0, 0x0b0a0000, 4,  0x00040000 },
1534 	{ 0x4, 0x5,  0x5,  0, 0x0b0b0000, 5,  0x00050000 },
1535 	{ 0x4, 0x5,  0x6,  0, 0x0b0c0000, 6,  0x00060000 },
1536 	{ 0x4, 0x5,  0x7,  0, 0x0b0d0000, 7,  0x00070000 },
1537 	{ 0x4, 0x5,  0x8,  0, 0x0b0e0000, 8,  0x00080000 },
1538 	{ 0x4, 0x5,  0x9,  0, 0x0b860000, 9,  0x00000000 },
1539 	{ 0x4, 0x5,  0xa,  0, 0x0b870000, 10, 0x00010000 },
1540 	{ 0x4, 0x5,  0xb,  0, 0x0b880000, 11, 0x00020000 },
1541 	{ 0x4, 0x5,  0xc,  0, 0x0b890000, 12, 0x00030000 },
1542 	{ 0x4, 0x5,  0xd,  0, 0x0b8a0000, 13, 0x00040000 },
1543 	{ 0x4, 0x5,  0xe,  0, 0x0b8b0000, 14, 0x00050000 },
1544 	{ 0x4, 0x5,  0xf,  0, 0x0b8c0000, 15, 0x00060000 },
1545 	{ 0x4, 0x5,  0x10, 0, 0x0b8d0000, 16, 0x00070000 },
1546 	{ 0x4, 0x5,  0x11, 0, 0x0b8e0000, 17, 0x00080000 },
1547 	{ 0x4, 0x6,  0x0,  0, 0x0b650000, 0,  0x00000000 },
1548 	{ 0x4, 0x6,  0x1,  0, 0x0be50000, 1,  0x00000000 },
1549 	{ 0x4, 0x7,  0x0,  0, 0x20df0000, 0,  0x00000000 },
1550 	{ 0x4, 0x7,  0x1,  0, 0x210f0000, 1,  0x00000000 },
1551 	{ 0x4, 0x8,  0x0,  0, 0x0b3e0000, 0,  0x00000000 },
1552 	{ 0x4, 0x8,  0x1,  0, 0x0bbe0000, 1,  0x00000000 },
1553 	{ 0x4, 0x9,  0x0,  0, 0x0b3d0000, 0,  0x00000000 },
1554 	{ 0x4, 0x9,  0x1,  0, 0x0bbd0000, 1,  0x00000000 },
1555 	{ 0x4, 0xa,  0x0,  0, 0x0b1e0000, 0,  0x00000000 },
1556 	{ 0x4, 0xa,  0x1,  0, 0x0b9e0000, 1,  0x00000000 },
1557 	{ 0x4, 0xb,  0x0,  0, 0x0b150000, 0,  0x00000000 },
1558 	{ 0x4, 0xb,  0x1,  0, 0x0b160000, 1,  0x00010000 },
1559 	{ 0x4, 0xb,  0x2,  0, 0x0b170000, 2,  0x00020000 },
1560 	{ 0x4, 0xb,  0x3,  0, 0x0b180000, 3,  0x00030000 },
1561 	{ 0x4, 0xb,  0x4,  0, 0x0b190000, 4,  0x00040000 },
1562 	{ 0x4, 0xb,  0x5,  0, 0x0b1a0000, 5,  0x00050000 },
1563 	{ 0x4, 0xb,  0x6,  0, 0x0b1b0000, 6,  0x00060000 },
1564 	{ 0x4, 0xb,  0x7,  0, 0x0b1c0000, 7,  0x00070000 },
1565 	{ 0x4, 0xb,  0x8,  0, 0x0b1d0000, 8,  0x00080000 },
1566 	{ 0x4, 0xb,  0x9,  0, 0x0b950000, 9,  0x00000000 },
1567 	{ 0x4, 0xb,  0xa,  0, 0x0b960000, 10, 0x00010000 },
1568 	{ 0x4, 0xb,  0xb,  0, 0x0b970000, 11, 0x00020000 },
1569 	{ 0x4, 0xb,  0xc,  0, 0x0b980000, 12, 0x00030000 },
1570 	{ 0x4, 0xb,  0xd,  0, 0x0b990000, 13, 0x00040000 },
1571 	{ 0x4, 0xb,  0xe,  0, 0x0b9a0000, 14, 0x00050000 },
1572 	{ 0x4, 0xb,  0xf,  0, 0x0b9b0000, 15, 0x00060000 },
1573 	{ 0x4, 0xb,  0x10, 0, 0x0b9c0000, 16, 0x00070000 },
1574 	{ 0x4, 0xb,  0x11, 0, 0x0b9d0000, 17, 0x00080000 },
1575 	{ 0x4, 0xc,  0x0,  0, 0x0b660000, 0,  0x00000000 },
1576 	{ 0x4, 0xc,  0x1,  0, 0x0be60000, 1,  0x00000000 },
1577 	{ 0x4, 0xd,  0x0,  0, 0x0b1f0000, 0,  0x00000000 },
1578 	{ 0x4, 0xd,  0x1,  0, 0x0b200000, 1,  0x00010000 },
1579 	{ 0x4, 0xd,  0x2,  0, 0x0b210000, 2,  0x00020000 },
1580 	{ 0x4, 0xd,  0x3,  0, 0x0b220000, 3,  0x00030000 },
1581 	{ 0x4, 0xd,  0x4,  0, 0x0b9f0000, 4,  0x00000000 },
1582 	{ 0x4, 0xd,  0x5,  0, 0x0ba00000, 5,  0x00010000 },
1583 	{ 0x4, 0xd,  0x6,  0, 0x0ba10000, 6,  0x00020000 },
1584 	{ 0x4, 0xd,  0x7,  0, 0x0ba20000, 7,  0x00030000 },
1585 	{ 0x4, 0xe,  0x0,  0, 0x0b0f0000, 0,  0x00000000 },
1586 	{ 0x4, 0xe,  0x1,  0, 0x0b100000, 1,  0x00010000 },
1587 	{ 0x4, 0xe,  0x2,  0, 0x0b110000, 2,  0x00020000 },
1588 	{ 0x4, 0xe,  0x3,  0, 0x0b120000, 3,  0x00030000 },
1589 	{ 0x4, 0xe,  0x4,  0, 0x0b130000, 4,  0x00040000 },
1590 	{ 0x4, 0xe,  0x5,  0, 0x0b140000, 5,  0x00050000 },
1591 	{ 0x4, 0xe,  0x6,  0, 0x0b8f0000, 6,  0x00000000 },
1592 	{ 0x4, 0xe,  0x7,  0, 0x0b900000, 7,  0x00010000 },
1593 	{ 0x4, 0xe,  0x8,  0, 0x0b910000, 8,  0x00020000 },
1594 	{ 0x4, 0xe,  0x9,  0, 0x0b920000, 9,  0x00030000 },
1595 	{ 0x4, 0xe,  0xa,  0, 0x0b930000, 10, 0x00040000 },
1596 	{ 0x4, 0xe,  0xb,  0, 0x0b940000, 11, 0x00050000 },
1597 	{ 0x4, 0x10, 0x0,  0, 0x0b240000, 0,  0x00000000 },
1598 	{ 0x4, 0x10, 0x1,  0, 0x0ba40000, 1,  0x00000000 },
1599 	{ 0x4, 0x11, 0x0,  0, 0x0b020000, 0,  0x00000000 },
1600 	{ 0x4, 0x11, 0x1,  0, 0x0b820000, 1,  0x00000000 },
1601 	{ 0x4, 0x12, 0x0,  0, 0x0b030000, 0,  0x00000000 },
1602 	{ 0x4, 0x12, 0x1,  0, 0x0b830000, 1,  0x00000000 },
1603 	{ 0x4, 0x17, 0x0,  0, 0x0b640000, 0,  0x00000000 },
1604 	{ 0x4, 0x17, 0x1,  0, 0x0be40000, 1,  0x00000000 },
1605 	{ 0x4, 0x18, 0x0,  0, 0x0b600000, 0,  0x00000000 },
1606 	{ 0x4, 0x18, 0x1,  0, 0x0be00000, 1,  0x00000000 },
1607 	{ 0x4, 0x18, 0x2,  0, 0x00000000, 0,  0x00000000 },
1608 	{ 0x4, 0x18, 0x3,  0, 0x00000000, 0,  0x00000000 }
1609 };
1610 
cbbcentralnoc_parse_routeid(struct tegra194_cbb_aperture * info,u64 routeid)1611 static void cbbcentralnoc_parse_routeid(struct tegra194_cbb_aperture *info, u64 routeid)
1612 {
1613 	info->initflow = FIELD_GET(CBB_NOC_INITFLOW, routeid);
1614 	info->targflow = FIELD_GET(CBB_NOC_TARGFLOW, routeid);
1615 	info->targ_subrange = FIELD_GET(CBB_NOC_TARG_SUBRANGE, routeid);
1616 	info->seqid = FIELD_GET(CBB_NOC_SEQID, routeid);
1617 }
1618 
bpmpnoc_parse_routeid(struct tegra194_cbb_aperture * info,u64 routeid)1619 static void bpmpnoc_parse_routeid(struct tegra194_cbb_aperture *info, u64 routeid)
1620 {
1621 	info->initflow = FIELD_GET(BPMP_NOC_INITFLOW, routeid);
1622 	info->targflow = FIELD_GET(BPMP_NOC_TARGFLOW, routeid);
1623 	info->targ_subrange = FIELD_GET(BPMP_NOC_TARG_SUBRANGE, routeid);
1624 	info->seqid = FIELD_GET(BPMP_NOC_SEQID, routeid);
1625 }
1626 
aonnoc_parse_routeid(struct tegra194_cbb_aperture * info,u64 routeid)1627 static void aonnoc_parse_routeid(struct tegra194_cbb_aperture *info, u64 routeid)
1628 {
1629 	info->initflow = FIELD_GET(AON_NOC_INITFLOW, routeid);
1630 	info->targflow = FIELD_GET(AON_NOC_TARGFLOW, routeid);
1631 	info->targ_subrange = FIELD_GET(AON_NOC_TARG_SUBRANGE, routeid);
1632 	info->seqid = FIELD_GET(AON_NOC_SEQID, routeid);
1633 }
1634 
scenoc_parse_routeid(struct tegra194_cbb_aperture * info,u64 routeid)1635 static void scenoc_parse_routeid(struct tegra194_cbb_aperture *info, u64 routeid)
1636 {
1637 	info->initflow = FIELD_GET(SCE_NOC_INITFLOW, routeid);
1638 	info->targflow = FIELD_GET(SCE_NOC_TARGFLOW, routeid);
1639 	info->targ_subrange = FIELD_GET(SCE_NOC_TARG_SUBRANGE, routeid);
1640 	info->seqid = FIELD_GET(SCE_NOC_SEQID, routeid);
1641 }
1642 
cbbcentralnoc_parse_userbits(struct tegra194_cbb_userbits * usrbits,u32 elog_5)1643 static void cbbcentralnoc_parse_userbits(struct tegra194_cbb_userbits *usrbits, u32 elog_5)
1644 {
1645 	usrbits->axcache = FIELD_GET(CBB_NOC_AXCACHE, elog_5);
1646 	usrbits->non_mod = FIELD_GET(CBB_NOC_NON_MOD, elog_5);
1647 	usrbits->axprot = FIELD_GET(CBB_NOC_AXPROT, elog_5);
1648 	usrbits->falconsec = FIELD_GET(CBB_NOC_FALCONSEC, elog_5);
1649 	usrbits->grpsec = FIELD_GET(CBB_NOC_GRPSEC, elog_5);
1650 	usrbits->vqc = FIELD_GET(CBB_NOC_VQC, elog_5);
1651 	usrbits->mstr_id = FIELD_GET(CBB_NOC_MSTR_ID, elog_5) - 1;
1652 	usrbits->axi_id = FIELD_GET(CBB_NOC_AXI_ID, elog_5);
1653 }
1654 
clusternoc_parse_userbits(struct tegra194_cbb_userbits * usrbits,u32 elog_5)1655 static void clusternoc_parse_userbits(struct tegra194_cbb_userbits *usrbits, u32 elog_5)
1656 {
1657 	usrbits->axcache = FIELD_GET(CLUSTER_NOC_AXCACHE, elog_5);
1658 	usrbits->axprot = FIELD_GET(CLUSTER_NOC_AXCACHE, elog_5);
1659 	usrbits->falconsec = FIELD_GET(CLUSTER_NOC_FALCONSEC, elog_5);
1660 	usrbits->grpsec = FIELD_GET(CLUSTER_NOC_GRPSEC, elog_5);
1661 	usrbits->vqc = FIELD_GET(CLUSTER_NOC_VQC, elog_5);
1662 	usrbits->mstr_id = FIELD_GET(CLUSTER_NOC_MSTR_ID, elog_5) - 1;
1663 }
1664 
tegra194_cbb_fault_enable(struct tegra_cbb * cbb)1665 static void tegra194_cbb_fault_enable(struct tegra_cbb *cbb)
1666 {
1667 	struct tegra194_cbb *priv = to_tegra194_cbb(cbb);
1668 
1669 	writel(1, priv->regs + ERRLOGGER_0_FAULTEN_0);
1670 	writel(1, priv->regs + ERRLOGGER_1_FAULTEN_0);
1671 	writel(1, priv->regs + ERRLOGGER_2_FAULTEN_0);
1672 }
1673 
tegra194_cbb_stall_enable(struct tegra_cbb * cbb)1674 static void tegra194_cbb_stall_enable(struct tegra_cbb *cbb)
1675 {
1676 	struct tegra194_cbb *priv = to_tegra194_cbb(cbb);
1677 
1678 	writel(1, priv->regs + ERRLOGGER_0_STALLEN_0);
1679 	writel(1, priv->regs + ERRLOGGER_1_STALLEN_0);
1680 	writel(1, priv->regs + ERRLOGGER_2_STALLEN_0);
1681 }
1682 
tegra194_cbb_error_clear(struct tegra_cbb * cbb)1683 static void tegra194_cbb_error_clear(struct tegra_cbb *cbb)
1684 {
1685 	struct tegra194_cbb *priv = to_tegra194_cbb(cbb);
1686 
1687 	writel(1, priv->regs + ERRLOGGER_0_ERRCLR_0);
1688 	writel(1, priv->regs + ERRLOGGER_1_ERRCLR_0);
1689 	writel(1, priv->regs + ERRLOGGER_2_ERRCLR_0);
1690 	dsb(sy);
1691 }
1692 
tegra194_cbb_get_status(struct tegra_cbb * cbb)1693 static u32 tegra194_cbb_get_status(struct tegra_cbb *cbb)
1694 {
1695 	struct tegra194_cbb *priv = to_tegra194_cbb(cbb);
1696 	u32 value;
1697 
1698 	value = readl(priv->regs + ERRLOGGER_0_ERRVLD_0);
1699 	value |= (readl(priv->regs + ERRLOGGER_1_ERRVLD_0) << 1);
1700 	value |= (readl(priv->regs + ERRLOGGER_2_ERRVLD_0) << 2);
1701 
1702 	dsb(sy);
1703 	return value;
1704 }
1705 
tegra194_axi2apb_status(void __iomem * addr)1706 static u32 tegra194_axi2apb_status(void __iomem *addr)
1707 {
1708 	u32 value;
1709 
1710 	value = readl(addr + DMAAPB_X_RAW_INTERRUPT_STATUS);
1711 	writel(0xffffffff, addr + DMAAPB_X_RAW_INTERRUPT_STATUS);
1712 
1713 	return value;
1714 }
1715 
tegra194_axi2apb_fatal(struct seq_file * file,unsigned int bridge,u32 status)1716 static bool tegra194_axi2apb_fatal(struct seq_file *file, unsigned int bridge, u32 status)
1717 {
1718 	bool is_fatal = true;
1719 	size_t i;
1720 
1721 	for (i = 0; i < ARRAY_SIZE(tegra194_axi2apb_error); i++) {
1722 		if (status & BIT(i)) {
1723 			tegra_cbb_print_err(file, "\t  AXI2APB_%d bridge error: %s\n",
1724 					    bridge + 1, tegra194_axi2apb_error[i]);
1725 			if (strstr(tegra194_axi2apb_error[i], "Firewall"))
1726 				is_fatal = false;
1727 		}
1728 	}
1729 
1730 	return is_fatal;
1731 }
1732 
1733 /*
1734  * Fetch InitlocalAddress from NOC Aperture lookup table
1735  * using Targflow, Targsubrange
1736  */
get_init_localaddress(const struct tegra194_cbb_aperture * info,const struct tegra194_cbb_aperture * aper,unsigned int max)1737 static u32 get_init_localaddress(const struct tegra194_cbb_aperture *info,
1738 				 const struct tegra194_cbb_aperture *aper, unsigned int max)
1739 {
1740 	unsigned int t_f = 0, t_sr = 0;
1741 	u32 addr = 0;
1742 
1743 	for (t_f = 0; t_f < max; t_f++) {
1744 		if (aper[t_f].targflow == info->targflow) {
1745 			t_sr = t_f;
1746 
1747 			do {
1748 				if (aper[t_sr].targ_subrange == info->targ_subrange) {
1749 					addr = aper[t_sr].init_localaddress;
1750 					return addr;
1751 				}
1752 
1753 				if (t_sr >= max)
1754 					return 0;
1755 
1756 				t_sr++;
1757 			} while (aper[t_sr].targflow == aper[t_sr - 1].targflow);
1758 
1759 			t_f = t_sr;
1760 		}
1761 	}
1762 
1763 	return addr;
1764 }
1765 
print_errlog5(struct seq_file * file,struct tegra194_cbb * cbb)1766 static void print_errlog5(struct seq_file *file, struct tegra194_cbb *cbb)
1767 {
1768 	struct tegra194_cbb_userbits userbits;
1769 
1770 	cbb->noc->parse_userbits(&userbits, cbb->errlog5);
1771 
1772 	if (!strcmp(cbb->noc->name, "cbb-noc")) {
1773 		tegra_cbb_print_err(file, "\t  Non-Modify\t\t: %#x\n", userbits.non_mod);
1774 		tegra_cbb_print_err(file, "\t  AXI ID\t\t: %#x\n", userbits.axi_id);
1775 	}
1776 
1777 	tegra_cbb_print_err(file, "\t  Master ID\t\t: %s\n",
1778 			    cbb->noc->master_id[userbits.mstr_id]);
1779 	tegra_cbb_print_err(file, "\t  Security Group(GRPSEC): %#x\n", userbits.grpsec);
1780 	tegra_cbb_print_cache(file, userbits.axcache);
1781 	tegra_cbb_print_prot(file, userbits.axprot);
1782 	tegra_cbb_print_err(file, "\t  FALCONSEC\t\t: %#x\n", userbits.falconsec);
1783 	tegra_cbb_print_err(file, "\t  Virtual Queuing Channel(VQC): %#x\n", userbits.vqc);
1784 }
1785 
1786 /*
1787  *  Fetch Base Address/InitlocalAddress from NOC aperture lookup table using TargFlow &
1788  *  Targ_subRange extracted from RouteId. Perform address reconstruction as below:
1789  *
1790  *    Address = Base Address + (ErrLog3 + ErrLog4)
1791  */
1792 static void
print_errlog3_4(struct seq_file * file,u32 errlog3,u32 errlog4,const struct tegra194_cbb_aperture * info,const struct tegra194_cbb_aperture * aperture,unsigned int max)1793 print_errlog3_4(struct seq_file *file, u32 errlog3, u32 errlog4,
1794 		const struct tegra194_cbb_aperture *info,
1795 		const struct tegra194_cbb_aperture *aperture, unsigned int max)
1796 {
1797 	u64 addr = (u64)errlog4 << 32 | errlog3;
1798 
1799 	/*
1800 	 * If errlog4[7] = "1", then it's a joker entry. Joker entries are a rare phenomenon and
1801 	 * such addresses are not reliable. Debugging should be done using only the RouteId
1802 	 * information.
1803 	 */
1804 	if (errlog4 & 0x80)
1805 		tegra_cbb_print_err(file, "\t debug using RouteId alone as below address is a "
1806 					  "joker entry and not reliable");
1807 
1808 	addr += get_init_localaddress(info, aperture, max);
1809 
1810 	tegra_cbb_print_err(file, "\t  Address accessed\t: %#llx\n", addr);
1811 }
1812 
1813 /*
1814  *  Get RouteId from ErrLog1+ErrLog2 registers and fetch values of
1815  *  InitFlow, TargFlow, Targ_subRange and SeqId values from RouteId
1816  */
1817 static void
print_errlog1_2(struct seq_file * file,struct tegra194_cbb * cbb,struct tegra194_cbb_aperture * info)1818 print_errlog1_2(struct seq_file *file, struct tegra194_cbb *cbb,
1819 		struct tegra194_cbb_aperture *info)
1820 {
1821 	u64 routeid = (u64)cbb->errlog2 << 32 | cbb->errlog1;
1822 	u32 seqid = 0;
1823 
1824 	tegra_cbb_print_err(file, "\t  RouteId\t\t: %#llx\n", routeid);
1825 
1826 	cbb->noc->parse_routeid(info, routeid);
1827 
1828 	tegra_cbb_print_err(file, "\t  InitFlow\t\t: %s\n",
1829 			    cbb->noc->routeid_initflow[info->initflow]);
1830 
1831 	tegra_cbb_print_err(file, "\t  Targflow\t\t: %s\n",
1832 			    cbb->noc->routeid_targflow[info->targflow]);
1833 
1834 	tegra_cbb_print_err(file, "\t  TargSubRange\t\t: %d\n", info->targ_subrange);
1835 	tegra_cbb_print_err(file, "\t  SeqId\t\t\t: %d\n", seqid);
1836 }
1837 
1838 /*
1839  * Print transcation type, error code and description from ErrLog0 for all
1840  * errors. For NOC slave errors, all relevant error info is printed using
1841  * ErrLog0 only. But additional information is printed for errors from
1842  * APB slaves because for them:
1843  *  - All errors are logged as SLV(slave) errors due to APB having only single
1844  *    bit pslverr to report all errors.
1845  *  - Exact cause is printed by reading DMAAPB_X_RAW_INTERRUPT_STATUS register.
1846  *  - The driver prints information showing AXI2APB bridge and exact error
1847  *    only if there is error in any AXI2APB slave.
1848  *  - There is still no way to disambiguate a DEC error from SLV error type.
1849  */
print_errlog0(struct seq_file * file,struct tegra194_cbb * cbb)1850 static bool print_errlog0(struct seq_file *file, struct tegra194_cbb *cbb)
1851 {
1852 	struct tegra194_cbb_packet_header hdr;
1853 	bool is_fatal = true;
1854 
1855 	hdr.lock = cbb->errlog0 & 0x1;
1856 	hdr.opc = FIELD_GET(CBB_ERR_OPC, cbb->errlog0);
1857 	hdr.errcode = FIELD_GET(CBB_ERR_ERRCODE, cbb->errlog0);
1858 	hdr.len1 = FIELD_GET(CBB_ERR_LEN1, cbb->errlog0);
1859 	hdr.format = (cbb->errlog0 >> 31);
1860 
1861 	tegra_cbb_print_err(file, "\t  Transaction Type\t: %s\n",
1862 			    tegra194_cbb_trantype[hdr.opc]);
1863 	tegra_cbb_print_err(file, "\t  Error Code\t\t: %s\n",
1864 			    tegra194_cbb_errors[hdr.errcode].code);
1865 	tegra_cbb_print_err(file, "\t  Error Source\t\t: %s\n",
1866 			    tegra194_cbb_errors[hdr.errcode].source);
1867 	tegra_cbb_print_err(file, "\t  Error Description\t: %s\n",
1868 			    tegra194_cbb_errors[hdr.errcode].desc);
1869 
1870 	/*
1871 	 * Do not crash system for errors which are only notifications to indicate a transaction
1872 	 * was not allowed to be attempted.
1873 	 */
1874 	if (!strcmp(tegra194_cbb_errors[hdr.errcode].code, "SEC") ||
1875 	    !strcmp(tegra194_cbb_errors[hdr.errcode].code, "DEC") ||
1876 	    !strcmp(tegra194_cbb_errors[hdr.errcode].code, "UNS") ||
1877 	    !strcmp(tegra194_cbb_errors[hdr.errcode].code, "DISC")) {
1878 		is_fatal = false;
1879 	} else if (!strcmp(tegra194_cbb_errors[hdr.errcode].code, "SLV") &&
1880 		   cbb->num_bridges > 0) {
1881 		unsigned int i;
1882 		u32 status;
1883 
1884 		/* For all SLV errors, read DMAAPB_X_RAW_INTERRUPT_STATUS
1885 		 * register to get error status for all AXI2APB bridges.
1886 		 * Print bridge details if a bit is set in a bridge's
1887 		 * status register due to error in a APB slave connected
1888 		 * to that bridge. For other NOC slaves, none of the status
1889 		 * register will be set.
1890 		 */
1891 
1892 		for (i = 0; i < cbb->num_bridges; i++) {
1893 			status = tegra194_axi2apb_status(cbb->bridges[i].base);
1894 
1895 			if (status)
1896 				is_fatal = tegra194_axi2apb_fatal(file, i, status);
1897 		}
1898 	}
1899 
1900 	tegra_cbb_print_err(file, "\t  Packet header Lock\t: %d\n", hdr.lock);
1901 	tegra_cbb_print_err(file, "\t  Packet header Len1\t: %d\n", hdr.len1);
1902 
1903 	if (hdr.format)
1904 		tegra_cbb_print_err(file, "\t  NOC protocol version\t: %s\n",
1905 				    "version >= 2.7");
1906 	else
1907 		tegra_cbb_print_err(file, "\t  NOC protocol version\t: %s\n",
1908 				    "version < 2.7");
1909 
1910 	return is_fatal;
1911 }
1912 
1913 /*
1914  * Print debug information about failed transaction using
1915  * ErrLog registers of error loggger having ErrVld set
1916  */
print_errloggerX_info(struct seq_file * file,struct tegra194_cbb * cbb,int errloggerX)1917 static bool print_errloggerX_info(struct seq_file *file, struct tegra194_cbb *cbb,
1918 				  int errloggerX)
1919 {
1920 	struct tegra194_cbb_aperture info = { 0, };
1921 	bool is_fatal = true;
1922 
1923 	tegra_cbb_print_err(file, "\tError Logger\t\t: %d\n", errloggerX);
1924 
1925 	if (errloggerX == 0) {
1926 		cbb->errlog0 = readl(cbb->regs + ERRLOGGER_0_ERRLOG0_0);
1927 		cbb->errlog1 = readl(cbb->regs + ERRLOGGER_0_ERRLOG1_0);
1928 		cbb->errlog2 = readl(cbb->regs + ERRLOGGER_0_RSVD_00_0);
1929 		cbb->errlog3 = readl(cbb->regs + ERRLOGGER_0_ERRLOG3_0);
1930 		cbb->errlog4 = readl(cbb->regs + ERRLOGGER_0_ERRLOG4_0);
1931 		cbb->errlog5 = readl(cbb->regs + ERRLOGGER_0_ERRLOG5_0);
1932 	} else if (errloggerX == 1) {
1933 		cbb->errlog0 = readl(cbb->regs + ERRLOGGER_1_ERRLOG0_0);
1934 		cbb->errlog1 = readl(cbb->regs + ERRLOGGER_1_ERRLOG1_0);
1935 		cbb->errlog2 = readl(cbb->regs + ERRLOGGER_1_RSVD_00_0);
1936 		cbb->errlog3 = readl(cbb->regs + ERRLOGGER_1_ERRLOG3_0);
1937 		cbb->errlog4 = readl(cbb->regs + ERRLOGGER_1_ERRLOG4_0);
1938 		cbb->errlog5 = readl(cbb->regs + ERRLOGGER_1_ERRLOG5_0);
1939 	} else if (errloggerX == 2) {
1940 		cbb->errlog0 = readl(cbb->regs + ERRLOGGER_2_ERRLOG0_0);
1941 		cbb->errlog1 = readl(cbb->regs + ERRLOGGER_2_ERRLOG1_0);
1942 		cbb->errlog2 = readl(cbb->regs + ERRLOGGER_2_RSVD_00_0);
1943 		cbb->errlog3 = readl(cbb->regs + ERRLOGGER_2_ERRLOG3_0);
1944 		cbb->errlog4 = readl(cbb->regs + ERRLOGGER_2_ERRLOG4_0);
1945 		cbb->errlog5 = readl(cbb->regs + ERRLOGGER_2_ERRLOG5_0);
1946 	}
1947 
1948 	tegra_cbb_print_err(file, "\tErrLog0\t\t\t: %#x\n", cbb->errlog0);
1949 	is_fatal = print_errlog0(file, cbb);
1950 
1951 	tegra_cbb_print_err(file, "\tErrLog1\t\t\t: %#x\n", cbb->errlog1);
1952 	tegra_cbb_print_err(file, "\tErrLog2\t\t\t: %#x\n", cbb->errlog2);
1953 	print_errlog1_2(file, cbb, &info);
1954 
1955 	tegra_cbb_print_err(file, "\tErrLog3\t\t\t: %#x\n", cbb->errlog3);
1956 	tegra_cbb_print_err(file, "\tErrLog4\t\t\t: %#x\n", cbb->errlog4);
1957 	print_errlog3_4(file, cbb->errlog3, cbb->errlog4, &info, cbb->noc->noc_aperture,
1958 			cbb->noc->max_aperture);
1959 
1960 	tegra_cbb_print_err(file, "\tErrLog5\t\t\t: %#x\n", cbb->errlog5);
1961 
1962 	if (cbb->errlog5)
1963 		print_errlog5(file, cbb);
1964 
1965 	return is_fatal;
1966 }
1967 
print_errlog(struct seq_file * file,struct tegra194_cbb * cbb,u32 errvld)1968 static bool print_errlog(struct seq_file *file, struct tegra194_cbb *cbb, u32 errvld)
1969 {
1970 	bool is_fatal = true;
1971 
1972 	pr_crit("**************************************\n");
1973 	pr_crit("CPU:%d, Error:%s\n", smp_processor_id(), cbb->noc->name);
1974 
1975 	if (errvld & 0x1)
1976 		is_fatal = print_errloggerX_info(file, cbb, 0);
1977 	else if (errvld & 0x2)
1978 		is_fatal = print_errloggerX_info(file, cbb, 1);
1979 	else if (errvld & 0x4)
1980 		is_fatal = print_errloggerX_info(file, cbb, 2);
1981 
1982 	tegra_cbb_error_clear(&cbb->base);
1983 	tegra_cbb_print_err(file, "\t**************************************\n");
1984 	return is_fatal;
1985 }
1986 
1987 #ifdef CONFIG_DEBUG_FS
1988 static DEFINE_MUTEX(cbb_err_mutex);
1989 
tegra194_cbb_debugfs_show(struct tegra_cbb * cbb,struct seq_file * file,void * data)1990 static int tegra194_cbb_debugfs_show(struct tegra_cbb *cbb, struct seq_file *file, void *data)
1991 {
1992 	struct tegra_cbb *noc;
1993 
1994 	mutex_lock(&cbb_err_mutex);
1995 
1996 	list_for_each_entry(noc, &cbb_list, node) {
1997 		struct tegra194_cbb *priv = to_tegra194_cbb(noc);
1998 		u32 status;
1999 
2000 		status = tegra_cbb_get_status(noc);
2001 		if (status)
2002 			print_errlog(file, priv, status);
2003 	}
2004 
2005 	mutex_unlock(&cbb_err_mutex);
2006 
2007 	return 0;
2008 }
2009 #endif
2010 
2011 /*
2012  * Handler for CBB errors from different initiators
2013  */
tegra194_cbb_err_isr(int irq,void * data)2014 static irqreturn_t tegra194_cbb_err_isr(int irq, void *data)
2015 {
2016 	bool is_inband_err = false, is_fatal = false;
2017 	//struct tegra194_cbb *cbb = data;
2018 	struct tegra_cbb *noc;
2019 	unsigned long flags;
2020 	u8 mstr_id = 0;
2021 
2022 	spin_lock_irqsave(&cbb_lock, flags);
2023 
2024 	/* XXX only process interrupts for "cbb" instead of iterating over all NOCs? */
2025 	list_for_each_entry(noc, &cbb_list, node) {
2026 		struct tegra194_cbb *priv = to_tegra194_cbb(noc);
2027 		u32 status = 0;
2028 
2029 		status = tegra_cbb_get_status(noc);
2030 
2031 		if (status && ((irq == priv->sec_irq) || (irq == priv->nonsec_irq))) {
2032 			tegra_cbb_print_err(NULL, "CPU:%d, Error: %s@%llx, irq=%d\n",
2033 					    smp_processor_id(), priv->noc->name, priv->res->start,
2034 					    irq);
2035 
2036 			is_fatal = print_errlog(NULL, priv, status);
2037 
2038 			/*
2039 			 * If illegal request is from CCPLEX(0x1) initiator
2040 			 * and error is fatal then call BUG() to crash system.
2041 			 */
2042 			if (priv->noc->erd_mask_inband_err) {
2043 				mstr_id =  FIELD_GET(CBB_NOC_MSTR_ID, priv->errlog5);
2044 				if (mstr_id == 0x1)
2045 					is_inband_err = 1;
2046 			}
2047 		}
2048 	}
2049 
2050 	spin_unlock_irqrestore(&cbb_lock, flags);
2051 
2052 	if (is_inband_err) {
2053 		if (is_fatal)
2054 			BUG();
2055 		else
2056 			WARN(true, "Warning due to CBB Error\n");
2057 	}
2058 
2059 	return IRQ_HANDLED;
2060 }
2061 
2062 /*
2063  * Register handler for CBB_NONSECURE & CBB_SECURE interrupts
2064  * for reporting CBB errors
2065  */
tegra194_cbb_interrupt_enable(struct tegra_cbb * cbb)2066 static int tegra194_cbb_interrupt_enable(struct tegra_cbb *cbb)
2067 {
2068 	struct tegra194_cbb *priv = to_tegra194_cbb(cbb);
2069 	struct device *dev = cbb->dev;
2070 	int err;
2071 
2072 	if (priv->sec_irq) {
2073 		err = devm_request_irq(dev, priv->sec_irq, tegra194_cbb_err_isr, 0, dev_name(dev),
2074 				       priv);
2075 		if (err) {
2076 			dev_err(dev, "failed to register interrupt %u: %d\n", priv->sec_irq, err);
2077 			return err;
2078 		}
2079 	}
2080 
2081 	if (priv->nonsec_irq) {
2082 		err = devm_request_irq(dev, priv->nonsec_irq, tegra194_cbb_err_isr, 0,
2083 				       dev_name(dev), priv);
2084 		if (err) {
2085 			dev_err(dev, "failed to register interrupt %u: %d\n", priv->nonsec_irq,
2086 				err);
2087 			return err;
2088 		}
2089 	}
2090 
2091 	return 0;
2092 }
2093 
tegra194_cbb_error_enable(struct tegra_cbb * cbb)2094 static void tegra194_cbb_error_enable(struct tegra_cbb *cbb)
2095 {
2096 	/*
2097 	 * Set “StallEn=1” to enable queuing of error packets till
2098 	 * first is served & cleared
2099 	 */
2100 	tegra_cbb_stall_enable(cbb);
2101 
2102 	/* set “FaultEn=1” to enable error reporting signal “Fault” */
2103 	tegra_cbb_fault_enable(cbb);
2104 }
2105 
2106 static const struct tegra_cbb_ops tegra194_cbb_ops = {
2107 	.get_status = tegra194_cbb_get_status,
2108 	.error_clear = tegra194_cbb_error_clear,
2109 	.fault_enable = tegra194_cbb_fault_enable,
2110 	.stall_enable = tegra194_cbb_stall_enable,
2111 	.error_enable = tegra194_cbb_error_enable,
2112 	.interrupt_enable = tegra194_cbb_interrupt_enable,
2113 #ifdef CONFIG_DEBUG_FS
2114 	.debugfs_show = tegra194_cbb_debugfs_show,
2115 #endif
2116 };
2117 
2118 static struct tegra194_cbb_noc_data tegra194_cbb_central_noc_data = {
2119 	.name = "cbb-noc",
2120 	.erd_mask_inband_err = true,
2121 	.master_id = tegra194_master_id,
2122 	.noc_aperture = tegra194_cbbcentralnoc_apert_lookup,
2123 	.max_aperture = ARRAY_SIZE(tegra194_cbbcentralnoc_apert_lookup),
2124 	.routeid_initflow = tegra194_cbbcentralnoc_routeid_initflow,
2125 	.routeid_targflow = tegra194_cbbcentralnoc_routeid_targflow,
2126 	.parse_routeid = cbbcentralnoc_parse_routeid,
2127 	.parse_userbits = cbbcentralnoc_parse_userbits
2128 };
2129 
2130 static struct tegra194_cbb_noc_data tegra194_aon_noc_data = {
2131 	.name = "aon-noc",
2132 	.erd_mask_inband_err = false,
2133 	.master_id = tegra194_master_id,
2134 	.noc_aperture = tegra194_aonnoc_aperture_lookup,
2135 	.max_aperture = ARRAY_SIZE(tegra194_aonnoc_aperture_lookup),
2136 	.routeid_initflow = tegra194_aonnoc_routeid_initflow,
2137 	.routeid_targflow = tegra194_aonnoc_routeid_targflow,
2138 	.parse_routeid = aonnoc_parse_routeid,
2139 	.parse_userbits = clusternoc_parse_userbits
2140 };
2141 
2142 static struct tegra194_cbb_noc_data tegra194_bpmp_noc_data = {
2143 	.name = "bpmp-noc",
2144 	.erd_mask_inband_err = false,
2145 	.master_id = tegra194_master_id,
2146 	.noc_aperture = tegra194_bpmpnoc_apert_lookup,
2147 	.max_aperture = ARRAY_SIZE(tegra194_bpmpnoc_apert_lookup),
2148 	.routeid_initflow = tegra194_bpmpnoc_routeid_initflow,
2149 	.routeid_targflow = tegra194_bpmpnoc_routeid_targflow,
2150 	.parse_routeid = bpmpnoc_parse_routeid,
2151 	.parse_userbits = clusternoc_parse_userbits
2152 };
2153 
2154 static struct tegra194_cbb_noc_data tegra194_rce_noc_data = {
2155 	.name = "rce-noc",
2156 	.erd_mask_inband_err = false,
2157 	.master_id = tegra194_master_id,
2158 	.noc_aperture = tegra194_scenoc_apert_lookup,
2159 	.max_aperture = ARRAY_SIZE(tegra194_scenoc_apert_lookup),
2160 	.routeid_initflow = tegra194_scenoc_routeid_initflow,
2161 	.routeid_targflow = tegra194_scenoc_routeid_targflow,
2162 	.parse_routeid = scenoc_parse_routeid,
2163 	.parse_userbits = clusternoc_parse_userbits
2164 };
2165 
2166 static struct tegra194_cbb_noc_data tegra194_sce_noc_data = {
2167 	.name = "sce-noc",
2168 	.erd_mask_inband_err = false,
2169 	.master_id = tegra194_master_id,
2170 	.noc_aperture = tegra194_scenoc_apert_lookup,
2171 	.max_aperture = ARRAY_SIZE(tegra194_scenoc_apert_lookup),
2172 	.routeid_initflow = tegra194_scenoc_routeid_initflow,
2173 	.routeid_targflow = tegra194_scenoc_routeid_targflow,
2174 	.parse_routeid = scenoc_parse_routeid,
2175 	.parse_userbits = clusternoc_parse_userbits
2176 };
2177 
2178 static const struct of_device_id tegra194_cbb_match[] = {
2179 	{ .compatible = "nvidia,tegra194-cbb-noc", .data = &tegra194_cbb_central_noc_data },
2180 	{ .compatible = "nvidia,tegra194-aon-noc", .data = &tegra194_aon_noc_data },
2181 	{ .compatible = "nvidia,tegra194-bpmp-noc", .data = &tegra194_bpmp_noc_data },
2182 	{ .compatible = "nvidia,tegra194-rce-noc", .data = &tegra194_rce_noc_data },
2183 	{ .compatible = "nvidia,tegra194-sce-noc", .data = &tegra194_sce_noc_data },
2184 	{ /* sentinel */ }
2185 };
2186 MODULE_DEVICE_TABLE(of, tegra194_cbb_match);
2187 
tegra194_cbb_get_bridges(struct tegra194_cbb * cbb,struct device_node * np)2188 static int tegra194_cbb_get_bridges(struct tegra194_cbb *cbb, struct device_node *np)
2189 {
2190 	struct tegra_cbb *entry;
2191 	unsigned long flags;
2192 	unsigned int i;
2193 	int err;
2194 
2195 	spin_lock_irqsave(&cbb_lock, flags);
2196 
2197 	list_for_each_entry(entry, &cbb_list, node) {
2198 		struct tegra194_cbb *priv = to_tegra194_cbb(entry);
2199 
2200 		if (priv->bridges) {
2201 			cbb->num_bridges = priv->num_bridges;
2202 			cbb->bridges = priv->bridges;
2203 			break;
2204 		}
2205 	}
2206 
2207 	spin_unlock_irqrestore(&cbb_lock, flags);
2208 
2209 	if (!cbb->bridges) {
2210 		cbb->num_bridges = of_address_count(np);
2211 
2212 		cbb->bridges = devm_kcalloc(cbb->base.dev, cbb->num_bridges,
2213 					    sizeof(*cbb->bridges), GFP_KERNEL);
2214 		if (!cbb->bridges)
2215 			return -ENOMEM;
2216 
2217 		for (i = 0; i < cbb->num_bridges; i++) {
2218 			err = of_address_to_resource(np, i, &cbb->bridges[i].res);
2219 			if (err < 0)
2220 				return err;
2221 
2222 			cbb->bridges[i].base = devm_ioremap_resource(cbb->base.dev,
2223 								     &cbb->bridges[i].res);
2224 			if (IS_ERR(cbb->bridges[i].base))
2225 				return PTR_ERR(cbb->bridges[i].base);
2226 		}
2227 	}
2228 
2229 	if (cbb->num_bridges > 0) {
2230 		dev_dbg(cbb->base.dev, "AXI2APB bridge info present:\n");
2231 
2232 		for (i = 0; i < cbb->num_bridges; i++)
2233 			dev_dbg(cbb->base.dev, "  %u: %pR\n", i, &cbb->bridges[i].res);
2234 	}
2235 
2236 	return 0;
2237 }
2238 
tegra194_cbb_probe(struct platform_device * pdev)2239 static int tegra194_cbb_probe(struct platform_device *pdev)
2240 {
2241 	const struct tegra194_cbb_noc_data *noc;
2242 	struct tegra194_cbb *cbb;
2243 	struct device_node *np;
2244 	unsigned long flags;
2245 	int err;
2246 
2247 	noc = of_device_get_match_data(&pdev->dev);
2248 
2249 	if (noc->erd_mask_inband_err) {
2250 		/*
2251 		 * Set Error Response Disable(ERD) bit to mask SError/inband
2252 		 * error and only trigger interrupts for illegal access from
2253 		 * CCPLEX initiator.
2254 		 */
2255 		err = tegra194_miscreg_mask_serror();
2256 		if (err) {
2257 			dev_err(&pdev->dev, "couldn't mask inband errors\n");
2258 			return err;
2259 		}
2260 	}
2261 
2262 	cbb = devm_kzalloc(&pdev->dev, sizeof(*cbb), GFP_KERNEL);
2263 	if (!cbb)
2264 		return -ENOMEM;
2265 
2266 	INIT_LIST_HEAD(&cbb->base.node);
2267 	cbb->base.ops = &tegra194_cbb_ops;
2268 	cbb->base.dev = &pdev->dev;
2269 	cbb->noc = noc;
2270 
2271 	cbb->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &cbb->res);
2272 	if (IS_ERR(cbb->regs))
2273 		return PTR_ERR(cbb->regs);
2274 
2275 	err = tegra_cbb_get_irq(pdev, &cbb->nonsec_irq, &cbb->sec_irq);
2276 	if (err)
2277 		return err;
2278 
2279 	np = of_parse_phandle(pdev->dev.of_node, "nvidia,axi2apb", 0);
2280 	if (np) {
2281 		err = tegra194_cbb_get_bridges(cbb, np);
2282 		of_node_put(np);
2283 		if (err < 0)
2284 			return err;
2285 	}
2286 
2287 	platform_set_drvdata(pdev, cbb);
2288 
2289 	spin_lock_irqsave(&cbb_lock, flags);
2290 	list_add(&cbb->base.node, &cbb_list);
2291 	spin_unlock_irqrestore(&cbb_lock, flags);
2292 
2293 	return tegra_cbb_register(&cbb->base);
2294 }
2295 
tegra194_cbb_remove(struct platform_device * pdev)2296 static int tegra194_cbb_remove(struct platform_device *pdev)
2297 {
2298 	struct tegra194_cbb *cbb = platform_get_drvdata(pdev);
2299 	struct tegra_cbb *noc, *tmp;
2300 	unsigned long flags;
2301 
2302 	spin_lock_irqsave(&cbb_lock, flags);
2303 
2304 	list_for_each_entry_safe(noc, tmp, &cbb_list, node) {
2305 		struct tegra194_cbb *priv = to_tegra194_cbb(noc);
2306 
2307 		if (cbb->res->start == priv->res->start) {
2308 			list_del(&noc->node);
2309 			break;
2310 		}
2311 	}
2312 
2313 	spin_unlock_irqrestore(&cbb_lock, flags);
2314 
2315 	return 0;
2316 }
2317 
tegra194_cbb_resume_noirq(struct device * dev)2318 static int __maybe_unused tegra194_cbb_resume_noirq(struct device *dev)
2319 {
2320 	struct tegra194_cbb *cbb = dev_get_drvdata(dev);
2321 
2322 	tegra194_cbb_error_enable(&cbb->base);
2323 	dsb(sy);
2324 
2325 	dev_dbg(dev, "%s resumed\n", cbb->noc->name);
2326 	return 0;
2327 }
2328 
2329 static const struct dev_pm_ops tegra194_cbb_pm = {
2330 	SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(NULL, tegra194_cbb_resume_noirq)
2331 };
2332 
2333 static struct platform_driver tegra194_cbb_driver = {
2334 	.probe = tegra194_cbb_probe,
2335 	.remove = tegra194_cbb_remove,
2336 	.driver = {
2337 		.name = "tegra194-cbb",
2338 		.of_match_table = of_match_ptr(tegra194_cbb_match),
2339 		.pm = &tegra194_cbb_pm,
2340 	},
2341 };
2342 
tegra194_cbb_init(void)2343 static int __init tegra194_cbb_init(void)
2344 {
2345 	return platform_driver_register(&tegra194_cbb_driver);
2346 }
2347 pure_initcall(tegra194_cbb_init);
2348 
tegra194_cbb_exit(void)2349 static void __exit tegra194_cbb_exit(void)
2350 {
2351 	platform_driver_unregister(&tegra194_cbb_driver);
2352 }
2353 module_exit(tegra194_cbb_exit);
2354 
2355 MODULE_AUTHOR("Sumit Gupta <sumitg@nvidia.com>");
2356 MODULE_DESCRIPTION("Control Backbone error handling driver for Tegra194");
2357