blob: 6953b898c60425c4a7d73aa84b37c42d88492b08 [file] [log] [blame]
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +01001/*
Rohit Mathew96ee83a2023-12-26 22:33:03 +00002 * Copyright (c) 2021-2024, Arm Limited and Contributors. All rights reserved.
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +01003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef PLATFORM_DEF_H
8#define PLATFORM_DEF_H
9
10#include <common/tbbr/tbbr_img_def.h>
11#include <lib/utils_def.h>
12#include <lib/xlat_tables/xlat_tables_defs.h>
Rohit Mathew96ee83a2023-12-26 22:33:03 +000013#include <plat/arm/board/common/rotpk/rotpk_def.h>
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +010014#include <plat/arm/board/common/v2m_def.h>
15#include <plat/arm/common/arm_spm_def.h>
16#include <plat/arm/common/smccc_def.h>
17#include <plat/common/common_def.h>
18#include <plat/arm/soc/common/soc_css_def.h>
19
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +010020/* Special value used to verify platform parameters from BL2 to BL31 */
David Vinczebfdb7262022-03-03 14:35:51 +010021#define ARM_BL31_PLAT_PARAM_VAL ULL(0x0f1e2d3c4b5a6978)
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +010022
23/* PL011 UART related constants */
24#ifdef V2M_IOFPGA_UART0_CLK_IN_HZ
25#undef V2M_IOFPGA_UART0_CLK_IN_HZ
26#endif
27
28#ifdef V2M_IOFPGA_UART1_CLK_IN_HZ
29#undef V2M_IOFPGA_UART1_CLK_IN_HZ
30#endif
31
David Vinczebfdb7262022-03-03 14:35:51 +010032#define V2M_IOFPGA_UART0_CLK_IN_HZ 50000000
33#define V2M_IOFPGA_UART1_CLK_IN_HZ 50000000
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +010034
Vishnu Banavath2b651ea2022-01-19 18:43:12 +000035/* Core/Cluster/Thread counts for corstone1000 */
David Vinczebfdb7262022-03-03 14:35:51 +010036#define CORSTONE1000_CLUSTER_COUNT U(1)
37#define CORSTONE1000_MAX_CPUS_PER_CLUSTER U(4)
38#define CORSTONE1000_MAX_PE_PER_CPU U(1)
39#define CORSTONE1000_PRIMARY_CPU U(0)
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +010040
David Vinczebfdb7262022-03-03 14:35:51 +010041#define PLAT_ARM_CLUSTER_COUNT CORSTONE1000_CLUSTER_COUNT
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +010042
David Vinczebfdb7262022-03-03 14:35:51 +010043#define PLATFORM_CORE_COUNT (PLAT_ARM_CLUSTER_COUNT * \
44 CORSTONE1000_MAX_CPUS_PER_CLUSTER * \
45 CORSTONE1000_MAX_PE_PER_CPU)
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +010046
47/* UART related constants */
David Vinczebfdb7262022-03-03 14:35:51 +010048#define PLAT_ARM_BOOT_UART_BASE 0x1a510000
49#define PLAT_ARM_BOOT_UART_CLK_IN_HZ V2M_IOFPGA_UART0_CLK_IN_HZ
50#define PLAT_ARM_RUN_UART_BASE 0x1a520000
51#define PLAT_ARM_RUN_UART_CLK_IN_HZ V2M_IOFPGA_UART1_CLK_IN_HZ
52#define ARM_CONSOLE_BAUDRATE 115200
53#define PLAT_ARM_CRASH_UART_BASE PLAT_ARM_RUN_UART_BASE
54#define PLAT_ARM_CRASH_UART_CLK_IN_HZ PLAT_ARM_RUN_UART_CLK_IN_HZ
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +010055
56/* Memory related constants */
57
58/* SRAM (CVM) memory layout
59 *
60 * <ARM_TRUSTED_SRAM_BASE>
David Vinczebfdb7262022-03-03 14:35:51 +010061 * partition size: sizeof(meminfo_t) = 16 bytes
62 * content: memory info area used by the next BL
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +010063 *
64 * <ARM_FW_CONFIG_BASE>
David Vinczebfdb7262022-03-03 14:35:51 +010065 * partition size: 4080 bytes
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +010066 *
67 * <ARM_BL2_MEM_DESC_BASE>
David Vinczebfdb7262022-03-03 14:35:51 +010068 * partition size: 4 KB
69 * content: Area where BL2 copies the images descriptors
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +010070 *
71 * <ARM_BL_RAM_BASE> = <BL32_BASE>
David Vinczebfdb7262022-03-03 14:35:51 +010072 * partition size: 688 KB
73 * content: BL32 (optee-os)
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +010074 *
Vishnu Banavath2b651ea2022-01-19 18:43:12 +000075 * <CORSTONE1000_TOS_FW_CONFIG_BASE> = 0x20ae000
David Vinczebfdb7262022-03-03 14:35:51 +010076 * partition size: 8 KB
77 * content: BL32 config (TOS_FW_CONFIG)
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +010078 *
79 * <BL31_BASE>
David Vinczebfdb7262022-03-03 14:35:51 +010080 * partition size: 140 KB
81 * content: BL31
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +010082 *
83 * <BL2_SIGNATURE_BASE>
David Vinczebfdb7262022-03-03 14:35:51 +010084 * partition size: 4 KB
85 * content: MCUBOOT data needed to verify TF-A BL2
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +010086 *
87 * <BL2_BASE>
David Vinczebfdb7262022-03-03 14:35:51 +010088 * partition size: 176 KB
89 * content: BL2
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +010090 *
91 * <ARM_NS_SHARED_RAM_BASE> = <ARM_TRUSTED_SRAM_BASE> + 1 MB
David Vinczebfdb7262022-03-03 14:35:51 +010092 * partition size: 512 KB
93 * content: BL33 (u-boot)
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +010094 */
95
96/* DDR memory */
David Vinczebfdb7262022-03-03 14:35:51 +010097#define ARM_DRAM1_BASE UL(0x80000000)
98#define ARM_DRAM1_SIZE (SZ_2G) /* 2GB*/
99#define ARM_DRAM1_END (ARM_DRAM1_BASE + ARM_DRAM1_SIZE - 1)
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100100
Vishnu Banavath2b651ea2022-01-19 18:43:12 +0000101/* DRAM1 and DRAM2 are the same for corstone1000 */
David Vinczebfdb7262022-03-03 14:35:51 +0100102#define ARM_DRAM2_BASE ARM_DRAM1_BASE
103#define ARM_DRAM2_SIZE ARM_DRAM1_SIZE
104#define ARM_DRAM2_END ARM_DRAM1_END
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100105
David Vinczebfdb7262022-03-03 14:35:51 +0100106#define ARM_NS_DRAM1_BASE ARM_DRAM1_BASE
107#define ARM_NS_DRAM1_SIZE ARM_DRAM1_SIZE
108#define ARM_NS_DRAM1_END (ARM_NS_DRAM1_BASE + ARM_NS_DRAM1_SIZE - 1)
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100109
110/* The first 8 KB of Trusted SRAM are used as shared memory */
David Vinczebfdb7262022-03-03 14:35:51 +0100111#define ARM_TRUSTED_SRAM_BASE UL(0x02000000)
112#define ARM_SHARED_RAM_SIZE (SZ_8K) /* 8 KB */
113#define ARM_SHARED_RAM_BASE ARM_TRUSTED_SRAM_BASE
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100114
115/* The remaining Trusted SRAM is used to load the BL images */
David Vinczebfdb7262022-03-03 14:35:51 +0100116#define TOTAL_SRAM_SIZE (SZ_4M) /* 4 MB */
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100117
David Vinczebfdb7262022-03-03 14:35:51 +0100118/* Last 512KB of CVM is allocated for shared RAM as an example openAMP */
119#define ARM_NS_SHARED_RAM_SIZE (512 * SZ_1K)
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100120
David Vinczebfdb7262022-03-03 14:35:51 +0100121#define PLAT_ARM_TRUSTED_SRAM_SIZE (TOTAL_SRAM_SIZE - \
122 ARM_NS_SHARED_RAM_SIZE - \
123 ARM_SHARED_RAM_SIZE)
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100124
David Vinczebfdb7262022-03-03 14:35:51 +0100125#define PLAT_ARM_MAX_BL2_SIZE (180 * SZ_1K) /* 180 KB */
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100126
David Vinczebfdb7262022-03-03 14:35:51 +0100127#define PLAT_ARM_MAX_BL31_SIZE (140 * SZ_1K) /* 140 KB */
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100128
David Vinczebfdb7262022-03-03 14:35:51 +0100129#define ARM_BL_RAM_BASE (ARM_SHARED_RAM_BASE + ARM_SHARED_RAM_SIZE)
130#define ARM_BL_RAM_SIZE (PLAT_ARM_TRUSTED_SRAM_SIZE - \
131 ARM_SHARED_RAM_SIZE)
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100132
David Vinczebfdb7262022-03-03 14:35:51 +0100133#define BL2_SIGNATURE_SIZE (SZ_4K) /* 4 KB */
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100134
David Vinczebfdb7262022-03-03 14:35:51 +0100135#define BL2_SIGNATURE_BASE (BL2_LIMIT - PLAT_ARM_MAX_BL2_SIZE)
136#define BL2_BASE (BL2_LIMIT - \
137 PLAT_ARM_MAX_BL2_SIZE + \
138 BL2_SIGNATURE_SIZE)
139#define BL2_LIMIT (ARM_BL_RAM_BASE + ARM_BL_RAM_SIZE)
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100140
David Vinczebfdb7262022-03-03 14:35:51 +0100141#define BL31_BASE (BL2_SIGNATURE_BASE - PLAT_ARM_MAX_BL31_SIZE)
142#define BL31_LIMIT BL2_SIGNATURE_BASE
Arpita S.K639f7b72021-10-13 14:49:26 +0530143
David Vinczebfdb7262022-03-03 14:35:51 +0100144#define CORSTONE1000_TOS_FW_CONFIG_BASE (BL31_BASE - \
145 CORSTONE1000_TOS_FW_CONFIG_SIZE)
146#define CORSTONE1000_TOS_FW_CONFIG_SIZE (SZ_8K) /* 8 KB */
147#define CORSTONE1000_TOS_FW_CONFIG_LIMIT BL31_BASE
Arpita S.K639f7b72021-10-13 14:49:26 +0530148
David Vinczebfdb7262022-03-03 14:35:51 +0100149#define BL32_BASE ARM_BL_RAM_BASE
150#define PLAT_ARM_MAX_BL32_SIZE (CORSTONE1000_TOS_FW_CONFIG_BASE - BL32_BASE)
Arpita S.K639f7b72021-10-13 14:49:26 +0530151
David Vinczebfdb7262022-03-03 14:35:51 +0100152#define BL32_LIMIT (BL32_BASE + PLAT_ARM_MAX_BL32_SIZE)
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100153
154/* SPD_spmd settings */
155
David Vinczebfdb7262022-03-03 14:35:51 +0100156#define PLAT_ARM_SPMC_BASE BL32_BASE
157#define PLAT_ARM_SPMC_SIZE PLAT_ARM_MAX_BL32_SIZE
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100158
159/* NS memory */
160
Arpita S.K639f7b72021-10-13 14:49:26 +0530161/* The last 512KB of the SRAM is allocated as shared memory */
David Vinczebfdb7262022-03-03 14:35:51 +0100162#define ARM_NS_SHARED_RAM_BASE (ARM_TRUSTED_SRAM_BASE + TOTAL_SRAM_SIZE - \
163 (PLAT_ARM_MAX_BL31_SIZE + \
164 PLAT_ARM_MAX_BL32_SIZE))
Arpita S.K639f7b72021-10-13 14:49:26 +0530165
David Vinczebfdb7262022-03-03 14:35:51 +0100166#define BL33_BASE ARM_DRAM1_BASE
167#define PLAT_ARM_MAX_BL33_SIZE (12 * SZ_1M) /* 12 MB*/
168#define BL33_LIMIT (ARM_DRAM1_BASE + PLAT_ARM_MAX_BL33_SIZE)
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100169
170/* end of the definition of SRAM memory layout */
171
172/* NOR Flash */
173
David Vinczebfdb7262022-03-03 14:35:51 +0100174#define PLAT_ARM_NVM_BASE V2M_FLASH0_BASE
175#define PLAT_ARM_NVM_SIZE (SZ_32M) /* 32 MB */
Harsimran Singh Tungalb17aaed2023-10-20 11:20:48 +0100176#define PLAT_ARM_FIP_MAX_SIZE UL(0x1ff000) /* 1.996 MB */
177#define PLAT_ARM_FLASH_IMAGE_BASE UL(0x08000000)
David Vinczebfdb7262022-03-03 14:35:51 +0100178#define PLAT_ARM_FLASH_IMAGE_MAX_SIZE PLAT_ARM_FIP_MAX_SIZE
Harsimran Singh Tungalb17aaed2023-10-20 11:20:48 +0100179#define PLAT_ARM_FIP_OFFSET_IN_GPT (0x86000)
180
181/* FIP Information */
182#define FIP_SIGNATURE_AREA_SIZE (0x1000) /* 4 KB */
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100183
184/*
185 * Some data must be aligned on the biggest cache line size in the platform.
186 * This is known only to the platform as it might have a combination of
187 * integrated and external caches.
188 */
David Vinczebfdb7262022-03-03 14:35:51 +0100189#define CACHE_WRITEBACK_GRANULE (U(1) << ARM_CACHE_WRITEBACK_SHIFT)
190#define ARM_CACHE_WRITEBACK_SHIFT 6
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100191
192/*
193 * Define FW_CONFIG area base and limit. Leave enough space for BL2 meminfo.
194 * FW_CONFIG is intended to host the device tree. Currently, This area is not
Vishnu Banavath2b651ea2022-01-19 18:43:12 +0000195 * used because corstone1000 platform doesn't use a device tree at TF-A level.
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100196 */
David Vinczebfdb7262022-03-03 14:35:51 +0100197#define ARM_FW_CONFIG_BASE (ARM_SHARED_RAM_BASE + sizeof(meminfo_t))
198#define ARM_FW_CONFIG_LIMIT (ARM_SHARED_RAM_BASE + \
199 (ARM_SHARED_RAM_SIZE >> 1))
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100200
201/*
202 * Boot parameters passed from BL2 to BL31/BL32 are stored here
203 */
David Vinczebfdb7262022-03-03 14:35:51 +0100204#define ARM_BL2_MEM_DESC_BASE ARM_FW_CONFIG_LIMIT
205#define ARM_BL2_MEM_DESC_LIMIT ARM_BL_RAM_BASE
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100206
207/*
208 * The max number of regions like RO(code), coherent and data required by
209 * different BL stages which need to be mapped in the MMU.
210 */
David Vinczebfdb7262022-03-03 14:35:51 +0100211#define ARM_BL_REGIONS 3
212#define PLAT_ARM_MMAP_ENTRIES 8
213#define MAX_XLAT_TABLES 5
214#define MAX_MMAP_REGIONS (PLAT_ARM_MMAP_ENTRIES + ARM_BL_REGIONS)
215#define MAX_IO_DEVICES 2
216#define MAX_IO_HANDLES 3
217#define MAX_IO_BLOCK_DEVICES 1
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100218
219/* GIC related constants */
David Vinczebfdb7262022-03-03 14:35:51 +0100220#define PLAT_ARM_GICD_BASE 0x1C010000
221#define PLAT_ARM_GICC_BASE 0x1C02F000
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100222
223/* MHUv2 Secure Channel receiver and sender */
David Vinczebfdb7262022-03-03 14:35:51 +0100224#define PLAT_SDK700_MHU0_SEND 0x1B800000
225#define PLAT_SDK700_MHU0_RECV 0x1B810000
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100226
227/* Timer/watchdog related constants */
David Vinczebfdb7262022-03-03 14:35:51 +0100228#define ARM_SYS_CNTCTL_BASE UL(0x1a200000)
229#define ARM_SYS_CNTREAD_BASE UL(0x1a210000)
230#define ARM_SYS_TIMCTL_BASE UL(0x1a220000)
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100231
David Vinczebfdb7262022-03-03 14:35:51 +0100232#define SECURE_WATCHDOG_ADDR_CTRL_REG 0x1A320000
233#define SECURE_WATCHDOG_ADDR_VAL_REG 0x1A320008
234#define SECURE_WATCHDOG_MASK_ENABLE 0x01
235#define SECURE_WATCHDOG_COUNTDOWN_VAL 0x1000
Emekcan Aras53e91a32021-11-17 18:45:32 +0000236
David Vinczebfdb7262022-03-03 14:35:51 +0100237#define SYS_COUNTER_FREQ_IN_TICKS UL(50000000) /* 50MHz */
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100238
David Vinczebfdb7262022-03-03 14:35:51 +0100239#define CORSTONE1000_IRQ_TZ_WDOG 32
240#define CORSTONE1000_IRQ_SEC_SYS_TIMER 34
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100241
David Vinczebfdb7262022-03-03 14:35:51 +0100242#define PLAT_MAX_PWR_LVL 2
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100243/*
244 * Macros mapping the MPIDR Affinity levels to ARM Platform Power levels. The
245 * power levels have a 1:1 mapping with the MPIDR affinity levels.
246 */
David Vinczebfdb7262022-03-03 14:35:51 +0100247#define ARM_PWR_LVL0 MPIDR_AFFLVL0
248#define ARM_PWR_LVL1 MPIDR_AFFLVL1
249#define ARM_PWR_LVL2 MPIDR_AFFLVL2
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100250
251/*
252 * Macros for local power states in ARM platforms encoded by State-ID field
253 * within the power-state parameter.
254 */
255/* Local power state for power domains in Run state. */
David Vinczebfdb7262022-03-03 14:35:51 +0100256#define ARM_LOCAL_STATE_RUN U(0)
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100257/* Local power state for retention. Valid only for CPU power domains */
David Vinczebfdb7262022-03-03 14:35:51 +0100258#define ARM_LOCAL_STATE_RET U(1)
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100259/* Local power state for OFF/power-down. Valid for CPU and cluster
260 * power domains
261 */
David Vinczebfdb7262022-03-03 14:35:51 +0100262#define ARM_LOCAL_STATE_OFF U(2)
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100263
David Vinczebfdb7262022-03-03 14:35:51 +0100264#define PLAT_ARM_TRUSTED_MAILBOX_BASE ARM_TRUSTED_SRAM_BASE
265#define PLAT_ARM_NSTIMER_FRAME_ID U(1)
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100266
David Vinczebfdb7262022-03-03 14:35:51 +0100267#define PLAT_ARM_NS_IMAGE_BASE (ARM_NS_SHARED_RAM_BASE)
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100268
David Vinczebfdb7262022-03-03 14:35:51 +0100269#define PLAT_PHY_ADDR_SPACE_SIZE (1ULL << 32)
270#define PLAT_VIRT_ADDR_SPACE_SIZE (1ULL << 32)
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100271
272/*
273 * This macro defines the deepest retention state possible. A higher state
274 * ID will represent an invalid or a power down state.
275 */
David Vinczebfdb7262022-03-03 14:35:51 +0100276#define PLAT_MAX_RET_STATE 1
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100277
278/*
279 * This macro defines the deepest power down states possible. Any state ID
280 * higher than this is invalid.
281 */
David Vinczebfdb7262022-03-03 14:35:51 +0100282#define PLAT_MAX_OFF_STATE 2
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100283
David Vinczebfdb7262022-03-03 14:35:51 +0100284#define PLATFORM_STACK_SIZE UL(0x440)
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100285
David Vinczebfdb7262022-03-03 14:35:51 +0100286#define CORSTONE1000_EXTERNAL_FLASH MAP_REGION_FLAT( \
287 PLAT_ARM_NVM_BASE, \
288 PLAT_ARM_NVM_SIZE, \
289 MT_DEVICE | MT_RO | MT_SECURE)
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100290
David Vinczebfdb7262022-03-03 14:35:51 +0100291#define ARM_MAP_SHARED_RAM MAP_REGION_FLAT( \
292 ARM_SHARED_RAM_BASE, \
293 ARM_SHARED_RAM_SIZE, \
294 MT_MEMORY | MT_RW | MT_SECURE)
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100295
David Vinczebfdb7262022-03-03 14:35:51 +0100296#define ARM_MAP_NS_SHARED_RAM MAP_REGION_FLAT( \
297 ARM_NS_SHARED_RAM_BASE, \
298 ARM_NS_SHARED_RAM_SIZE, \
299 MT_MEMORY | MT_RW | MT_NS)
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100300
David Vinczebfdb7262022-03-03 14:35:51 +0100301#define ARM_MAP_NS_DRAM1 MAP_REGION_FLAT( \
302 ARM_NS_DRAM1_BASE, \
303 ARM_NS_DRAM1_SIZE, \
304 MT_MEMORY | MT_RW | MT_NS)
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100305
David Vinczebfdb7262022-03-03 14:35:51 +0100306#define ARM_MAP_BL_RO MAP_REGION_FLAT( \
307 BL_CODE_BASE, \
308 (BL_CODE_END - BL_CODE_BASE), \
309 MT_CODE | MT_SECURE), \
310 MAP_REGION_FLAT( \
311 BL_RO_DATA_BASE, \
312 (BL_RO_DATA_END - BL_RO_DATA_BASE), \
313 MT_RO_DATA | MT_SECURE)
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100314#if USE_COHERENT_MEM
David Vinczebfdb7262022-03-03 14:35:51 +0100315#define ARM_MAP_BL_COHERENT_RAM MAP_REGION_FLAT( \
316 BL_COHERENT_RAM_BASE, \
317 (BL_COHERENT_RAM_END \
318 - BL_COHERENT_RAM_BASE), \
319 MT_DEVICE | MT_RW | MT_SECURE)
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100320#endif
321
322/*
323 * Map the region for the optional device tree configuration with read and
324 * write permissions
325 */
David Vinczebfdb7262022-03-03 14:35:51 +0100326#define ARM_MAP_BL_CONFIG_REGION MAP_REGION_FLAT( \
327 ARM_FW_CONFIG_BASE, \
328 (ARM_FW_CONFIG_LIMIT \
329 - ARM_FW_CONFIG_BASE), \
330 MT_MEMORY | MT_RW | MT_SECURE)
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100331
David Vinczebfdb7262022-03-03 14:35:51 +0100332#define CORSTONE1000_DEVICE_BASE (0x1A000000)
333#define CORSTONE1000_DEVICE_SIZE (0x26000000)
334#define CORSTONE1000_MAP_DEVICE MAP_REGION_FLAT( \
335 CORSTONE1000_DEVICE_BASE, \
336 CORSTONE1000_DEVICE_SIZE, \
337 MT_DEVICE | MT_RW | MT_SECURE)
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100338
David Vinczebfdb7262022-03-03 14:35:51 +0100339#define ARM_IRQ_SEC_PHY_TIMER 29
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100340
David Vinczebfdb7262022-03-03 14:35:51 +0100341#define ARM_IRQ_SEC_SGI_0 8
342#define ARM_IRQ_SEC_SGI_1 9
343#define ARM_IRQ_SEC_SGI_2 10
344#define ARM_IRQ_SEC_SGI_3 11
345#define ARM_IRQ_SEC_SGI_4 12
346#define ARM_IRQ_SEC_SGI_5 13
347#define ARM_IRQ_SEC_SGI_6 14
348#define ARM_IRQ_SEC_SGI_7 15
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100349
350/*
351 * Define a list of Group 1 Secure and Group 0 interrupt properties as per GICv3
352 * terminology. On a GICv2 system or mode, the lists will be merged and treated
353 * as Group 0 interrupts.
354 */
355#define ARM_G1S_IRQ_PROPS(grp) \
356 INTR_PROP_DESC(ARM_IRQ_SEC_PHY_TIMER, GIC_HIGHEST_SEC_PRIORITY, \
357 (grp), GIC_INTR_CFG_LEVEL), \
358 INTR_PROP_DESC(ARM_IRQ_SEC_SGI_1, GIC_HIGHEST_SEC_PRIORITY, \
359 (grp), GIC_INTR_CFG_EDGE), \
360 INTR_PROP_DESC(ARM_IRQ_SEC_SGI_2, GIC_HIGHEST_SEC_PRIORITY, \
361 (grp), GIC_INTR_CFG_EDGE), \
362 INTR_PROP_DESC(ARM_IRQ_SEC_SGI_3, GIC_HIGHEST_SEC_PRIORITY, \
363 (grp), GIC_INTR_CFG_EDGE), \
364 INTR_PROP_DESC(ARM_IRQ_SEC_SGI_4, GIC_HIGHEST_SEC_PRIORITY, \
365 (grp), GIC_INTR_CFG_EDGE), \
366 INTR_PROP_DESC(ARM_IRQ_SEC_SGI_5, GIC_HIGHEST_SEC_PRIORITY, \
367 (grp), GIC_INTR_CFG_EDGE), \
368 INTR_PROP_DESC(ARM_IRQ_SEC_SGI_7, GIC_HIGHEST_SEC_PRIORITY, \
369 (grp), GIC_INTR_CFG_EDGE)
370
371#define ARM_G0_IRQ_PROPS(grp) \
372 INTR_PROP_DESC(ARM_IRQ_SEC_SGI_6, GIC_HIGHEST_SEC_PRIORITY, (grp), \
373 GIC_INTR_CFG_EDGE)
374
375/*
376 * Define a list of Group 1 Secure and Group 0 interrupts as per GICv3
377 * terminology. On a GICv2 system or mode, the lists will be merged and treated
378 * as Group 0 interrupts.
379 */
David Vinczebfdb7262022-03-03 14:35:51 +0100380#define PLAT_ARM_G1S_IRQ_PROPS(grp) \
381 ARM_G1S_IRQ_PROPS(grp), \
382 INTR_PROP_DESC(CORSTONE1000_IRQ_TZ_WDOG, \
383 GIC_HIGHEST_SEC_PRIORITY, \
384 (grp), GIC_INTR_CFG_LEVEL), \
385 INTR_PROP_DESC(CORSTONE1000_IRQ_SEC_SYS_TIMER, \
386 GIC_HIGHEST_SEC_PRIORITY, \
387 (grp), GIC_INTR_CFG_LEVEL)
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +0100388
389#define PLAT_ARM_G0_IRQ_PROPS(grp) ARM_G0_IRQ_PROPS(grp)
390
391#endif /* PLATFORM_DEF_H */