Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 1 | /* |
Vishnu Banavath | 2b651ea | 2022-01-19 18:43:12 +0000 | [diff] [blame] | 2 | * Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved. |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 3 | * |
| 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> |
| 13 | #include <plat/arm/board/common/v2m_def.h> |
| 14 | #include <plat/arm/common/arm_spm_def.h> |
| 15 | #include <plat/arm/common/smccc_def.h> |
| 16 | #include <plat/common/common_def.h> |
| 17 | #include <plat/arm/soc/common/soc_css_def.h> |
| 18 | |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 19 | #define ARM_ROTPK_HEADER_LEN 19 |
| 20 | #define ARM_ROTPK_HASH_LEN 32 |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 21 | |
| 22 | /* Special value used to verify platform parameters from BL2 to BL31 */ |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 23 | #define ARM_BL31_PLAT_PARAM_VAL ULL(0x0f1e2d3c4b5a6978) |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 24 | |
| 25 | /* PL011 UART related constants */ |
| 26 | #ifdef V2M_IOFPGA_UART0_CLK_IN_HZ |
| 27 | #undef V2M_IOFPGA_UART0_CLK_IN_HZ |
| 28 | #endif |
| 29 | |
| 30 | #ifdef V2M_IOFPGA_UART1_CLK_IN_HZ |
| 31 | #undef V2M_IOFPGA_UART1_CLK_IN_HZ |
| 32 | #endif |
| 33 | |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 34 | #define V2M_IOFPGA_UART0_CLK_IN_HZ 50000000 |
| 35 | #define V2M_IOFPGA_UART1_CLK_IN_HZ 50000000 |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 36 | |
Vishnu Banavath | 2b651ea | 2022-01-19 18:43:12 +0000 | [diff] [blame] | 37 | /* Core/Cluster/Thread counts for corstone1000 */ |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 38 | #define CORSTONE1000_CLUSTER_COUNT U(1) |
| 39 | #define CORSTONE1000_MAX_CPUS_PER_CLUSTER U(4) |
| 40 | #define CORSTONE1000_MAX_PE_PER_CPU U(1) |
| 41 | #define CORSTONE1000_PRIMARY_CPU U(0) |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 42 | |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 43 | #define PLAT_ARM_CLUSTER_COUNT CORSTONE1000_CLUSTER_COUNT |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 44 | |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 45 | #define PLATFORM_CORE_COUNT (PLAT_ARM_CLUSTER_COUNT * \ |
| 46 | CORSTONE1000_MAX_CPUS_PER_CLUSTER * \ |
| 47 | CORSTONE1000_MAX_PE_PER_CPU) |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 48 | |
| 49 | /* UART related constants */ |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 50 | #define PLAT_ARM_BOOT_UART_BASE 0x1a510000 |
| 51 | #define PLAT_ARM_BOOT_UART_CLK_IN_HZ V2M_IOFPGA_UART0_CLK_IN_HZ |
| 52 | #define PLAT_ARM_RUN_UART_BASE 0x1a520000 |
| 53 | #define PLAT_ARM_RUN_UART_CLK_IN_HZ V2M_IOFPGA_UART1_CLK_IN_HZ |
| 54 | #define ARM_CONSOLE_BAUDRATE 115200 |
| 55 | #define PLAT_ARM_CRASH_UART_BASE PLAT_ARM_RUN_UART_BASE |
| 56 | #define PLAT_ARM_CRASH_UART_CLK_IN_HZ PLAT_ARM_RUN_UART_CLK_IN_HZ |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 57 | |
| 58 | /* Memory related constants */ |
| 59 | |
| 60 | /* SRAM (CVM) memory layout |
| 61 | * |
| 62 | * <ARM_TRUSTED_SRAM_BASE> |
| 63 | * |
| 64 | * partition size: sizeof(meminfo_t) = 16 bytes |
| 65 | * |
| 66 | * content: memory info area used by the next BL |
| 67 | * |
| 68 | * <ARM_FW_CONFIG_BASE> |
| 69 | * |
| 70 | * partition size: 4080 bytes |
| 71 | * |
| 72 | * <ARM_BL2_MEM_DESC_BASE> |
| 73 | * |
| 74 | * partition size: 4 KB |
| 75 | * |
| 76 | * content: |
| 77 | * |
| 78 | * Area where BL2 copies the images descriptors |
| 79 | * |
| 80 | * <ARM_BL_RAM_BASE> = <BL32_BASE> |
| 81 | * |
| 82 | * partition size: 688 KB |
| 83 | * |
| 84 | * content: |
| 85 | * |
| 86 | * BL32 (optee-os) |
| 87 | * |
Vishnu Banavath | 2b651ea | 2022-01-19 18:43:12 +0000 | [diff] [blame] | 88 | * <CORSTONE1000_TOS_FW_CONFIG_BASE> = 0x20ae000 |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 89 | * |
| 90 | * partition size: 8 KB |
| 91 | * |
| 92 | * content: |
| 93 | * |
| 94 | * BL32 config (TOS_FW_CONFIG) |
| 95 | * |
| 96 | * <BL31_BASE> |
| 97 | * |
| 98 | * partition size: 140 KB |
| 99 | * |
| 100 | * content: |
| 101 | * |
| 102 | * BL31 |
| 103 | * |
| 104 | * <BL2_SIGNATURE_BASE> |
| 105 | * |
| 106 | * partition size: 4 KB |
| 107 | * |
| 108 | * content: |
| 109 | * |
| 110 | * MCUBOOT data needed to verify TF-A BL2 |
| 111 | * |
| 112 | * <BL2_BASE> |
| 113 | * |
| 114 | * partition size: 176 KB |
| 115 | * |
| 116 | * content: |
| 117 | * |
| 118 | * BL2 |
| 119 | * |
| 120 | * <ARM_NS_SHARED_RAM_BASE> = <ARM_TRUSTED_SRAM_BASE> + 1 MB |
| 121 | * |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 122 | * partition size: 512 KB |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 123 | * |
| 124 | * content: |
| 125 | * |
| 126 | * BL33 (u-boot) |
| 127 | */ |
| 128 | |
| 129 | /* DDR memory */ |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 130 | #define ARM_DRAM1_BASE UL(0x80000000) |
| 131 | #define ARM_DRAM1_SIZE (SZ_2G) /* 2GB*/ |
| 132 | #define ARM_DRAM1_END (ARM_DRAM1_BASE + \ |
| 133 | ARM_DRAM1_SIZE - 1) |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 134 | |
Vishnu Banavath | 2b651ea | 2022-01-19 18:43:12 +0000 | [diff] [blame] | 135 | /* DRAM1 and DRAM2 are the same for corstone1000 */ |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 136 | #define ARM_DRAM2_BASE ARM_DRAM1_BASE |
| 137 | #define ARM_DRAM2_SIZE ARM_DRAM1_SIZE |
| 138 | #define ARM_DRAM2_END ARM_DRAM1_END |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 139 | |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 140 | #define ARM_NS_DRAM1_BASE ARM_DRAM1_BASE |
| 141 | #define ARM_NS_DRAM1_SIZE ARM_DRAM1_SIZE |
| 142 | #define ARM_NS_DRAM1_END (ARM_NS_DRAM1_BASE +\ |
| 143 | ARM_NS_DRAM1_SIZE - 1) |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 144 | |
| 145 | /* The first 8 KB of Trusted SRAM are used as shared memory */ |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 146 | #define ARM_TRUSTED_SRAM_BASE UL(0x02000000) |
| 147 | #define ARM_SHARED_RAM_SIZE (SZ_8K) /* 8 KB */ |
| 148 | #define ARM_SHARED_RAM_BASE ARM_TRUSTED_SRAM_BASE |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 149 | |
| 150 | /* The remaining Trusted SRAM is used to load the BL images */ |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 151 | #define TOTAL_SRAM_SIZE (SZ_4M) /* 4 MB */ |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 152 | |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 153 | /* Last 512KB of CVM is allocated for shared RAM |
| 154 | * as an example openAMP */ |
| 155 | #define ARM_NS_SHARED_RAM_SIZE (512 * SZ_1K) |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 156 | |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 157 | #define PLAT_ARM_TRUSTED_SRAM_SIZE (TOTAL_SRAM_SIZE - \ |
| 158 | ARM_NS_SHARED_RAM_SIZE - \ |
| 159 | ARM_SHARED_RAM_SIZE) |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 160 | |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 161 | #define PLAT_ARM_MAX_BL2_SIZE (180 * SZ_1K) /* 180 KB */ |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 162 | |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 163 | #define PLAT_ARM_MAX_BL31_SIZE (140 * SZ_1K) /* 140 KB */ |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 164 | |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 165 | #define ARM_BL_RAM_BASE (ARM_SHARED_RAM_BASE + \ |
| 166 | ARM_SHARED_RAM_SIZE) |
| 167 | #define ARM_BL_RAM_SIZE (PLAT_ARM_TRUSTED_SRAM_SIZE - \ |
| 168 | ARM_SHARED_RAM_SIZE) |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 169 | |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 170 | #define BL2_SIGNATURE_SIZE (SZ_4K) /* 4 KB */ |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 171 | |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 172 | #define BL2_SIGNATURE_BASE (BL2_LIMIT - \ |
| 173 | PLAT_ARM_MAX_BL2_SIZE) |
| 174 | #define BL2_BASE (BL2_LIMIT - \ |
| 175 | PLAT_ARM_MAX_BL2_SIZE + \ |
| 176 | BL2_SIGNATURE_SIZE) |
| 177 | #define BL2_LIMIT (ARM_BL_RAM_BASE + \ |
| 178 | ARM_BL_RAM_SIZE) |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 179 | |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 180 | #define BL31_BASE (BL2_SIGNATURE_BASE - \ |
| 181 | PLAT_ARM_MAX_BL31_SIZE) |
| 182 | #define BL31_LIMIT BL2_SIGNATURE_BASE |
| 183 | |
| 184 | #define CORSTONE1000_TOS_FW_CONFIG_BASE (BL31_BASE - \ |
| 185 | CORSTONE1000_TOS_FW_CONFIG_SIZE) |
| 186 | #define CORSTONE1000_TOS_FW_CONFIG_SIZE (SZ_8K) /* 8 KB */ |
| 187 | #define CORSTONE1000_TOS_FW_CONFIG_LIMIT BL31_BASE |
| 188 | |
| 189 | #define BL32_BASE ARM_BL_RAM_BASE |
| 190 | #define PLAT_ARM_MAX_BL32_SIZE (CORSTONE1000_TOS_FW_CONFIG_BASE - \ |
| 191 | BL32_BASE) |
| 192 | |
| 193 | #define BL32_LIMIT (BL32_BASE + \ |
| 194 | PLAT_ARM_MAX_BL32_SIZE) |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 195 | |
| 196 | /* SPD_spmd settings */ |
| 197 | |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 198 | #define PLAT_ARM_SPMC_BASE BL32_BASE |
| 199 | #define PLAT_ARM_SPMC_SIZE PLAT_ARM_MAX_BL32_SIZE |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 200 | |
| 201 | /* NS memory */ |
| 202 | |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 203 | /* The last 512KB of the SRAM is allocated as shared memory */ |
| 204 | #define ARM_NS_SHARED_RAM_BASE (ARM_TRUSTED_SRAM_BASE + TOTAL_SRAM_SIZE - \ |
| 205 | (PLAT_ARM_MAX_BL31_SIZE + \ |
| 206 | PLAT_ARM_MAX_BL32_SIZE)) |
| 207 | |
| 208 | #define BL33_BASE ARM_DRAM1_BASE |
| 209 | #define PLAT_ARM_MAX_BL33_SIZE (12 * SZ_1M) /* 12 MB*/ |
| 210 | #define BL33_LIMIT (ARM_DRAM1_BASE + PLAT_ARM_MAX_BL33_SIZE) |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 211 | |
| 212 | /* end of the definition of SRAM memory layout */ |
| 213 | |
| 214 | /* NOR Flash */ |
| 215 | |
Satish Kumar | aa4a3af | 2021-10-27 16:31:04 +0100 | [diff] [blame^] | 216 | #define PLAT_ARM_BOOT_BANK_FLAG UL(0x08002000) |
| 217 | #define PLAT_ARM_FIP_BASE_BANK0 UL(0x081EF000) |
| 218 | #define PLAT_ARM_FIP_BASE_BANK1 UL(0x0916F000) |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 219 | #define PLAT_ARM_FIP_MAX_SIZE UL(0x1ff000) /* 1.996 MB */ |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 220 | |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 221 | #define PLAT_ARM_NVM_BASE V2M_FLASH0_BASE |
| 222 | #define PLAT_ARM_NVM_SIZE (SZ_32M) /* 32 MB */ |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 223 | |
Satish Kumar | aa4a3af | 2021-10-27 16:31:04 +0100 | [diff] [blame^] | 224 | #define PLAT_ARM_FLASH_IMAGE_BASE PLAT_ARM_FIP_BASE_BANK0 |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 225 | #define PLAT_ARM_FLASH_IMAGE_MAX_SIZE PLAT_ARM_FIP_MAX_SIZE |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 226 | |
| 227 | /* |
| 228 | * Some data must be aligned on the biggest cache line size in the platform. |
| 229 | * This is known only to the platform as it might have a combination of |
| 230 | * integrated and external caches. |
| 231 | */ |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 232 | #define CACHE_WRITEBACK_GRANULE (U(1) << ARM_CACHE_WRITEBACK_SHIFT) |
| 233 | #define ARM_CACHE_WRITEBACK_SHIFT 6 |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 234 | |
| 235 | /* |
| 236 | * Define FW_CONFIG area base and limit. Leave enough space for BL2 meminfo. |
| 237 | * FW_CONFIG is intended to host the device tree. Currently, This area is not |
Vishnu Banavath | 2b651ea | 2022-01-19 18:43:12 +0000 | [diff] [blame] | 238 | * used because corstone1000 platform doesn't use a device tree at TF-A level. |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 239 | */ |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 240 | #define ARM_FW_CONFIG_BASE (ARM_SHARED_RAM_BASE \ |
| 241 | + sizeof(meminfo_t)) |
| 242 | #define ARM_FW_CONFIG_LIMIT (ARM_SHARED_RAM_BASE \ |
| 243 | + (ARM_SHARED_RAM_SIZE >> 1)) |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 244 | |
| 245 | /* |
| 246 | * Boot parameters passed from BL2 to BL31/BL32 are stored here |
| 247 | */ |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 248 | #define ARM_BL2_MEM_DESC_BASE ARM_FW_CONFIG_LIMIT |
| 249 | #define ARM_BL2_MEM_DESC_LIMIT ARM_BL_RAM_BASE |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 250 | |
| 251 | /* |
| 252 | * The max number of regions like RO(code), coherent and data required by |
| 253 | * different BL stages which need to be mapped in the MMU. |
| 254 | */ |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 255 | #define ARM_BL_REGIONS 3 |
| 256 | #define PLAT_ARM_MMAP_ENTRIES 8 |
| 257 | #define MAX_XLAT_TABLES 5 |
| 258 | #define MAX_MMAP_REGIONS (PLAT_ARM_MMAP_ENTRIES + \ |
| 259 | ARM_BL_REGIONS) |
| 260 | #define MAX_IO_DEVICES 2 |
| 261 | #define MAX_IO_HANDLES 3 |
| 262 | #define MAX_IO_BLOCK_DEVICES 1 |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 263 | |
| 264 | /* GIC related constants */ |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 265 | #define PLAT_ARM_GICD_BASE 0x1C010000 |
| 266 | #define PLAT_ARM_GICC_BASE 0x1C02F000 |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 267 | |
| 268 | /* MHUv2 Secure Channel receiver and sender */ |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 269 | #define PLAT_SDK700_MHU0_SEND 0x1B800000 |
| 270 | #define PLAT_SDK700_MHU0_RECV 0x1B810000 |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 271 | |
| 272 | /* Timer/watchdog related constants */ |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 273 | #define ARM_SYS_CNTCTL_BASE UL(0x1a200000) |
| 274 | #define ARM_SYS_CNTREAD_BASE UL(0x1a210000) |
| 275 | #define ARM_SYS_TIMCTL_BASE UL(0x1a220000) |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 276 | |
Emekcan Aras | 53e91a3 | 2021-11-17 18:45:32 +0000 | [diff] [blame] | 277 | #define SECURE_WATCHDOG_ADDR_CTRL_REG 0x1A320000 |
| 278 | #define SECURE_WATCHDOG_ADDR_VAL_REG 0x1A320008 |
| 279 | #define SECURE_WATCHDOG_MASK_ENABLE 0x01 |
| 280 | #define SECURE_WATCHDOG_COUNTDOWN_VAL 0x1000 |
| 281 | |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 282 | #define SYS_COUNTER_FREQ_IN_TICKS UL(50000000) /* 50MHz */ |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 283 | |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 284 | #define CORSTONE1000_IRQ_TZ_WDOG 32 |
| 285 | #define CORSTONE1000_IRQ_SEC_SYS_TIMER 34 |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 286 | |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 287 | #define PLAT_MAX_PWR_LVL 2 |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 288 | /* |
| 289 | * Macros mapping the MPIDR Affinity levels to ARM Platform Power levels. The |
| 290 | * power levels have a 1:1 mapping with the MPIDR affinity levels. |
| 291 | */ |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 292 | #define ARM_PWR_LVL0 MPIDR_AFFLVL0 |
| 293 | #define ARM_PWR_LVL1 MPIDR_AFFLVL1 |
| 294 | #define ARM_PWR_LVL2 MPIDR_AFFLVL2 |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 295 | |
| 296 | /* |
| 297 | * Macros for local power states in ARM platforms encoded by State-ID field |
| 298 | * within the power-state parameter. |
| 299 | */ |
| 300 | /* Local power state for power domains in Run state. */ |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 301 | #define ARM_LOCAL_STATE_RUN U(0) |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 302 | /* Local power state for retention. Valid only for CPU power domains */ |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 303 | #define ARM_LOCAL_STATE_RET U(1) |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 304 | /* Local power state for OFF/power-down. Valid for CPU and cluster |
| 305 | * power domains |
| 306 | */ |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 307 | #define ARM_LOCAL_STATE_OFF U(2) |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 308 | |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 309 | #define PLAT_ARM_TRUSTED_MAILBOX_BASE ARM_TRUSTED_SRAM_BASE |
| 310 | #define PLAT_ARM_NSTIMER_FRAME_ID U(1) |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 311 | |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 312 | #define PLAT_ARM_NS_IMAGE_BASE (ARM_NS_SHARED_RAM_BASE) |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 313 | |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 314 | #define PLAT_PHY_ADDR_SPACE_SIZE (1ULL << 32) |
| 315 | #define PLAT_VIRT_ADDR_SPACE_SIZE (1ULL << 32) |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 316 | |
| 317 | /* |
| 318 | * This macro defines the deepest retention state possible. A higher state |
| 319 | * ID will represent an invalid or a power down state. |
| 320 | */ |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 321 | #define PLAT_MAX_RET_STATE 1 |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 322 | |
| 323 | /* |
| 324 | * This macro defines the deepest power down states possible. Any state ID |
| 325 | * higher than this is invalid. |
| 326 | */ |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 327 | #define PLAT_MAX_OFF_STATE 2 |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 328 | |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 329 | #define PLATFORM_STACK_SIZE UL(0x440) |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 330 | |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 331 | #define CORSTONE1000_EXTERNAL_FLASH MAP_REGION_FLAT( \ |
| 332 | PLAT_ARM_NVM_BASE, \ |
| 333 | PLAT_ARM_NVM_SIZE, \ |
| 334 | MT_DEVICE | MT_RO | MT_SECURE) |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 335 | |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 336 | #define ARM_MAP_SHARED_RAM MAP_REGION_FLAT( \ |
| 337 | ARM_SHARED_RAM_BASE, \ |
| 338 | ARM_SHARED_RAM_SIZE, \ |
| 339 | MT_MEMORY | MT_RW | MT_SECURE) |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 340 | |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 341 | #define ARM_MAP_NS_SHARED_RAM MAP_REGION_FLAT( \ |
| 342 | ARM_NS_SHARED_RAM_BASE, \ |
| 343 | ARM_NS_SHARED_RAM_SIZE, \ |
| 344 | MT_MEMORY | MT_RW | MT_NS) |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 345 | |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 346 | #define ARM_MAP_NS_DRAM1 MAP_REGION_FLAT( \ |
| 347 | ARM_NS_DRAM1_BASE, \ |
| 348 | ARM_NS_DRAM1_SIZE, \ |
| 349 | MT_MEMORY | MT_RW | MT_NS) |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 350 | |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 351 | #define ARM_MAP_BL_RO MAP_REGION_FLAT( \ |
| 352 | BL_CODE_BASE, \ |
| 353 | BL_CODE_END \ |
| 354 | - BL_CODE_BASE, \ |
| 355 | MT_CODE | MT_SECURE), \ |
| 356 | MAP_REGION_FLAT( \ |
| 357 | BL_RO_DATA_BASE, \ |
| 358 | BL_RO_DATA_END \ |
| 359 | - BL_RO_DATA_BASE, \ |
| 360 | MT_RO_DATA | MT_SECURE) |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 361 | #if USE_COHERENT_MEM |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 362 | #define ARM_MAP_BL_COHERENT_RAM MAP_REGION_FLAT( \ |
| 363 | BL_COHERENT_RAM_BASE, \ |
| 364 | BL_COHERENT_RAM_END \ |
| 365 | - BL_COHERENT_RAM_BASE, \ |
| 366 | MT_DEVICE | MT_RW | MT_SECURE) |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 367 | #endif |
| 368 | |
| 369 | /* |
| 370 | * Map the region for the optional device tree configuration with read and |
| 371 | * write permissions |
| 372 | */ |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 373 | #define ARM_MAP_BL_CONFIG_REGION MAP_REGION_FLAT( \ |
| 374 | ARM_FW_CONFIG_BASE, \ |
| 375 | (ARM_FW_CONFIG_LIMIT- \ |
| 376 | ARM_FW_CONFIG_BASE), \ |
| 377 | MT_MEMORY | MT_RW | MT_SECURE) |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 378 | |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 379 | #define CORSTONE1000_DEVICE_BASE (0x1A000000) |
| 380 | #define CORSTONE1000_DEVICE_SIZE (0x26000000) |
| 381 | #define CORSTONE1000_MAP_DEVICE MAP_REGION_FLAT( \ |
| 382 | CORSTONE1000_DEVICE_BASE, \ |
| 383 | CORSTONE1000_DEVICE_SIZE, \ |
| 384 | MT_DEVICE | MT_RW | MT_SECURE) |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 385 | |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 386 | #define ARM_IRQ_SEC_PHY_TIMER 29 |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 387 | |
Arpita S.K | 639f7b7 | 2021-10-13 14:49:26 +0530 | [diff] [blame] | 388 | #define ARM_IRQ_SEC_SGI_0 8 |
| 389 | #define ARM_IRQ_SEC_SGI_1 9 |
| 390 | #define ARM_IRQ_SEC_SGI_2 10 |
| 391 | #define ARM_IRQ_SEC_SGI_3 11 |
| 392 | #define ARM_IRQ_SEC_SGI_4 12 |
| 393 | #define ARM_IRQ_SEC_SGI_5 13 |
| 394 | #define ARM_IRQ_SEC_SGI_6 14 |
| 395 | #define ARM_IRQ_SEC_SGI_7 15 |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 396 | |
| 397 | /* |
| 398 | * Define a list of Group 1 Secure and Group 0 interrupt properties as per GICv3 |
| 399 | * terminology. On a GICv2 system or mode, the lists will be merged and treated |
| 400 | * as Group 0 interrupts. |
| 401 | */ |
| 402 | #define ARM_G1S_IRQ_PROPS(grp) \ |
| 403 | INTR_PROP_DESC(ARM_IRQ_SEC_PHY_TIMER, GIC_HIGHEST_SEC_PRIORITY, \ |
| 404 | (grp), GIC_INTR_CFG_LEVEL), \ |
| 405 | INTR_PROP_DESC(ARM_IRQ_SEC_SGI_1, GIC_HIGHEST_SEC_PRIORITY, \ |
| 406 | (grp), GIC_INTR_CFG_EDGE), \ |
| 407 | INTR_PROP_DESC(ARM_IRQ_SEC_SGI_2, GIC_HIGHEST_SEC_PRIORITY, \ |
| 408 | (grp), GIC_INTR_CFG_EDGE), \ |
| 409 | INTR_PROP_DESC(ARM_IRQ_SEC_SGI_3, GIC_HIGHEST_SEC_PRIORITY, \ |
| 410 | (grp), GIC_INTR_CFG_EDGE), \ |
| 411 | INTR_PROP_DESC(ARM_IRQ_SEC_SGI_4, GIC_HIGHEST_SEC_PRIORITY, \ |
| 412 | (grp), GIC_INTR_CFG_EDGE), \ |
| 413 | INTR_PROP_DESC(ARM_IRQ_SEC_SGI_5, GIC_HIGHEST_SEC_PRIORITY, \ |
| 414 | (grp), GIC_INTR_CFG_EDGE), \ |
| 415 | INTR_PROP_DESC(ARM_IRQ_SEC_SGI_7, GIC_HIGHEST_SEC_PRIORITY, \ |
| 416 | (grp), GIC_INTR_CFG_EDGE) |
| 417 | |
| 418 | #define ARM_G0_IRQ_PROPS(grp) \ |
| 419 | INTR_PROP_DESC(ARM_IRQ_SEC_SGI_6, GIC_HIGHEST_SEC_PRIORITY, (grp), \ |
| 420 | GIC_INTR_CFG_EDGE) |
| 421 | |
| 422 | /* |
| 423 | * Define a list of Group 1 Secure and Group 0 interrupts as per GICv3 |
| 424 | * terminology. On a GICv2 system or mode, the lists will be merged and treated |
| 425 | * as Group 0 interrupts. |
| 426 | */ |
| 427 | #define PLAT_ARM_G1S_IRQ_PROPS(grp) \ |
| 428 | ARM_G1S_IRQ_PROPS(grp), \ |
Vishnu Banavath | 2b651ea | 2022-01-19 18:43:12 +0000 | [diff] [blame] | 429 | INTR_PROP_DESC(CORSTONE1000_IRQ_TZ_WDOG, GIC_HIGHEST_SEC_PRIORITY, \ |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 430 | (grp), GIC_INTR_CFG_LEVEL), \ |
Vishnu Banavath | 2b651ea | 2022-01-19 18:43:12 +0000 | [diff] [blame] | 431 | INTR_PROP_DESC(CORSTONE1000_IRQ_SEC_SYS_TIMER, \ |
Abdellatif El Khlifi | ad9b8e5 | 2021-04-21 17:20:43 +0100 | [diff] [blame] | 432 | GIC_HIGHEST_SEC_PRIORITY, (grp), GIC_INTR_CFG_LEVEL) |
| 433 | |
| 434 | #define PLAT_ARM_G0_IRQ_PROPS(grp) ARM_G0_IRQ_PROPS(grp) |
| 435 | |
| 436 | #endif /* PLATFORM_DEF_H */ |