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