| 1 |
/* |
| 2 |
* Copyright (c) 2021-2024, Arm Limited and Contributors. All rights reserved. |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: BSD-3-Clause |
| 5 |
*/ |
| 6 |
|
| 7 |
#ifndef FVP_R_PLATFORM_DEF_H |
| 8 |
#define FVP_R_PLATFORM_DEF_H |
| 9 |
|
| 10 |
#define PLAT_V2M_OFFSET 0x80000000 |
| 11 |
|
| 12 |
#define BL33_IMAGE_DESC { \ |
| 13 |
.image_id = BL33_IMAGE_ID, \ |
| 14 |
SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, \ |
| 15 |
VERSION_2, image_info_t, 0), \ |
| 16 |
.image_info.image_base = PLAT_ARM_DRAM1_BASE + 0x1000, \ |
| 17 |
.image_info.image_max_size = UL(0x3ffff000), \ |
| 18 |
SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP, \ |
| 19 |
VERSION_2, entry_point_info_t, SECURE | EXECUTABLE),\ |
| 20 |
.ep_info.pc = PLAT_ARM_DRAM1_BASE + 0x1000, \ |
| 21 |
.ep_info.spsr = SPSR_64(MODE_EL2, MODE_SP_ELX, DISABLE_ALL_EXCEPTIONS), \ |
| 22 |
} |
| 23 |
|
| 24 |
#include "../fvp_r_def.h" |
| 25 |
#include <drivers/arm/tzc400.h> |
| 26 |
#include <lib/utils_def.h> |
| 27 |
#include <plat/arm/board/common/v2m_def.h> |
| 28 |
|
| 29 |
/* These are referenced by arm_def.h #included next, so #define first. */ |
| 30 |
#define PLAT_ARM_TRUSTED_ROM_BASE UL(0x80000000) |
| 31 |
#define PLAT_ARM_TRUSTED_SRAM_BASE UL(0x84000000) |
| 32 |
#define PLAT_ARM_TRUSTED_DRAM_BASE UL(0x86000000) |
| 33 |
#define PLAT_ARM_DRAM1_BASE ULL(0x0) |
| 34 |
#define PLAT_ARM_DRAM2_BASE ULL(0x080000000) |
| 35 |
|
| 36 |
#define PLAT_HW_CONFIG_DTB_BASE ULL(0x12000000) |
| 37 |
#define PLAT_ARM_SYS_CNTCTL_BASE UL(0xaa430000) |
| 38 |
#define PLAT_ARM_SYS_CNTREAD_BASE UL(0xaa800000) |
| 39 |
#define PLAT_ARM_SYS_TIMCTL_BASE UL(0xaa810000) |
| 40 |
#define PLAT_ARM_SYS_CNT_BASE_S UL(0xaa820000) |
| 41 |
#define PLAT_ARM_SYS_CNT_BASE_NS UL(0xaa830000) |
| 42 |
#define PLAT_ARM_SP805_TWDG_BASE UL(0xaa490000) |
| 43 |
|
| 44 |
#include <plat/arm/common/arm_def.h> |
| 45 |
#include <plat/common/common_def.h> |
| 46 |
|
| 47 |
|
| 48 |
/* Required to create plat_regions: */ |
| 49 |
#define MIN_LVL_BLOCK_DESC U(1) |
| 50 |
|
| 51 |
/* Required platform porting definitions */ |
| 52 |
#define PLATFORM_CORE_COUNT (U(FVP_R_CLUSTER_COUNT) * \ |
| 53 |
U(FVP_R_MAX_CPUS_PER_CLUSTER) * \ |
| 54 |
U(FVP_R_MAX_PE_PER_CPU)) |
| 55 |
|
| 56 |
#define PLAT_NUM_PWR_DOMAINS (U(FVP_R_CLUSTER_COUNT) + \ |
| 57 |
PLATFORM_CORE_COUNT + U(1)) |
| 58 |
|
| 59 |
#define PLAT_MAX_PWR_LVL ARM_PWR_LVL2 |
| 60 |
|
| 61 |
/* |
| 62 |
* Other platform porting definitions are provided by included headers |
| 63 |
*/ |
| 64 |
|
| 65 |
/* |
| 66 |
* Required ARM standard platform porting definitions |
| 67 |
*/ |
| 68 |
#define PLAT_ARM_CLUSTER_COUNT U(FVP_R_CLUSTER_COUNT) |
| 69 |
#define PLAT_ARM_DRAM1_SIZE ULL(0x7fffffff) |
| 70 |
#define PLAT_ARM_TRUSTED_SRAM_SIZE UL(0x00040000) /* 256 KB */ |
| 71 |
#define PLAT_ARM_TRUSTED_ROM_SIZE UL(0x04000000) /* 64 MB */ |
| 72 |
#define PLAT_ARM_TRUSTED_DRAM_SIZE UL(0x02000000) /* 32 MB */ |
| 73 |
|
| 74 |
/* These two are defined thus in arm_def.h, but doesn't seem to see it... */ |
| 75 |
#define PLAT_BL1_RO_LIMIT (BL1_RO_BASE \ |
| 76 |
+ PLAT_ARM_TRUSTED_ROM_SIZE) |
| 77 |
|
| 78 |
/* virtual address used by dynamic mem_protect for chunk_base */ |
| 79 |
#define PLAT_ARM_MEM_PROTEC_VA_FRAME UL(0xc0000000) |
| 80 |
|
| 81 |
/* No SCP in FVP_R */ |
| 82 |
#define PLAT_ARM_SCP_TZC_DRAM1_SIZE UL(0x0) |
| 83 |
|
| 84 |
#define PLAT_ARM_DRAM2_SIZE UL(0x80000000) |
| 85 |
|
| 86 |
#define PLAT_ARM_HW_CONFIG_SIZE ULL(0x8000) |
| 87 |
|
| 88 |
#define ARM_DTB_DRAM_NS MAP_REGION_FLAT( \ |
| 89 |
PLAT_HW_CONFIG_DTB_BASE, \ |
| 90 |
PLAT_ARM_HW_CONFIG_SIZE, \ |
| 91 |
MT_MEMORY | MT_RO | MT_NS) |
| 92 |
|
| 93 |
#define V2M_FVP_R_SYSREGS_BASE UL(0x9c010000) |
| 94 |
|
| 95 |
/* |
| 96 |
* Load address of BL33 for this platform port, |
| 97 |
* U-Boot specifically must be loaded at a 4K aligned address. |
| 98 |
*/ |
| 99 |
#define PLAT_ARM_NS_IMAGE_BASE (PLAT_ARM_DRAM1_BASE + 0x1000) |
| 100 |
|
| 101 |
/* |
| 102 |
* PLAT_ARM_MMAP_ENTRIES depends on the number of entries in the |
| 103 |
* plat_arm_mmap array defined for each BL stage. |
| 104 |
*/ |
| 105 |
#if !USE_ROMLIB |
| 106 |
# define PLAT_ARM_MMAP_ENTRIES 11 |
| 107 |
# define MAX_XLAT_TABLES 5 |
| 108 |
#else |
| 109 |
# define PLAT_ARM_MMAP_ENTRIES 12 |
| 110 |
# define MAX_XLAT_TABLES 6 |
| 111 |
#endif |
| 112 |
# define N_MPU_REGIONS 16 /* number of MPU regions */ |
| 113 |
# define ALL_MPU_EL2_REGIONS_USED 0xffffffff |
| 114 |
/* this is the PRENR_EL2 value if all MPU regions are in use */ |
| 115 |
|
| 116 |
/* |
| 117 |
* PLAT_ARM_MAX_BL1_RW_SIZE is calculated using the current BL1 RW debug size |
| 118 |
* plus a little space for growth. |
| 119 |
*/ |
| 120 |
#define PLAT_ARM_MAX_BL1_RW_SIZE UL(0xB000) |
| 121 |
|
| 122 |
/* |
| 123 |
* PLAT_ARM_MAX_ROMLIB_RW_SIZE is define to use a full page |
| 124 |
*/ |
| 125 |
|
| 126 |
#if USE_ROMLIB |
| 127 |
#define PLAT_ARM_MAX_ROMLIB_RW_SIZE UL(0x1000) |
| 128 |
#define PLAT_ARM_MAX_ROMLIB_RO_SIZE UL(0xe000) |
| 129 |
#define FVP_R_BL2_ROMLIB_OPTIMIZATION UL(0x6000) |
| 130 |
#else |
| 131 |
#define PLAT_ARM_MAX_ROMLIB_RW_SIZE UL(0) |
| 132 |
#define PLAT_ARM_MAX_ROMLIB_RO_SIZE UL(0) |
| 133 |
#define FVP_R_BL2_ROMLIB_OPTIMIZATION UL(0) |
| 134 |
#endif |
| 135 |
|
| 136 |
/* |
| 137 |
* PLAT_ARM_MAX_BL2_SIZE is calculated using the current BL2 debug size plus a |
| 138 |
* little space for growth. |
| 139 |
*/ |
| 140 |
#if TRUSTED_BOARD_BOOT |
| 141 |
#if COT_DESC_IN_DTB |
| 142 |
# define PLAT_ARM_MAX_BL2_SIZE (UL(0x1E000) - FVP_R_BL2_ROMLIB_OPTIMIZATION) |
| 143 |
#else |
| 144 |
# define PLAT_ARM_MAX_BL2_SIZE (UL(0x1D000) - FVP_R_BL2_ROMLIB_OPTIMIZATION) |
| 145 |
#endif |
| 146 |
#else |
| 147 |
# define PLAT_ARM_MAX_BL2_SIZE (UL(0x13000) - FVP_R_BL2_ROMLIB_OPTIMIZATION) |
| 148 |
#endif |
| 149 |
|
| 150 |
/* |
| 151 |
* Since BL31 NOBITS overlays BL2 and BL1-RW, PLAT_ARM_MAX_BL31_SIZE is |
| 152 |
* calculated using the current BL31 PROGBITS debug size plus the sizes of |
| 153 |
* BL2 and BL1-RW |
| 154 |
*/ |
| 155 |
#define PLAT_ARM_MAX_BL31_SIZE UL(0x3D000) |
| 156 |
|
| 157 |
/* |
| 158 |
* Size of cacheable stacks |
| 159 |
*/ |
| 160 |
#if defined(IMAGE_BL1) |
| 161 |
# if TRUSTED_BOARD_BOOT |
| 162 |
# define PLATFORM_STACK_SIZE UL(0x1000) |
| 163 |
# else |
| 164 |
# define PLATFORM_STACK_SIZE UL(0x500) |
| 165 |
# endif |
| 166 |
#endif |
| 167 |
|
| 168 |
#define MAX_IO_DEVICES 3 |
| 169 |
#define MAX_IO_HANDLES 4 |
| 170 |
|
| 171 |
/* |
| 172 |
* These nominally reserve the last block of flash for PSCI MEM PROTECT flag, |
| 173 |
* but no PSCI in FVP_R platform, so reserve nothing: |
| 174 |
*/ |
| 175 |
#define PLAT_ARM_FLASH_IMAGE_BASE (PLAT_ARM_DRAM1_BASE + UL(0x40000000)) |
| 176 |
#define PLAT_ARM_FLASH_IMAGE_MAX_SIZE (PLAT_ARM_DRAM1_SIZE - UL(0x40000000)) |
| 177 |
|
| 178 |
#define PLAT_ARM_NVM_BASE V2M_FLASH0_BASE |
| 179 |
#define PLAT_ARM_NVM_SIZE (V2M_FLASH0_SIZE - V2M_FLASH_BLOCK_SIZE) |
| 180 |
|
| 181 |
/* |
| 182 |
* PL011 related constants |
| 183 |
*/ |
| 184 |
#define PLAT_ARM_BOOT_UART_BASE V2M_IOFPGA_UART0_BASE |
| 185 |
#define PLAT_ARM_BOOT_UART_CLK_IN_HZ V2M_IOFPGA_UART0_CLK_IN_HZ |
| 186 |
|
| 187 |
#define PLAT_ARM_RUN_UART_BASE V2M_IOFPGA_UART1_BASE |
| 188 |
#define PLAT_ARM_RUN_UART_CLK_IN_HZ V2M_IOFPGA_UART1_CLK_IN_HZ |
| 189 |
|
| 190 |
#define PLAT_ARM_CRASH_UART_BASE PLAT_ARM_RUN_UART_BASE |
| 191 |
#define PLAT_ARM_CRASH_UART_CLK_IN_HZ PLAT_ARM_RUN_UART_CLK_IN_HZ |
| 192 |
|
| 193 |
#define PLAT_ARM_TSP_UART_BASE V2M_IOFPGA_UART2_BASE |
| 194 |
#define PLAT_ARM_TSP_UART_CLK_IN_HZ V2M_IOFPGA_UART2_CLK_IN_HZ |
| 195 |
|
| 196 |
/* CCI related constants */ |
| 197 |
#define PLAT_FVP_R_CCI400_BASE UL(0xac090000) |
| 198 |
#define PLAT_FVP_R_CCI400_CLUS0_SL_PORT 3 |
| 199 |
#define PLAT_FVP_R_CCI400_CLUS1_SL_PORT 4 |
| 200 |
|
| 201 |
/* CCI-500/CCI-550 on Base platform */ |
| 202 |
#define PLAT_FVP_R_CCI5XX_BASE UL(0xaa000000) |
| 203 |
#define PLAT_FVP_R_CCI5XX_CLUS0_SL_PORT 5 |
| 204 |
#define PLAT_FVP_R_CCI5XX_CLUS1_SL_PORT 6 |
| 205 |
|
| 206 |
/* System timer related constants */ |
| 207 |
#define PLAT_ARM_NSTIMER_FRAME_ID U(1) |
| 208 |
|
| 209 |
/* Mailbox base address */ |
| 210 |
#define PLAT_ARM_TRUSTED_MAILBOX_BASE ARM_TRUSTED_SRAM_BASE |
| 211 |
|
| 212 |
|
| 213 |
/* TrustZone controller related constants |
| 214 |
* |
| 215 |
* Currently only filters 0 and 2 are connected on Base FVP_R. |
| 216 |
* Filter 0 : CPU clusters (no access to DRAM by default) |
| 217 |
* Filter 1 : not connected |
| 218 |
* Filter 2 : LCDs (access to VRAM allowed by default) |
| 219 |
* Filter 3 : not connected |
| 220 |
* Programming unconnected filters will have no effect at the |
| 221 |
* moment. These filter could, however, be connected in future. |
| 222 |
* So care should be taken not to configure the unused filters. |
| 223 |
* |
| 224 |
* Allow only non-secure access to all DRAM to supported devices. |
| 225 |
* Give access to the CPUs and Virtio. Some devices |
| 226 |
* would normally use the default ID so allow that too. |
| 227 |
*/ |
| 228 |
#define PLAT_ARM_TZC_BASE UL(0xaa4a0000) |
| 229 |
#define PLAT_ARM_TZC_FILTERS TZC_400_REGION_ATTR_FILTER_BIT(0) |
| 230 |
|
| 231 |
#define PLAT_ARM_TZC_NS_DEV_ACCESS ( \ |
| 232 |
TZC_REGION_ACCESS_RDWR(FVP_R_NSAID_DEFAULT) | \ |
| 233 |
TZC_REGION_ACCESS_RDWR(FVP_R_NSAID_PCI) | \ |
| 234 |
TZC_REGION_ACCESS_RDWR(FVP_R_NSAID_AP) | \ |
| 235 |
TZC_REGION_ACCESS_RDWR(FVP_R_NSAID_VIRTIO) | \ |
| 236 |
TZC_REGION_ACCESS_RDWR(FVP_R_NSAID_VIRTIO_OLD)) |
| 237 |
|
| 238 |
/* |
| 239 |
* GIC related constants to cater for both GICv2 and GICv3 instances of an |
| 240 |
* FVP_R. They could be overridden at runtime in case the FVP_R implements the |
| 241 |
* legacy VE memory map. |
| 242 |
*/ |
| 243 |
#define PLAT_ARM_GICD_BASE BASE_GICD_BASE |
| 244 |
#define PLAT_ARM_GICR_BASE BASE_GICR_BASE |
| 245 |
#define PLAT_ARM_GICC_BASE BASE_GICC_BASE |
| 246 |
|
| 247 |
#define PLAT_ARM_SP_IMAGE_STACK_BASE (PLAT_SP_IMAGE_NS_BUF_BASE + \ |
| 248 |
PLAT_SP_IMAGE_NS_BUF_SIZE) |
| 249 |
|
| 250 |
#define PLAT_SP_PRI PLAT_RAS_PRI |
| 251 |
|
| 252 |
/* |
| 253 |
* Physical and virtual address space limits for MPU in AARCH64 & AARCH32 modes |
| 254 |
*/ |
| 255 |
#define PLAT_PHY_ADDR_SPACE_SIZE (1ULL << 36) |
| 256 |
#define PLAT_VIRT_ADDR_SPACE_SIZE (1ULL << 36) |
| 257 |
|
| 258 |
#define ARM_SOC_CONTINUATION_SHIFT U(24) |
| 259 |
#define ARM_SOC_IDENTIFICATION_SHIFT U(16) |
| 260 |
|
| 261 |
#endif /* FVP_R_PLATFORM_DEF_H */ |