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