xref: /arm-trusted-firmware/plat/nxp/common/include/default/plat_default_def.h (revision 91f16700b400a8c0651d24a598fc48ee2997a0d7)
1*91f16700Schasinglulu /*
2*91f16700Schasinglulu  * Copyright 2021 NXP
3*91f16700Schasinglulu  *
4*91f16700Schasinglulu  * SPDX-License-Identifier: BSD-3-Clause
5*91f16700Schasinglulu  *
6*91f16700Schasinglulu  */
7*91f16700Schasinglulu 
8*91f16700Schasinglulu #ifndef PLAT_DEFAULT_DEF_H
9*91f16700Schasinglulu #define PLAT_DEFAULT_DEF_H
10*91f16700Schasinglulu 
11*91f16700Schasinglulu /*
12*91f16700Schasinglulu  * Platform binary types for linking
13*91f16700Schasinglulu  */
14*91f16700Schasinglulu #ifdef __aarch64__
15*91f16700Schasinglulu #define PLATFORM_LINKER_FORMAT          "elf64-littleaarch64"
16*91f16700Schasinglulu #define PLATFORM_LINKER_ARCH            aarch64
17*91f16700Schasinglulu #else
18*91f16700Schasinglulu #define PLATFORM_LINKER_FORMAT          "elf32-littlearm"
19*91f16700Schasinglulu #define PLATFORM_LINKER_ARCH            arm
20*91f16700Schasinglulu #endif /* __aarch64__ */
21*91f16700Schasinglulu 
22*91f16700Schasinglulu #define LS_BL31_PLAT_PARAM_VAL		0x0f1e2d3c4b5a6978ULL
23*91f16700Schasinglulu 
24*91f16700Schasinglulu /* NXP Platforms have DRAM divided into banks.
25*91f16700Schasinglulu  * DRAM0 Bank:	Maximum size of this bank is fixed to 2GB
26*91f16700Schasinglulu  * DRAM1 Bank:	Greater than 2GB belongs to bank1 and size of bank1 varies from
27*91f16700Schasinglulu  *		one platform to other platform.
28*91f16700Schasinglulu  * DRAMn Bank:
29*91f16700Schasinglulu  *
30*91f16700Schasinglulu  * Except a few, all the platforms have 2GB size as DRAM0 BANK.
31*91f16700Schasinglulu  * Hence common for all the platforms.
32*91f16700Schasinglulu  * For platforms where DRAM0 Size is < 2GB, it is defined in platform_def.h
33*91f16700Schasinglulu  */
34*91f16700Schasinglulu #ifndef PLAT_DEF_DRAM0_SIZE
35*91f16700Schasinglulu #define PLAT_DEF_DRAM0_SIZE	0x80000000	/*  2G */
36*91f16700Schasinglulu #endif
37*91f16700Schasinglulu 
38*91f16700Schasinglulu /* This is common for all platforms where: */
39*91f16700Schasinglulu #ifndef NXP_NS_DRAM_ADDR
40*91f16700Schasinglulu #define NXP_NS_DRAM_ADDR	NXP_DRAM0_ADDR
41*91f16700Schasinglulu #endif
42*91f16700Schasinglulu 
43*91f16700Schasinglulu /* 1 MB is reserved for dma of sd */
44*91f16700Schasinglulu #ifndef NXP_SD_BLOCK_BUF_SIZE
45*91f16700Schasinglulu #define NXP_SD_BLOCK_BUF_SIZE	(1 * 1024 * 1024)
46*91f16700Schasinglulu #endif
47*91f16700Schasinglulu 
48*91f16700Schasinglulu /* 64MB is reserved for Secure memory */
49*91f16700Schasinglulu #ifndef NXP_SECURE_DRAM_SIZE
50*91f16700Schasinglulu #define NXP_SECURE_DRAM_SIZE	(64 * 1024 * 1024)
51*91f16700Schasinglulu #endif
52*91f16700Schasinglulu 
53*91f16700Schasinglulu /* 2M Secure EL1 Payload Shared Memory */
54*91f16700Schasinglulu #ifndef NXP_SP_SHRD_DRAM_SIZE
55*91f16700Schasinglulu #define NXP_SP_SHRD_DRAM_SIZE	(2 * 1024 * 1024)
56*91f16700Schasinglulu #endif
57*91f16700Schasinglulu 
58*91f16700Schasinglulu #ifndef NXP_NS_DRAM_SIZE
59*91f16700Schasinglulu /* Non secure memory */
60*91f16700Schasinglulu #define NXP_NS_DRAM_SIZE	(PLAT_DEF_DRAM0_SIZE - \
61*91f16700Schasinglulu 				(NXP_SECURE_DRAM_SIZE + NXP_SP_SHRD_DRAM_SIZE))
62*91f16700Schasinglulu #endif
63*91f16700Schasinglulu 
64*91f16700Schasinglulu #ifndef NXP_SD_BLOCK_BUF_ADDR
65*91f16700Schasinglulu #define NXP_SD_BLOCK_BUF_ADDR	(NXP_NS_DRAM_ADDR)
66*91f16700Schasinglulu #endif
67*91f16700Schasinglulu 
68*91f16700Schasinglulu #ifndef NXP_SECURE_DRAM_ADDR
69*91f16700Schasinglulu #ifdef TEST_BL31
70*91f16700Schasinglulu #define NXP_SECURE_DRAM_ADDR 0
71*91f16700Schasinglulu #else
72*91f16700Schasinglulu #define NXP_SECURE_DRAM_ADDR	(NXP_NS_DRAM_ADDR + PLAT_DEF_DRAM0_SIZE - \
73*91f16700Schasinglulu 				(NXP_SECURE_DRAM_SIZE + NXP_SP_SHRD_DRAM_SIZE))
74*91f16700Schasinglulu #endif
75*91f16700Schasinglulu #endif
76*91f16700Schasinglulu 
77*91f16700Schasinglulu #ifndef NXP_SP_SHRD_DRAM_ADDR
78*91f16700Schasinglulu #define NXP_SP_SHRD_DRAM_ADDR	(NXP_NS_DRAM_ADDR + PLAT_DEF_DRAM0_SIZE - \
79*91f16700Schasinglulu 				NXP_SP_SHRD_DRAM_SIZE)
80*91f16700Schasinglulu #endif
81*91f16700Schasinglulu 
82*91f16700Schasinglulu #ifndef BL31_BASE
83*91f16700Schasinglulu /* 2 MB reserved in secure memory for DDR */
84*91f16700Schasinglulu #define BL31_BASE		NXP_SECURE_DRAM_ADDR
85*91f16700Schasinglulu #endif
86*91f16700Schasinglulu 
87*91f16700Schasinglulu #ifndef BL31_SIZE
88*91f16700Schasinglulu #define BL31_SIZE		(0x200000)
89*91f16700Schasinglulu #endif
90*91f16700Schasinglulu 
91*91f16700Schasinglulu #ifndef BL31_LIMIT
92*91f16700Schasinglulu #define BL31_LIMIT		(BL31_BASE + BL31_SIZE)
93*91f16700Schasinglulu #endif
94*91f16700Schasinglulu 
95*91f16700Schasinglulu /* Put BL32 in secure memory */
96*91f16700Schasinglulu #ifndef BL32_BASE
97*91f16700Schasinglulu #define BL32_BASE		(NXP_SECURE_DRAM_ADDR + BL31_SIZE)
98*91f16700Schasinglulu #endif
99*91f16700Schasinglulu 
100*91f16700Schasinglulu #ifndef BL32_LIMIT
101*91f16700Schasinglulu #define BL32_LIMIT		(NXP_SECURE_DRAM_ADDR + \
102*91f16700Schasinglulu 				NXP_SECURE_DRAM_SIZE + NXP_SP_SHRD_DRAM_SIZE)
103*91f16700Schasinglulu #endif
104*91f16700Schasinglulu 
105*91f16700Schasinglulu /* BL33 memory region */
106*91f16700Schasinglulu /* Hardcoded based on current address in u-boot */
107*91f16700Schasinglulu #ifndef BL33_BASE
108*91f16700Schasinglulu #define BL33_BASE		0x82000000
109*91f16700Schasinglulu #endif
110*91f16700Schasinglulu 
111*91f16700Schasinglulu #ifndef BL33_LIMIT
112*91f16700Schasinglulu #define BL33_LIMIT		(NXP_NS_DRAM_ADDR + NXP_NS_DRAM_SIZE)
113*91f16700Schasinglulu #endif
114*91f16700Schasinglulu 
115*91f16700Schasinglulu /*
116*91f16700Schasinglulu  * FIP image defines - Offset at which FIP Image would be present
117*91f16700Schasinglulu  * Image would include Bl31 , Bl33 and Bl32 (optional)
118*91f16700Schasinglulu  */
119*91f16700Schasinglulu #ifdef POLICY_FUSE_PROVISION
120*91f16700Schasinglulu #ifndef FUSE_BUF
121*91f16700Schasinglulu #define FUSE_BUF		ULL(0x81000000)
122*91f16700Schasinglulu #endif
123*91f16700Schasinglulu 
124*91f16700Schasinglulu #ifndef FUSE_SZ
125*91f16700Schasinglulu #define FUSE_SZ			0x80000
126*91f16700Schasinglulu #endif
127*91f16700Schasinglulu #endif
128*91f16700Schasinglulu 
129*91f16700Schasinglulu #ifndef MAX_FIP_DEVICES
130*91f16700Schasinglulu #define MAX_FIP_DEVICES		2
131*91f16700Schasinglulu #endif
132*91f16700Schasinglulu 
133*91f16700Schasinglulu #ifndef PLAT_FIP_OFFSET
134*91f16700Schasinglulu #define PLAT_FIP_OFFSET		0x100000
135*91f16700Schasinglulu #endif
136*91f16700Schasinglulu 
137*91f16700Schasinglulu #ifndef PLAT_FIP_MAX_SIZE
138*91f16700Schasinglulu #define PLAT_FIP_MAX_SIZE	0x400000
139*91f16700Schasinglulu #endif
140*91f16700Schasinglulu 
141*91f16700Schasinglulu /* Check if this size can be determined from array size */
142*91f16700Schasinglulu #if defined(IMAGE_BL2)
143*91f16700Schasinglulu #ifndef MAX_MMAP_REGIONS
144*91f16700Schasinglulu #define MAX_MMAP_REGIONS	8
145*91f16700Schasinglulu #endif
146*91f16700Schasinglulu #ifndef MAX_XLAT_TABLES
147*91f16700Schasinglulu #define MAX_XLAT_TABLES		6
148*91f16700Schasinglulu #endif
149*91f16700Schasinglulu #elif defined(IMAGE_BL31)
150*91f16700Schasinglulu #ifndef MAX_MMAP_REGIONS
151*91f16700Schasinglulu #define MAX_MMAP_REGIONS	9
152*91f16700Schasinglulu #endif
153*91f16700Schasinglulu #ifndef MAX_XLAT_TABLES
154*91f16700Schasinglulu #define MAX_XLAT_TABLES		9
155*91f16700Schasinglulu #endif
156*91f16700Schasinglulu #elif defined(IMAGE_BL32)
157*91f16700Schasinglulu #ifndef MAX_MMAP_REGIONS
158*91f16700Schasinglulu #define MAX_MMAP_REGIONS	8
159*91f16700Schasinglulu #endif
160*91f16700Schasinglulu #ifndef MAX_XLAT_TABLES
161*91f16700Schasinglulu #define MAX_XLAT_TABLES		9
162*91f16700Schasinglulu #endif
163*91f16700Schasinglulu #endif
164*91f16700Schasinglulu 
165*91f16700Schasinglulu /*
166*91f16700Schasinglulu  * ID of the secure physical generic timer interrupt used by the BL32.
167*91f16700Schasinglulu  */
168*91f16700Schasinglulu #ifndef BL32_IRQ_SEC_PHY_TIMER
169*91f16700Schasinglulu #define BL32_IRQ_SEC_PHY_TIMER	29
170*91f16700Schasinglulu #endif
171*91f16700Schasinglulu 
172*91f16700Schasinglulu #endif	/*	PLAT_DEFAULT_DEF_H	*/
173