xref: /rk3399_ARM-atf/plat/arm/board/tc/include/platform_def.h (revision b62673c645752a78f649282cfa293e8da09e3bef)
1 /*
2  * Copyright (c) 2020-2024, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef PLATFORM_DEF_H
8 #define PLATFORM_DEF_H
9 
10 #include <cortex_a520.h>
11 #include <lib/utils_def.h>
12 #include <lib/xlat_tables/xlat_tables_defs.h>
13 #include <plat/arm/board/common/board_css_def.h>
14 #include <plat/arm/board/common/v2m_def.h>
15 
16 /*
17  * arm_def.h depends on the platform system counter macros, so must define the
18  * platform macros before including arm_def.h.
19  */
20 #if TARGET_PLATFORM == 4
21 #ifdef ARM_SYS_CNTCTL_BASE
22 #error "error: ARM_SYS_CNTCTL_BASE is defined prior to the PLAT_ARM_SYS_CNTCTL_BASE definition"
23 #endif
24 #define PLAT_ARM_SYS_CNTCTL_BASE	UL(0x47000000)
25 #define PLAT_ARM_SYS_CNTREAD_BASE	UL(0x47010000)
26 #endif
27 
28 #include <plat/arm/common/arm_def.h>
29 
30 #include <plat/arm/common/arm_spm_def.h>
31 #include <plat/arm/css/common/css_def.h>
32 #include <plat/arm/soc/common/soc_css_def.h>
33 #include <plat/common/common_def.h>
34 
35 #define PLAT_ARM_TRUSTED_SRAM_SIZE	0x00080000	/* 512 KB */
36 
37 /*
38  * The top 16MB of ARM_DRAM1 is configured as secure access only using the TZC,
39  * its base is ARM_AP_TZC_DRAM1_BASE.
40  *
41  * Reserve 96 MB below ARM_AP_TZC_DRAM1_BASE for:
42  *   - BL32_BASE when SPD_spmd is enabled
43  *   - Region to load secure partitions
44  *
45  *
46  *  0x8000_0000  ------------------   TC_NS_DRAM1_BASE
47  *               |       DTB      |
48  *               |      (32K)     |
49  *  0x8000_8000  ------------------
50  *               | NT_FW_CONFIG   |
51  *               |      (4KB)     |
52  *  0x8000_9000  ------------------
53  *               |       ...      |
54  *  0xf8e0_0000  ------------------   TC_NS_OPTEE_BASE
55  *               |  OP-TEE shmem  |
56  *               |      (2MB)     |
57  *  0xF900_0000  ------------------   TC_TZC_DRAM1_BASE
58  *               |                |
59  *               |      SPMC      |
60  *               |       SP       |
61  *               |     (96MB)     |
62  *  0xFF00_0000  ------------------   ARM_AP_TZC_DRAM1_BASE
63  *               |       AP       |
64  *               |   EL3 Monitor  |
65  *               |       SCP      |
66  *               |     (16MB)     |
67  *  0xFFFF_FFFF  ------------------
68  *
69  *
70  */
71 #define TC_TZC_DRAM1_BASE		(ARM_AP_TZC_DRAM1_BASE -	\
72 					 TC_TZC_DRAM1_SIZE)
73 #define TC_TZC_DRAM1_SIZE		(96 * SZ_1M)	/* 96 MB */
74 #define TC_TZC_DRAM1_END		(TC_TZC_DRAM1_BASE +		\
75 					 TC_TZC_DRAM1_SIZE - 1)
76 
77 #define TC_NS_DRAM1_BASE		ARM_DRAM1_BASE
78 #define TC_NS_DRAM1_SIZE		(ARM_DRAM1_SIZE -		\
79 					 ARM_TZC_DRAM1_SIZE -		\
80 					 TC_TZC_DRAM1_SIZE)
81 #define TC_NS_DRAM1_END			(TC_NS_DRAM1_BASE + TC_NS_DRAM1_SIZE - 1)
82 
83 #define TC_NS_OPTEE_SIZE		(2 * SZ_1M)
84 #define TC_NS_OPTEE_BASE		(TC_NS_DRAM1_BASE + TC_NS_DRAM1_SIZE - TC_NS_OPTEE_SIZE)
85 
86 /*
87  * Mappings for TC DRAM1 (non-secure) and TC TZC DRAM1 (secure)
88  */
89 #define TC_MAP_NS_DRAM1		MAP_REGION_FLAT(		\
90 						TC_NS_DRAM1_BASE,	\
91 						TC_NS_DRAM1_SIZE,	\
92 						MT_MEMORY | MT_RW | MT_NS)
93 
94 
95 #define TC_MAP_TZC_DRAM1		MAP_REGION_FLAT(		\
96 						TC_TZC_DRAM1_BASE,	\
97 						TC_TZC_DRAM1_SIZE,	\
98 						MT_MEMORY | MT_RW | MT_SECURE)
99 
100 #define PLAT_HW_CONFIG_DTB_BASE	TC_NS_DRAM1_BASE
101 #define PLAT_ARM_HW_CONFIG_SIZE	ULL(0x8000)
102 
103 #define PLAT_DTB_DRAM_NS MAP_REGION_FLAT(	\
104 					PLAT_HW_CONFIG_DTB_BASE,	\
105 					PLAT_ARM_HW_CONFIG_SIZE,	\
106 					MT_MEMORY | MT_RO | MT_NS)
107 /*
108  * Max size of SPMC is 2MB for tc. With SPMD enabled this value corresponds to
109  * max size of BL32 image.
110  */
111 #if defined(SPD_spmd)
112 #define TC_EL2SPMC_LOAD_ADDR		(TC_TZC_DRAM1_BASE + 0x04000000)
113 
114 #define PLAT_ARM_SPMC_BASE		TC_EL2SPMC_LOAD_ADDR
115 #define PLAT_ARM_SPMC_SIZE		UL(0x200000)  /* 2 MB */
116 #endif
117 
118 /*
119  * PLAT_ARM_MMAP_ENTRIES depends on the number of entries in the
120  * plat_arm_mmap array defined for each BL stage.
121  */
122 #if defined(IMAGE_BL31)
123 # if SPM_MM
124 #  define PLAT_ARM_MMAP_ENTRIES		9
125 #  define MAX_XLAT_TABLES		7
126 #  define PLAT_SP_IMAGE_MMAP_REGIONS	7
127 #  define PLAT_SP_IMAGE_MAX_XLAT_TABLES	10
128 # else
129 #  define PLAT_ARM_MMAP_ENTRIES		8
130 #  define MAX_XLAT_TABLES		8
131 # endif
132 #elif defined(IMAGE_BL32)
133 # define PLAT_ARM_MMAP_ENTRIES		8
134 # define MAX_XLAT_TABLES		5
135 #elif !USE_ROMLIB
136 # define PLAT_ARM_MMAP_ENTRIES		11
137 # define MAX_XLAT_TABLES		7
138 #else
139 # define PLAT_ARM_MMAP_ENTRIES		12
140 # define MAX_XLAT_TABLES		6
141 #endif
142 
143 /*
144  * PLAT_ARM_MAX_BL1_RW_SIZE is calculated using the current BL1 RW debug size
145  * plus a little space for growth.
146  */
147 #define PLAT_ARM_MAX_BL1_RW_SIZE	0x12000
148 
149 /*
150  * PLAT_ARM_MAX_ROMLIB_RW_SIZE is define to use a full page
151  */
152 
153 #if USE_ROMLIB
154 #define PLAT_ARM_MAX_ROMLIB_RW_SIZE	0x1000
155 #define PLAT_ARM_MAX_ROMLIB_RO_SIZE	0xe000
156 #else
157 #define PLAT_ARM_MAX_ROMLIB_RW_SIZE	0
158 #define PLAT_ARM_MAX_ROMLIB_RO_SIZE	0
159 #endif
160 
161 /*
162  * PLAT_ARM_MAX_BL2_SIZE is calculated using the current BL2 debug size plus a
163  * little space for growth. Current size is considering that TRUSTED_BOARD_BOOT
164  * and MEASURED_BOOT is enabled.
165  */
166 # define PLAT_ARM_MAX_BL2_SIZE		0x29000
167 
168 
169 /*
170  * Since BL31 NOBITS overlays BL2 and BL1-RW, PLAT_ARM_MAX_BL31_SIZE is
171  * calculated using the current BL31 PROGBITS debug size plus the sizes of
172  * BL2 and BL1-RW. Current size is considering that TRUSTED_BOARD_BOOT and
173  * MEASURED_BOOT is enabled.
174  */
175 #define PLAT_ARM_MAX_BL31_SIZE		0x60000
176 
177 /*
178  * Size of cacheable stacks
179  */
180 #if defined(IMAGE_BL1)
181 #  define PLATFORM_STACK_SIZE		0x1000
182 #elif defined(IMAGE_BL2)
183 #  define PLATFORM_STACK_SIZE		0x1000
184 #elif defined(IMAGE_BL2U)
185 # define PLATFORM_STACK_SIZE		0x400
186 #elif defined(IMAGE_BL31)
187 # if SPM_MM
188 #  define PLATFORM_STACK_SIZE		0x500
189 # else
190 #  define PLATFORM_STACK_SIZE		0xb00
191 # endif
192 #elif defined(IMAGE_BL32)
193 # define PLATFORM_STACK_SIZE		0x440
194 #endif
195 
196 /*
197  * In the current implementation the RoT Service request that requires the
198  * biggest message buffer is the RSE_DELEGATED_ATTEST_GET_PLATFORM_TOKEN. The
199  * maximum required buffer size is calculated based on the platform-specific
200  * needs of this request.
201  */
202 #define PLAT_RSE_COMMS_PAYLOAD_MAX_SIZE	0x500
203 
204 #define TC_DEVICE_BASE			0x21000000
205 #define TC_DEVICE_SIZE			0x5f000000
206 
207 #if defined(TARGET_FLAVOUR_FPGA)
208 #undef V2M_FLASH0_BASE
209 #undef V2M_FLASH0_SIZE
210 #if TC_FPGA_FIP_IMG_IN_RAM
211 /*
212  * Note that this is just used for the FIP, which is not required
213  * anymore once Linux has commenced booting. So we are safe allowing
214  * Linux to also make use of this memory and it doesn't need to be
215  * carved out of the devicetree.
216  *
217  * This only needs to match the RAM load address that we give the FIP
218  * on either the FPGA or FVP command line so there is no need to link
219  * it to say halfway through the RAM or anything like that.
220  */
221 #define V2M_FLASH0_BASE			UL(0xB0000000)
222 #else
223 #define V2M_FLASH0_BASE			UL(0x0C000000)
224 #endif
225 #define V2M_FLASH0_SIZE			UL(0x02000000)
226 #endif
227 
228 // TC_MAP_DEVICE covers different peripherals
229 // available to the platform
230 #define TC_MAP_DEVICE	MAP_REGION_FLAT(		\
231 					TC_DEVICE_BASE,	\
232 					TC_DEVICE_SIZE,	\
233 					MT_DEVICE | MT_RW | MT_SECURE)
234 
235 
236 #define TC_FLASH0_RO	MAP_REGION_FLAT(V2M_FLASH0_BASE,\
237 						V2M_FLASH0_SIZE,	\
238 						MT_DEVICE | MT_RO | MT_SECURE)
239 #if TARGET_PLATFORM == 2
240 #define PLAT_ARM_NSTIMER_FRAME_ID	U(0)
241 #else
242 #define PLAT_ARM_NSTIMER_FRAME_ID	U(1)
243 #endif
244 
245 #define PLAT_ARM_TRUSTED_ROM_BASE	0x0
246 
247 /* PLAT_ARM_TRUSTED_ROM_SIZE 512KB minus ROM base. */
248 #define PLAT_ARM_TRUSTED_ROM_SIZE	(0x00080000 - PLAT_ARM_TRUSTED_ROM_BASE)
249 
250 #define PLAT_ARM_NSRAM_BASE		0x06000000
251 #if TARGET_FLAVOUR_FVP
252 #define PLAT_ARM_NSRAM_SIZE		0x00080000	/* 512KB */
253 #else /* TARGET_FLAVOUR_FPGA */
254 #define PLAT_ARM_NSRAM_SIZE		0x00008000	/* 64KB */
255 #endif /* TARGET_FLAVOUR_FPGA */
256 
257 #if TARGET_PLATFORM <= 2
258 #define PLAT_ARM_DRAM2_BASE		ULL(0x8080000000)
259 #define PLAT_ARM_DRAM2_SIZE             ULL(0x180000000)
260 #elif TARGET_PLATFORM >= 3
261 
262 #if TC_FPGA_FS_IMG_IN_RAM
263 /* 10GB reserved for system+userdata+vendor images */
264 #define SYSTEM_IMAGE_SIZE		0xC0000000	/* 3GB */
265 #define USERDATA_IMAGE_SIZE		0x140000000	/* 5GB */
266 #define VENDOR_IMAGE_SIZE		0x20000000 	/* 512MB */
267 #define RESERVE_IMAGE_SIZE		0x60000000      /* 1.5GB */
268 #define ANDROID_FS_SIZE			(SYSTEM_IMAGE_SIZE + \
269 					 USERDATA_IMAGE_SIZE + \
270 					 VENDOR_IMAGE_SIZE + RESERVE_IMAGE_SIZE)
271 
272 #define PLAT_ARM_DRAM2_BASE		ULL(0x880000000) + ANDROID_FS_SIZE
273 #define PLAT_ARM_DRAM2_SIZE		ULL(0x380000000) - ANDROID_FS_SIZE
274 #else
275 #define PLAT_ARM_DRAM2_BASE             ULL(0x880000000)
276 #define PLAT_ARM_DRAM2_SIZE             ULL(0x180000000)
277 #endif /* TC_FPGA_FS_IMG_IN_RAM */
278 
279 #endif /* TARGET_VERSION >= 3 */
280 
281 #define PLAT_ARM_DRAM2_END		(PLAT_ARM_DRAM2_BASE + PLAT_ARM_DRAM2_SIZE - 1ULL)
282 
283 #define TC_NS_MTE_SIZE			(256 * SZ_1M)
284 /* the SCP puts the carveout at the end of DRAM2 */
285 #define TC_NS_DRAM2_SIZE		(PLAT_ARM_DRAM2_SIZE - TC_NS_MTE_SIZE)
286 
287 #define PLAT_ARM_G1S_IRQ_PROPS(grp)	CSS_G1S_INT_PROPS(grp)
288 #define PLAT_ARM_G0_IRQ_PROPS(grp)	ARM_G0_IRQ_PROPS(grp),	\
289 					INTR_PROP_DESC(SBSA_SECURE_WDOG_INTID,	\
290 						GIC_HIGHEST_SEC_PRIORITY, grp, \
291 						GIC_INTR_CFG_LEVEL)
292 
293 #define PLAT_ARM_SP_IMAGE_STACK_BASE	(PLAT_SP_IMAGE_NS_BUF_BASE +	\
294 					 PLAT_SP_IMAGE_NS_BUF_SIZE)
295 
296 #define PLAT_ARM_SP_MAX_SIZE		U(0x2000000)
297 
298 /*******************************************************************************
299  * Memprotect definitions
300  ******************************************************************************/
301 /* PSCI memory protect definitions:
302  * This variable is stored in a non-secure flash because some ARM reference
303  * platforms do not have secure NVRAM. Real systems that provided MEM_PROTECT
304  * support must use a secure NVRAM to store the PSCI MEM_PROTECT definitions.
305  */
306 #define PLAT_ARM_MEM_PROT_ADDR		(V2M_FLASH0_BASE + \
307 					 V2M_FLASH0_SIZE - V2M_FLASH_BLOCK_SIZE)
308 
309 /* Secure Watchdog Constants */
310 #define SBSA_SECURE_WDOG_CONTROL_BASE	UL(0x2A480000)
311 #define SBSA_SECURE_WDOG_REFRESH_BASE	UL(0x2A490000)
312 #define SBSA_SECURE_WDOG_TIMEOUT	UL(100)
313 #define SBSA_SECURE_WDOG_INTID		86
314 
315 #define PLAT_ARM_SCMI_CHANNEL_COUNT	1
316 
317 /* Index of SDS region used in the communication with SCP */
318 #define SDS_SCP_AP_REGION_ID		U(0)
319 /* Index of SDS region used in the communication with RSE */
320 #define SDS_RSE_AP_REGION_ID		U(1)
321 /*
322  * Memory region for RSE's shared data storage (SDS)
323  * It is placed right after the SCMI payload area.
324  */
325 #define PLAT_ARM_RSE_AP_SDS_MEM_BASE	(CSS_SCMI_PAYLOAD_BASE + \
326 					 CSS_SCMI_PAYLOAD_SIZE_MAX)
327 
328 #define PLAT_ARM_CLUSTER_COUNT		U(1)
329 #if TARGET_FLAVOUR_FPGA && TARGET_PLATFORM == 2
330 #define PLAT_MAX_CPUS_PER_CLUSTER	U(14)
331 #else /* TARGET_FLAVOUR_FPGA && TARGET_PLATFORM == 2 */
332 #define PLAT_MAX_CPUS_PER_CLUSTER	U(8)
333 #endif /* TARGET_FLAVOUR_FPGA && TARGET_PLATFORM == 2 */
334 #define PLAT_MAX_PE_PER_CPU		U(1)
335 
336 #define PLATFORM_CORE_COUNT		(PLAT_MAX_CPUS_PER_CLUSTER * PLAT_ARM_CLUSTER_COUNT)
337 
338 /* Message Handling Unit (MHU) base addresses */
339 #if TARGET_PLATFORM <= 2
340 	#define PLAT_CSS_MHU_BASE		UL(0x45400000)
341 #elif TARGET_PLATFORM >= 3
342 	#define PLAT_CSS_MHU_BASE		UL(0x46000000)
343 #endif /* TARGET_PLATFORM >= 3 */
344 #define PLAT_MHUV2_BASE			PLAT_CSS_MHU_BASE
345 
346 /* AP<->RSS MHUs */
347 #if TARGET_PLATFORM <= 2
348 #define PLAT_RSE_AP_SND_MHU_BASE	UL(0x2A840000)
349 #define PLAT_RSE_AP_RCV_MHU_BASE	UL(0x2A850000)
350 #elif TARGET_PLATFORM == 3
351 #define PLAT_RSE_AP_SND_MHU_BASE	UL(0x49000000)
352 #define PLAT_RSE_AP_RCV_MHU_BASE	UL(0x49100000)
353 #elif TARGET_PLATFORM == 4
354 #define PLAT_RSE_AP_SND_MHU_BASE	UL(0x49000000)
355 #define PLAT_RSE_AP_RCV_MHU_BASE	UL(0x49010000)
356 #endif
357 
358 #define CSS_SYSTEM_PWR_DMN_LVL		ARM_PWR_LVL2
359 #define PLAT_MAX_PWR_LVL		ARM_PWR_LVL1
360 
361 /*
362  * Physical and virtual address space limits for MMU in AARCH64
363  */
364 #define PLAT_PHY_ADDR_SPACE_SIZE	(1ULL << 36)
365 #define PLAT_VIRT_ADDR_SPACE_SIZE	(1ULL << 36)
366 
367 /* GIC related constants */
368 #define PLAT_ARM_GICD_BASE		UL(0x30000000)
369 #define PLAT_ARM_GICC_BASE		UL(0x2C000000)
370 #define PLAT_ARM_GICR_BASE		UL(0x30080000)
371 
372 /*
373  * PLAT_CSS_MAX_SCP_BL2_SIZE is calculated using the current
374  * SCP_BL2 size plus a little space for growth.
375  */
376 #define PLAT_CSS_MAX_SCP_BL2_SIZE	0x30000
377 
378 /*
379  * PLAT_CSS_MAX_SCP_BL2U_SIZE is calculated using the current
380  * SCP_BL2U size plus a little space for growth.
381  */
382 #define PLAT_CSS_MAX_SCP_BL2U_SIZE	0x30000
383 
384 #if TARGET_PLATFORM <= 2
385 /* TZC Related Constants */
386 #define PLAT_ARM_TZC_BASE		UL(0x25000000)
387 #define PLAT_ARM_TZC_FILTERS		TZC_400_REGION_ATTR_FILTER_BIT(0)
388 
389 #define TZC400_OFFSET			UL(0x1000000)
390 #define TZC400_COUNT			4
391 
392 #define TZC400_BASE(n)			(PLAT_ARM_TZC_BASE + \
393 					 (n * TZC400_OFFSET))
394 
395 #define TZC_NSAID_DEFAULT		U(0)
396 
397 #define PLAT_ARM_TZC_NS_DEV_ACCESS	\
398 		(TZC_REGION_ACCESS_RDWR(TZC_NSAID_DEFAULT))
399 
400 /*
401  * The first region below, TC_TZC_DRAM1_BASE (0xf9000000) to
402  * ARM_SCP_TZC_DRAM1_END (0xffffffff) will mark the last 112 MB of DRAM as
403  * secure. The second and third regions gives non secure access to rest of DRAM.
404  */
405 #define TC_TZC_REGIONS_DEF	\
406 	{TC_TZC_DRAM1_BASE, ARM_SCP_TZC_DRAM1_END,	\
407 		TZC_REGION_S_RDWR, PLAT_ARM_TZC_NS_DEV_ACCESS},	\
408 	{TC_NS_DRAM1_BASE, TC_NS_DRAM1_END, ARM_TZC_NS_DRAM_S_ACCESS,	\
409 		PLAT_ARM_TZC_NS_DEV_ACCESS},	\
410 	{PLAT_ARM_DRAM2_BASE, PLAT_ARM_DRAM2_END,	\
411 		ARM_TZC_NS_DRAM_S_ACCESS, PLAT_ARM_TZC_NS_DEV_ACCESS}
412 #endif
413 
414 /* virtual address used by dynamic mem_protect for chunk_base */
415 #define PLAT_ARM_MEM_PROTEC_VA_FRAME	UL(0xc0000000)
416 
417 #if ARM_GPT_SUPPORT
418 /*
419  * This overrides the default PLAT_ARM_FIP_OFFSET_IN_GPT in board_css_def.h.
420  * Offset of the FIP in the GPT image. BL1 component uses this option
421  * as it does not load the partition table to get the FIP base
422  * address. At sector 48 for TC to align with ATU page size boundaries (8KiB)
423  * (i.e. after reserved sectors 0-47).
424  * Offset = 48 * 512 = 0x6000
425  */
426 #undef PLAT_ARM_FIP_OFFSET_IN_GPT
427 #define PLAT_ARM_FIP_OFFSET_IN_GPT		0x6000
428 #endif /* ARM_GPT_SUPPORT */
429 
430 /* UART related constants */
431 
432 #define TC_UART0			0x2a400000
433 #define TC_UART1			0x2a410000
434 
435 /*
436  * TODO: if any more undefs are needed, it's better to consider dropping the
437  * board_css_def.h include above
438  */
439 #undef PLAT_ARM_BOOT_UART_BASE
440 #undef PLAT_ARM_RUN_UART_BASE
441 
442 #undef PLAT_ARM_CRASH_UART_BASE
443 #undef PLAT_ARM_BOOT_UART_CLK_IN_HZ
444 #undef PLAT_ARM_RUN_UART_CLK_IN_HZ
445 
446 #undef  ARM_CONSOLE_BAUDRATE
447 #define ARM_CONSOLE_BAUDRATE		38400
448 
449 #if TARGET_PLATFORM <= 2
450 #define TC_UARTCLK			5000000
451 #elif TARGET_PLATFORM == 3
452 #define TC_UARTCLK			3750000
453 #elif TARGET_PLATFORM == 4
454 #define TC_UARTCLK			4000000
455 #endif /* TARGET_PLATFORM <=2 */
456 
457 
458 #if TARGET_FLAVOUR_FVP
459 #define PLAT_ARM_BOOT_UART_BASE		TC_UART1
460 #else /* TARGET_FLAVOUR_FPGA */
461 #define PLAT_ARM_BOOT_UART_BASE		TC_UART0
462 #endif /* TARGET_FLAVOUR_FPGA */
463 
464 #define PLAT_ARM_RUN_UART_BASE		TC_UART0
465 #define PLAT_ARM_CRASH_UART_BASE	PLAT_ARM_RUN_UART_BASE
466 
467 #define PLAT_ARM_BOOT_UART_CLK_IN_HZ	TC_UARTCLK
468 #define PLAT_ARM_RUN_UART_CLK_IN_HZ	TC_UARTCLK
469 
470 #if (TARGET_PLATFORM == 3) || (TARGET_PLATFORM == 4)
471 #define NCI_BASE_ADDR			UL(0x4F000000)
472 #if (TARGET_PLATFORM == 3) && defined(TARGET_FLAVOUR_FPGA)
473 #define MCN_ADDRESS_SPACE_SIZE		0x00120000
474 #else
475 #define MCN_ADDRESS_SPACE_SIZE		0x00130000
476 #endif	/* (TARGET_PLATFORM == 3) && defined(TARGET_FLAVOUR_FPGA) */
477 #if TARGET_PLATFORM == 3
478 #define MCN_OFFSET_IN_NCI		0x00C90000
479 #else	/* TARGET_PLATFORM == 4 */
480 #ifdef TARGET_FLAVOUR_FPGA
481 #define MCN_OFFSET_IN_NCI		0x00420000
482 #else
483 #define MCN_OFFSET_IN_NCI		0x00D80000
484 #endif	/* TARGET_FLAVOUR_FPGA */
485 #endif	/* TARGET_PLATFORM == 3 */
486 #define MCN_BASE_ADDR(n)		(NCI_BASE_ADDR + MCN_OFFSET_IN_NCI + \
487 								((n) * MCN_ADDRESS_SPACE_SIZE))
488 #define MCN_PMU_OFFSET			0x000C4000
489 #define MCN_MICROARCH_OFFSET		0x000E4000
490 #define MCN_MICROARCH_BASE_ADDR(n)		(MCN_BASE_ADDR(n) + \
491 										MCN_MICROARCH_OFFSET)
492 #define MCN_SCR_OFFSET			0x4
493 #define MCN_SCR_PMU_BIT			10
494 #if TARGET_PLATFORM == 3
495 #define MCN_INSTANCES			4
496 #else	/* TARGET_PLATFORM == 4 */
497 #define MCN_INSTANCES			8
498 #endif	/* TARGET_PLATFORM == 3 */
499 #define MCN_PMU_ADDR(n)			(MCN_BASE_ADDR(n) + \
500 								MCN_PMU_OFFSET)
501 #define MCN_MPAM_NS_OFFSET		0x000D0000
502 #define MCN_MPAM_NS_BASE_ADDR(n)		(MCN_BASE_ADDR(n) + MCN_MPAM_NS_OFFSET)
503 #define MCN_MPAM_S_OFFSET		0x000D4000
504 #define MCN_MPAM_S_BASE_ADDR(n)		(MCN_BASE_ADDR(n) + MCN_MPAM_S_OFFSET)
505 #define MPAM_SLCCFG_CTL_OFFSET		0x00003018
506 #define SLC_RDALLOCMODE_SHIFT		8
507 #define SLC_RDALLOCMODE_MASK		(3 << SLC_RDALLOCMODE_SHIFT)
508 #define SLC_WRALLOCMODE_SHIFT		12
509 #define SLC_WRALLOCMODE_MASK		(3 << SLC_WRALLOCMODE_SHIFT)
510 
511 #define SLC_DONT_ALLOC			0
512 #define SLC_ALWAYS_ALLOC		1
513 #define SLC_ALLOC_BUS_SIGNAL_ATTR	2
514 
515 #define MCN_CONFIG_OFFSET		0x204
516 #define MCN_CONFIG_ADDR(n)			(MCN_BASE_ADDR(n) + MCN_CONFIG_OFFSET)
517 #define MCN_CONFIG_SLC_PRESENT_BIT	3
518 
519 /*
520  * TC3 CPUs have the same definitions for:
521  *   CORTEX_{A520|A725|X925}_CPUECTLR_EL1
522  *   CORTEX_{A520|A725|X925}_CPUECTLR_EL1_EXTLLC_BIT
523  * Define the common macros for easier using.
524  */
525 #define CPUECTLR_EL1			CORTEX_A520_CPUECTLR_EL1
526 #define CPUECTLR_EL1_EXTLLC_BIT		CORTEX_A520_CPUECTLR_EL1_EXTLLC_BIT
527 #endif /* (TARGET_PLATFORM == 3) || (TARGET_PLATFORM == 4) */
528 
529 #define CPUACTLR_CLUSTERPMUEN		(ULL(1) << 12)
530 
531 #endif /* PLATFORM_DEF_H */
532