Debian Codegraph @

plat/arm/board/neoverse_rd/common/include/nrd1/nrd_plat_arm_def1.h

raw
1 /*
2 * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 * This file is limited to include the platform port definitions for the
7 * first generation platforms based on the A75, N1 and V1 CPUs.
8 */
9
10 #ifndef NRD_PLAT_ARM_DEF1_H
11 #define NRD_PLAT_ARM_DEF1_H
12
13 #ifndef __ASSEMBLER__
14 #include <lib/mmio.h>
15 #endif /* __ASSEMBLER__ */
16
17 #include <lib/utils_def.h>
18 #include <lib/xlat_tables/xlat_tables_defs.h>
19 #include <plat/arm/board/common/v2m_def.h>
20 #include <plat/arm/common/arm_def.h>
21 #include <plat/arm/common/arm_spm_def.h>
22 #include <plat/arm/css/common/css_def.h>
23 #include <plat/arm/soc/common/soc_css_def.h>
24 #include <plat/common/common_def.h>
25 #include <nrd_css_fw_def1.h>
26 #include <nrd_ros_fw_def1.h>
27
28 /*******************************************************************************
29 * Core count
30 ******************************************************************************/
31
32 #define PLATFORM_CORE_COUNT (NRD_CHIP_COUNT * \
33 PLAT_ARM_CLUSTER_COUNT * \
34 NRD_MAX_CPUS_PER_CLUSTER * \
35 NRD_MAX_PE_PER_CPU)
36
37 /*******************************************************************************
38 * PA/VA config
39 ******************************************************************************/
40
41 #ifdef __aarch64__
42 #define PLAT_PHY_ADDR_SPACE_SIZE NRD_REMOTE_CHIP_MEM_OFFSET( \
43 NRD_CHIP_COUNT)
44 #define PLAT_VIRT_ADDR_SPACE_SIZE NRD_REMOTE_CHIP_MEM_OFFSET( \
45 NRD_CHIP_COUNT)
46 #else
47 #define PLAT_PHY_ADDR_SPACE_SIZE (1ULL << 32)
48 #define PLAT_VIRT_ADDR_SPACE_SIZE (1ULL << 32)
49 #endif
50
51 /*******************************************************************************
52 * XLAT definitions
53 ******************************************************************************/
54
55 #if defined(IMAGE_BL31)
56 # if SPM_MM || (SPMC_AT_EL3 && SPMC_AT_EL3_SEL0_SP)
57 # define PLAT_ARM_MMAP_ENTRIES (10 + ((NRD_CHIP_COUNT - 1) * 3))
58 # define MAX_XLAT_TABLES (11 + ((NRD_CHIP_COUNT - 1) * 3))
59 # define PLAT_SP_IMAGE_MMAP_REGIONS U(12)
60 # define PLAT_SP_IMAGE_MAX_XLAT_TABLES U(14)
61 # else
62 # define PLAT_ARM_MMAP_ENTRIES (5 + ((NRD_CHIP_COUNT - 1) * 3))
63 # define MAX_XLAT_TABLES (6 + ((NRD_CHIP_COUNT - 1) * 3))
64 # endif
65 #elif defined(IMAGE_BL32)
66 # define PLAT_ARM_MMAP_ENTRIES U(8)
67 # define MAX_XLAT_TABLES U(5)
68 #elif defined(IMAGE_BL2)
69 # define PLAT_ARM_MMAP_ENTRIES (11 + (NRD_CHIP_COUNT - 1))
70
71 /*
72 * MAX_XLAT_TABLES entries need to be doubled because when the address width
73 * exceeds 40 bits an additional level of translation is required. In case of
74 * multichip platforms peripherals also fall into address space with width
75 * > 40 bits.
76 */
77 # define MAX_XLAT_TABLES (11 + ((NRD_CHIP_COUNT - 1) * 2))
78 #elif !USE_ROMLIB
79 # define PLAT_ARM_MMAP_ENTRIES U(11)
80 # define MAX_XLAT_TABLES U(7)
81 #else
82 # define PLAT_ARM_MMAP_ENTRIES U(12)
83 # define MAX_XLAT_TABLES U(6)
84 #endif
85
86 /*******************************************************************************
87 * Stack size
88 ******************************************************************************/
89
90 #if defined(IMAGE_BL1)
91 # if TRUSTED_BOARD_BOOT
92 # define PLATFORM_STACK_SIZE U(0x1000)
93 # else
94 # define PLATFORM_STACK_SIZE U(0x440)
95 # endif
96 #elif defined(IMAGE_BL2)
97 # if TRUSTED_BOARD_BOOT
98 # define PLATFORM_STACK_SIZE U(0x1000)
99 # else
100 # define PLATFORM_STACK_SIZE U(0x400)
101 # endif
102 #elif defined(IMAGE_BL2U)
103 # define PLATFORM_STACK_SIZE U(0x400)
104 #elif defined(IMAGE_BL31)
105 # if SPM_MM
106 # define PLATFORM_STACK_SIZE U(0x500)
107 # else
108 # define PLATFORM_STACK_SIZE U(0x400)
109 # endif
110 #elif defined(IMAGE_BL32)
111 # define PLATFORM_STACK_SIZE U(0x440)
112 #endif
113
114 #if (SPM_MM || (SPMC_AT_EL3 && SPMC_AT_EL3_SEL0_SP))
115 /*
116 * Secure partition stack follows right after the memory region that is shared
117 * between EL3 and S-EL0.
118 */
119 #define PLAT_ARM_SP_IMAGE_STACK_BASE (PLAT_SP_IMAGE_NS_BUF_BASE + \
120 PLAT_SP_IMAGE_NS_BUF_SIZE)
121 #endif /* SPM_MM || (SPMC_AT_EL3 && SPMC_AT_EL3_SEL0_SP) */
122
123 /*******************************************************************************
124 * BL sizes
125 ******************************************************************************/
126
127 #if USE_ROMLIB
128 #define PLAT_ARM_MAX_ROMLIB_RW_SIZE U(0x1000)
129 #define PLAT_ARM_MAX_ROMLIB_RO_SIZE U(0xe000)
130 #else
131 #define PLAT_ARM_MAX_ROMLIB_RW_SIZE U(0)
132 #define PLAT_ARM_MAX_ROMLIB_RO_SIZE U(0)
133 #endif
134
135 #define PLAT_ARM_MAX_BL1_RW_SIZE NRD_CSS_BL1_RW_SIZE
136
137 /*
138 * PLAT_ARM_MAX_BL2_SIZE is calculated using the current BL2 debug size plus a
139 * little space for growth. Additional 8KiB space is added per chip in
140 * order to accommodate the additional level of translation required for "TZC"
141 * peripheral access which lies in >4TB address space.
142 *
143 */
144 #define PLAT_ARM_MAX_BL2_SIZE (NRD_CSS_BL2_SIZE + \
145 ((NRD_CHIP_COUNT - 1) * 0x2000))
146
147 #define PLAT_ARM_MAX_BL31_SIZE (NRD_CSS_BL31_SIZE + \
148 PLAT_ARM_MAX_BL2_SIZE + \
149 PLAT_ARM_MAX_BL1_RW_SIZE)
150
151 /*******************************************************************************
152 * ROM, SRAM and DRAM config
153 ******************************************************************************/
154
155 #define PLAT_ARM_TRUSTED_SRAM_SIZE NRD_CSS_TRUSTED_SRAM_SIZE
156
157 #define PLAT_ARM_TRUSTED_ROM_BASE NRD_CSS_TRUSTED_ROM_BASE
158 #define PLAT_ARM_TRUSTED_ROM_SIZE NRD_CSS_TRUSTED_ROM_SIZE
159
160 #define PLAT_ARM_NSRAM_BASE NRD_CSS_NONTRUSTED_SRAM_BASE
161 #define PLAT_ARM_NSRAM_SIZE NRD_CSS_NONTRUSTED_SRAM_SIZE
162
163 #define PLAT_ARM_DRAM2_BASE NRD_CSS_DRAM2_BASE
164 #define PLAT_ARM_DRAM2_SIZE NRD_CSS_DRAM2_SIZE
165
166 /*******************************************************************************
167 * Console config
168 ******************************************************************************/
169
170 #define PLAT_ARM_BOOT_UART_BASE NRD_CSS_SEC_UART_BASE
171 #define PLAT_ARM_BOOT_UART_CLK_IN_HZ NRD_CSS_UART_CLK_IN_HZ
172
173 #define PLAT_ARM_RUN_UART_BASE NRD_CSS_SEC_UART_BASE
174 #define PLAT_ARM_RUN_UART_CLK_IN_HZ NRD_CSS_UART_CLK_IN_HZ
175
176 #define PLAT_ARM_CRASH_UART_BASE NRD_CSS_SEC_UART_BASE
177 #define PLAT_ARM_CRASH_UART_CLK_IN_HZ NRD_CSS_UART_CLK_IN_HZ
178
179 /*******************************************************************************
180 * Timer config
181 ******************************************************************************/
182
183 #define PLAT_ARM_NSTIMER_FRAME_ID (0)
184
185 /*******************************************************************************
186 * Power config
187 ******************************************************************************/
188
189 #define CSS_SYSTEM_PWR_DMN_LVL ARM_PWR_LVL2
190 #define PLAT_MAX_PWR_LVL ARM_PWR_LVL1
191
192 /*******************************************************************************
193 * Flash config
194 ******************************************************************************/
195
196 #define PLAT_ARM_FLASH_IMAGE_BASE V2M_FLASH0_BASE
197 #define PLAT_ARM_FLASH_IMAGE_MAX_SIZE (V2M_FLASH0_SIZE - V2M_FLASH_BLOCK_SIZE)
198 #define PLAT_ARM_NVM_BASE V2M_FLASH0_BASE
199 #define PLAT_ARM_NVM_SIZE (V2M_FLASH0_SIZE - V2M_FLASH_BLOCK_SIZE)
200 #define PLAT_ARM_MEM_PROT_ADDR (V2M_FLASH0_BASE + \
201 V2M_FLASH0_SIZE - V2M_FLASH_BLOCK_SIZE)
202 /* IO storage framework */
203 #define MAX_IO_DEVICES U(3)
204 #define MAX_IO_HANDLES U(4)
205
206 /*******************************************************************************
207 * SCMI config
208 ******************************************************************************/
209
210 /* Number of SCMI channels on the platform */
211 #define PLAT_ARM_SCMI_CHANNEL_COUNT NRD_CHIP_COUNT
212
213 /*******************************************************************************
214 * SDS config
215 ******************************************************************************/
216
217 /* Index of SDS region used in the communication with SCP */
218 #define SDS_SCP_AP_REGION_ID U(0)
219 /* SDS ID for unusable CPU MPID list structure */
220 #define SDS_ISOLATED_CPU_LIST_ID U(128)
221
222 /*******************************************************************************
223 * GIC/EHF config
224 ******************************************************************************/
225
226 #define PLAT_ARM_G1S_IRQ_PROPS(grp) CSS_G1S_IRQ_PROPS(grp)
227 #define PLAT_ARM_G0_IRQ_PROPS(grp) ARM_G0_IRQ_PROPS(grp)
228 #define PLAT_SP_PRI U(0x10)
229
230 /*******************************************************************************
231 * Platform type identification macro
232 ******************************************************************************/
233
234 /* Platform ID related accessors */
235 #define BOARD_CSS_PLAT_ID_REG_ID_MASK U(0x0f)
236 #define BOARD_CSS_PLAT_ID_REG_ID_SHIFT U(0x0)
237 #define BOARD_CSS_PLAT_TYPE_EMULATOR U(0x02)
238
239 #ifndef __ASSEMBLER__
240 #define BOARD_CSS_GET_PLAT_TYPE(addr) \
241 ((mmio_read_32(addr) & BOARD_CSS_PLAT_ID_REG_ID_MASK) \
242 >> BOARD_CSS_PLAT_ID_REG_ID_SHIFT)
243 #endif /* __ASSEMBLER__ */
244
245 /* Platform ID address */
246 #define BOARD_CSS_PLAT_ID_REG_ADDR NRD_ROS_PLATFORM_BASE + \
247 UL(0x00fe00e0)
248
249 #endif /* NRD_PLAT_ARM_DEF1_H */