Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: BSD-3-Clause |
| 2 | * |
Masahisa Kojima | 099064b | 2020-06-11 21:46:44 +0900 | [diff] [blame] | 3 | * Copyright (c) 2019-2020, Linaro Limited and Contributors. |
| 4 | * All rights reserved. |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 5 | */ |
| 6 | |
Masahisa Kojima | 099064b | 2020-06-11 21:46:44 +0900 | [diff] [blame] | 7 | #ifndef PLATFORM_DEF_H |
| 8 | #define PLATFORM_DEF_H |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 9 | |
| 10 | #include <arch.h> |
| 11 | #include <plat/common/common_def.h> |
| 12 | #include <tbbr_img_def.h> |
| 13 | |
| 14 | /* Special value used to verify platform parameters from BL2 to BL3-1 */ |
| 15 | #define QEMU_BL31_PLAT_PARAM_VAL 0x0f1e2d3c4b5a6978ULL |
| 16 | |
| 17 | #define PLATFORM_STACK_SIZE 0x1000 |
| 18 | |
Graeme Gregory | 10e9223 | 2020-08-28 16:37:02 +0100 | [diff] [blame] | 19 | #define PLATFORM_MAX_CPUS_PER_CLUSTER U(8) |
Graeme Gregory | 0a15c7f | 2020-12-16 14:13:07 +0000 | [diff] [blame] | 20 | /* |
| 21 | * Define the number of cores per cluster used in calculating core position. |
| 22 | * The cluster number is shifted by this value and added to the core ID, |
| 23 | * so its value represents log2(cores/cluster). |
Graeme Gregory | 10e9223 | 2020-08-28 16:37:02 +0100 | [diff] [blame] | 24 | * Default is 2**(3) = 8 cores per cluster. |
Graeme Gregory | 0a15c7f | 2020-12-16 14:13:07 +0000 | [diff] [blame] | 25 | */ |
Graeme Gregory | 10e9223 | 2020-08-28 16:37:02 +0100 | [diff] [blame] | 26 | #define PLATFORM_CPU_PER_CLUSTER_SHIFT U(3) |
| 27 | #define PLATFORM_CLUSTER_COUNT U(64) |
| 28 | #define PLATFORM_CORE_COUNT (PLATFORM_CLUSTER_COUNT * \ |
| 29 | PLATFORM_MAX_CPUS_PER_CLUSTER) |
Deepika Bhavnani | 9b27dfb | 2019-12-13 10:52:14 -0600 | [diff] [blame] | 30 | #define QEMU_PRIMARY_CPU U(0) |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 31 | |
| 32 | #define PLAT_NUM_PWR_DOMAINS (PLATFORM_CLUSTER_COUNT + \ |
| 33 | PLATFORM_CORE_COUNT) |
| 34 | #define PLAT_MAX_PWR_LVL MPIDR_AFFLVL1 |
| 35 | |
| 36 | #define PLAT_MAX_RET_STATE 1 |
| 37 | #define PLAT_MAX_OFF_STATE 2 |
| 38 | |
| 39 | /* Local power state for power domains in Run state. */ |
| 40 | #define PLAT_LOCAL_STATE_RUN 0 |
| 41 | /* Local power state for retention. Valid only for CPU power domains */ |
| 42 | #define PLAT_LOCAL_STATE_RET 1 |
| 43 | /* |
| 44 | * Local power state for OFF/power-down. Valid for CPU and cluster power |
| 45 | * domains. |
| 46 | */ |
| 47 | #define PLAT_LOCAL_STATE_OFF 2 |
| 48 | |
| 49 | /* |
| 50 | * Macros used to parse state information from State-ID if it is using the |
| 51 | * recommended encoding for State-ID. |
| 52 | */ |
| 53 | #define PLAT_LOCAL_PSTATE_WIDTH 4 |
| 54 | #define PLAT_LOCAL_PSTATE_MASK ((1 << PLAT_LOCAL_PSTATE_WIDTH) - 1) |
| 55 | |
| 56 | /* |
| 57 | * Some data must be aligned on the biggest cache line size in the platform. |
| 58 | * This is known only to the platform as it might have a combination of |
| 59 | * integrated and external caches. |
| 60 | */ |
| 61 | #define CACHE_WRITEBACK_SHIFT 6 |
| 62 | #define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT) |
| 63 | |
| 64 | /* |
Xiong Yining | 1f6f01d | 2024-01-12 10:47:03 +0000 | [diff] [blame] | 65 | * Define the max number of memory nodes. |
| 66 | */ |
| 67 | #define PLAT_MAX_MEM_NODES 128 |
| 68 | |
| 69 | /* |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 70 | * Partition memory into secure ROM, non-secure DRAM, secure "SRAM", |
| 71 | * and secure DRAM. |
| 72 | */ |
| 73 | #define SEC_ROM_BASE 0x00000000 |
| 74 | #define SEC_ROM_SIZE 0x00020000 |
| 75 | |
| 76 | #define NS_DRAM0_BASE 0x10000000000ULL |
| 77 | #define NS_DRAM0_SIZE 0x00020000000 |
| 78 | |
| 79 | #define SEC_SRAM_BASE 0x20000000 |
| 80 | #define SEC_SRAM_SIZE 0x20000000 |
| 81 | |
| 82 | /* |
| 83 | * RAD just placeholders, need to be chosen after finalizing mem map |
| 84 | */ |
| 85 | #define SEC_DRAM_BASE 0x1000 |
| 86 | #define SEC_DRAM_SIZE 0x1000 |
| 87 | |
| 88 | /* Load pageable part of OP-TEE 2MB above secure DRAM base */ |
| 89 | #define QEMU_OPTEE_PAGEABLE_LOAD_BASE (SEC_DRAM_BASE + 0x00200000) |
| 90 | #define QEMU_OPTEE_PAGEABLE_LOAD_SIZE 0x00400000 |
| 91 | |
| 92 | /* |
| 93 | * ARM-TF lives in SRAM, partition it here |
| 94 | */ |
| 95 | |
| 96 | #define SHARED_RAM_BASE SEC_SRAM_BASE |
Masato Fukumori | 0a4fac8 | 2020-12-01 22:17:27 +0900 | [diff] [blame] | 97 | #define SHARED_RAM_SIZE 0x00002000 |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 98 | |
| 99 | #define PLAT_QEMU_TRUSTED_MAILBOX_BASE SHARED_RAM_BASE |
| 100 | #define PLAT_QEMU_TRUSTED_MAILBOX_SIZE (8 + PLAT_QEMU_HOLD_SIZE) |
| 101 | #define PLAT_QEMU_HOLD_BASE (PLAT_QEMU_TRUSTED_MAILBOX_BASE + 8) |
| 102 | #define PLAT_QEMU_HOLD_SIZE (PLATFORM_CORE_COUNT * \ |
| 103 | PLAT_QEMU_HOLD_ENTRY_SIZE) |
| 104 | #define PLAT_QEMU_HOLD_ENTRY_SHIFT 3 |
| 105 | #define PLAT_QEMU_HOLD_ENTRY_SIZE (1 << PLAT_QEMU_HOLD_ENTRY_SHIFT) |
| 106 | #define PLAT_QEMU_HOLD_STATE_WAIT 0 |
| 107 | #define PLAT_QEMU_HOLD_STATE_GO 1 |
| 108 | |
| 109 | #define BL_RAM_BASE (SHARED_RAM_BASE + SHARED_RAM_SIZE) |
| 110 | #define BL_RAM_SIZE (SEC_SRAM_SIZE - SHARED_RAM_SIZE) |
| 111 | |
| 112 | /* |
| 113 | * BL1 specific defines. |
| 114 | * |
| 115 | * BL1 RW data is relocated from ROM to RAM at runtime so we need 2 sets of |
| 116 | * addresses. |
| 117 | * Put BL1 RW at the top of the Secure SRAM. BL1_RW_BASE is calculated using |
| 118 | * the current BL1 RW debug size plus a little space for growth. |
| 119 | */ |
Masahisa Kojima | 099064b | 2020-06-11 21:46:44 +0900 | [diff] [blame] | 120 | #define BL1_SIZE 0x12000 |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 121 | #define BL1_RO_BASE SEC_ROM_BASE |
| 122 | #define BL1_RO_LIMIT (SEC_ROM_BASE + SEC_ROM_SIZE) |
Masahisa Kojima | 099064b | 2020-06-11 21:46:44 +0900 | [diff] [blame] | 123 | #define BL1_RW_BASE (BL1_RW_LIMIT - BL1_SIZE) |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 124 | #define BL1_RW_LIMIT (BL_RAM_BASE + BL_RAM_SIZE) |
| 125 | |
| 126 | /* |
| 127 | * BL2 specific defines. |
| 128 | * |
| 129 | * Put BL2 just below BL3-1. BL2_BASE is calculated using the current BL2 debug |
| 130 | * size plus a little space for growth. |
| 131 | */ |
Masahisa Kojima | 099064b | 2020-06-11 21:46:44 +0900 | [diff] [blame] | 132 | #define BL2_SIZE 0x1D000 |
| 133 | #define BL2_BASE (BL31_BASE - BL2_SIZE) |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 134 | #define BL2_LIMIT BL31_BASE |
| 135 | |
| 136 | /* |
| 137 | * BL3-1 specific defines. |
| 138 | * |
| 139 | * Put BL3-1 at the top of the Trusted SRAM. BL31_BASE is calculated using the |
| 140 | * current BL3-1 debug size plus a little space for growth. |
| 141 | */ |
Graeme Gregory | 10e9223 | 2020-08-28 16:37:02 +0100 | [diff] [blame] | 142 | #define BL31_SIZE 0x300000 |
Masahisa Kojima | 099064b | 2020-06-11 21:46:44 +0900 | [diff] [blame] | 143 | #define BL31_BASE (BL31_LIMIT - BL31_SIZE) |
| 144 | #define BL31_LIMIT (BL1_RW_BASE) |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 145 | #define BL31_PROGBITS_LIMIT BL1_RW_BASE |
| 146 | |
| 147 | |
| 148 | /* |
| 149 | * BL3-2 specific defines. |
| 150 | * |
| 151 | * BL3-2 can execute from Secure SRAM, or Secure DRAM. |
| 152 | */ |
| 153 | #define BL32_SRAM_BASE BL_RAM_BASE |
Masahisa Kojima | 099064b | 2020-06-11 21:46:44 +0900 | [diff] [blame] | 154 | #define BL32_SRAM_LIMIT BL2_BASE |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 155 | |
| 156 | #define BL32_MEM_BASE BL_RAM_BASE |
Masahisa Kojima | 099064b | 2020-06-11 21:46:44 +0900 | [diff] [blame] | 157 | #define BL32_MEM_SIZE (BL_RAM_SIZE - BL1_SIZE - \ |
| 158 | BL2_SIZE - BL31_SIZE) |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 159 | #define BL32_BASE BL32_SRAM_BASE |
| 160 | #define BL32_LIMIT BL32_SRAM_LIMIT |
| 161 | |
| 162 | #define NS_IMAGE_OFFSET (NS_DRAM0_BASE + 0x20000000) |
| 163 | #define NS_IMAGE_MAX_SIZE (NS_DRAM0_SIZE - 0x20000000) |
| 164 | |
| 165 | #define PLAT_PHY_ADDR_SPACE_SIZE (1ull << 42) |
| 166 | #define PLAT_VIRT_ADDR_SPACE_SIZE (1ull << 42) |
Masahisa Kojima | 099064b | 2020-06-11 21:46:44 +0900 | [diff] [blame] | 167 | #if SPM_MM |
| 168 | #define MAX_MMAP_REGIONS 12 |
Graeme Gregory | 1a73223 | 2020-08-28 18:03:35 +0100 | [diff] [blame] | 169 | #define MAX_XLAT_TABLES 12 |
Masahisa Kojima | 099064b | 2020-06-11 21:46:44 +0900 | [diff] [blame] | 170 | #else |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 171 | #define MAX_MMAP_REGIONS 11 |
Graeme Gregory | 1a73223 | 2020-08-28 18:03:35 +0100 | [diff] [blame] | 172 | #define MAX_XLAT_TABLES 11 |
Masahisa Kojima | 099064b | 2020-06-11 21:46:44 +0900 | [diff] [blame] | 173 | #endif |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 174 | #define MAX_IO_DEVICES 3 |
| 175 | #define MAX_IO_HANDLES 4 |
| 176 | |
Masahisa Kojima | 099064b | 2020-06-11 21:46:44 +0900 | [diff] [blame] | 177 | #if SPM_MM && defined(IMAGE_BL31) |
| 178 | # define PLAT_SP_IMAGE_MMAP_REGIONS 30 |
Masahisa Kojima | 617f749 | 2021-02-02 16:00:27 +0900 | [diff] [blame] | 179 | # define PLAT_SP_IMAGE_MAX_XLAT_TABLES 50 |
Masahisa Kojima | 099064b | 2020-06-11 21:46:44 +0900 | [diff] [blame] | 180 | #endif |
| 181 | |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 182 | /* |
| 183 | * PL011 related constants |
| 184 | */ |
| 185 | #define UART0_BASE 0x60000000 |
| 186 | #define UART1_BASE 0x60030000 |
| 187 | #define UART0_CLK_IN_HZ 1 |
| 188 | #define UART1_CLK_IN_HZ 1 |
| 189 | |
Masahisa Kojima | 099064b | 2020-06-11 21:46:44 +0900 | [diff] [blame] | 190 | /* Secure UART */ |
| 191 | #define UART2_BASE 0x60040000 |
| 192 | #define UART2_CLK_IN_HZ 1 |
| 193 | |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 194 | #define PLAT_QEMU_BOOT_UART_BASE UART0_BASE |
| 195 | #define PLAT_QEMU_BOOT_UART_CLK_IN_HZ UART0_CLK_IN_HZ |
| 196 | |
| 197 | #define PLAT_QEMU_CRASH_UART_BASE UART1_BASE |
| 198 | #define PLAT_QEMU_CRASH_UART_CLK_IN_HZ UART1_CLK_IN_HZ |
| 199 | |
| 200 | #define PLAT_QEMU_CONSOLE_BAUDRATE 115200 |
| 201 | |
| 202 | #define QEMU_FLASH0_BASE 0x00000000 |
| 203 | #define QEMU_FLASH0_SIZE 0x10000000 |
| 204 | #define QEMU_FLASH1_BASE 0x10000000 |
| 205 | #define QEMU_FLASH1_SIZE 0x10000000 |
| 206 | |
Marcin Juszkiewicz | 405bfb9 | 2023-09-18 12:47:45 +0200 | [diff] [blame] | 207 | #define PLAT_QEMU_FIP_BASE BL1_SIZE |
Masahisa Kojima | 099064b | 2020-06-11 21:46:44 +0900 | [diff] [blame] | 208 | #define PLAT_QEMU_FIP_MAX_SIZE 0x00400000 |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 209 | |
| 210 | /* This is map from GIC_DIST up to last CPU (255) GIC_REDISTR */ |
| 211 | #define DEVICE0_BASE 0x40000000 |
| 212 | #define DEVICE0_SIZE 0x04080000 |
| 213 | /* This is map from NORMAL_UART up to SECURE_UART_MM */ |
| 214 | #define DEVICE1_BASE 0x60000000 |
Graeme Gregory | 1a73223 | 2020-08-28 18:03:35 +0100 | [diff] [blame] | 215 | #define DEVICE1_SIZE 0x10041000 |
| 216 | /* This is a map for SECURE_EC */ |
| 217 | #define DEVICE2_BASE 0x50000000 |
| 218 | #define DEVICE2_SIZE 0x00001000 |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 219 | |
| 220 | /* |
| 221 | * GIC related constants |
| 222 | * We use GICv3 where CPU Interface registers are not memory mapped |
Marcin Juszkiewicz | 79ee1c4 | 2023-05-15 11:07:54 +0200 | [diff] [blame] | 223 | * |
| 224 | * Legacy values - on platform version 0.1+ they are read from DT |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 225 | */ |
| 226 | #define GICD_BASE 0x40060000 |
| 227 | #define GICR_BASE 0x40080000 |
| 228 | #define GICC_BASE 0x0 |
| 229 | |
| 230 | #define QEMU_IRQ_SEC_SGI_0 8 |
| 231 | #define QEMU_IRQ_SEC_SGI_1 9 |
| 232 | #define QEMU_IRQ_SEC_SGI_2 10 |
| 233 | #define QEMU_IRQ_SEC_SGI_3 11 |
| 234 | #define QEMU_IRQ_SEC_SGI_4 12 |
| 235 | #define QEMU_IRQ_SEC_SGI_5 13 |
| 236 | #define QEMU_IRQ_SEC_SGI_6 14 |
| 237 | #define QEMU_IRQ_SEC_SGI_7 15 |
| 238 | |
| 239 | /****************************************************************************** |
| 240 | * On a GICv2 system, the Group 1 secure interrupts are treated as Group 0 |
| 241 | * interrupts. |
| 242 | *****************************************************************************/ |
| 243 | #define PLATFORM_G1S_PROPS(grp) \ |
| 244 | INTR_PROP_DESC(QEMU_IRQ_SEC_SGI_0, GIC_HIGHEST_SEC_PRIORITY, \ |
| 245 | grp, GIC_INTR_CFG_EDGE), \ |
| 246 | INTR_PROP_DESC(QEMU_IRQ_SEC_SGI_1, GIC_HIGHEST_SEC_PRIORITY, \ |
| 247 | grp, GIC_INTR_CFG_EDGE), \ |
| 248 | INTR_PROP_DESC(QEMU_IRQ_SEC_SGI_2, GIC_HIGHEST_SEC_PRIORITY, \ |
| 249 | grp, GIC_INTR_CFG_EDGE), \ |
| 250 | INTR_PROP_DESC(QEMU_IRQ_SEC_SGI_3, GIC_HIGHEST_SEC_PRIORITY, \ |
| 251 | grp, GIC_INTR_CFG_EDGE), \ |
| 252 | INTR_PROP_DESC(QEMU_IRQ_SEC_SGI_4, GIC_HIGHEST_SEC_PRIORITY, \ |
| 253 | grp, GIC_INTR_CFG_EDGE), \ |
| 254 | INTR_PROP_DESC(QEMU_IRQ_SEC_SGI_5, GIC_HIGHEST_SEC_PRIORITY, \ |
| 255 | grp, GIC_INTR_CFG_EDGE), \ |
| 256 | INTR_PROP_DESC(QEMU_IRQ_SEC_SGI_6, GIC_HIGHEST_SEC_PRIORITY, \ |
| 257 | grp, GIC_INTR_CFG_EDGE), \ |
| 258 | INTR_PROP_DESC(QEMU_IRQ_SEC_SGI_7, GIC_HIGHEST_SEC_PRIORITY, \ |
| 259 | grp, GIC_INTR_CFG_EDGE) |
| 260 | |
| 261 | #define PLATFORM_G0_PROPS(grp) |
| 262 | |
| 263 | /* |
| 264 | * DT related constants |
| 265 | */ |
| 266 | #define PLAT_QEMU_DT_BASE NS_DRAM0_BASE |
Masahisa Kojima | cbeb7e5 | 2020-05-19 19:49:36 +0900 | [diff] [blame] | 267 | #define PLAT_QEMU_DT_MAX_SIZE 0x100000 |
Radoslaw Biernacki | 1201aba | 2018-05-17 22:52:49 +0200 | [diff] [blame] | 268 | |
| 269 | /* |
| 270 | * System counter |
| 271 | */ |
| 272 | #define SYS_COUNTER_FREQ_IN_TICKS ((1000 * 1000 * 1000) / 16) |
| 273 | |
Masahisa Kojima | 099064b | 2020-06-11 21:46:44 +0900 | [diff] [blame] | 274 | #if SPM_MM |
| 275 | #define PLAT_QEMU_SP_IMAGE_BASE BL_RAM_BASE |
| 276 | #define PLAT_QEMU_SP_IMAGE_SIZE ULL(0x300000) |
| 277 | |
| 278 | #ifdef IMAGE_BL2 |
| 279 | /* In BL2 all memory allocated to the SPM Payload image is marked as RW. */ |
| 280 | # define QEMU_SP_IMAGE_MMAP MAP_REGION_FLAT( \ |
| 281 | PLAT_QEMU_SP_IMAGE_BASE, \ |
| 282 | PLAT_QEMU_SP_IMAGE_SIZE, \ |
| 283 | MT_MEMORY | MT_RW | \ |
| 284 | MT_SECURE) |
| 285 | #elif IMAGE_BL31 |
| 286 | /* All SPM Payload memory is marked as code in S-EL0 */ |
| 287 | # define QEMU_SP_IMAGE_MMAP MAP_REGION2(PLAT_QEMU_SP_IMAGE_BASE, \ |
| 288 | PLAT_QEMU_SP_IMAGE_BASE, \ |
| 289 | PLAT_QEMU_SP_IMAGE_SIZE, \ |
| 290 | MT_CODE | MT_SECURE | \ |
| 291 | MT_USER, \ |
| 292 | PAGE_SIZE) |
| 293 | #endif |
| 294 | |
| 295 | /* |
| 296 | * EL3 -> S-EL0 secure shared memory |
| 297 | */ |
| 298 | #define PLAT_SPM_BUF_PCPU_SIZE ULL(0x10000) |
| 299 | #define PLAT_SPM_BUF_SIZE (PLATFORM_CORE_COUNT * \ |
| 300 | PLAT_SPM_BUF_PCPU_SIZE) |
| 301 | #define PLAT_SPM_BUF_BASE (BL32_LIMIT - PLAT_SPM_BUF_SIZE) |
| 302 | |
| 303 | #define QEMU_SPM_BUF_EL3_MMAP MAP_REGION_FLAT(PLAT_SPM_BUF_BASE, \ |
| 304 | PLAT_SPM_BUF_SIZE, \ |
| 305 | MT_RW_DATA | MT_SECURE) |
| 306 | |
| 307 | #define QEMU_SPM_BUF_EL0_MMAP MAP_REGION2(PLAT_SPM_BUF_BASE, \ |
| 308 | PLAT_SPM_BUF_BASE, \ |
| 309 | PLAT_SPM_BUF_SIZE, \ |
| 310 | MT_RO_DATA | MT_SECURE | \ |
| 311 | MT_USER, \ |
| 312 | PAGE_SIZE) |
| 313 | |
| 314 | /* |
| 315 | * Shared memory between Normal world and S-EL0 for |
| 316 | * passing data during service requests. It will be marked as RW and NS. |
Masahisa Kojima | 7e917dc | 2020-09-23 16:52:59 +0900 | [diff] [blame] | 317 | * This buffer is allocated at the top of NS_DRAM, the base address is |
| 318 | * overridden in SPM initialization. |
Masahisa Kojima | 099064b | 2020-06-11 21:46:44 +0900 | [diff] [blame] | 319 | */ |
| 320 | #define PLAT_QEMU_SP_IMAGE_NS_BUF_BASE (PLAT_QEMU_DT_BASE + \ |
| 321 | PLAT_QEMU_DT_MAX_SIZE) |
Masahisa Kojima | 7e917dc | 2020-09-23 16:52:59 +0900 | [diff] [blame] | 322 | #define PLAT_QEMU_SP_IMAGE_NS_BUF_SIZE ULL(0x200000) |
| 323 | |
Masahisa Kojima | 099064b | 2020-06-11 21:46:44 +0900 | [diff] [blame] | 324 | #define QEMU_SP_IMAGE_NS_BUF_MMAP MAP_REGION2( \ |
| 325 | PLAT_QEMU_SP_IMAGE_NS_BUF_BASE, \ |
| 326 | PLAT_QEMU_SP_IMAGE_NS_BUF_BASE, \ |
| 327 | PLAT_QEMU_SP_IMAGE_NS_BUF_SIZE, \ |
| 328 | MT_RW_DATA | MT_NS | \ |
| 329 | MT_USER, \ |
| 330 | PAGE_SIZE) |
| 331 | |
| 332 | #define PLAT_SP_IMAGE_NS_BUF_BASE PLAT_QEMU_SP_IMAGE_NS_BUF_BASE |
| 333 | #define PLAT_SP_IMAGE_NS_BUF_SIZE PLAT_QEMU_SP_IMAGE_NS_BUF_SIZE |
| 334 | |
| 335 | #define PLAT_QEMU_SP_IMAGE_HEAP_BASE (PLAT_QEMU_SP_IMAGE_BASE + \ |
| 336 | PLAT_QEMU_SP_IMAGE_SIZE) |
| 337 | #define PLAT_QEMU_SP_IMAGE_HEAP_SIZE ULL(0x800000) |
| 338 | |
| 339 | #define PLAT_SP_IMAGE_STACK_BASE (PLAT_QEMU_SP_IMAGE_HEAP_BASE + \ |
| 340 | PLAT_QEMU_SP_IMAGE_HEAP_SIZE) |
| 341 | #define PLAT_SP_IMAGE_STACK_PCPU_SIZE ULL(0x10000) |
| 342 | #define QEMU_SP_IMAGE_STACK_TOTAL_SIZE (PLATFORM_CORE_COUNT * \ |
| 343 | PLAT_SP_IMAGE_STACK_PCPU_SIZE) |
| 344 | |
| 345 | #define QEMU_SP_IMAGE_RW_MMAP MAP_REGION2( \ |
| 346 | PLAT_QEMU_SP_IMAGE_HEAP_BASE, \ |
| 347 | PLAT_QEMU_SP_IMAGE_HEAP_BASE, \ |
| 348 | (QEMU_SP_IMAGE_STACK_TOTAL_SIZE + \ |
| 349 | PLAT_QEMU_SP_IMAGE_HEAP_SIZE), \ |
| 350 | MT_RW_DATA | MT_SECURE | \ |
| 351 | MT_USER, \ |
| 352 | PAGE_SIZE) |
| 353 | |
Masahisa Kojima | 7e917dc | 2020-09-23 16:52:59 +0900 | [diff] [blame] | 354 | /* |
| 355 | * Secure variable storage is located at Secure Flash. |
| 356 | */ |
| 357 | #if SPM_MM |
| 358 | #define QEMU_SECURE_VARSTORE_BASE 0x01000000 |
| 359 | #define QEMU_SECURE_VARSTORE_SIZE 0x00100000 |
| 360 | #define MAP_SECURE_VARSTORE MAP_REGION_FLAT( \ |
| 361 | QEMU_SECURE_VARSTORE_BASE, \ |
| 362 | QEMU_SECURE_VARSTORE_SIZE, \ |
Masahisa Kojima | dc358b2 | 2021-03-01 15:47:47 +0900 | [diff] [blame] | 363 | MT_DEVICE | MT_RW | \ |
Masahisa Kojima | 7e917dc | 2020-09-23 16:52:59 +0900 | [diff] [blame] | 364 | MT_SECURE | MT_USER) |
| 365 | #endif |
| 366 | |
Masahisa Kojima | 099064b | 2020-06-11 21:46:44 +0900 | [diff] [blame] | 367 | /* Total number of memory regions with distinct properties */ |
| 368 | #define PLAT_QEMU_SP_IMAGE_NUM_MEM_REGIONS 6 |
| 369 | |
| 370 | /* |
| 371 | * Name of the section to put the translation tables used by the S-EL1/S-EL0 |
| 372 | * context of a Secure Partition. |
| 373 | */ |
Chris Kay | 33bfc5e | 2023-02-14 11:30:04 +0000 | [diff] [blame] | 374 | #define PLAT_SP_IMAGE_XLAT_SECTION_NAME ".qemu_sp_xlat_table" |
| 375 | #define PLAT_SP_IMAGE_BASE_XLAT_SECTION_NAME ".qemu_sp_xlat_table" |
Masahisa Kojima | 099064b | 2020-06-11 21:46:44 +0900 | [diff] [blame] | 376 | |
| 377 | /* Cookies passed to the Secure Partition at boot. Not used by QEMU platforms.*/ |
| 378 | #define PLAT_SPM_COOKIE_0 ULL(0) |
| 379 | #define PLAT_SPM_COOKIE_1 ULL(0) |
| 380 | #endif |
| 381 | |
| 382 | #define QEMU_PRI_BITS 2 |
| 383 | #define PLAT_SP_PRI 0x20 |
| 384 | |
| 385 | #endif /* PLATFORM_DEF_H */ |